@gen-epix/ui-client-common 4.5.0 → 4.5.1
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/README.md +5 -4
- package/dist/@types/mui.d.ts +13 -5
- package/dist/@types/ui-client-common.d.ts +1 -0
- package/dist/_chunks/ApplicationFooter.js +44 -44
- package/dist/_chunks/ApplicationFooter.js.map +1 -1
- package/dist/_chunks/Breadcrumbs.js +13 -13
- package/dist/_chunks/CrudPage.js +300 -300
- package/dist/_chunks/CrudPage.js.map +1 -1
- package/dist/_chunks/Notifications.js +51 -51
- package/dist/_chunks/OutageList.js +29 -29
- package/dist/_chunks/OutageUtil.js +1 -2
- package/dist/_chunks/OutageUtil.js.map +1 -1
- package/dist/_chunks/QueryClientService.js +96 -388
- package/dist/_chunks/QueryClientService.js.map +1 -1
- package/dist/_chunks/Table.js +518 -512
- package/dist/_chunks/Table.js.map +1 -1
- package/dist/_chunks/TableUtil.js +8 -16
- package/dist/_chunks/TableUtil.js.map +1 -1
- package/dist/_chunks/TextFilter.js +14 -12
- package/dist/_chunks/TextFilter.js.map +1 -1
- package/dist/_chunks/UserInvitationsAdminPage.js +77 -77
- package/dist/_chunks/UserInvitationsAdminPage.js.map +1 -1
- package/dist/_chunks/UserManagerUtil.js +210 -209
- package/dist/_chunks/UserManagerUtil.js.map +1 -1
- package/dist/_chunks/_baseFlatten.js +8 -8
- package/dist/_chunks/_baseFlatten.js.map +1 -1
- package/dist/_chunks/_baseGet.js +280 -0
- package/dist/_chunks/_baseGet.js.map +1 -0
- package/dist/_chunks/_baseIteratee.js +274 -0
- package/dist/_chunks/_baseIteratee.js.map +1 -0
- package/dist/_chunks/_baseUnset.js +22 -299
- package/dist/_chunks/_baseUnset.js.map +1 -1
- package/dist/_chunks/last.js +13 -0
- package/dist/_chunks/last.js.map +1 -0
- package/dist/_chunks/omit.js +41 -40
- package/dist/_chunks/omit.js.map +1 -1
- package/dist/_chunks/tableStore.js +190 -183
- package/dist/_chunks/tableStore.js.map +1 -1
- package/dist/_chunks/uniq.js +44 -0
- package/dist/_chunks/uniq.js.map +1 -0
- package/dist/_chunks/useMutation.js +22 -22
- package/dist/_chunks/useMutation.js.map +1 -1
- package/dist/_chunks/useQueryMemo.js +25 -8
- package/dist/_chunks/useQueryMemo.js.map +1 -1
- package/dist/classes/abstracts/FilterAbstract/index.js +3 -1
- package/dist/classes/abstracts/FilterAbstract/index.js.map +1 -1
- package/dist/classes/filters/MultiSelectFilter.d.ts +1 -1
- package/dist/classes/services/AuthenticationService/AuthenticationService.d.ts +1 -1
- package/dist/classes/services/AuthenticationService/index.js +15 -15
- package/dist/classes/services/AuthenticationService/index.js.map +1 -1
- package/dist/classes/services/AuthorizationService/index.js +4 -4
- package/dist/classes/services/AuthorizationService/index.js.map +1 -1
- package/dist/classes/services/BackendVersionService/index.js +3 -2
- package/dist/classes/services/BackendVersionService/index.js.map +1 -1
- package/dist/classes/services/BreadcrumbService/index.js +16 -38
- package/dist/classes/services/BreadcrumbService/index.js.map +1 -1
- package/dist/classes/services/EmotionCacheService/index.js +9 -8
- package/dist/classes/services/EmotionCacheService/index.js.map +1 -1
- package/dist/classes/services/I18nService/index.js +11 -10
- package/dist/classes/services/I18nService/index.js.map +1 -1
- package/dist/classes/services/InactivityService/index.js +12 -12
- package/dist/classes/services/InactivityService/index.js.map +1 -1
- package/dist/classes/services/LogService/index.js +39 -33
- package/dist/classes/services/LogService/index.js.map +1 -1
- package/dist/classes/services/NotificationService/index.js +8 -8
- package/dist/classes/services/NotificationService/index.js.map +1 -1
- package/dist/classes/services/PageEventBusService/index.js +13 -9
- package/dist/classes/services/PageEventBusService/index.js.map +1 -1
- package/dist/classes/services/RouterService/index.js +3 -6
- package/dist/classes/services/RouterService/index.js.map +1 -1
- package/dist/components/app/App/App.d.ts +1 -1
- package/dist/components/app/App/index.js +34 -38
- package/dist/components/app/App/index.js.map +1 -1
- package/dist/components/app/ApplicationBootstrapWithAuthentication/index.js +28 -28
- package/dist/components/app/ApplicationBootstrapWithAuthentication/index.js.map +1 -1
- package/dist/components/app/ApplicationBootstrapWithoutAuthorization/index.js +47 -45
- package/dist/components/app/ApplicationBootstrapWithoutAuthorization/index.js.map +1 -1
- package/dist/components/app/AuthenticationWrapper/index.js +35 -35
- package/dist/components/app/AuthenticationWrapper/index.js.map +1 -1
- package/dist/components/app/AuthorizationWrapper/index.js +19 -19
- package/dist/components/app/AuthorizationWrapper/index.js.map +1 -1
- package/dist/components/app/RouterRoot/index.js +52 -50
- package/dist/components/app/RouterRoot/index.js.map +1 -1
- package/dist/components/epi/EpiContactDetailsDialog/index.js +21 -21
- package/dist/components/filters/BooleanFilterField/index.js +5 -5
- package/dist/components/filters/DateFilterField/index.js +3 -3
- package/dist/components/filters/GeoFilterField/index.js +4 -4
- package/dist/components/filters/MultiSelectFilterField/index.js +4 -4
- package/dist/components/filters/NumberRangeFilterField/index.js +3 -3
- package/dist/components/filters/TextFilterField/index.js +3 -3
- package/dist/components/ui/ApplicationBar/index.js +188 -188
- package/dist/components/ui/ApplicationBar/index.js.map +1 -1
- package/dist/components/ui/GenericErrorMessage/index.js +29 -29
- package/dist/components/ui/LicensesDialog/index.js +38 -38
- package/dist/components/ui/LicensesDialog/index.js.map +1 -1
- package/dist/components/ui/MyPermissionsDialog/index.js +16 -16
- package/dist/components/ui/NavLink/index.js +6 -6
- package/dist/components/ui/OrganizationSwitcherDialog/index.js +21 -21
- package/dist/components/ui/OrganizationSwitcherDialog/index.js.map +1 -1
- package/dist/components/ui/PageContainer/index.js +24 -24
- package/dist/components/ui/PageContainer/index.js.map +1 -1
- package/dist/components/ui/Sidebar/index.js +30 -30
- package/dist/components/ui/UserFeedbackDialog/index.js +12 -12
- package/dist/constants/config.constants.d.ts +0 -2
- package/dist/constants/config.constants.js +2 -2
- package/dist/constants/config.constants.js.map +1 -1
- package/dist/dataHooks/useIdentifierIssuerOwnOrganizationQuery/index.js +12 -12
- package/dist/dataHooks/useIdentifierIssuerOwnOrganizationQuery/index.js.map +1 -1
- package/dist/dataHooks/useIdentifierIssuerQuery/index.js +14 -14
- package/dist/dataHooks/useIdentifierIssuerQuery/index.js.map +1 -1
- package/dist/dataHooks/useInviteUserConstraintsQuery/index.js +12 -12
- package/dist/dataHooks/useInviteUserConstraintsQuery/index.js.map +1 -1
- package/dist/dataHooks/useOrganizationAdminPoliciesQuery/index.js +13 -13
- package/dist/dataHooks/useOrganizationAdminPoliciesQuery/index.js.map +1 -1
- package/dist/dataHooks/useOrganizationIdentifierIssuerLinksQuery/index.js +4 -4
- package/dist/dataHooks/useOrganizationsQuery/index.js +13 -13
- package/dist/dataHooks/useOrganizationsQuery/index.js.map +1 -1
- package/dist/dataHooks/useUsersQuery/index.js +10 -10
- package/dist/dataHooks/useUsersQuery/index.js.map +1 -1
- package/dist/hooks/useConfig/index.js +2 -2
- package/dist/hooks/useConfig/index.js.map +1 -1
- package/dist/hooks/useCreateMutation/index.js +12 -12
- package/dist/hooks/useCreateMutation/index.js.map +1 -1
- package/dist/hooks/useDeleteMutation/index.js +16 -9
- package/dist/hooks/useDeleteMutation/index.js.map +1 -1
- package/dist/hooks/useEditMutation/index.js +48 -33
- package/dist/hooks/useEditMutation/index.js.map +1 -1
- package/dist/hooks/useItemQuery/index.js +4 -4
- package/dist/hooks/useItemQuery/index.js.map +1 -1
- package/dist/locale/en.json +1 -0
- package/dist/locale/nl.json +1 -0
- package/dist/models/config.models.d.ts +1 -5
- package/dist/models/theme.models.d.ts +19 -16
- package/dist/pages/AcceptInvitationPage/index.js +25 -25
- package/dist/pages/AcceptInvitationPage/index.js.map +1 -1
- package/dist/pages/AdminPage/index.js +16 -16
- package/dist/pages/ChooseIdentityProviderPage/index.js +21 -21
- package/dist/pages/IdentifierIssuersAdminPage/index.js +5 -5
- package/dist/pages/OrganizationAdminPoliciesAdminPage/index.js +5 -5
- package/dist/pages/OrganizationContactsAdminPage/index.js +6 -6
- package/dist/pages/OrganizationSitesAdminPage/index.js +9 -9
- package/dist/pages/OrganizationsAdminPage/index.js +13 -13
- package/dist/pages/OutagesAdminPage/index.js +20 -20
- package/dist/pages/PostLoginPage/index.js +6 -6
- package/dist/pages/PostLogoutPage/index.js +8 -8
- package/dist/pages/UsersAdminPage/index.js +39 -39
- package/dist/pages/UsersAdminPage/index.js.map +1 -1
- package/dist/setup/setup.js +11 -4
- package/dist/setup/setup.js.map +1 -1
- package/dist/theme/demoTheme/index.js +17 -15
- package/dist/theme/demoTheme/index.js.map +1 -1
- package/dist/utils/DataHookUtil/index.js +1 -1
- package/dist/utils/DataHookUtil/index.js.map +1 -1
- package/dist/utils/DependencyContainerUtil/DependencyContainerUtil.d.ts +2 -3
- package/dist/utils/DependencyContainerUtil/index.js +10 -15
- package/dist/utils/DependencyContainerUtil/index.js.map +1 -1
- package/dist/utils/MenuDataUtil/index.js +1 -1
- package/dist/utils/MenuDataUtil/index.js.map +1 -1
- package/dist/utils/StandardConfigUtil/index.js +0 -4
- package/dist/utils/StandardConfigUtil/index.js.map +1 -1
- package/dist/utils/TimeUtil/index.js +1 -1
- package/dist/utils/TimeUtil/index.js.map +1 -1
- package/package.json +10 -13
- package/dist/context/ClientCommonConfigContext/ClientCommonConfigContext.d.ts +0 -9
- package/dist/context/ClientCommonConfigContext/ClientCommonConfigContextProvider.d.ts +0 -6
- package/dist/context/ClientCommonConfigContext/index.d.ts +0 -3
- package/dist/context/ClientCommonConfigContext/index.js +0 -34
- package/dist/context/ClientCommonConfigContext/index.js.map +0 -1
- package/dist/context/ClientCommonConfigContext/useClientCommonConfigContext.d.ts +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CrudPage.js","names":["yupResolver","useDebouncedCallback","isArray","Table","__toESM","require_isArray","QueryClientService","useQueryMemo","createTableStore","TableStoreContextProvider","Table$1","c","TableHeader","TableCaption","TableSidebarMenu","o","EditIcon","DeleteForeverIcon","ArrowCircleRightIcon","ContentCopyIcon","SaveIcon","import_isArray","CrudPageEditDialog","withDialog","useTranslation","formId","useId","initialFormFieldDefinitions","useMemo","formFieldDefinitions","openProps","resolvedFormFieldDefinitions","setResolvedFormFieldDefinitions","useState","actions","TestIdUtil","def","onActionsChange","t","values","defaultNewItem","FormUtil","getFormValuesFromItem","onTitleChange","getName","createItemDialogTitle","formMethods","useForm","schema","debouncedHandleValuesChange","onChange","formValues","useEffect","unsubscribe","subscribe","formState","onFormSubmit","useCallback","onSave","formFields","onClose","GenericForm","handleSubmit","CrudPageDeleteDialog","onConfirmButtonClick","onConfirm","Box","CrudPage","theme","useTheme","config","useConfig","deleteConfirmationRef","useRef","editDialogRef","authorizationService","container","AuthorizationService","resourceQueryKey","resourceQueryKeyBase","tableStore","item","RouterService","tableStoreStorageNamePostFix","tableStoreStorageVersion","defaultSortByField","defaultSortDirection","isLoadablesLoading","loadables","LoadableUtil","rows","rowsError","isRowsLoading","fetchAll","signal","fetchAllSelect","onRowsChange","isLoading","error","loadable","createPermission","crudCommandType","permissionType","userCanEdit","updateOne","CommonDbPermissionType","extraUpdateOnePermissions","userCanDelete","deleteOne","extraDeleteOnePermissions","userCanCreate","createOne","extraCreateOnePermissions","normalizedEditDialogExtraActionsFactory","editDialogExtraActionsFactory","subPages","subPage","editItem","canEditItem","tryToGetName","name","getEditProgressNotificationMessage","data","itemName","getCreateProgressNotificationMessage","getDeleteProgressNotificationMessage","getEditSuccessNotificationMessage","getCreateSuccessNotificationMessage","getDeleteSuccessNotificationMessage","getEditErrorNotificationMessage","getCreateErrorNotificationMessage","getDeleteErrorNotificationMessage","calculatedAssociationQueryKeys","keys","associationQueryKeys","key","mutateEdit","mutateEditSetPreviousItem","useEditMutation","getOptimisticUpdateIntermediateItem","onEditError","onEditSuccess","isCreating","mutateCreate","useCreateMutation","onCreateError","onCreateSuccess","mutateDelete","useDeleteMutation","onDeleteError","onDeleteSuccess","onEditDialogSave","onEditIconClick","params","onRowClick","customOnRowClick","onShowItem","onDeleteConfirmationConfirm","normalizedExtraActions","extraActions","extraActionsFactory","MenuItem","ListItemIcon","ListItemText","columns","internalColumns","TableUtil","showIdColumn","tableColumns","tableRows","convertToTableData","onCreateItemButtonClick","customContentActions","contentActions","Button","createItemButtonText","normalizedTitle","title","PageContainer","contentHeader","ResponseHandler","onFormChange"],"sources":["../../src/pages/CrudPage/CrudPageEditDialog.tsx","../../src/pages/CrudPage/CrudPageDeleteDialog.tsx","../../src/pages/CrudPage/CrudPage.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport {\n useCallback,\n useEffect,\n useId,\n useMemo,\n useState,\n} from 'react';\nimport SaveIcon from '@mui/icons-material/Save';\nimport { useTranslation } from 'react-i18next';\nimport type {\n AnyObject,\n ObjectSchema,\n} from 'yup';\nimport { yupResolver } from '@hookform/resolvers/yup';\nimport type {\n Resolver,\n UseFormReturn,\n} from 'react-hook-form';\nimport { useForm } from 'react-hook-form';\nimport { useDebouncedCallback } from 'use-debounce';\nimport { TestIdUtil } from '@gen-epix/ui-core/utils/TestIdUtil';\nimport { GenericForm } from '@gen-epix/ui-core-form/components/helpers/GenericForm';\nimport type { FormFieldDefinition } from '@gen-epix/ui-core-form/models/form.models';\nimport { FormUtil } from '@gen-epix/ui-core-form/utils/FormUtil';\nimport type { DialogAction } from '@gen-epix/ui-core-components/components/Dialog';\nimport type {\n WithDialogRefMethods,\n WithDialogRenderProps,\n} from '@gen-epix/ui-core-components/hoc/withDialog';\nimport { withDialog } from '@gen-epix/ui-core-components/hoc/withDialog';\n\nimport type { GenericData } from '../../models/data.models';\n\n\nexport interface CrudPageEditDialogOpenProps<TData extends GenericData> {\n readonly canSave: boolean;\n readonly extraActionsFactory?: (item: TData) => DialogAction[];\n readonly item?: TData;\n}\nexport interface CrudPageEditDialogProps<TData extends GenericData, TFormFields extends AnyObject> extends WithDialogRenderProps<CrudPageEditDialogOpenProps<TData>> {\n readonly createItemDialogTitle?: string;\n readonly defaultNewItem?: Partial<TFormFields>;\n readonly formFieldDefinitions: ((item: TData, values?: TFormFields) => FormFieldDefinition<TFormFields>[]) | FormFieldDefinition<TFormFields>[];\n readonly getFormValuesFromItem?: (item: TData) => Partial<TFormFields>;\n readonly getName: (item: TData | TFormFields) => string;\n readonly onChange?: (item: TData, formValues: TFormFields, formMethods: UseFormReturn<TFormFields>) => void;\n readonly onSave: (formValues: TFormFields, item: TData) => void;\n readonly schema: ObjectSchema<TFormFields, TFormFields>;\n}\nexport type CrudPageEditDialogRefMethods<TData extends GenericData, TFormFields extends AnyObject> = WithDialogRefMethods<CrudPageEditDialogProps<TData, TFormFields>, CrudPageEditDialogOpenProps<TData>>;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const CrudPageEditDialog = withDialog<CrudPageEditDialogProps<any, any>, CrudPageEditDialogOpenProps<any>>(<TData extends GenericData, TFormFields extends AnyObject>(\n {\n createItemDialogTitle,\n defaultNewItem,\n formFieldDefinitions,\n getFormValuesFromItem,\n getName,\n onActionsChange,\n onChange,\n onClose,\n onSave,\n onTitleChange,\n openProps,\n schema,\n }: CrudPageEditDialogProps<TData, TFormFields>,\n): ReactElement => {\n const { t } = useTranslation();\n const formId = useId();\n\n const initialFormFieldDefinitions = useMemo(() => {\n return typeof formFieldDefinitions === 'function' ? formFieldDefinitions(openProps.item) : formFieldDefinitions;\n }, [formFieldDefinitions, openProps.item]);\n\n const [resolvedFormFieldDefinitions, setResolvedFormFieldDefinitions] = useState<FormFieldDefinition<TFormFields>[]>(initialFormFieldDefinitions);\n\n useEffect(() => {\n const actions: DialogAction[] = [];\n if (openProps.extraActionsFactory) {\n actions.push(...openProps.extraActionsFactory(openProps.item));\n }\n actions.push({\n ...TestIdUtil.createAttributes('CrudPageEditDialog-saveButton'),\n autoFocus: true,\n color: 'secondary',\n disabled: !openProps.canSave || resolvedFormFieldDefinitions.some(def => def.loading),\n form: formId,\n label: t`Save`,\n startIcon: <SaveIcon />,\n type: 'submit',\n variant: 'contained',\n });\n onActionsChange(actions);\n }, [onActionsChange, formId, t, resolvedFormFieldDefinitions, openProps]);\n\n const values = useMemo<TFormFields>(() => {\n return { ...defaultNewItem, ...FormUtil.createFormValues(resolvedFormFieldDefinitions, { ...defaultNewItem, ...(getFormValuesFromItem ? getFormValuesFromItem(openProps.item) : (openProps.item ?? {})) }) };\n }, [defaultNewItem, resolvedFormFieldDefinitions, getFormValuesFromItem, openProps.item]);\n\n useEffect(() => {\n if (openProps.item?.id) {\n onTitleChange(`Edit item: ${getName({ ...defaultNewItem as TFormFields, ...(getFormValuesFromItem ? getFormValuesFromItem(openProps.item) : (openProps.item ?? {})) })}`);\n } else {\n onTitleChange(createItemDialogTitle ?? t`Create new item`);\n }\n }, [getName, onTitleChange, openProps, t, createItemDialogTitle, defaultNewItem, getFormValuesFromItem]);\n\n\n const formMethods = useForm<TFormFields>({\n resolver: yupResolver(schema) as unknown as Resolver<TFormFields>,\n values,\n });\n const { formState, handleSubmit, subscribe } = formMethods;\n\n const debouncedHandleValuesChange = useDebouncedCallback((formValues: TFormFields) => {\n if (onChange) {\n onChange(openProps.item, formValues, formMethods);\n }\n\n if (typeof formFieldDefinitions !== 'function') {\n return;\n }\n setResolvedFormFieldDefinitions(formFieldDefinitions(openProps.item, formValues));\n }, 500, {\n leading: false,\n trailing: true,\n });\n\n useEffect(() => {\n const unsubscribe = subscribe({\n callback: ({ values: formValues }) => {\n debouncedHandleValuesChange(formValues);\n },\n formState: {\n values: true,\n },\n });\n return () => unsubscribe();\n }, [debouncedHandleValuesChange, formFieldDefinitions, subscribe]);\n\n if (formState.errors && Object.keys(formState.errors).length > 0) {\n console.table(formState.errors);\n }\n\n const onFormSubmit = useCallback((formFields: TFormFields): void => {\n onSave(formFields, openProps.item);\n onClose();\n }, [onClose, onSave, openProps.item]);\n\n return (\n <GenericForm<TFormFields>\n disableAll={!openProps.canSave}\n formFieldDefinitions={resolvedFormFieldDefinitions}\n formId={formId}\n formMethods={formMethods}\n onSubmit={openProps.canSave ? handleSubmit(onFormSubmit) : undefined}\n schema={schema}\n />\n );\n}, {\n defaultTitle: '',\n fullWidth: true,\n maxWidth: 'lg',\n testId: 'CrudPageEditDialog',\n});\n","import type { ReactElement } from 'react';\nimport {\n useCallback,\n useEffect,\n} from 'react';\nimport SaveIcon from '@mui/icons-material/Save';\nimport { useTranslation } from 'react-i18next';\nimport { Box } from '@mui/material';\nimport { TestIdUtil } from '@gen-epix/ui-core/utils/TestIdUtil';\nimport type { DialogAction } from '@gen-epix/ui-core-components/components/Dialog';\nimport type {\n WithDialogRefMethods,\n WithDialogRenderProps,\n} from '@gen-epix/ui-core-components/hoc/withDialog';\nimport { withDialog } from '@gen-epix/ui-core-components/hoc/withDialog';\n\nimport type { GenericData } from '../../models/data.models';\n\n\nexport interface CrudPageDeleteDialogOpenProps<TData extends GenericData> {\n readonly item: TData;\n}\nexport interface CrudPageDeleteDialogProps<TData extends GenericData> extends WithDialogRenderProps<CrudPageDeleteDialogOpenProps<TData>> {\n readonly createItemDialogTitle?: string;\n readonly getName: (item: TData) => string;\n readonly onConfirm: (item: TData) => void;\n}\nexport type CrudPageDeleteDialogRefMethods<TData extends GenericData> = WithDialogRefMethods<CrudPageDeleteDialogProps<TData>, CrudPageDeleteDialogOpenProps<TData>>;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const CrudPageDeleteDialog = withDialog<CrudPageDeleteDialogProps<any>, CrudPageDeleteDialogOpenProps<any>>(<TData extends GenericData>(\n {\n createItemDialogTitle,\n getName,\n onActionsChange,\n onClose,\n onConfirm,\n onTitleChange,\n openProps,\n }: CrudPageDeleteDialogProps<TData>,\n): ReactElement => {\n const { t } = useTranslation();\n\n const onConfirmButtonClick = useCallback(() => {\n onConfirm(openProps.item);\n onClose();\n }, [onClose, onConfirm, openProps.item]);\n\n useEffect(() => {\n const actions: DialogAction[] = [];\n actions.push({\n ...TestIdUtil.createAttributes('CrudPageDeleteDialog-closeButton'),\n autoFocus: true,\n color: 'primary',\n label: t`Cancel`,\n onClick: onClose,\n variant: 'outlined',\n });\n actions.push({\n ...TestIdUtil.createAttributes('CrudPageDeleteDialog-confirmButton'),\n color: 'secondary',\n label: t`Confirm`,\n onClick: onConfirmButtonClick,\n startIcon: <SaveIcon />,\n variant: 'contained',\n });\n\n onActionsChange(actions);\n }, [onActionsChange, t, openProps, onConfirmButtonClick, onClose]);\n\n useEffect(() => {\n onTitleChange(t('Delete item: {{itemName}}', { itemName: getName(openProps.item) }));\n }, [getName, onTitleChange, openProps, t, createItemDialogTitle]);\n\n return (\n <Box>\n {t('Are you sure you want to delete the item \"{{itemName}}\"?', { itemName: getName(openProps.item) })}\n </Box>\n );\n}, {\n defaultTitle: '',\n fullWidth: true,\n maxWidth: 'lg',\n testId: 'CrudPageDeleteDialog',\n});\n","import { container } from 'tsyringe';\nimport { useTranslation } from 'react-i18next';\nimport EditIcon from '@mui/icons-material/Edit';\nimport DeleteForeverIcon from '@mui/icons-material/DeleteForever';\nimport ArrowCircleRightIcon from '@mui/icons-material/ArrowCircleRight';\nimport ContentCopyIcon from '@mui/icons-material/ContentCopy';\nimport {\n Box,\n Button,\n ListItemIcon,\n ListItemText,\n MenuItem,\n useTheme,\n} from '@mui/material';\nimport type { ReactElement } from 'react';\nimport {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n} from 'react';\nimport type { ObjectSchema } from 'yup';\nimport isArray from 'lodash/isArray';\nimport type {\n FieldValues,\n UseFormReturn,\n} from 'react-hook-form';\nimport type { CommonDbApiPermission } from '@gen-epix/api-commondb';\nimport { CommonDbPermissionType } from '@gen-epix/api-commondb';\nimport type { PropsWithTestIdAttributes } from '@gen-epix/ui-core/models/test-id.models';\nimport type { FormFieldDefinition } from '@gen-epix/ui-core-form/models/form.models';\nimport type { DialogAction } from '@gen-epix/ui-core-components/components/Dialog';\n\nimport { AuthorizationService } from '../../classes/services/AuthorizationService';\nimport { RouterService } from '../../classes/services/RouterService';\nimport { PageContainer } from '../../components/ui/PageContainer';\nimport { ResponseHandler } from '../../components/ui/ResponseHandler';\nimport {\n Table,\n TableCaption,\n TableHeader,\n TableSidebarMenu,\n} from '../../components/ui/Table';\nimport type { MutationContextCreate } from '../../hooks/useCreateMutation';\nimport { useCreateMutation } from '../../hooks/useCreateMutation';\nimport type { MutationContextDelete } from '../../hooks/useDeleteMutation';\nimport { useDeleteMutation } from '../../hooks/useDeleteMutation';\nimport type { MutationContextEdit } from '../../hooks/useEditMutation';\nimport { useEditMutation } from '../../hooks/useEditMutation';\nimport { useInitializeTableStore } from '../../hooks/useInitializeTableStore';\nimport type { GenericData } from '../../models/data.models';\nimport type { Loadable } from '../../models/data-hooks.models';\nimport type {\n TableColumn,\n TableRowParams,\n TableSortDirection,\n} from '../../models/table.models';\nimport {\n createTableStore,\n TableStoreContextProvider,\n} from '../../stores/tableStore';\nimport { TableUtil } from '../../utils/TableUtil';\nimport { useQueryMemo } from '../../hooks/useQueryMemo';\nimport { LoadableUtil } from '../../utils/LoadableUtil';\nimport { QueryClientService } from '../../classes/services/QueryClientService';\nimport type { COMMON_QUERY_KEY } from '../../constants/query.constants';\nimport { useConfig } from '../../hooks/useConfig';\n\nimport type { CrudPageEditDialogRefMethods } from './CrudPageEditDialog';\nimport { CrudPageEditDialog } from './CrudPageEditDialog';\nimport type { CrudPageDeleteDialogRefMethods } from './CrudPageDeleteDialog';\nimport { CrudPageDeleteDialog } from './CrudPageDeleteDialog';\n\nexport type CrudPageProps<\n TFormFields extends FieldValues,\n TData extends GenericData,\n TTableData extends TData = TData,\n TQueryKey extends string = COMMON_QUERY_KEY,\n TApiPermission extends {\n command_name: string;\n permission_type: string;\n } = CommonDbApiPermission,\n TCommandName extends TApiPermission['command_name'] = TApiPermission['command_name'],\n> = PropsWithTestIdAttributes<{\n readonly associationQueryKeys?: string[][];\n readonly canEditItem?: (item: TData) => boolean;\n readonly contentActions?: ReactElement;\n readonly contentHeader?: string;\n readonly convertToTableData?: (items: TData[]) => TTableData[];\n readonly createItemButtonText?: string;\n readonly createItemDialogTitle?: string;\n readonly createOne?: (item: TFormFields) => Promise<TData>;\n readonly crudCommandType?: TCommandName;\n readonly customOnRowClick?: (params: TableRowParams<TData, null>) => void;\n readonly defaultNewItem?: Partial<TFormFields>;\n readonly defaultSortByField: keyof TTableData;\n readonly defaultSortDirection: TableSortDirection;\n readonly deleteOne?: (item: TData) => Promise<unknown>;\n readonly editDialogExtraActionsFactory?: (item: TData) => DialogAction[];\n readonly extraActionsFactory?: (params: TableRowParams<TData, null>) => ReactElement[];\n readonly extraCreateOnePermissions?: TApiPermission[];\n readonly extraDeleteOnePermissions?: TApiPermission[];\n readonly extraUpdateOnePermissions?: TApiPermission[];\n readonly fetchAll: (signal: AbortSignal) => Promise<TData[]>;\n readonly fetchAllSelect?: (data: TData[]) => TData[];\n readonly formFieldDefinitions: ((values: TFormFields, item: TData) => FormFieldDefinition<TFormFields>[]) | FormFieldDefinition<TFormFields>[];\n readonly getFormValuesFromItem?: (item: TData) => Partial<TFormFields>;\n readonly getName: (item: TData | TFormFields) => string;\n readonly getOptimisticUpdateIntermediateItem?: (variables: TFormFields, previousItem: TData) => TData;\n readonly itemName: string;\n readonly loadables?: Loadable[];\n readonly onCreateError?: (error: unknown, variables: TFormFields, context: MutationContextCreate<TData>) => Promise<void> | void;\n readonly onCreateSuccess?: (item: TData, variables: TFormFields, context: MutationContextCreate<TData>) => Promise<void> | void;\n readonly onDeleteError?: (error: unknown, item: TData, context: MutationContextDelete<TData>) => Promise<void> | void;\n readonly onDeleteSuccess?: (item: TData, context: MutationContextDelete<TData>) => Promise<void> | void;\n readonly onEditError?: (error: unknown, variables: TFormFields, context: MutationContextEdit<TData>) => Promise<void> | void;\n readonly onEditSuccess?: (item: TData, variables: TFormFields, context: MutationContextEdit<TData>) => Promise<void> | void;\n readonly onFormChange?: (item: TData, formValues: TFormFields, formMethods: UseFormReturn<TFormFields>) => void;\n readonly onRowsChange?: (items: TData[]) => void;\n readonly onShowItem?: (params: TableRowParams<TTableData, null>) => void;\n readonly readOnly?: boolean;\n readonly resourceQueryKeyBase: TQueryKey;\n readonly schema?: ObjectSchema<TFormFields, TFormFields>;\n readonly showBreadcrumbs?: boolean;\n readonly showIdColumn?: boolean;\n readonly subPages?: CrudPageSubPage<TData>[];\n readonly tableColumns: TableColumn<TTableData, null>[];\n readonly tableStoreStorageNamePostFix?: string;\n readonly tableStoreStorageVersion?: number;\n readonly title: string | string[];\n readonly updateOne?: (variables: TFormFields, data: TData) => Promise<TData>;\n}>;\n\nexport type CrudPageSubPage<TData extends GenericData> = {\n getPathName: (item: TData) => string;\n icon?: ReactElement;\n label: string;\n};\n\nexport const CrudPage = <\n TFormFields extends FieldValues,\n TData extends GenericData,\n TTableData extends TData = TData,\n TQueryKey extends string = COMMON_QUERY_KEY,\n TApiPermission extends {\n command_name: string;\n permission_type: string;\n } = CommonDbApiPermission,\n TCommandName extends TApiPermission['command_name'] = TApiPermission['command_name'],\n>({\n associationQueryKeys,\n canEditItem,\n contentActions,\n contentHeader,\n convertToTableData,\n createItemButtonText,\n createItemDialogTitle,\n createOne,\n crudCommandType,\n customOnRowClick,\n defaultNewItem,\n defaultSortByField,\n defaultSortDirection,\n deleteOne,\n editDialogExtraActionsFactory,\n extraActionsFactory,\n extraCreateOnePermissions,\n extraDeleteOnePermissions,\n extraUpdateOnePermissions,\n fetchAll,\n fetchAllSelect,\n formFieldDefinitions,\n getFormValuesFromItem,\n getName,\n getOptimisticUpdateIntermediateItem,\n itemName,\n loadables,\n onCreateError,\n onCreateSuccess,\n onDeleteError,\n onDeleteSuccess,\n onEditError,\n onEditSuccess,\n onFormChange,\n onRowsChange,\n onShowItem,\n resourceQueryKeyBase,\n schema,\n showIdColumn = false,\n subPages,\n tableColumns,\n tableStoreStorageNamePostFix,\n tableStoreStorageVersion,\n testIdAttributes,\n title,\n updateOne,\n}: CrudPageProps<TFormFields, TData, TTableData, TQueryKey, TApiPermission, TCommandName>) => {\n type CrudPermission = Pick<TApiPermission, 'command_name' | 'permission_type'>;\n\n const { t } = useTranslation();\n const theme = useTheme();\n const config = useConfig();\n const deleteConfirmationRef = useRef<CrudPageDeleteDialogRefMethods<TData>>(null);\n const editDialogRef = useRef<CrudPageEditDialogRefMethods<TData, TFormFields>>(null);\n const authorizationService = useMemo(() => container.resolve(AuthorizationService), []);\n const resourceQueryKey = useMemo(() => [resourceQueryKeyBase], [resourceQueryKeyBase]);\n const tableStore = useMemo(() => createTableStore<TTableData, null>({\n defaultSortByField: defaultSortByField as string,\n defaultSortDirection,\n idSelectorCallback: (item) => item.id,\n navigatorFunction: container.resolve(RouterService).router.navigate,\n storageNamePostFix: tableStoreStorageNamePostFix ? `CRUDPage-${resourceQueryKeyBase}-${tableStoreStorageNamePostFix}` : `CRUDPage-${resourceQueryKeyBase}`,\n storageVersion: tableStoreStorageVersion ?? 1,\n }), [defaultSortByField, defaultSortDirection, resourceQueryKeyBase, tableStoreStorageNamePostFix, tableStoreStorageVersion]);\n\n const isLoadablesLoading = useMemo(() => {\n if (isArray(loadables)) {\n return LoadableUtil.isSomeLoading(loadables);\n }\n return false;\n }, [loadables]);\n\n const { data: rows, error: rowsError, isLoading: isRowsLoading } = useQueryMemo({\n enabled: !isLoadablesLoading,\n queryFn: async ({ signal }) => fetchAll(signal),\n queryKey: resourceQueryKey,\n select: fetchAllSelect,\n });\n\n useEffect(() => {\n if (onRowsChange && rows) {\n onRowsChange(rows);\n }\n }, [onRowsChange, rows]);\n\n const isLoading = useMemo(() => {\n if (isRowsLoading) {\n return true;\n }\n return isLoadablesLoading;\n }, [isRowsLoading, isLoadablesLoading]);\n\n const error = useMemo(() => {\n if (rowsError) {\n return rowsError;\n }\n if (isArray(loadables)) {\n return loadables.find((loadable) => loadable.error)?.error as Error;\n }\n return null;\n }, [rowsError, loadables]);\n\n const createPermission = useCallback((permissionType: CrudPermission['permission_type']): CrudPermission => {\n return {\n command_name: crudCommandType,\n permission_type: permissionType,\n };\n }, [crudCommandType]);\n\n const userCanEdit = useMemo(() => {\n if (!updateOne) {\n return false;\n }\n return authorizationService.doesUserHavePermission<CrudPermission>(\n [\n ...(crudCommandType ? [createPermission(CommonDbPermissionType.UPDATE)] : []),\n ...(extraUpdateOnePermissions ?? []),\n ],\n );\n }, [authorizationService, createPermission, crudCommandType, extraUpdateOnePermissions, updateOne]);\n\n const userCanDelete = useMemo(() => {\n if (!deleteOne) {\n return false;\n }\n return authorizationService.doesUserHavePermission<CrudPermission>(\n [\n ...(crudCommandType ? [createPermission(CommonDbPermissionType.DELETE)] : []),\n ...(extraDeleteOnePermissions ?? []),\n ],\n );\n }, [authorizationService, createPermission, crudCommandType, deleteOne, extraDeleteOnePermissions]);\n\n const userCanCreate = useMemo(() => {\n if (!createOne || error) {\n return false;\n }\n return authorizationService.doesUserHavePermission<CrudPermission>(\n [\n ...(crudCommandType ? [createPermission(CommonDbPermissionType.CREATE)] : []),\n ...(extraCreateOnePermissions ?? []),\n ],\n );\n }, [authorizationService, createOne, createPermission, crudCommandType, error, extraCreateOnePermissions]);\n\n const normalizedEditDialogExtraActionsFactory = useCallback((item: TData) => {\n const actions: DialogAction[] = [];\n\n if (editDialogExtraActionsFactory) {\n actions.push(...editDialogExtraActionsFactory(item));\n }\n subPages?.forEach(subPage => {\n actions.push({\n color: 'primary',\n label: subPage.label,\n onClick: async () => await container.resolve(RouterService).router.navigate({\n pathname: subPage.getPathName(item),\n }),\n variant: 'outlined',\n });\n });\n\n return actions;\n }, [editDialogExtraActionsFactory, subPages]);\n\n const editItem = useCallback((item: TTableData) => {\n editDialogRef.current.open({\n canSave: userCanEdit && (!item || canEditItem ? canEditItem(item) : true),\n extraActionsFactory: normalizedEditDialogExtraActionsFactory,\n item,\n });\n }, [canEditItem, normalizedEditDialogExtraActionsFactory, userCanEdit]);\n\n const tryToGetName = useCallback((item: TData | TFormFields) => {\n let name: string;\n try {\n name = getName(item);\n } catch {\n name = undefined;\n }\n return name;\n }, [getName]);\n\n const getEditProgressNotificationMessage = useCallback((data: TData) => {\n const name = tryToGetName(data);\n return name ? t('{{itemName}} \"{{name}}\" is being saved...', { itemName, name }) : t('{{itemName}} is being saved...', { itemName });\n }, [t, tryToGetName, itemName]);\n\n const getCreateProgressNotificationMessage = useCallback((data: TFormFields) => {\n const name = tryToGetName(data);\n return name ? t('{{itemName}} \"{{name}}\" is being saved...', { itemName, name }) : t('{{itemName}} is being saved...', { itemName });\n }, [t, tryToGetName, itemName]);\n\n const getDeleteProgressNotificationMessage = useCallback((data: TData) => {\n const name = tryToGetName(data);\n return name ? t('{{itemName}} \"{{name}}\" is being deleted...', { itemName, name }) : t('{{itemName}} is being deleted...', { itemName });\n }, [t, tryToGetName, itemName]);\n\n const getEditSuccessNotificationMessage = useCallback((data: TData) => {\n const name = tryToGetName(data);\n return name ? t('{{itemName}} \"{{name}}\" has been saved.', { itemName, name }) : t('{{itemName}} has been saved.', { itemName });\n }, [t, tryToGetName, itemName]);\n\n const getCreateSuccessNotificationMessage = useCallback((data: TData) => {\n const name = tryToGetName(data);\n return name ? t('{{itemName}} \"{{name}}\" has been created.', { itemName, name }) : t('{{itemName}} has been created.', { itemName });\n }, [t, tryToGetName, itemName]);\n\n const getDeleteSuccessNotificationMessage = useCallback((data: TData) => {\n const name = tryToGetName(data);\n return name ? t('{{itemName}} \"{{name}}\" has been deleted.', { itemName, name }) : t('{{itemName}} has been deleted.', { itemName });\n }, [t, tryToGetName, itemName]);\n\n const getEditErrorNotificationMessage = useCallback((data: TData) => {\n const name = tryToGetName(data);\n return name ? t('{{itemName}} \"{{name}}\" could not be saved.', { itemName, name }) : t('{{itemName}} could not be saved.', { itemName });\n }, [t, tryToGetName, itemName]);\n\n const getCreateErrorNotificationMessage = useCallback((data: TFormFields) => {\n const name = tryToGetName(data);\n return name ? t('{{itemName}} \"{{name}}\" could not be created.', { itemName, name }) : t('{{itemName}} could not be created.', { itemName });\n }, [t, tryToGetName, itemName]);\n\n const getDeleteErrorNotificationMessage = useCallback((data: TData) => {\n const name = tryToGetName(data);\n return name ? t('{{itemName}} \"{{name}}\" could not be deleted.', { itemName, name }) : t('{{itemName}} could not be deleted.', { itemName });\n }, [t, tryToGetName, itemName]);\n\n const calculatedAssociationQueryKeys = useMemo<string[][]>(() => {\n const keys = associationQueryKeys ?? [];\n\n container.resolve(QueryClientService).getQueryKeyDependencies([resourceQueryKeyBase]).forEach(key => {\n keys.push(key);\n });\n return keys;\n }, [associationQueryKeys, resourceQueryKeyBase]);\n\n const { mutate: mutateEdit, setPreviousItem: mutateEditSetPreviousItem } = useEditMutation<TData, TFormFields>({\n associationQueryKeys: calculatedAssociationQueryKeys,\n getErrorNotificationMessage: getEditErrorNotificationMessage,\n getIntermediateItem: getOptimisticUpdateIntermediateItem,\n getProgressNotificationMessage: getEditProgressNotificationMessage,\n getSuccessNotificationMessage: getEditSuccessNotificationMessage,\n onError: onEditError,\n onSuccess: onEditSuccess,\n queryFn: updateOne,\n resourceQueryKey,\n });\n\n const { isMutating: isCreating, mutate: mutateCreate } = useCreateMutation<TData, TFormFields>({\n associationQueryKeys: calculatedAssociationQueryKeys,\n getErrorNotificationMessage: getCreateErrorNotificationMessage,\n getProgressNotificationMessage: getCreateProgressNotificationMessage,\n getSuccessNotificationMessage: getCreateSuccessNotificationMessage,\n onError: onCreateError,\n onSuccess: onCreateSuccess,\n queryFn: createOne,\n resourceQueryKey,\n });\n\n const { mutate: mutateDelete } = useDeleteMutation<TData>({\n associationQueryKeys: calculatedAssociationQueryKeys,\n getErrorNotificationMessage: getDeleteErrorNotificationMessage,\n getProgressNotificationMessage: getDeleteProgressNotificationMessage,\n getSuccessNotificationMessage: getDeleteSuccessNotificationMessage,\n onError: onDeleteError,\n onSuccess: onDeleteSuccess,\n queryFn: deleteOne,\n resourceQueryKey,\n });\n\n const onEditDialogSave = useCallback((formValues: TFormFields, item: TData) => {\n if (item?.id) {\n mutateEditSetPreviousItem(item);\n mutateEdit(formValues);\n } else {\n mutateCreate(formValues);\n }\n }, [mutateCreate, mutateEdit, mutateEditSetPreviousItem]);\n\n const onEditIconClick = useCallback((params: TableRowParams<TTableData, null>) => {\n editItem(params.row);\n }, [editItem]);\n\n const onRowClick = useCallback((params: TableRowParams<TTableData, null>) => {\n if (customOnRowClick) {\n customOnRowClick(params);\n } else if (onShowItem) {\n onShowItem(params);\n } else {\n editItem(params.row);\n }\n }, [customOnRowClick, onShowItem, editItem]);\n\n const onDeleteConfirmationConfirm = useCallback((item: TData) => {\n mutateDelete(item);\n }, [mutateDelete]);\n\n const normalizedExtraActions = useCallback((params: TableRowParams<TTableData, null>) => {\n const actions: ReactElement[] = [];\n\n const extraActions = extraActionsFactory ? extraActionsFactory(params) : [];\n if (extraActions?.length > 0) {\n actions.push(...extraActions);\n }\n subPages?.forEach(subPage => {\n actions.push((\n <MenuItem\n key={subPage.label}\n // eslint-disable-next-line @eslint-react/kit/jsx-no-bind\n onClick={async () => await container.resolve(RouterService).router.navigate({\n pathname: subPage.getPathName(params.row),\n })}\n >\n <ListItemIcon>\n {subPage.icon ? subPage.icon : <ArrowCircleRightIcon />}\n </ListItemIcon>\n <ListItemText>\n {subPage.label}\n </ListItemText>\n </MenuItem>\n ));\n });\n\n if (userCanCreate) {\n actions.push((\n <MenuItem\n key={'clone'}\n // eslint-disable-next-line @eslint-react/kit/jsx-no-bind\n onClick={() => editDialogRef.current.open({\n canSave: true,\n item: { ...params.row, id: null },\n })}\n >\n <ListItemIcon>\n <ContentCopyIcon />\n </ListItemIcon>\n <ListItemText>\n {t`Clone`}\n </ListItemText>\n </MenuItem>\n ));\n }\n\n return actions;\n }, [extraActionsFactory, subPages, userCanCreate, t]);\n\n const columns = useMemo<TableColumn<TTableData, null>[]>(() => {\n const internalColumns: TableColumn<TTableData, null>[] = [\n TableUtil.createReadableIndexColumn(),\n ];\n\n if (showIdColumn) {\n internalColumns.push({\n headerName: t`Id`,\n id: 'id',\n isInitiallyVisible: true,\n type: 'text',\n widthPx: 300,\n });\n }\n internalColumns.push(...tableColumns);\n\n internalColumns.push(\n TableUtil.createActionsColumn({\n getActions: (params) => {\n const actions: ReactElement[] = [];\n if (onShowItem) {\n actions.push(\n <MenuItem\n key={'actions1'}\n // eslint-disable-next-line @eslint-react/kit/jsx-no-bind\n onClick={() => onShowItem(params)}\n >\n <ListItemIcon>\n <ArrowCircleRightIcon />\n </ListItemIcon>\n <ListItemText>\n {t`Show`}\n </ListItemText>\n </MenuItem>,\n );\n }\n actions.push(\n <MenuItem\n key={'actions2'}\n // eslint-disable-next-line @eslint-react/kit/jsx-no-bind\n onClick={() => onEditIconClick(params)}\n >\n <ListItemIcon>\n <EditIcon />\n </ListItemIcon>\n <ListItemText>\n {t`Edit`}\n </ListItemText>\n </MenuItem>,\n );\n if (userCanDelete) {\n actions.push(\n <MenuItem\n key={'actions3'}\n // eslint-disable-next-line @eslint-react/kit/jsx-no-bind\n onClick={() => deleteConfirmationRef.current.open({\n item: params.row,\n })}\n >\n <ListItemIcon>\n <DeleteForeverIcon />\n </ListItemIcon>\n <ListItemText>\n {t`Delete`}\n </ListItemText>\n </MenuItem>,\n );\n }\n const extraActions = normalizedExtraActions(params) ?? [];\n if (extraActions?.length > 0 && actions.length > 0) {\n actions.push(...extraActions);\n }\n return actions;\n },\n t,\n }),\n );\n return internalColumns;\n }, [normalizedExtraActions, onEditIconClick, onShowItem, showIdColumn, t, tableColumns, userCanDelete]);\n\n const tableRows = useMemo(() => {\n if (!convertToTableData) {\n return rows as TTableData[];\n }\n return convertToTableData(rows);\n }, [convertToTableData, rows]);\n\n useInitializeTableStore<TTableData, null>({ columns, context: null, createFiltersFromColumns: true, rows: tableRows, store: tableStore });\n\n const onCreateItemButtonClick = useCallback(() => {\n editDialogRef.current.open({\n canSave: true,\n });\n }, []);\n\n const customContentActions = useMemo(() => {\n if (!contentActions && !userCanCreate) {\n return (\n <TableHeader />\n );\n }\n return (\n <Box\n sx={{\n alignItems: 'center',\n display: 'flex',\n gap: theme.spacing(1),\n }}\n >\n <TableHeader />\n {userCanCreate && (\n <Button\n color={'secondary'}\n disabled={isLoading || isCreating}\n loading={isLoading || isCreating}\n onClick={onCreateItemButtonClick}\n size={'small'}\n variant={'contained'}\n >\n {createItemButtonText ?? t`Create item`}\n </Button>\n )}\n {contentActions}\n </Box>\n );\n }, [contentActions, userCanCreate, isLoading, isCreating, onCreateItemButtonClick, createItemButtonText, t, theme]);\n\n const normalizedTitle = useMemo<string>(() => {\n if (isArray(title)) {\n return title.join(' -> ');\n }\n return title;\n }, [title]);\n\n\n return (\n <TableStoreContextProvider store={tableStore}>\n <PageContainer\n contentActions={customContentActions}\n contentHeader={(\n <TableCaption\n caption={contentHeader ?? normalizedTitle}\n component={'h2'}\n variant={'h2'}\n />\n )}\n fullWidth\n showBreadcrumbs\n testIdAttributes={testIdAttributes}\n title={normalizedTitle}\n >\n <Box\n sx={{\n height: '100%',\n position: 'relative',\n }}\n >\n <ResponseHandler\n error={error}\n isLoading={isLoading}\n >\n <TableSidebarMenu />\n <Box\n sx={{\n height: '100%',\n paddingLeft: theme.spacing(config.layout.SIDEBAR_MENU_WIDTH + 1),\n width: '100%',\n }}\n >\n <Table\n getRowName={getName}\n onRowClick={onRowClick}\n />\n </Box>\n </ResponseHandler>\n </Box>\n <CrudPageEditDialog\n createItemDialogTitle={createItemDialogTitle}\n defaultNewItem={defaultNewItem}\n formFieldDefinitions={formFieldDefinitions}\n getFormValuesFromItem={getFormValuesFromItem}\n getName={getName}\n onChange={onFormChange}\n onSave={onEditDialogSave}\n ref={editDialogRef}\n schema={schema}\n />\n <CrudPageDeleteDialog\n getName={getName}\n onConfirm={onDeleteConfirmationConfirm}\n ref={deleteConfirmationRef}\n />\n </PageContainer>\n </TableStoreContextProvider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAqDasB,KAAqBC,GAChC,EACE,0BACA,mBACA,yBACA,0BACA,YACA,oBACA,aACA,YACA,WACA,kBACA,cACA,gBAEe;CACjB,IAAM,EAAE,SAAMC,GAAe,GACvBC,IAASC,EAAM,GAEfC,IAA8BC,QAC3B,OAAOC,KAAyB,aAAaA,EAAqBC,EAAU,IAAI,IAAID,GAC1F,CAACA,GAAsBC,EAAU,IAAI,CAAC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,gBAAgBN;GAChB,eACE,kBAAC/J,GAAD;IACE,SAASsK,MAAiBH;IAC1B,WAAW;IACX,SAAS;GACV,CAAA;GAEH,WAAA;GACA,iBAAA;GACkB;GAClB,OAAOA;GAZT,UAAA;IAcE,kBAAC9G,GAAD;KACE,IAAI;MACF,QAAQ;MACR,UAAU;KACZ;KAEA,UAAA,kBAACkH,GAAD;MACS;MACI;MAFb,UAAA,CAIE,kBAACtK,IAAD,CAAmB,CAAA,GACnB,kBAACoD,GAAD;OACE,IAAI;QACF,QAAQ;QACR,aAAaE,GAAM,QAAQE,GAAO,OAAO,qBAAqB,CAAC;QAC/D,OAAO;OACT;OAEA,UAAA,kBAACnE,GAAD;QACE,YAAYyC;QACA;OACb,CAAA;MACE,CAAA,CACU;;IACd,CAAA;IACL,kBAACtB,IAAD;KACyB;KACP;KACM;KACC;KACd;KACT,UAAU+J;KACV,QAAQ9B;KACR,KAAK7E;KACG;IACT,CAAA;IACD,kBAACX,IAAD;KACW;KACT,WAAW8F;KACX,KAAKrF;IACN,CAAA;GACY;;CACU,CAAA;AAE/B"}
|
|
1
|
+
{"version":3,"file":"CrudPage.js","names":["yupResolver","useDebouncedCallback","isArray","Table","__toESM","require_isArray","TableStoreContextProvider","Table$1","c","TableHeader","TableCaption","TableSidebarMenu","useQueryMemo","QueryClientService","o","EditIcon","DeleteForeverIcon","ArrowCircleRightIcon","ContentCopyIcon","SaveIcon","import_isArray","CrudPageEditDialog","withDialog","useTranslation","formId","useId","initialFormFieldDefinitions","useMemo","formFieldDefinitions","openProps","resolvedFormFieldDefinitions","setResolvedFormFieldDefinitions","useState","actions","TestIdUtil","def","onActionsChange","t","values","defaultNewItem","FormUtil","getFormValuesFromItem","onTitleChange","getName","createItemDialogTitle","formMethods","useForm","schema","debouncedHandleValuesChange","onChange","formValues","useEffect","unsubscribe","subscribe","formState","onFormSubmit","useCallback","onSave","formFields","onClose","GenericForm","handleSubmit","CrudPageDeleteDialog","onConfirmButtonClick","onConfirm","Box","CrudPage","theme","useTheme","config","useConfig","deleteConfirmationRef","useRef","editDialogRef","authorizationService","container","AuthorizationService","resourceQueryKey","resourceQueryKeyBase","tableStore","createTableStore","item","RouterService","tableStoreStorageNamePostFix","tableStoreStorageVersion","defaultSortByField","defaultSortDirection","isLoadablesLoading","loadables","LoadableUtil","rows","rowsError","isRowsLoading","fetchAll","signal","fetchAllSelect","onRowsChange","isLoading","error","loadable","createPermission","crudCommandType","permissionType","userCanEdit","updateOne","CommonDbPermissionType","extraUpdateOnePermissions","userCanDelete","deleteOne","extraDeleteOnePermissions","userCanCreate","createOne","extraCreateOnePermissions","normalizedEditDialogExtraActionsFactory","editDialogExtraActionsFactory","subPages","subPage","editItem","canEditItem","tryToGetName","name","getEditProgressNotificationMessage","data","itemName","getCreateProgressNotificationMessage","getDeleteProgressNotificationMessage","getEditSuccessNotificationMessage","getCreateSuccessNotificationMessage","getDeleteSuccessNotificationMessage","getEditErrorNotificationMessage","getCreateErrorNotificationMessage","getDeleteErrorNotificationMessage","calculatedAssociationQueryKeys","keys","associationQueryKeys","key","mutateEdit","mutateEditSetPreviousItem","useEditMutation","getOptimisticUpdateIntermediateItem","onEditError","onEditSuccess","isCreating","mutateCreate","useCreateMutation","onCreateError","onCreateSuccess","mutateDelete","useDeleteMutation","onDeleteError","onDeleteSuccess","onEditDialogSave","onEditIconClick","params","onRowClick","customOnRowClick","onShowItem","onDeleteConfirmationConfirm","normalizedExtraActions","extraActions","extraActionsFactory","MenuItem","ListItemIcon","ListItemText","columns","internalColumns","TableUtil","showIdColumn","tableColumns","tableRows","convertToTableData","onCreateItemButtonClick","customContentActions","contentActions","Button","createItemButtonText","normalizedTitle","title","PageContainer","contentHeader","ResponseHandler","onFormChange"],"sources":["../../src/pages/CrudPage/CrudPageEditDialog.tsx","../../src/pages/CrudPage/CrudPageDeleteDialog.tsx","../../src/pages/CrudPage/CrudPage.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport {\n useCallback,\n useEffect,\n useId,\n useMemo,\n useState,\n} from 'react';\nimport SaveIcon from '@mui/icons-material/Save';\nimport { useTranslation } from 'react-i18next';\nimport type {\n AnyObject,\n ObjectSchema,\n} from 'yup';\nimport { yupResolver } from '@hookform/resolvers/yup';\nimport type {\n Resolver,\n UseFormReturn,\n} from 'react-hook-form';\nimport { useForm } from 'react-hook-form';\nimport { useDebouncedCallback } from 'use-debounce';\nimport { TestIdUtil } from '@gen-epix/ui-core/utils/TestIdUtil';\nimport { GenericForm } from '@gen-epix/ui-core-form/components/helpers/GenericForm';\nimport type { FormFieldDefinition } from '@gen-epix/ui-core-form/models/form.models';\nimport { FormUtil } from '@gen-epix/ui-core-form/utils/FormUtil';\nimport type { DialogAction } from '@gen-epix/ui-core-components/components/Dialog';\nimport type {\n WithDialogRefMethods,\n WithDialogRenderProps,\n} from '@gen-epix/ui-core-components/hoc/withDialog';\nimport { withDialog } from '@gen-epix/ui-core-components/hoc/withDialog';\n\nimport type { GenericData } from '../../models/data.models';\n\n\nexport interface CrudPageEditDialogOpenProps<TData extends GenericData> {\n readonly canSave: boolean;\n readonly extraActionsFactory?: (item: TData) => DialogAction[];\n readonly item?: TData;\n}\nexport interface CrudPageEditDialogProps<TData extends GenericData, TFormFields extends AnyObject> extends WithDialogRenderProps<CrudPageEditDialogOpenProps<TData>> {\n readonly createItemDialogTitle?: string;\n readonly defaultNewItem?: Partial<TFormFields>;\n readonly formFieldDefinitions: ((item: TData, values?: TFormFields) => FormFieldDefinition<TFormFields>[]) | FormFieldDefinition<TFormFields>[];\n readonly getFormValuesFromItem?: (item: TData) => Partial<TFormFields>;\n readonly getName: (item: TData | TFormFields) => string;\n readonly onChange?: (item: TData, formValues: TFormFields, formMethods: UseFormReturn<TFormFields>) => void;\n readonly onSave: (formValues: TFormFields, item: TData) => void;\n readonly schema: ObjectSchema<TFormFields, TFormFields>;\n}\nexport type CrudPageEditDialogRefMethods<TData extends GenericData, TFormFields extends AnyObject> = WithDialogRefMethods<CrudPageEditDialogProps<TData, TFormFields>, CrudPageEditDialogOpenProps<TData>>;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const CrudPageEditDialog = withDialog<CrudPageEditDialogProps<any, any>, CrudPageEditDialogOpenProps<any>>(<TData extends GenericData, TFormFields extends AnyObject>(\n {\n createItemDialogTitle,\n defaultNewItem,\n formFieldDefinitions,\n getFormValuesFromItem,\n getName,\n onActionsChange,\n onChange,\n onClose,\n onSave,\n onTitleChange,\n openProps,\n schema,\n }: CrudPageEditDialogProps<TData, TFormFields>,\n): ReactElement => {\n const { t } = useTranslation();\n const formId = useId();\n\n const initialFormFieldDefinitions = useMemo(() => {\n return typeof formFieldDefinitions === 'function' ? formFieldDefinitions(openProps.item) : formFieldDefinitions;\n }, [formFieldDefinitions, openProps.item]);\n\n const [resolvedFormFieldDefinitions, setResolvedFormFieldDefinitions] = useState<FormFieldDefinition<TFormFields>[]>(initialFormFieldDefinitions);\n\n useEffect(() => {\n const actions: DialogAction[] = [];\n if (openProps.extraActionsFactory) {\n actions.push(...openProps.extraActionsFactory(openProps.item));\n }\n actions.push({\n ...TestIdUtil.createAttributes('CrudPageEditDialog-saveButton'),\n autoFocus: true,\n color: 'secondary',\n disabled: !openProps.canSave || resolvedFormFieldDefinitions.some(def => def.loading),\n form: formId,\n label: t`Save`,\n startIcon: <SaveIcon />,\n type: 'submit',\n variant: 'contained',\n });\n onActionsChange(actions);\n }, [onActionsChange, formId, t, resolvedFormFieldDefinitions, openProps]);\n\n const values = useMemo<TFormFields>(() => {\n return { ...defaultNewItem, ...FormUtil.createFormValues(resolvedFormFieldDefinitions, { ...defaultNewItem, ...(getFormValuesFromItem ? getFormValuesFromItem(openProps.item) : (openProps.item ?? {})) }) };\n }, [defaultNewItem, resolvedFormFieldDefinitions, getFormValuesFromItem, openProps.item]);\n\n useEffect(() => {\n if (openProps.item?.id) {\n onTitleChange(`Edit item: ${getName({ ...defaultNewItem as TFormFields, ...(getFormValuesFromItem ? getFormValuesFromItem(openProps.item) : (openProps.item ?? {})) })}`);\n } else {\n onTitleChange(createItemDialogTitle ?? t`Create new item`);\n }\n }, [getName, onTitleChange, openProps, t, createItemDialogTitle, defaultNewItem, getFormValuesFromItem]);\n\n\n const formMethods = useForm<TFormFields>({\n resolver: yupResolver(schema) as unknown as Resolver<TFormFields>,\n values,\n });\n const { formState, handleSubmit, subscribe } = formMethods;\n\n const debouncedHandleValuesChange = useDebouncedCallback((formValues: TFormFields) => {\n if (onChange) {\n onChange(openProps.item, formValues, formMethods);\n }\n\n if (typeof formFieldDefinitions !== 'function') {\n return;\n }\n setResolvedFormFieldDefinitions(formFieldDefinitions(openProps.item, formValues));\n }, 500, {\n leading: false,\n trailing: true,\n });\n\n useEffect(() => {\n const unsubscribe = subscribe({\n callback: ({ values: formValues }) => {\n debouncedHandleValuesChange(formValues);\n },\n formState: {\n values: true,\n },\n });\n return () => unsubscribe();\n }, [debouncedHandleValuesChange, formFieldDefinitions, subscribe]);\n\n if (formState.errors && Object.keys(formState.errors).length > 0) {\n console.table(formState.errors);\n }\n\n const onFormSubmit = useCallback((formFields: TFormFields): void => {\n onSave(formFields, openProps.item);\n onClose();\n }, [onClose, onSave, openProps.item]);\n\n return (\n <GenericForm<TFormFields>\n disableAll={!openProps.canSave}\n formFieldDefinitions={resolvedFormFieldDefinitions}\n formId={formId}\n formMethods={formMethods}\n onSubmit={openProps.canSave ? handleSubmit(onFormSubmit) : undefined}\n schema={schema}\n />\n );\n}, {\n defaultTitle: '',\n fullWidth: true,\n maxWidth: 'lg',\n testId: 'CrudPageEditDialog',\n});\n","import type { ReactElement } from 'react';\nimport {\n useCallback,\n useEffect,\n} from 'react';\nimport SaveIcon from '@mui/icons-material/Save';\nimport { useTranslation } from 'react-i18next';\nimport { Box } from '@mui/material';\nimport { TestIdUtil } from '@gen-epix/ui-core/utils/TestIdUtil';\nimport type { DialogAction } from '@gen-epix/ui-core-components/components/Dialog';\nimport type {\n WithDialogRefMethods,\n WithDialogRenderProps,\n} from '@gen-epix/ui-core-components/hoc/withDialog';\nimport { withDialog } from '@gen-epix/ui-core-components/hoc/withDialog';\n\nimport type { GenericData } from '../../models/data.models';\n\n\nexport interface CrudPageDeleteDialogOpenProps<TData extends GenericData> {\n readonly item: TData;\n}\nexport interface CrudPageDeleteDialogProps<TData extends GenericData> extends WithDialogRenderProps<CrudPageDeleteDialogOpenProps<TData>> {\n readonly createItemDialogTitle?: string;\n readonly getName: (item: TData) => string;\n readonly onConfirm: (item: TData) => void;\n}\nexport type CrudPageDeleteDialogRefMethods<TData extends GenericData> = WithDialogRefMethods<CrudPageDeleteDialogProps<TData>, CrudPageDeleteDialogOpenProps<TData>>;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const CrudPageDeleteDialog = withDialog<CrudPageDeleteDialogProps<any>, CrudPageDeleteDialogOpenProps<any>>(<TData extends GenericData>(\n {\n createItemDialogTitle,\n getName,\n onActionsChange,\n onClose,\n onConfirm,\n onTitleChange,\n openProps,\n }: CrudPageDeleteDialogProps<TData>,\n): ReactElement => {\n const { t } = useTranslation();\n\n const onConfirmButtonClick = useCallback(() => {\n onConfirm(openProps.item);\n onClose();\n }, [onClose, onConfirm, openProps.item]);\n\n useEffect(() => {\n const actions: DialogAction[] = [];\n actions.push({\n ...TestIdUtil.createAttributes('CrudPageDeleteDialog-closeButton'),\n autoFocus: true,\n color: 'primary',\n label: t`Cancel`,\n onClick: onClose,\n variant: 'outlined',\n });\n actions.push({\n ...TestIdUtil.createAttributes('CrudPageDeleteDialog-confirmButton'),\n color: 'secondary',\n label: t`Confirm`,\n onClick: onConfirmButtonClick,\n startIcon: <SaveIcon />,\n variant: 'contained',\n });\n\n onActionsChange(actions);\n }, [onActionsChange, t, openProps, onConfirmButtonClick, onClose]);\n\n useEffect(() => {\n onTitleChange(t('Delete item: {{itemName}}', { itemName: getName(openProps.item) }));\n }, [getName, onTitleChange, openProps, t, createItemDialogTitle]);\n\n return (\n <Box>\n {t('Are you sure you want to delete the item \"{{itemName}}\"?', { itemName: getName(openProps.item) })}\n </Box>\n );\n}, {\n defaultTitle: '',\n fullWidth: true,\n maxWidth: 'lg',\n testId: 'CrudPageDeleteDialog',\n});\n","import { container } from 'tsyringe';\nimport { useTranslation } from 'react-i18next';\nimport EditIcon from '@mui/icons-material/Edit';\nimport DeleteForeverIcon from '@mui/icons-material/DeleteForever';\nimport ArrowCircleRightIcon from '@mui/icons-material/ArrowCircleRight';\nimport ContentCopyIcon from '@mui/icons-material/ContentCopy';\nimport {\n Box,\n Button,\n ListItemIcon,\n ListItemText,\n MenuItem,\n useTheme,\n} from '@mui/material';\nimport type { ReactElement } from 'react';\nimport {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n} from 'react';\nimport type { ObjectSchema } from 'yup';\nimport isArray from 'lodash/isArray';\nimport type {\n FieldValues,\n UseFormReturn,\n} from 'react-hook-form';\nimport type { CommonDbApiPermission } from '@gen-epix/api-commondb';\nimport { CommonDbPermissionType } from '@gen-epix/api-commondb';\nimport type { PropsWithTestIdAttributes } from '@gen-epix/ui-core/models/test-id.models';\nimport type { FormFieldDefinition } from '@gen-epix/ui-core-form/models/form.models';\nimport type { DialogAction } from '@gen-epix/ui-core-components/components/Dialog';\n\nimport { AuthorizationService } from '../../classes/services/AuthorizationService';\nimport { RouterService } from '../../classes/services/RouterService';\nimport { PageContainer } from '../../components/ui/PageContainer';\nimport { ResponseHandler } from '../../components/ui/ResponseHandler';\nimport {\n Table,\n TableCaption,\n TableHeader,\n TableSidebarMenu,\n} from '../../components/ui/Table';\nimport type { MutationContextCreate } from '../../hooks/useCreateMutation';\nimport { useCreateMutation } from '../../hooks/useCreateMutation';\nimport type { MutationContextDelete } from '../../hooks/useDeleteMutation';\nimport { useDeleteMutation } from '../../hooks/useDeleteMutation';\nimport type { MutationContextEdit } from '../../hooks/useEditMutation';\nimport { useEditMutation } from '../../hooks/useEditMutation';\nimport { useInitializeTableStore } from '../../hooks/useInitializeTableStore';\nimport type { GenericData } from '../../models/data.models';\nimport type { Loadable } from '../../models/data-hooks.models';\nimport type {\n TableColumn,\n TableRowParams,\n TableSortDirection,\n} from '../../models/table.models';\nimport {\n createTableStore,\n TableStoreContextProvider,\n} from '../../stores/tableStore';\nimport { TableUtil } from '../../utils/TableUtil';\nimport { useQueryMemo } from '../../hooks/useQueryMemo';\nimport { LoadableUtil } from '../../utils/LoadableUtil';\nimport { QueryClientService } from '../../classes/services/QueryClientService';\nimport type { COMMON_QUERY_KEY } from '../../constants/query.constants';\nimport { useConfig } from '../../hooks/useConfig';\n\nimport type { CrudPageEditDialogRefMethods } from './CrudPageEditDialog';\nimport { CrudPageEditDialog } from './CrudPageEditDialog';\nimport type { CrudPageDeleteDialogRefMethods } from './CrudPageDeleteDialog';\nimport { CrudPageDeleteDialog } from './CrudPageDeleteDialog';\n\nexport type CrudPageProps<\n TFormFields extends FieldValues,\n TData extends GenericData,\n TTableData extends TData = TData,\n TQueryKey extends string = COMMON_QUERY_KEY,\n TApiPermission extends {\n command_name: string;\n permission_type: string;\n } = CommonDbApiPermission,\n TCommandName extends TApiPermission['command_name'] = TApiPermission['command_name'],\n> = PropsWithTestIdAttributes<{\n readonly associationQueryKeys?: string[][];\n readonly canEditItem?: (item: TData) => boolean;\n readonly contentActions?: ReactElement;\n readonly contentHeader?: string;\n readonly convertToTableData?: (items: TData[]) => TTableData[];\n readonly createItemButtonText?: string;\n readonly createItemDialogTitle?: string;\n readonly createOne?: (item: TFormFields) => Promise<TData>;\n readonly crudCommandType?: TCommandName;\n readonly customOnRowClick?: (params: TableRowParams<TData, null>) => void;\n readonly defaultNewItem?: Partial<TFormFields>;\n readonly defaultSortByField: keyof TTableData;\n readonly defaultSortDirection: TableSortDirection;\n readonly deleteOne?: (item: TData) => Promise<unknown>;\n readonly editDialogExtraActionsFactory?: (item: TData) => DialogAction[];\n readonly extraActionsFactory?: (params: TableRowParams<TData, null>) => ReactElement[];\n readonly extraCreateOnePermissions?: TApiPermission[];\n readonly extraDeleteOnePermissions?: TApiPermission[];\n readonly extraUpdateOnePermissions?: TApiPermission[];\n readonly fetchAll: (signal: AbortSignal) => Promise<TData[]>;\n readonly fetchAllSelect?: (data: TData[]) => TData[];\n readonly formFieldDefinitions: ((values: TFormFields, item: TData) => FormFieldDefinition<TFormFields>[]) | FormFieldDefinition<TFormFields>[];\n readonly getFormValuesFromItem?: (item: TData) => Partial<TFormFields>;\n readonly getName: (item: TData | TFormFields) => string;\n readonly getOptimisticUpdateIntermediateItem?: (variables: TFormFields, previousItem: TData) => TData;\n readonly itemName: string;\n readonly loadables?: Loadable[];\n readonly onCreateError?: (error: unknown, variables: TFormFields, context: MutationContextCreate<TData>) => Promise<void> | void;\n readonly onCreateSuccess?: (item: TData, variables: TFormFields, context: MutationContextCreate<TData>) => Promise<void> | void;\n readonly onDeleteError?: (error: unknown, item: TData, context: MutationContextDelete<TData>) => Promise<void> | void;\n readonly onDeleteSuccess?: (item: TData, context: MutationContextDelete<TData>) => Promise<void> | void;\n readonly onEditError?: (error: unknown, variables: TFormFields, context: MutationContextEdit<TData>) => Promise<void> | void;\n readonly onEditSuccess?: (item: TData, variables: TFormFields, context: MutationContextEdit<TData>) => Promise<void> | void;\n readonly onFormChange?: (item: TData, formValues: TFormFields, formMethods: UseFormReturn<TFormFields>) => void;\n readonly onRowsChange?: (items: TData[]) => void;\n readonly onShowItem?: (params: TableRowParams<TTableData, null>) => void;\n readonly readOnly?: boolean;\n readonly resourceQueryKeyBase: TQueryKey;\n readonly schema?: ObjectSchema<TFormFields, TFormFields>;\n readonly showBreadcrumbs?: boolean;\n readonly showIdColumn?: boolean;\n readonly subPages?: CrudPageSubPage<TData>[];\n readonly tableColumns: TableColumn<TTableData, null>[];\n readonly tableStoreStorageNamePostFix?: string;\n readonly tableStoreStorageVersion?: number;\n readonly title: string | string[];\n readonly updateOne?: (variables: TFormFields, data: TData) => Promise<TData>;\n}>;\n\nexport type CrudPageSubPage<TData extends GenericData> = {\n getPathName: (item: TData) => string;\n icon?: ReactElement;\n label: string;\n};\n\nexport const CrudPage = <\n TFormFields extends FieldValues,\n TData extends GenericData,\n TTableData extends TData = TData,\n TQueryKey extends string = COMMON_QUERY_KEY,\n TApiPermission extends {\n command_name: string;\n permission_type: string;\n } = CommonDbApiPermission,\n TCommandName extends TApiPermission['command_name'] = TApiPermission['command_name'],\n>({\n associationQueryKeys,\n canEditItem,\n contentActions,\n contentHeader,\n convertToTableData,\n createItemButtonText,\n createItemDialogTitle,\n createOne,\n crudCommandType,\n customOnRowClick,\n defaultNewItem,\n defaultSortByField,\n defaultSortDirection,\n deleteOne,\n editDialogExtraActionsFactory,\n extraActionsFactory,\n extraCreateOnePermissions,\n extraDeleteOnePermissions,\n extraUpdateOnePermissions,\n fetchAll,\n fetchAllSelect,\n formFieldDefinitions,\n getFormValuesFromItem,\n getName,\n getOptimisticUpdateIntermediateItem,\n itemName,\n loadables,\n onCreateError,\n onCreateSuccess,\n onDeleteError,\n onDeleteSuccess,\n onEditError,\n onEditSuccess,\n onFormChange,\n onRowsChange,\n onShowItem,\n resourceQueryKeyBase,\n schema,\n showIdColumn = false,\n subPages,\n tableColumns,\n tableStoreStorageNamePostFix,\n tableStoreStorageVersion,\n testIdAttributes,\n title,\n updateOne,\n}: CrudPageProps<TFormFields, TData, TTableData, TQueryKey, TApiPermission, TCommandName>) => {\n type CrudPermission = Pick<TApiPermission, 'command_name' | 'permission_type'>;\n\n const { t } = useTranslation();\n const theme = useTheme();\n const config = useConfig();\n const deleteConfirmationRef = useRef<CrudPageDeleteDialogRefMethods<TData>>(null);\n const editDialogRef = useRef<CrudPageEditDialogRefMethods<TData, TFormFields>>(null);\n const authorizationService = useMemo(() => container.resolve(AuthorizationService), []);\n const resourceQueryKey = useMemo(() => [resourceQueryKeyBase], [resourceQueryKeyBase]);\n const tableStore = useMemo(() => createTableStore<TTableData, null>({\n defaultSortByField: defaultSortByField as string,\n defaultSortDirection,\n idSelectorCallback: (item) => item.id,\n navigatorFunction: container.resolve(RouterService).router.navigate,\n storageNamePostFix: tableStoreStorageNamePostFix ? `CRUDPage-${resourceQueryKeyBase}-${tableStoreStorageNamePostFix}` : `CRUDPage-${resourceQueryKeyBase}`,\n storageVersion: tableStoreStorageVersion ?? 1,\n }), [defaultSortByField, defaultSortDirection, resourceQueryKeyBase, tableStoreStorageNamePostFix, tableStoreStorageVersion]);\n\n const isLoadablesLoading = useMemo(() => {\n if (isArray(loadables)) {\n return LoadableUtil.isSomeLoading(loadables);\n }\n return false;\n }, [loadables]);\n\n const { data: rows, error: rowsError, isLoading: isRowsLoading } = useQueryMemo({\n enabled: !isLoadablesLoading,\n queryFn: async ({ signal }) => fetchAll(signal),\n queryKey: resourceQueryKey,\n select: fetchAllSelect,\n });\n\n useEffect(() => {\n if (onRowsChange && rows) {\n onRowsChange(rows);\n }\n }, [onRowsChange, rows]);\n\n const isLoading = useMemo(() => {\n if (isRowsLoading) {\n return true;\n }\n return isLoadablesLoading;\n }, [isRowsLoading, isLoadablesLoading]);\n\n const error = useMemo(() => {\n if (rowsError) {\n return rowsError;\n }\n if (isArray(loadables)) {\n return loadables.find((loadable) => loadable.error)?.error as Error;\n }\n return null;\n }, [rowsError, loadables]);\n\n const createPermission = useCallback((permissionType: CrudPermission['permission_type']): CrudPermission => {\n return {\n command_name: crudCommandType,\n permission_type: permissionType,\n };\n }, [crudCommandType]);\n\n const userCanEdit = useMemo(() => {\n if (!updateOne) {\n return false;\n }\n return authorizationService.doesUserHavePermission<CrudPermission>(\n [\n ...(crudCommandType ? [createPermission(CommonDbPermissionType.UPDATE)] : []),\n ...(extraUpdateOnePermissions ?? []),\n ],\n );\n }, [authorizationService, createPermission, crudCommandType, extraUpdateOnePermissions, updateOne]);\n\n const userCanDelete = useMemo(() => {\n if (!deleteOne) {\n return false;\n }\n return authorizationService.doesUserHavePermission<CrudPermission>(\n [\n ...(crudCommandType ? [createPermission(CommonDbPermissionType.DELETE)] : []),\n ...(extraDeleteOnePermissions ?? []),\n ],\n );\n }, [authorizationService, createPermission, crudCommandType, deleteOne, extraDeleteOnePermissions]);\n\n const userCanCreate = useMemo(() => {\n if (!createOne || error) {\n return false;\n }\n return authorizationService.doesUserHavePermission<CrudPermission>(\n [\n ...(crudCommandType ? [createPermission(CommonDbPermissionType.CREATE)] : []),\n ...(extraCreateOnePermissions ?? []),\n ],\n );\n }, [authorizationService, createOne, createPermission, crudCommandType, error, extraCreateOnePermissions]);\n\n const normalizedEditDialogExtraActionsFactory = useCallback((item: TData) => {\n const actions: DialogAction[] = [];\n\n if (editDialogExtraActionsFactory) {\n actions.push(...editDialogExtraActionsFactory(item));\n }\n subPages?.forEach(subPage => {\n actions.push({\n color: 'primary',\n label: subPage.label,\n onClick: async () => await container.resolve(RouterService).router.navigate({\n pathname: subPage.getPathName(item),\n }),\n variant: 'outlined',\n });\n });\n\n return actions;\n }, [editDialogExtraActionsFactory, subPages]);\n\n const editItem = useCallback((item: TTableData) => {\n editDialogRef.current.open({\n canSave: userCanEdit && (!item || canEditItem ? canEditItem(item) : true),\n extraActionsFactory: normalizedEditDialogExtraActionsFactory,\n item,\n });\n }, [canEditItem, normalizedEditDialogExtraActionsFactory, userCanEdit]);\n\n const tryToGetName = useCallback((item: TData | TFormFields) => {\n let name: string;\n try {\n name = getName(item);\n } catch {\n name = undefined;\n }\n return name;\n }, [getName]);\n\n const getEditProgressNotificationMessage = useCallback((data: TData) => {\n const name = tryToGetName(data);\n return name ? t('{{itemName}} \"{{name}}\" is being saved...', { itemName, name }) : t('{{itemName}} is being saved...', { itemName });\n }, [t, tryToGetName, itemName]);\n\n const getCreateProgressNotificationMessage = useCallback((data: TFormFields) => {\n const name = tryToGetName(data);\n return name ? t('{{itemName}} \"{{name}}\" is being saved...', { itemName, name }) : t('{{itemName}} is being saved...', { itemName });\n }, [t, tryToGetName, itemName]);\n\n const getDeleteProgressNotificationMessage = useCallback((data: TData) => {\n const name = tryToGetName(data);\n return name ? t('{{itemName}} \"{{name}}\" is being deleted...', { itemName, name }) : t('{{itemName}} is being deleted...', { itemName });\n }, [t, tryToGetName, itemName]);\n\n const getEditSuccessNotificationMessage = useCallback((data: TData) => {\n const name = tryToGetName(data);\n return name ? t('{{itemName}} \"{{name}}\" has been saved.', { itemName, name }) : t('{{itemName}} has been saved.', { itemName });\n }, [t, tryToGetName, itemName]);\n\n const getCreateSuccessNotificationMessage = useCallback((data: TData) => {\n const name = tryToGetName(data);\n return name ? t('{{itemName}} \"{{name}}\" has been created.', { itemName, name }) : t('{{itemName}} has been created.', { itemName });\n }, [t, tryToGetName, itemName]);\n\n const getDeleteSuccessNotificationMessage = useCallback((data: TData) => {\n const name = tryToGetName(data);\n return name ? t('{{itemName}} \"{{name}}\" has been deleted.', { itemName, name }) : t('{{itemName}} has been deleted.', { itemName });\n }, [t, tryToGetName, itemName]);\n\n const getEditErrorNotificationMessage = useCallback((data: TData) => {\n const name = tryToGetName(data);\n return name ? t('{{itemName}} \"{{name}}\" could not be saved.', { itemName, name }) : t('{{itemName}} could not be saved.', { itemName });\n }, [t, tryToGetName, itemName]);\n\n const getCreateErrorNotificationMessage = useCallback((data: TFormFields) => {\n const name = tryToGetName(data);\n return name ? t('{{itemName}} \"{{name}}\" could not be created.', { itemName, name }) : t('{{itemName}} could not be created.', { itemName });\n }, [t, tryToGetName, itemName]);\n\n const getDeleteErrorNotificationMessage = useCallback((data: TData) => {\n const name = tryToGetName(data);\n return name ? t('{{itemName}} \"{{name}}\" could not be deleted.', { itemName, name }) : t('{{itemName}} could not be deleted.', { itemName });\n }, [t, tryToGetName, itemName]);\n\n const calculatedAssociationQueryKeys = useMemo<string[][]>(() => {\n const keys = associationQueryKeys ?? [];\n\n container.resolve(QueryClientService).getQueryKeyDependencies([resourceQueryKeyBase]).forEach(key => {\n keys.push(key);\n });\n return keys;\n }, [associationQueryKeys, resourceQueryKeyBase]);\n\n const { mutate: mutateEdit, setPreviousItem: mutateEditSetPreviousItem } = useEditMutation<TData, TFormFields>({\n associationQueryKeys: calculatedAssociationQueryKeys,\n getErrorNotificationMessage: getEditErrorNotificationMessage,\n getIntermediateItem: getOptimisticUpdateIntermediateItem,\n getProgressNotificationMessage: getEditProgressNotificationMessage,\n getSuccessNotificationMessage: getEditSuccessNotificationMessage,\n onError: onEditError,\n onSuccess: onEditSuccess,\n queryFn: updateOne,\n resourceQueryKey,\n });\n\n const { isMutating: isCreating, mutate: mutateCreate } = useCreateMutation<TData, TFormFields>({\n associationQueryKeys: calculatedAssociationQueryKeys,\n getErrorNotificationMessage: getCreateErrorNotificationMessage,\n getProgressNotificationMessage: getCreateProgressNotificationMessage,\n getSuccessNotificationMessage: getCreateSuccessNotificationMessage,\n onError: onCreateError,\n onSuccess: onCreateSuccess,\n queryFn: createOne,\n resourceQueryKey,\n });\n\n const { mutate: mutateDelete } = useDeleteMutation<TData>({\n associationQueryKeys: calculatedAssociationQueryKeys,\n getErrorNotificationMessage: getDeleteErrorNotificationMessage,\n getProgressNotificationMessage: getDeleteProgressNotificationMessage,\n getSuccessNotificationMessage: getDeleteSuccessNotificationMessage,\n onError: onDeleteError,\n onSuccess: onDeleteSuccess,\n queryFn: deleteOne,\n resourceQueryKey,\n });\n\n const onEditDialogSave = useCallback((formValues: TFormFields, item: TData) => {\n if (item?.id) {\n mutateEditSetPreviousItem(item);\n mutateEdit(formValues);\n } else {\n mutateCreate(formValues);\n }\n }, [mutateCreate, mutateEdit, mutateEditSetPreviousItem]);\n\n const onEditIconClick = useCallback((params: TableRowParams<TTableData, null>) => {\n editItem(params.row);\n }, [editItem]);\n\n const onRowClick = useCallback((params: TableRowParams<TTableData, null>) => {\n if (customOnRowClick) {\n customOnRowClick(params);\n } else if (onShowItem) {\n onShowItem(params);\n } else {\n editItem(params.row);\n }\n }, [customOnRowClick, onShowItem, editItem]);\n\n const onDeleteConfirmationConfirm = useCallback((item: TData) => {\n mutateDelete(item);\n }, [mutateDelete]);\n\n const normalizedExtraActions = useCallback((params: TableRowParams<TTableData, null>) => {\n const actions: ReactElement[] = [];\n\n const extraActions = extraActionsFactory ? extraActionsFactory(params) : [];\n if (extraActions?.length > 0) {\n actions.push(...extraActions);\n }\n subPages?.forEach(subPage => {\n actions.push((\n <MenuItem\n key={subPage.label}\n // eslint-disable-next-line @eslint-react/kit/jsx-no-bind\n onClick={async () => await container.resolve(RouterService).router.navigate({\n pathname: subPage.getPathName(params.row),\n })}\n >\n <ListItemIcon>\n {subPage.icon ? subPage.icon : <ArrowCircleRightIcon />}\n </ListItemIcon>\n <ListItemText>\n {subPage.label}\n </ListItemText>\n </MenuItem>\n ));\n });\n\n if (userCanCreate) {\n actions.push((\n <MenuItem\n key={'clone'}\n // eslint-disable-next-line @eslint-react/kit/jsx-no-bind\n onClick={() => editDialogRef.current.open({\n canSave: true,\n item: { ...params.row, id: null },\n })}\n >\n <ListItemIcon>\n <ContentCopyIcon />\n </ListItemIcon>\n <ListItemText>\n {t`Clone`}\n </ListItemText>\n </MenuItem>\n ));\n }\n\n return actions;\n }, [extraActionsFactory, subPages, userCanCreate, t]);\n\n const columns = useMemo<TableColumn<TTableData, null>[]>(() => {\n const internalColumns: TableColumn<TTableData, null>[] = [\n TableUtil.createReadableIndexColumn(),\n ];\n\n if (showIdColumn) {\n internalColumns.push({\n headerName: t`Id`,\n id: 'id',\n isInitiallyVisible: true,\n type: 'text',\n widthPx: 300,\n });\n }\n internalColumns.push(...tableColumns);\n\n internalColumns.push(\n TableUtil.createActionsColumn({\n getActions: (params) => {\n const actions: ReactElement[] = [];\n if (onShowItem) {\n actions.push(\n <MenuItem\n key={'actions1'}\n // eslint-disable-next-line @eslint-react/kit/jsx-no-bind\n onClick={() => onShowItem(params)}\n >\n <ListItemIcon>\n <ArrowCircleRightIcon />\n </ListItemIcon>\n <ListItemText>\n {t`Show`}\n </ListItemText>\n </MenuItem>,\n );\n }\n actions.push(\n <MenuItem\n key={'actions2'}\n // eslint-disable-next-line @eslint-react/kit/jsx-no-bind\n onClick={() => onEditIconClick(params)}\n >\n <ListItemIcon>\n <EditIcon />\n </ListItemIcon>\n <ListItemText>\n {t`Edit`}\n </ListItemText>\n </MenuItem>,\n );\n if (userCanDelete) {\n actions.push(\n <MenuItem\n key={'actions3'}\n // eslint-disable-next-line @eslint-react/kit/jsx-no-bind\n onClick={() => deleteConfirmationRef.current.open({\n item: params.row,\n })}\n >\n <ListItemIcon>\n <DeleteForeverIcon />\n </ListItemIcon>\n <ListItemText>\n {t`Delete`}\n </ListItemText>\n </MenuItem>,\n );\n }\n const extraActions = normalizedExtraActions(params) ?? [];\n if (extraActions?.length > 0 && actions.length > 0) {\n actions.push(...extraActions);\n }\n return actions;\n },\n t,\n }),\n );\n return internalColumns;\n }, [normalizedExtraActions, onEditIconClick, onShowItem, showIdColumn, t, tableColumns, userCanDelete]);\n\n const tableRows = useMemo(() => {\n if (!convertToTableData) {\n return rows as TTableData[];\n }\n return convertToTableData(rows);\n }, [convertToTableData, rows]);\n\n useInitializeTableStore<TTableData, null>({ columns, context: null, createFiltersFromColumns: true, rows: tableRows, store: tableStore });\n\n const onCreateItemButtonClick = useCallback(() => {\n editDialogRef.current.open({\n canSave: true,\n });\n }, []);\n\n const customContentActions = useMemo(() => {\n if (!contentActions && !userCanCreate) {\n return (\n <TableHeader />\n );\n }\n return (\n <Box\n sx={{\n alignItems: 'center',\n display: 'flex',\n gap: theme.spacing(1),\n }}\n >\n <TableHeader />\n {userCanCreate && (\n <Button\n color={'secondary'}\n disabled={isLoading || isCreating}\n loading={isLoading || isCreating}\n onClick={onCreateItemButtonClick}\n size={'small'}\n variant={'contained'}\n >\n {createItemButtonText ?? t`Create item`}\n </Button>\n )}\n {contentActions}\n </Box>\n );\n }, [contentActions, userCanCreate, isLoading, isCreating, onCreateItemButtonClick, createItemButtonText, t, theme]);\n\n const normalizedTitle = useMemo<string>(() => {\n if (isArray(title)) {\n return title.join(' -> ');\n }\n return title;\n }, [title]);\n\n\n return (\n <TableStoreContextProvider store={tableStore}>\n <PageContainer\n contentActions={customContentActions}\n contentHeader={(\n <TableCaption\n caption={contentHeader ?? normalizedTitle}\n component={'h2'}\n variant={'h2'}\n />\n )}\n fullWidth\n showBreadcrumbs\n testIdAttributes={testIdAttributes}\n title={normalizedTitle}\n >\n <Box\n sx={{\n height: '100%',\n position: 'relative',\n }}\n >\n <ResponseHandler\n error={error}\n isLoading={isLoading}\n >\n <TableSidebarMenu />\n <Box\n sx={{\n height: '100%',\n paddingLeft: theme.spacing(config.layout.SIDEBAR_MENU_WIDTH + 1),\n width: '100%',\n }}\n >\n <Table\n getRowName={getName}\n onRowClick={onRowClick}\n />\n </Box>\n </ResponseHandler>\n </Box>\n <CrudPageEditDialog\n createItemDialogTitle={createItemDialogTitle}\n defaultNewItem={defaultNewItem}\n formFieldDefinitions={formFieldDefinitions}\n getFormValuesFromItem={getFormValuesFromItem}\n getName={getName}\n onChange={onFormChange}\n onSave={onEditDialogSave}\n ref={editDialogRef}\n schema={schema}\n />\n <CrudPageDeleteDialog\n getName={getName}\n onConfirm={onDeleteConfirmationConfirm}\n ref={deleteConfirmationRef}\n />\n </PageContainer>\n </TableStoreContextProvider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAqDaqB,KAAqBC,GAChC,EACE,0BACA,mBACA,yBACA,0BACA,YACA,oBACA,aACA,YACA,WACA,kBACA,cACA,iBAEe;CACjB,IAAM,EAAE,SAAMC,GAAe,GACvBC,IAASC,EAAM,GAEfC,KAA8BC,QAC3B,OAAOC,KAAyB,aAAaA,EAAqBC,EAAU,IAAI,IAAID,GAC1F,CAACA,GAAsBC,EAAU,IAAI,CAAC,GAEnC,CAACC,GAA8BC,MAAmCC,EAA6CN,EAA2B;CAEhJ,QAAgB;EACd,IAAMO,IAA0B,CAAC;EAejC,AAdIJ,EAAU,uBACZI,EAAQ,KAAK,GAAGJ,EAAU,oBAAoBA,EAAU,IAAI,CAAC,GAE/DI,EAAQ,KAAK;GACX,GAAGC,EAAW,iBAAiB,+BAA+B;GAC9D,WAAW;GACX,OAAO;GACP,UAAU,CAACL,EAAU,WAAWC,EAA6B,MAAK,MAAOK,EAAI,OA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E,IAAI;QACF,QAAQ;QACR,aAAaE,GAAM,QAAQE,GAAO,OAAO,qBAAqB,CAAC;QAC/D,OAAO;OACT;OAEA,UAAA,kBAAClE,IAAD;QACE,YAAYwC;QACA;OACb,CAAA;MACE,CAAA,CACU;;IACd,CAAA;IACL,kBAACtB,IAAD;KACyB;KACP;KACM;KACC;KACd;KACT,UAAUgK;KACV,QAAQ9B;KACR,KAAK9E;KACG;IACT,CAAA;IACD,kBAACX,IAAD;KACW;KACT,WAAW+F;KACX,KAAKtF;IACN,CAAA;GACY;;CACU,CAAA;AAE/B"}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { TimeUtil as e } from "../utils/TimeUtil/index.js";
|
|
2
2
|
import { NotificationService as t } from "../classes/services/NotificationService/index.js";
|
|
3
3
|
import { container as n } from "tsyringe";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { Alert as r, AlertTitle as i, Box as a, Button as o, CircularProgress as s, Divider as c, Drawer as l, IconButton as u, Snackbar as d, Typography as f, useTheme as p } from "@mui/material";
|
|
5
|
+
import { useCallback as m, useMemo as h } from "react";
|
|
6
|
+
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
7
7
|
import { useTranslation as y } from "react-i18next";
|
|
8
8
|
import { TestIdUtil as b } from "@gen-epix/ui-core/utils/TestIdUtil";
|
|
9
9
|
import { useSubscribable as x } from "@gen-epix/ui-core/hooks/useSubscribable";
|
|
10
10
|
import S from "@mui/icons-material/Close";
|
|
11
11
|
import C from "@mui/icons-material/Notifications";
|
|
12
12
|
//#region src/components/ui/Notifications/NotificationItem.tsx
|
|
13
|
-
var w = ({ allowClose: t, notification: n, onClose:
|
|
14
|
-
let { t:
|
|
15
|
-
|
|
16
|
-
}, [n.key,
|
|
17
|
-
return /* @__PURE__ */
|
|
13
|
+
var w = ({ allowClose: t, notification: n, onClose: o, showTimestamp: c }) => {
|
|
14
|
+
let { t: l } = y(), u = m(() => {
|
|
15
|
+
o(n.key);
|
|
16
|
+
}, [n.key, o]), d = h(() => (/* @__PURE__ */ new Date()).getTime(), []);
|
|
17
|
+
return /* @__PURE__ */ v(r, {
|
|
18
18
|
...b.createAttributes("NotificationItem", { key: n.key }),
|
|
19
|
-
closeText:
|
|
20
|
-
icon: n.isLoading ? /* @__PURE__ */
|
|
21
|
-
onClose: t ?
|
|
19
|
+
closeText: l`Clear notification`,
|
|
20
|
+
icon: n.isLoading ? /* @__PURE__ */ _(s, { size: 16 }) : void 0,
|
|
21
|
+
onClose: t ? u : void 0,
|
|
22
22
|
severity: n.isLoading ? "info" : n.severity,
|
|
23
23
|
slotProps: { message: { sx: { flexGrow: 1 } } },
|
|
24
24
|
sx: {
|
|
@@ -26,101 +26,101 @@ var w = ({ allowClose: t, notification: n, onClose: a, showTimestamp: d }) => {
|
|
|
26
26
|
boxShadow: 1,
|
|
27
27
|
marginBottom: 1
|
|
28
28
|
},
|
|
29
|
-
children: [/* @__PURE__ */
|
|
29
|
+
children: [/* @__PURE__ */ _(i, {
|
|
30
30
|
sx: { width: "100%" },
|
|
31
31
|
children: n.message
|
|
32
|
-
}),
|
|
32
|
+
}), c && /* @__PURE__ */ v(a, {
|
|
33
33
|
sx: { textAlign: "right" },
|
|
34
34
|
children: [
|
|
35
|
-
e.getReadableTimeRemaining(
|
|
35
|
+
e.getReadableTimeRemaining(d - n.timestamp, !0),
|
|
36
36
|
" ",
|
|
37
|
-
|
|
37
|
+
l("ago")
|
|
38
38
|
]
|
|
39
39
|
})]
|
|
40
40
|
});
|
|
41
|
-
}, T = ({ onDrawerClose: e, open:
|
|
42
|
-
let { t:
|
|
41
|
+
}, T = ({ onDrawerClose: e, open: r }) => {
|
|
42
|
+
let { t: i } = y(), s = p(), d = x(n.resolve(t)), h = m((e) => {
|
|
43
43
|
n.resolve(t).clearNotification(e);
|
|
44
|
-
}, []), g =
|
|
44
|
+
}, []), g = m(() => {
|
|
45
45
|
n.resolve(t).clearNotifications(), e();
|
|
46
46
|
}, [e]);
|
|
47
|
-
return /* @__PURE__ */
|
|
47
|
+
return /* @__PURE__ */ _(l, {
|
|
48
48
|
anchor: "right",
|
|
49
49
|
onClose: e,
|
|
50
|
-
open:
|
|
51
|
-
children: /* @__PURE__ */
|
|
50
|
+
open: r,
|
|
51
|
+
children: /* @__PURE__ */ v(a, {
|
|
52
52
|
sx: {
|
|
53
|
-
padding:
|
|
54
|
-
[
|
|
53
|
+
padding: s.spacing(2),
|
|
54
|
+
[s.breakpoints.up("xl")]: { width: "620px" },
|
|
55
55
|
width: "520px"
|
|
56
56
|
},
|
|
57
57
|
children: [
|
|
58
|
-
/* @__PURE__ */
|
|
58
|
+
/* @__PURE__ */ v(a, {
|
|
59
59
|
sx: {
|
|
60
60
|
alignItems: "center",
|
|
61
61
|
display: "flex",
|
|
62
62
|
justifyContent: "space-between",
|
|
63
63
|
marginBottom: 2
|
|
64
64
|
},
|
|
65
|
-
children: [/* @__PURE__ */
|
|
65
|
+
children: [/* @__PURE__ */ _(f, {
|
|
66
66
|
component: "h6",
|
|
67
67
|
variant: "h3",
|
|
68
|
-
children:
|
|
69
|
-
}), /* @__PURE__ */
|
|
70
|
-
"aria-label":
|
|
68
|
+
children: i`Notifications`
|
|
69
|
+
}), /* @__PURE__ */ _(u, {
|
|
70
|
+
"aria-label": i`Close notifications drawer`,
|
|
71
71
|
onClick: e,
|
|
72
|
-
children: /* @__PURE__ */
|
|
73
|
-
"&:hover": { color:
|
|
74
|
-
color:
|
|
72
|
+
children: /* @__PURE__ */ _(S, { sx: {
|
|
73
|
+
"&:hover": { color: s.palette.text.primary },
|
|
74
|
+
color: s.palette.text.secondary
|
|
75
75
|
} })
|
|
76
76
|
})]
|
|
77
77
|
}),
|
|
78
|
-
|
|
78
|
+
d.length === 0 && /* @__PURE__ */ v(a, { children: [/* @__PURE__ */ _(a, {
|
|
79
79
|
sx: {
|
|
80
80
|
display: "flex",
|
|
81
81
|
justifyContent: "center",
|
|
82
82
|
marginBottom: 2
|
|
83
83
|
},
|
|
84
|
-
children: /* @__PURE__ */
|
|
85
|
-
color:
|
|
84
|
+
children: /* @__PURE__ */ _(C, { sx: {
|
|
85
|
+
color: s.palette.text.disabled,
|
|
86
86
|
fontSize: 100
|
|
87
87
|
} })
|
|
88
|
-
}), /* @__PURE__ */
|
|
88
|
+
}), /* @__PURE__ */ _(a, {
|
|
89
89
|
sx: {
|
|
90
90
|
display: "flex",
|
|
91
91
|
justifyContent: "center"
|
|
92
92
|
},
|
|
93
|
-
children: /* @__PURE__ */
|
|
93
|
+
children: /* @__PURE__ */ _(f, { children: i`No new notifications in this session` })
|
|
94
94
|
})] }),
|
|
95
|
-
|
|
96
|
-
/* @__PURE__ */
|
|
95
|
+
d.length > 0 && /* @__PURE__ */ v(a, { children: [
|
|
96
|
+
/* @__PURE__ */ _(a, {
|
|
97
97
|
sx: {
|
|
98
98
|
display: "flex",
|
|
99
99
|
justifyContent: "flex-end"
|
|
100
100
|
},
|
|
101
|
-
children: /* @__PURE__ */ o
|
|
102
|
-
"aria-label":
|
|
101
|
+
children: /* @__PURE__ */ _(o, {
|
|
102
|
+
"aria-label": i`Clear all notifications`,
|
|
103
103
|
color: "primary",
|
|
104
104
|
onClick: g,
|
|
105
105
|
variant: "outlined",
|
|
106
|
-
children:
|
|
106
|
+
children: i`Clear all notifications`
|
|
107
107
|
})
|
|
108
108
|
}),
|
|
109
|
-
/* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ _(a, {
|
|
110
110
|
sx: { marginY: 2 },
|
|
111
|
-
children: /* @__PURE__ */
|
|
111
|
+
children: /* @__PURE__ */ _(c, {})
|
|
112
112
|
}),
|
|
113
|
-
/* @__PURE__ */
|
|
113
|
+
/* @__PURE__ */ _(a, {
|
|
114
114
|
sx: { overflowY: "hidden" },
|
|
115
|
-
children: /* @__PURE__ */
|
|
115
|
+
children: /* @__PURE__ */ _(a, {
|
|
116
116
|
sx: {
|
|
117
117
|
maxHeight: "100%",
|
|
118
118
|
overflowY: "auto"
|
|
119
119
|
},
|
|
120
|
-
children:
|
|
120
|
+
children: d.map((e) => /* @__PURE__ */ _(w, {
|
|
121
121
|
allowClose: !e.isLoading,
|
|
122
122
|
notification: e,
|
|
123
|
-
onClose:
|
|
123
|
+
onClose: h,
|
|
124
124
|
showTimestamp: !0
|
|
125
125
|
}, e.key))
|
|
126
126
|
})
|
|
@@ -130,20 +130,20 @@ var w = ({ allowClose: t, notification: n, onClose: a, showTimestamp: d }) => {
|
|
|
130
130
|
})
|
|
131
131
|
});
|
|
132
132
|
}, E = () => {
|
|
133
|
-
let e = x(n.resolve(t), { select: (e) => e.filter((e) => e.visible) }),
|
|
133
|
+
let e = x(n.resolve(t), { select: (e) => e.filter((e) => e.visible) }), r = m((e) => {
|
|
134
134
|
n.resolve(t).hideNotification(e);
|
|
135
135
|
}, []);
|
|
136
|
-
return /* @__PURE__ */
|
|
136
|
+
return /* @__PURE__ */ _(g, { children: e.length > 0 && /* @__PURE__ */ _(d, {
|
|
137
137
|
...b.createAttributes("NotificationsStack"),
|
|
138
138
|
anchorOrigin: {
|
|
139
139
|
horizontal: "right",
|
|
140
140
|
vertical: "top"
|
|
141
141
|
},
|
|
142
142
|
open: !0,
|
|
143
|
-
children: /* @__PURE__ */
|
|
143
|
+
children: /* @__PURE__ */ _(a, { children: e.map((e) => /* @__PURE__ */ _(w, {
|
|
144
144
|
allowClose: !0,
|
|
145
145
|
notification: e,
|
|
146
|
-
onClose:
|
|
146
|
+
onClose: r
|
|
147
147
|
}, e.key)) })
|
|
148
148
|
}) });
|
|
149
149
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { t as e } from "./format.js";
|
|
2
2
|
import { DATE_FORMAT as t } from "@gen-epix/ui-core/constants/date.constants";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { Alert as n, AlertTitle as r, Box as i, Typography as a } from "@mui/material";
|
|
4
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
5
5
|
import { useTranslation as c } from "react-i18next";
|
|
6
6
|
//#region src/components/ui/OutageList/OutageItem.tsx
|
|
7
7
|
var l = ({ outage: l, severity: u, title: d }) => {
|
|
8
8
|
let { t: f } = c();
|
|
9
|
-
return /* @__PURE__ */
|
|
9
|
+
return /* @__PURE__ */ s(n, {
|
|
10
10
|
severity: u,
|
|
11
11
|
children: [
|
|
12
|
-
/* @__PURE__ */
|
|
13
|
-
/* @__PURE__ */
|
|
14
|
-
/* @__PURE__ */
|
|
12
|
+
/* @__PURE__ */ o(r, { children: d }),
|
|
13
|
+
/* @__PURE__ */ o(i, { children: l.description }),
|
|
14
|
+
/* @__PURE__ */ o(i, { children: /* @__PURE__ */ s(a, {
|
|
15
15
|
component: "p",
|
|
16
16
|
children: [
|
|
17
17
|
f`Expected start: `,
|
|
@@ -19,7 +19,7 @@ var l = ({ outage: l, severity: u, title: d }) => {
|
|
|
19
19
|
l.active_from ? e(new Date(l.active_from), t.DATE_TIME) : f`Unknown`
|
|
20
20
|
]
|
|
21
21
|
}) }),
|
|
22
|
-
/* @__PURE__ */
|
|
22
|
+
/* @__PURE__ */ o(i, { children: /* @__PURE__ */ s(a, {
|
|
23
23
|
component: "p",
|
|
24
24
|
children: [
|
|
25
25
|
f`Expected end: `,
|
|
@@ -29,46 +29,46 @@ var l = ({ outage: l, severity: u, title: d }) => {
|
|
|
29
29
|
}) })
|
|
30
30
|
]
|
|
31
31
|
});
|
|
32
|
-
}, u = ({ itemTitle: e, outages: t, severity:
|
|
32
|
+
}, u = ({ itemTitle: e, outages: t, severity: n, title: r }) => /* @__PURE__ */ s(i, {
|
|
33
33
|
sx: { marginBottom: 2 },
|
|
34
|
-
children: [/* @__PURE__ */
|
|
34
|
+
children: [/* @__PURE__ */ o(i, {
|
|
35
35
|
sx: { marginBottom: 1 },
|
|
36
|
-
children: /* @__PURE__ */
|
|
36
|
+
children: /* @__PURE__ */ o(a, {
|
|
37
37
|
component: "p",
|
|
38
|
-
children:
|
|
38
|
+
children: r
|
|
39
39
|
})
|
|
40
|
-
}), t.map((t) => /* @__PURE__ */
|
|
40
|
+
}), t.map((t) => /* @__PURE__ */ o(i, {
|
|
41
41
|
sx: { marginBottom: 1 },
|
|
42
|
-
children: /* @__PURE__ */
|
|
42
|
+
children: /* @__PURE__ */ o(l, {
|
|
43
43
|
outage: t,
|
|
44
|
-
severity:
|
|
44
|
+
severity: n,
|
|
45
45
|
title: e
|
|
46
46
|
})
|
|
47
47
|
}, t.id))]
|
|
48
|
-
}), d = ({ activeOutages: e, soonActiveOutages: t, visibleOutages:
|
|
49
|
-
let { t:
|
|
50
|
-
return /* @__PURE__ */
|
|
51
|
-
|
|
48
|
+
}), d = ({ activeOutages: e, soonActiveOutages: t, visibleOutages: n }) => {
|
|
49
|
+
let { t: r } = c();
|
|
50
|
+
return /* @__PURE__ */ s(i, { children: [
|
|
51
|
+
n.length === 0 && e.length === 0 && t.length === 0 && /* @__PURE__ */ o(i, { children: /* @__PURE__ */ o(a, {
|
|
52
52
|
component: "p",
|
|
53
|
-
children:
|
|
53
|
+
children: r`There no current or scheduled outages.`
|
|
54
54
|
}) }),
|
|
55
|
-
e.length > 0 && /* @__PURE__ */
|
|
56
|
-
itemTitle:
|
|
55
|
+
e.length > 0 && /* @__PURE__ */ o(u, {
|
|
56
|
+
itemTitle: r`Active outage`,
|
|
57
57
|
outages: e,
|
|
58
58
|
severity: "error",
|
|
59
|
-
title:
|
|
59
|
+
title: r`Our platform is experiencing an active outing.`
|
|
60
60
|
}),
|
|
61
|
-
t.length > 0 && /* @__PURE__ */
|
|
62
|
-
itemTitle:
|
|
61
|
+
t.length > 0 && /* @__PURE__ */ o(u, {
|
|
62
|
+
itemTitle: r`Upcoming outage`,
|
|
63
63
|
outages: t,
|
|
64
64
|
severity: "warning",
|
|
65
|
-
title:
|
|
65
|
+
title: r`Our platform will soon go down for a planned outage.`
|
|
66
66
|
}),
|
|
67
|
-
|
|
68
|
-
itemTitle:
|
|
69
|
-
outages:
|
|
67
|
+
n.length > 0 && /* @__PURE__ */ o(u, {
|
|
68
|
+
itemTitle: r`Planned outage`,
|
|
69
|
+
outages: n,
|
|
70
70
|
severity: "info",
|
|
71
|
-
title:
|
|
71
|
+
title: r`There are scheduled outages. Our platform will be disrupted during these times.`
|
|
72
72
|
})
|
|
73
73
|
] });
|
|
74
74
|
};
|
|
@@ -31,10 +31,9 @@ var o = class {
|
|
|
31
31
|
activeOutages: t,
|
|
32
32
|
soonActiveOutages: e.filter((e) => {
|
|
33
33
|
if (n.includes(e.id)) return !1;
|
|
34
|
-
if (e.is_active) return !0;
|
|
35
34
|
if (e.active_from || e.active_to) {
|
|
36
35
|
let t = /* @__PURE__ */ new Date(), n = a(t, r.resolveConfig().outages.NUM_HOURS_TO_SHOW_SOON_ACTIVE_OUTAGES);
|
|
37
|
-
return e.active_from && e.active_to ? n >= new Date(e.active_from) && t < new Date(e.active_to) : !!(e.active_from && n >= new Date(e.active_from)
|
|
36
|
+
return e.active_from && e.active_to ? n >= new Date(e.active_from) && t < new Date(e.active_to) : !!(e.active_from && n >= new Date(e.active_from));
|
|
38
37
|
}
|
|
39
38
|
}),
|
|
40
39
|
visibleOutages: i
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OutageUtil.js","names":["millisecondsInHour","constructFrom","toDate","addMilliseconds","options","date","amount","addHours","OutageUtil","activeOutages","outages","outage","now","activeOutageIds","visibleOutages","soon","DependencyContainerUtil"],"sources":["../../../../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/addMilliseconds.js","../../../../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/addHours.js","../../src/utils/OutageUtil/OutageUtil.ts"],"sourcesContent":["import { constructFrom } from \"./constructFrom.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link addMilliseconds} function options.\n */\n\n/**\n * @name addMilliseconds\n * @category Millisecond Helpers\n * @summary Add the specified number of milliseconds to the given date.\n *\n * @description\n * Add the specified number of milliseconds to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param amount - The amount of milliseconds to be added.\n * @param options - The options object\n *\n * @returns The new date with the milliseconds added\n *\n * @example\n * // Add 750 milliseconds to 10 July 2014 12:45:30.000:\n * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)\n * //=> Thu Jul 10 2014 12:45:30.750\n */\nexport function addMilliseconds(date, amount, options) {\n return constructFrom(options?.in || date, +toDate(date) + amount);\n}\n\n// Fallback for modularized imports:\nexport default addMilliseconds;\n","import { addMilliseconds } from \"./addMilliseconds.js\";\nimport { millisecondsInHour } from \"./constants.js\";\n\n/**\n * The {@link addHours} function options.\n */\n\n/**\n * @name addHours\n * @category Hour Helpers\n * @summary Add the specified number of hours to the given date.\n *\n * @description\n * Add the specified number of hours to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param amount - The amount of hours to be added\n * @param options - An object with options\n *\n * @returns The new date with the hours added\n *\n * @example\n * // Add 2 hours to 10 July 2014 23:00:00:\n * const result = addHours(new Date(2014, 6, 10, 23, 0), 2)\n * //=> Fri Jul 11 2014 01:00:00\n */\nexport function addHours(date, amount, options) {\n return addMilliseconds(date, amount * millisecondsInHour, options);\n}\n\n// Fallback for modularized imports:\nexport default addHours;\n","import { addHours } from 'date-fns';\nimport type { CommonDbOutage } from '@gen-epix/api-commondb';\n\nimport { DependencyContainerUtil } from '../DependencyContainerUtil';\nimport type { CategorizedOutages } from '../../models/outage.models';\n\nexport class OutageUtil {\n public static getCategorizedOutages(outages: CommonDbOutage[]): CategorizedOutages {\n\n const activeOutages = outages.filter((outage) => {\n if (outage.is_active) {\n return true;\n }\n if (outage.active_from || outage.active_to) {\n const now = new Date();\n if (outage.active_from && outage.active_to) {\n return now >= new Date(outage.active_from) && now < new Date(outage.active_to);\n }\n if (outage.active_from && now >= new Date(outage.active_from)) {\n return true;\n }\n if (outage.active_to && now < new Date(outage.active_to)) {\n return true;\n }\n return false;\n }\n });\n const activeOutageIds = activeOutages.map((outage) => outage.id);\n\n const visibleOutages = outages.filter((outage) => {\n if (activeOutageIds.includes(outage.id)) {\n return false;\n }\n if (outage.is_visible) {\n return true;\n }\n if (outage.visible_from || outage.visible_to) {\n const now = new Date();\n if (outage.visible_from && outage.visible_to) {\n return now >= new Date(outage.visible_from) && now < new Date(outage.visible_to);\n }\n if (outage.visible_from && now >= new Date(outage.visible_from)) {\n return true;\n }\n if (outage.visible_to && now < new Date(outage.visible_to)) {\n return true;\n }\n return false;\n }\n });\n\n const soonActiveOutages = outages.filter((outage) => {\n if (activeOutageIds.includes(outage.id)) {\n return false;\n }\n if (outage.
|
|
1
|
+
{"version":3,"file":"OutageUtil.js","names":["millisecondsInHour","constructFrom","toDate","addMilliseconds","options","date","amount","addHours","OutageUtil","activeOutages","outages","outage","now","activeOutageIds","visibleOutages","soon","DependencyContainerUtil"],"sources":["../../../../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/addMilliseconds.js","../../../../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/addHours.js","../../src/utils/OutageUtil/OutageUtil.ts"],"sourcesContent":["import { constructFrom } from \"./constructFrom.js\";\nimport { toDate } from \"./toDate.js\";\n\n/**\n * The {@link addMilliseconds} function options.\n */\n\n/**\n * @name addMilliseconds\n * @category Millisecond Helpers\n * @summary Add the specified number of milliseconds to the given date.\n *\n * @description\n * Add the specified number of milliseconds to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param amount - The amount of milliseconds to be added.\n * @param options - The options object\n *\n * @returns The new date with the milliseconds added\n *\n * @example\n * // Add 750 milliseconds to 10 July 2014 12:45:30.000:\n * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)\n * //=> Thu Jul 10 2014 12:45:30.750\n */\nexport function addMilliseconds(date, amount, options) {\n return constructFrom(options?.in || date, +toDate(date) + amount);\n}\n\n// Fallback for modularized imports:\nexport default addMilliseconds;\n","import { addMilliseconds } from \"./addMilliseconds.js\";\nimport { millisecondsInHour } from \"./constants.js\";\n\n/**\n * The {@link addHours} function options.\n */\n\n/**\n * @name addHours\n * @category Hour Helpers\n * @summary Add the specified number of hours to the given date.\n *\n * @description\n * Add the specified number of hours to the given date.\n *\n * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).\n * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.\n *\n * @param date - The date to be changed\n * @param amount - The amount of hours to be added\n * @param options - An object with options\n *\n * @returns The new date with the hours added\n *\n * @example\n * // Add 2 hours to 10 July 2014 23:00:00:\n * const result = addHours(new Date(2014, 6, 10, 23, 0), 2)\n * //=> Fri Jul 11 2014 01:00:00\n */\nexport function addHours(date, amount, options) {\n return addMilliseconds(date, amount * millisecondsInHour, options);\n}\n\n// Fallback for modularized imports:\nexport default addHours;\n","import { addHours } from 'date-fns';\nimport type { CommonDbOutage } from '@gen-epix/api-commondb';\n\nimport { DependencyContainerUtil } from '../DependencyContainerUtil';\nimport type { CategorizedOutages } from '../../models/outage.models';\n\nexport class OutageUtil {\n public static getCategorizedOutages(outages: CommonDbOutage[]): CategorizedOutages {\n\n const activeOutages = outages.filter((outage) => {\n if (outage.is_active) {\n return true;\n }\n if (outage.active_from || outage.active_to) {\n const now = new Date();\n if (outage.active_from && outage.active_to) {\n return now >= new Date(outage.active_from) && now < new Date(outage.active_to);\n }\n if (outage.active_from && now >= new Date(outage.active_from)) {\n return true;\n }\n if (outage.active_to && now < new Date(outage.active_to)) {\n return true;\n }\n return false;\n }\n });\n const activeOutageIds = activeOutages.map((outage) => outage.id);\n\n const visibleOutages = outages.filter((outage) => {\n if (activeOutageIds.includes(outage.id)) {\n return false;\n }\n if (outage.is_visible) {\n return true;\n }\n if (outage.visible_from || outage.visible_to) {\n const now = new Date();\n if (outage.visible_from && outage.visible_to) {\n return now >= new Date(outage.visible_from) && now < new Date(outage.visible_to);\n }\n if (outage.visible_from && now >= new Date(outage.visible_from)) {\n return true;\n }\n if (outage.visible_to && now < new Date(outage.visible_to)) {\n return true;\n }\n return false;\n }\n });\n\n const soonActiveOutages = outages.filter((outage) => {\n if (activeOutageIds.includes(outage.id)) {\n return false;\n }\n if (outage.active_from || outage.active_to) {\n const now = new Date();\n const soon = addHours(now, DependencyContainerUtil.resolveConfig().outages.NUM_HOURS_TO_SHOW_SOON_ACTIVE_OUTAGES);\n if (outage.active_from && outage.active_to) {\n return soon >= new Date(outage.active_from) && now < new Date(outage.active_to);\n }\n if (outage.active_from && soon >= new Date(outage.active_from)) {\n return true;\n }\n return false;\n }\n });\n\n return {\n activeOutages,\n soonActiveOutages,\n visibleOutages,\n };\n }\n}\n"],"ignoreList":[0,1],"mappings":";;;AA6BA,SAAgBG,EAAgB,GAAM,GAAQ,GAAS;CACrD,OAAOF,EAAcG,GAAS,MAAMC,GAAM,CAACH,EAAOG,CAAI,IAAIC,CAAM;AAClE;;;ACFA,SAAgBC,EAAS,GAAM,GAAQ,GAAS;CAC9C,OAAOJ,EAAgBE,GAAMC,IAASN,GAAoBI,CAAO;AACnE;;;ACzBA,IAAaI,IAAb,MAAwB;CACtB,OAAc,sBAAsB,GAA+C;EAEjF,IAAMC,IAAgBC,EAAQ,QAAQ,MAAW;GAC/C,IAAIC,EAAO,WACT,OAAO;GAET,IAAIA,EAAO,eAAeA,EAAO,WAA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