@plumile/backoffice-react 0.1.191 → 0.1.193
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/lib/esm/auth/authRefreshNotice.css.js +0 -1
- package/lib/esm/auth/login/PasskeyLoginForm.js +2 -1
- package/lib/esm/auth/login/PasskeyLoginForm.js.map +1 -1
- package/lib/esm/auth/login/loginPage.css.js +0 -2
- package/lib/esm/components/backoffice/actions/BackofficeEntityActionFormDialog.js +5 -2
- package/lib/esm/components/backoffice/actions/BackofficeEntityActionFormDialog.js.map +1 -1
- package/lib/esm/components/backoffice/actions/backofficeEntityActionFormDialog.css.js +0 -1
- package/lib/esm/components/backoffice/billing/backofficeBillingUsageChart.css.js +0 -1
- package/lib/esm/components/backoffice/detail/backofficeDetailBadgeRow.css.js +0 -1
- package/lib/esm/components/backoffice/detail/backofficeDetailErrorList.css.js +0 -1
- package/lib/esm/components/backoffice/detail/backofficeDetailLayout.css.js +0 -1
- package/lib/esm/components/backoffice/detail/backofficeDetailRelationLink.css.js +0 -1
- package/lib/esm/components/backoffice/detail/backofficeDetailRelationList.css.js +0 -1
- package/lib/esm/components/backoffice/detail/backofficeEntitySummaryHeader.css.js +0 -1
- package/lib/esm/components/backoffice/detail/backofficeRelationsSummaryGrid.css.js +0 -1
- package/lib/esm/components/backoffice/filters/backofficeFilterAction.css.js +0 -1
- package/lib/esm/components/backoffice/layout/breadcrumb/BackofficeTopbarBreadcrumb.js +2 -2
- package/lib/esm/components/backoffice/layout/breadcrumb/backofficeTopbarBreadcrumb.css.js +1 -2
- package/lib/esm/components/backoffice/layout/breadcrumb/backofficeTopbarBreadcrumb.css.js.map +1 -1
- package/lib/esm/components/backoffice/layout/buildSidebarSections.js +10 -7
- package/lib/esm/components/backoffice/layout/buildSidebarSections.js.map +1 -1
- package/lib/esm/components/backoffice/layout/sidebarUtils.js +1 -1
- package/lib/esm/components/backoffice/layout/sidebarUtils.js.map +1 -1
- package/lib/esm/components/backoffice/links/backofficeLink.css.js +0 -1
- package/lib/esm/components/backoffice/list/RowFlagsCell.css.js +0 -1
- package/lib/esm/components/backoffice/pickers/entityIdPickerDialog.css.js +0 -1
- package/lib/esm/components/backoffice/refs/backofficeEntityIdRef.css.js +0 -1
- package/lib/esm/components/backoffice/routing/BackofficeRouteFallback.js +10 -20
- package/lib/esm/components/backoffice/routing/BackofficeRouteFallback.js.map +1 -1
- package/lib/esm/components/backoffice/routing/backofficeContentBoundary.css.js +0 -1
- package/lib/esm/components/backoffice/routing/backofficeContentError.css.js +0 -1
- package/lib/esm/components/backoffice/routing/backofficeContentFallback.css.js +0 -1
- package/lib/esm/components/backoffice/scaffolds/BackofficeEntityListScaffold.js +17 -17
- package/lib/esm/components/backoffice/scaffolds/BackofficeEntityListScaffold.js.map +1 -1
- package/lib/esm/components/backoffice/scaffolds/backofficeEntityListScaffold.css.js +0 -1
- package/lib/esm/components/backoffice/scaffolds/backofficeTabbedDetailShell.css.js +0 -1
- package/lib/esm/components/backoffice/shared/backofficeFilterableCell.css.js +0 -1
- package/lib/esm/components/backoffice/shared/backofficeInlineFilterRow.css.js +0 -1
- package/lib/esm/components/backoffice/tools/backofficeToolsForm.css.js +0 -1
- package/lib/esm/components/backoffice/tools/backofficeToolsJsonForm.css.js +0 -1
- package/lib/esm/filters/filterHelpers.js +1 -1
- package/lib/esm/filters/filterHelpers.js.map +1 -1
- package/lib/esm/hooks/useBackofficeSidebarPins.js +2 -1
- package/lib/esm/hooks/useBackofficeSidebarPins.js.map +1 -1
- package/lib/esm/hooks/useSidebarGroupCollapse.js +2 -1
- package/lib/esm/hooks/useSidebarGroupCollapse.js.map +1 -1
- package/lib/esm/node_modules/relay-test-utils/lib/RelayMockPayloadGenerator.js +2 -2
- package/lib/esm/node_modules/relay-test-utils/lib/RelayMockPayloadGenerator.js.map +1 -1
- package/lib/esm/node_modules/relay-test-utils/lib/RelayModernMockEnvironment.js +1 -1
- package/lib/esm/node_modules/relay-test-utils/lib/RelayModernMockEnvironment.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityDetailPage.helpers.js +1 -1
- package/lib/esm/pages/BackofficeEntityDetailPage.helpers.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityDetailPage.js +1 -1
- package/lib/esm/pages/BackofficeEntityDetailPage.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityListPage.js +1 -1
- package/lib/esm/pages/BackofficeEntityListPage.js.map +1 -1
- package/lib/esm/pages/BackofficeLayoutPage.js +68 -71
- package/lib/esm/pages/BackofficeLayoutPage.js.map +1 -1
- package/lib/esm/pages/backofficeDashboardPage.css.js +0 -1
- package/lib/esm/pages/backofficeEntityDetailPage.css.js +0 -1
- package/lib/esm/pages/backofficeEntityListPage.css.js +0 -1
- package/lib/esm/pages/detail/pageResolution.js +1 -1
- package/lib/esm/pages/detail/pageResolution.js.map +1 -1
- package/lib/esm/provider/entityRegistry.js +15 -15
- package/lib/esm/provider/entityRegistry.js.map +1 -1
- package/lib/esm/relay/connectionUtils.js +1 -1
- package/lib/esm/relay/connectionUtils.js.map +1 -1
- package/lib/esm/relay/typedRelayHooks.js.map +1 -1
- package/lib/esm/storybook/relay/RelayStory.css.js +0 -1
- package/lib/esm/storybook/relay/mockResolvers.js +10 -9
- package/lib/esm/storybook/relay/mockResolvers.js.map +1 -1
- package/lib/esm/style.css +1 -1
- package/lib/types/auth/AuthFlows.stories.d.ts.map +1 -1
- package/lib/types/auth/AuthRefreshNotice.d.ts.map +1 -1
- package/lib/types/auth/TotpQrCode.d.ts.map +1 -1
- package/lib/types/auth/login/AuthPanel.d.ts.map +1 -1
- package/lib/types/auth/login/EmailCapturePanel.d.ts.map +1 -1
- package/lib/types/auth/login/LoginFlow.d.ts.map +1 -1
- package/lib/types/auth/login/MethodChooser.d.ts.map +1 -1
- package/lib/types/auth/login/MfaChallengeForm.d.ts.map +1 -1
- package/lib/types/auth/login/OidcButtons.d.ts.map +1 -1
- package/lib/types/auth/login/PasskeyLoginForm.d.ts.map +1 -1
- package/lib/types/auth/login/PasswordLoginPanel.d.ts.map +1 -1
- package/lib/types/auth/pages/AcceptInvitationScreen.d.ts.map +1 -1
- package/lib/types/auth/pages/PasswordResetCompleteScreen.d.ts.map +1 -1
- package/lib/types/auth/pages/PasswordResetRequestScreen.d.ts.map +1 -1
- package/lib/types/auth/pages/VerifyEmailScreen.d.ts.map +1 -1
- package/lib/types/components/backoffice/actions/BackofficeEntityActionFormDialog.d.ts.map +1 -1
- package/lib/types/components/backoffice/actions/LazyBackofficeEntityActionFormDialog.d.ts.map +1 -1
- package/lib/types/components/backoffice/actions/toastViewAction.d.ts.map +1 -1
- package/lib/types/components/backoffice/billing/BackofficeBillingUsageChart.d.ts.map +1 -1
- package/lib/types/components/backoffice/billing/BackofficeBillingUsageChart.stories.d.ts +18 -18
- package/lib/types/components/backoffice/billing/BackofficeBillingUsageChart.stories.d.ts.map +1 -1
- package/lib/types/components/backoffice/detail/BackofficeDetailBadgeRow.d.ts.map +1 -1
- package/lib/types/components/backoffice/detail/BackofficeDetailErrorList.d.ts.map +1 -1
- package/lib/types/components/backoffice/detail/BackofficeDetailFlagTag.d.ts.map +1 -1
- package/lib/types/components/backoffice/detail/BackofficeDetailPrimitives.stories.d.ts.map +1 -1
- package/lib/types/components/backoffice/detail/BackofficeDetailRelationList.d.ts.map +1 -1
- package/lib/types/components/backoffice/detail/BackofficeDetailTaggedValue.d.ts.map +1 -1
- package/lib/types/components/backoffice/detail/BackofficeEntitySummaryHeader.d.ts.map +1 -1
- package/lib/types/components/backoffice/detail/BackofficeEnumLabel.d.ts.map +1 -1
- package/lib/types/components/backoffice/detail/BackofficeLifecycleTimelineSection.d.ts.map +1 -1
- package/lib/types/components/backoffice/detail/BackofficeReferenceValue.d.ts.map +1 -1
- package/lib/types/components/backoffice/detail/BackofficeRelationsSummaryGrid.d.ts.map +1 -1
- package/lib/types/components/backoffice/detail/BackofficeStatusGroup.d.ts.map +1 -1
- package/lib/types/components/backoffice/detail/BackofficeStatusMetaBadge.d.ts.map +1 -1
- package/lib/types/components/backoffice/detail/BackofficeTokenUsageBreakdown.d.ts.map +1 -1
- package/lib/types/components/backoffice/detail/BackofficeUsageCostBreakdown.d.ts.map +1 -1
- package/lib/types/components/backoffice/detail/createBackofficeEntityLinkProps.d.ts.map +1 -1
- package/lib/types/components/backoffice/errors/BackofficeErrorBoundary.d.ts.map +1 -1
- package/lib/types/components/backoffice/errors/BackofficeErrorBoundary.stories.d.ts.map +1 -1
- package/lib/types/components/backoffice/filters/BackofficeFilterAction.d.ts.map +1 -1
- package/lib/types/components/backoffice/filters/DeferredFilterSearchInput.d.ts.map +1 -1
- package/lib/types/components/backoffice/filters/EntityFilterValue.d.ts.map +1 -1
- package/lib/types/components/backoffice/filters/EntityIdFilterField.d.ts.map +1 -1
- package/lib/types/components/backoffice/filters/EntityIdFilterField.stories.d.ts +1 -1
- package/lib/types/components/backoffice/filters/EntityIdFilterField.stories.d.ts.map +1 -1
- package/lib/types/components/backoffice/hub/BackofficeHubTemplate.d.ts.map +1 -1
- package/lib/types/components/backoffice/hub/BackofficeHubTemplate.stories.d.ts +4 -3
- package/lib/types/components/backoffice/hub/BackofficeHubTemplate.stories.d.ts.map +1 -1
- package/lib/types/components/backoffice/layout/BackofficePermissionsContext.d.ts.map +1 -1
- package/lib/types/components/backoffice/layout/breadcrumb/BackofficeRightPageLayout.d.ts.map +1 -1
- package/lib/types/components/backoffice/layout/breadcrumb/BackofficeTopbarBreadcrumb.d.ts.map +1 -1
- package/lib/types/components/backoffice/layout/breadcrumb/BackofficeTopbarPortal.d.ts.map +1 -1
- package/lib/types/components/backoffice/layout/breadcrumb/assertValidBreadcrumb.d.ts.map +1 -1
- package/lib/types/components/backoffice/layout/breadcrumb/backofficeTopbarBreadcrumb.css.d.ts.map +1 -1
- package/lib/types/components/backoffice/layout/breadcrumb/buildBreadcrumbs.d.ts +1 -1
- package/lib/types/components/backoffice/layout/breadcrumb/buildBreadcrumbs.d.ts.map +1 -1
- package/lib/types/components/backoffice/layout/mapViewerToSidebarProfileView.d.ts.map +1 -1
- package/lib/types/components/backoffice/layout/sidebarUtils.d.ts.map +1 -1
- package/lib/types/components/backoffice/links/BackofficeInlineLink.d.ts.map +1 -1
- package/lib/types/components/backoffice/links/BackofficeLink.d.ts.map +1 -1
- package/lib/types/components/backoffice/links/BackofficeLinkContent.d.ts.map +1 -1
- package/lib/types/components/backoffice/links/BackofficeLinkLabel.d.ts.map +1 -1
- package/lib/types/components/backoffice/links/resolveBackofficeLink.d.ts.map +1 -1
- package/lib/types/components/backoffice/links/resolveBackofficeTargetIcon.d.ts.map +1 -1
- package/lib/types/components/backoffice/links/useBackofficeLink.d.ts.map +1 -1
- package/lib/types/components/backoffice/list/RowFlagsCell.d.ts.map +1 -1
- package/lib/types/components/backoffice/overview/BackofficeOverviewLayout.d.ts.map +1 -1
- package/lib/types/components/backoffice/overview/BackofficeOverviewLayout.stories.d.ts +1 -1
- package/lib/types/components/backoffice/overview/BackofficeOverviewLayout.stories.d.ts.map +1 -1
- package/lib/types/components/backoffice/pickers/EntityIdPickerDialog.d.ts.map +1 -1
- package/lib/types/components/backoffice/pickers/EntityIdPickerDialog.stories.d.ts +2 -1
- package/lib/types/components/backoffice/pickers/EntityIdPickerDialog.stories.d.ts.map +1 -1
- package/lib/types/components/backoffice/refs/BackofficeEntityIdRef.d.ts.map +1 -1
- package/lib/types/components/backoffice/refs/BackofficeEntityLink.d.ts.map +1 -1
- package/lib/types/components/backoffice/refs/BackofficeLazyEntityCount.d.ts.map +1 -1
- package/lib/types/components/backoffice/refs/BackofficeRelatedCountLink.d.ts.map +1 -1
- package/lib/types/components/backoffice/routing/BackofficeContentBoundary.d.ts.map +1 -1
- package/lib/types/components/backoffice/routing/BackofficeContentError.d.ts.map +1 -1
- package/lib/types/components/backoffice/routing/BackofficeContentFallback.d.ts.map +1 -1
- package/lib/types/components/backoffice/routing/BackofficeRouteFallback.d.ts.map +1 -1
- package/lib/types/components/backoffice/routing/BackofficeRoutePendingBar.d.ts.map +1 -1
- package/lib/types/components/backoffice/scaffolds/BackofficeEntityDetailNotFound.d.ts.map +1 -1
- package/lib/types/components/backoffice/scaffolds/BackofficeEntityDetailScaffold.d.ts.map +1 -1
- package/lib/types/components/backoffice/scaffolds/BackofficeEntityListScaffold.d.ts.map +1 -1
- package/lib/types/components/backoffice/scaffolds/BackofficeListFilterContext.d.ts.map +1 -1
- package/lib/types/components/backoffice/scaffolds/BackofficeTabbedDetailShell.d.ts.map +1 -1
- package/lib/types/components/backoffice/scaffolds/BackofficeTabbedDetailShell.stories.d.ts +1 -1
- package/lib/types/components/backoffice/scaffolds/BackofficeTabbedDetailShell.stories.d.ts.map +1 -1
- package/lib/types/components/backoffice/scaffolds/backofficeListScrollMode.d.ts +1 -1
- package/lib/types/components/backoffice/shared/BackofficeFilterableCell.d.ts.map +1 -1
- package/lib/types/components/backoffice/shared/BackofficeFormattedCurrency.d.ts.map +1 -1
- package/lib/types/components/backoffice/shared/BackofficeFormattedNumber.d.ts.map +1 -1
- package/lib/types/components/backoffice/shared/BackofficeInlineFilterRow.d.ts.map +1 -1
- package/lib/types/components/backoffice/shared/backofficeFilterableCell.css.d.ts.map +1 -1
- package/lib/types/components/backoffice/technical/TechnicalIdentifierValue.d.ts.map +1 -1
- package/lib/types/components/backoffice/tools/BackofficeTools.stories.d.ts.map +1 -1
- package/lib/types/components/backoffice/tools/BackofficeToolsDocPanel.d.ts.map +1 -1
- package/lib/types/components/backoffice/tools/BackofficeToolsErrorFallback.d.ts.map +1 -1
- package/lib/types/components/backoffice/tools/BackofficeToolsJsonForm.d.ts.map +1 -1
- package/lib/types/components/backoffice/tools/BackofficeToolsQueryBoundary.d.ts.map +1 -1
- package/lib/types/hooks/useAuth.d.ts.map +1 -1
- package/lib/types/hooks/useBackofficeSessionAuth.d.ts.map +1 -1
- package/lib/types/hooks/useBackofficeSidebarPins.d.ts +6 -3
- package/lib/types/hooks/useBackofficeSidebarPins.d.ts.map +1 -1
- package/lib/types/hooks/useCopyToClipboard.d.ts.map +1 -1
- package/lib/types/hooks/useInfiniteConnection.d.ts.map +1 -1
- package/lib/types/hooks/useSidebarGroupCollapse.d.ts.map +1 -1
- package/lib/types/i18n/mergeResourceLanguages.d.ts +5 -2
- package/lib/types/i18n/mergeResourceLanguages.d.ts.map +1 -1
- package/lib/types/i18n/resources.d.ts.map +1 -1
- package/lib/types/modules/uploads.d.ts.map +1 -1
- package/lib/types/pages/BackofficeAcceptInvitationPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeDashboardPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeDashboardPage.helpers.d.ts.map +1 -1
- package/lib/types/pages/BackofficeDashboardPage.stories.d.ts.map +1 -1
- package/lib/types/pages/BackofficeDashboardShellPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeDashboardWidgetContent.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityDetailFramePage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityDetailLayoutPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityDetailPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityDetailPage.helpers.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityDetailPage.view-helpers.d.ts +1 -1
- package/lib/types/pages/BackofficeEntityDetailPage.view-helpers.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityDetailPageConfigPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityDetailShellPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityDetailUnknownPageRedirect.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityListDataPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityListPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityListPage.helpers.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityListRouteContext.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityListShellPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeHubPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeLayoutPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeLoginPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficePasswordResetCompletePage.d.ts.map +1 -1
- package/lib/types/pages/BackofficePasswordResetRequestPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeRedirect.d.ts.map +1 -1
- package/lib/types/pages/BackofficeToolShellPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeVerifyEmailPage.d.ts.map +1 -1
- package/lib/types/pages/detail/BackofficeEntityDetailManifestFallback.d.ts.map +1 -1
- package/lib/types/pages/detail/buildTabsItems.d.ts.map +1 -1
- package/lib/types/pages/detail/pageResolution.d.ts.map +1 -1
- package/lib/types/provider/BackofficeConfigContext.d.ts.map +1 -1
- package/lib/types/provider/BackofficeListUiStateContext.d.ts +1 -1
- package/lib/types/provider/BackofficeListUiStateContext.d.ts.map +1 -1
- package/lib/types/provider/BackofficeProvider.d.ts.map +1 -1
- package/lib/types/provider/dashboardRegistrations.d.ts.map +1 -1
- package/lib/types/provider/entityRegistry.d.ts +6 -3
- package/lib/types/provider/entityRegistry.d.ts.map +1 -1
- package/lib/types/provider/lazyValue.d.ts.map +1 -1
- package/lib/types/provider/useBackofficeEntityLoader.d.ts +6 -3
- package/lib/types/provider/useBackofficeEntityLoader.d.ts.map +1 -1
- package/lib/types/provider/useBackofficeLazyValue.d.ts.map +1 -1
- package/lib/types/relay/connectionUtils.d.ts.map +1 -1
- package/lib/types/relay/createInlineReader.d.ts.map +1 -1
- package/lib/types/relay/envHelpers.d.ts +6 -3
- package/lib/types/relay/envHelpers.d.ts.map +1 -1
- package/lib/types/relay/identityView.d.ts.map +1 -1
- package/lib/types/relay/mutationResult.d.ts.map +1 -1
- package/lib/types/relay/typedRelayHooks.d.ts +2 -3
- package/lib/types/relay/typedRelayHooks.d.ts.map +1 -1
- package/lib/types/router/backofficeAuthPaths.d.ts.map +1 -1
- package/lib/types/router/createBackofficeRoutes.d.ts +28 -17
- package/lib/types/router/createBackofficeRoutes.d.ts.map +1 -1
- package/lib/types/storybook/relay/RelayStory.d.ts.map +1 -1
- package/lib/types/subscriptions/useCursorResumableSubscription.d.ts.map +1 -1
- package/package.json +21 -21
- package/lib/esm/components/backoffice/routing/backofficeRouteFallback.css.js +0 -7
- package/lib/esm/components/backoffice/routing/backofficeRouteFallback.css.js.map +0 -1
- package/lib/types/components/backoffice/routing/backofficeRouteFallback.css.d.ts +0 -3
- package/lib/types/components/backoffice/routing/backofficeRouteFallback.css.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeEntityListPage.js","names":[],"sources":["../../../src/pages/BackofficeEntityListPage.tsx"],"sourcesContent":["import {\n Suspense,\n type JSX,\n type ReactNode,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport type { TFunction } from 'i18next';\nimport { useTranslation } from 'react-i18next';\nimport Link from '@plumile/router/routing/Link.js';\nimport type {\n BackofficeEntityManifestItem,\n BackofficePreparedListLayoutRoute,\n BackofficeRuntimeResolvedListFacetConfig,\n BackofficeRowFlagSpec,\n} from '@plumile/backoffice-core/types.js';\nimport { Button } from '@plumile/ui/atomic/atoms/button/Button.js';\nimport { LinkButton } from '@plumile/ui/atomic/atoms/button/LinkButton.js';\nimport {\n type DataTableColumn,\n type GetRowId,\n} from '@plumile/ui/components/data-table/DataTable.js';\nimport { TableCell } from '@plumile/ui/components/data-table/TableCell.js';\nimport { EyeSvg } from '@plumile/ui/icons/EyeSvg.js';\nimport { BackofficeEntityListScaffold } from '../components/backoffice/scaffolds/BackofficeEntityListScaffold.js';\nimport { LazyBackofficeEntityActionFormDialog } from '../components/backoffice/actions/LazyBackofficeEntityActionFormDialog.js';\nimport { buildDataTableColumns } from '../components/backoffice/columns/buildDataTableColumns.js';\nimport { RowFlagsCell } from '../components/backoffice/list/RowFlagsCell.js';\nimport { useBackofficeListUrlState } from '../hooks/useBackofficeListUrlState.js';\nimport { useBackofficeReactTranslation } from '../i18n/useBackofficeReactTranslation.js';\nimport {\n createBackofficeEntityListUiStateKey,\n useBackofficeListFilterDrawerState,\n} from '../provider/BackofficeListUiStateContext.js';\nimport * as pageStyles from './backofficeEntityListPage.css.js';\nimport { rowFlagsColumnCell } from '../components/backoffice/list/RowFlagsCell.css.js';\nimport { BackofficeRightPageLayout } from '../components/backoffice/layout/breadcrumb/BackofficeRightPageLayout.js';\nimport { buildEntityListBreadcrumb } from '../components/backoffice/layout/breadcrumb/buildBreadcrumbs.js';\nimport { BackofficeEntityListRouteProvider } from './BackofficeEntityListRouteContext.js';\nimport {\n buildActionsColumn,\n computeActionsColumnWidthPx,\n computeRowFlagsColumnWidthPx,\n isFormMutationAction,\n isRouteAction,\n resolveLabel,\n resolveActionVariant,\n resolveTrackBySize,\n type ConnectionListConfig,\n} from './BackofficeEntityListPage.helpers.js';\n\nexport type BackofficeEntityListPageProps = {\n children?: ReactNode;\n entityManifest: BackofficeEntityManifestItem;\n config: BackofficeRuntimeResolvedListFacetConfig;\n prepared: BackofficePreparedListLayoutRoute;\n};\n\nconst applyListEdgeColumns = <Row,>(\n inputColumns: readonly DataTableColumn<Row>[],\n rowFlags: readonly BackofficeRowFlagSpec<Row>[] | undefined,\n actionCount: number,\n tApp: TFunction,\n): {\n columns: readonly DataTableColumn<Row>[];\n gridTemplateColumns?: string;\n} => {\n const hasFlags = rowFlags != null && rowFlags.length > 0;\n\n let columns = inputColumns;\n if (hasFlags) {\n const flagsColumn: DataTableColumn<Row> = {\n id: '__rowFlags',\n header: '',\n className: rowFlagsColumnCell,\n mobileRole: 'badge',\n cell: (row) => {\n return <RowFlagsCell row={row} flags={rowFlags} tApp={tApp} />;\n },\n };\n\n // Ensure we never pick the flags column as \"primary\".\n const withFlags = [flagsColumn, ...inputColumns];\n const hasPrimary = withFlags.some((col) => {\n return col.isPrimary === true;\n });\n\n columns = withFlags;\n if (!hasPrimary) {\n columns = withFlags.map((col, index) => {\n if (index === 1) {\n return { ...col, isPrimary: true };\n }\n return col;\n });\n }\n }\n\n let flagCount = 0;\n if (hasFlags) {\n flagCount = rowFlags.length;\n }\n const flagsWidthPx = computeRowFlagsColumnWidthPx(flagCount);\n const actionsWidthPx = computeActionsColumnWidthPx(actionCount);\n\n // We always include the right-side \"actions\" column in list pages.\n let leftColumnCount = 0;\n if (hasFlags) {\n leftColumnCount = 1;\n }\n const middleCount = columns.length - leftColumnCount - 1;\n\n const middleTracks = columns\n .slice(leftColumnCount, leftColumnCount + Math.max(0, middleCount))\n .map((column) => {\n return resolveTrackBySize(column as DataTableColumn<unknown>, '1fr');\n })\n .join(' ');\n\n let gridTemplateColumns = '';\n if (hasFlags) {\n gridTemplateColumns = `${flagsWidthPx}px ${middleTracks} ${actionsWidthPx}px`;\n } else {\n gridTemplateColumns = `${middleTracks} ${actionsWidthPx}px`;\n }\n\n return { columns, gridTemplateColumns };\n};\n\nconst BackofficeEntityConnectionListPage = ({\n children,\n config,\n breadcrumb,\n}: Omit<BackofficeEntityListPageProps, 'config' | 'prepared'> & {\n config: ConnectionListConfig;\n breadcrumb: ReturnType<typeof buildEntityListBreadcrumb>;\n}): JSX.Element | null => {\n const listConfig = config.list;\n\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n const [activeFormActionId, setActiveFormActionId] = useState<string | null>(\n null,\n );\n const [countFetchKey, setCountFetchKey] = useState(0);\n const refreshRef = useRef<(() => void) | null>(null);\n\n const registerRefresh = useCallback((refresh: (() => void) | null) => {\n refreshRef.current = refresh;\n }, []);\n\n const { columns, gridTemplateColumns } = useMemo((): {\n columns: readonly DataTableColumn<unknown>[];\n gridTemplateColumns?: string;\n } => {\n const baseColumns = buildDataTableColumns(listConfig.columns, {\n tApp,\n t,\n });\n const actionsColumn = buildActionsColumn({\n ariaLabel: t('actions.view'),\n fallback: t('common.notAvailable'),\n className: pageStyles.actionsColumnCell,\n resolveDetailHref: (id) => {\n return config.routes.detail(id);\n },\n renderAction: ({ href, ariaLabel }) => {\n return (\n <TableCell.Actions>\n <Link\n to={href}\n className={pageStyles.actionTrigger}\n aria-label={ariaLabel}\n title={ariaLabel}\n preloadOnHover=\"code\"\n >\n <EyeSvg width={16} height={16} />\n </Link>\n </TableCell.Actions>\n );\n },\n });\n const allColumns = [...baseColumns, actionsColumn];\n return applyListEdgeColumns(allColumns, listConfig.rowFlags, 1, tApp);\n }, [config.routes, listConfig.columns, listConfig.rowFlags, t, tApp]);\n\n const getRowId = useCallback<GetRowId<unknown>>(\n (row) => {\n return listConfig.getRowId(row);\n },\n [listConfig],\n );\n\n const { state, pushState } = useBackofficeListUrlState(config);\n const listUiStateKey = useMemo(() => {\n return createBackofficeEntityListUiStateKey(config.id);\n }, [config.id]);\n const filterDrawerState = useBackofficeListFilterDrawerState(listUiStateKey);\n\n const handleRefreshRequest = useCallback(() => {\n setCountFetchKey((current) => {\n return current + 1;\n });\n refreshRef.current?.();\n }, []);\n\n const listActions = useMemo(() => {\n return config.listActions ?? [];\n }, [config.listActions]);\n const visibleActions = useMemo(() => {\n return listActions.filter((action) => {\n if (action.isVisible == null) {\n return true;\n }\n return action.isVisible(null);\n });\n }, [listActions]);\n\n const headerActions = useMemo(() => {\n if (visibleActions.length === 0) {\n return undefined;\n }\n return (\n <div className={pageStyles.headerActions}>\n {visibleActions.map((action, index) => {\n const { variant: actionVariant } = action;\n const label = resolveLabel(action.label, tApp);\n let ariaLabel = label;\n if (action.ariaLabel != null) {\n ariaLabel = resolveLabel(action.ariaLabel, tApp);\n }\n const variant = resolveActionVariant(actionVariant, index);\n const size = action.size ?? 'small';\n const isDisabled = action.isDisabled?.(null) === true;\n\n if (isRouteAction(action)) {\n const href = action.to(null);\n return (\n <LinkButton\n key={action.id}\n to={href}\n variant={variant}\n size={size}\n isDisabled={isDisabled}\n aria-label={ariaLabel}\n preloadOnHover=\"code-and-data\"\n >\n {label}\n </LinkButton>\n );\n }\n\n if (isFormMutationAction(action)) {\n return (\n <Button\n key={action.id}\n type=\"button\"\n variant={variant}\n size={size}\n disabled={isDisabled}\n onClick={() => {\n setActiveFormActionId(action.id);\n }}\n aria-label={ariaLabel}\n >\n {label}\n </Button>\n );\n }\n\n return null;\n })}\n </div>\n );\n }, [tApp, visibleActions]);\n\n const activeFormAction = listActions.find((action) => {\n return action.id === activeFormActionId;\n });\n\n const renderLoadingScaffold = () => {\n return (\n <BackofficeEntityListScaffold\n config={config}\n state={state}\n pushState={pushState}\n headerActions={headerActions}\n rows={[]}\n columns={columns}\n gridTemplateColumns={gridTemplateColumns}\n getRowId={getRowId}\n hasNextPage={false}\n isLoadingMore={false}\n isRefreshing={false}\n onLoadMore={() => {}}\n onRefresh={handleRefreshRequest}\n totalCount={null}\n isLoadingInitial\n filterDrawerState={filterDrawerState}\n />\n );\n };\n\n const contextValue = useMemo(() => {\n return {\n config,\n state,\n pushState,\n headerActions,\n columns,\n gridTemplateColumns,\n getRowId,\n countFetchKey,\n filterDrawerState,\n bumpCountFetchKey: () => {\n setCountFetchKey((current) => {\n return current + 1;\n });\n },\n registerRefresh,\n };\n }, [\n columns,\n config,\n countFetchKey,\n filterDrawerState,\n getRowId,\n gridTemplateColumns,\n headerActions,\n pushState,\n registerRefresh,\n state,\n ]);\n\n return (\n <BackofficeRightPageLayout breadcrumb={breadcrumb}>\n <BackofficeEntityListRouteProvider value={contextValue}>\n <Suspense fallback={renderLoadingScaffold()}>{children}</Suspense>\n </BackofficeEntityListRouteProvider>\n {activeFormAction != null && isFormMutationAction(activeFormAction) && (\n <LazyBackofficeEntityActionFormDialog\n isOpen\n action={activeFormAction}\n node={null}\n onClose={() => {\n setActiveFormActionId(null);\n }}\n onSuccess={handleRefreshRequest}\n />\n )}\n </BackofficeRightPageLayout>\n );\n};\n\nexport const BackofficeEntityListPage = ({\n children,\n entityManifest,\n config,\n}: BackofficeEntityListPageProps): JSX.Element | null => {\n const { t: tApp } = useTranslation();\n const breadcrumb = buildEntityListBreadcrumb(config, tApp);\n\n return (\n <BackofficeEntityConnectionListPage\n children={children}\n entityManifest={entity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GACN,eAAe;IACb,EAAsB,IAAI;GAC5B;GACA,WAAW;EACZ,CAAA,CAEsB;;AAE/B,GAEa,KAA4B,EACvC,aACA,mBACA,gBACuD;CACvD,IAAM,EAAE,GAAG,MAAS,EAAe;CAGnC,OACE,kBAAC,GAAD;EACY;EACM;EACR;EACI,YAPG,EAA0B,GAAQ,CAOrC;CACb,CAAA;AAEL"}
|
|
1
|
+
{"version":3,"file":"BackofficeEntityListPage.js","names":[],"sources":["../../../src/pages/BackofficeEntityListPage.tsx"],"sourcesContent":["import {\n Suspense,\n type JSX,\n type ReactNode,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport type { TFunction } from 'i18next';\nimport { useTranslation } from 'react-i18next';\nimport Link from '@plumile/router/routing/Link.js';\nimport type {\n BackofficeEntityManifestItem,\n BackofficePreparedListLayoutRoute,\n BackofficeRuntimeResolvedListFacetConfig,\n BackofficeRowFlagSpec,\n} from '@plumile/backoffice-core/types.js';\nimport { Button } from '@plumile/ui/atomic/atoms/button/Button.js';\nimport { LinkButton } from '@plumile/ui/atomic/atoms/button/LinkButton.js';\nimport {\n type DataTableColumn,\n type GetRowId,\n} from '@plumile/ui/components/data-table/DataTable.js';\nimport { TableCell } from '@plumile/ui/components/data-table/TableCell.js';\nimport { EyeSvg } from '@plumile/ui/icons/EyeSvg.js';\nimport { BackofficeEntityListScaffold } from '../components/backoffice/scaffolds/BackofficeEntityListScaffold.js';\nimport { LazyBackofficeEntityActionFormDialog } from '../components/backoffice/actions/LazyBackofficeEntityActionFormDialog.js';\nimport { buildDataTableColumns } from '../components/backoffice/columns/buildDataTableColumns.js';\nimport { RowFlagsCell } from '../components/backoffice/list/RowFlagsCell.js';\nimport { useBackofficeListUrlState } from '../hooks/useBackofficeListUrlState.js';\nimport { useBackofficeReactTranslation } from '../i18n/useBackofficeReactTranslation.js';\nimport {\n createBackofficeEntityListUiStateKey,\n useBackofficeListFilterDrawerState,\n} from '../provider/BackofficeListUiStateContext.js';\nimport * as pageStyles from './backofficeEntityListPage.css.js';\nimport { rowFlagsColumnCell } from '../components/backoffice/list/RowFlagsCell.css.js';\nimport { BackofficeRightPageLayout } from '../components/backoffice/layout/breadcrumb/BackofficeRightPageLayout.js';\nimport { buildEntityListBreadcrumb } from '../components/backoffice/layout/breadcrumb/buildBreadcrumbs.js';\nimport { BackofficeEntityListRouteProvider } from './BackofficeEntityListRouteContext.js';\nimport {\n buildActionsColumn,\n computeActionsColumnWidthPx,\n computeRowFlagsColumnWidthPx,\n isFormMutationAction,\n isRouteAction,\n resolveLabel,\n resolveActionVariant,\n resolveTrackBySize,\n type ConnectionListConfig,\n} from './BackofficeEntityListPage.helpers.js';\n\nexport type BackofficeEntityListPageProps = {\n children?: ReactNode;\n entityManifest: BackofficeEntityManifestItem;\n config: BackofficeRuntimeResolvedListFacetConfig;\n prepared: BackofficePreparedListLayoutRoute;\n};\n\nconst applyListEdgeColumns = <Row,>(\n inputColumns: readonly DataTableColumn<Row>[],\n rowFlags: readonly BackofficeRowFlagSpec<Row>[] | undefined,\n actionCount: number,\n tApp: TFunction,\n): {\n columns: readonly DataTableColumn<Row>[];\n gridTemplateColumns?: string;\n} => {\n const hasFlags = rowFlags != null && rowFlags.length > 0;\n\n let columns = inputColumns;\n if (hasFlags) {\n const flagsColumn: DataTableColumn<Row> = {\n id: '__rowFlags',\n header: '',\n className: rowFlagsColumnCell,\n mobileRole: 'badge',\n cell: (row) => {\n return <RowFlagsCell row={row} flags={rowFlags} tApp={tApp} />;\n },\n };\n\n // Ensure we never pick the flags column as \"primary\".\n const withFlags = [flagsColumn, ...inputColumns];\n const hasPrimary = withFlags.some((col) => {\n return col.isPrimary === true;\n });\n\n columns = withFlags;\n if (!hasPrimary) {\n columns = withFlags.map((col, index) => {\n if (index === 1) {\n return { ...col, isPrimary: true };\n }\n return col;\n });\n }\n }\n\n let flagCount = 0;\n if (hasFlags) {\n flagCount = rowFlags.length;\n }\n const flagsWidthPx = computeRowFlagsColumnWidthPx(flagCount);\n const actionsWidthPx = computeActionsColumnWidthPx(actionCount);\n\n // We always include the right-side \"actions\" column in list pages.\n let leftColumnCount = 0;\n if (hasFlags) {\n leftColumnCount = 1;\n }\n const middleCount = columns.length - leftColumnCount - 1;\n\n const middleTracks = columns\n .slice(leftColumnCount, leftColumnCount + Math.max(0, middleCount))\n .map((column) => {\n return resolveTrackBySize(column as DataTableColumn<unknown>, '1fr');\n })\n .join(' ');\n\n let gridTemplateColumns = '';\n if (hasFlags) {\n gridTemplateColumns = `${flagsWidthPx}px ${middleTracks} ${actionsWidthPx}px`;\n } else {\n gridTemplateColumns = `${middleTracks} ${actionsWidthPx}px`;\n }\n\n return { columns, gridTemplateColumns };\n};\n\nconst BackofficeEntityConnectionListPage = ({\n children,\n config,\n breadcrumb,\n}: Omit<BackofficeEntityListPageProps, 'config' | 'prepared'> & {\n config: ConnectionListConfig;\n breadcrumb: ReturnType<typeof buildEntityListBreadcrumb>;\n}): JSX.Element | null => {\n const listConfig = config.list;\n\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n const [activeFormActionId, setActiveFormActionId] = useState<string | null>(\n null,\n );\n const [countFetchKey, setCountFetchKey] = useState(0);\n const refreshRef = useRef<(() => void) | null>(null);\n\n const registerRefresh = useCallback((refresh: (() => void) | null) => {\n refreshRef.current = refresh;\n }, []);\n\n const { columns, gridTemplateColumns } = useMemo((): {\n columns: readonly DataTableColumn<unknown>[];\n gridTemplateColumns?: string;\n } => {\n const baseColumns = buildDataTableColumns(listConfig.columns, {\n tApp,\n t,\n });\n const actionsColumn = buildActionsColumn({\n ariaLabel: t('actions.view'),\n fallback: t('common.notAvailable'),\n className: pageStyles.actionsColumnCell,\n resolveDetailHref: (id) => {\n return config.routes.detail(id);\n },\n renderAction: ({ href, ariaLabel }) => {\n return (\n <TableCell.Actions>\n <Link\n to={href}\n className={pageStyles.actionTrigger}\n aria-label={ariaLabel}\n title={ariaLabel}\n preloadOnHover=\"code\"\n >\n <EyeSvg width={16} height={16} />\n </Link>\n </TableCell.Actions>\n );\n },\n });\n const allColumns = [...baseColumns, actionsColumn];\n return applyListEdgeColumns(allColumns, listConfig.rowFlags, 1, tApp);\n }, [config.routes, listConfig.columns, listConfig.rowFlags, t, tApp]);\n\n const getRowId = useCallback<GetRowId<unknown>>(\n (row) => {\n return listConfig.getRowId(row);\n },\n [listConfig],\n );\n\n const { state, pushState } = useBackofficeListUrlState(config);\n const listUiStateKey = useMemo(() => {\n return createBackofficeEntityListUiStateKey(config.id);\n }, [config.id]);\n const filterDrawerState = useBackofficeListFilterDrawerState(listUiStateKey);\n\n const handleRefreshRequest = useCallback(() => {\n setCountFetchKey((current) => {\n return current + 1;\n });\n refreshRef.current?.();\n }, []);\n\n const listActions = useMemo(() => {\n return config.listActions ?? [];\n }, [config.listActions]);\n const visibleActions = useMemo(() => {\n return listActions.filter((action) => {\n if (action.isVisible == null) {\n return true;\n }\n return action.isVisible(null);\n });\n }, [listActions]);\n\n const headerActions = useMemo(() => {\n if (visibleActions.length === 0) {\n return undefined;\n }\n return (\n <div className={pageStyles.headerActions}>\n {visibleActions.map((action, index) => {\n const { variant: actionVariant } = action;\n const label = resolveLabel(action.label, tApp);\n let ariaLabel = label;\n if (action.ariaLabel != null) {\n ariaLabel = resolveLabel(action.ariaLabel, tApp);\n }\n const variant = resolveActionVariant(actionVariant, index);\n const size = action.size ?? 'small';\n const isDisabled = action.isDisabled?.(null) === true;\n\n if (isRouteAction(action)) {\n const href = action.to(null);\n return (\n <LinkButton\n key={action.id}\n to={href}\n variant={variant}\n size={size}\n isDisabled={isDisabled}\n aria-label={ariaLabel}\n preloadOnHover=\"code-and-data\"\n >\n {label}\n </LinkButton>\n );\n }\n\n if (isFormMutationAction(action)) {\n return (\n <Button\n key={action.id}\n type=\"button\"\n variant={variant}\n size={size}\n disabled={isDisabled}\n onClick={() => {\n setActiveFormActionId(action.id);\n }}\n aria-label={ariaLabel}\n >\n {label}\n </Button>\n );\n }\n\n return null;\n })}\n </div>\n );\n }, [tApp, visibleActions]);\n\n const activeFormAction = listActions.find((action) => {\n return action.id === activeFormActionId;\n });\n\n const renderLoadingScaffold = () => {\n return (\n <BackofficeEntityListScaffold\n config={config}\n state={state}\n pushState={pushState}\n headerActions={headerActions}\n rows={[]}\n columns={columns}\n gridTemplateColumns={gridTemplateColumns}\n getRowId={getRowId}\n hasNextPage={false}\n isLoadingMore={false}\n isRefreshing={false}\n onLoadMore={() => {}}\n onRefresh={handleRefreshRequest}\n totalCount={null}\n isLoadingInitial\n filterDrawerState={filterDrawerState}\n />\n );\n };\n\n const contextValue = useMemo(() => {\n return {\n config,\n state,\n pushState,\n headerActions,\n columns,\n gridTemplateColumns,\n getRowId,\n countFetchKey,\n filterDrawerState,\n bumpCountFetchKey: () => {\n setCountFetchKey((current) => {\n return current + 1;\n });\n },\n registerRefresh,\n };\n }, [\n columns,\n config,\n countFetchKey,\n filterDrawerState,\n getRowId,\n gridTemplateColumns,\n headerActions,\n pushState,\n registerRefresh,\n state,\n ]);\n\n return (\n <BackofficeRightPageLayout breadcrumb={breadcrumb}>\n <BackofficeEntityListRouteProvider value={contextValue}>\n <Suspense fallback={renderLoadingScaffold()}>{children}</Suspense>\n </BackofficeEntityListRouteProvider>\n {activeFormAction != null && isFormMutationAction(activeFormAction) && (\n <LazyBackofficeEntityActionFormDialog\n isOpen\n action={activeFormAction}\n node={null}\n onClose={() => {\n setActiveFormActionId(null);\n }}\n onSuccess={handleRefreshRequest}\n />\n )}\n </BackofficeRightPageLayout>\n );\n};\n\nexport const BackofficeEntityListPage = ({\n children,\n entityManifest,\n config,\n}: BackofficeEntityListPageProps): JSX.Element | null => {\n const { t: tApp } = useTranslation();\n const breadcrumb = buildEntityListBreadcrumb(config, tApp);\n\n return (\n <BackofficeEntityConnectionListPage\n children={children}\n entityManifest={entityManifest}\n config={config}\n breadcrumb={breadcrumb}\n />\n );\n};\n\nexport default BackofficeEntityListPage;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA4DA,IAAM,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AAM,EAAE,GAAG,MAAS,EAAe;CAGnC,OACE,kBAAC,GAAD;EACY;EACM;EACR;EACI,YAPG,EAA0B,GAAQ,CAOrC;CACb,CAAA;AAEL"}
|
|
@@ -15,13 +15,12 @@ import { useCallback as le, useContext as ue, useEffect as o, useMemo as s, useS
|
|
|
15
15
|
import { jsx as l } from "react/jsx-runtime";
|
|
16
16
|
import { useTranslation as de } from "react-i18next";
|
|
17
17
|
import { commitMutation as fe, usePreloadedQuery as u } from "react-relay";
|
|
18
|
-
import { ToastProvider as
|
|
19
|
-
import
|
|
20
|
-
import { GlobalSearchInput as
|
|
21
|
-
import
|
|
22
|
-
import { AdminShellLayout as
|
|
23
|
-
import {
|
|
24
|
-
import { SidebarProfileMenu as p } from "@plumile/ui/components/navigation/sidebar/SidebarProfileMenu.js";
|
|
18
|
+
import { ToastProvider as d } from "@plumile/ui/atomic/molecules/toast/ToastProvider.js";
|
|
19
|
+
import pe from "@plumile/router/routing/RoutingContext.js";
|
|
20
|
+
import { GlobalSearchInput as me } from "@plumile/ui/backoffice/molecules/global_search_input/GlobalSearchInput.js";
|
|
21
|
+
import he from "@plumile/router/routing/useLocation.js";
|
|
22
|
+
import { AdminShellLayout as ge } from "@plumile/ui/admin/templates/admin_shell_layout/AdminShellLayout.js";
|
|
23
|
+
import { SidebarProfileMenu as f } from "@plumile/ui/components/navigation/sidebar/SidebarProfileMenu.js";
|
|
25
24
|
//#region src/pages/BackofficeLayoutPage.tsx
|
|
26
25
|
var _e = "plumile:backoffice:recent-items", ve = "plumile:backoffice:sidebar", ye = (e) => {
|
|
27
26
|
if (typeof window > "u") return [];
|
|
@@ -37,19 +36,19 @@ var _e = "plumile:backoffice:recent-items", ve = "plumile:backoffice:sidebar", y
|
|
|
37
36
|
} catch {
|
|
38
37
|
return [];
|
|
39
38
|
}
|
|
40
|
-
},
|
|
39
|
+
}, p = (e, t) => {
|
|
41
40
|
if (!(typeof window > "u")) try {
|
|
42
41
|
window.localStorage.setItem(e, JSON.stringify(t));
|
|
43
42
|
} catch {}
|
|
44
43
|
}, m = ({ children: u, permissions: m, authStatus: h, activeGroupId: g }) => {
|
|
45
|
-
let { t: _ } = de(), { t: v } = e(), { pathname: y } =
|
|
44
|
+
let { t: _ } = de(), { t: v } = e(), { pathname: y } = he(), b = ue(pe), x = ae(), { auth: S, basePath: C, dashboards: w, entities: T, sidebar: E } = t(), [D, be] = c(""), O = E?.preferences?.storageKey ?? ve, k = E?.preferences?.persistCollapsed === !0, [A, xe] = c(() => {
|
|
46
45
|
if (!k || typeof window > "u") return !1;
|
|
47
46
|
try {
|
|
48
47
|
return window.localStorage.getItem(`${O}:collapsed`) === "true";
|
|
49
48
|
} catch {
|
|
50
49
|
return !1;
|
|
51
50
|
}
|
|
52
|
-
}), [j, M] = c(!1), [N,
|
|
51
|
+
}), [j, M] = c(!1), [N, P] = c(null), F = E?.recentItems, I = F?.enabled === !0, L = F?.storageKey ?? _e, R = F?.maxItems ?? 8, [z, Se] = c(() => I ? ye(L) : []);
|
|
53
52
|
o(() => {
|
|
54
53
|
if (!(!k || typeof window > "u")) try {
|
|
55
54
|
window.localStorage.setItem(`${O}:collapsed`, String(A));
|
|
@@ -59,52 +58,52 @@ var _e = "plumile:backoffice:recent-items", ve = "plumile:backoffice:sidebar", y
|
|
|
59
58
|
k,
|
|
60
59
|
O
|
|
61
60
|
]);
|
|
62
|
-
let
|
|
61
|
+
let B = s(() => i(T, E), [T, E]), Ce = s(() => Object.keys(B), [B]), we = s(() => Object.fromEntries(Object.entries(B).map(([e, t]) => [e, t.behavior?.defaultCollapsed ?? !0])), [B]), Te = s(() => ee(B, T, E, m), [
|
|
63
62
|
T,
|
|
64
|
-
|
|
63
|
+
B,
|
|
65
64
|
m,
|
|
66
65
|
E
|
|
67
|
-
]),
|
|
66
|
+
]), V = s(() => r(y, T), [T, y]);
|
|
68
67
|
o(() => {
|
|
69
|
-
if (!
|
|
70
|
-
let e = T[
|
|
68
|
+
if (!I || V == null) return;
|
|
69
|
+
let e = T[V];
|
|
71
70
|
if (e == null || e.kind !== "tool" && !e.hasList) return;
|
|
72
71
|
let t = e.routes.list, n = "entity";
|
|
73
72
|
e.kind === "tool" && (n = "tool");
|
|
74
73
|
let r = {
|
|
75
74
|
kind: n,
|
|
76
|
-
id:
|
|
75
|
+
id: V,
|
|
77
76
|
label: e.label(_),
|
|
78
77
|
href: t,
|
|
79
78
|
visitedAt: Date.now()
|
|
80
79
|
};
|
|
81
|
-
|
|
82
|
-
let t = [r, ...e.filter((e) => e.id !== r.id || e.kind !== r.kind)].slice(0,
|
|
83
|
-
return
|
|
80
|
+
Se((e) => {
|
|
81
|
+
let t = [r, ...e.filter((e) => e.id !== r.id || e.kind !== r.kind)].slice(0, R);
|
|
82
|
+
return p(L, t), t;
|
|
84
83
|
});
|
|
85
84
|
}, [
|
|
86
|
-
|
|
85
|
+
V,
|
|
87
86
|
T,
|
|
88
|
-
F,
|
|
89
|
-
L,
|
|
90
87
|
I,
|
|
88
|
+
R,
|
|
89
|
+
L,
|
|
91
90
|
_
|
|
92
91
|
]);
|
|
93
|
-
let
|
|
94
|
-
enabled:
|
|
92
|
+
let H = E?.pinnedItems?.enabled === !0, { pins: Ee, toggle: De, reorder: Oe } = oe({
|
|
93
|
+
enabled: H,
|
|
95
94
|
storageKey: E?.pinnedItems?.storageKey,
|
|
96
|
-
visibleEntityIds:
|
|
97
|
-
}),
|
|
98
|
-
|
|
99
|
-
let
|
|
100
|
-
E?.preferences?.storageKey != null && (
|
|
101
|
-
let { collapsedByGroupId:
|
|
102
|
-
groupIds:
|
|
95
|
+
visibleEntityIds: Te
|
|
96
|
+
}), U, W, G;
|
|
97
|
+
H && (U = Ee, W = De, G = Oe);
|
|
98
|
+
let K;
|
|
99
|
+
E?.preferences?.storageKey != null && (K = `${E.preferences.storageKey}:groups`);
|
|
100
|
+
let { collapsedByGroupId: q, setCollapsed: J } = se({
|
|
101
|
+
groupIds: Ce,
|
|
103
102
|
activeGroupId: g,
|
|
104
|
-
defaultCollapsedByGroupId:
|
|
103
|
+
defaultCollapsedByGroupId: we,
|
|
105
104
|
persist: E?.preferences?.persistGroups === !0,
|
|
106
|
-
storageKey:
|
|
107
|
-
}),
|
|
105
|
+
storageKey: K
|
|
106
|
+
}), ke = s(() => a({
|
|
108
107
|
basePath: C,
|
|
109
108
|
pathname: y,
|
|
110
109
|
entities: T,
|
|
@@ -114,30 +113,30 @@ var _e = "plumile:backoffice:recent-items", ve = "plumile:backoffice:sidebar", y
|
|
|
114
113
|
searchQuery: D,
|
|
115
114
|
tApp: _,
|
|
116
115
|
t: v,
|
|
117
|
-
pinnedEntityIds:
|
|
118
|
-
recentItems:
|
|
119
|
-
onTogglePin:
|
|
120
|
-
onReorderPin:
|
|
121
|
-
collapsedByGroupId:
|
|
122
|
-
onGroupCollapsedChange:
|
|
116
|
+
pinnedEntityIds: U,
|
|
117
|
+
recentItems: z,
|
|
118
|
+
onTogglePin: W,
|
|
119
|
+
onReorderPin: G,
|
|
120
|
+
collapsedByGroupId: q,
|
|
121
|
+
onGroupCollapsedChange: J,
|
|
123
122
|
sidebarCollapsed: !1
|
|
124
123
|
}), [
|
|
125
124
|
C,
|
|
126
|
-
|
|
125
|
+
q,
|
|
127
126
|
T,
|
|
128
127
|
w,
|
|
129
128
|
y,
|
|
130
129
|
m,
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
z,
|
|
131
|
+
J,
|
|
133
132
|
E,
|
|
134
|
-
|
|
133
|
+
U,
|
|
135
134
|
D,
|
|
135
|
+
G,
|
|
136
136
|
W,
|
|
137
|
-
U,
|
|
138
137
|
v,
|
|
139
138
|
_
|
|
140
|
-
]),
|
|
139
|
+
]), Ae = s(() => a({
|
|
141
140
|
basePath: C,
|
|
142
141
|
pathname: y,
|
|
143
142
|
entities: T,
|
|
@@ -147,30 +146,30 @@ var _e = "plumile:backoffice:recent-items", ve = "plumile:backoffice:sidebar", y
|
|
|
147
146
|
searchQuery: D,
|
|
148
147
|
tApp: _,
|
|
149
148
|
t: v,
|
|
150
|
-
pinnedEntityIds:
|
|
151
|
-
recentItems:
|
|
152
|
-
onTogglePin:
|
|
153
|
-
onReorderPin:
|
|
154
|
-
collapsedByGroupId:
|
|
155
|
-
onGroupCollapsedChange:
|
|
149
|
+
pinnedEntityIds: U,
|
|
150
|
+
recentItems: z,
|
|
151
|
+
onTogglePin: W,
|
|
152
|
+
onReorderPin: G,
|
|
153
|
+
collapsedByGroupId: q,
|
|
154
|
+
onGroupCollapsedChange: J,
|
|
156
155
|
sidebarCollapsed: !1
|
|
157
156
|
}), [
|
|
158
157
|
C,
|
|
159
|
-
|
|
158
|
+
q,
|
|
160
159
|
T,
|
|
161
160
|
w,
|
|
162
161
|
y,
|
|
163
162
|
m,
|
|
164
|
-
|
|
165
|
-
|
|
163
|
+
z,
|
|
164
|
+
J,
|
|
166
165
|
E,
|
|
167
|
-
|
|
166
|
+
U,
|
|
168
167
|
D,
|
|
168
|
+
G,
|
|
169
169
|
W,
|
|
170
|
-
U,
|
|
171
170
|
v,
|
|
172
171
|
_
|
|
173
|
-
]),
|
|
172
|
+
]), Y = le(() => {
|
|
174
173
|
j || (M(!0), (async () => {
|
|
175
174
|
try {
|
|
176
175
|
let e = await S.logout.load();
|
|
@@ -199,7 +198,7 @@ var _e = "plumile:backoffice:recent-items", ve = "plumile:backoffice:sidebar", y
|
|
|
199
198
|
]), X = h?.me ?? null, Z = s(() => ne({
|
|
200
199
|
viewer: X,
|
|
201
200
|
unknownUserLabel: v("sidebar.profile.unknownUser")
|
|
202
|
-
}), [v, X]),
|
|
201
|
+
}), [v, X]), je = /* @__PURE__ */ l(f, {
|
|
203
202
|
collapsed: !1,
|
|
204
203
|
viewer: Z,
|
|
205
204
|
labels: {
|
|
@@ -209,7 +208,7 @@ var _e = "plumile:backoffice:recent-items", ve = "plumile:backoffice:sidebar", y
|
|
|
209
208
|
},
|
|
210
209
|
onSignOut: Y,
|
|
211
210
|
isSigningOut: j
|
|
212
|
-
}),
|
|
211
|
+
}), Me = /* @__PURE__ */ l(f, {
|
|
213
212
|
collapsed: !1,
|
|
214
213
|
viewer: Z,
|
|
215
214
|
labels: {
|
|
@@ -221,34 +220,32 @@ var _e = "plumile:backoffice:recent-items", ve = "plumile:backoffice:sidebar", y
|
|
|
221
220
|
isSigningOut: j
|
|
222
221
|
}), Q = null;
|
|
223
222
|
N != null && (Q = /* @__PURE__ */ l(re, { children: u }));
|
|
224
|
-
let $ = /* @__PURE__ */ l(
|
|
223
|
+
let $ = /* @__PURE__ */ l(me, {
|
|
225
224
|
value: D,
|
|
226
|
-
onChange:
|
|
225
|
+
onChange: be,
|
|
227
226
|
placeholder: v("sidebar.search.placeholder"),
|
|
228
227
|
ariaLabel: v("sidebar.search.placeholder")
|
|
229
228
|
});
|
|
230
|
-
return /* @__PURE__ */ l(
|
|
229
|
+
return /* @__PURE__ */ l(d, { children: /* @__PURE__ */ l(ge, {
|
|
231
230
|
sidebar: {
|
|
232
|
-
sections:
|
|
233
|
-
header: /* @__PURE__ */ l(f, { environment: J }),
|
|
231
|
+
sections: ke,
|
|
234
232
|
search: $,
|
|
235
|
-
footer:
|
|
233
|
+
footer: je,
|
|
236
234
|
isCollapsed: A,
|
|
237
|
-
onCollapsedChange:
|
|
235
|
+
onCollapsedChange: xe,
|
|
238
236
|
collapseToggleLabel: v("sidebar.actions.collapseSidebar"),
|
|
239
237
|
expandToggleLabel: v("sidebar.actions.expandSidebar"),
|
|
240
238
|
navigationAriaLabel: v("sidebar.navigationAriaLabel")
|
|
241
239
|
},
|
|
242
240
|
mobileSidebar: {
|
|
243
|
-
sections:
|
|
244
|
-
header: /* @__PURE__ */ l(f, { environment: J }),
|
|
241
|
+
sections: Ae,
|
|
245
242
|
search: $,
|
|
246
|
-
footer:
|
|
243
|
+
footer: Me,
|
|
247
244
|
isCollapsed: !1,
|
|
248
245
|
hideCollapseToggle: !0,
|
|
249
246
|
navigationAriaLabel: v("sidebar.navigationAriaLabel")
|
|
250
247
|
},
|
|
251
|
-
topbar: { breadcrumb: /* @__PURE__ */ l("div", { ref:
|
|
248
|
+
topbar: { breadcrumb: /* @__PURE__ */ l("div", { ref: P }) },
|
|
252
249
|
contentScrollMode: "contained",
|
|
253
250
|
children: /* @__PURE__ */ l(te, {
|
|
254
251
|
permissions: m,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeLayoutPage.js","names":[],"sources":["../../../src/pages/BackofficeLayoutPage.tsx"],"sourcesContent":["import {\n useEffect,\n useMemo,\n type JSX,\n type ReactNode,\n useCallback,\n useContext,\n useState,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport {\n commitMutation,\n usePreloadedQuery,\n type PreloadedQuery,\n} from 'react-relay';\nimport type {\n GraphQLTaggedNode,\n MutationParameters,\n OperationType,\n} from 'relay-runtime';\nimport RoutingContext from '@plumile/router/routing/RoutingContext.js';\nimport useLocation from '@plumile/router/routing/useLocation.js';\n\nimport { AdminShellLayout } from '@plumile/ui/admin/templates/admin_shell_layout/AdminShellLayout.js';\nimport { ToastProvider } from '@plumile/ui/atomic/molecules/toast/ToastProvider.js';\nimport { EnvironmentBadge } from '@plumile/ui/backoffice/atoms/environment_badge/EnvironmentBadge.js';\nimport { GlobalSearchInput } from '@plumile/ui/backoffice/molecules/global_search_input/GlobalSearchInput.js';\nimport { SidebarProfileMenu } from '@plumile/ui/components/navigation/sidebar/SidebarProfileMenu.js';\n\nimport { useBackofficeReactTranslation } from '../i18n/useBackofficeReactTranslation.js';\nimport { useBackofficeConfig } from '../provider/BackofficeConfigContext.js';\nimport type { LogoutResponse, LogoutVariables } from '../hooks/useAuth.js';\nimport { useBackofficeSidebarPins } from '../hooks/useBackofficeSidebarPins.js';\nimport { useSidebarGroupCollapse } from '../hooks/useSidebarGroupCollapse.js';\nimport { buildSidebarSections } from '../components/backoffice/layout/buildSidebarSections.js';\nimport { BackofficeContentBoundary } from '../components/backoffice/routing/BackofficeContentBoundary.js';\nimport {\n resolveActiveEntityId,\n resolveSidebarGroups,\n resolveVisibleEntityIds,\n} from '../components/backoffice/layout/sidebarUtils.js';\nimport { BackofficeTopbarPortalContextProvider } from '../components/backoffice/layout/breadcrumb/BackofficeTopbarPortalContext.js';\nimport { BackofficePermissionsProvider } from '../components/backoffice/layout/BackofficePermissionsContext.js';\nimport {\n mapViewerToSidebarProfileView,\n type BackofficeViewerIdentity,\n} from '../components/backoffice/layout/mapViewerToSidebarProfileView.js';\nimport { resetRelayStore } from '../relay/environment.js';\nimport { useRelayEnvironment } from '../relay/useRelayEnvironment.js';\nimport { getBackofficeLoginPath } from '../router/backofficeAuthPaths.js';\nimport type { BackofficeSidebarRecentItem } from '../provider/types.js';\n\nexport type BackofficeLayoutPageProps = {\n children: ReactNode;\n permissionsQuery?: GraphQLTaggedNode;\n prepared?: PreloadedQuery<OperationType> | null;\n authStatus?: {\n isLoggedIn?: boolean | null;\n me?: BackofficeViewerIdentity | null;\n } | null;\n activeGroupId?: string | null;\n};\n\ntype LayoutShellProps = {\n children: ReactNode;\n permissions: unknown;\n authStatus?: {\n isLoggedIn?: boolean | null;\n me?: BackofficeViewerIdentity | null;\n } | null;\n activeGroupId?: string | null;\n};\n\nconst DEFAULT_RECENT_ITEMS_STORAGE_KEY = 'plumile:backoffice:recent-items';\nconst DEFAULT_SIDEBAR_PREFS_STORAGE_KEY = 'plumile:backoffice:sidebar';\n\nconst readRecentItems = (\n storageKey: string,\n): readonly BackofficeSidebarRecentItem[] => {\n if (typeof window === 'undefined') {\n return [];\n }\n try {\n const raw = window.localStorage.getItem(storageKey);\n if (raw == null) {\n return [];\n }\n const parsed = JSON.parse(raw) as unknown;\n if (!Array.isArray(parsed)) {\n return [];\n }\n return parsed.filter((item): item is BackofficeSidebarRecentItem => {\n if (item == null || typeof item !== 'object') {\n return false;\n }\n const candidate = item as Partial<BackofficeSidebarRecentItem>;\n return (\n (candidate.kind === 'entity' || candidate.kind === 'tool') &&\n typeof candidate.id === 'string' &&\n typeof candidate.label === 'string' &&\n typeof candidate.href === 'string' &&\n typeof candidate.visitedAt === 'number'\n );\n });\n } catch {\n return [];\n }\n};\n\nconst writeRecentItems = (\n storageKey: string,\n items: readonly BackofficeSidebarRecentItem[],\n): void => {\n if (typeof window === 'undefined') {\n return;\n }\n try {\n window.localStorage.setItem(storageKey, JSON.stringify(items));\n } catch {\n // Ignore storage quota / privacy mode failures.\n }\n};\n\nconst BackofficeLayoutShell = ({\n children,\n permissions,\n authStatus,\n activeGroupId,\n}: LayoutShellProps): JSX.Element => {\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n const { pathname } = useLocation();\n const routing = useContext(RoutingContext);\n const relayEnvironment = useRelayEnvironment();\n const {\n auth: authConfig,\n basePath,\n dashboards,\n entities,\n sidebar,\n } = useBackofficeConfig();\n const [sidebarQuery, setSidebarQuery] = useState('');\n const sidebarPreferencesStorageKey =\n sidebar?.preferences?.storageKey ?? DEFAULT_SIDEBAR_PREFS_STORAGE_KEY;\n const persistSidebarCollapsed =\n sidebar?.preferences?.persistCollapsed === true;\n const [isSidebarCollapsed, setIsSidebarCollapsed] = useState(() => {\n if (!persistSidebarCollapsed || typeof window === 'undefined') {\n return false;\n }\n try {\n return (\n window.localStorage.getItem(\n `${sidebarPreferencesStorageKey}:collapsed`,\n ) === 'true'\n );\n } catch {\n return false;\n }\n });\n const [isSigningOut, setIsSigningOut] = useState(false);\n const [topbarTarget, setTopbarTarget] = useState<HTMLDivElement | null>(null);\n const recentItemsConfig = sidebar?.recentItems;\n const recentItemsEnabled = recentItemsConfig?.enabled === true;\n const recentItemsStorageKey =\n recentItemsConfig?.storageKey ?? DEFAULT_RECENT_ITEMS_STORAGE_KEY;\n const recentItemsMaxItems = recentItemsConfig?.maxItems ?? 8;\n const [recentItems, setRecentItems] = useState<\n readonly BackofficeSidebarRecentItem[]\n >(() => {\n if (!recentItemsEnabled) {\n return [];\n }\n return readRecentItems(recentItemsStorageKey);\n });\n\n useEffect(() => {\n if (!persistSidebarCollapsed || typeof window === 'undefined') {\n return;\n }\n try {\n window.localStorage.setItem(\n `${sidebarPreferencesStorageKey}:collapsed`,\n String(isSidebarCollapsed),\n );\n } catch {\n // Ignore storage quota / privacy mode failures.\n }\n }, [\n isSidebarCollapsed,\n persistSidebarCollapsed,\n sidebarPreferencesStorageKey,\n ]);\n\n const groups = useMemo(() => {\n return resolveSidebarGroups(entities, sidebar);\n }, [entities, sidebar]);\n\n const groupIds = useMemo(() => {\n return Object.keys(groups);\n }, [groups]);\n\n const defaultCollapsedByGroupId = useMemo(() => {\n return Object.fromEntries(\n Object.entries(groups).map(([groupId, group]) => {\n return [groupId, group.behavior?.defaultCollapsed ?? true];\n }),\n );\n }, [groups]);\n\n const visibleEntityIds = useMemo(() => {\n return resolveVisibleEntityIds(groups, entities, sidebar, permissions);\n }, [entities, groups, permissions, sidebar]);\n\n const activeEntityId = useMemo(() => {\n return resolveActiveEntityId(pathname, entities);\n }, [entities, pathname]);\n\n useEffect(() => {\n if (!recentItemsEnabled || activeEntityId == null) {\n return;\n }\n const config = entities[activeEntityId];\n if (config == null) {\n return;\n }\n if (config.kind !== 'tool' && !config.hasList) {\n return;\n }\n const href = config.routes.list;\n let kind: BackofficeSidebarRecentItem['kind'] = 'entity';\n if (config.kind === 'tool') {\n kind = 'tool';\n }\n const item: BackofficeSidebarRecentItem = {\n kind,\n id: activeEntityId,\n label: config.label(tApp),\n href,\n visitedAt: Date.now(),\n };\n setRecentItems((prev) => {\n const next = [\n item,\n ...prev.filter((entry) => {\n return entry.id !== item.id || entry.kind !== item.kind;\n }),\n ].slice(0, recentItemsMaxItems);\n writeRecentItems(recentItemsStorageKey, next);\n return next;\n });\n }, [\n activeEntityId,\n entities,\n recentItemsEnabled,\n recentItemsMaxItems,\n recentItemsStorageKey,\n tApp,\n ]);\n\n const pinningEnabled = sidebar?.pinnedItems?.enabled === true;\n\n const {\n pins,\n toggle: togglePin,\n reorder: reorderPin,\n } = useBackofficeSidebarPins({\n enabled: pinningEnabled,\n storageKey: sidebar?.pinnedItems?.storageKey,\n visibleEntityIds,\n });\n\n let sidebarPinnedEntityIds: readonly string[] | undefined;\n let sidebarTogglePin: ((entityId: string) => void) | undefined;\n let sidebarReorderPin: ((fromId: string, toId: string) => void) | undefined;\n if (pinningEnabled) {\n sidebarPinnedEntityIds = pins;\n sidebarTogglePin = togglePin;\n sidebarReorderPin = reorderPin;\n }\n\n let groupCollapseStorageKey: string | undefined;\n if (sidebar?.preferences?.storageKey != null) {\n groupCollapseStorageKey = `${sidebar.preferences.storageKey}:groups`;\n }\n\n const { collapsedByGroupId, setCollapsed } = useSidebarGroupCollapse({\n groupIds,\n activeGroupId,\n defaultCollapsedByGroupId,\n persist: sidebar?.preferences?.persistGroups === true,\n storageKey: groupCollapseStorageKey,\n });\n\n const sections = useMemo(() => {\n return buildSidebarSections({\n basePath,\n pathname,\n entities,\n dashboards,\n sidebar,\n permissions,\n searchQuery: sidebarQuery,\n tApp,\n t,\n pinnedEntityIds: sidebarPinnedEntityIds,\n recentItems,\n onTogglePin: sidebarTogglePin,\n onReorderPin: sidebarReorderPin,\n collapsedByGroupId,\n onGroupCollapsedChange: setCollapsed,\n sidebarCollapsed: false,\n });\n }, [\n basePath,\n collapsedByGroupId,\n entities,\n dashboards,\n pathname,\n permissions,\n recentItems,\n setCollapsed,\n sidebar,\n sidebarPinnedEntityIds,\n sidebarQuery,\n sidebarReorderPin,\n sidebarTogglePin,\n t,\n tApp,\n ]);\n\n const mobileSections = useMemo(() => {\n return buildSidebarSections({\n basePath,\n pathname,\n entities,\n dashboards,\n sidebar,\n permissions,\n searchQuery: sidebarQuery,\n tApp,\n t,\n pinnedEntityIds: sidebarPinnedEntityIds,\n recentItems,\n onTogglePin: sidebarTogglePin,\n onReorderPin: sidebarReorderPin,\n collapsedByGroupId,\n onGroupCollapsedChange: setCollapsed,\n sidebarCollapsed: false,\n });\n }, [\n basePath,\n collapsedByGroupId,\n entities,\n dashboards,\n pathname,\n permissions,\n recentItems,\n setCollapsed,\n sidebar,\n sidebarPinnedEntityIds,\n sidebarQuery,\n sidebarReorderPin,\n sidebarTogglePin,\n t,\n tApp,\n ]);\n\n const environment = useMemo(() => {\n const meta = import.meta as unknown as { env?: Record<string, unknown> };\n if (meta.env?.DEV === true) {\n return 'dev' as const;\n }\n return 'prod' as const;\n }, []);\n\n const handleSignOut = useCallback(() => {\n if (isSigningOut) {\n return;\n }\n\n type LogoutMutation = MutationParameters & {\n response: LogoutResponse;\n variables: LogoutVariables;\n };\n\n setIsSigningOut(true);\n\n const runSignOut = async (): Promise<void> => {\n try {\n const config = await authConfig.logout.load();\n await new Promise<void>((resolve, reject) => {\n commitMutation<LogoutMutation>(relayEnvironment, {\n mutation: config.logoutMutation,\n variables: {},\n onCompleted: () => {\n resolve();\n },\n onError: (error) => {\n reject(error);\n },\n });\n });\n localStorage.removeItem('auth_token');\n localStorage.removeItem('remember_me');\n resetRelayStore();\n routing?.history.push({ pathname: getBackofficeLoginPath(basePath) });\n } finally {\n setIsSigningOut(false);\n }\n };\n\n runSignOut().catch(() => {\n /* noop */\n });\n }, [authConfig.logout, basePath, isSigningOut, relayEnvironment, routing]);\n\n const viewer = authStatus?.me ?? null;\n const sidebarProfile = useMemo(() => {\n return mapViewerToSidebarProfileView({\n viewer,\n unknownUserLabel: t('sidebar.profile.unknownUser'),\n });\n }, [t, viewer]);\n\n const sidebarFooter = (\n <SidebarProfileMenu\n collapsed={false}\n viewer={sidebarProfile}\n labels={{\n sectionTitle: t('sidebar.profile.title'),\n menuAriaLabel: t('sidebar.profile.menuAriaLabel'),\n signOut: t('sidebar.profile.actions.signOut'),\n }}\n onSignOut={handleSignOut}\n isSigningOut={isSigningOut}\n />\n );\n\n const mobileSidebarFooter = (\n <SidebarProfileMenu\n collapsed={false}\n viewer={sidebarProfile}\n labels={{\n sectionTitle: t('sidebar.profile.title'),\n menuAriaLabel: t('sidebar.profile.menuAriaLabel'),\n signOut: t('sidebar.profile.actions.signOut'),\n }}\n onSignOut={handleSignOut}\n isSigningOut={isSigningOut}\n />\n );\n\n let contentNode: JSX.Element | null = null;\n if (topbarTarget != null) {\n contentNode = (\n <BackofficeContentBoundary>{children}</BackofficeContentBoundary>\n );\n }\n\n const sidebarSearchNode = (\n <GlobalSearchInput\n value={sidebarQuery}\n onChange={setSidebarQuery}\n placeholder={t('sidebar.search.placeholder')}\n ariaLabel={t('sidebar.search.placeholder')}\n />\n );\n\n return (\n <ToastProvider>\n <AdminShellLayout\n sidebar={{\n sections,\n header: <EnvironmentBadge environment={environment} />,\n search: sidebarSearchNode,\n footer: sidebarFooter,\n isCollapsed: isSidebarCollapsed,\n onCollapsedChange: setIsSidebarCollapsed,\n collapseToggleLabel: t('sidebar.actions.collapseSidebar'),\n expandToggleLabel: t('sidebar.actions.expandSidebar'),\n navigationAriaLabel: t('sidebar.navigationAriaLabel'),\n }}\n mobileSidebar={{\n sections: mobileSections,\n header: <EnvironmentBadge environment={environment} />,\n search: sidebarSearchNode,\n footer: mobileSidebarFooter,\n isCollapsed: false,\n hideCollapseToggle: true,\n navigationAriaLabel: t('sidebar.navigationAriaLabel'),\n }}\n topbar={{\n breadcrumb: <div ref={setTopbarTarget} />,\n }}\n contentScrollMode=\"contained\"\n >\n <BackofficePermissionsProvider permissions={permissions}>\n <BackofficeTopbarPortalContextProvider\n value={{\n target: topbarTarget,\n dashboardHref: basePath,\n dashboardLabel: t('sidebar.items.dashboard'),\n }}\n >\n {contentNode}\n </BackofficeTopbarPortalContextProvider>\n </BackofficePermissionsProvider>\n </AdminShellLayout>\n </ToastProvider>\n );\n};\n\ntype LayoutWithPermissionsProps = {\n children: ReactNode;\n permissionsQuery: GraphQLTaggedNode;\n prepared: PreloadedQuery<OperationType>;\n authStatus?: {\n isLoggedIn?: boolean | null;\n me?: BackofficeViewerIdentity | null;\n } | null;\n activeGroupId?: string | null;\n};\n\nconst LayoutWithPermissions = ({\n children,\n permissionsQuery,\n prepared,\n authStatus,\n activeGroupId,\n}: LayoutWithPermissionsProps): JSX.Element => {\n const permissions = usePreloadedQuery(permissionsQuery, prepared);\n\n return (\n <BackofficeLayoutShell\n permissions={permissions}\n authStatus={authStatus}\n activeGroupId={activeGroupId}\n >\n {children}\n </BackofficeLayoutShell>\n );\n};\n\nexport const BackofficeLayoutPage = ({\n children,\n permissionsQuery,\n prepared,\n authStatus,\n activeGroupId,\n}: BackofficeLayoutPageProps): JSX.Element => {\n if (permissionsQuery != null && prepared != null) {\n return (\n <LayoutWithPermissions\n permissionsQuery={permissionsQuery}\n prepared={prepared}\n authStatus={authStatus}\n activeGroupId={activeGroupId}\n >\n {children}\n </LayoutWithPermissions>\n );\n }\n\n return (\n <BackofficeLayoutShell\n permissions={null}\n authStatus={authStatus}\n activeGroupId={activeGroupId}\n >\n {children}\n </BackofficeLayoutShell>\n );\n};\n\nexport default BackofficeLayoutPage;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyEA,IAAM,KAAmC,mCACnC,KAAoC,8BAEpC,MACJ,MAC2C;CAC3C,IAAI,OAAO,SAAW,KACpB,OAAO,CAAC;CAEV,IAAI;EACF,IAAM,IAAM,OAAO,aAAa,QAAQ,CAAU;EAClD,IAAI,KAAO,MACT,OAAO,CAAC;EAEV,IAAM,IAAS,KAAK,MAAM,CAAG;EAI7B,OAHK,MAAM,QAAQ,CAAM,IAGlB,EAAO,QAAQ,MAA8C;GAClE,IAAoB,OAAO,KAAS,aAAhC,GACF,OAAO;GAET,IAAM,IAAY;GAClB,QACG,EAAU,SAAS,YAAY,EAAU,SAAS,WACnD,OAAO,EAAU,MAAO,YACxB,OAAO,EAAU,SAAU,YAC3B,OAAO,EAAU,QAAS,YAC1B,OAAO,EAAU,aAAc;EAEnC,CAAC,IAdQ,CAAC;CAeZ,QAAQ;EACN,OAAO,CAAC;CACV;AACF,GAEM,MACJ,GACA,MACS;CACL,aAAO,SAAW,MAGtB,IAAI;EACF,OAAO,aAAa,QAAQ,GAAY,KAAK,UAAU,CAAK,CAAC;CAC/D,QAAQ,CAER;AACF,GAEM,KAAyB,EAC7B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B,CAAA,GAId,KAAwB,EACnC,aACA,qBACA,aACA,eACA,uBAEI,KAAoB,QAAQ,KAAY,OAExC,kBAAC,GAAD;CACoB;CACR;CACE;CACG;CAEd;AACoB,CAAA,IAKzB,kBAAC,GAAD;CACE,aAAa;CACD;CACG;CAEd;AACoB,CAAA"}
|
|
1
|
+
{"version":3,"file":"BackofficeLayoutPage.js","names":[],"sources":["../../../src/pages/BackofficeLayoutPage.tsx"],"sourcesContent":["import {\n useEffect,\n useMemo,\n type JSX,\n type ReactNode,\n useCallback,\n useContext,\n useState,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport {\n commitMutation,\n usePreloadedQuery,\n type PreloadedQuery,\n} from 'react-relay';\nimport type {\n GraphQLTaggedNode,\n MutationParameters,\n OperationType,\n} from 'relay-runtime';\nimport RoutingContext from '@plumile/router/routing/RoutingContext.js';\nimport useLocation from '@plumile/router/routing/useLocation.js';\n\nimport { AdminShellLayout } from '@plumile/ui/admin/templates/admin_shell_layout/AdminShellLayout.js';\nimport { ToastProvider } from '@plumile/ui/atomic/molecules/toast/ToastProvider.js';\nimport { GlobalSearchInput } from '@plumile/ui/backoffice/molecules/global_search_input/GlobalSearchInput.js';\nimport { SidebarProfileMenu } from '@plumile/ui/components/navigation/sidebar/SidebarProfileMenu.js';\n\nimport { useBackofficeReactTranslation } from '../i18n/useBackofficeReactTranslation.js';\nimport { useBackofficeConfig } from '../provider/BackofficeConfigContext.js';\nimport type { LogoutResponse, LogoutVariables } from '../hooks/useAuth.js';\nimport { useBackofficeSidebarPins } from '../hooks/useBackofficeSidebarPins.js';\nimport { useSidebarGroupCollapse } from '../hooks/useSidebarGroupCollapse.js';\nimport { buildSidebarSections } from '../components/backoffice/layout/buildSidebarSections.js';\nimport { BackofficeContentBoundary } from '../components/backoffice/routing/BackofficeContentBoundary.js';\nimport {\n resolveActiveEntityId,\n resolveSidebarGroups,\n resolveVisibleEntityIds,\n} from '../components/backoffice/layout/sidebarUtils.js';\nimport { BackofficeTopbarPortalContextProvider } from '../components/backoffice/layout/breadcrumb/BackofficeTopbarPortalContext.js';\nimport { BackofficePermissionsProvider } from '../components/backoffice/layout/BackofficePermissionsContext.js';\nimport {\n mapViewerToSidebarProfileView,\n type BackofficeViewerIdentity,\n} from '../components/backoffice/layout/mapViewerToSidebarProfileView.js';\nimport { resetRelayStore } from '../relay/environment.js';\nimport { useRelayEnvironment } from '../relay/useRelayEnvironment.js';\nimport { getBackofficeLoginPath } from '../router/backofficeAuthPaths.js';\nimport type { BackofficeSidebarRecentItem } from '../provider/types.js';\n\nexport type BackofficeLayoutPageProps = {\n children: ReactNode;\n permissionsQuery?: GraphQLTaggedNode;\n prepared?: PreloadedQuery<OperationType> | null;\n authStatus?: {\n isLoggedIn?: boolean | null;\n me?: BackofficeViewerIdentity | null;\n } | null;\n activeGroupId?: string | null;\n};\n\ntype LayoutShellProps = {\n children: ReactNode;\n permissions: unknown;\n authStatus?: {\n isLoggedIn?: boolean | null;\n me?: BackofficeViewerIdentity | null;\n } | null;\n activeGroupId?: string | null;\n};\n\nconst DEFAULT_RECENT_ITEMS_STORAGE_KEY = 'plumile:backoffice:recent-items';\nconst DEFAULT_SIDEBAR_PREFS_STORAGE_KEY = 'plumile:backoffice:sidebar';\n\nconst readRecentItems = (\n storageKey: string,\n): readonly BackofficeSidebarRecentItem[] => {\n if (typeof window === 'undefined') {\n return [];\n }\n try {\n const raw = window.localStorage.getItem(storageKey);\n if (raw == null) {\n return [];\n }\n const parsed = JSON.parse(raw) as unknown;\n if (!Array.isArray(parsed)) {\n return [];\n }\n return parsed.filter((item): item is BackofficeSidebarRecentItem => {\n if (item == null || typeof item !== 'object') {\n return false;\n }\n const candidate = item as Partial<BackofficeSidebarRecentItem>;\n return (\n (candidate.kind === 'entity' || candidate.kind === 'tool') &&\n typeof candidate.id === 'string' &&\n typeof candidate.label === 'string' &&\n typeof candidate.href === 'string' &&\n typeof candidate.visitedAt === 'number'\n );\n });\n } catch {\n return [];\n }\n};\n\nconst writeRecentItems = (\n storageKey: string,\n items: readonly BackofficeSidebarRecentItem[],\n): void => {\n if (typeof window === 'undefined') {\n return;\n }\n try {\n window.localStorage.setItem(storageKey, JSON.stringify(items));\n } catch {\n // Ignore storage quota / privacy mode failures.\n }\n};\n\nconst BackofficeLayoutShell = ({\n children,\n permissions,\n authStatus,\n activeGroupId,\n}: LayoutShellProps): JSX.Element => {\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n const { pathname } = useLocation();\n const routing = useContext(RoutingContext);\n const relayEnvironment = useRelayEnvironment();\n const {\n auth: authConfig,\n basePath,\n dashboards,\n entities,\n sidebar,\n } = useBackofficeConfig();\n const [sidebarQuery, setSidebarQuery] = useState('');\n const sidebarPreferencesStorageKey =\n sidebar?.preferences?.storageKey ?? DEFAULT_SIDEBAR_PREFS_STORAGE_KEY;\n const persistSidebarCollapsed =\n sidebar?.preferences?.persistCollapsed === true;\n const [isSidebarCollapsed, setIsSidebarCollapsed] = useState(() => {\n if (!persistSidebarCollapsed || typeof window === 'undefined') {\n return false;\n }\n try {\n return (\n window.localStorage.getItem(\n `${sidebarPreferencesStorageKey}:collapsed`,\n ) === 'true'\n );\n } catch {\n return false;\n }\n });\n const [isSigningOut, setIsSigningOut] = useState(false);\n const [topbarTarget, setTopbarTarget] = useState<HTMLDivElement | null>(null);\n const recentItemsConfig = sidebar?.recentItems;\n const recentItemsEnabled = recentItemsConfig?.enabled === true;\n const recentItemsStorageKey =\n recentItemsConfig?.storageKey ?? DEFAULT_RECENT_ITEMS_STORAGE_KEY;\n const recentItemsMaxItems = recentItemsConfig?.maxItems ?? 8;\n const [recentItems, setRecentItems] = useState<\n readonly BackofficeSidebarRecentItem[]\n >(() => {\n if (!recentItemsEnabled) {\n return [];\n }\n return readRecentItems(recentItemsStorageKey);\n });\n\n useEffect(() => {\n if (!persistSidebarCollapsed || typeof window === 'undefined') {\n return;\n }\n try {\n window.localStorage.setItem(\n `${sidebarPreferencesStorageKey}:collapsed`,\n String(isSidebarCollapsed),\n );\n } catch {\n // Ignore storage quota / privacy mode failures.\n }\n }, [\n isSidebarCollapsed,\n persistSidebarCollapsed,\n sidebarPreferencesStorageKey,\n ]);\n\n const groups = useMemo(() => {\n return resolveSidebarGroups(entities, sidebar);\n }, [entities, sidebar]);\n\n const groupIds = useMemo(() => {\n return Object.keys(groups);\n }, [groups]);\n\n const defaultCollapsedByGroupId = useMemo(() => {\n return Object.fromEntries(\n Object.entries(groups).map(([groupId, group]) => {\n return [groupId, group.behavior?.defaultCollapsed ?? true];\n }),\n );\n }, [groups]);\n\n const visibleEntityIds = useMemo(() => {\n return resolveVisibleEntityIds(groups, entities, sidebar, permissions);\n }, [entities, groups, permissions, sidebar]);\n\n const activeEntityId = useMemo(() => {\n return resolveActiveEntityId(pathname, entities);\n }, [entities, pathname]);\n\n useEffect(() => {\n if (!recentItemsEnabled || activeEntityId == null) {\n return;\n }\n const config = entities[activeEntityId];\n if (config == null) {\n return;\n }\n if (config.kind !== 'tool' && !config.hasList) {\n return;\n }\n const href = config.routes.list;\n let kind: BackofficeSidebarRecentItem['kind'] = 'entity';\n if (config.kind === 'tool') {\n kind = 'tool';\n }\n const item: BackofficeSidebarRecentItem = {\n kind,\n id: activeEntityId,\n label: config.label(tApp),\n href,\n visitedAt: Date.now(),\n };\n setRecentItems((prev) => {\n const next = [\n item,\n ...prev.filter((entry) => {\n return entry.id !== item.id || entry.kind !== item.kind;\n }),\n ].slice(0, recentItemsMaxItems);\n writeRecentItems(recentItemsStorageKey, next);\n return next;\n });\n }, [\n activeEntityId,\n entities,\n recentItemsEnabled,\n recentItemsMaxItems,\n recentItemsStorageKey,\n tApp,\n ]);\n\n const pinningEnabled = sidebar?.pinnedItems?.enabled === true;\n\n const {\n pins,\n toggle: togglePin,\n reorder: reorderPin,\n } = useBackofficeSidebarPins({\n enabled: pinningEnabled,\n storageKey: sidebar?.pinnedItems?.storageKey,\n visibleEntityIds,\n });\n\n let sidebarPinnedEntityIds: readonly string[] | undefined;\n let sidebarTogglePin: ((entityId: string) => void) | undefined;\n let sidebarReorderPin: ((fromId: string, toId: string) => void) | undefined;\n if (pinningEnabled) {\n sidebarPinnedEntityIds = pins;\n sidebarTogglePin = togglePin;\n sidebarReorderPin = reorderPin;\n }\n\n let groupCollapseStorageKey: string | undefined;\n if (sidebar?.preferences?.storageKey != null) {\n groupCollapseStorageKey = `${sidebar.preferences.storageKey}:groups`;\n }\n\n const { collapsedByGroupId, setCollapsed } = useSidebarGroupCollapse({\n groupIds,\n activeGroupId,\n defaultCollapsedByGroupId,\n persist: sidebar?.preferences?.persistGroups === true,\n storageKey: groupCollapseStorageKey,\n });\n\n const sections = useMemo(() => {\n return buildSidebarSections({\n basePath,\n pathname,\n entities,\n dashboards,\n sidebar,\n permissions,\n searchQuery: sidebarQuery,\n tApp,\n t,\n pinnedEntityIds: sidebarPinnedEntityIds,\n recentItems,\n onTogglePin: sidebarTogglePin,\n onReorderPin: sidebarReorderPin,\n collapsedByGroupId,\n onGroupCollapsedChange: setCollapsed,\n sidebarCollapsed: false,\n });\n }, [\n basePath,\n collapsedByGroupId,\n entities,\n dashboards,\n pathname,\n permissions,\n recentItems,\n setCollapsed,\n sidebar,\n sidebarPinnedEntityIds,\n sidebarQuery,\n sidebarReorderPin,\n sidebarTogglePin,\n t,\n tApp,\n ]);\n\n const mobileSections = useMemo(() => {\n return buildSidebarSections({\n basePath,\n pathname,\n entities,\n dashboards,\n sidebar,\n permissions,\n searchQuery: sidebarQuery,\n tApp,\n t,\n pinnedEntityIds: sidebarPinnedEntityIds,\n recentItems,\n onTogglePin: sidebarTogglePin,\n onReorderPin: sidebarReorderPin,\n collapsedByGroupId,\n onGroupCollapsedChange: setCollapsed,\n sidebarCollapsed: false,\n });\n }, [\n basePath,\n collapsedByGroupId,\n entities,\n dashboards,\n pathname,\n permissions,\n recentItems,\n setCollapsed,\n sidebar,\n sidebarPinnedEntityIds,\n sidebarQuery,\n sidebarReorderPin,\n sidebarTogglePin,\n t,\n tApp,\n ]);\n\n const handleSignOut = useCallback(() => {\n if (isSigningOut) {\n return;\n }\n\n type LogoutMutation = MutationParameters & {\n response: LogoutResponse;\n variables: LogoutVariables;\n };\n\n setIsSigningOut(true);\n\n const runSignOut = async (): Promise<void> => {\n try {\n const config = await authConfig.logout.load();\n await new Promise<void>((resolve, reject) => {\n commitMutation<LogoutMutation>(relayEnvironment, {\n mutation: config.logoutMutation,\n variables: {},\n onCompleted: () => {\n resolve();\n },\n onError: (error) => {\n reject(error);\n },\n });\n });\n localStorage.removeItem('auth_token');\n localStorage.removeItem('remember_me');\n resetRelayStore();\n routing?.history.push({ pathname: getBackofficeLoginPath(basePath) });\n } finally {\n setIsSigningOut(false);\n }\n };\n\n runSignOut().catch(() => {\n /* noop */\n });\n }, [authConfig.logout, basePath, isSigningOut, relayEnvironment, routing]);\n\n const viewer = authStatus?.me ?? null;\n const sidebarProfile = useMemo(() => {\n return mapViewerToSidebarProfileView({\n viewer,\n unknownUserLabel: t('sidebar.profile.unknownUser'),\n });\n }, [t, viewer]);\n\n const sidebarFooter = (\n <SidebarProfileMenu\n collapsed={false}\n viewer={sidebarProfile}\n labels={{\n sectionTitle: t('sidebar.profile.title'),\n menuAriaLabel: t('sidebar.profile.menuAriaLabel'),\n signOut: t('sidebar.profile.actions.signOut'),\n }}\n onSignOut={handleSignOut}\n isSigningOut={isSigningOut}\n />\n );\n\n const mobileSidebarFooter = (\n <SidebarProfileMenu\n collapsed={false}\n viewer={sidebarProfile}\n labels={{\n sectionTitle: t('sidebar.profile.title'),\n menuAriaLabel: t('sidebar.profile.menuAriaLabel'),\n signOut: t('sidebar.profile.actions.signOut'),\n }}\n onSignOut={handleSignOut}\n isSigningOut={isSigningOut}\n />\n );\n\n let contentNode: JSX.Element | null = null;\n if (topbarTarget != null) {\n contentNode = (\n <BackofficeContentBoundary>{children}</BackofficeContentBoundary>\n );\n }\n\n const sidebarSearchNode = (\n <GlobalSearchInput\n value={sidebarQuery}\n onChange={setSidebarQuery}\n placeholder={t('sidebar.search.placeholder')}\n ariaLabel={t('sidebar.search.placeholder')}\n />\n );\n\n return (\n <ToastProvider>\n <AdminShellLayout\n sidebar={{\n sections,\n search: sidebarSearchNode,\n footer: sidebarFooter,\n isCollapsed: isSidebarCollapsed,\n onCollapsedChange: setIsSidebarCollapsed,\n collapseToggleLabel: t('sidebar.actions.collapseSidebar'),\n expandToggleLabel: t('sidebar.actions.expandSidebar'),\n navigationAriaLabel: t('sidebar.navigationAriaLabel'),\n }}\n mobileSidebar={{\n sections: mobileSections,\n search: sidebarSearchNode,\n footer: mobileSidebarFooter,\n isCollapsed: false,\n hideCollapseToggle: true,\n navigationAriaLabel: t('sidebar.navigationAriaLabel'),\n }}\n topbar={{\n breadcrumb: <div ref={setTopbarTarget} />,\n }}\n contentScrollMode=\"contained\"\n >\n <BackofficePermissionsProvider permissions={permissions}>\n <BackofficeTopbarPortalContextProvider\n value={{\n target: topbarTarget,\n dashboardHref: basePath,\n dashboardLabel: t('sidebar.items.dashboard'),\n }}\n >\n {contentNode}\n </BackofficeTopbarPortalContextProvider>\n </BackofficePermissionsProvider>\n </AdminShellLayout>\n </ToastProvider>\n );\n};\n\ntype LayoutWithPermissionsProps = {\n children: ReactNode;\n permissionsQuery: GraphQLTaggedNode;\n prepared: PreloadedQuery<OperationType>;\n authStatus?: {\n isLoggedIn?: boolean | null;\n me?: BackofficeViewerIdentity | null;\n } | null;\n activeGroupId?: string | null;\n};\n\nconst LayoutWithPermissions = ({\n children,\n permissionsQuery,\n prepared,\n authStatus,\n activeGroupId,\n}: LayoutWithPermissionsProps): JSX.Element => {\n const permissions = usePreloadedQuery(permissionsQuery, prepared);\n\n return (\n <BackofficeLayoutShell\n permissions={permissions}\n authStatus={authStatus}\n activeGroupId={activeGroupId}\n >\n {children}\n </BackofficeLayoutShell>\n );\n};\n\nexport const BackofficeLayoutPage = ({\n children,\n permissionsQuery,\n prepared,\n authStatus,\n activeGroupId,\n}: BackofficeLayoutPageProps): JSX.Element => {\n if (permissionsQuery != null && prepared != null) {\n return (\n <LayoutWithPermissions\n permissionsQuery={permissionsQuery}\n prepared={prepared}\n authStatus={authStatus}\n activeGroupId={activeGroupId}\n >\n {children}\n </LayoutWithPermissions>\n );\n }\n\n return (\n <BackofficeLayoutShell\n permissions={null}\n authStatus={authStatus}\n activeGroupId={activeGroupId}\n >\n {children}\n </BackofficeLayoutShell>\n );\n};\n\nexport default BackofficeLayoutPage;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwEA,IAAM,KAAmC,mCACnC,KAAoC,8BAEpC,MACJ,MAC2C;CAC3C,IAAI,OAAO,SAAW,KACpB,OAAO,CAAC;CAEV,IAAI;EACF,IAAM,IAAM,OAAO,aAAa,QAAQ,CAAU;EAClD,IAAI,KAAO,MACT,OAAO,CAAC;EAEV,IAAM,IAAS,KAAK,MAAM,CAAG;EAI7B,OAHK,MAAM,QAAQ,CAAM,IAGlB,EAAO,QAAQ,MAA8C;GAClE,IAAoB,OAAO,KAAS,aAAhC,GACF,OAAO;GAET,IAAM,IAAY;GAClB,QACG,EAAU,SAAS,YAAY,EAAU,SAAS,WACnD,OAAO,EAAU,MAAO,YACxB,OAAO,EAAU,SAAU,YAC3B,OAAO,EAAU,QAAS,YAC1B,OAAO,EAAU,aAAc;EAEnC,CAAC,IAdQ,CAAC;CAeZ,QAAQ;EACN,OAAO,CAAC;CACV;AACF,GAEM,KACJ,GACA,MACS;CACL,aAAO,SAAW,MAGtB,IAAI;EACF,OAAO,aAAa,QAAQ,GAAY,KAAK,UAAU,CAAK,CAAC;CAC/D,QAAQ,CAER;AACF,GAEM,KAAyB,EAC7B,aACA,gBACA,eACA,uBACmC;CACnC,IAAM,EAAE,GAAG,MAAS,GAAe,GAC7B,EAAE,SAAM,EAA8B,GACtC,EAAE,gBAAa,GAAY,GAC3B,IAAU,GAAW,EAAc,GACnC,IAAmB,GAAoB,GACvC,EACJ,MAAM,GACN,aACA,eACA,aACA,eACE,EAAoB,GAClB,CAAC,GAAc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AgB,SAClB,IACE,kBAAC,IAAD,EAA4B,YAAoC,CAAA;CAIpE,IAAM,IACJ,kBAAC,IAAD;EACE,OAAO;EACP,UAAU;EACV,aAAa,EAAE,4BAA4B;EAC3C,WAAW,EAAE,4BAA4B;CAC1C,CAAA;CAGH,OACE,kBAAC,GAAD,EAAA,UACE,kBAAC,IAAD;EACE,SAAS;GACP;GACA,QAAQ;GACR,QAAQ;GACR,aAAa;GACb,mBAAmB;GACnB,qBAAqB,EAAE,iCAAiC;GACxD,mBAAmB,EAAE,+BAA+B;GACpD,qBAAqB,EAAE,6BAA6B;EACtD;EACA,eAAe;GACb,UAAU;GACV,QAAQ;GACR,QAAQ;GACR,aAAa;GACb,oBAAoB;GACpB,qBAAqB,EAAE,6BAA6B;EACtD;EACA,QAAQ,EACN,YAAY,kBAAC,OAAD,EAAK,KAAK,EAAkB,CAAA,EAC1C;EACA,mBAAkB;YAElB,kBAAC,IAAD;GAA4C;aAC1C,kBAAC,GAAD;IACE,OAAO;KACL,QAAQ;KACR,eAAe;KACf,gBAAgB,EAAE,yBAAyB;IAC7C;cAEC;GACoC,CAAA;EACV,CAAA;CACf,CAAA,EACL,CAAA;AAEnB,GAaM,KAAyB,EAC7B,aACA,qBACA,aACA,eACA,uBAKE,kBAAC,GAAD;CACe,aAJG,EAAkB,GAAkB,CAIvC;CACD;CACG;CAEd;AACoB,CAAA,GAId,KAAwB,EACnC,aACA,qBACA,aACA,eACA,uBAEI,KAAoB,QAAQ,KAAY,OAExC,kBAAC,GAAD;CACoB;CACR;CACE;CACG;CAEd;AACoB,CAAA,IAKzB,kBAAC,GAAD;CACE,aAAa;CACD;CACG;CAEd;AACoB,CAAA"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* empty css */
|
|
2
1
|
//#region src/pages/backofficeEntityDetailPage.css.ts
|
|
3
2
|
var e = "txvbqbfpn txvbqbey txvbqblsh txvbqbhdl txvbqbh7g txvbqbv7x", t = "txvbqbfpn txvbqbey txvbqblsh txvbqbhdl txvbqbh7g", n = "txvbqbfpn txvbqbey txvbqb10n4 txvbqbb49 txvbqbbkc txvbqb2sj txvbqb7tt", r = "txvbqbfpn txvbqbh4x txvbqbhdy", i = "txvbqbfpn txvbqbey txvbqbhdl txvbqbh7g", a = "txvbqbfpn txvbqbh4x txvbqbhdl", o = "txvbqbfqq txvbqbey txvbqbls4 txvbqb19fz txvbqbjl1 txvbqb1bgv";
|
|
4
3
|
//#endregion
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* empty css */
|
|
2
1
|
//#region src/pages/backofficeEntityListPage.css.ts
|
|
3
2
|
var e = "txvbqbfpn txvbqbey txvbqbhdl txvbqbh7g", t = "txvbqblsh", n = "c0tad0 txvbqbfqq txvbqbey txvbqbls4 txvbqb19hf txvbqbjmh txvbqbvat txvbqbub2 txvbqb2tz txvbqb1b5h txvbqb1bgt txvbqb3f txvbqb7h txvbqb76 txvbqb7t txvbqb1ctz txvbqb1emf qbwcue0 txvbqb1fgi txvbqb1gaq";
|
|
4
3
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/pages/detail/pageResolution.ts
|
|
2
2
|
var e = (e) => e.trim().replace(/^\/+|\/+$/g, ""), t = (t) => {
|
|
3
|
-
let n = [t.mainPage, ...t.subPages ?? []].filter((e) => e.isVisible == null
|
|
3
|
+
let n = [t.mainPage, ...t.subPages ?? []].filter((e) => e.isVisible == null || e.isVisible(t.node));
|
|
4
4
|
if (n.length === 0) return {
|
|
5
5
|
pages: [],
|
|
6
6
|
activePage: null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pageResolution.js","names":[],"sources":["../../../../src/pages/detail/pageResolution.ts"],"sourcesContent":["type DetailPageBase<ShellView> = {\n id: string;\n path: string;\n isVisible?: (layout: ShellView) => boolean;\n};\n\ntype PageResolutionInput<\n ShellView,\n MainPage extends DetailPageBase<ShellView>,\n SubPage extends DetailPageBase<ShellView> = MainPage,\n> = {\n mainPage: MainPage;\n subPages?: readonly SubPage[];\n activePagePath?: string;\n node: ShellView;\n};\n\nexport type ResolvedDetailPages<Page> = {\n pages: readonly Page[];\n activePage: Page | null;\n hasVisiblePages: boolean;\n hasMultiplePages: boolean;\n};\n\nconst normalizePath = (value: string): string => {\n return value.trim().replace(/^\\/+|\\/+$/g, '');\n};\n\nexport const resolveVisibleDetailPages = <\n ShellView,\n MainPage extends DetailPageBase<ShellView>,\n SubPage extends DetailPageBase<ShellView> = MainPage,\n>(\n input: PageResolutionInput<ShellView, MainPage, SubPage>,\n): ResolvedDetailPages<MainPage | SubPage> => {\n const allPages = [input.mainPage, ...(input.subPages ?? [])] as readonly (\n MainPage | SubPage\n )[];\n const visiblePages = allPages.filter((page) => {\n if (page.isVisible == null) {\n return true;\n }\n return page.isVisible(input.node);\n });\n\n if (visiblePages.length === 0) {\n return {\n pages: [],\n activePage: null,\n hasVisiblePages: false,\n hasMultiplePages: false,\n };\n }\n\n const activePath = normalizePath(input.activePagePath ?? '');\n let activeByPath: MainPage | SubPage | null = null;\n if (activePath !== '') {\n activeByPath =\n visiblePages.find((page) => {\n return normalizePath(page.path) === activePath;\n }) ?? null;\n }\n\n const defaultPage =\n visiblePages.find((page) => {\n return page.id === input.mainPage.id;\n }) ?? visiblePages[0];\n if (defaultPage == null) {\n return {\n pages: [],\n activePage: null,\n hasVisiblePages: false,\n hasMultiplePages: false,\n };\n }\n\n const activePage = activeByPath ?? defaultPage;\n\n return {\n pages: visiblePages,\n activePage,\n hasVisiblePages: true,\n hasMultiplePages: visiblePages.length > 1,\n };\n};\n"],"mappings":";AAwBA,IAAM,KAAiB,MACd,EAAM,KAAK,CAAC,CAAC,QAAQ,cAAc,EAAE,GAGjC,KAKX,MAC4C;CAI5C,IAAM,IAAe,CAHH,EAAM,UAAU,GAAI,EAAM,YAAY,CAAC,CAGpC,CAAA,CAAS,QAAQ,MAChC,EAAK,aAAa,
|
|
1
|
+
{"version":3,"file":"pageResolution.js","names":[],"sources":["../../../../src/pages/detail/pageResolution.ts"],"sourcesContent":["type DetailPageBase<ShellView> = {\n id: string;\n path: string;\n isVisible?: (layout: ShellView) => boolean;\n};\n\ntype PageResolutionInput<\n ShellView,\n MainPage extends DetailPageBase<ShellView>,\n SubPage extends DetailPageBase<ShellView> = MainPage,\n> = {\n mainPage: MainPage;\n subPages?: readonly SubPage[];\n activePagePath?: string;\n node: ShellView;\n};\n\nexport type ResolvedDetailPages<Page> = {\n pages: readonly Page[];\n activePage: Page | null;\n hasVisiblePages: boolean;\n hasMultiplePages: boolean;\n};\n\nconst normalizePath = (value: string): string => {\n return value.trim().replace(/^\\/+|\\/+$/g, '');\n};\n\nexport const resolveVisibleDetailPages = <\n ShellView,\n MainPage extends DetailPageBase<ShellView>,\n SubPage extends DetailPageBase<ShellView> = MainPage,\n>(\n input: PageResolutionInput<ShellView, MainPage, SubPage>,\n): ResolvedDetailPages<MainPage | SubPage> => {\n const allPages = [input.mainPage, ...(input.subPages ?? [])] as readonly (\n MainPage | SubPage\n )[];\n const visiblePages = allPages.filter((page) => {\n if (page.isVisible == null) {\n return true;\n }\n return page.isVisible(input.node);\n });\n\n if (visiblePages.length === 0) {\n return {\n pages: [],\n activePage: null,\n hasVisiblePages: false,\n hasMultiplePages: false,\n };\n }\n\n const activePath = normalizePath(input.activePagePath ?? '');\n let activeByPath: MainPage | SubPage | null = null;\n if (activePath !== '') {\n activeByPath =\n visiblePages.find((page) => {\n return normalizePath(page.path) === activePath;\n }) ?? null;\n }\n\n const defaultPage =\n visiblePages.find((page) => {\n return page.id === input.mainPage.id;\n }) ?? visiblePages[0];\n if (defaultPage == null) {\n return {\n pages: [],\n activePage: null,\n hasVisiblePages: false,\n hasMultiplePages: false,\n };\n }\n\n const activePage = activeByPath ?? defaultPage;\n\n return {\n pages: visiblePages,\n activePage,\n hasVisiblePages: true,\n hasMultiplePages: visiblePages.length > 1,\n };\n};\n"],"mappings":";AAwBA,IAAM,KAAiB,MACd,EAAM,KAAK,CAAC,CAAC,QAAQ,cAAc,EAAE,GAGjC,KAKX,MAC4C;CAI5C,IAAM,IAAe,CAHH,EAAM,UAAU,GAAI,EAAM,YAAY,CAAC,CAGpC,CAAA,CAAS,QAAQ,MAChC,EAAK,aAAa,QAGf,EAAK,UAAU,EAAM,IAAI,CACjC;CAED,IAAI,EAAa,WAAW,GAC1B,OAAO;EACL,OAAO,CAAC;EACR,YAAY;EACZ,iBAAiB;EACjB,kBAAkB;CACpB;CAGF,IAAM,IAAa,EAAc,EAAM,kBAAkB,EAAE,GACvD,IAA0C;CAC9C,AAAI,MAAe,OACjB,IACE,EAAa,MAAM,MACV,EAAc,EAAK,IAAI,MAAM,CACrC,KAAK;CAGV,IAAM,IACJ,EAAa,MAAM,MACV,EAAK,OAAO,EAAM,SAAS,EACnC,KAAK,EAAa;CAYrB,OAXI,KAAe,OACV;EACL,OAAO,CAAC;EACR,YAAY;EACZ,iBAAiB;EACjB,kBAAkB;CACpB,IAKK;EACL,OAAO;EACP,YAJiB,KAAgB;EAKjC,iBAAiB;EACjB,kBAAkB,EAAa,SAAS;CAC1C;AACF"}
|
|
@@ -40,9 +40,9 @@ var t = "cache-first", n = "detail-page", r = "detail-layout", i = "list", a = "
|
|
|
40
40
|
let a = r.facets.list;
|
|
41
41
|
if (a == null) throw Error(`Backoffice entity ${t} does not expose a list facet.`);
|
|
42
42
|
return _(l(t, i), n, async () => {
|
|
43
|
-
let n =
|
|
44
|
-
if (
|
|
45
|
-
return
|
|
43
|
+
let n = await a(), o = e(r, n, m);
|
|
44
|
+
if (o.kind !== i) throw Error(`Backoffice entity ${t} did not resolve to a list facet.`);
|
|
45
|
+
return o;
|
|
46
46
|
});
|
|
47
47
|
},
|
|
48
48
|
loadPickerEntity: async (t, n) => {
|
|
@@ -51,36 +51,36 @@ var t = "cache-first", n = "detail-page", r = "detail-layout", i = "list", a = "
|
|
|
51
51
|
let i = r.facets.picker;
|
|
52
52
|
if (i == null) throw Error(`Backoffice entity ${t} does not expose a picker facet.`);
|
|
53
53
|
return _(l(t, a), n, async () => {
|
|
54
|
-
let n =
|
|
55
|
-
if (
|
|
56
|
-
return
|
|
54
|
+
let n = await i(), o = e(r, n, m);
|
|
55
|
+
if (o.kind !== a) throw Error(`Backoffice entity ${t} did not resolve to a picker facet.`);
|
|
56
|
+
return o;
|
|
57
57
|
});
|
|
58
58
|
},
|
|
59
59
|
loadDetailLayoutEntity: async (t, n) => {
|
|
60
60
|
let i = f(p, t);
|
|
61
61
|
if (!s(i)) throw Error(`Backoffice entity ${t} does not expose a detail-layout facet.`);
|
|
62
62
|
return _(l(t, r), n, async () => {
|
|
63
|
-
let n =
|
|
64
|
-
if (
|
|
65
|
-
return
|
|
63
|
+
let n = await i.facets.detailLayout(), a = e(i, n, m);
|
|
64
|
+
if (a.kind !== r) throw Error(`Backoffice entity ${t} did not resolve to a detail-layout facet.`);
|
|
65
|
+
return a;
|
|
66
66
|
});
|
|
67
67
|
},
|
|
68
68
|
loadDetailPageEntity: async (t, r, i) => {
|
|
69
69
|
let a = f(p, t);
|
|
70
70
|
if (!s(a)) throw Error(`Backoffice entity ${t} does not expose a detail-page facet.`);
|
|
71
71
|
return _(l(t, n, r), i, async () => {
|
|
72
|
-
let i =
|
|
73
|
-
if (
|
|
74
|
-
return
|
|
72
|
+
let i = await a.facets.detailPage(r), o = e(a, i, m);
|
|
73
|
+
if (o.kind !== n) throw Error(`Backoffice entity ${t} did not resolve to a detail-page facet.`);
|
|
74
|
+
return o;
|
|
75
75
|
});
|
|
76
76
|
},
|
|
77
77
|
loadToolEntity: async (t, n) => {
|
|
78
78
|
let r = f(p, t);
|
|
79
79
|
if (!c(r)) throw Error(`Backoffice entity ${t} does not expose a tool facet.`);
|
|
80
80
|
return _(l(t, o), n, async () => {
|
|
81
|
-
let n =
|
|
82
|
-
if (
|
|
83
|
-
return
|
|
81
|
+
let n = await r.facets.tool(), i = e(r, n, m);
|
|
82
|
+
if (i.kind !== o) throw Error(`Backoffice entity ${t} did not resolve to a tool facet.`);
|
|
83
|
+
return i;
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
};
|