@headless-adminapp/app 0.0.10-alpha.0 → 0.0.14-alpha.0
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/dataform → dataform}/hooks/index.d.ts +1 -0
- package/{dist/dataform → dataform}/hooks/index.js +1 -0
- package/{dist/dataform → dataform}/utils/index.d.ts +8 -4
- package/form/index.d.ts +1 -0
- package/{dist/mutable → mutable}/index.d.ts +1 -1
- package/package.json +8 -16
- package/dist/form/index.d.ts +0 -1
- package/src/app/context.ts +0 -11
- package/src/app/hooks/index.ts +0 -1
- package/src/app/hooks/useAppContext.ts +0 -13
- package/src/app/index.ts +0 -2
- package/src/appearance/context.ts +0 -13
- package/src/appearance/hooks/index.ts +0 -1
- package/src/appearance/hooks/useAppearanceContext.ts +0 -13
- package/src/appearance/index.ts +0 -6
- package/src/auth/AuthProvider.tsx +0 -118
- package/src/auth/context.ts +0 -41
- package/src/auth/hooks/index.ts +0 -2
- package/src/auth/hooks/useAuthSession.ts +0 -17
- package/src/auth/hooks/useLogout.ts +0 -23
- package/src/auth/index.ts +0 -4
- package/src/auth/types.ts +0 -17
- package/src/builders/CommandBuilder.ts +0 -777
- package/src/builders/SchemaExperienceBuilder.ts +0 -488
- package/src/builders/index.ts +0 -5
- package/src/command/hooks/index.ts +0 -2
- package/src/command/hooks/useBaseCommandHandlerContext.ts +0 -51
- package/src/command/hooks/useCommands.ts +0 -26
- package/src/command/index.ts +0 -2
- package/src/command/types.ts +0 -116
- package/src/command/utils/index.ts +0 -142
- package/src/components/ScrollView/index.tsx +0 -26
- package/src/dataform/DataFormProvider/DataResolver.tsx +0 -186
- package/src/dataform/DataFormProvider/InitialValueResolver.tsx +0 -55
- package/src/dataform/DataFormProvider/ReadonlyInfoResolver.tsx +0 -35
- package/src/dataform/DataFormProvider/index.tsx +0 -102
- package/src/dataform/context.ts +0 -53
- package/src/dataform/hooks/index.ts +0 -11
- package/src/dataform/hooks/useFormInstance.ts +0 -6
- package/src/dataform/hooks/useFormIsDirty.ts +0 -7
- package/src/dataform/hooks/useFormIsReadonly.ts +0 -11
- package/src/dataform/hooks/useFormNotifications.ts +0 -46
- package/src/dataform/hooks/useFormRecord.ts +0 -7
- package/src/dataform/hooks/useFormSave.ts +0 -147
- package/src/dataform/hooks/useFormSchema.ts +0 -13
- package/src/dataform/hooks/useLoadFormGridPage.ts +0 -97
- package/src/dataform/hooks/useMainFormCommands.ts +0 -65
- package/src/dataform/hooks/useRecordId.ts +0 -6
- package/src/dataform/hooks/useRecordTitle.ts +0 -22
- package/src/dataform/hooks/useSelectedForm.ts +0 -14
- package/src/dataform/index.ts +0 -4
- package/src/dataform/utils/index.ts +0 -582
- package/src/datagrid/DataGridProvider/DataResolver.tsx +0 -281
- package/src/datagrid/DataGridProvider/index.tsx +0 -134
- package/src/datagrid/DataGridProvider/transformViewColumns.ts +0 -54
- package/src/datagrid/DataGridProvider/utils.ts +0 -89
- package/src/datagrid/column-filter/constants.ts +0 -493
- package/src/datagrid/column-filter/index.ts +0 -3
- package/src/datagrid/column-filter/types.ts +0 -68
- package/src/datagrid/column-filter/utils.ts +0 -19
- package/src/datagrid/context.ts +0 -66
- package/src/datagrid/hooks/index.ts +0 -20
- package/src/datagrid/hooks/useChangeView.ts +0 -18
- package/src/datagrid/hooks/useGridColumnFilter.ts +0 -28
- package/src/datagrid/hooks/useGridColumns.ts +0 -13
- package/src/datagrid/hooks/useGridCommands.ts +0 -21
- package/src/datagrid/hooks/useGridData.ts +0 -8
- package/src/datagrid/hooks/useGridDataState.ts +0 -8
- package/src/datagrid/hooks/useGridExtraFilter.ts +0 -6
- package/src/datagrid/hooks/useGridOptions.ts +0 -3
- package/src/datagrid/hooks/useGridPagination.ts +0 -3
- package/src/datagrid/hooks/useGridRefresh.ts +0 -19
- package/src/datagrid/hooks/useGridSchema.ts +0 -13
- package/src/datagrid/hooks/useGridSelection.ts +0 -28
- package/src/datagrid/hooks/useGridSorting.ts +0 -23
- package/src/datagrid/hooks/useGridViewLookupData.ts +0 -10
- package/src/datagrid/hooks/useLoadMainGridPage.ts +0 -90
- package/src/datagrid/hooks/useMainGridCommands.ts +0 -255
- package/src/datagrid/hooks/useMaxRecords.ts +0 -6
- package/src/datagrid/hooks/useSearchText.ts +0 -22
- package/src/datagrid/hooks/useSelectedView.ts +0 -14
- package/src/datagrid/hooks/useSubGridCommands.ts +0 -104
- package/src/datagrid/index.ts +0 -14
- package/src/dialog/DialogProvider.tsx +0 -20
- package/src/dialog/context.ts +0 -14
- package/src/dialog/hooks/index.ts +0 -8
- package/src/dialog/hooks/useCloseDialog.ts +0 -36
- package/src/dialog/hooks/useDialogItem.ts +0 -8
- package/src/dialog/hooks/useDialogItems.ts +0 -6
- package/src/dialog/hooks/useOpenAlertDialog.ts +0 -30
- package/src/dialog/hooks/useOpenConfirmDialog.ts +0 -45
- package/src/dialog/hooks/useOpenDialog.ts +0 -39
- package/src/dialog/hooks/useOpenErrorDialog.ts +0 -26
- package/src/dialog/hooks/useOpenPromptDialog.ts +0 -46
- package/src/dialog/index.ts +0 -7
- package/src/form/FormValidationStringContext.ts +0 -30
- package/src/form/index.ts +0 -6
- package/src/hooks/index.ts +0 -5
- package/src/hooks/useDebouncedValue.ts +0 -38
- package/src/hooks/useElementLayout.ts +0 -49
- package/src/hooks/useIsMobile.ts +0 -21
- package/src/hooks/useStorageState.ts +0 -36
- package/src/hooks/useSystemColorScheme.ts +0 -38
- package/src/index.css +0 -4
- package/src/insights/context.ts +0 -5
- package/src/insights/hooks/index.ts +0 -14
- package/src/insights/index.ts +0 -2
- package/src/locale/context.ts +0 -7
- package/src/locale/index.ts +0 -3
- package/src/locale/types.ts +0 -3
- package/src/locale/useLocale.ts +0 -13
- package/src/metadata/MetadataProvider.tsx +0 -51
- package/src/metadata/context.ts +0 -15
- package/src/metadata/hooks/index.ts +0 -8
- package/src/metadata/hooks/useAppStore.ts +0 -6
- package/src/metadata/hooks/useExperienceStore.ts +0 -6
- package/src/metadata/hooks/useExperienceView.ts +0 -36
- package/src/metadata/hooks/useExperienceViewCommands.ts +0 -20
- package/src/metadata/hooks/useExperienceViewLookup.ts +0 -33
- package/src/metadata/hooks/useExperienceViewSubgridCommands.ts +0 -20
- package/src/metadata/hooks/useMetadata.ts +0 -44
- package/src/metadata/hooks/useSchema.ts +0 -11
- package/src/metadata/index.ts +0 -3
- package/src/mutable/context.ts +0 -71
- package/src/mutable/index.ts +0 -10
- package/src/mutable/state.ts +0 -13
- package/src/mutable/type.ts +0 -9
- package/src/mutable/utils.ts +0 -80
- package/src/navigation/hooks/useOpenForm.ts +0 -34
- package/src/progress-indicator/ProgressIndicatorProvider.tsx +0 -77
- package/src/progress-indicator/context.ts +0 -12
- package/src/progress-indicator/hooks/index.ts +0 -1
- package/src/progress-indicator/hooks/useProgressIndicator.ts +0 -15
- package/src/progress-indicator/index.ts +0 -6
- package/src/providers/PageEntityFormProvider/index.tsx +0 -34
- package/src/providers/PageEntityViewProvider/index.tsx +0 -39
- package/src/recordset/RecordSetProvider.tsx +0 -55
- package/src/recordset/context.ts +0 -12
- package/src/recordset/hooks/index.ts +0 -3
- package/src/recordset/hooks/useRecordSetResult.ts +0 -94
- package/src/recordset/hooks/useRecordSetSetter.ts +0 -21
- package/src/recordset/hooks/useRecordSetVisibility.ts +0 -24
- package/src/recordset/index.ts +0 -3
- package/src/route/RouteProvider.tsx +0 -76
- package/src/route/context.ts +0 -39
- package/src/route/hooks/index.ts +0 -5
- package/src/route/hooks/useBasePath.ts +0 -7
- package/src/route/hooks/usePathname.ts +0 -7
- package/src/route/hooks/useRouteResolver.ts +0 -7
- package/src/route/hooks/useRouter.ts +0 -7
- package/src/route/hooks/useSearchParams.ts +0 -7
- package/src/route/index.ts +0 -2
- package/src/route/types.ts +0 -1
- package/src/store/ClientAppStore.ts +0 -20
- package/src/store/ComponentStore.tsx +0 -22
- package/src/store/EventManager.ts +0 -33
- package/src/store/SchemaExperienceStore.ts +0 -374
- package/src/store/index.ts +0 -4
- package/src/toast-notification/ToastNotificationProvider.tsx +0 -23
- package/src/toast-notification/context.ts +0 -17
- package/src/toast-notification/hooks/index.ts +0 -3
- package/src/toast-notification/hooks/useCloseToastNotification.ts +0 -36
- package/src/toast-notification/hooks/useOpenToastNotification.ts +0 -38
- package/src/toast-notification/hooks/useToastNotificationItems.ts +0 -6
- package/src/toast-notification/index.ts +0 -7
- package/src/transport/InMemoryDataService/index.ts +0 -157
- package/src/transport/RestDataService/index.ts +0 -151
- package/src/transport/context.ts +0 -6
- package/src/transport/hooks/index.ts +0 -1
- package/src/transport/hooks/useDataService.ts +0 -13
- package/src/transport/index.ts +0 -2
- package/src/utils/calculateColumnWidths.ts +0 -72
- package/src/utils/index.ts +0 -1
- package/src/widget/context.ts +0 -5
- package/src/widget/hooks/index.ts +0 -11
- package/src/widget/index.ts +0 -1
- package/tsconfig.json +0 -9
- package/tsconfig.tsbuildinfo +0 -1
- /package/{dist/app → app}/context.d.ts +0 -0
- /package/{dist/app → app}/context.js +0 -0
- /package/{dist/app → app}/hooks/index.d.ts +0 -0
- /package/{dist/app → app}/hooks/index.js +0 -0
- /package/{dist/app → app}/hooks/useAppContext.d.ts +0 -0
- /package/{dist/app → app}/hooks/useAppContext.js +0 -0
- /package/{dist/app → app}/index.d.ts +0 -0
- /package/{dist/app → app}/index.js +0 -0
- /package/{dist/appearance → appearance}/context.d.ts +0 -0
- /package/{dist/appearance → appearance}/context.js +0 -0
- /package/{dist/appearance → appearance}/hooks/index.d.ts +0 -0
- /package/{dist/appearance → appearance}/hooks/index.js +0 -0
- /package/{dist/appearance → appearance}/hooks/useAppearanceContext.d.ts +0 -0
- /package/{dist/appearance → appearance}/hooks/useAppearanceContext.js +0 -0
- /package/{dist/appearance → appearance}/index.d.ts +0 -0
- /package/{dist/appearance → appearance}/index.js +0 -0
- /package/{dist/auth → auth}/AuthProvider.d.ts +0 -0
- /package/{dist/auth → auth}/AuthProvider.js +0 -0
- /package/{dist/auth → auth}/context.d.ts +0 -0
- /package/{dist/auth → auth}/context.js +0 -0
- /package/{dist/auth → auth}/hooks/index.d.ts +0 -0
- /package/{dist/auth → auth}/hooks/index.js +0 -0
- /package/{dist/auth → auth}/hooks/useAuthSession.d.ts +0 -0
- /package/{dist/auth → auth}/hooks/useAuthSession.js +0 -0
- /package/{dist/auth → auth}/hooks/useLogout.d.ts +0 -0
- /package/{dist/auth → auth}/hooks/useLogout.js +0 -0
- /package/{dist/auth → auth}/index.d.ts +0 -0
- /package/{dist/auth → auth}/index.js +0 -0
- /package/{dist/auth → auth}/types.d.ts +0 -0
- /package/{dist/auth → auth}/types.js +0 -0
- /package/{dist/builders → builders}/CommandBuilder.d.ts +0 -0
- /package/{dist/builders → builders}/CommandBuilder.js +0 -0
- /package/{dist/builders → builders}/SchemaExperienceBuilder.d.ts +0 -0
- /package/{dist/builders → builders}/SchemaExperienceBuilder.js +0 -0
- /package/{dist/builders → builders}/index.d.ts +0 -0
- /package/{dist/builders → builders}/index.js +0 -0
- /package/{dist/command → command}/hooks/index.d.ts +0 -0
- /package/{dist/command → command}/hooks/index.js +0 -0
- /package/{dist/command → command}/hooks/useBaseCommandHandlerContext.d.ts +0 -0
- /package/{dist/command → command}/hooks/useBaseCommandHandlerContext.js +0 -0
- /package/{dist/command → command}/hooks/useCommands.d.ts +0 -0
- /package/{dist/command → command}/hooks/useCommands.js +0 -0
- /package/{dist/command → command}/index.d.ts +0 -0
- /package/{dist/command → command}/index.js +0 -0
- /package/{dist/command → command}/types.d.ts +0 -0
- /package/{dist/command → command}/types.js +0 -0
- /package/{dist/command → command}/utils/index.d.ts +0 -0
- /package/{dist/command → command}/utils/index.js +0 -0
- /package/{dist/components → components}/ScrollView/index.d.ts +0 -0
- /package/{dist/components → components}/ScrollView/index.js +0 -0
- /package/{dist/dataform → dataform}/DataFormProvider/DataResolver.d.ts +0 -0
- /package/{dist/dataform → dataform}/DataFormProvider/DataResolver.js +0 -0
- /package/{dist/dataform → dataform}/DataFormProvider/InitialValueResolver.d.ts +0 -0
- /package/{dist/dataform → dataform}/DataFormProvider/InitialValueResolver.js +0 -0
- /package/{dist/dataform → dataform}/DataFormProvider/ReadonlyInfoResolver.d.ts +0 -0
- /package/{dist/dataform → dataform}/DataFormProvider/ReadonlyInfoResolver.js +0 -0
- /package/{dist/dataform → dataform}/DataFormProvider/index.d.ts +0 -0
- /package/{dist/dataform → dataform}/DataFormProvider/index.js +0 -0
- /package/{dist/dataform → dataform}/context.d.ts +0 -0
- /package/{dist/dataform → dataform}/context.js +0 -0
- /package/{dist/dataform → dataform}/hooks/useFormInstance.d.ts +0 -0
- /package/{dist/dataform → dataform}/hooks/useFormInstance.js +0 -0
- /package/{dist/dataform → dataform}/hooks/useFormIsDirty.d.ts +0 -0
- /package/{dist/dataform → dataform}/hooks/useFormIsDirty.js +0 -0
- /package/{dist/dataform → dataform}/hooks/useFormIsReadonly.d.ts +0 -0
- /package/{dist/dataform → dataform}/hooks/useFormIsReadonly.js +0 -0
- /package/{dist/dataform → dataform}/hooks/useFormNotifications.d.ts +0 -0
- /package/{dist/dataform → dataform}/hooks/useFormNotifications.js +0 -0
- /package/{dist/dataform → dataform}/hooks/useFormRecord.d.ts +0 -0
- /package/{dist/dataform → dataform}/hooks/useFormRecord.js +0 -0
- /package/{dist/dataform → dataform}/hooks/useFormSave.d.ts +0 -0
- /package/{dist/dataform → dataform}/hooks/useFormSave.js +0 -0
- /package/{dist/dataform → dataform}/hooks/useFormSchema.d.ts +0 -0
- /package/{dist/dataform → dataform}/hooks/useFormSchema.js +0 -0
- /package/{dist/dataform → dataform}/hooks/useLoadFormGridPage.d.ts +0 -0
- /package/{dist/dataform → dataform}/hooks/useLoadFormGridPage.js +0 -0
- /package/{dist/dataform → dataform}/hooks/useMainFormCommands.d.ts +0 -0
- /package/{dist/dataform → dataform}/hooks/useMainFormCommands.js +0 -0
- /package/{dist/dataform → dataform}/hooks/useRecordId.d.ts +0 -0
- /package/{dist/dataform → dataform}/hooks/useRecordId.js +0 -0
- /package/{dist/dataform → dataform}/hooks/useRecordTitle.d.ts +0 -0
- /package/{dist/dataform → dataform}/hooks/useRecordTitle.js +0 -0
- /package/{dist/dataform → dataform}/hooks/useSelectedForm.d.ts +0 -0
- /package/{dist/dataform → dataform}/hooks/useSelectedForm.js +0 -0
- /package/{dist/dataform → dataform}/index.d.ts +0 -0
- /package/{dist/dataform → dataform}/index.js +0 -0
- /package/{dist/dataform → dataform}/utils/index.js +0 -0
- /package/{dist/datagrid → datagrid}/DataGridProvider/DataResolver.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/DataGridProvider/DataResolver.js +0 -0
- /package/{dist/datagrid → datagrid}/DataGridProvider/index.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/DataGridProvider/index.js +0 -0
- /package/{dist/datagrid → datagrid}/DataGridProvider/transformViewColumns.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/DataGridProvider/transformViewColumns.js +0 -0
- /package/{dist/datagrid → datagrid}/DataGridProvider/utils.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/DataGridProvider/utils.js +0 -0
- /package/{dist/datagrid → datagrid}/column-filter/constants.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/column-filter/constants.js +0 -0
- /package/{dist/datagrid → datagrid}/column-filter/index.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/column-filter/index.js +0 -0
- /package/{dist/datagrid → datagrid}/column-filter/types.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/column-filter/types.js +0 -0
- /package/{dist/datagrid → datagrid}/column-filter/utils.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/column-filter/utils.js +0 -0
- /package/{dist/datagrid → datagrid}/context.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/context.js +0 -0
- /package/{dist/datagrid → datagrid}/hooks/index.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/hooks/index.js +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useChangeView.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useChangeView.js +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useGridColumnFilter.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useGridColumnFilter.js +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useGridColumns.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useGridColumns.js +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useGridCommands.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useGridCommands.js +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useGridData.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useGridData.js +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useGridDataState.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useGridDataState.js +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useGridExtraFilter.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useGridExtraFilter.js +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useGridOptions.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useGridOptions.js +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useGridPagination.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useGridPagination.js +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useGridRefresh.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useGridRefresh.js +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useGridSchema.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useGridSchema.js +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useGridSelection.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useGridSelection.js +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useGridSorting.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useGridSorting.js +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useGridViewLookupData.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useGridViewLookupData.js +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useLoadMainGridPage.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useLoadMainGridPage.js +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useMainGridCommands.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useMainGridCommands.js +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useMaxRecords.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useMaxRecords.js +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useSearchText.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useSearchText.js +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useSelectedView.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useSelectedView.js +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useSubGridCommands.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/hooks/useSubGridCommands.js +0 -0
- /package/{dist/datagrid → datagrid}/index.d.ts +0 -0
- /package/{dist/datagrid → datagrid}/index.js +0 -0
- /package/{dist/dialog → dialog}/DialogProvider.d.ts +0 -0
- /package/{dist/dialog → dialog}/DialogProvider.js +0 -0
- /package/{dist/dialog → dialog}/context.d.ts +0 -0
- /package/{dist/dialog → dialog}/context.js +0 -0
- /package/{dist/dialog → dialog}/hooks/index.d.ts +0 -0
- /package/{dist/dialog → dialog}/hooks/index.js +0 -0
- /package/{dist/dialog → dialog}/hooks/useCloseDialog.d.ts +0 -0
- /package/{dist/dialog → dialog}/hooks/useCloseDialog.js +0 -0
- /package/{dist/dialog → dialog}/hooks/useDialogItem.d.ts +0 -0
- /package/{dist/dialog → dialog}/hooks/useDialogItem.js +0 -0
- /package/{dist/dialog → dialog}/hooks/useDialogItems.d.ts +0 -0
- /package/{dist/dialog → dialog}/hooks/useDialogItems.js +0 -0
- /package/{dist/dialog → dialog}/hooks/useOpenAlertDialog.d.ts +0 -0
- /package/{dist/dialog → dialog}/hooks/useOpenAlertDialog.js +0 -0
- /package/{dist/dialog → dialog}/hooks/useOpenConfirmDialog.d.ts +0 -0
- /package/{dist/dialog → dialog}/hooks/useOpenConfirmDialog.js +0 -0
- /package/{dist/dialog → dialog}/hooks/useOpenDialog.d.ts +0 -0
- /package/{dist/dialog → dialog}/hooks/useOpenDialog.js +0 -0
- /package/{dist/dialog → dialog}/hooks/useOpenErrorDialog.d.ts +0 -0
- /package/{dist/dialog → dialog}/hooks/useOpenErrorDialog.js +0 -0
- /package/{dist/dialog → dialog}/hooks/useOpenPromptDialog.d.ts +0 -0
- /package/{dist/dialog → dialog}/hooks/useOpenPromptDialog.js +0 -0
- /package/{dist/dialog → dialog}/index.d.ts +0 -0
- /package/{dist/dialog → dialog}/index.js +0 -0
- /package/{dist/form → form}/FormValidationStringContext.d.ts +0 -0
- /package/{dist/form → form}/FormValidationStringContext.js +0 -0
- /package/{dist/form → form}/index.js +0 -0
- /package/{dist/hooks → hooks}/index.d.ts +0 -0
- /package/{dist/hooks → hooks}/index.js +0 -0
- /package/{dist/hooks → hooks}/useDebouncedValue.d.ts +0 -0
- /package/{dist/hooks → hooks}/useDebouncedValue.js +0 -0
- /package/{dist/hooks → hooks}/useElementLayout.d.ts +0 -0
- /package/{dist/hooks → hooks}/useElementLayout.js +0 -0
- /package/{dist/hooks → hooks}/useIsMobile.d.ts +0 -0
- /package/{dist/hooks → hooks}/useIsMobile.js +0 -0
- /package/{dist/hooks → hooks}/useStorageState.d.ts +0 -0
- /package/{dist/hooks → hooks}/useStorageState.js +0 -0
- /package/{dist/hooks → hooks}/useSystemColorScheme.d.ts +0 -0
- /package/{dist/hooks → hooks}/useSystemColorScheme.js +0 -0
- /package/{dist/insights → insights}/context.d.ts +0 -0
- /package/{dist/insights → insights}/context.js +0 -0
- /package/{dist/insights → insights}/hooks/index.d.ts +0 -0
- /package/{dist/insights → insights}/hooks/index.js +0 -0
- /package/{dist/insights → insights}/index.d.ts +0 -0
- /package/{dist/insights → insights}/index.js +0 -0
- /package/{dist/locale → locale}/context.d.ts +0 -0
- /package/{dist/locale → locale}/context.js +0 -0
- /package/{dist/locale → locale}/index.d.ts +0 -0
- /package/{dist/locale → locale}/index.js +0 -0
- /package/{dist/locale → locale}/types.d.ts +0 -0
- /package/{dist/locale → locale}/types.js +0 -0
- /package/{dist/locale → locale}/useLocale.d.ts +0 -0
- /package/{dist/locale → locale}/useLocale.js +0 -0
- /package/{dist/metadata → metadata}/MetadataProvider.d.ts +0 -0
- /package/{dist/metadata → metadata}/MetadataProvider.js +0 -0
- /package/{dist/metadata → metadata}/context.d.ts +0 -0
- /package/{dist/metadata → metadata}/context.js +0 -0
- /package/{dist/metadata → metadata}/hooks/index.d.ts +0 -0
- /package/{dist/metadata → metadata}/hooks/index.js +0 -0
- /package/{dist/metadata → metadata}/hooks/useAppStore.d.ts +0 -0
- /package/{dist/metadata → metadata}/hooks/useAppStore.js +0 -0
- /package/{dist/metadata → metadata}/hooks/useExperienceStore.d.ts +0 -0
- /package/{dist/metadata → metadata}/hooks/useExperienceStore.js +0 -0
- /package/{dist/metadata → metadata}/hooks/useExperienceView.d.ts +0 -0
- /package/{dist/metadata → metadata}/hooks/useExperienceView.js +0 -0
- /package/{dist/metadata → metadata}/hooks/useExperienceViewCommands.d.ts +0 -0
- /package/{dist/metadata → metadata}/hooks/useExperienceViewCommands.js +0 -0
- /package/{dist/metadata → metadata}/hooks/useExperienceViewLookup.d.ts +0 -0
- /package/{dist/metadata → metadata}/hooks/useExperienceViewLookup.js +0 -0
- /package/{dist/metadata → metadata}/hooks/useExperienceViewSubgridCommands.d.ts +0 -0
- /package/{dist/metadata → metadata}/hooks/useExperienceViewSubgridCommands.js +0 -0
- /package/{dist/metadata → metadata}/hooks/useMetadata.d.ts +0 -0
- /package/{dist/metadata → metadata}/hooks/useMetadata.js +0 -0
- /package/{dist/metadata → metadata}/hooks/useSchema.d.ts +0 -0
- /package/{dist/metadata → metadata}/hooks/useSchema.js +0 -0
- /package/{dist/metadata → metadata}/index.d.ts +0 -0
- /package/{dist/metadata → metadata}/index.js +0 -0
- /package/{dist/mutable → mutable}/context.d.ts +0 -0
- /package/{dist/mutable → mutable}/context.js +0 -0
- /package/{dist/mutable → mutable}/index.js +0 -0
- /package/{dist/mutable → mutable}/state.d.ts +0 -0
- /package/{dist/mutable → mutable}/state.js +0 -0
- /package/{dist/mutable → mutable}/type.d.ts +0 -0
- /package/{dist/mutable → mutable}/type.js +0 -0
- /package/{dist/mutable → mutable}/utils.d.ts +0 -0
- /package/{dist/mutable → mutable}/utils.js +0 -0
- /package/{dist/navigation → navigation}/hooks/useOpenForm.d.ts +0 -0
- /package/{dist/navigation → navigation}/hooks/useOpenForm.js +0 -0
- /package/{dist/progress-indicator → progress-indicator}/ProgressIndicatorProvider.d.ts +0 -0
- /package/{dist/progress-indicator → progress-indicator}/ProgressIndicatorProvider.js +0 -0
- /package/{dist/progress-indicator → progress-indicator}/context.d.ts +0 -0
- /package/{dist/progress-indicator → progress-indicator}/context.js +0 -0
- /package/{dist/progress-indicator → progress-indicator}/hooks/index.d.ts +0 -0
- /package/{dist/progress-indicator → progress-indicator}/hooks/index.js +0 -0
- /package/{dist/progress-indicator → progress-indicator}/hooks/useProgressIndicator.d.ts +0 -0
- /package/{dist/progress-indicator → progress-indicator}/hooks/useProgressIndicator.js +0 -0
- /package/{dist/progress-indicator → progress-indicator}/index.d.ts +0 -0
- /package/{dist/progress-indicator → progress-indicator}/index.js +0 -0
- /package/{dist/providers → providers}/PageEntityFormProvider/index.d.ts +0 -0
- /package/{dist/providers → providers}/PageEntityFormProvider/index.js +0 -0
- /package/{dist/providers → providers}/PageEntityViewProvider/index.d.ts +0 -0
- /package/{dist/providers → providers}/PageEntityViewProvider/index.js +0 -0
- /package/{dist/recordset → recordset}/RecordSetProvider.d.ts +0 -0
- /package/{dist/recordset → recordset}/RecordSetProvider.js +0 -0
- /package/{dist/recordset → recordset}/context.d.ts +0 -0
- /package/{dist/recordset → recordset}/context.js +0 -0
- /package/{dist/recordset → recordset}/hooks/index.d.ts +0 -0
- /package/{dist/recordset → recordset}/hooks/index.js +0 -0
- /package/{dist/recordset → recordset}/hooks/useRecordSetResult.d.ts +0 -0
- /package/{dist/recordset → recordset}/hooks/useRecordSetResult.js +0 -0
- /package/{dist/recordset → recordset}/hooks/useRecordSetSetter.d.ts +0 -0
- /package/{dist/recordset → recordset}/hooks/useRecordSetSetter.js +0 -0
- /package/{dist/recordset → recordset}/hooks/useRecordSetVisibility.d.ts +0 -0
- /package/{dist/recordset → recordset}/hooks/useRecordSetVisibility.js +0 -0
- /package/{dist/recordset → recordset}/index.d.ts +0 -0
- /package/{dist/recordset → recordset}/index.js +0 -0
- /package/{dist/route → route}/RouteProvider.d.ts +0 -0
- /package/{dist/route → route}/RouteProvider.js +0 -0
- /package/{dist/route → route}/context.d.ts +0 -0
- /package/{dist/route → route}/context.js +0 -0
- /package/{dist/route → route}/hooks/index.d.ts +0 -0
- /package/{dist/route → route}/hooks/index.js +0 -0
- /package/{dist/route → route}/hooks/useBasePath.d.ts +0 -0
- /package/{dist/route → route}/hooks/useBasePath.js +0 -0
- /package/{dist/route → route}/hooks/usePathname.d.ts +0 -0
- /package/{dist/route → route}/hooks/usePathname.js +0 -0
- /package/{dist/route → route}/hooks/useRouteResolver.d.ts +0 -0
- /package/{dist/route → route}/hooks/useRouteResolver.js +0 -0
- /package/{dist/route → route}/hooks/useRouter.d.ts +0 -0
- /package/{dist/route → route}/hooks/useRouter.js +0 -0
- /package/{dist/route → route}/hooks/useSearchParams.d.ts +0 -0
- /package/{dist/route → route}/hooks/useSearchParams.js +0 -0
- /package/{dist/route → route}/index.d.ts +0 -0
- /package/{dist/route → route}/index.js +0 -0
- /package/{dist/route → route}/types.d.ts +0 -0
- /package/{dist/route → route}/types.js +0 -0
- /package/{dist/store → store}/ClientAppStore.d.ts +0 -0
- /package/{dist/store → store}/ClientAppStore.js +0 -0
- /package/{dist/store → store}/ComponentStore.d.ts +0 -0
- /package/{dist/store → store}/ComponentStore.js +0 -0
- /package/{dist/store → store}/EventManager.d.ts +0 -0
- /package/{dist/store → store}/EventManager.js +0 -0
- /package/{dist/store → store}/SchemaExperienceStore.d.ts +0 -0
- /package/{dist/store → store}/SchemaExperienceStore.js +0 -0
- /package/{dist/store → store}/index.d.ts +0 -0
- /package/{dist/store → store}/index.js +0 -0
- /package/{dist/toast-notification → toast-notification}/ToastNotificationProvider.d.ts +0 -0
- /package/{dist/toast-notification → toast-notification}/ToastNotificationProvider.js +0 -0
- /package/{dist/toast-notification → toast-notification}/context.d.ts +0 -0
- /package/{dist/toast-notification → toast-notification}/context.js +0 -0
- /package/{dist/toast-notification → toast-notification}/hooks/index.d.ts +0 -0
- /package/{dist/toast-notification → toast-notification}/hooks/index.js +0 -0
- /package/{dist/toast-notification → toast-notification}/hooks/useCloseToastNotification.d.ts +0 -0
- /package/{dist/toast-notification → toast-notification}/hooks/useCloseToastNotification.js +0 -0
- /package/{dist/toast-notification → toast-notification}/hooks/useOpenToastNotification.d.ts +0 -0
- /package/{dist/toast-notification → toast-notification}/hooks/useOpenToastNotification.js +0 -0
- /package/{dist/toast-notification → toast-notification}/hooks/useToastNotificationItems.d.ts +0 -0
- /package/{dist/toast-notification → toast-notification}/hooks/useToastNotificationItems.js +0 -0
- /package/{dist/toast-notification → toast-notification}/index.d.ts +0 -0
- /package/{dist/toast-notification → toast-notification}/index.js +0 -0
- /package/{dist/transport → transport}/InMemoryDataService/index.d.ts +0 -0
- /package/{dist/transport → transport}/InMemoryDataService/index.js +0 -0
- /package/{dist/transport → transport}/RestDataService/index.d.ts +0 -0
- /package/{dist/transport → transport}/RestDataService/index.js +0 -0
- /package/{dist/transport → transport}/context.d.ts +0 -0
- /package/{dist/transport → transport}/context.js +0 -0
- /package/{dist/transport → transport}/hooks/index.d.ts +0 -0
- /package/{dist/transport → transport}/hooks/index.js +0 -0
- /package/{dist/transport → transport}/hooks/useDataService.d.ts +0 -0
- /package/{dist/transport → transport}/hooks/useDataService.js +0 -0
- /package/{dist/transport → transport}/index.d.ts +0 -0
- /package/{dist/transport → transport}/index.js +0 -0
- /package/{dist/utils → utils}/calculateColumnWidths.d.ts +0 -0
- /package/{dist/utils → utils}/calculateColumnWidths.js +0 -0
- /package/{dist/utils → utils}/index.d.ts +0 -0
- /package/{dist/utils → utils}/index.js +0 -0
- /package/{dist/widget → widget}/context.d.ts +0 -0
- /package/{dist/widget → widget}/context.js +0 -0
- /package/{dist/widget → widget}/hooks/index.d.ts +0 -0
- /package/{dist/widget → widget}/hooks/index.js +0 -0
- /package/{dist/widget → widget}/index.d.ts +0 -0
- /package/{dist/widget → widget}/index.js +0 -0
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CommandItemExperience,
|
|
3
|
-
MenuItemCommandExperience,
|
|
4
|
-
} from '@headless-adminapp/core/experience/command';
|
|
5
|
-
import { checkCommandCondition } from '@headless-adminapp/core/experience/command/utils';
|
|
6
|
-
import {
|
|
7
|
-
ArrayGroupWithAtLeastOne,
|
|
8
|
-
ArrayWithAtLeastOne,
|
|
9
|
-
} from '@headless-adminapp/core/types';
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
CommandItemExperienceSelector,
|
|
13
|
-
CommandItemState,
|
|
14
|
-
MenuItemCommandState,
|
|
15
|
-
} from '../types';
|
|
16
|
-
|
|
17
|
-
function transformedProperties<HandlerContext>(
|
|
18
|
-
command: Pick<
|
|
19
|
-
CommandItemExperience<HandlerContext>,
|
|
20
|
-
'Icon' | 'disabled' | 'onClick' | 'hidden'
|
|
21
|
-
>,
|
|
22
|
-
handlerContext: HandlerContext
|
|
23
|
-
) {
|
|
24
|
-
const IconComponent = command.Icon;
|
|
25
|
-
|
|
26
|
-
const hidden = checkCommandCondition(handlerContext, command.hidden);
|
|
27
|
-
|
|
28
|
-
const disabled = checkCommandCondition(handlerContext, command.disabled);
|
|
29
|
-
|
|
30
|
-
const onClick = command.onClick
|
|
31
|
-
? () => {
|
|
32
|
-
command.onClick!(handlerContext)?.catch(console.error);
|
|
33
|
-
}
|
|
34
|
-
: undefined;
|
|
35
|
-
|
|
36
|
-
return {
|
|
37
|
-
Icon: IconComponent,
|
|
38
|
-
hidden,
|
|
39
|
-
disabled,
|
|
40
|
-
onClick,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function transformCommand<HandlerContext>(
|
|
45
|
-
command: CommandItemExperience<HandlerContext>,
|
|
46
|
-
handlerContext: HandlerContext
|
|
47
|
-
): CommandItemState {
|
|
48
|
-
const commandType = command.type;
|
|
49
|
-
|
|
50
|
-
switch (command.type) {
|
|
51
|
-
case 'icon':
|
|
52
|
-
return {
|
|
53
|
-
type: command.type,
|
|
54
|
-
isQuickAction: command.isQuickAction,
|
|
55
|
-
danger: command.danger,
|
|
56
|
-
iconPosition: command.iconPosition,
|
|
57
|
-
...transformedProperties(command, handlerContext),
|
|
58
|
-
} as CommandItemState;
|
|
59
|
-
case 'button':
|
|
60
|
-
return {
|
|
61
|
-
type: command.type,
|
|
62
|
-
isQuickAction: command.isQuickAction,
|
|
63
|
-
text: command.text,
|
|
64
|
-
danger: command.danger,
|
|
65
|
-
iconPosition: command.iconPosition,
|
|
66
|
-
localizedTexts: command.localizedText,
|
|
67
|
-
...transformedProperties(command, handlerContext),
|
|
68
|
-
} as CommandItemState;
|
|
69
|
-
case 'menu':
|
|
70
|
-
return {
|
|
71
|
-
type: command.type,
|
|
72
|
-
text: command.text,
|
|
73
|
-
danger: command.danger,
|
|
74
|
-
localizedTexts: command.localizedTexts,
|
|
75
|
-
iconPosition: command.iconPosition,
|
|
76
|
-
...transformedProperties(command, handlerContext),
|
|
77
|
-
items: command.items.map((item) =>
|
|
78
|
-
transformMenuItems(item, handlerContext)
|
|
79
|
-
),
|
|
80
|
-
} as CommandItemState;
|
|
81
|
-
default:
|
|
82
|
-
throw new Error(`Unknown command type: ${commandType}`);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function transformMenuItems<HandlerContext>(
|
|
87
|
-
items: ArrayWithAtLeastOne<MenuItemCommandExperience<HandlerContext>>,
|
|
88
|
-
handlerContext: HandlerContext
|
|
89
|
-
): ArrayWithAtLeastOne<MenuItemCommandState> {
|
|
90
|
-
return items.map((item) =>
|
|
91
|
-
transformMenuItem(item, handlerContext)
|
|
92
|
-
) as ArrayWithAtLeastOne<MenuItemCommandState>;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function transformMenuItem<HandlerContext>(
|
|
96
|
-
item: MenuItemCommandExperience<HandlerContext>,
|
|
97
|
-
handlerContext: HandlerContext
|
|
98
|
-
): MenuItemCommandState {
|
|
99
|
-
return {
|
|
100
|
-
danger: item.danger,
|
|
101
|
-
text: item.text,
|
|
102
|
-
localizedTexts: item.localizedTexts,
|
|
103
|
-
...transformedProperties(item, handlerContext),
|
|
104
|
-
items: item.items?.map((item) =>
|
|
105
|
-
transformMenuItems(item, handlerContext)
|
|
106
|
-
) as ArrayGroupWithAtLeastOne<MenuItemCommandState>,
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function transformCommandGroup<HandlerContext>(
|
|
111
|
-
group: CommandItemExperience<HandlerContext>[],
|
|
112
|
-
handlerContext: HandlerContext,
|
|
113
|
-
selector?: CommandItemExperienceSelector<HandlerContext>
|
|
114
|
-
): CommandItemState[] {
|
|
115
|
-
return group
|
|
116
|
-
.map((command) => {
|
|
117
|
-
if (!(selector?.(command) ?? true)) {
|
|
118
|
-
return false; // Skip command
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
const transformedCommand = transformCommand(command, handlerContext);
|
|
122
|
-
|
|
123
|
-
if (transformedCommand.hidden) {
|
|
124
|
-
return false; // Skip command
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return transformedCommand;
|
|
128
|
-
})
|
|
129
|
-
.filter(Boolean) as CommandItemState[];
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export function transformCommadnGroups<HandlerContext>(
|
|
133
|
-
groups: CommandItemExperience<HandlerContext>[][],
|
|
134
|
-
handlerContext: HandlerContext,
|
|
135
|
-
selector?: CommandItemExperienceSelector<HandlerContext>
|
|
136
|
-
): CommandItemState[][] {
|
|
137
|
-
return groups
|
|
138
|
-
.map((group) => {
|
|
139
|
-
return transformCommandGroup(group, handlerContext, selector);
|
|
140
|
-
})
|
|
141
|
-
.filter((group) => group.length > 0);
|
|
142
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import clsx from 'clsx';
|
|
2
|
-
import { FC, PropsWithChildren } from 'react';
|
|
3
|
-
import Scrollbars, { ScrollbarProps } from 'react-custom-scrollbars-2';
|
|
4
|
-
|
|
5
|
-
interface ScrollViewProps {
|
|
6
|
-
className?: string;
|
|
7
|
-
autoHide?: boolean;
|
|
8
|
-
rtl?: boolean;
|
|
9
|
-
onScroll?: ScrollbarProps['onScroll'];
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const ScrollView: FC<PropsWithChildren<ScrollViewProps>> = ({
|
|
13
|
-
children,
|
|
14
|
-
className,
|
|
15
|
-
rtl,
|
|
16
|
-
autoHide,
|
|
17
|
-
onScroll,
|
|
18
|
-
}) => (
|
|
19
|
-
<Scrollbars
|
|
20
|
-
autoHide={autoHide}
|
|
21
|
-
className={clsx(className, 'hdl-scrollbar', rtl && 'rtl')}
|
|
22
|
-
onScroll={onScroll}
|
|
23
|
-
>
|
|
24
|
-
{children}
|
|
25
|
-
</Scrollbars>
|
|
26
|
-
);
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import { Form } from '@headless-adminapp/core/experience/form';
|
|
2
|
-
import {
|
|
3
|
-
InferredSchemaType,
|
|
4
|
-
Schema,
|
|
5
|
-
SchemaAttributes,
|
|
6
|
-
} from '@headless-adminapp/core/schema';
|
|
7
|
-
import { HttpError, IDataService } from '@headless-adminapp/core/transport';
|
|
8
|
-
import { keepPreviousData, useQuery } from '@tanstack/react-query';
|
|
9
|
-
import { useEffect, useMemo } from 'react';
|
|
10
|
-
|
|
11
|
-
import { useMetadata } from '../../metadata/hooks';
|
|
12
|
-
import { useContextSetValue } from '../../mutable';
|
|
13
|
-
import { useDataService } from '../../transport';
|
|
14
|
-
import { DataFormContext } from '../context';
|
|
15
|
-
import { useDataFormSchema, useRecordId, useSelectedForm } from '../hooks';
|
|
16
|
-
|
|
17
|
-
export function getControls(form: Form) {
|
|
18
|
-
const controls = form.experience.tabs
|
|
19
|
-
.flatMap((tab) => tab.tabColumns)
|
|
20
|
-
.flatMap((tabColumn) => tabColumn.sections)
|
|
21
|
-
.flatMap((section) => section.controls);
|
|
22
|
-
|
|
23
|
-
return controls;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function getColumns(form: Form) {
|
|
27
|
-
const columns = Array.from(
|
|
28
|
-
new Set([
|
|
29
|
-
...(form.experience.includeAttributes ?? []),
|
|
30
|
-
...form.experience.headerControls,
|
|
31
|
-
...getControls(form)
|
|
32
|
-
.filter((control) => control.type === 'standard')
|
|
33
|
-
.map((control) => control.attributeName),
|
|
34
|
-
])
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
return columns;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
async function getRecord({
|
|
41
|
-
recordId,
|
|
42
|
-
dataService,
|
|
43
|
-
form,
|
|
44
|
-
schema,
|
|
45
|
-
columns,
|
|
46
|
-
getSchema,
|
|
47
|
-
}: {
|
|
48
|
-
recordId: string;
|
|
49
|
-
dataService: IDataService;
|
|
50
|
-
form: Form;
|
|
51
|
-
schema: Schema;
|
|
52
|
-
columns: string[];
|
|
53
|
-
getSchema: (logicalName: string) => Schema;
|
|
54
|
-
}) {
|
|
55
|
-
let record = null;
|
|
56
|
-
|
|
57
|
-
try {
|
|
58
|
-
record = await dataService.retriveRecord(
|
|
59
|
-
schema.logicalName,
|
|
60
|
-
recordId,
|
|
61
|
-
columns
|
|
62
|
-
);
|
|
63
|
-
} catch (error) {
|
|
64
|
-
if (error instanceof HttpError && error.status === 404) {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
throw error;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (!record) {
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const controls = getControls(form);
|
|
76
|
-
|
|
77
|
-
const editableGridControls = controls.filter(
|
|
78
|
-
(control) => control.type === 'editablegrid'
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
for (const control of editableGridControls) {
|
|
82
|
-
if (control.type !== 'editablegrid') {
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const controlSchema = getSchema(control.logicalName);
|
|
87
|
-
|
|
88
|
-
const records = await dataService.retriveRecords<
|
|
89
|
-
InferredSchemaType<SchemaAttributes>
|
|
90
|
-
>({
|
|
91
|
-
logicalName: controlSchema.logicalName,
|
|
92
|
-
filter: {
|
|
93
|
-
type: 'and',
|
|
94
|
-
conditions: [
|
|
95
|
-
{
|
|
96
|
-
field: control.referenceAttribute,
|
|
97
|
-
operator: 'eq',
|
|
98
|
-
value: recordId,
|
|
99
|
-
},
|
|
100
|
-
],
|
|
101
|
-
},
|
|
102
|
-
sort: [
|
|
103
|
-
{
|
|
104
|
-
field: controlSchema.createdAtAttribute ?? controlSchema.idAttribute,
|
|
105
|
-
order: 'asc',
|
|
106
|
-
},
|
|
107
|
-
],
|
|
108
|
-
limit: 5000,
|
|
109
|
-
search: '',
|
|
110
|
-
columns: [
|
|
111
|
-
controlSchema.idAttribute,
|
|
112
|
-
control.referenceAttribute,
|
|
113
|
-
...control.attributes,
|
|
114
|
-
],
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
(record as any)[control.attributeName] = records.records;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return record;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export function DataResolver() {
|
|
124
|
-
const schema = useDataFormSchema();
|
|
125
|
-
const form = useSelectedForm();
|
|
126
|
-
|
|
127
|
-
const dataService = useDataService();
|
|
128
|
-
const recordId = useRecordId();
|
|
129
|
-
|
|
130
|
-
const { getSchema } = useMetadata();
|
|
131
|
-
|
|
132
|
-
const setState = useContextSetValue(DataFormContext);
|
|
133
|
-
|
|
134
|
-
const columns = useMemo(() => getColumns(form), [form]);
|
|
135
|
-
|
|
136
|
-
const queryKey = useMemo(
|
|
137
|
-
() => ['data', 'retriveRecord', schema.logicalName, recordId, columns],
|
|
138
|
-
[columns, recordId, schema.logicalName]
|
|
139
|
-
);
|
|
140
|
-
|
|
141
|
-
const { data, refetch, isPending } = useQuery<any>({
|
|
142
|
-
queryKey,
|
|
143
|
-
queryFn: async () => {
|
|
144
|
-
if (!recordId) {
|
|
145
|
-
return null;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
const record = getRecord({
|
|
149
|
-
columns,
|
|
150
|
-
dataService,
|
|
151
|
-
form,
|
|
152
|
-
recordId,
|
|
153
|
-
schema,
|
|
154
|
-
getSchema,
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
return record;
|
|
158
|
-
},
|
|
159
|
-
placeholderData: keepPreviousData,
|
|
160
|
-
staleTime: 1000 * 60 * 5, // 5 minutes
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
useEffect(() => {
|
|
164
|
-
setState({
|
|
165
|
-
record: data,
|
|
166
|
-
});
|
|
167
|
-
}, [data, setState]);
|
|
168
|
-
|
|
169
|
-
useEffect(() => {
|
|
170
|
-
setState({
|
|
171
|
-
dataState: {
|
|
172
|
-
isFetching: isPending,
|
|
173
|
-
},
|
|
174
|
-
});
|
|
175
|
-
}, [isPending, setState]);
|
|
176
|
-
|
|
177
|
-
useEffect(() => {
|
|
178
|
-
setState({
|
|
179
|
-
refresh: async () => {
|
|
180
|
-
await refetch();
|
|
181
|
-
},
|
|
182
|
-
});
|
|
183
|
-
}, [refetch, setState]);
|
|
184
|
-
|
|
185
|
-
return null;
|
|
186
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { useEffect, useMemo, useRef } from 'react';
|
|
2
|
-
|
|
3
|
-
import { useContextSelector, useContextSetValue } from '../../mutable';
|
|
4
|
-
import { DataFormContext } from '../context';
|
|
5
|
-
import {
|
|
6
|
-
useDataFormSchema,
|
|
7
|
-
useFormInstance,
|
|
8
|
-
useRecordId,
|
|
9
|
-
useSelectedForm,
|
|
10
|
-
} from '../hooks';
|
|
11
|
-
import { getInitialValues } from '../utils';
|
|
12
|
-
|
|
13
|
-
export function InitialValueResolver() {
|
|
14
|
-
const formConfig = useSelectedForm();
|
|
15
|
-
const schema = useDataFormSchema();
|
|
16
|
-
const recordId = useRecordId();
|
|
17
|
-
const record = useContextSelector(DataFormContext, (state) => state.record);
|
|
18
|
-
const formInstance = useFormInstance();
|
|
19
|
-
|
|
20
|
-
const initialValues = useMemo(() => {
|
|
21
|
-
return getInitialValues({
|
|
22
|
-
cloneRecord: undefined,
|
|
23
|
-
form: formConfig,
|
|
24
|
-
record: record,
|
|
25
|
-
recordId: recordId,
|
|
26
|
-
schema: schema,
|
|
27
|
-
defaultParameters: {},
|
|
28
|
-
// defaultParameters,
|
|
29
|
-
});
|
|
30
|
-
}, [formConfig, record, recordId, schema]);
|
|
31
|
-
|
|
32
|
-
const setValue = useContextSetValue(DataFormContext);
|
|
33
|
-
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
setValue({
|
|
36
|
-
initialValues,
|
|
37
|
-
});
|
|
38
|
-
}, [setValue, initialValues]);
|
|
39
|
-
|
|
40
|
-
const formInstanceRef = useRef(formInstance);
|
|
41
|
-
formInstanceRef.current = formInstance;
|
|
42
|
-
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
const timer = setTimeout(() => {
|
|
45
|
-
// console.log('resetting form', initialValues);
|
|
46
|
-
formInstanceRef.current.reset(initialValues);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
return () => {
|
|
50
|
-
clearTimeout(timer);
|
|
51
|
-
};
|
|
52
|
-
}, [initialValues]);
|
|
53
|
-
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
|
|
3
|
-
import { useContextSetValue } from '../../mutable';
|
|
4
|
-
import { DataFormContext } from '../context';
|
|
5
|
-
import { useDataFormSchema, useRecordId } from '../hooks';
|
|
6
|
-
|
|
7
|
-
export function ReadonlyInfoResolver({
|
|
8
|
-
setFormReadOnly,
|
|
9
|
-
}: {
|
|
10
|
-
setFormReadOnly: (value: boolean) => void;
|
|
11
|
-
}) {
|
|
12
|
-
const schema = useDataFormSchema();
|
|
13
|
-
const recordId = useRecordId();
|
|
14
|
-
|
|
15
|
-
let readonly = false;
|
|
16
|
-
|
|
17
|
-
if (schema.restrictions?.disableCreate && !recordId) {
|
|
18
|
-
readonly = true;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (schema.restrictions?.disableUpdate && recordId) {
|
|
22
|
-
readonly = true;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const setValue = useContextSetValue(DataFormContext);
|
|
26
|
-
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
setValue({
|
|
29
|
-
isReadonly: readonly,
|
|
30
|
-
});
|
|
31
|
-
setFormReadOnly(readonly);
|
|
32
|
-
}, [setValue, setFormReadOnly, readonly]);
|
|
33
|
-
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
EntityMainFormCommandItemExperience,
|
|
3
|
-
Form,
|
|
4
|
-
} from '@headless-adminapp/core/experience/form';
|
|
5
|
-
import {
|
|
6
|
-
InferredSchemaType,
|
|
7
|
-
Schema,
|
|
8
|
-
SchemaAttributes,
|
|
9
|
-
} from '@headless-adminapp/core/schema';
|
|
10
|
-
import { Nullable } from '@headless-adminapp/core/types';
|
|
11
|
-
import { PropsWithChildren, useEffect, useState } from 'react';
|
|
12
|
-
import { FormProvider, useForm } from 'react-hook-form';
|
|
13
|
-
|
|
14
|
-
import { useFormValidationStrings } from '../../form/FormValidationStringContext';
|
|
15
|
-
import { useLocale } from '../../locale/useLocale';
|
|
16
|
-
import { useMetadata } from '../../metadata/hooks/useMetadata';
|
|
17
|
-
import { ContextValue, useCreateContextStore } from '../../mutable';
|
|
18
|
-
import { DataFormContext, DataFormContextState } from '../context';
|
|
19
|
-
import { formValidator } from '../utils';
|
|
20
|
-
import { DataResolver } from './DataResolver';
|
|
21
|
-
import { InitialValueResolver } from './InitialValueResolver';
|
|
22
|
-
import { ReadonlyInfoResolver } from './ReadonlyInfoResolver';
|
|
23
|
-
|
|
24
|
-
export interface DataFormProviderProps<
|
|
25
|
-
S extends SchemaAttributes = SchemaAttributes
|
|
26
|
-
> {
|
|
27
|
-
schema: Schema<S>;
|
|
28
|
-
form: Form<S>;
|
|
29
|
-
recordId?: string;
|
|
30
|
-
commands: EntityMainFormCommandItemExperience[][];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function DataFormProvider<S extends SchemaAttributes = SchemaAttributes>(
|
|
34
|
-
props: PropsWithChildren<DataFormProviderProps<S>>
|
|
35
|
-
) {
|
|
36
|
-
const { getSchema } = useMetadata();
|
|
37
|
-
const [{ language }] = useLocale();
|
|
38
|
-
const formValidationStrings = useFormValidationStrings();
|
|
39
|
-
|
|
40
|
-
const [formReadOnly, setFormReadOnly] = useState(false); // A trick to provide readOnly info to formInstance
|
|
41
|
-
|
|
42
|
-
const formInstance = useForm<any>({
|
|
43
|
-
mode: 'all',
|
|
44
|
-
defaultValues: {},
|
|
45
|
-
resolver: formValidator({
|
|
46
|
-
form: props.form,
|
|
47
|
-
getSchema,
|
|
48
|
-
language,
|
|
49
|
-
schema: props.schema,
|
|
50
|
-
strings: formValidationStrings,
|
|
51
|
-
formReadOnly,
|
|
52
|
-
}),
|
|
53
|
-
shouldUnregister: false,
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
const contextValue = useCreateContextStore<DataFormContextState<S>>({
|
|
57
|
-
schema: props.schema,
|
|
58
|
-
form: props.form,
|
|
59
|
-
commands: props.commands,
|
|
60
|
-
dataState: { isFetching: false },
|
|
61
|
-
recordId: props.recordId,
|
|
62
|
-
refresh: async () => {}, // Initial value, will be overridden
|
|
63
|
-
cloneId: undefined,
|
|
64
|
-
// formInstance,
|
|
65
|
-
// formInstanceRenderCount: 0,
|
|
66
|
-
initialValues: {} as Nullable<InferredSchemaType<S>>,
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
useEffect(() => {
|
|
70
|
-
contextValue.setValue({
|
|
71
|
-
form: props.form,
|
|
72
|
-
schema: props.schema,
|
|
73
|
-
recordId: props.recordId,
|
|
74
|
-
cloneId: undefined,
|
|
75
|
-
commands: props.commands,
|
|
76
|
-
});
|
|
77
|
-
}, [
|
|
78
|
-
props.form,
|
|
79
|
-
props.schema,
|
|
80
|
-
props.recordId,
|
|
81
|
-
contextValue,
|
|
82
|
-
getSchema,
|
|
83
|
-
props.commands,
|
|
84
|
-
]);
|
|
85
|
-
|
|
86
|
-
return (
|
|
87
|
-
<DataFormContext.Provider
|
|
88
|
-
value={
|
|
89
|
-
contextValue as unknown as ContextValue<
|
|
90
|
-
DataFormContextState<SchemaAttributes>
|
|
91
|
-
>
|
|
92
|
-
}
|
|
93
|
-
>
|
|
94
|
-
<FormProvider {...formInstance}>
|
|
95
|
-
<DataResolver />
|
|
96
|
-
<InitialValueResolver />
|
|
97
|
-
<ReadonlyInfoResolver setFormReadOnly={setFormReadOnly} />
|
|
98
|
-
{props.children}
|
|
99
|
-
</FormProvider>
|
|
100
|
-
</DataFormContext.Provider>
|
|
101
|
-
);
|
|
102
|
-
}
|
package/src/dataform/context.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
EntityMainFormCommandItemExperience,
|
|
3
|
-
Form,
|
|
4
|
-
} from '@headless-adminapp/core/experience/form';
|
|
5
|
-
import {
|
|
6
|
-
InferredSchemaType,
|
|
7
|
-
Schema,
|
|
8
|
-
SchemaAttributes,
|
|
9
|
-
} from '@headless-adminapp/core/schema';
|
|
10
|
-
import { Data } from '@headless-adminapp/core/transport';
|
|
11
|
-
import { Nullable } from '@headless-adminapp/core/types';
|
|
12
|
-
|
|
13
|
-
import { createContext } from '../mutable';
|
|
14
|
-
|
|
15
|
-
export type DataFormContextState<
|
|
16
|
-
SA extends SchemaAttributes = SchemaAttributes
|
|
17
|
-
> = {
|
|
18
|
-
// from props
|
|
19
|
-
schema: Schema<SA>;
|
|
20
|
-
form: Form<SA>;
|
|
21
|
-
recordId?: string | number;
|
|
22
|
-
cloneId?: string | number;
|
|
23
|
-
commands: EntityMainFormCommandItemExperience[][];
|
|
24
|
-
|
|
25
|
-
// internal state (visual)
|
|
26
|
-
// field visibilities
|
|
27
|
-
// disabled fields
|
|
28
|
-
// form state (dirty, touched, readonly, etc)
|
|
29
|
-
activeTab?: string;
|
|
30
|
-
|
|
31
|
-
// internal state (data)
|
|
32
|
-
record?: Data<InferredSchemaType<SA>>;
|
|
33
|
-
cloneRecord?: Data<InferredSchemaType<SA>>;
|
|
34
|
-
isReadonly?: boolean;
|
|
35
|
-
|
|
36
|
-
dataState: {
|
|
37
|
-
isFetching: boolean;
|
|
38
|
-
isError?: boolean;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
refresh: () => Promise<void>;
|
|
42
|
-
|
|
43
|
-
// form
|
|
44
|
-
initialValues: Nullable<InferredSchemaType<SA>>;
|
|
45
|
-
// formInstance: UseFormReturn<any, any, undefined>;
|
|
46
|
-
// formInstanceRenderCount: number;
|
|
47
|
-
|
|
48
|
-
// other
|
|
49
|
-
// config: FormConfig;
|
|
50
|
-
// useCustomState?: () => unknown;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export const DataFormContext = createContext<DataFormContextState>();
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export * from './useFormInstance';
|
|
2
|
-
export * from './useFormIsDirty';
|
|
3
|
-
export * from './useFormIsReadonly';
|
|
4
|
-
export * from './useFormNotifications';
|
|
5
|
-
export * from './useFormRecord';
|
|
6
|
-
export * from './useFormSave';
|
|
7
|
-
export * from './useFormSchema';
|
|
8
|
-
export * from './useMainFormCommands';
|
|
9
|
-
export * from './useRecordId';
|
|
10
|
-
export * from './useRecordTitle';
|
|
11
|
-
export * from './useSelectedForm';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { useContextSelector } from '../../mutable';
|
|
2
|
-
import { DataFormContext } from '../context';
|
|
3
|
-
|
|
4
|
-
export function useFormIsReadonly() {
|
|
5
|
-
const readonly = useContextSelector(
|
|
6
|
-
DataFormContext,
|
|
7
|
-
(state) => state.isReadonly
|
|
8
|
-
);
|
|
9
|
-
|
|
10
|
-
return readonly;
|
|
11
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
|
|
3
|
-
import { useFormInstance } from './useFormInstance';
|
|
4
|
-
import { useFormIsReadonly } from './useFormIsReadonly';
|
|
5
|
-
|
|
6
|
-
export function useFormNotifications() {
|
|
7
|
-
const readonly = useFormIsReadonly();
|
|
8
|
-
|
|
9
|
-
const formInstance = useFormInstance();
|
|
10
|
-
|
|
11
|
-
const formInstanceAvailable = !!formInstance;
|
|
12
|
-
|
|
13
|
-
return useMemo(() => {
|
|
14
|
-
type Notification = {
|
|
15
|
-
level: 'info' | 'warning' | 'error';
|
|
16
|
-
message: string;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const notifications: Notification[] = [];
|
|
20
|
-
|
|
21
|
-
if (readonly) {
|
|
22
|
-
notifications.push({
|
|
23
|
-
level: 'warning',
|
|
24
|
-
message: 'This record is read only',
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (
|
|
29
|
-
formInstanceAvailable &&
|
|
30
|
-
formInstance.formState.isSubmitted &&
|
|
31
|
-
Object.keys(formInstance.formState.errors).length > 0
|
|
32
|
-
) {
|
|
33
|
-
notifications.push({
|
|
34
|
-
level: 'error',
|
|
35
|
-
message: 'Please fill in the required fields',
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return notifications;
|
|
40
|
-
}, [
|
|
41
|
-
formInstanceAvailable,
|
|
42
|
-
formInstance?.formState.errors,
|
|
43
|
-
formInstance?.formState.isSubmitted,
|
|
44
|
-
readonly,
|
|
45
|
-
]);
|
|
46
|
-
}
|