@headless-adminapp/app 0.0.8-0.0.9-alpha.1.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/LICENSE +21 -0
- package/dist/app/context.d.ts +8 -0
- package/dist/app/context.js +5 -0
- package/dist/app/hooks/index.d.ts +1 -0
- package/dist/app/hooks/index.js +17 -0
- package/dist/app/hooks/useAppContext.d.ts +2 -0
- package/dist/app/hooks/useAppContext.js +12 -0
- package/dist/app/index.d.ts +2 -0
- package/dist/app/index.js +7 -0
- package/dist/appearance/context.d.ts +7 -0
- package/dist/appearance/context.js +5 -0
- package/dist/appearance/hooks/index.d.ts +1 -0
- package/dist/appearance/hooks/index.js +17 -0
- package/dist/appearance/hooks/useAppearanceContext.d.ts +1 -0
- package/dist/appearance/hooks/useAppearanceContext.js +12 -0
- package/dist/appearance/index.d.ts +2 -0
- package/dist/appearance/index.js +20 -0
- package/dist/auth/AuthProvider.d.ts +7 -0
- package/dist/auth/AuthProvider.js +104 -0
- package/dist/auth/context.d.ts +30 -0
- package/dist/auth/context.js +5 -0
- package/dist/auth/hooks/index.d.ts +2 -0
- package/dist/auth/hooks/index.js +18 -0
- package/dist/auth/hooks/useAuthSession.d.ts +2 -0
- package/dist/auth/hooks/useAuthSession.js +16 -0
- package/dist/auth/hooks/useLogout.d.ts +1 -0
- package/dist/auth/hooks/useLogout.js +19 -0
- package/dist/auth/index.d.ts +4 -0
- package/dist/auth/index.js +23 -0
- package/dist/auth/types.d.ts +10 -0
- package/dist/auth/types.js +2 -0
- package/dist/builders/CommandBuilder.d.ts +176 -0
- package/dist/builders/CommandBuilder.js +474 -0
- package/dist/builders/SchemaExperienceBuilder.d.ts +69 -0
- package/dist/builders/SchemaExperienceBuilder.js +267 -0
- package/dist/builders/index.d.ts +2 -0
- package/dist/builders/index.js +7 -0
- package/dist/command/hooks/index.d.ts +2 -0
- package/dist/command/hooks/index.js +18 -0
- package/dist/command/hooks/useBaseCommandHandlerContext.d.ts +4 -0
- package/dist/command/hooks/useBaseCommandHandlerContext.js +42 -0
- package/dist/command/hooks/useCommands.d.ts +7 -0
- package/dist/command/hooks/useCommands.js +16 -0
- package/dist/command/index.d.ts +2 -0
- package/dist/command/index.js +18 -0
- package/dist/command/types.d.ts +76 -0
- package/dist/command/types.js +2 -0
- package/dist/command/utils/index.d.ts +3 -0
- package/dist/command/utils/index.js +63 -0
- package/dist/components/ScrollView/index.d.ts +10 -0
- package/dist/components/ScrollView/index.js +11 -0
- package/dist/dataform/DataFormProvider/DataResolver.d.ts +5 -0
- package/dist/dataform/DataFormProvider/DataResolver.js +143 -0
- package/dist/dataform/DataFormProvider/InitialValueResolver.d.ts +1 -0
- package/dist/dataform/DataFormProvider/InitialValueResolver.js +44 -0
- package/dist/dataform/DataFormProvider/ReadonlyInfoResolver.d.ts +3 -0
- package/dist/dataform/DataFormProvider/ReadonlyInfoResolver.js +27 -0
- package/dist/dataform/DataFormProvider/index.d.ts +10 -0
- package/dist/dataform/DataFormProvider/index.js +72 -0
- package/dist/dataform/context.d.ts +22 -0
- package/dist/dataform/context.js +5 -0
- package/dist/dataform/hooks/index.d.ts +11 -0
- package/dist/dataform/hooks/index.js +27 -0
- package/dist/dataform/hooks/useFormInstance.d.ts +1 -0
- package/dist/dataform/hooks/useFormInstance.js +8 -0
- package/dist/dataform/hooks/useFormIsDirty.d.ts +1 -0
- package/dist/dataform/hooks/useFormIsDirty.js +8 -0
- package/dist/dataform/hooks/useFormIsReadonly.d.ts +1 -0
- package/dist/dataform/hooks/useFormIsReadonly.js +9 -0
- package/dist/dataform/hooks/useFormNotifications.d.ts +4 -0
- package/dist/dataform/hooks/useFormNotifications.js +34 -0
- package/dist/dataform/hooks/useFormRecord.d.ts +1 -0
- package/dist/dataform/hooks/useFormRecord.js +9 -0
- package/dist/dataform/hooks/useFormSave.d.ts +2 -0
- package/dist/dataform/hooks/useFormSave.js +135 -0
- package/dist/dataform/hooks/useFormSchema.d.ts +2 -0
- package/dist/dataform/hooks/useFormSchema.js +8 -0
- package/dist/dataform/hooks/useLoadFormGridPage.d.ts +18 -0
- package/dist/dataform/hooks/useLoadFormGridPage.js +73 -0
- package/dist/dataform/hooks/useMainFormCommands.d.ts +16 -0
- package/dist/dataform/hooks/useMainFormCommands.js +47 -0
- package/dist/dataform/hooks/useRecordId.d.ts +1 -0
- package/dist/dataform/hooks/useRecordId.js +8 -0
- package/dist/dataform/hooks/useRecordTitle.d.ts +1 -0
- package/dist/dataform/hooks/useRecordTitle.js +20 -0
- package/dist/dataform/hooks/useSelectedForm.d.ts +3 -0
- package/dist/dataform/hooks/useSelectedForm.js +8 -0
- package/dist/dataform/utils/index.d.ts +62 -0
- package/dist/dataform/utils/index.js +356 -0
- package/dist/datagrid/DataGridProvider/DataResolver.d.ts +2 -0
- package/dist/datagrid/DataGridProvider/DataResolver.js +208 -0
- package/dist/datagrid/DataGridProvider/index.d.ts +18 -0
- package/dist/datagrid/DataGridProvider/index.js +77 -0
- package/dist/datagrid/DataGridProvider/transformViewColumns.d.ts +5 -0
- package/dist/datagrid/DataGridProvider/transformViewColumns.js +29 -0
- package/dist/datagrid/DataGridProvider/utils.d.ts +3 -0
- package/dist/datagrid/DataGridProvider/utils.js +74 -0
- package/dist/datagrid/column-filter/constants.d.ts +4 -0
- package/dist/datagrid/column-filter/constants.js +482 -0
- package/dist/datagrid/column-filter/index.d.ts +3 -0
- package/dist/datagrid/column-filter/index.js +7 -0
- package/dist/datagrid/column-filter/types.d.ts +65 -0
- package/dist/datagrid/column-filter/types.js +2 -0
- package/dist/datagrid/column-filter/utils.d.ts +3 -0
- package/dist/datagrid/column-filter/utils.js +8 -0
- package/dist/datagrid/context.d.ts +33 -0
- package/dist/datagrid/context.js +5 -0
- package/dist/datagrid/hooks/index.d.ts +19 -0
- package/dist/datagrid/hooks/index.js +35 -0
- package/dist/datagrid/hooks/useChangeView.d.ts +1 -0
- package/dist/datagrid/hooks/useChangeView.js +12 -0
- package/dist/datagrid/hooks/useGridColumnFilter.d.ts +2 -0
- package/dist/datagrid/hooks/useGridColumnFilter.js +16 -0
- package/dist/datagrid/hooks/useGridColumns.d.ts +3 -0
- package/dist/datagrid/hooks/useGridColumns.js +8 -0
- package/dist/datagrid/hooks/useGridCommands.d.ts +3 -0
- package/dist/datagrid/hooks/useGridCommands.js +9 -0
- package/dist/datagrid/hooks/useGridData.d.ts +1 -0
- package/dist/datagrid/hooks/useGridData.js +9 -0
- package/dist/datagrid/hooks/useGridDataState.d.ts +5 -0
- package/dist/datagrid/hooks/useGridDataState.js +9 -0
- package/dist/datagrid/hooks/useGridExtraFilter.d.ts +1 -0
- package/dist/datagrid/hooks/useGridExtraFilter.js +8 -0
- package/dist/datagrid/hooks/useGridOptions.d.ts +1 -0
- package/dist/datagrid/hooks/useGridOptions.js +6 -0
- package/dist/datagrid/hooks/useGridPagination.d.ts +1 -0
- package/dist/datagrid/hooks/useGridPagination.js +6 -0
- package/dist/datagrid/hooks/useGridRefresh.d.ts +1 -0
- package/dist/datagrid/hooks/useGridRefresh.js +18 -0
- package/dist/datagrid/hooks/useGridSchema.d.ts +2 -0
- package/dist/datagrid/hooks/useGridSchema.js +8 -0
- package/dist/datagrid/hooks/useGridSelection.d.ts +1 -0
- package/dist/datagrid/hooks/useGridSelection.js +21 -0
- package/dist/datagrid/hooks/useGridSorting.d.ts +3 -0
- package/dist/datagrid/hooks/useGridSorting.js +14 -0
- package/dist/datagrid/hooks/useGridViewLookupData.d.ts +1 -0
- package/dist/datagrid/hooks/useGridViewLookupData.js +9 -0
- package/dist/datagrid/hooks/useLoadMainGridPage.d.ts +20 -0
- package/dist/datagrid/hooks/useLoadMainGridPage.js +55 -0
- package/dist/datagrid/hooks/useMainGridCommands.d.ts +19 -0
- package/dist/datagrid/hooks/useMainGridCommands.js +228 -0
- package/dist/datagrid/hooks/useMaxRecords.d.ts +1 -0
- package/dist/datagrid/hooks/useMaxRecords.js +8 -0
- package/dist/datagrid/hooks/useSearchText.d.ts +1 -0
- package/dist/datagrid/hooks/useSearchText.js +14 -0
- package/dist/datagrid/hooks/useSelectedView.d.ts +3 -0
- package/dist/datagrid/hooks/useSelectedView.js +8 -0
- package/dist/datagrid/hooks/useSubGridCommands.d.ts +5 -0
- package/dist/datagrid/hooks/useSubGridCommands.js +87 -0
- package/dist/dialog/DialogProvider.d.ts +5 -0
- package/dist/dialog/DialogProvider.js +13 -0
- package/dist/dialog/context.d.ts +6 -0
- package/dist/dialog/context.js +5 -0
- package/dist/dialog/hooks/index.d.ts +8 -0
- package/dist/dialog/hooks/index.js +24 -0
- package/dist/dialog/hooks/useCloseDialog.d.ts +1 -0
- package/dist/dialog/hooks/useCloseDialog.js +30 -0
- package/dist/dialog/hooks/useDialogItem.d.ts +1 -0
- package/dist/dialog/hooks/useDialogItem.js +8 -0
- package/dist/dialog/hooks/useDialogItems.d.ts +1 -0
- package/dist/dialog/hooks/useDialogItems.js +8 -0
- package/dist/dialog/hooks/useOpenAlertDialog.d.ts +2 -0
- package/dist/dialog/hooks/useOpenAlertDialog.js +20 -0
- package/dist/dialog/hooks/useOpenConfirmDialog.d.ts +2 -0
- package/dist/dialog/hooks/useOpenConfirmDialog.js +26 -0
- package/dist/dialog/hooks/useOpenDialog.d.ts +5 -0
- package/dist/dialog/hooks/useOpenDialog.js +27 -0
- package/dist/dialog/hooks/useOpenErrorDialog.d.ts +2 -0
- package/dist/dialog/hooks/useOpenErrorDialog.js +16 -0
- package/dist/dialog/hooks/useOpenPromptDialog.d.ts +3 -0
- package/dist/dialog/hooks/useOpenPromptDialog.js +26 -0
- package/dist/dialog/index.d.ts +3 -0
- package/dist/dialog/index.js +22 -0
- package/dist/form/FormValidationStringContext.d.ts +12 -0
- package/dist/form/FormValidationStringContext.js +19 -0
- package/dist/hooks/index.d.ts +5 -0
- package/dist/hooks/index.js +21 -0
- package/dist/hooks/useDebouncedValue.d.ts +3 -0
- package/dist/hooks/useDebouncedValue.js +32 -0
- package/dist/hooks/useElementLayout.d.ts +7 -0
- package/dist/hooks/useElementLayout.js +34 -0
- package/dist/hooks/useIsMobile.d.ts +1 -0
- package/dist/hooks/useIsMobile.js +21 -0
- package/dist/hooks/useStorageState.d.ts +2 -0
- package/dist/hooks/useStorageState.js +26 -0
- package/dist/hooks/useSystemColorScheme.d.ts +1 -0
- package/dist/hooks/useSystemColorScheme.js +27 -0
- package/dist/insights/context.d.ts +2 -0
- package/dist/insights/context.js +5 -0
- package/dist/locale/context.d.ts +2 -0
- package/dist/locale/context.js +5 -0
- package/dist/locale/index.d.ts +3 -0
- package/dist/locale/index.js +21 -0
- package/dist/locale/types.d.ts +2 -0
- package/dist/locale/types.js +2 -0
- package/dist/locale/useLocale.d.ts +1 -0
- package/dist/locale/useLocale.js +12 -0
- package/dist/metadata/MetadataProvider.d.ts +9 -0
- package/dist/metadata/MetadataProvider.js +29 -0
- package/dist/metadata/context.d.ts +7 -0
- package/dist/metadata/context.js +5 -0
- package/dist/metadata/hooks/index.d.ts +8 -0
- package/dist/metadata/hooks/index.js +24 -0
- package/dist/metadata/hooks/useAppStore.d.ts +1 -0
- package/dist/metadata/hooks/useAppStore.js +8 -0
- package/dist/metadata/hooks/useExperienceStore.d.ts +1 -0
- package/dist/metadata/hooks/useExperienceStore.js +8 -0
- package/dist/metadata/hooks/useExperienceView.d.ts +4 -0
- package/dist/metadata/hooks/useExperienceView.js +37 -0
- package/dist/metadata/hooks/useExperienceViewCommands.d.ts +4 -0
- package/dist/metadata/hooks/useExperienceViewCommands.js +28 -0
- package/dist/metadata/hooks/useExperienceViewLookup.d.ts +4 -0
- package/dist/metadata/hooks/useExperienceViewLookup.js +36 -0
- package/dist/metadata/hooks/useExperienceViewSubgridCommands.d.ts +4 -0
- package/dist/metadata/hooks/useExperienceViewSubgridCommands.js +28 -0
- package/dist/metadata/hooks/useMetadata.d.ts +9 -0
- package/dist/metadata/hooks/useMetadata.js +28 -0
- package/dist/metadata/hooks/useSchema.d.ts +2 -0
- package/dist/metadata/hooks/useSchema.js +8 -0
- package/dist/metadata/index.d.ts +3 -0
- package/dist/metadata/index.js +22 -0
- package/dist/mutable/context.d.ts +11 -0
- package/dist/mutable/context.js +46 -0
- package/dist/mutable/index.d.ts +3 -0
- package/dist/mutable/index.js +26 -0
- package/dist/mutable/state.d.ts +6 -0
- package/dist/mutable/state.js +12 -0
- package/dist/mutable/type.d.ts +11 -0
- package/dist/mutable/type.js +2 -0
- package/dist/mutable/utils.d.ts +3 -0
- package/dist/mutable/utils.js +62 -0
- package/dist/navigation/hooks/useOpenForm.d.ts +4 -0
- package/dist/navigation/hooks/useOpenForm.js +20 -0
- package/dist/progress-indicator/ProgressIndicatorProvider.d.ts +2 -0
- package/dist/progress-indicator/ProgressIndicatorProvider.js +54 -0
- package/dist/progress-indicator/context.d.ts +8 -0
- package/dist/progress-indicator/context.js +5 -0
- package/dist/progress-indicator/hooks/index.d.ts +1 -0
- package/dist/progress-indicator/hooks/index.js +17 -0
- package/dist/progress-indicator/hooks/useProgressIndicator.d.ts +1 -0
- package/dist/progress-indicator/hooks/useProgressIndicator.js +12 -0
- package/dist/progress-indicator/index.d.ts +3 -0
- package/dist/progress-indicator/index.js +22 -0
- package/dist/providers/PageEntityFormProvider/index.d.ts +11 -0
- package/dist/providers/PageEntityFormProvider/index.js +8 -0
- package/dist/providers/PageEntityViewProvider/index.d.ts +13 -0
- package/dist/providers/PageEntityViewProvider/index.js +8 -0
- package/dist/recordset/RecordSetProvider.d.ts +2 -0
- package/dist/recordset/RecordSetProvider.js +40 -0
- package/dist/recordset/context.d.ts +8 -0
- package/dist/recordset/context.js +5 -0
- package/dist/recordset/hooks/index.d.ts +3 -0
- package/dist/recordset/hooks/index.js +19 -0
- package/dist/recordset/hooks/useRecordSetResult.d.ts +7 -0
- package/dist/recordset/hooks/useRecordSetResult.js +81 -0
- package/dist/recordset/hooks/useRecordSetSetter.d.ts +1 -0
- package/dist/recordset/hooks/useRecordSetSetter.js +17 -0
- package/dist/recordset/hooks/useRecordSetVisibility.d.ts +1 -0
- package/dist/recordset/hooks/useRecordSetVisibility.js +16 -0
- package/dist/recordset/index.d.ts +3 -0
- package/dist/recordset/index.js +22 -0
- package/dist/route/RouteProvider.d.ts +13 -0
- package/dist/route/RouteProvider.js +24 -0
- package/dist/route/context.d.ts +23 -0
- package/dist/route/context.js +9 -0
- package/dist/route/hooks/index.d.ts +4 -0
- package/dist/route/hooks/index.js +20 -0
- package/dist/route/hooks/useBasePath.d.ts +1 -0
- package/dist/route/hooks/useBasePath.js +8 -0
- package/dist/route/hooks/usePathname.d.ts +1 -0
- package/dist/route/hooks/usePathname.js +8 -0
- package/dist/route/hooks/useRouteResolver.d.ts +1 -0
- package/dist/route/hooks/useRouteResolver.js +8 -0
- package/dist/route/hooks/useRouter.d.ts +1 -0
- package/dist/route/hooks/useRouter.js +8 -0
- package/dist/route/hooks/useSearchParams.d.ts +1 -0
- package/dist/route/hooks/useSearchParams.js +8 -0
- package/dist/route/index.d.ts +2 -0
- package/dist/route/index.js +20 -0
- package/dist/route/types.d.ts +2 -0
- package/dist/route/types.js +2 -0
- package/dist/store/ClientAppStore.d.ts +7 -0
- package/dist/store/ClientAppStore.js +30 -0
- package/dist/store/ComponentStore.d.ts +6 -0
- package/dist/store/ComponentStore.js +23 -0
- package/dist/store/EventManager.d.ts +7 -0
- package/dist/store/EventManager.js +42 -0
- package/dist/store/SchemaExperienceStore.d.ts +32 -0
- package/dist/store/SchemaExperienceStore.js +264 -0
- package/dist/store/index.d.ts +4 -0
- package/dist/store/index.js +20 -0
- package/dist/toast-notification/ToastNotificationProvider.d.ts +5 -0
- package/dist/toast-notification/ToastNotificationProvider.js +13 -0
- package/dist/toast-notification/context.d.ts +15 -0
- package/dist/toast-notification/context.js +5 -0
- package/dist/toast-notification/hooks/index.d.ts +3 -0
- package/dist/toast-notification/hooks/index.js +19 -0
- package/dist/toast-notification/hooks/useCloseToastNotification.d.ts +1 -0
- package/dist/toast-notification/hooks/useCloseToastNotification.js +30 -0
- package/dist/toast-notification/hooks/useOpenToastNotification.d.ts +5 -0
- package/dist/toast-notification/hooks/useOpenToastNotification.js +27 -0
- package/dist/toast-notification/hooks/useToastNotificationItems.d.ts +1 -0
- package/dist/toast-notification/hooks/useToastNotificationItems.js +8 -0
- package/dist/toast-notification/index.d.ts +3 -0
- package/dist/toast-notification/index.js +22 -0
- package/dist/transport/InMemoryDataService/index.d.ts +25 -0
- package/dist/transport/InMemoryDataService/index.js +112 -0
- package/dist/transport/RestDataService/index.d.ts +25 -0
- package/dist/transport/RestDataService/index.js +124 -0
- package/dist/transport/context.d.ts +2 -0
- package/dist/transport/context.js +5 -0
- package/dist/transport/hooks/index.d.ts +1 -0
- package/dist/transport/hooks/index.js +17 -0
- package/dist/transport/hooks/useDataService.d.ts +1 -0
- package/dist/transport/hooks/useDataService.js +12 -0
- package/dist/transport/index.d.ts +2 -0
- package/dist/transport/index.js +20 -0
- package/dist/utils/calculateColumnWidths.d.ts +14 -0
- package/dist/utils/calculateColumnWidths.js +46 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +17 -0
- package/dist/widget/context.d.ts +2 -0
- package/dist/widget/context.js +5 -0
- package/dist/widget/hooks/index.d.ts +3 -0
- package/dist/widget/hooks/index.js +8 -0
- package/dist/widget/index.d.ts +1 -0
- package/dist/widget/index.js +5 -0
- package/package.json +45 -0
- package/src/app/context.ts +11 -0
- package/src/app/hooks/index.ts +1 -0
- package/src/app/hooks/useAppContext.ts +13 -0
- package/src/app/index.ts +2 -0
- package/src/appearance/context.ts +13 -0
- package/src/appearance/hooks/index.ts +1 -0
- package/src/appearance/hooks/useAppearanceContext.ts +13 -0
- package/src/appearance/index.ts +6 -0
- package/src/auth/AuthProvider.tsx +118 -0
- package/src/auth/context.ts +41 -0
- package/src/auth/hooks/index.ts +2 -0
- package/src/auth/hooks/useAuthSession.ts +17 -0
- package/src/auth/hooks/useLogout.ts +23 -0
- package/src/auth/index.ts +4 -0
- package/src/auth/types.ts +17 -0
- package/src/builders/CommandBuilder.ts +777 -0
- package/src/builders/SchemaExperienceBuilder.ts +488 -0
- package/src/builders/index.ts +2 -0
- package/src/command/hooks/index.ts +2 -0
- package/src/command/hooks/useBaseCommandHandlerContext.ts +51 -0
- package/src/command/hooks/useCommands.ts +26 -0
- package/src/command/index.ts +2 -0
- package/src/command/types.ts +116 -0
- package/src/command/utils/index.ts +142 -0
- package/src/components/ScrollView/index.tsx +26 -0
- package/src/dataform/DataFormProvider/DataResolver.tsx +186 -0
- package/src/dataform/DataFormProvider/InitialValueResolver.tsx +55 -0
- package/src/dataform/DataFormProvider/ReadonlyInfoResolver.tsx +35 -0
- package/src/dataform/DataFormProvider/index.tsx +102 -0
- package/src/dataform/context.ts +53 -0
- package/src/dataform/hooks/index.ts +11 -0
- package/src/dataform/hooks/useFormInstance.ts +6 -0
- package/src/dataform/hooks/useFormIsDirty.ts +7 -0
- package/src/dataform/hooks/useFormIsReadonly.ts +11 -0
- package/src/dataform/hooks/useFormNotifications.ts +46 -0
- package/src/dataform/hooks/useFormRecord.ts +7 -0
- package/src/dataform/hooks/useFormSave.ts +147 -0
- package/src/dataform/hooks/useFormSchema.ts +13 -0
- package/src/dataform/hooks/useLoadFormGridPage.ts +97 -0
- package/src/dataform/hooks/useMainFormCommands.ts +65 -0
- package/src/dataform/hooks/useRecordId.ts +6 -0
- package/src/dataform/hooks/useRecordTitle.ts +22 -0
- package/src/dataform/hooks/useSelectedForm.ts +14 -0
- package/src/dataform/utils/index.ts +582 -0
- package/src/datagrid/DataGridProvider/DataResolver.tsx +281 -0
- package/src/datagrid/DataGridProvider/index.tsx +134 -0
- package/src/datagrid/DataGridProvider/transformViewColumns.ts +54 -0
- package/src/datagrid/DataGridProvider/utils.ts +89 -0
- package/src/datagrid/column-filter/constants.ts +493 -0
- package/src/datagrid/column-filter/index.ts +3 -0
- package/src/datagrid/column-filter/types.ts +68 -0
- package/src/datagrid/column-filter/utils.ts +19 -0
- package/src/datagrid/context.ts +66 -0
- package/src/datagrid/hooks/index.ts +19 -0
- package/src/datagrid/hooks/useChangeView.ts +18 -0
- package/src/datagrid/hooks/useGridColumnFilter.ts +28 -0
- package/src/datagrid/hooks/useGridColumns.ts +13 -0
- package/src/datagrid/hooks/useGridCommands.ts +21 -0
- package/src/datagrid/hooks/useGridData.ts +8 -0
- package/src/datagrid/hooks/useGridDataState.ts +8 -0
- package/src/datagrid/hooks/useGridExtraFilter.ts +6 -0
- package/src/datagrid/hooks/useGridOptions.ts +3 -0
- package/src/datagrid/hooks/useGridPagination.ts +3 -0
- package/src/datagrid/hooks/useGridRefresh.ts +19 -0
- package/src/datagrid/hooks/useGridSchema.ts +13 -0
- package/src/datagrid/hooks/useGridSelection.ts +28 -0
- package/src/datagrid/hooks/useGridSorting.ts +23 -0
- package/src/datagrid/hooks/useGridViewLookupData.ts +10 -0
- package/src/datagrid/hooks/useLoadMainGridPage.ts +90 -0
- package/src/datagrid/hooks/useMainGridCommands.ts +255 -0
- package/src/datagrid/hooks/useMaxRecords.ts +6 -0
- package/src/datagrid/hooks/useSearchText.ts +22 -0
- package/src/datagrid/hooks/useSelectedView.ts +14 -0
- package/src/datagrid/hooks/useSubGridCommands.ts +104 -0
- package/src/dialog/DialogProvider.tsx +20 -0
- package/src/dialog/context.ts +14 -0
- package/src/dialog/hooks/index.ts +8 -0
- package/src/dialog/hooks/useCloseDialog.ts +36 -0
- package/src/dialog/hooks/useDialogItem.ts +8 -0
- package/src/dialog/hooks/useDialogItems.ts +6 -0
- package/src/dialog/hooks/useOpenAlertDialog.ts +30 -0
- package/src/dialog/hooks/useOpenConfirmDialog.ts +45 -0
- package/src/dialog/hooks/useOpenDialog.ts +39 -0
- package/src/dialog/hooks/useOpenErrorDialog.ts +26 -0
- package/src/dialog/hooks/useOpenPromptDialog.ts +46 -0
- package/src/dialog/index.ts +7 -0
- package/src/form/FormValidationStringContext.ts +30 -0
- package/src/hooks/index.ts +5 -0
- package/src/hooks/useDebouncedValue.ts +38 -0
- package/src/hooks/useElementLayout.ts +49 -0
- package/src/hooks/useIsMobile.ts +21 -0
- package/src/hooks/useStorageState.ts +36 -0
- package/src/hooks/useSystemColorScheme.ts +38 -0
- package/src/index.css +4 -0
- package/src/insights/context.ts +5 -0
- package/src/locale/context.ts +7 -0
- package/src/locale/index.ts +3 -0
- package/src/locale/types.ts +3 -0
- package/src/locale/useLocale.ts +13 -0
- package/src/metadata/MetadataProvider.tsx +51 -0
- package/src/metadata/context.ts +15 -0
- package/src/metadata/hooks/index.ts +8 -0
- package/src/metadata/hooks/useAppStore.ts +6 -0
- package/src/metadata/hooks/useExperienceStore.ts +6 -0
- package/src/metadata/hooks/useExperienceView.ts +36 -0
- package/src/metadata/hooks/useExperienceViewCommands.ts +20 -0
- package/src/metadata/hooks/useExperienceViewLookup.ts +33 -0
- package/src/metadata/hooks/useExperienceViewSubgridCommands.ts +20 -0
- package/src/metadata/hooks/useMetadata.ts +44 -0
- package/src/metadata/hooks/useSchema.ts +11 -0
- package/src/metadata/index.ts +3 -0
- package/src/mutable/context.ts +71 -0
- package/src/mutable/index.ts +9 -0
- package/src/mutable/state.ts +13 -0
- package/src/mutable/type.ts +9 -0
- package/src/mutable/utils.ts +80 -0
- package/src/navigation/hooks/useOpenForm.ts +34 -0
- package/src/progress-indicator/ProgressIndicatorProvider.tsx +77 -0
- package/src/progress-indicator/context.ts +12 -0
- package/src/progress-indicator/hooks/index.ts +1 -0
- package/src/progress-indicator/hooks/useProgressIndicator.ts +15 -0
- package/src/progress-indicator/index.ts +6 -0
- package/src/providers/PageEntityFormProvider/index.tsx +34 -0
- package/src/providers/PageEntityViewProvider/index.tsx +39 -0
- package/src/recordset/RecordSetProvider.tsx +55 -0
- package/src/recordset/context.ts +12 -0
- package/src/recordset/hooks/index.ts +3 -0
- package/src/recordset/hooks/useRecordSetResult.ts +94 -0
- package/src/recordset/hooks/useRecordSetSetter.ts +21 -0
- package/src/recordset/hooks/useRecordSetVisibility.ts +24 -0
- package/src/recordset/index.ts +3 -0
- package/src/route/RouteProvider.tsx +76 -0
- package/src/route/context.ts +39 -0
- package/src/route/hooks/index.ts +4 -0
- package/src/route/hooks/useBasePath.ts +7 -0
- package/src/route/hooks/usePathname.ts +7 -0
- package/src/route/hooks/useRouteResolver.ts +7 -0
- package/src/route/hooks/useRouter.ts +7 -0
- package/src/route/hooks/useSearchParams.ts +7 -0
- package/src/route/index.ts +2 -0
- package/src/route/types.ts +1 -0
- package/src/store/ClientAppStore.ts +20 -0
- package/src/store/ComponentStore.tsx +22 -0
- package/src/store/EventManager.ts +33 -0
- package/src/store/SchemaExperienceStore.ts +374 -0
- package/src/store/index.ts +4 -0
- package/src/toast-notification/ToastNotificationProvider.tsx +23 -0
- package/src/toast-notification/context.ts +17 -0
- package/src/toast-notification/hooks/index.ts +3 -0
- package/src/toast-notification/hooks/useCloseToastNotification.ts +36 -0
- package/src/toast-notification/hooks/useOpenToastNotification.ts +38 -0
- package/src/toast-notification/hooks/useToastNotificationItems.ts +6 -0
- package/src/toast-notification/index.ts +7 -0
- package/src/transport/InMemoryDataService/index.ts +157 -0
- package/src/transport/RestDataService/index.ts +151 -0
- package/src/transport/context.ts +6 -0
- package/src/transport/hooks/index.ts +1 -0
- package/src/transport/hooks/useDataService.ts +13 -0
- package/src/transport/index.ts +2 -0
- package/src/utils/calculateColumnWidths.ts +72 -0
- package/src/utils/index.ts +1 -0
- package/src/widget/context.ts +5 -0
- package/src/widget/hooks/index.ts +11 -0
- package/src/widget/index.ts +1 -0
- package/tsconfig.json +9 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CommandBuilder = void 0;
|
|
13
|
+
exports.localizedLabel = localizedLabel;
|
|
14
|
+
exports.createLocalizedSelector = createLocalizedSelector;
|
|
15
|
+
function localizedLabel(language, value, fallback) {
|
|
16
|
+
var _a, _b, _c, _d, _e;
|
|
17
|
+
return ((_e = (_d = (_b = (_a = value.localizedLabels) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : (_c = fallback === null || fallback === void 0 ? void 0 : fallback.localizedLabels) === null || _c === void 0 ? void 0 : _c[language]) !== null && _d !== void 0 ? _d : value.label) !== null && _e !== void 0 ? _e : fallback === null || fallback === void 0 ? void 0 : fallback.label);
|
|
18
|
+
}
|
|
19
|
+
function createLocalizedSelector(stringSet, localizedStringSet, language) {
|
|
20
|
+
return function selectLocalized(selector) {
|
|
21
|
+
if (localizedStringSet && localizedStringSet[language]) {
|
|
22
|
+
return selector(localizedStringSet[language]);
|
|
23
|
+
}
|
|
24
|
+
return selector(stringSet);
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
var CommandBuilder;
|
|
28
|
+
(function (CommandBuilder) {
|
|
29
|
+
let View;
|
|
30
|
+
(function (View) {
|
|
31
|
+
function createNewRecordCommand({ Icon, text, localizedTexts, }) {
|
|
32
|
+
return {
|
|
33
|
+
type: 'button',
|
|
34
|
+
Icon,
|
|
35
|
+
text,
|
|
36
|
+
localizedText: localizedTexts,
|
|
37
|
+
onClick: (context) => {
|
|
38
|
+
console.log('New record', context);
|
|
39
|
+
},
|
|
40
|
+
hidden: (context) => {
|
|
41
|
+
console.log(context);
|
|
42
|
+
// TODO: Implement logic to hide the button
|
|
43
|
+
return false;
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
View.createNewRecordCommand = createNewRecordCommand;
|
|
48
|
+
function createEditRecordCommand({ Icon, text, localizedTexts, }) {
|
|
49
|
+
return {
|
|
50
|
+
type: 'button',
|
|
51
|
+
Icon,
|
|
52
|
+
text,
|
|
53
|
+
localizedText: localizedTexts,
|
|
54
|
+
isContextMenu: true,
|
|
55
|
+
onClick: (context) => {
|
|
56
|
+
console.log('Edit record', context);
|
|
57
|
+
},
|
|
58
|
+
hidden: (context) => context.primaryControl.selectedIds.length !== 1, // TODO: check permissions
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
View.createEditRecordCommand = createEditRecordCommand;
|
|
62
|
+
function plurialize(count, singular, plural) {
|
|
63
|
+
if (Array.isArray(singular)) {
|
|
64
|
+
plural = singular[1];
|
|
65
|
+
singular = singular[0];
|
|
66
|
+
}
|
|
67
|
+
let msg = count === 1 ? singular : plural !== null && plural !== void 0 ? plural : singular;
|
|
68
|
+
msg = msg.replace('{count}', count.toString());
|
|
69
|
+
return msg;
|
|
70
|
+
}
|
|
71
|
+
View.defaultDeleteRecordStringSet = {
|
|
72
|
+
confirmation: {
|
|
73
|
+
text: [
|
|
74
|
+
'Are you sure you want to delete this record?',
|
|
75
|
+
'Are you sure you want to delete selected records?',
|
|
76
|
+
],
|
|
77
|
+
title: ['Delete record', 'Delete records'],
|
|
78
|
+
buttonConfirm: 'Delete',
|
|
79
|
+
buttonCancel: 'Cancel',
|
|
80
|
+
},
|
|
81
|
+
status: {
|
|
82
|
+
deleting: ['Deleting record', 'Deleting records'],
|
|
83
|
+
},
|
|
84
|
+
successNotification: {
|
|
85
|
+
title: ['Record deleted', 'Records deleted'],
|
|
86
|
+
text: ['Record deleted successfully', 'Records deleted successfully'],
|
|
87
|
+
},
|
|
88
|
+
errorNotification: {
|
|
89
|
+
title: 'Error',
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
function createDeleteRecordCommand({ Icon, localizedText, text, stringSet = View.defaultDeleteRecordStringSet, localizedStringSet, }) {
|
|
93
|
+
return {
|
|
94
|
+
type: 'button',
|
|
95
|
+
Icon,
|
|
96
|
+
text,
|
|
97
|
+
localizedText,
|
|
98
|
+
danger: true,
|
|
99
|
+
isContextMenu: true,
|
|
100
|
+
hidden: [(context) => context.primaryControl.selectedIds.length === 0], // TODO: check permissions
|
|
101
|
+
onClick: (context) => __awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
const recordIds = context.primaryControl.selectedIds;
|
|
103
|
+
if (!recordIds.length) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const localizeSelector = createLocalizedSelector(stringSet, localizedStringSet, context.locale.language);
|
|
107
|
+
try {
|
|
108
|
+
const confirmResult = yield context.utility.openConfirmDialog({
|
|
109
|
+
title: plurialize(recordIds.length, localizeSelector((s) => s.confirmation.title)),
|
|
110
|
+
text: plurialize(recordIds.length, localizeSelector((s) => s.confirmation.text)),
|
|
111
|
+
cancelButtonLabel: localizeSelector((s) => s.confirmation.buttonCancel),
|
|
112
|
+
confirmButtonLabel: localizeSelector((s) => s.confirmation.buttonConfirm),
|
|
113
|
+
});
|
|
114
|
+
if (!(confirmResult === null || confirmResult === void 0 ? void 0 : confirmResult.confirmed)) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
context.utility.showProgressIndicator(plurialize(recordIds.length, localizeSelector((s) => s.status.deleting)) + '...');
|
|
118
|
+
yield new Promise((resolve) => setTimeout(resolve, 2000));
|
|
119
|
+
context.utility.showNotification({
|
|
120
|
+
title: plurialize(recordIds.length, localizeSelector((s) => s.successNotification.title)),
|
|
121
|
+
text: plurialize(recordIds.length, localizeSelector((s) => s.successNotification.text)),
|
|
122
|
+
type: 'success',
|
|
123
|
+
});
|
|
124
|
+
context.primaryControl.refresh();
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
context.utility.showNotification({
|
|
128
|
+
title: localizeSelector((s) => s.errorNotification.title),
|
|
129
|
+
text: error.message,
|
|
130
|
+
type: 'error',
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
finally {
|
|
134
|
+
context.utility.hideProgressIndicator();
|
|
135
|
+
}
|
|
136
|
+
}),
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
View.createDeleteRecordCommand = createDeleteRecordCommand;
|
|
140
|
+
function createRefreshCommand({ Icon, localizedTexts, text, }) {
|
|
141
|
+
return {
|
|
142
|
+
type: 'button',
|
|
143
|
+
Icon,
|
|
144
|
+
text,
|
|
145
|
+
localizedText: localizedTexts,
|
|
146
|
+
onClick: (context) => {
|
|
147
|
+
context.primaryControl.refresh();
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
View.createRefreshCommand = createRefreshCommand;
|
|
152
|
+
function createExportCommand({ button, csv, excel, }) {
|
|
153
|
+
return {
|
|
154
|
+
type: 'menu',
|
|
155
|
+
Icon: button.Icon,
|
|
156
|
+
text: button.text,
|
|
157
|
+
localizedTexts: button.localizedTexts,
|
|
158
|
+
items: [
|
|
159
|
+
[
|
|
160
|
+
{
|
|
161
|
+
Icon: excel.Icon,
|
|
162
|
+
text: excel.text,
|
|
163
|
+
localizedTexts: excel.localizedTexts,
|
|
164
|
+
onClick: (context) => {
|
|
165
|
+
console.log('Export to Excel', context);
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
Icon: csv.Icon,
|
|
170
|
+
text: csv.text,
|
|
171
|
+
localizedTexts: csv.localizedTexts,
|
|
172
|
+
onClick: (context) => {
|
|
173
|
+
console.log('Export to CSV', context);
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
],
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
View.createExportCommand = createExportCommand;
|
|
181
|
+
})(View = CommandBuilder.View || (CommandBuilder.View = {}));
|
|
182
|
+
let Form;
|
|
183
|
+
(function (Form) {
|
|
184
|
+
function createSaveCommand({ Icon, text, localizedTexts, }) {
|
|
185
|
+
return {
|
|
186
|
+
type: 'button',
|
|
187
|
+
Icon,
|
|
188
|
+
text,
|
|
189
|
+
localizedText: localizedTexts,
|
|
190
|
+
isQuickAction: true,
|
|
191
|
+
onClick: (context) => __awaiter(this, void 0, void 0, function* () {
|
|
192
|
+
yield context.primaryControl.save('save');
|
|
193
|
+
}),
|
|
194
|
+
hidden: (context) => {
|
|
195
|
+
if (context.primaryControl.readonly) {
|
|
196
|
+
return true;
|
|
197
|
+
}
|
|
198
|
+
return false;
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
Form.createSaveCommand = createSaveCommand;
|
|
203
|
+
function createSaveAndCloseCommand({ Icon, text, localizedTexts, }) {
|
|
204
|
+
return {
|
|
205
|
+
type: 'button',
|
|
206
|
+
Icon,
|
|
207
|
+
text,
|
|
208
|
+
localizedText: localizedTexts,
|
|
209
|
+
onClick: (context) => __awaiter(this, void 0, void 0, function* () {
|
|
210
|
+
yield context.primaryControl.save('saveandclose');
|
|
211
|
+
}),
|
|
212
|
+
hidden: (context) => {
|
|
213
|
+
if (context.primaryControl.readonly) {
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
return false;
|
|
217
|
+
},
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
Form.createSaveAndCloseCommand = createSaveAndCloseCommand;
|
|
221
|
+
Form.defaultDeleteRecordStringSet = {
|
|
222
|
+
confirmation: {
|
|
223
|
+
text: 'Are you sure you want to delete this record?',
|
|
224
|
+
title: 'Delete record',
|
|
225
|
+
buttonConfirm: 'Delete',
|
|
226
|
+
buttonCancel: 'Cancel',
|
|
227
|
+
},
|
|
228
|
+
status: {
|
|
229
|
+
deleting: 'Deleting record',
|
|
230
|
+
},
|
|
231
|
+
successNotification: {
|
|
232
|
+
title: 'Record deleted',
|
|
233
|
+
text: 'Record deleted successfully',
|
|
234
|
+
},
|
|
235
|
+
errorNotification: {
|
|
236
|
+
title: 'Error',
|
|
237
|
+
},
|
|
238
|
+
};
|
|
239
|
+
function createDeleteCommand({ Icon, text, localizedTexts, stringSet, }) {
|
|
240
|
+
return {
|
|
241
|
+
Icon: Icon,
|
|
242
|
+
type: 'button',
|
|
243
|
+
text,
|
|
244
|
+
localizedText: localizedTexts,
|
|
245
|
+
danger: true,
|
|
246
|
+
hidden: (context) => {
|
|
247
|
+
var _a;
|
|
248
|
+
if (!context.primaryControl.recordId) {
|
|
249
|
+
return true;
|
|
250
|
+
}
|
|
251
|
+
if ((_a = context.primaryControl.schema.restrictions) === null || _a === void 0 ? void 0 : _a.disableDelete) {
|
|
252
|
+
return true;
|
|
253
|
+
}
|
|
254
|
+
return false;
|
|
255
|
+
},
|
|
256
|
+
onClick: (context) => __awaiter(this, void 0, void 0, function* () {
|
|
257
|
+
const recordId = context.primaryControl.recordId;
|
|
258
|
+
if (!recordId) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
if (typeof stringSet === 'function') {
|
|
262
|
+
stringSet = stringSet(context);
|
|
263
|
+
}
|
|
264
|
+
try {
|
|
265
|
+
const confirmResult = yield context.utility.openConfirmDialog({
|
|
266
|
+
title: stringSet.confirmation.title,
|
|
267
|
+
text: stringSet.confirmation.text,
|
|
268
|
+
cancelButtonLabel: stringSet.confirmation.buttonCancel,
|
|
269
|
+
confirmButtonLabel: stringSet.confirmation.buttonConfirm,
|
|
270
|
+
});
|
|
271
|
+
if (!(confirmResult === null || confirmResult === void 0 ? void 0 : confirmResult.confirmed)) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
context.utility.showProgressIndicator(stringSet.status.deleting + '...');
|
|
275
|
+
yield new Promise((resolve) => setTimeout(resolve, 2000));
|
|
276
|
+
// await context.dataService.deleteRecord(
|
|
277
|
+
// context.primaryControl.logicalName,
|
|
278
|
+
// recordId
|
|
279
|
+
// );
|
|
280
|
+
context.utility.showNotification({
|
|
281
|
+
title: stringSet.successNotification.title,
|
|
282
|
+
text: stringSet.successNotification.text,
|
|
283
|
+
type: 'success',
|
|
284
|
+
});
|
|
285
|
+
// context.primaryControl.close();
|
|
286
|
+
}
|
|
287
|
+
catch (error) {
|
|
288
|
+
context.utility.showNotification({
|
|
289
|
+
title: stringSet.errorNotification.title,
|
|
290
|
+
text: error.message,
|
|
291
|
+
type: 'error',
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
finally {
|
|
295
|
+
context.utility.hideProgressIndicator();
|
|
296
|
+
}
|
|
297
|
+
}),
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
Form.createDeleteCommand = createDeleteCommand;
|
|
301
|
+
function createRefreshCommand({ Icon, text, localizedTexts, }) {
|
|
302
|
+
return {
|
|
303
|
+
Icon,
|
|
304
|
+
type: 'button',
|
|
305
|
+
text,
|
|
306
|
+
localizedText: localizedTexts,
|
|
307
|
+
onClick: (context) => __awaiter(this, void 0, void 0, function* () {
|
|
308
|
+
yield context.primaryControl.refresh();
|
|
309
|
+
}),
|
|
310
|
+
hidden: (context) => !context.primaryControl.recordId,
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
Form.createRefreshCommand = createRefreshCommand;
|
|
314
|
+
})(Form = CommandBuilder.Form || (CommandBuilder.Form = {}));
|
|
315
|
+
let Subgrid;
|
|
316
|
+
(function (Subgrid) {
|
|
317
|
+
function createNewRecordCommand({ Icon, text, localizedTexts, }) {
|
|
318
|
+
return {
|
|
319
|
+
type: 'button',
|
|
320
|
+
Icon,
|
|
321
|
+
text,
|
|
322
|
+
localizedText: localizedTexts,
|
|
323
|
+
onClick: (context) => {
|
|
324
|
+
console.log('New record', context);
|
|
325
|
+
},
|
|
326
|
+
hidden: (context) => {
|
|
327
|
+
console.log(context);
|
|
328
|
+
// TODO: Implement logic to hide the button
|
|
329
|
+
return false;
|
|
330
|
+
},
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
Subgrid.createNewRecordCommand = createNewRecordCommand;
|
|
334
|
+
function createEditRecordCommand({ Icon, text, localizedTexts, }) {
|
|
335
|
+
return {
|
|
336
|
+
type: 'button',
|
|
337
|
+
Icon,
|
|
338
|
+
text,
|
|
339
|
+
localizedText: localizedTexts,
|
|
340
|
+
isContextMenu: true,
|
|
341
|
+
onClick: (context) => {
|
|
342
|
+
console.log('Edit record', context);
|
|
343
|
+
},
|
|
344
|
+
// hidden: (context) => context.secondaryControl.selectedIds.length !== 1, // TODO: check permissions
|
|
345
|
+
hidden: (context) => {
|
|
346
|
+
console.log('temp.', context);
|
|
347
|
+
return context.secondaryControl.selectedIds.length !== 1;
|
|
348
|
+
},
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
Subgrid.createEditRecordCommand = createEditRecordCommand;
|
|
352
|
+
function plurialize(count, singular, plural) {
|
|
353
|
+
if (Array.isArray(singular)) {
|
|
354
|
+
plural = singular[1];
|
|
355
|
+
singular = singular[0];
|
|
356
|
+
}
|
|
357
|
+
let msg = count === 1 ? singular : plural !== null && plural !== void 0 ? plural : singular;
|
|
358
|
+
msg = msg.replace('{count}', count.toString());
|
|
359
|
+
return msg;
|
|
360
|
+
}
|
|
361
|
+
Subgrid.defaultDeleteRecordStringSet = {
|
|
362
|
+
confirmation: {
|
|
363
|
+
text: [
|
|
364
|
+
'Are you sure you want to delete this record?',
|
|
365
|
+
'Are you sure you want to delete selected records?',
|
|
366
|
+
],
|
|
367
|
+
title: ['Delete record', 'Delete records'],
|
|
368
|
+
buttonConfirm: 'Delete',
|
|
369
|
+
buttonCancel: 'Cancel',
|
|
370
|
+
},
|
|
371
|
+
status: {
|
|
372
|
+
deleting: ['Deleting record', 'Deleting records'],
|
|
373
|
+
},
|
|
374
|
+
successNotification: {
|
|
375
|
+
title: ['Record deleted', 'Records deleted'],
|
|
376
|
+
text: ['Record deleted successfully', 'Records deleted successfully'],
|
|
377
|
+
},
|
|
378
|
+
errorNotification: {
|
|
379
|
+
title: 'Error',
|
|
380
|
+
},
|
|
381
|
+
};
|
|
382
|
+
function createDeleteRecordCommand({ Icon, localizedText, text, stringSet = Subgrid.defaultDeleteRecordStringSet, localizedStringSet, }) {
|
|
383
|
+
return {
|
|
384
|
+
type: 'button',
|
|
385
|
+
Icon,
|
|
386
|
+
text,
|
|
387
|
+
localizedText,
|
|
388
|
+
danger: true,
|
|
389
|
+
isContextMenu: true,
|
|
390
|
+
hidden: [
|
|
391
|
+
(context) => context.secondaryControl.selectedIds.length === 0,
|
|
392
|
+
], // TODO: check permissions
|
|
393
|
+
onClick: (context) => __awaiter(this, void 0, void 0, function* () {
|
|
394
|
+
const recordIds = context.secondaryControl.selectedIds;
|
|
395
|
+
if (!recordIds.length) {
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
const localizeSelector = createLocalizedSelector(stringSet, localizedStringSet, context.locale.language);
|
|
399
|
+
try {
|
|
400
|
+
const confirmResult = yield context.utility.openConfirmDialog({
|
|
401
|
+
title: plurialize(recordIds.length, localizeSelector((s) => s.confirmation.title)),
|
|
402
|
+
text: plurialize(recordIds.length, localizeSelector((s) => s.confirmation.text)),
|
|
403
|
+
cancelButtonLabel: localizeSelector((s) => s.confirmation.buttonCancel),
|
|
404
|
+
confirmButtonLabel: localizeSelector((s) => s.confirmation.buttonConfirm),
|
|
405
|
+
});
|
|
406
|
+
if (!(confirmResult === null || confirmResult === void 0 ? void 0 : confirmResult.confirmed)) {
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
context.utility.showProgressIndicator(plurialize(recordIds.length, localizeSelector((s) => s.status.deleting)) + '...');
|
|
410
|
+
yield new Promise((resolve) => setTimeout(resolve, 2000));
|
|
411
|
+
context.utility.showNotification({
|
|
412
|
+
title: plurialize(recordIds.length, localizeSelector((s) => s.successNotification.title)),
|
|
413
|
+
text: plurialize(recordIds.length, localizeSelector((s) => s.successNotification.text)),
|
|
414
|
+
type: 'success',
|
|
415
|
+
});
|
|
416
|
+
yield context.primaryControl.refresh();
|
|
417
|
+
}
|
|
418
|
+
catch (error) {
|
|
419
|
+
context.utility.showNotification({
|
|
420
|
+
title: localizeSelector((s) => s.errorNotification.title),
|
|
421
|
+
text: error.message,
|
|
422
|
+
type: 'error',
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
finally {
|
|
426
|
+
context.utility.hideProgressIndicator();
|
|
427
|
+
}
|
|
428
|
+
}),
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
Subgrid.createDeleteRecordCommand = createDeleteRecordCommand;
|
|
432
|
+
function createRefreshCommand({ Icon, localizedTexts, text, }) {
|
|
433
|
+
return {
|
|
434
|
+
type: 'button',
|
|
435
|
+
Icon,
|
|
436
|
+
text,
|
|
437
|
+
localizedText: localizedTexts,
|
|
438
|
+
onClick: (context) => {
|
|
439
|
+
context.secondaryControl.refresh();
|
|
440
|
+
},
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
Subgrid.createRefreshCommand = createRefreshCommand;
|
|
444
|
+
function createExportCommand({ button, csv, excel, }) {
|
|
445
|
+
return {
|
|
446
|
+
type: 'menu',
|
|
447
|
+
Icon: button.Icon,
|
|
448
|
+
text: button.text,
|
|
449
|
+
localizedTexts: button.localizedTexts,
|
|
450
|
+
items: [
|
|
451
|
+
[
|
|
452
|
+
{
|
|
453
|
+
Icon: excel.Icon,
|
|
454
|
+
text: excel.text,
|
|
455
|
+
localizedTexts: excel.localizedTexts,
|
|
456
|
+
onClick: (context) => {
|
|
457
|
+
console.log('Export to Excel', context);
|
|
458
|
+
},
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
Icon: csv.Icon,
|
|
462
|
+
text: csv.text,
|
|
463
|
+
localizedTexts: csv.localizedTexts,
|
|
464
|
+
onClick: (context) => {
|
|
465
|
+
console.log('Export to CSV', context);
|
|
466
|
+
},
|
|
467
|
+
},
|
|
468
|
+
],
|
|
469
|
+
],
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
Subgrid.createExportCommand = createExportCommand;
|
|
473
|
+
})(Subgrid = CommandBuilder.Subgrid || (CommandBuilder.Subgrid = {}));
|
|
474
|
+
})(CommandBuilder || (exports.CommandBuilder = CommandBuilder = {}));
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { AsyncForm, AsyncQuickCreateForm, EntityMainFormCommandItemExperience, Form, FormExperience, QuickCreateForm } from '@headless-adminapp/core/experience/form';
|
|
2
|
+
import { SchemaExperience } from '@headless-adminapp/core/experience/schema';
|
|
3
|
+
import { AsyncView, EntityMainGridCommandItemExperience, SubGridCommandItemExperience, View, ViewExperience } from '@headless-adminapp/core/experience/view';
|
|
4
|
+
import { Schema, SchemaAttributes } from '@headless-adminapp/core/schema';
|
|
5
|
+
declare abstract class BaseSchemaExperienceBuilder<S extends SchemaAttributes> {
|
|
6
|
+
protected readonly logicalName: string;
|
|
7
|
+
protected views: View<S>[];
|
|
8
|
+
protected forms: Form<S>[];
|
|
9
|
+
protected lookups: View<S>[];
|
|
10
|
+
protected quickCreateForms: QuickCreateForm<S>[];
|
|
11
|
+
protected defaultViewId: string | null;
|
|
12
|
+
protected defaultFormId: string | null;
|
|
13
|
+
protected defaultLookupId: string | null;
|
|
14
|
+
protected defaultQuickCreateFormId: string | null;
|
|
15
|
+
protected locked: boolean;
|
|
16
|
+
constructor(logicalName: string);
|
|
17
|
+
reset(): this;
|
|
18
|
+
protected baseBuild(): {
|
|
19
|
+
logicalName: string;
|
|
20
|
+
defaultFormId: string;
|
|
21
|
+
defaultViewId: string;
|
|
22
|
+
views: View<S>[];
|
|
23
|
+
forms: Form<S>[];
|
|
24
|
+
defaultLookupId: string;
|
|
25
|
+
lookups: View<S>[];
|
|
26
|
+
defaultQuickCreateFormId: string | null;
|
|
27
|
+
quickCreateForms: QuickCreateForm<S>[];
|
|
28
|
+
};
|
|
29
|
+
defineFormExperience(formExperience: FormExperience<S>): FormExperience<S>;
|
|
30
|
+
}
|
|
31
|
+
export interface SchemaExperienceBuilderDefaults {
|
|
32
|
+
formCommands?: EntityMainFormCommandItemExperience[][];
|
|
33
|
+
viewCommands?: EntityMainGridCommandItemExperience[][];
|
|
34
|
+
subgridCommands?: SubGridCommandItemExperience[][];
|
|
35
|
+
localizedViewNames?: Record<string, string>;
|
|
36
|
+
}
|
|
37
|
+
interface SchemaExperienceBuilderOptions {
|
|
38
|
+
}
|
|
39
|
+
export declare class SchemaExperienceBuilder<S extends SchemaAttributes = SchemaAttributes> extends BaseSchemaExperienceBuilder<S> {
|
|
40
|
+
private schema;
|
|
41
|
+
private defaults?;
|
|
42
|
+
private options?;
|
|
43
|
+
constructor(schema: Schema<S>, defaults?: SchemaExperienceBuilderDefaults | undefined, options?: SchemaExperienceBuilderOptions | undefined);
|
|
44
|
+
defineViewExperience(viewExperience: Pick<ViewExperience<S>, 'filter' | 'defaultSorting'> & {
|
|
45
|
+
card?: ViewExperience<S>['card'];
|
|
46
|
+
grid?: ViewExperience<S>['grid'];
|
|
47
|
+
}): ViewExperience<S>;
|
|
48
|
+
defineDefaultViewGrid(): ViewExperience<S>['grid'];
|
|
49
|
+
defineDefaultViewCard(): ViewExperience<S>['card'];
|
|
50
|
+
defineDefaultViewExperience(): ViewExperience<S>;
|
|
51
|
+
defineDefaultFormExperience(): FormExperience<S>;
|
|
52
|
+
private getLocalizedViewNames;
|
|
53
|
+
private resolveDefaultId;
|
|
54
|
+
defineExperience(experience: Omit<SchemaExperience<S>, 'logicalName' | 'forms' | 'views' | 'lookups' | 'defaultViewId' | 'defaultFormId' | 'defaultLookupId' | 'defaultAssociatedViewId' | 'quickCreateForms' | 'viewCommands' | 'subgridCommands' | 'formCommands' | 'associatedViews'> & {
|
|
55
|
+
forms?: Omit<AsyncForm<S>, 'logicalName'>[];
|
|
56
|
+
views?: Omit<AsyncView<S>, 'logicalName'>[];
|
|
57
|
+
lookups?: Omit<AsyncView<S>, 'logicalName'>[];
|
|
58
|
+
associatedViews?: Omit<AsyncView<S>, 'logicalName'>[];
|
|
59
|
+
quickCreateForms?: Omit<AsyncQuickCreateForm<S>, 'logicalName'>[];
|
|
60
|
+
defaultViewId?: string;
|
|
61
|
+
defaultFormId?: string;
|
|
62
|
+
defaultLookupId?: string;
|
|
63
|
+
defaultAssociatedViewId?: string;
|
|
64
|
+
viewCommands?: SchemaExperience<S>['viewCommands'];
|
|
65
|
+
subgridCommands?: SchemaExperience<S>['subgridCommands'];
|
|
66
|
+
formCommands?: SchemaExperience<S>['formCommands'];
|
|
67
|
+
}): SchemaExperience<S>;
|
|
68
|
+
}
|
|
69
|
+
export {};
|