@tsed/react-formio 3.0.0-alpha.11 → 3.0.0-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/atoms/icon/Icon.js.map +1 -1
- package/dist/chunks/index.js +33 -30
- package/dist/chunks/index.js.map +1 -1
- package/dist/chunks/index.module.js +16 -16
- package/dist/chunks/index.module.js.map +1 -1
- package/dist/chunks/react-select-animated.esm.js +1204 -1101
- package/dist/chunks/react-select-animated.esm.js.map +1 -1
- package/dist/hooks/keyboard.constants.js.map +1 -1
- package/dist/hooks/useKeyboardControls.js.map +1 -1
- package/dist/hooks/useTooltip.js.map +1 -1
- package/dist/molecules/alert/Alert.js.map +1 -1
- package/dist/molecules/button/Button.js +17 -20
- package/dist/molecules/button/Button.js.map +1 -1
- package/dist/molecules/card/Card.js.map +1 -1
- package/dist/molecules/forms/form-control/FormControl.js.map +1 -1
- package/dist/molecules/forms/input-tags/InputTags.js.map +1 -1
- package/dist/molecules/forms/input-tags/components/ChoicesTags.js +26 -26
- package/dist/molecules/forms/input-tags/components/ChoicesTags.js.map +1 -1
- package/dist/molecules/forms/input-tags/components/ReactTags.js +289 -300
- package/dist/molecules/forms/input-tags/components/ReactTags.js.map +1 -1
- package/dist/molecules/forms/input-text/InputText.js +3 -3
- package/dist/molecules/forms/input-text/InputText.js.map +1 -1
- package/dist/molecules/forms/select/Select.js.map +1 -1
- package/dist/molecules/forms/select/components/ChoicesSelect.js +71 -73
- package/dist/molecules/forms/select/components/ChoicesSelect.js.map +1 -1
- package/dist/molecules/forms/select/components/HtmlSelect.js.map +1 -1
- package/dist/molecules/forms/select/components/ReactSelect.js +13 -14
- package/dist/molecules/forms/select/components/ReactSelect.js.map +1 -1
- package/dist/molecules/forms/select/components/choices.template.js +2340 -2257
- package/dist/molecules/forms/select/components/choices.template.js.map +1 -1
- package/dist/molecules/forms/select/hooks/useOptions.js.map +1 -1
- package/dist/molecules/loader/Loader.js.map +1 -1
- package/dist/molecules/modal/Modal.js +23 -24
- package/dist/molecules/modal/Modal.js.map +1 -1
- package/dist/molecules/pagination/Pagination.js +19 -19
- package/dist/molecules/pagination/Pagination.js.map +1 -1
- package/dist/molecules/pagination/PaginationButton.js.map +1 -1
- package/dist/molecules/pagination/utils/getPageNumbers.js.map +1 -1
- package/dist/molecules/table/Table.js +29 -35
- package/dist/molecules/table/Table.js.map +1 -1
- package/dist/molecules/table/components/DefaultArrowSort.js.map +1 -1
- package/dist/molecules/table/components/DefaultCell.js.map +1 -1
- package/dist/molecules/table/components/DefaultCellFooter.js.map +1 -1
- package/dist/molecules/table/components/DefaultCellHeader.js.map +1 -1
- package/dist/molecules/table/components/DefaultCellOperations.js +10 -10
- package/dist/molecules/table/components/DefaultCellOperations.js.map +1 -1
- package/dist/molecules/table/components/DefaultFilter.js.map +1 -1
- package/dist/molecules/table/components/DefaultOperationButton.js +1 -1
- package/dist/molecules/table/components/DefaultOperationButton.js.map +1 -1
- package/dist/molecules/table/filters/RangeFilter.js +23 -24
- package/dist/molecules/table/filters/RangeFilter.js.map +1 -1
- package/dist/molecules/table/filters/SelectFilter.js +11 -13
- package/dist/molecules/table/filters/SelectFilter.js.map +1 -1
- package/dist/molecules/table/filters/TextFieldFilter.js.map +1 -1
- package/dist/molecules/table/hooks/useTable.js +7 -7
- package/dist/molecules/table/hooks/useTable.js.map +1 -1
- package/dist/molecules/table/hooks/useUniqValues.js.map +1 -1
- package/dist/molecules/table/utils/mapFormToColumns.js +20 -21
- package/dist/molecules/table/utils/mapFormToColumns.js.map +1 -1
- package/dist/molecules/tabs/Tab.js +36 -37
- package/dist/molecules/tabs/Tab.js.map +1 -1
- package/dist/molecules/tabs/TabList.js +9 -10
- package/dist/molecules/tabs/TabList.js.map +1 -1
- package/dist/molecules/tabs/TabPanel.js.map +1 -1
- package/dist/molecules/tabs/Tabs.js.map +1 -1
- package/dist/molecules/tabs/TabsBody.js.map +1 -1
- package/dist/molecules/tabs/TabsLegacy.js.map +1 -1
- package/dist/molecules/tabs/context/TabControl.js.map +1 -1
- package/dist/molecules/tabs/hooks/tabControl.js.map +1 -1
- package/dist/organisms/form/Form.js.map +1 -1
- package/dist/organisms/form/access/FormAccess.js +41 -41
- package/dist/organisms/form/access/FormAccess.js.map +1 -1
- package/dist/organisms/form/access/FormAccess.schema.js.map +1 -1
- package/dist/organisms/form/access/FormAccess.utils.js +2 -2
- package/dist/organisms/form/access/FormAccess.utils.js.map +1 -1
- package/dist/organisms/form/actions/FormAction.js +7 -8
- package/dist/organisms/form/actions/FormAction.js.map +1 -1
- package/dist/organisms/form/builder/FormBuilder.js.map +1 -1
- package/dist/organisms/form/builder/FormEdit.js.map +1 -1
- package/dist/organisms/form/builder/FormEdit.reducer.js.map +1 -1
- package/dist/organisms/form/builder/FormEditCtas.js +34 -34
- package/dist/organisms/form/builder/FormEditCtas.js.map +1 -1
- package/dist/organisms/form/builder/FormParameters.js.map +1 -1
- package/dist/organisms/form/builder/useFormBuilder.js +41 -38
- package/dist/organisms/form/builder/useFormBuilder.js.map +1 -1
- package/dist/organisms/form/builder/useFormEdit.js +17 -17
- package/dist/organisms/form/builder/useFormEdit.js.map +1 -1
- package/dist/organisms/form/exports/FormExport.js +29 -29
- package/dist/organisms/form/exports/FormExport.js.map +1 -1
- package/dist/organisms/form/preview/FormPreview.js.map +1 -1
- package/dist/organisms/form/settings/FormSettings.js +24 -24
- package/dist/organisms/form/settings/FormSettings.js.map +1 -1
- package/dist/organisms/form/settings/FormSettings.schema.js.map +1 -1
- package/dist/organisms/form/settings/FormSettings.utils.js.map +1 -1
- package/dist/organisms/form/useForm.js +664 -661
- package/dist/organisms/form/useForm.js.map +1 -1
- package/dist/organisms/modal/RemoveModal.js +16 -17
- package/dist/organisms/modal/RemoveModal.js.map +1 -1
- package/dist/organisms/table/actions/ActionsTable.js.map +1 -1
- package/dist/organisms/table/forms/FormsTable.js.map +1 -1
- package/dist/organisms/table/forms/components/FormsCell.js.map +1 -1
- package/dist/organisms/table/submissions/SubmissionsTable.js.map +1 -1
- package/dist/organisms/views/FormViews.js.map +1 -1
- package/dist/registries/components.js.map +1 -1
- package/dist/utils/getEventValue.js.map +1 -1
- package/dist/utils/iconClass.js.map +1 -1
- package/dist/utils/mapPagination.js.map +1 -1
- package/dist/utils/stopPropagationWrapper.js.map +1 -1
- package/package.json +7 -7
- package/src/atoms/icon/Icon.stories.tsx +1 -1
- package/src/molecules/button/Button.stories.tsx +1 -1
- package/src/molecules/forms/form-control/FormControl.stories.tsx +1 -1
- package/src/molecules/forms/input-tags/components/ChoicesTags.stories.tsx +1 -1
- package/src/molecules/forms/input-tags/components/ReactTags.stories.tsx +1 -1
- package/src/molecules/forms/input-text/InputText.stories.tsx +2 -2
- package/src/molecules/forms/select/components/ChoicesSelect.stories.tsx +2 -2
- package/src/molecules/forms/select/components/HtmlSelect.stories.tsx +2 -2
- package/src/molecules/forms/select/components/ReactSelect.stories.tsx +2 -2
- package/src/molecules/loader/Loader.stories.tsx +1 -1
- package/src/molecules/modal/Modal.stories.tsx +1 -1
- package/src/molecules/pagination/Pagination.stories.tsx +1 -1
- package/src/molecules/pagination/Pagination.tsx +0 -1
- package/src/molecules/table/Table.stories.tsx +2 -2
- package/src/molecules/table/filters/SelectFilter.tsx +1 -1
- package/src/molecules/tabs/Tabs.stories.tsx +2 -2
- package/src/molecules/tabs/TabsLegacy.stories.tsx +1 -1
- package/src/organisms/form/Form.stories.tsx +94 -118
- package/src/organisms/form/access/FormAccess.stories.tsx +2 -2
- package/src/organisms/form/actions/FormAction.stories.tsx +1 -1
- package/src/organisms/form/builder/FormBuilder.stories.tsx +4 -1
- package/src/organisms/form/builder/FormEdit.stories.tsx +1 -1
- package/src/organisms/form/builder/useFormBuilder.ts +5 -1
- package/src/organisms/form/exports/FormExport.stories.tsx +1 -1
- package/src/organisms/form/preview/FormPreview.stories.tsx +1 -1
- package/src/organisms/modal/RemoveModal.stories.tsx +1 -1
- package/src/organisms/table/actions/ActionsTable.stories.tsx +2 -2
- package/src/organisms/table/submissions/SubmissionsTable.stories.tsx +1 -1
- package/src/organisms/views/FormViews.stories.tsx +1 -1
- package/vite.config.mts +2 -2
- package/tsconfig.app.json +0 -11
- package/tsconfig.json +0 -21
- package/tsconfig.node.json +0 -13
- package/tsconfig.spec.json +0 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubmissionsTable.js","sources":["../../../../src/organisms/table/submissions/SubmissionsTable.tsx"],"sourcesContent":["import type { FormType, JSON, SubmissionType } from \"../../../interfaces\";\nimport { Table, type TableProps } from \"../../../molecules/table/Table\";\nimport { mapFormToColumns } from \"../../../molecules/table/utils/mapFormToColumns.js\";\n\nexport type SubmissionsTableProps<Data extends { [key: string]: JSON } = { [key: string]: JSON }> = Omit<\n TableProps<SubmissionType<Data>>,\n \"columns\"\n> & {\n form?: FormType;\n};\n\nexport function SubmissionsTable<Data extends { [key: string]: JSON } = { [key: string]: JSON }>({\n form,\n ...props\n}: SubmissionsTableProps<Data>) {\n const columns: any[] | undefined = form && mapFormToColumns(form);\n\n return <Table {...(props as any)} columns={columns!} />;\n}\n"],"names":["SubmissionsTable","form","props","columns","mapFormToColumns","jsx","Table"],"mappings":";;;AAWO,SAASA,EAAiF;AAAA,EAC/F,MAAAC;AAAA,EACA,GAAGC;AACL,GAAgC;
|
|
1
|
+
{"version":3,"file":"SubmissionsTable.js","sources":["../../../../src/organisms/table/submissions/SubmissionsTable.tsx"],"sourcesContent":["import type { FormType, JSON, SubmissionType } from \"../../../interfaces\";\nimport { Table, type TableProps } from \"../../../molecules/table/Table\";\nimport { mapFormToColumns } from \"../../../molecules/table/utils/mapFormToColumns.js\";\n\nexport type SubmissionsTableProps<Data extends { [key: string]: JSON } = { [key: string]: JSON }> = Omit<\n TableProps<SubmissionType<Data>>,\n \"columns\"\n> & {\n form?: FormType;\n};\n\nexport function SubmissionsTable<Data extends { [key: string]: JSON } = { [key: string]: JSON }>({\n form,\n ...props\n}: SubmissionsTableProps<Data>) {\n const columns: any[] | undefined = form && mapFormToColumns(form);\n\n return <Table {...(props as any)} columns={columns!} />;\n}\n"],"names":["SubmissionsTable","form","props","columns","mapFormToColumns","jsx","Table"],"mappings":";;;AAWO,SAASA,EAAiF;AAAA,EAC/F,MAAAC;AAAA,EACA,GAAGC;AACL,GAAgC;AAC9B,QAAMC,IAA6BF,KAAQG,EAAiBH,CAAI;AAEhE,SAAO,gBAAAI,EAACC,GAAA,EAAO,GAAIJ,GAAe,SAAAC,EAAA,CAAmB;AACvD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormViews.js","sources":["../../../src/organisms/views/FormViews.tsx"],"sourcesContent":["import type { FormType, JSON, PermissionsResolver } from \"../../interfaces/index.js\";\nimport type { Tab as DefaultTab } from \"../../molecules/tabs/Tab.js\";\nimport type { TabList as DefaultTabList } from \"../../molecules/tabs/TabList.js\";\nimport type { TabPanel as DefaultTabPanel } from \"../../molecules/tabs/TabPanel.js\";\nimport type { Tabs as DefaultTabs } from \"../../molecules/tabs/Tabs.js\";\nimport type { TabsBody as DefaultTabsBody } from \"../../molecules/tabs/TabsBody.js\";\nimport { getComponent } from \"../../registries/components.js\";\nimport { FormAccess, type FormAccessProps } from \"../form/access/FormAccess.js\";\nimport { FormEdit, type FormEditProps } from \"../form/builder/FormEdit.js\";\nimport { FormExport } from \"../form/exports/FormExport.js\";\nimport { FormPreview } from \"../form/preview/FormPreview.js\";\nimport { FormSettings } from \"../form/settings/FormSettings.js\";\nimport { ActionsTable, type ActionsTableProps } from \"../table/actions/ActionsTable.js\";\nimport { SubmissionsTable, type SubmissionsTableProps } from \"../table/submissions/SubmissionsTable.js\";\n\nexport type FormViewsProps<Data extends { [key: string]: JSON } = { [key: string]: JSON }> = {\n form: FormEditProps[\"form\"];\n submissions: SubmissionsTableProps<Data>[\"data\"];\n availableActions: ActionsTableProps[\"availableActions\"];\n actions: ActionsTableProps[\"data\"];\n roles?: FormAccessProps[\"roles\"];\n i18n?: (key: string) => string;\n onAction: () => void;\n permissionsResolver?: PermissionsResolver<Data>;\n};\n\nfunction useSubmissionsOperations<Data extends { [key: string]: JSON } = { [key: string]: JSON }>(\n permissionsResolver?: PermissionsResolver<Data>\n) {\n return [\n {\n title: \"Edit\",\n action: \"submission:edit\",\n alias: \"row\",\n icon: \"edit\",\n permissionsResolver\n },\n {\n action: \"submission:delete\",\n icon: \"trash\",\n buttonType: \"danger\",\n permissionsResolver\n }\n ] as SubmissionsTableProps<Data>[\"operations\"];\n}\n\nfunction useActionsOperations<Data extends { [key: string]: JSON } = { [key: string]: JSON }>(\n permissionsResolver?: PermissionsResolver<Data>\n) {\n return [\n {\n title: \"Edit\",\n action: \"action:edit\",\n alias: \"row\",\n icon: \"edit\",\n permissionsResolver\n },\n {\n action: \"action:delete\",\n icon: \"trash\",\n buttonType: \"danger\",\n permissionsResolver\n }\n ] as SubmissionsTableProps<Data>[\"operations\"];\n}\n\nexport function FormViews<Data extends { [key: string]: JSON } = { [key: string]: JSON }>({\n form,\n roles,\n availableActions,\n actions,\n permissionsResolver,\n submissions,\n i18n = (f) => f\n}: FormViewsProps<Data>) {\n const Tabs = getComponent<typeof DefaultTabs>(\"Tabs\");\n const TabList = getComponent<typeof DefaultTabList>(\"TabList\");\n const Tab = getComponent<typeof DefaultTab>(\"Tab\");\n const TabsBody = getComponent<typeof DefaultTabsBody>(\"TabsBody\");\n const TabPanel = getComponent<typeof DefaultTabPanel>(\"TabPanel\");\n const submissionsOperations = useSubmissionsOperations<Data>(permissionsResolver);\n const actionsOperations = useActionsOperations<any>(permissionsResolver);\n\n return (\n <Tabs>\n <TabList>\n <Tab value={0} icon='edit'>\n {i18n(\"Edit\")}\n </Tab>\n <Tab value={1} icon='data'>\n {i18n(\"Data\")}\n </Tab>\n <Tab value={2} icon='test-tube'>\n {i18n(\"Preview\")}\n </Tab>\n <Tab value={3} icon='paper-plane'>\n {i18n(\"Actions\")}\n </Tab>\n <Tab value={4} icon='lock'>\n {i18n(\"Access\")}\n </Tab>\n <Tab value={5} icon='download'>\n {i18n(\"Export\")}\n </Tab>\n <Tab value={6} icon='cog'>\n {i18n(\"Settings\")}\n </Tab>\n </TabList>\n <TabsBody>\n <TabPanel value={0} className='p-3 border-l-1 border-b-1 border-r-1 border-gray-300'>\n <FormEdit form={form} options={{ i18n }} />\n </TabPanel>\n <TabPanel value={1}>\n <SubmissionsTable<Data>\n className={\"border-top-0\"}\n form={form as FormType}\n data={submissions}\n i18n={i18n}\n operations={submissionsOperations}\n />\n </TabPanel>\n <TabPanel value={2}>\n <FormPreview form={form as FormType} i18n={i18n} />\n </TabPanel>\n <TabPanel value={3}>\n <ActionsTable\n className={\"border-top-0\"}\n availableActions={availableActions}\n data={actions}\n operations={actionsOperations as any}\n i18n={i18n}\n />\n </TabPanel>\n <TabPanel value={4} className='pt-3'>\n <FormAccess form={form as FormType} roles={roles} options={{ i18n }} />\n </TabPanel>\n <TabPanel value={5} className='pt-3'>\n <FormExport i18n={i18n} />\n </TabPanel>\n <TabPanel value={6} className='p-3 border-l-1 border-b-1 border-r-1 border-gray-300'>\n <FormSettings form={form as FormType} options={{}} />\n </TabPanel>\n </TabsBody>\n </Tabs>\n );\n}\n"],"names":["useSubmissionsOperations","permissionsResolver","useActionsOperations","FormViews","form","roles","availableActions","actions","submissions","i18n","f","Tabs","getComponent","TabList","Tab","TabsBody","TabPanel","submissionsOperations","actionsOperations","jsxs","jsx","FormEdit","SubmissionsTable","FormPreview","ActionsTable","FormAccess","FormExport","FormSettings"],"mappings":";;;;;;;;;AA0BA,SAASA,EACPC,GACA;
|
|
1
|
+
{"version":3,"file":"FormViews.js","sources":["../../../src/organisms/views/FormViews.tsx"],"sourcesContent":["import type { FormType, JSON, PermissionsResolver } from \"../../interfaces/index.js\";\nimport type { Tab as DefaultTab } from \"../../molecules/tabs/Tab.js\";\nimport type { TabList as DefaultTabList } from \"../../molecules/tabs/TabList.js\";\nimport type { TabPanel as DefaultTabPanel } from \"../../molecules/tabs/TabPanel.js\";\nimport type { Tabs as DefaultTabs } from \"../../molecules/tabs/Tabs.js\";\nimport type { TabsBody as DefaultTabsBody } from \"../../molecules/tabs/TabsBody.js\";\nimport { getComponent } from \"../../registries/components.js\";\nimport { FormAccess, type FormAccessProps } from \"../form/access/FormAccess.js\";\nimport { FormEdit, type FormEditProps } from \"../form/builder/FormEdit.js\";\nimport { FormExport } from \"../form/exports/FormExport.js\";\nimport { FormPreview } from \"../form/preview/FormPreview.js\";\nimport { FormSettings } from \"../form/settings/FormSettings.js\";\nimport { ActionsTable, type ActionsTableProps } from \"../table/actions/ActionsTable.js\";\nimport { SubmissionsTable, type SubmissionsTableProps } from \"../table/submissions/SubmissionsTable.js\";\n\nexport type FormViewsProps<Data extends { [key: string]: JSON } = { [key: string]: JSON }> = {\n form: FormEditProps[\"form\"];\n submissions: SubmissionsTableProps<Data>[\"data\"];\n availableActions: ActionsTableProps[\"availableActions\"];\n actions: ActionsTableProps[\"data\"];\n roles?: FormAccessProps[\"roles\"];\n i18n?: (key: string) => string;\n onAction: () => void;\n permissionsResolver?: PermissionsResolver<Data>;\n};\n\nfunction useSubmissionsOperations<Data extends { [key: string]: JSON } = { [key: string]: JSON }>(\n permissionsResolver?: PermissionsResolver<Data>\n) {\n return [\n {\n title: \"Edit\",\n action: \"submission:edit\",\n alias: \"row\",\n icon: \"edit\",\n permissionsResolver\n },\n {\n action: \"submission:delete\",\n icon: \"trash\",\n buttonType: \"danger\",\n permissionsResolver\n }\n ] as SubmissionsTableProps<Data>[\"operations\"];\n}\n\nfunction useActionsOperations<Data extends { [key: string]: JSON } = { [key: string]: JSON }>(\n permissionsResolver?: PermissionsResolver<Data>\n) {\n return [\n {\n title: \"Edit\",\n action: \"action:edit\",\n alias: \"row\",\n icon: \"edit\",\n permissionsResolver\n },\n {\n action: \"action:delete\",\n icon: \"trash\",\n buttonType: \"danger\",\n permissionsResolver\n }\n ] as SubmissionsTableProps<Data>[\"operations\"];\n}\n\nexport function FormViews<Data extends { [key: string]: JSON } = { [key: string]: JSON }>({\n form,\n roles,\n availableActions,\n actions,\n permissionsResolver,\n submissions,\n i18n = (f) => f\n}: FormViewsProps<Data>) {\n const Tabs = getComponent<typeof DefaultTabs>(\"Tabs\");\n const TabList = getComponent<typeof DefaultTabList>(\"TabList\");\n const Tab = getComponent<typeof DefaultTab>(\"Tab\");\n const TabsBody = getComponent<typeof DefaultTabsBody>(\"TabsBody\");\n const TabPanel = getComponent<typeof DefaultTabPanel>(\"TabPanel\");\n const submissionsOperations = useSubmissionsOperations<Data>(permissionsResolver);\n const actionsOperations = useActionsOperations<any>(permissionsResolver);\n\n return (\n <Tabs>\n <TabList>\n <Tab value={0} icon='edit'>\n {i18n(\"Edit\")}\n </Tab>\n <Tab value={1} icon='data'>\n {i18n(\"Data\")}\n </Tab>\n <Tab value={2} icon='test-tube'>\n {i18n(\"Preview\")}\n </Tab>\n <Tab value={3} icon='paper-plane'>\n {i18n(\"Actions\")}\n </Tab>\n <Tab value={4} icon='lock'>\n {i18n(\"Access\")}\n </Tab>\n <Tab value={5} icon='download'>\n {i18n(\"Export\")}\n </Tab>\n <Tab value={6} icon='cog'>\n {i18n(\"Settings\")}\n </Tab>\n </TabList>\n <TabsBody>\n <TabPanel value={0} className='p-3 border-l-1 border-b-1 border-r-1 border-gray-300'>\n <FormEdit form={form} options={{ i18n }} />\n </TabPanel>\n <TabPanel value={1}>\n <SubmissionsTable<Data>\n className={\"border-top-0\"}\n form={form as FormType}\n data={submissions}\n i18n={i18n}\n operations={submissionsOperations}\n />\n </TabPanel>\n <TabPanel value={2}>\n <FormPreview form={form as FormType} i18n={i18n} />\n </TabPanel>\n <TabPanel value={3}>\n <ActionsTable\n className={\"border-top-0\"}\n availableActions={availableActions}\n data={actions}\n operations={actionsOperations as any}\n i18n={i18n}\n />\n </TabPanel>\n <TabPanel value={4} className='pt-3'>\n <FormAccess form={form as FormType} roles={roles} options={{ i18n }} />\n </TabPanel>\n <TabPanel value={5} className='pt-3'>\n <FormExport i18n={i18n} />\n </TabPanel>\n <TabPanel value={6} className='p-3 border-l-1 border-b-1 border-r-1 border-gray-300'>\n <FormSettings form={form as FormType} options={{}} />\n </TabPanel>\n </TabsBody>\n </Tabs>\n );\n}\n"],"names":["useSubmissionsOperations","permissionsResolver","useActionsOperations","FormViews","form","roles","availableActions","actions","submissions","i18n","f","Tabs","getComponent","TabList","Tab","TabsBody","TabPanel","submissionsOperations","actionsOperations","jsxs","jsx","FormEdit","SubmissionsTable","FormPreview","ActionsTable","FormAccess","FormExport","FormSettings"],"mappings":";;;;;;;;;AA0BA,SAASA,EACPC,GACA;AACA,SAAO;AAAA,IACL;AAAA,MACE,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,MAAM;AAAA,MACN,qBAAAA;AAAA,IAAA;AAAA,IAEF;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,YAAY;AAAA,MACZ,qBAAAA;AAAA,IAAA;AAAA,EACF;AAEJ;AAEA,SAASC,EACPD,GACA;AACA,SAAO;AAAA,IACL;AAAA,MACE,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,MAAM;AAAA,MACN,qBAAAA;AAAA,IAAA;AAAA,IAEF;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,YAAY;AAAA,MACZ,qBAAAA;AAAA,IAAA;AAAA,EACF;AAEJ;AAEO,SAASE,EAA0E;AAAA,EACxF,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,qBAAAN;AAAA,EACA,aAAAO;AAAA,EACA,MAAAC,IAAO,CAACC,MAAMA;AAChB,GAAyB;AACvB,QAAMC,IAAOC,EAAiC,MAAM,GAC9CC,IAAUD,EAAoC,SAAS,GACvDE,IAAMF,EAAgC,KAAK,GAC3CG,IAAWH,EAAqC,UAAU,GAC1DI,IAAWJ,EAAqC,UAAU,GAC1DK,IAAwBjB,EAA+BC,CAAmB,GAC1EiB,IAAoBhB,EAA0BD,CAAmB;AAEvE,2BACGU,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAQ,EAACN,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAO,EAACN,KAAI,OAAO,GAAG,MAAK,QACjB,UAAAL,EAAK,MAAM,GACd;AAAA,MACA,gBAAAW,EAACN,KAAI,OAAO,GAAG,MAAK,QACjB,UAAAL,EAAK,MAAM,GACd;AAAA,MACA,gBAAAW,EAACN,KAAI,OAAO,GAAG,MAAK,aACjB,UAAAL,EAAK,SAAS,GACjB;AAAA,MACA,gBAAAW,EAACN,KAAI,OAAO,GAAG,MAAK,eACjB,UAAAL,EAAK,SAAS,GACjB;AAAA,MACA,gBAAAW,EAACN,KAAI,OAAO,GAAG,MAAK,QACjB,UAAAL,EAAK,QAAQ,GAChB;AAAA,MACA,gBAAAW,EAACN,KAAI,OAAO,GAAG,MAAK,YACjB,UAAAL,EAAK,QAAQ,GAChB;AAAA,MACA,gBAAAW,EAACN,KAAI,OAAO,GAAG,MAAK,OACjB,UAAAL,EAAK,UAAU,EAAA,CAClB;AAAA,IAAA,GACF;AAAA,sBACCM,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAK,EAACJ,GAAA,EAAS,OAAO,GAAG,WAAU,wDAC5B,UAAA,gBAAAI,EAACC,GAAA,EAAS,MAAAjB,GAAY,SAAS,EAAE,MAAAK,EAAA,EAAK,CAAG,GAC3C;AAAA,MACA,gBAAAW,EAACJ,GAAA,EAAS,OAAO,GACf,UAAA,gBAAAI;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,WAAW;AAAA,UACX,MAAAlB;AAAA,UACA,MAAMI;AAAA,UACN,MAAAC;AAAA,UACA,YAAYQ;AAAA,QAAA;AAAA,MAAA,GAEhB;AAAA,MACA,gBAAAG,EAACJ,KAAS,OAAO,GACf,4BAACO,GAAA,EAAY,MAAAnB,GAAwB,MAAAK,GAAY,EAAA,CACnD;AAAA,MACA,gBAAAW,EAACJ,GAAA,EAAS,OAAO,GACf,UAAA,gBAAAI;AAAA,QAACI;AAAA,QAAA;AAAA,UACC,WAAW;AAAA,UACX,kBAAAlB;AAAA,UACA,MAAMC;AAAA,UACN,YAAYW;AAAA,UACZ,MAAAT;AAAA,QAAA;AAAA,MAAA,GAEJ;AAAA,MACA,gBAAAW,EAACJ,GAAA,EAAS,OAAO,GAAG,WAAU,QAC5B,UAAA,gBAAAI,EAACK,GAAA,EAAW,MAAArB,GAAwB,OAAAC,GAAc,SAAS,EAAE,MAAAI,EAAA,GAAQ,GACvE;AAAA,MACA,gBAAAW,EAACJ,KAAS,OAAO,GAAG,WAAU,QAC5B,UAAA,gBAAAI,EAACM,GAAA,EAAW,MAAAjB,EAAA,CAAY,EAAA,CAC1B;AAAA,MACA,gBAAAW,EAACJ,GAAA,EAAS,OAAO,GAAG,WAAU,wDAC5B,UAAA,gBAAAI,EAACO,GAAA,EAAa,MAAAvB,GAAwB,SAAS,CAAA,EAAC,CAAG,EAAA,CACrD;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sources":["../../src/registries/components.ts"],"sourcesContent":["export const components = new Map<string, unknown>();\n\nexport function registerComponent(type: string, component: unknown) {\n components.set(type, component);\n}\n\nexport function getComponent<Cmp>(type: string | string[]): Cmp {\n if (Array.isArray(type)) {\n for (const t of type) {\n if (components.has(t)) {\n return components.get(t) as unknown as Cmp;\n }\n }\n }\n\n const result = components.get(type as string) as unknown as Cmp;\n\n if (!result) {\n console.warn(`Missing component for ${type}`);\n }\n\n return result;\n}\n"],"names":["components","registerComponent","type","component","getComponent","t","result"],"mappings":"
|
|
1
|
+
{"version":3,"file":"components.js","sources":["../../src/registries/components.ts"],"sourcesContent":["export const components = new Map<string, unknown>();\n\nexport function registerComponent(type: string, component: unknown) {\n components.set(type, component);\n}\n\nexport function getComponent<Cmp>(type: string | string[]): Cmp {\n if (Array.isArray(type)) {\n for (const t of type) {\n if (components.has(t)) {\n return components.get(t) as unknown as Cmp;\n }\n }\n }\n\n const result = components.get(type as string) as unknown as Cmp;\n\n if (!result) {\n console.warn(`Missing component for ${type}`);\n }\n\n return result;\n}\n"],"names":["components","registerComponent","type","component","getComponent","t","result"],"mappings":"AAAO,MAAMA,wBAAiB,IAAA;AAEvB,SAASC,EAAkBC,GAAcC,GAAoB;AAClE,EAAAH,EAAW,IAAIE,GAAMC,CAAS;AAChC;AAEO,SAASC,EAAkBF,GAA8B;AAC9D,MAAI,MAAM,QAAQA,CAAI;AACpB,eAAWG,KAAKH;AACd,UAAIF,EAAW,IAAIK,CAAC;AAClB,eAAOL,EAAW,IAAIK,CAAC;AAAA;AAK7B,QAAMC,IAASN,EAAW,IAAIE,CAAc;AAE5C,SAAKI,KACH,QAAQ,KAAK,yBAAyBJ,CAAI,EAAE,GAGvCI;AACT;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getEventValue.js","sources":["../../src/utils/getEventValue.ts"],"sourcesContent":["export function getEventValue(event: any) {\n const { target } = event;\n\n if (event.target.multiple && event.target.selectedOptions) {\n return Array.from(event.target.selectedOptions, (option: any) => option.value);\n }\n\n return target.type === \"checkbox\" ? target.checked : target.value;\n}\n"],"names":["getEventValue","event","target","option"],"mappings":"AAAO,SAASA,EAAcC,GAAY;
|
|
1
|
+
{"version":3,"file":"getEventValue.js","sources":["../../src/utils/getEventValue.ts"],"sourcesContent":["export function getEventValue(event: any) {\n const { target } = event;\n\n if (event.target.multiple && event.target.selectedOptions) {\n return Array.from(event.target.selectedOptions, (option: any) => option.value);\n }\n\n return target.type === \"checkbox\" ? target.checked : target.value;\n}\n"],"names":["getEventValue","event","target","option"],"mappings":"AAAO,SAASA,EAAcC,GAAY;AACxC,QAAM,EAAE,QAAAC,MAAWD;AAEnB,SAAIA,EAAM,OAAO,YAAYA,EAAM,OAAO,kBACjC,MAAM,KAAKA,EAAM,OAAO,iBAAiB,CAACE,MAAgBA,EAAO,KAAK,IAGxED,EAAO,SAAS,aAAaA,EAAO,UAAUA,EAAO;AAC9D;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iconClass.js","sources":["../../src/utils/iconClass.ts"],"sourcesContent":["import * as formio from \"formiojs\";\n\nconst { Templates } = formio;\n\nexport function iconClass(iconset: string | undefined, name: string, spinning?: boolean): string {\n return Templates.current.iconClass(iconset || Templates.current.defaultIconset, name, spinning);\n}\n"],"names":["Templates","formio","iconClass","iconset","name","spinning"],"mappings":";AAEA,MAAM,EAAE,WAAAA,
|
|
1
|
+
{"version":3,"file":"iconClass.js","sources":["../../src/utils/iconClass.ts"],"sourcesContent":["import * as formio from \"formiojs\";\n\nconst { Templates } = formio;\n\nexport function iconClass(iconset: string | undefined, name: string, spinning?: boolean): string {\n return Templates.current.iconClass(iconset || Templates.current.defaultIconset, name, spinning);\n}\n"],"names":["Templates","formio","iconClass","iconset","name","spinning"],"mappings":";AAEA,MAAM,EAAE,WAAAA,MAAcC;AAEf,SAASC,EAAUC,GAA6BC,GAAcC,GAA4B;AAC/F,SAAOL,EAAU,QAAQ,UAAUG,KAAWH,EAAU,QAAQ,gBAAgBI,GAAMC,CAAQ;AAChG;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapPagination.js","sources":["../../src/utils/mapPagination.ts"],"sourcesContent":["export function mapPagination({ skip, limit, serverCount, length }: any = {}): any {\n skip = skip || 0;\n limit = limit || 10;\n serverCount = serverCount || length;\n\n return {\n pageIndex: Math.floor(skip / limit),\n pageSize: limit,\n pageCount: Math.ceil(serverCount / limit)\n };\n}\n"],"names":["mapPagination","skip","limit","serverCount","length"],"mappings":"
|
|
1
|
+
{"version":3,"file":"mapPagination.js","sources":["../../src/utils/mapPagination.ts"],"sourcesContent":["export function mapPagination({ skip, limit, serverCount, length }: any = {}): any {\n skip = skip || 0;\n limit = limit || 10;\n serverCount = serverCount || length;\n\n return {\n pageIndex: Math.floor(skip / limit),\n pageSize: limit,\n pageCount: Math.ceil(serverCount / limit)\n };\n}\n"],"names":["mapPagination","skip","limit","serverCount","length"],"mappings":"AAAO,SAASA,EAAc,EAAE,MAAAC,GAAM,OAAAC,GAAO,aAAAC,GAAa,QAAAC,EAAA,IAAgB,IAAS;AACjF,SAAAH,IAAOA,KAAQ,GACfC,IAAQA,KAAS,IACjBC,IAAcA,KAAeC,GAEtB;AAAA,IACL,WAAW,KAAK,MAAMH,IAAOC,CAAK;AAAA,IAClC,UAAUA;AAAA,IACV,WAAW,KAAK,KAAKC,IAAcD,CAAK;AAAA,EAAA;AAE5C;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stopPropagationWrapper.js","sources":["../../src/utils/stopPropagationWrapper.ts"],"sourcesContent":["export const stopPropagationWrapper = (fn: Function) => (event: any) => {\n event.stopPropagation();\n fn();\n};\n"],"names":["stopPropagationWrapper","fn","event"],"mappings":"AAAO,MAAMA,IAAyB,CAACC,MAAiB,CAACC,MAAe;AACtE,EAAAA,EAAM,
|
|
1
|
+
{"version":3,"file":"stopPropagationWrapper.js","sources":["../../src/utils/stopPropagationWrapper.ts"],"sourcesContent":["export const stopPropagationWrapper = (fn: Function) => (event: any) => {\n event.stopPropagation();\n fn();\n};\n"],"names":["stopPropagationWrapper","fn","event"],"mappings":"AAAO,MAAMA,IAAyB,CAACC,MAAiB,CAACC,MAAe;AACtE,EAAAA,EAAM,gBAAA,GACND,EAAA;AACF;"}
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/react-formio",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.12",
|
|
4
4
|
"description": "Provide a react formio wrapper. Written in TypeScript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.modern.js",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"types": "./dist/index.d.ts",
|
|
11
10
|
"tsed-source": "./src/index.ts",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
12
|
"default": "./dist/index.js"
|
|
13
13
|
},
|
|
14
14
|
"./*": {
|
|
15
|
-
"types": "./dist/*.d.ts",
|
|
16
15
|
"tsed-source": "./src/*",
|
|
16
|
+
"types": "./dist/*.d.ts",
|
|
17
17
|
"default": "./dist/*.js"
|
|
18
18
|
}
|
|
19
19
|
},
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@tanstack/react-table": ">=8.20.6",
|
|
47
|
-
"@tsed/tailwind-formio": "3.0.0-alpha.
|
|
48
|
-
"@tsed/typescript": "3.0.0-alpha.
|
|
47
|
+
"@tsed/tailwind-formio": "3.0.0-alpha.12",
|
|
48
|
+
"@tsed/typescript": "3.0.0-alpha.12",
|
|
49
49
|
"microbundle": "0.13.0",
|
|
50
|
-
"vite": "
|
|
51
|
-
"vitest": "2.
|
|
50
|
+
"vite": "7.1.5",
|
|
51
|
+
"vitest": "3.2.4"
|
|
52
52
|
},
|
|
53
53
|
"repository": "https://github.com/tsedio/tsed-formio",
|
|
54
54
|
"bugs": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { expect, userEvent, within } from "
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { expect, userEvent, within } from "storybook/test";
|
|
3
3
|
|
|
4
4
|
import { iconClass } from "../../../utils/iconClass";
|
|
5
5
|
import { useValue } from "../../__fixtures__/useValue.hook";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./ChoicesSelect";
|
|
2
2
|
|
|
3
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
4
|
-
import { fn } from "
|
|
3
|
+
import { Meta, StoryObj } from "@storybook/react-vite";
|
|
4
|
+
import { fn } from "storybook/test";
|
|
5
5
|
|
|
6
6
|
import { iconClass } from "../../../../utils/iconClass";
|
|
7
7
|
import { useValue } from "../../../__fixtures__/useValue.hook";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./HtmlSelect";
|
|
2
2
|
|
|
3
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
4
|
-
import { expect, fn, userEvent, within } from "
|
|
3
|
+
import { Meta, StoryObj } from "@storybook/react-vite";
|
|
4
|
+
import { expect, fn, userEvent, within } from "storybook/test";
|
|
5
5
|
|
|
6
6
|
import { iconClass } from "../../../../utils/iconClass";
|
|
7
7
|
import { useValue } from "../../../__fixtures__/useValue.hook";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../all";
|
|
2
2
|
|
|
3
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
4
|
-
import { fn } from "
|
|
3
|
+
import { Meta, StoryObj } from "@storybook/react-vite";
|
|
4
|
+
import { fn } from "storybook/test";
|
|
5
5
|
|
|
6
6
|
import { iconClass } from "../../../../utils/iconClass";
|
|
7
7
|
import { useValue } from "../../../__fixtures__/useValue.hook";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./all";
|
|
2
2
|
|
|
3
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
4
|
-
import { expect, fn, userEvent, waitFor, within } from "
|
|
3
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
4
|
+
import { expect, fn, userEvent, waitFor, within } from "storybook/test";
|
|
5
5
|
|
|
6
6
|
import { SubmissionType } from "../../interfaces";
|
|
7
7
|
import FormType from "../__fixtures__/form-schema.json";
|
|
@@ -9,7 +9,7 @@ export function SelectFilter<Data = any>({ header, options }: FilterProps<Data,
|
|
|
9
9
|
const Select = getComponent<typeof DefaultSelect>("Select");
|
|
10
10
|
const columnFilterValue = header.column.getFilterValue();
|
|
11
11
|
const uniqValues = useUniqValues<Data>({ header, filterVariant: "text" });
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
const opts =
|
|
14
14
|
options.layout === "choicesjs"
|
|
15
15
|
? {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./all.js";
|
|
2
2
|
|
|
3
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
4
|
-
import { expect, fn, userEvent, waitFor, within } from "
|
|
3
|
+
import { Meta, StoryObj } from "@storybook/react-vite";
|
|
4
|
+
import { expect, fn, userEvent, waitFor, within } from "storybook/test";
|
|
5
5
|
|
|
6
6
|
import { Icon } from "../../atoms/icon/Icon.js";
|
|
7
7
|
import { Button } from "../button/Button.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import {
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { delay, http, HttpResponse } from "msw";
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
|
+
import { expect, fn, userEvent, waitFor, within } from "storybook/test";
|
|
4
5
|
|
|
5
6
|
import { SubmissionType } from "../../interfaces";
|
|
6
7
|
import { InputText } from "../../molecules/forms/input-text/InputText";
|
|
@@ -9,12 +10,6 @@ import formFirstname from "../__fixtures__/form-firstname.fixture.json";
|
|
|
9
10
|
import { useEditForm } from "../__fixtures__/useEditForm";
|
|
10
11
|
import { Form } from "./Form";
|
|
11
12
|
|
|
12
|
-
async function delay(number: number) {
|
|
13
|
-
return new Promise((resolve) => {
|
|
14
|
-
setTimeout(resolve, number);
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
|
|
18
13
|
/**
|
|
19
14
|
* The form component is the primary component of the system. It is what takes the form definition (json) and renders the
|
|
20
15
|
* form into html. There are multiple ways to send the form to the Form component. The two main ways are to pass the `src`
|
|
@@ -332,15 +327,15 @@ export const WithOnSubmit: Story = {
|
|
|
332
327
|
expect(firstnameInput).toHaveValue("John");
|
|
333
328
|
expect(lastNameInput).toHaveValue("Doe");
|
|
334
329
|
|
|
335
|
-
userEvent.clear(firstnameInput);
|
|
336
|
-
userEvent.type(firstnameInput, "Jane", { delay: 100 });
|
|
330
|
+
await userEvent.clear(firstnameInput);
|
|
331
|
+
await userEvent.type(firstnameInput, "Jane", { delay: 100 });
|
|
337
332
|
|
|
338
333
|
await waitFor(() => {
|
|
339
334
|
expect(firstnameInput).toHaveValue("Jane");
|
|
340
335
|
});
|
|
341
336
|
|
|
342
|
-
userEvent.clear(lastNameInput);
|
|
343
|
-
userEvent.type(lastNameInput, "Smith", { delay: 100 });
|
|
337
|
+
await userEvent.clear(lastNameInput);
|
|
338
|
+
await userEvent.type(lastNameInput, "Smith", { delay: 100 });
|
|
344
339
|
|
|
345
340
|
await waitFor(() => {
|
|
346
341
|
expect(lastNameInput).toHaveValue("Smith");
|
|
@@ -397,42 +392,20 @@ export const WithOnSubmit: Story = {
|
|
|
397
392
|
* Form with custom validation hook
|
|
398
393
|
*/
|
|
399
394
|
export const CustomValidation: Story = {
|
|
400
|
-
parameters: {
|
|
401
|
-
mockData: [
|
|
402
|
-
{
|
|
403
|
-
url: "https://test.dev/todos/1",
|
|
404
|
-
method: "GET",
|
|
405
|
-
status: 500,
|
|
406
|
-
response: {
|
|
407
|
-
message: "My custom message about this field",
|
|
408
|
-
type: "custom",
|
|
409
|
-
path: ["firstName"],
|
|
410
|
-
level: "error"
|
|
411
|
-
},
|
|
412
|
-
delay: 800
|
|
413
|
-
}
|
|
414
|
-
]
|
|
415
|
-
},
|
|
395
|
+
parameters: {},
|
|
416
396
|
args: {
|
|
417
397
|
form: formFirstname as never,
|
|
418
398
|
options: {
|
|
419
399
|
hooks: {
|
|
420
400
|
async customValidation(submission: SubmissionType, callback: (error: any) => void) {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
const responseData = await response.json();
|
|
430
|
-
|
|
431
|
-
if (response.ok) {
|
|
432
|
-
callback(null);
|
|
433
|
-
} else {
|
|
434
|
-
callback(responseData);
|
|
435
|
-
}
|
|
401
|
+
setTimeout(() => {
|
|
402
|
+
callback({
|
|
403
|
+
message: "My custom message about this field",
|
|
404
|
+
type: "custom",
|
|
405
|
+
path: ["firstName"],
|
|
406
|
+
level: "error"
|
|
407
|
+
});
|
|
408
|
+
}, 200);
|
|
436
409
|
}
|
|
437
410
|
}
|
|
438
411
|
}
|
|
@@ -451,15 +424,15 @@ export const CustomValidation: Story = {
|
|
|
451
424
|
let firstnameInput = canvas.getByRole("textbox", { name: "First name" });
|
|
452
425
|
let lastNameInput = canvas.getByRole("textbox", { name: "Last name" });
|
|
453
426
|
|
|
454
|
-
userEvent.clear(firstnameInput);
|
|
455
|
-
userEvent.type(firstnameInput, "Jane", { delay: 100 });
|
|
427
|
+
await userEvent.clear(firstnameInput);
|
|
428
|
+
await userEvent.type(firstnameInput, "Jane", { delay: 100 });
|
|
456
429
|
|
|
457
430
|
await waitFor(() => {
|
|
458
431
|
expect(firstnameInput).toHaveValue("Jane");
|
|
459
432
|
});
|
|
460
433
|
|
|
461
|
-
userEvent.clear(lastNameInput);
|
|
462
|
-
userEvent.type(lastNameInput, "Smith", { delay: 100 });
|
|
434
|
+
await userEvent.clear(lastNameInput);
|
|
435
|
+
await userEvent.type(lastNameInput, "Smith", { delay: 100 });
|
|
463
436
|
|
|
464
437
|
await waitFor(() => {
|
|
465
438
|
expect(lastNameInput).toHaveValue("Smith");
|
|
@@ -467,7 +440,7 @@ export const CustomValidation: Story = {
|
|
|
467
440
|
|
|
468
441
|
let submitButton = canvas.getByRole("button", { name: "Submit" });
|
|
469
442
|
|
|
470
|
-
userEvent.click(submitButton);
|
|
443
|
+
await userEvent.click(submitButton);
|
|
471
444
|
|
|
472
445
|
await waitFor(async () => {
|
|
473
446
|
expect(canvas.getByText("Please fix the following errors before submitting.")).toBeInTheDocument();
|
|
@@ -490,35 +463,29 @@ export const FetchSubmissionWithCustomAction: Story = {
|
|
|
490
463
|
}
|
|
491
464
|
},
|
|
492
465
|
parameters: {
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
firstName: "John",
|
|
517
|
-
lastName: "Doe"
|
|
518
|
-
},
|
|
519
|
-
delay: 800
|
|
520
|
-
}
|
|
521
|
-
]
|
|
466
|
+
chromatic: { disableSnapshot: false },
|
|
467
|
+
msw: {
|
|
468
|
+
handlers: [
|
|
469
|
+
http.get("https://local.dev/form/Test", async () => {
|
|
470
|
+
await delay(200);
|
|
471
|
+
return HttpResponse.json(JSON.parse(JSON.stringify(formFirstname)));
|
|
472
|
+
}),
|
|
473
|
+
http.get("https://local.dev/form/Test/submissions/1", async () => {
|
|
474
|
+
await delay(300);
|
|
475
|
+
return HttpResponse.json({
|
|
476
|
+
firstName: "Jane",
|
|
477
|
+
lastName: "Doe"
|
|
478
|
+
});
|
|
479
|
+
}),
|
|
480
|
+
http.put("https://local.dev/form/Test/submissions/1", async () => {
|
|
481
|
+
await delay(800);
|
|
482
|
+
return HttpResponse.json({
|
|
483
|
+
firstName: "Jane",
|
|
484
|
+
lastName: "Doe"
|
|
485
|
+
});
|
|
486
|
+
})
|
|
487
|
+
]
|
|
488
|
+
}
|
|
522
489
|
},
|
|
523
490
|
render(args) {
|
|
524
491
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
@@ -562,15 +529,20 @@ export const FetchSubmissionWithCustomAction: Story = {
|
|
|
562
529
|
let firstnameInput = canvas.getByRole("textbox", { name: "First name" });
|
|
563
530
|
let lastNameInput = canvas.getByRole("textbox", { name: "Last name" });
|
|
564
531
|
|
|
565
|
-
userEvent.clear(firstnameInput);
|
|
566
|
-
|
|
532
|
+
await userEvent.clear(firstnameInput);
|
|
533
|
+
|
|
534
|
+
await waitFor(() => {
|
|
535
|
+
expect(firstnameInput).toHaveValue("");
|
|
536
|
+
});
|
|
537
|
+
|
|
538
|
+
await userEvent.type(firstnameInput, "Jane", { delay: 100 });
|
|
567
539
|
|
|
568
540
|
await waitFor(() => {
|
|
569
541
|
expect(firstnameInput).toHaveValue("Jane");
|
|
570
542
|
});
|
|
571
543
|
|
|
572
|
-
userEvent.clear(lastNameInput);
|
|
573
|
-
userEvent.type(lastNameInput, "Smith", { delay: 100 });
|
|
544
|
+
await userEvent.clear(lastNameInput);
|
|
545
|
+
await userEvent.type(lastNameInput, "Smith", { delay: 100 });
|
|
574
546
|
|
|
575
547
|
await waitFor(() => {
|
|
576
548
|
expect(lastNameInput).toHaveValue("Smith");
|
|
@@ -578,7 +550,7 @@ export const FetchSubmissionWithCustomAction: Story = {
|
|
|
578
550
|
|
|
579
551
|
let submitButton = canvas.getByRole("button", { name: "Submit" });
|
|
580
552
|
|
|
581
|
-
userEvent.click(submitButton);
|
|
553
|
+
await userEvent.click(submitButton);
|
|
582
554
|
|
|
583
555
|
await delay(1000);
|
|
584
556
|
|
|
@@ -597,37 +569,36 @@ export const ErrorOnSubmitServer: Story = {
|
|
|
597
569
|
}
|
|
598
570
|
},
|
|
599
571
|
parameters: {
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
]
|
|
572
|
+
chromatic: { disableSnapshot: false },
|
|
573
|
+
msw: {
|
|
574
|
+
handlers: [
|
|
575
|
+
http.get("https://local.dev/form/Test2", async () => {
|
|
576
|
+
await delay(200);
|
|
577
|
+
return HttpResponse.json(JSON.parse(JSON.stringify(formFirstname)));
|
|
578
|
+
}),
|
|
579
|
+
http.get("https://local.dev/form/Test2/submissions/2", async () => {
|
|
580
|
+
await delay(300);
|
|
581
|
+
return HttpResponse.json({
|
|
582
|
+
firstName: "John",
|
|
583
|
+
lastName: "Doe"
|
|
584
|
+
});
|
|
585
|
+
}),
|
|
586
|
+
http.put("https://local.dev/form/Test2/submissions/2", async () => {
|
|
587
|
+
await delay(800);
|
|
588
|
+
return HttpResponse.json(
|
|
589
|
+
{
|
|
590
|
+
message: "My custom message about this field",
|
|
591
|
+
type: "custom",
|
|
592
|
+
path: ["firstName"],
|
|
593
|
+
level: "error"
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
status: 400
|
|
597
|
+
}
|
|
598
|
+
);
|
|
599
|
+
})
|
|
600
|
+
]
|
|
601
|
+
}
|
|
631
602
|
},
|
|
632
603
|
render(args) {
|
|
633
604
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
@@ -671,15 +642,20 @@ export const ErrorOnSubmitServer: Story = {
|
|
|
671
642
|
let firstnameInput = canvas.getByRole("textbox", { name: "First name" });
|
|
672
643
|
let lastNameInput = canvas.getByRole("textbox", { name: "Last name" });
|
|
673
644
|
|
|
674
|
-
userEvent.clear(firstnameInput);
|
|
675
|
-
|
|
645
|
+
await userEvent.clear(firstnameInput);
|
|
646
|
+
|
|
647
|
+
await waitFor(() => {
|
|
648
|
+
expect(firstnameInput).toHaveValue("");
|
|
649
|
+
});
|
|
650
|
+
|
|
651
|
+
await userEvent.type(firstnameInput, "Jane", { delay: 100 });
|
|
676
652
|
|
|
677
653
|
await waitFor(() => {
|
|
678
654
|
expect(firstnameInput).toHaveValue("Jane");
|
|
679
655
|
});
|
|
680
656
|
|
|
681
|
-
userEvent.clear(lastNameInput);
|
|
682
|
-
userEvent.type(lastNameInput, "Smith", { delay: 100 });
|
|
657
|
+
await userEvent.clear(lastNameInput);
|
|
658
|
+
await userEvent.type(lastNameInput, "Smith", { delay: 100 });
|
|
683
659
|
|
|
684
660
|
await waitFor(() => {
|
|
685
661
|
expect(lastNameInput).toHaveValue("Smith");
|
|
@@ -687,7 +663,7 @@ export const ErrorOnSubmitServer: Story = {
|
|
|
687
663
|
|
|
688
664
|
let submitButton = canvas.getByRole("button", { name: "Submit" });
|
|
689
665
|
|
|
690
|
-
userEvent.click(submitButton);
|
|
666
|
+
await userEvent.click(submitButton);
|
|
691
667
|
|
|
692
668
|
await delay(1000);
|
|
693
669
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { expect, fn, userEvent, within } from "
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { expect, fn, userEvent, within } from "storybook/test";
|
|
3
3
|
|
|
4
4
|
import { FormAccess } from "./FormAccess";
|
|
5
5
|
|