@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 headless-adminapp
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AppExperience } from '@headless-adminapp/core/experience/app';
|
|
2
|
+
import { SchemaExperienceMetadata } from '@headless-adminapp/core/experience/schema';
|
|
3
|
+
export interface AppContextState {
|
|
4
|
+
app: AppExperience;
|
|
5
|
+
schemaMetadataList: SchemaExperienceMetadata[];
|
|
6
|
+
schemaMetadataDic: Record<string, SchemaExperienceMetadata>;
|
|
7
|
+
}
|
|
8
|
+
export declare const AppContext: import("react").Context<AppContextState | null>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useAppContext';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./useAppContext"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAppContext = useAppContext;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const context_1 = require("../context");
|
|
6
|
+
function useAppContext() {
|
|
7
|
+
const context = (0, react_1.useContext)(context_1.AppContext);
|
|
8
|
+
if (!context) {
|
|
9
|
+
throw new Error('useAppContext must be used within a AppContextProvider');
|
|
10
|
+
}
|
|
11
|
+
return context;
|
|
12
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAppContext = exports.AppContext = void 0;
|
|
4
|
+
var context_1 = require("./context");
|
|
5
|
+
Object.defineProperty(exports, "AppContext", { enumerable: true, get: function () { return context_1.AppContext; } });
|
|
6
|
+
var hooks_1 = require("./hooks");
|
|
7
|
+
Object.defineProperty(exports, "useAppContext", { enumerable: true, get: function () { return hooks_1.useAppContext; } });
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
export type ColorScheme = 'system' | 'light' | 'dark';
|
|
3
|
+
export interface AppearanceContextState {
|
|
4
|
+
colorScheme: ColorScheme;
|
|
5
|
+
brandColor: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const AppearanceContext: import("react").Context<[AppearanceContextState, Dispatch<SetStateAction<AppearanceContextState>>] | null>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useAppearanceContext';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./useAppearanceContext"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useAppearanceContext(): [import("../context").AppearanceContextState, import("react").Dispatch<import("react").SetStateAction<import("../context").AppearanceContextState>>];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAppearanceContext = useAppearanceContext;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const context_1 = require("../context");
|
|
6
|
+
function useAppearanceContext() {
|
|
7
|
+
const context = (0, react_1.useContext)(context_1.AppearanceContext);
|
|
8
|
+
if (!context) {
|
|
9
|
+
throw new Error('useAppContext must be used within a AppContextProvider');
|
|
10
|
+
}
|
|
11
|
+
return context;
|
|
12
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.AppearanceContext = void 0;
|
|
18
|
+
var context_1 = require("./context");
|
|
19
|
+
Object.defineProperty(exports, "AppearanceContext", { enumerable: true, get: function () { return context_1.AppearanceContext; } });
|
|
20
|
+
__exportStar(require("./hooks"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FC, PropsWithChildren } from 'react';
|
|
2
|
+
import { SessionResolver, UnauthorizeReason } from './types';
|
|
3
|
+
export interface AuthProviderProps {
|
|
4
|
+
onUnauthenticated?: (reason: UnauthorizeReason) => void;
|
|
5
|
+
sessionResolver: SessionResolver;
|
|
6
|
+
}
|
|
7
|
+
export declare const AuthProvider: FC<PropsWithChildren<AuthProviderProps>>;
|
|
@@ -0,0 +1,104 @@
|
|
|
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.AuthProvider = void 0;
|
|
13
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
14
|
+
const react_1 = require("react");
|
|
15
|
+
const context_1 = require("../mutable/context");
|
|
16
|
+
const context_2 = require("./context");
|
|
17
|
+
const AuthProvider = ({ sessionResolver, onUnauthenticated, children, }) => {
|
|
18
|
+
const onUnauthenticatedRef = (0, react_1.useRef)(onUnauthenticated);
|
|
19
|
+
onUnauthenticatedRef.current = onUnauthenticated;
|
|
20
|
+
const onUnauthenticatedInternal = (0, react_1.useCallback)((reason) => {
|
|
21
|
+
var _a;
|
|
22
|
+
(_a = onUnauthenticatedRef.current) === null || _a === void 0 ? void 0 : _a.call(onUnauthenticatedRef, reason);
|
|
23
|
+
}, []);
|
|
24
|
+
const contextValue = (0, context_1.useCreateContextStore)({
|
|
25
|
+
loading: true,
|
|
26
|
+
loadError: false,
|
|
27
|
+
initialized: false,
|
|
28
|
+
loadSession: () => Promise.resolve(),
|
|
29
|
+
onUnauthenticated: onUnauthenticatedInternal,
|
|
30
|
+
});
|
|
31
|
+
const state = (0, context_1.useContextSelectorInternal)(contextValue, (state) => state);
|
|
32
|
+
const session = state.initialized && state.authenticated && state.session;
|
|
33
|
+
const sessionResolverRef = (0, react_1.useRef)(sessionResolver);
|
|
34
|
+
sessionResolverRef.current = sessionResolver;
|
|
35
|
+
const loadSession = (0, react_1.useCallback)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
+
var _a;
|
|
37
|
+
contextValue.setValue({ loading: true, loadError: false });
|
|
38
|
+
try {
|
|
39
|
+
const data = yield sessionResolverRef.current();
|
|
40
|
+
if (!data) {
|
|
41
|
+
contextValue.setValue({
|
|
42
|
+
initialized: true,
|
|
43
|
+
authenticated: false,
|
|
44
|
+
sessionExpired: false,
|
|
45
|
+
session: null,
|
|
46
|
+
});
|
|
47
|
+
(_a = onUnauthenticatedRef.current) === null || _a === void 0 ? void 0 : _a.call(onUnauthenticatedRef, 'load');
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
contextValue.setValue({
|
|
51
|
+
initialized: true,
|
|
52
|
+
authenticated: true,
|
|
53
|
+
session: data,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
console.error('Error fetching auth session', error);
|
|
59
|
+
contextValue.setValue({ loadError: true });
|
|
60
|
+
}
|
|
61
|
+
finally {
|
|
62
|
+
contextValue.setValue({ loading: false });
|
|
63
|
+
}
|
|
64
|
+
}), [contextValue]);
|
|
65
|
+
(0, react_1.useEffect)(() => {
|
|
66
|
+
contextValue.setValue({ loadSession });
|
|
67
|
+
}, [contextValue, loadSession]);
|
|
68
|
+
(0, react_1.useEffect)(() => {
|
|
69
|
+
loadSession().catch(console.error);
|
|
70
|
+
}, [loadSession]);
|
|
71
|
+
(0, react_1.useEffect)(() => {
|
|
72
|
+
var _a;
|
|
73
|
+
if (!session) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const exp = session.exp * 1000;
|
|
77
|
+
const timeout = exp - Date.now();
|
|
78
|
+
if (timeout <= 0) {
|
|
79
|
+
contextValue.setValue({
|
|
80
|
+
initialized: true,
|
|
81
|
+
authenticated: false,
|
|
82
|
+
sessionExpired: true,
|
|
83
|
+
session: null,
|
|
84
|
+
});
|
|
85
|
+
(_a = onUnauthenticatedRef.current) === null || _a === void 0 ? void 0 : _a.call(onUnauthenticatedRef, 'sessionExpired');
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const timer = setTimeout(() => {
|
|
89
|
+
var _a;
|
|
90
|
+
contextValue.setValue({
|
|
91
|
+
initialized: true,
|
|
92
|
+
authenticated: false,
|
|
93
|
+
sessionExpired: true,
|
|
94
|
+
session: null,
|
|
95
|
+
});
|
|
96
|
+
(_a = onUnauthenticatedRef.current) === null || _a === void 0 ? void 0 : _a.call(onUnauthenticatedRef, 'sessionExpired');
|
|
97
|
+
}, timeout);
|
|
98
|
+
return () => {
|
|
99
|
+
clearTimeout(timer);
|
|
100
|
+
};
|
|
101
|
+
}, [contextValue, session]);
|
|
102
|
+
return ((0, jsx_runtime_1.jsx)(context_2.AuthContext.Provider, { value: contextValue, children: children }));
|
|
103
|
+
};
|
|
104
|
+
exports.AuthProvider = AuthProvider;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
type UnauthorizeReason = 'sessionExpired' | 'unauthorized' | 'logout' | 'load';
|
|
2
|
+
interface AuthStoreLoadingState {
|
|
3
|
+
initialized: false;
|
|
4
|
+
}
|
|
5
|
+
interface AuthStoreUnauthorizedState {
|
|
6
|
+
initialized: true;
|
|
7
|
+
authenticated: false;
|
|
8
|
+
sessionExpired: boolean;
|
|
9
|
+
session: null;
|
|
10
|
+
}
|
|
11
|
+
interface AuthStoreAuthorizedState<T extends AuthSession = AuthSession> {
|
|
12
|
+
initialized: true;
|
|
13
|
+
authenticated: true;
|
|
14
|
+
session: T;
|
|
15
|
+
}
|
|
16
|
+
export type AuthState = (AuthStoreLoadingState | AuthStoreUnauthorizedState | AuthStoreAuthorizedState) & {
|
|
17
|
+
loading: boolean;
|
|
18
|
+
loadError: boolean;
|
|
19
|
+
loadSession: () => Promise<void>;
|
|
20
|
+
onUnauthenticated?: (reason: UnauthorizeReason) => void;
|
|
21
|
+
};
|
|
22
|
+
export interface AuthSession {
|
|
23
|
+
exp: number;
|
|
24
|
+
fullName: string;
|
|
25
|
+
email: string;
|
|
26
|
+
profilePicture?: string;
|
|
27
|
+
data?: Record<string, any>;
|
|
28
|
+
}
|
|
29
|
+
export declare const AuthContext: import("react").Context<import("../mutable/context").ContextValue<AuthState>>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./useAuthSession"), exports);
|
|
18
|
+
__exportStar(require("./useLogout"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAuthSession = useAuthSession;
|
|
4
|
+
const mutable_1 = require("../../mutable");
|
|
5
|
+
const context_1 = require("../context");
|
|
6
|
+
function useAuthSession() {
|
|
7
|
+
return (0, mutable_1.useContextSelector)(context_1.AuthContext, (state) => {
|
|
8
|
+
if (!state.initialized) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
if (!state.authenticated) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
return state.session;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useLogout(): () => void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useLogout = useLogout;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const context_1 = require("../../mutable/context");
|
|
6
|
+
const context_2 = require("../context");
|
|
7
|
+
function useLogout() {
|
|
8
|
+
const setValue = (0, context_1.useContextSetValue)(context_2.AuthContext);
|
|
9
|
+
const onUnauthenticated = (0, context_1.useContextSelector)(context_2.AuthContext, (state) => state.onUnauthenticated);
|
|
10
|
+
const logout = (0, react_1.useCallback)(() => {
|
|
11
|
+
setValue({
|
|
12
|
+
initialized: true,
|
|
13
|
+
authenticated: false,
|
|
14
|
+
session: null,
|
|
15
|
+
});
|
|
16
|
+
onUnauthenticated === null || onUnauthenticated === void 0 ? void 0 : onUnauthenticated('logout');
|
|
17
|
+
}, [setValue, onUnauthenticated]);
|
|
18
|
+
return logout;
|
|
19
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.AuthProvider = exports.AuthContext = void 0;
|
|
18
|
+
var context_1 = require("./context");
|
|
19
|
+
Object.defineProperty(exports, "AuthContext", { enumerable: true, get: function () { return context_1.AuthContext; } });
|
|
20
|
+
var AuthProvider_1 = require("./AuthProvider");
|
|
21
|
+
Object.defineProperty(exports, "AuthProvider", { enumerable: true, get: function () { return AuthProvider_1.AuthProvider; } });
|
|
22
|
+
__exportStar(require("./types"), exports);
|
|
23
|
+
__exportStar(require("./hooks"), exports);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AuthSession } from './context';
|
|
2
|
+
export type UnauthorizeReason = 'sessionExpired' | 'unauthorized' | 'logout' | 'load';
|
|
3
|
+
export interface AuthProviderPlaceholderProps {
|
|
4
|
+
loading?: boolean;
|
|
5
|
+
loadingError?: boolean;
|
|
6
|
+
unauthorized?: boolean;
|
|
7
|
+
sessionExpired?: boolean;
|
|
8
|
+
retry: () => void;
|
|
9
|
+
}
|
|
10
|
+
export type SessionResolver = () => Promise<AuthSession | null>;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { EntityFormCommandContext, EntityMainFormCommandItemExperience } from '@headless-adminapp/core/experience/form';
|
|
2
|
+
import { EntityMainGridCommandItemExperience, SubGridCommandItemExperience } from '@headless-adminapp/core/experience/view';
|
|
3
|
+
import { Localized } from '@headless-adminapp/core/types';
|
|
4
|
+
import { Icon } from '@headless-adminapp/icons';
|
|
5
|
+
export declare function localizedLabel<T extends {
|
|
6
|
+
label: string;
|
|
7
|
+
localizedLabels?: Localized<string>;
|
|
8
|
+
}>(language: string, value: T, fallback?: T): string;
|
|
9
|
+
export declare function createLocalizedSelector<T>(stringSet: T, localizedStringSet: Localized<T> | undefined, language: string): <U>(selector: (stringSet: T) => U) => U;
|
|
10
|
+
export declare namespace CommandBuilder {
|
|
11
|
+
namespace View {
|
|
12
|
+
export function createNewRecordCommand({ Icon, text, localizedTexts, }: {
|
|
13
|
+
Icon: Icon;
|
|
14
|
+
text: string;
|
|
15
|
+
localizedTexts?: Record<string, string>;
|
|
16
|
+
}): EntityMainGridCommandItemExperience;
|
|
17
|
+
export function createEditRecordCommand({ Icon, text, localizedTexts, }: {
|
|
18
|
+
Icon: Icon;
|
|
19
|
+
text: string;
|
|
20
|
+
localizedTexts?: Record<string, string>;
|
|
21
|
+
}): EntityMainGridCommandItemExperience;
|
|
22
|
+
interface DeleteRecordCommandStringSet {
|
|
23
|
+
confirmation: {
|
|
24
|
+
title: string | string[];
|
|
25
|
+
text: string | string[];
|
|
26
|
+
buttonCancel: string;
|
|
27
|
+
buttonConfirm: string;
|
|
28
|
+
};
|
|
29
|
+
status: {
|
|
30
|
+
deleting: string | string[];
|
|
31
|
+
};
|
|
32
|
+
successNotification: {
|
|
33
|
+
title: string | string[];
|
|
34
|
+
text: string | string[];
|
|
35
|
+
};
|
|
36
|
+
errorNotification: {
|
|
37
|
+
title: string;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export const defaultDeleteRecordStringSet: DeleteRecordCommandStringSet;
|
|
41
|
+
export function createDeleteRecordCommand({ Icon, localizedText, text, stringSet, localizedStringSet, }: {
|
|
42
|
+
Icon: Icon;
|
|
43
|
+
text: string;
|
|
44
|
+
localizedText?: Record<string, string>;
|
|
45
|
+
stringSet?: DeleteRecordCommandStringSet;
|
|
46
|
+
localizedStringSet?: Localized<DeleteRecordCommandStringSet>;
|
|
47
|
+
}): EntityMainGridCommandItemExperience;
|
|
48
|
+
export function createRefreshCommand({ Icon, localizedTexts, text, }: {
|
|
49
|
+
Icon: Icon;
|
|
50
|
+
text: string;
|
|
51
|
+
localizedTexts?: Record<string, string>;
|
|
52
|
+
}): EntityMainGridCommandItemExperience;
|
|
53
|
+
export function createExportCommand({ button, csv, excel, }: {
|
|
54
|
+
button: {
|
|
55
|
+
Icon: Icon;
|
|
56
|
+
text: string;
|
|
57
|
+
localizedTexts?: Record<string, string>;
|
|
58
|
+
};
|
|
59
|
+
excel: {
|
|
60
|
+
Icon: Icon;
|
|
61
|
+
text: string;
|
|
62
|
+
localizedTexts?: Record<string, string>;
|
|
63
|
+
};
|
|
64
|
+
csv: {
|
|
65
|
+
Icon: Icon;
|
|
66
|
+
text: string;
|
|
67
|
+
localizedTexts?: Record<string, string>;
|
|
68
|
+
};
|
|
69
|
+
}): EntityMainGridCommandItemExperience;
|
|
70
|
+
export {};
|
|
71
|
+
}
|
|
72
|
+
namespace Form {
|
|
73
|
+
export function createSaveCommand({ Icon, text, localizedTexts, }: {
|
|
74
|
+
Icon: Icon;
|
|
75
|
+
text: string;
|
|
76
|
+
localizedTexts?: Record<string, string>;
|
|
77
|
+
}): EntityMainFormCommandItemExperience;
|
|
78
|
+
export function createSaveAndCloseCommand({ Icon, text, localizedTexts, }: {
|
|
79
|
+
Icon: Icon;
|
|
80
|
+
text: string;
|
|
81
|
+
localizedTexts?: Record<string, string>;
|
|
82
|
+
}): EntityMainFormCommandItemExperience;
|
|
83
|
+
interface DeleteRecordCommandStringSet {
|
|
84
|
+
confirmation: {
|
|
85
|
+
title: string;
|
|
86
|
+
text: string;
|
|
87
|
+
buttonCancel: string;
|
|
88
|
+
buttonConfirm: string;
|
|
89
|
+
};
|
|
90
|
+
status: {
|
|
91
|
+
deleting: string;
|
|
92
|
+
};
|
|
93
|
+
successNotification: {
|
|
94
|
+
title: string;
|
|
95
|
+
text: string;
|
|
96
|
+
};
|
|
97
|
+
errorNotification: {
|
|
98
|
+
title: string;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
export const defaultDeleteRecordStringSet: DeleteRecordCommandStringSet;
|
|
102
|
+
export function createDeleteCommand({ Icon, text, localizedTexts, stringSet, }: {
|
|
103
|
+
Icon: Icon;
|
|
104
|
+
text: string;
|
|
105
|
+
localizedTexts?: Record<string, string>;
|
|
106
|
+
stringSet: DeleteRecordCommandStringSet | ((context: EntityFormCommandContext) => DeleteRecordCommandStringSet);
|
|
107
|
+
}): EntityMainFormCommandItemExperience;
|
|
108
|
+
export function createRefreshCommand({ Icon, text, localizedTexts, }: {
|
|
109
|
+
Icon: Icon;
|
|
110
|
+
text: string;
|
|
111
|
+
localizedTexts?: Record<string, string>;
|
|
112
|
+
}): EntityMainFormCommandItemExperience;
|
|
113
|
+
export {};
|
|
114
|
+
}
|
|
115
|
+
namespace Subgrid {
|
|
116
|
+
export function createNewRecordCommand({ Icon, text, localizedTexts, }: {
|
|
117
|
+
Icon: Icon;
|
|
118
|
+
text: string;
|
|
119
|
+
localizedTexts?: Record<string, string>;
|
|
120
|
+
}): SubGridCommandItemExperience;
|
|
121
|
+
export function createEditRecordCommand({ Icon, text, localizedTexts, }: {
|
|
122
|
+
Icon: Icon;
|
|
123
|
+
text: string;
|
|
124
|
+
localizedTexts?: Record<string, string>;
|
|
125
|
+
}): SubGridCommandItemExperience;
|
|
126
|
+
interface DeleteRecordCommandStringSet {
|
|
127
|
+
confirmation: {
|
|
128
|
+
title: string | string[];
|
|
129
|
+
text: string | string[];
|
|
130
|
+
buttonCancel: string;
|
|
131
|
+
buttonConfirm: string;
|
|
132
|
+
};
|
|
133
|
+
status: {
|
|
134
|
+
deleting: string | string[];
|
|
135
|
+
};
|
|
136
|
+
successNotification: {
|
|
137
|
+
title: string | string[];
|
|
138
|
+
text: string | string[];
|
|
139
|
+
};
|
|
140
|
+
errorNotification: {
|
|
141
|
+
title: string;
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
export const defaultDeleteRecordStringSet: DeleteRecordCommandStringSet;
|
|
145
|
+
export function createDeleteRecordCommand({ Icon, localizedText, text, stringSet, localizedStringSet, }: {
|
|
146
|
+
Icon: Icon;
|
|
147
|
+
text: string;
|
|
148
|
+
localizedText?: Record<string, string>;
|
|
149
|
+
stringSet?: DeleteRecordCommandStringSet;
|
|
150
|
+
localizedStringSet?: Localized<DeleteRecordCommandStringSet>;
|
|
151
|
+
}): SubGridCommandItemExperience;
|
|
152
|
+
export function createRefreshCommand({ Icon, localizedTexts, text, }: {
|
|
153
|
+
Icon: Icon;
|
|
154
|
+
text: string;
|
|
155
|
+
localizedTexts?: Record<string, string>;
|
|
156
|
+
}): SubGridCommandItemExperience;
|
|
157
|
+
export function createExportCommand({ button, csv, excel, }: {
|
|
158
|
+
button: {
|
|
159
|
+
Icon: Icon;
|
|
160
|
+
text: string;
|
|
161
|
+
localizedTexts?: Record<string, string>;
|
|
162
|
+
};
|
|
163
|
+
excel: {
|
|
164
|
+
Icon: Icon;
|
|
165
|
+
text: string;
|
|
166
|
+
localizedTexts?: Record<string, string>;
|
|
167
|
+
};
|
|
168
|
+
csv: {
|
|
169
|
+
Icon: Icon;
|
|
170
|
+
text: string;
|
|
171
|
+
localizedTexts?: Record<string, string>;
|
|
172
|
+
};
|
|
173
|
+
}): SubGridCommandItemExperience;
|
|
174
|
+
export {};
|
|
175
|
+
}
|
|
176
|
+
}
|