Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add type checking to items expression #69

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .storybook/decorators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import {
DEFAULT_VALIDATOR_PLUGINS,
sleep,
} from '@/tests/sharedUtils';
import {VariableDefinition, createTypeCheck} from '@/utils/jsonlogic';

import static_variables from '../src/components/static_variables.json';

export const ModalDecorator: Decorator = (Story, {parameters}) => {
if (parameters?.modal?.noModal) return <Story />;
Expand Down Expand Up @@ -55,6 +58,8 @@ export const BuilderContextDecorator: Decorator = (Story, context) => {
const defaultFileTypes = context.parameters.builder?.defaultFileTypes || DEFAULT_FILE_TYPES;
const defaultdocumentTypes =
context.parameters.builder?.defaultdocumentTypes || DEFAULT_DOCUMENT_TYPES;
const components = context?.args?.componentTree || defaultComponentTree;
const staticVariables = static_variables as VariableDefinition[]; // source is inferred as string not as ""

return (
<BuilderContext.Provider
Expand All @@ -63,7 +68,7 @@ export const BuilderContextDecorator: Decorator = (Story, context) => {
supportedLanguageCodes: supportedLanguageCodes,
richTextColors: DEFAULT_COLORS,
componentTranslationsRef: {current: translationsStore},
getFormComponents: () => context?.args?.componentTree || defaultComponentTree,
getFormComponents: () => components,
getValidatorPlugins: async () => {
await sleep(context.parameters?.builder?.validatorPluginsDelay || 0);
return context?.args?.validatorPlugins || defaultValidatorPlugins;
Expand All @@ -88,6 +93,7 @@ export const BuilderContextDecorator: Decorator = (Story, context) => {
getDocumentTypes: async () => context?.args?.documentTypes || defaultdocumentTypes,
getConfidentialityLevels: async () => CONFIDENTIALITY_LEVELS,
getAuthPlugins: async () => DEFAULT_AUTH_PLUGINS,
validateLogic: createTypeCheck({components, staticVariables}),
}}
>
<Story />
Expand Down
Loading
Loading