@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":"buildSidebarSections.js","names":[],"sources":["../../../../../src/components/backoffice/layout/buildSidebarSections.tsx"],"sourcesContent":["import { type ReactNode } from 'react';\nimport type { TFunction } from 'i18next';\n\nimport type { BackofficeEntityManifestMap } from '@plumile/backoffice-core/types.js';\nimport type {\n BackofficeSidebarConfig,\n BackofficeDashboardRegistration,\n BackofficeSidebarItemDescriptor,\n BackofficeIconComponent,\n BackofficeSidebarRecentItem,\n} from '../../../provider/types.js';\nimport type {\n SidebarNavigationItem,\n SidebarNavigationSection,\n} from '@plumile/ui/components/navigation/sidebar/SidebarNavigation.js';\nimport { BackofficeSidebarHistorySvg } from '@plumile/ui/icons/backoffice/BackofficeSidebarHistorySvg.js';\nimport { GripDotsSvg } from '@plumile/ui/icons/GripDotsSvg.js';\nimport { PinFilledSvg } from '@plumile/ui/icons/PinFilledSvg.js';\nimport { PinSvg } from '@plumile/ui/icons/PinSvg.js';\nimport { SidebarHomeSvg } from '@plumile/ui/icons/SidebarHomeSvg.js';\nimport { SidebarTasksSvg } from '@plumile/ui/icons/SidebarTasksSvg.js';\nimport type { SidebarGroupCollapseState } from '../../../hooks/useSidebarGroupCollapse.js';\nimport { findBackofficeDashboardRegistration } from '../../../provider/dashboardRegistrations.js';\nimport * as styles from './backofficeSidebarActions.css.js';\nimport {\n buildEntityGroupLookup,\n isActivePath,\n joinBackofficePath,\n resolveLabel,\n resolveGroupItems,\n resolveHubEntityIds,\n resolveSidebarHub,\n resolveSidebarGroups,\n} from './sidebarUtils.js';\n\nconst renderIcon = (\n Icon?: BackofficeIconComponent,\n fallback?: ReactNode,\n size = 18,\n): ReactNode => {\n if (Icon != null) {\n return <Icon width={size} height={size} aria-hidden=\"true\" />;\n }\n return fallback ?? null;\n};\n\nexport type BuildSidebarSectionsInput = {\n basePath: string;\n pathname: string;\n entities: BackofficeEntityManifestMap;\n dashboards?: readonly BackofficeDashboardRegistration[];\n sidebar?: BackofficeSidebarConfig;\n permissions: unknown;\n searchQuery?: string;\n tApp: TFunction;\n t: TFunction;\n pinnedEntityIds?: readonly string[];\n recentItems?: readonly BackofficeSidebarRecentItem[];\n onTogglePin?: (entityId: string) => void;\n onReorderPin?: (fromId: string, toId: string) => void;\n collapsedByGroupId?: SidebarGroupCollapseState;\n onGroupCollapsedChange?: (groupId: string, collapsed: boolean) => void;\n sidebarCollapsed?: boolean;\n};\n\n/**\n * Builds the sidebar sections for the backoffice layout.\n */\nexport function buildSidebarSections(\n input: BuildSidebarSectionsInput,\n): readonly SidebarNavigationSection[] {\n const {\n basePath,\n pathname,\n entities,\n dashboards = [],\n sidebar,\n permissions,\n searchQuery,\n tApp,\n t,\n pinnedEntityIds = [],\n recentItems = [],\n onTogglePin,\n onReorderPin,\n collapsedByGroupId,\n onGroupCollapsedChange,\n sidebarCollapsed = false,\n } = input;\n\n const groups = resolveSidebarGroups(entities, sidebar);\n const entries = Object.entries(groups);\n const pinnedSet = new Set(pinnedEntityIds);\n const pinLabel = t('sidebar.actions.pin');\n const unpinLabel = t('sidebar.actions.unpin');\n const reorderLabel = t('sidebar.actions.reorder');\n const entityGroupLookup = buildEntityGroupLookup(groups, sidebar);\n const normalizedQuery = searchQuery?.trim().toLowerCase() ?? '';\n\n const labelMatchesQuery = (label: string): boolean => {\n return (\n normalizedQuery === '' || label.toLowerCase().includes(normalizedQuery)\n );\n };\n\n const renderPinAction = (entityId: string): ReactNode | null => {\n if (onTogglePin == null) {\n return null;\n }\n const isPinned = pinnedSet.has(entityId);\n let label = pinLabel;\n let Icon = PinSvg;\n if (isPinned) {\n label = unpinLabel;\n Icon = PinFilledSvg;\n }\n\n return (\n <button\n type=\"button\"\n className={styles.actionButton}\n aria-pressed={isPinned}\n aria-label={label}\n title={label}\n onClick={(event) => {\n event.preventDefault();\n event.stopPropagation();\n onTogglePin(entityId);\n }}\n >\n <Icon width={14} height={14} aria-hidden=\"true\" />\n </button>\n );\n };\n\n const buildDashboardItem = (\n inputItem?: {\n id?: string;\n icon?: BackofficeIconComponent;\n label?: string;\n },\n groupId?: string,\n ): SidebarNavigationItem | null => {\n const dashboardId = inputItem?.id ?? 'dashboard';\n const dashboardDescriptor: BackofficeSidebarItemDescriptor = {\n kind: 'dashboard',\n id: dashboardId,\n };\n const isDashboardVisible = sidebar?.isItemVisible?.(\n dashboardDescriptor,\n permissions,\n );\n if (isDashboardVisible === false) {\n return null;\n }\n\n const registration = findBackofficeDashboardRegistration(\n dashboards,\n dashboardId,\n );\n let label = inputItem?.label;\n if (label == null && registration != null) {\n label = resolveLabel(registration.label, tApp);\n }\n label ??= t('sidebar.items.dashboard');\n if (!labelMatchesQuery(label)) {\n return null;\n }\n\n let href = basePath;\n let id = 'dashboard';\n if (dashboardId !== 'dashboard') {\n href = joinBackofficePath(basePath, `dashboard/${dashboardId}`);\n id = `dashboard-${dashboardId}`;\n }\n\n let isActive = isActivePath(pathname, href);\n if (dashboardId === 'dashboard') {\n isActive = pathname === basePath || pathname === `${basePath}/dashboard`;\n }\n\n return {\n id,\n data: {\n kind: 'dashboard',\n id: dashboardId,\n groupId,\n },\n label,\n href,\n icon: renderIcon(\n inputItem?.icon ?? registration?.icon,\n <SidebarHomeSvg width={18} height={18} aria-hidden=\"true\" />,\n ),\n isActive,\n ariaLabel: label,\n };\n };\n\n const buildEntityItem = (inputItem: {\n entityId: string;\n groupId?: string;\n groupIcon?: BackofficeIconComponent;\n itemIcon?: BackofficeIconComponent;\n itemLabel?: string;\n enableReorder?: boolean;\n sectionId?: string;\n }): SidebarNavigationItem | null => {\n const {\n entityId,\n groupId,\n groupIcon,\n itemIcon,\n itemLabel,\n enableReorder,\n sectionId,\n } = inputItem;\n const config = entities[entityId];\n if (config == null) {\n return null;\n }\n\n let descriptor: BackofficeSidebarItemDescriptor = {\n kind: 'entity',\n id: entityId,\n };\n if (config.kind === 'tool') {\n descriptor = { kind: 'tool', id: entityId };\n }\n const isEntityVisible = sidebar?.isItemVisible?.(descriptor, permissions);\n if (isEntityVisible === false) {\n return null;\n }\n\n if (config.kind === 'tool') {\n const label = itemLabel ?? resolveLabel(config.label, tApp);\n if (\n normalizedQuery !== '' &&\n !label.toLowerCase().includes(normalizedQuery)\n ) {\n return null;\n }\n\n let actionsVisibility: SidebarNavigationItem['actionsVisibility'];\n if (sectionId !== 'pinned' && pinnedSet.has(entityId)) {\n actionsVisibility = 'always';\n }\n\n return {\n id: `tool-${entityId}`,\n data: {\n kind: 'tool',\n id: entityId,\n groupId,\n },\n label,\n href: config.routes.list,\n icon: renderIcon(\n itemIcon ?? groupIcon,\n <SidebarTasksSvg width={18} height={18} aria-hidden=\"true\" />,\n ),\n isActive: isActivePath(pathname, config.routes.list),\n ariaLabel: label,\n actionSlot: renderPinAction(entityId),\n actionsVisibility,\n };\n }\n\n if (!config.hasList) {\n return null;\n }\n\n const label = itemLabel ?? resolveLabel(config.label, tApp);\n if (\n normalizedQuery !== '' &&\n !label.toLowerCase().includes(normalizedQuery)\n ) {\n return null;\n }\n\n let dragHandleSlot: ReactNode | undefined;\n if (enableReorder === true && onReorderPin != null) {\n dragHandleSlot = (\n <GripDotsSvg width={14} height={14} aria-hidden=\"true\" />\n );\n }\n\n let dragHandleLabel: string | undefined;\n if (dragHandleSlot != null) {\n dragHandleLabel = reorderLabel;\n }\n\n let actionsVisibility: SidebarNavigationItem['actionsVisibility'];\n if (sectionId !== 'pinned' && pinnedSet.has(entityId)) {\n actionsVisibility = 'always';\n }\n\n return {\n id: entityId,\n data: {\n kind: 'entity',\n id: entityId,\n groupId,\n },\n label,\n href: config.routes.list,\n icon: renderIcon(\n itemIcon ?? groupIcon,\n <SidebarTasksSvg width={18} height={18} aria-hidden=\"true\" />,\n ),\n isActive: isActivePath(pathname, config.routes.list),\n ariaLabel: label,\n actionSlot: renderPinAction(entityId),\n actionsVisibility,\n dragHandleSlot,\n dragHandleLabel,\n };\n };\n\n const buildHubItem = (inputItem: {\n hub: ReturnType<typeof resolveSidebarHub>;\n groupId?: string;\n icon?: BackofficeIconComponent;\n }): SidebarNavigationItem | null => {\n const { hub, groupId, icon } = inputItem;\n const descriptor: BackofficeSidebarItemDescriptor = {\n kind: 'hub',\n id: hub.id,\n };\n const isVisible = sidebar?.isItemVisible?.(descriptor, permissions);\n if (isVisible === false) {\n return null;\n }\n const childEntityIds = resolveHubEntityIds(hub);\n const visibleChildConfigs = childEntityIds\n .map((entityId) => {\n return entities[entityId] ?? null;\n })\n .filter((config): config is BackofficeEntityManifestMap[string] => {\n if (config == null) {\n return false;\n }\n let childKind: BackofficeSidebarItemDescriptor['kind'] = 'entity';\n if (config.kind === 'tool') {\n childKind = 'tool';\n }\n const childDescriptor: BackofficeSidebarItemDescriptor = {\n kind: childKind,\n id: config.id,\n };\n const isChildVisible = sidebar?.isItemVisible?.(\n childDescriptor,\n permissions,\n );\n if (isChildVisible === false) {\n return false;\n }\n if (config.kind !== 'tool' && !config.hasList) {\n return false;\n }\n return true;\n });\n if (childEntityIds.length > 0 && visibleChildConfigs.length === 0) {\n return null;\n }\n const label = resolveLabel(hub.title, tApp);\n const matchesHub = labelMatchesQuery(label);\n const matchesChild = visibleChildConfigs.some((config) => {\n return labelMatchesQuery(resolveLabel(config.label, tApp));\n });\n if (!matchesHub && !matchesChild) {\n return null;\n }\n const isActive =\n isActivePath(pathname, hub.href) ||\n visibleChildConfigs.some((config) => {\n return isActivePath(pathname, config.routes.list);\n });\n return {\n id: `hub-${hub.id}`,\n data: {\n kind: 'hub',\n id: hub.id,\n groupId,\n },\n label,\n href: hub.href,\n icon: renderIcon(\n icon,\n <SidebarTasksSvg width={18} height={18} aria-hidden=\"true\" />,\n ),\n isActive,\n ariaLabel: label,\n };\n };\n\n const sections: SidebarNavigationSection[] = [];\n\n const primaryItems = sidebar?.primaryItems ?? [];\n if (primaryItems.length > 0) {\n const primarySectionItems = primaryItems\n .map((primaryItem): SidebarNavigationItem | null => {\n if (primaryItem.kind === 'dashboard') {\n let itemLabel: string | undefined;\n if (primaryItem.label != null) {\n itemLabel = resolveLabel(primaryItem.label, tApp);\n }\n return buildDashboardItem({\n id: primaryItem.id,\n icon: primaryItem.icon,\n label: itemLabel,\n });\n }\n if (primaryItem.kind === 'hub') {\n const hub = resolveSidebarHub(primaryItem, sidebar);\n return buildHubItem({\n hub,\n icon: primaryItem.icon,\n });\n }\n let itemLabel: string | undefined;\n if (primaryItem.label != null) {\n itemLabel = resolveLabel(primaryItem.label, tApp);\n }\n return buildEntityItem({\n entityId: primaryItem.id,\n itemIcon: primaryItem.icon,\n itemLabel,\n sectionId: 'primary',\n });\n })\n .filter((item): item is SidebarNavigationItem => {\n return item != null;\n });\n\n if (primarySectionItems.length > 0) {\n sections.push({\n id: 'primary',\n items: primarySectionItems,\n collapsible: false,\n });\n }\n }\n\n if (pinnedEntityIds.length > 0) {\n const pinnedItems = pinnedEntityIds\n .map((entityId) => {\n const groupMeta = entityGroupLookup.get(entityId);\n return buildEntityItem({\n entityId,\n groupId: groupMeta?.groupId,\n groupIcon: groupMeta?.groupIcon,\n itemIcon: groupMeta?.itemIcon,\n enableReorder: true,\n sectionId: 'pinned',\n });\n })\n .filter((item): item is SidebarNavigationItem => {\n return item != null;\n });\n\n if (pinnedItems.length > 0) {\n let reorder: SidebarNavigationSection['reorder'];\n if (onReorderPin != null && pinnedItems.length > 1) {\n reorder = {\n enabled: true,\n onReorder: onReorderPin,\n };\n }\n let sectionItems = pinnedItems;\n if (reorder == null) {\n sectionItems = pinnedItems.map((item) => {\n const { dragHandleSlot, dragHandleLabel, ...rest } = item;\n return rest;\n });\n }\n\n sections.push({\n id: 'pinned',\n title: t('sidebar.sections.pinned'),\n icon: renderIcon(\n undefined,\n <PinSvg width={16} height={16} aria-hidden=\"true\" />,\n ),\n items: sectionItems,\n collapsible: false,\n reorder,\n });\n }\n }\n\n if (recentItems.length > 0) {\n const recentSectionItems = recentItems\n .map((recentItem): SidebarNavigationItem | null => {\n const config = entities[recentItem.id];\n if (config == null) {\n return null;\n }\n const descriptor: BackofficeSidebarItemDescriptor = {\n kind: recentItem.kind,\n id: recentItem.id,\n };\n const isVisible = sidebar?.isItemVisible?.(descriptor, permissions);\n if (isVisible === false) {\n return null;\n }\n if (\n normalizedQuery !== '' &&\n !recentItem.label.toLowerCase().includes(normalizedQuery)\n ) {\n return null;\n }\n const groupMeta = entityGroupLookup.get(recentItem.id);\n return {\n id: `recent-${recentItem.kind}-${recentItem.id}`,\n data: {\n kind: recentItem.kind,\n id: recentItem.id,\n groupId: groupMeta?.groupId,\n },\n label: recentItem.label,\n href: recentItem.href,\n icon: renderIcon(\n groupMeta?.itemIcon ?? groupMeta?.groupIcon,\n <SidebarTasksSvg width={18} height={18} aria-hidden=\"true\" />,\n ),\n isActive: isActivePath(pathname, recentItem.href),\n ariaLabel: recentItem.label,\n } satisfies SidebarNavigationItem;\n })\n .filter((item): item is SidebarNavigationItem => {\n return item != null;\n });\n\n if (recentSectionItems.length > 0) {\n sections.push({\n id: 'recent',\n title: t('sidebar.sections.recent'),\n icon: renderIcon(\n undefined,\n <BackofficeSidebarHistorySvg\n width={16}\n height={16}\n aria-hidden=\"true\"\n />,\n ),\n items: recentSectionItems,\n collapsible: false,\n });\n }\n }\n\n entries.forEach(([groupId, group]) => {\n if (group.isVisible != null && !group.isVisible(permissions)) {\n return;\n }\n\n const items: SidebarNavigationItem[] = [];\n\n const groupItems = resolveGroupItems(group);\n if (groupItems.length > 0) {\n groupItems.forEach((groupItem) => {\n if (groupItem.kind === 'dashboard') {\n let itemLabel: string | undefined;\n if (groupItem.label != null) {\n itemLabel = resolveLabel(groupItem.label, tApp);\n }\n const item = buildDashboardItem(\n {\n id: groupItem.id,\n icon: groupItem.icon ?? group.icon,\n label: itemLabel,\n },\n groupId,\n );\n if (item != null) {\n items.push(item);\n }\n return;\n }\n if (groupItem.kind === 'hub') {\n const hub = resolveSidebarHub(groupItem, sidebar);\n const item = buildHubItem({\n hub,\n groupId,\n icon: groupItem.icon ?? group.icon,\n });\n if (item != null) {\n items.push(item);\n }\n return;\n }\n let itemLabel: string | undefined;\n if (groupItem.label != null) {\n itemLabel = resolveLabel(groupItem.label, tApp);\n }\n const item = buildEntityItem({\n entityId: groupItem.id,\n groupId,\n groupIcon: group.icon,\n itemIcon: groupItem.icon,\n itemLabel,\n sectionId: groupId,\n });\n if (item != null) {\n items.push(item);\n }\n });\n }\n\n let sectionItems: SidebarNavigationItem[] = items;\n if (sidebarCollapsed && group.behavior?.showInCollapsedRail !== true) {\n sectionItems = items.filter((item) => {\n return item.data?.kind === 'dashboard' || item.isActive === true;\n });\n }\n\n if (sectionItems.length === 0) {\n return;\n }\n\n let title: string | undefined;\n if (group.title != null) {\n title = resolveLabel(group.title, tApp);\n }\n\n const isCollapsed = collapsedByGroupId?.[groupId];\n let onCollapsedChange: ((collapsed: boolean) => void) | undefined;\n if (onGroupCollapsedChange != null) {\n onCollapsedChange = (collapsed: boolean) => {\n onGroupCollapsedChange(groupId, collapsed);\n };\n }\n\n sections.push({\n id: groupId,\n title,\n icon: renderIcon(group.icon, undefined, 16),\n items: sectionItems,\n collapsible: group.behavior?.collapsible ?? true,\n defaultCollapsed: group.behavior?.defaultCollapsed ?? true,\n isCollapsed,\n onCollapsedChange,\n });\n });\n\n return sections;\n}\n"],"mappings":";;;;;;;;;;;AAmCA,IAAM,KACJ,GACA,GACA,IAAO,OAEH,KAAQ,OAGL,KAAY,OAFV,kBAAC,GAAD;CAAM,OAAO;CAAM,QAAQ;CAAM,eAAY;AAAQ,CAAA;AA2BhE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U,EAAU;IACpB;IACA,WAAW;GACb,CAAC;GACD,AAAI,KAAQ,QACV,EAAM,KAAK,CAAI;EAEnB,CAAC;EAGH,IAAI,IAAwC;EAO5C,IANI,KAAoB,EAAM,UAAU,wBAAwB,OAC9D,IAAe,EAAM,QAAQ,MACpB,EAAK,MAAM,SAAS,eAAe,EAAK,aAAa,EAC7D,IAGC,EAAa,WAAW,GAC1B;EAGF,IAAI;EACJ,AAAI,EAAM,SAAS,SACjB,IAAQ,EAAa,EAAM,OAAO,CAAI;EAGxC,IAAM,IAAc,IAAqB,IACrC;EAOJ,AANI,KAA0B,SAC5B,KAAqB,MAAuB;GAC1C,EAAuB,GAAS,CAAS;EAC3C,IAGF,EAAS,KAAK;GACZ,IAAI;GACJ;GACA,MAAM,EAAW,EAAM,MAAM,KAAA,GAAW,EAAE;GAC1C,OAAO;GACP,aAAa,EAAM,UAAU,eAAe;GAC5C,kBAAkB,EAAM,UAAU,oBAAoB;GACtD;GACA;EACF,CAAC;CACH,CAAC,GAEM;AACT"}
|
|
1
|
+
{"version":3,"file":"buildSidebarSections.js","names":[],"sources":["../../../../../src/components/backoffice/layout/buildSidebarSections.tsx"],"sourcesContent":["import { type ReactNode } from 'react';\nimport type { TFunction } from 'i18next';\n\nimport type { BackofficeEntityManifestMap } from '@plumile/backoffice-core/types.js';\nimport type {\n BackofficeSidebarConfig,\n BackofficeDashboardRegistration,\n BackofficeSidebarItemDescriptor,\n BackofficeIconComponent,\n BackofficeSidebarRecentItem,\n} from '../../../provider/types.js';\nimport type {\n SidebarNavigationItem,\n SidebarNavigationSection,\n} from '@plumile/ui/components/navigation/sidebar/SidebarNavigation.js';\nimport { BackofficeSidebarHistorySvg } from '@plumile/ui/icons/backoffice/BackofficeSidebarHistorySvg.js';\nimport { GripDotsSvg } from '@plumile/ui/icons/GripDotsSvg.js';\nimport { PinFilledSvg } from '@plumile/ui/icons/PinFilledSvg.js';\nimport { PinSvg } from '@plumile/ui/icons/PinSvg.js';\nimport { SidebarHomeSvg } from '@plumile/ui/icons/SidebarHomeSvg.js';\nimport { SidebarTasksSvg } from '@plumile/ui/icons/SidebarTasksSvg.js';\nimport type { SidebarGroupCollapseState } from '../../../hooks/useSidebarGroupCollapse.js';\nimport { findBackofficeDashboardRegistration } from '../../../provider/dashboardRegistrations.js';\nimport * as styles from './backofficeSidebarActions.css.js';\nimport {\n buildEntityGroupLookup,\n isActivePath,\n joinBackofficePath,\n resolveLabel,\n resolveGroupItems,\n resolveHubEntityIds,\n resolveSidebarHub,\n resolveSidebarGroups,\n} from './sidebarUtils.js';\n\nconst renderIcon = (\n Icon?: BackofficeIconComponent,\n fallback?: ReactNode,\n size = 18,\n): ReactNode => {\n if (Icon != null) {\n return <Icon width={size} height={size} aria-hidden=\"true\" />;\n }\n return fallback ?? null;\n};\n\nexport type BuildSidebarSectionsInput = {\n basePath: string;\n pathname: string;\n entities: BackofficeEntityManifestMap;\n dashboards?: readonly BackofficeDashboardRegistration[];\n sidebar?: BackofficeSidebarConfig;\n permissions: unknown;\n searchQuery?: string;\n tApp: TFunction;\n t: TFunction;\n pinnedEntityIds?: readonly string[];\n recentItems?: readonly BackofficeSidebarRecentItem[];\n onTogglePin?: (entityId: string) => void;\n onReorderPin?: (fromId: string, toId: string) => void;\n collapsedByGroupId?: SidebarGroupCollapseState;\n onGroupCollapsedChange?: (groupId: string, collapsed: boolean) => void;\n sidebarCollapsed?: boolean;\n};\n\n/**\n * Builds the sidebar sections for the backoffice layout.\n */\nexport function buildSidebarSections(\n input: BuildSidebarSectionsInput,\n): readonly SidebarNavigationSection[] {\n const {\n basePath,\n pathname,\n entities,\n dashboards = [],\n sidebar,\n permissions,\n searchQuery,\n tApp,\n t,\n pinnedEntityIds = [],\n recentItems = [],\n onTogglePin,\n onReorderPin,\n collapsedByGroupId,\n onGroupCollapsedChange,\n sidebarCollapsed = false,\n } = input;\n\n const groups = resolveSidebarGroups(entities, sidebar);\n const entries = Object.entries(groups);\n const pinnedSet = new Set(pinnedEntityIds);\n const pinLabel = t('sidebar.actions.pin');\n const unpinLabel = t('sidebar.actions.unpin');\n const reorderLabel = t('sidebar.actions.reorder');\n const entityGroupLookup = buildEntityGroupLookup(groups, sidebar);\n const normalizedQuery = searchQuery?.trim().toLowerCase() ?? '';\n\n const labelMatchesQuery = (label: string): boolean => {\n return (\n normalizedQuery === '' || label.toLowerCase().includes(normalizedQuery)\n );\n };\n\n const renderPinAction = (entityId: string): ReactNode | null => {\n if (onTogglePin == null) {\n return null;\n }\n const isPinned = pinnedSet.has(entityId);\n let label = pinLabel;\n let Icon = PinSvg;\n if (isPinned) {\n label = unpinLabel;\n Icon = PinFilledSvg;\n }\n\n return (\n <button\n type=\"button\"\n className={styles.actionButton}\n aria-pressed={isPinned}\n aria-label={label}\n title={label}\n onClick={(event) => {\n event.preventDefault();\n event.stopPropagation();\n onTogglePin(entityId);\n }}\n >\n <Icon width={14} height={14} aria-hidden=\"true\" />\n </button>\n );\n };\n\n const buildDashboardItem = (\n inputItem?: {\n id?: string;\n icon?: BackofficeIconComponent;\n label?: string;\n },\n groupId?: string,\n ): SidebarNavigationItem | null => {\n const dashboardId = inputItem?.id ?? 'dashboard';\n const dashboardDescriptor: BackofficeSidebarItemDescriptor = {\n kind: 'dashboard',\n id: dashboardId,\n };\n const isDashboardVisible = sidebar?.isItemVisible?.(\n dashboardDescriptor,\n permissions,\n );\n if (isDashboardVisible === false) {\n return null;\n }\n\n const registration = findBackofficeDashboardRegistration(\n dashboards,\n dashboardId,\n );\n let label = inputItem?.label;\n if (label == null && registration != null) {\n label = resolveLabel(registration.label, tApp);\n }\n label ??= t('sidebar.items.dashboard');\n if (!labelMatchesQuery(label)) {\n return null;\n }\n\n let href = basePath;\n let id = 'dashboard';\n if (dashboardId !== 'dashboard') {\n href = joinBackofficePath(basePath, `dashboard/${dashboardId}`);\n id = `dashboard-${dashboardId}`;\n }\n\n let isActive = isActivePath(pathname, href);\n if (dashboardId === 'dashboard') {\n isActive = pathname === basePath || pathname === `${basePath}/dashboard`;\n }\n\n return {\n id,\n data: {\n kind: 'dashboard',\n id: dashboardId,\n groupId,\n },\n label,\n href,\n icon: renderIcon(\n inputItem?.icon ?? registration?.icon,\n <SidebarHomeSvg width={18} height={18} aria-hidden=\"true\" />,\n ),\n isActive,\n ariaLabel: label,\n };\n };\n\n const buildEntityItem = (inputItem: {\n entityId: string;\n groupId?: string;\n groupIcon?: BackofficeIconComponent;\n itemIcon?: BackofficeIconComponent;\n itemLabel?: string;\n enableReorder?: boolean;\n sectionId?: string;\n }): SidebarNavigationItem | null => {\n const {\n entityId,\n groupId,\n groupIcon,\n itemIcon,\n itemLabel,\n enableReorder,\n sectionId,\n } = inputItem;\n const config = entities[entityId];\n if (config == null) {\n return null;\n }\n\n let descriptor: BackofficeSidebarItemDescriptor = {\n kind: 'entity',\n id: entityId,\n };\n if (config.kind === 'tool') {\n descriptor = { kind: 'tool', id: entityId };\n }\n const isEntityVisible = sidebar?.isItemVisible?.(descriptor, permissions);\n if (isEntityVisible === false) {\n return null;\n }\n\n if (config.kind === 'tool') {\n const label = itemLabel ?? resolveLabel(config.label, tApp);\n if (\n normalizedQuery !== '' &&\n !label.toLowerCase().includes(normalizedQuery)\n ) {\n return null;\n }\n\n let actionsVisibility: SidebarNavigationItem['actionsVisibility'];\n if (sectionId !== 'pinned' && pinnedSet.has(entityId)) {\n actionsVisibility = 'always';\n }\n\n return {\n id: `tool-${entityId}`,\n data: {\n kind: 'tool',\n id: entityId,\n groupId,\n },\n label,\n href: config.routes.list,\n icon: renderIcon(\n itemIcon ?? groupIcon,\n <SidebarTasksSvg width={18} height={18} aria-hidden=\"true\" />,\n ),\n isActive: isActivePath(pathname, config.routes.list),\n ariaLabel: label,\n actionSlot: renderPinAction(entityId),\n actionsVisibility,\n };\n }\n\n if (!config.hasList) {\n return null;\n }\n\n const label = itemLabel ?? resolveLabel(config.label, tApp);\n if (\n normalizedQuery !== '' &&\n !label.toLowerCase().includes(normalizedQuery)\n ) {\n return null;\n }\n\n let dragHandleSlot: ReactNode | undefined;\n if (enableReorder === true && onReorderPin != null) {\n dragHandleSlot = (\n <GripDotsSvg width={14} height={14} aria-hidden=\"true\" />\n );\n }\n\n let dragHandleLabel: string | undefined;\n if (dragHandleSlot != null) {\n dragHandleLabel = reorderLabel;\n }\n\n let actionsVisibility: SidebarNavigationItem['actionsVisibility'];\n if (sectionId !== 'pinned' && pinnedSet.has(entityId)) {\n actionsVisibility = 'always';\n }\n\n return {\n id: entityId,\n data: {\n kind: 'entity',\n id: entityId,\n groupId,\n },\n label,\n href: config.routes.list,\n icon: renderIcon(\n itemIcon ?? groupIcon,\n <SidebarTasksSvg width={18} height={18} aria-hidden=\"true\" />,\n ),\n isActive: isActivePath(pathname, config.routes.list),\n ariaLabel: label,\n actionSlot: renderPinAction(entityId),\n actionsVisibility,\n dragHandleSlot,\n dragHandleLabel,\n };\n };\n\n const buildHubItem = (inputItem: {\n hub: ReturnType<typeof resolveSidebarHub>;\n groupId?: string;\n icon?: BackofficeIconComponent;\n }): SidebarNavigationItem | null => {\n const { hub, groupId, icon } = inputItem;\n const descriptor: BackofficeSidebarItemDescriptor = {\n kind: 'hub',\n id: hub.id,\n };\n const isVisible = sidebar?.isItemVisible?.(descriptor, permissions);\n if (isVisible === false) {\n return null;\n }\n const childEntityIds = resolveHubEntityIds(hub);\n const visibleChildConfigs = childEntityIds\n .map((entityId) => {\n return entities[entityId] ?? null;\n })\n .filter((config): config is BackofficeEntityManifestMap[string] => {\n if (config == null) {\n return false;\n }\n let childKind: BackofficeSidebarItemDescriptor['kind'] = 'entity';\n if (config.kind === 'tool') {\n childKind = 'tool';\n }\n const childDescriptor: BackofficeSidebarItemDescriptor = {\n kind: childKind,\n id: config.id,\n };\n const isChildVisible = sidebar?.isItemVisible?.(\n childDescriptor,\n permissions,\n );\n if (isChildVisible === false) {\n return false;\n }\n if (config.kind !== 'tool' && !config.hasList) {\n return false;\n }\n return true;\n });\n if (childEntityIds.length > 0 && visibleChildConfigs.length === 0) {\n return null;\n }\n const label = resolveLabel(hub.title, tApp);\n const matchesHub = labelMatchesQuery(label);\n const matchesChild = visibleChildConfigs.some((config) => {\n return labelMatchesQuery(resolveLabel(config.label, tApp));\n });\n if (!matchesHub && !matchesChild) {\n return null;\n }\n const isActive =\n isActivePath(pathname, hub.href) ||\n visibleChildConfigs.some((config) => {\n return isActivePath(pathname, config.routes.list);\n });\n return {\n id: `hub-${hub.id}`,\n data: {\n kind: 'hub',\n id: hub.id,\n groupId,\n },\n label,\n href: hub.href,\n icon: renderIcon(\n icon,\n <SidebarTasksSvg width={18} height={18} aria-hidden=\"true\" />,\n ),\n isActive,\n ariaLabel: label,\n };\n };\n\n const sections: SidebarNavigationSection[] = [];\n\n const primaryItems = sidebar?.primaryItems ?? [];\n if (primaryItems.length > 0) {\n const primarySectionItems = primaryItems\n .map((primaryItem): SidebarNavigationItem | null => {\n if (primaryItem.kind === 'dashboard') {\n let itemLabel: string | undefined;\n if (primaryItem.label != null) {\n itemLabel = resolveLabel(primaryItem.label, tApp);\n }\n return buildDashboardItem({\n id: primaryItem.id,\n icon: primaryItem.icon,\n label: itemLabel,\n });\n }\n if (primaryItem.kind === 'hub') {\n const hub = resolveSidebarHub(primaryItem, sidebar);\n return buildHubItem({\n hub,\n icon: primaryItem.icon,\n });\n }\n let itemLabel: string | undefined;\n if (primaryItem.label != null) {\n itemLabel = resolveLabel(primaryItem.label, tApp);\n }\n return buildEntityItem({\n entityId: primaryItem.id,\n itemIcon: primaryItem.icon,\n itemLabel,\n sectionId: 'primary',\n });\n })\n .filter((item): item is SidebarNavigationItem => {\n return item != null;\n });\n\n if (primarySectionItems.length > 0) {\n sections.push({\n id: 'primary',\n items: primarySectionItems,\n collapsible: false,\n });\n }\n }\n\n if (pinnedEntityIds.length > 0) {\n const pinnedItems = pinnedEntityIds\n .map((entityId) => {\n const groupMeta = entityGroupLookup.get(entityId);\n return buildEntityItem({\n entityId,\n groupId: groupMeta?.groupId,\n groupIcon: groupMeta?.groupIcon,\n itemIcon: groupMeta?.itemIcon,\n enableReorder: true,\n sectionId: 'pinned',\n });\n })\n .filter((item): item is SidebarNavigationItem => {\n return item != null;\n });\n\n if (pinnedItems.length > 0) {\n let reorder: SidebarNavigationSection['reorder'];\n if (onReorderPin != null && pinnedItems.length > 1) {\n reorder = {\n enabled: true,\n onReorder: onReorderPin,\n };\n }\n let sectionItems = pinnedItems;\n if (reorder == null) {\n sectionItems = pinnedItems.map((item) => {\n const { dragHandleSlot, dragHandleLabel, ...rest } = item;\n return rest;\n });\n }\n\n sections.push({\n id: 'pinned',\n title: t('sidebar.sections.pinned'),\n icon: renderIcon(\n undefined,\n <PinSvg width={16} height={16} aria-hidden=\"true\" />,\n ),\n items: sectionItems,\n collapsible: false,\n reorder,\n });\n }\n }\n\n if (recentItems.length > 0) {\n const recentSectionItems = recentItems\n .map((recentItem): SidebarNavigationItem | null => {\n const config = entities[recentItem.id];\n if (config == null) {\n return null;\n }\n const descriptor: BackofficeSidebarItemDescriptor = {\n kind: recentItem.kind,\n id: recentItem.id,\n };\n const isVisible = sidebar?.isItemVisible?.(descriptor, permissions);\n if (isVisible === false) {\n return null;\n }\n if (\n normalizedQuery !== '' &&\n !recentItem.label.toLowerCase().includes(normalizedQuery)\n ) {\n return null;\n }\n const groupMeta = entityGroupLookup.get(recentItem.id);\n return {\n id: `recent-${recentItem.kind}-${recentItem.id}`,\n data: {\n kind: recentItem.kind,\n id: recentItem.id,\n groupId: groupMeta?.groupId,\n },\n label: recentItem.label,\n href: recentItem.href,\n icon: renderIcon(\n groupMeta?.itemIcon ?? groupMeta?.groupIcon,\n <SidebarTasksSvg width={18} height={18} aria-hidden=\"true\" />,\n ),\n isActive: isActivePath(pathname, recentItem.href),\n ariaLabel: recentItem.label,\n } satisfies SidebarNavigationItem;\n })\n .filter((item): item is SidebarNavigationItem => {\n return item != null;\n });\n\n if (recentSectionItems.length > 0) {\n sections.push({\n id: 'recent',\n title: t('sidebar.sections.recent'),\n icon: renderIcon(\n undefined,\n <BackofficeSidebarHistorySvg\n width={16}\n height={16}\n aria-hidden=\"true\"\n />,\n ),\n items: recentSectionItems,\n collapsible: false,\n });\n }\n }\n\n entries.forEach(([groupId, group]) => {\n if (group.isVisible != null && !group.isVisible(permissions)) {\n return;\n }\n\n const items: SidebarNavigationItem[] = [];\n\n const groupItems = resolveGroupItems(group);\n if (groupItems.length > 0) {\n groupItems.forEach((groupItem) => {\n if (groupItem.kind === 'dashboard') {\n let itemLabel: string | undefined;\n if (groupItem.label != null) {\n itemLabel = resolveLabel(groupItem.label, tApp);\n }\n const item = buildDashboardItem(\n {\n id: groupItem.id,\n icon: groupItem.icon ?? group.icon,\n label: itemLabel,\n },\n groupId,\n );\n if (item != null) {\n items.push(item);\n }\n return;\n }\n if (groupItem.kind === 'hub') {\n const hub = resolveSidebarHub(groupItem, sidebar);\n const item = buildHubItem({\n hub,\n groupId,\n icon: groupItem.icon ?? group.icon,\n });\n if (item != null) {\n items.push(item);\n }\n return;\n }\n let itemLabel: string | undefined;\n if (groupItem.label != null) {\n itemLabel = resolveLabel(groupItem.label, tApp);\n }\n const item = buildEntityItem({\n entityId: groupItem.id,\n groupId,\n groupIcon: group.icon,\n itemIcon: groupItem.icon,\n itemLabel,\n sectionId: groupId,\n });\n if (item != null) {\n items.push(item);\n }\n });\n }\n\n let sectionItems: SidebarNavigationItem[] = items;\n if (sidebarCollapsed && group.behavior?.showInCollapsedRail !== true) {\n sectionItems = items.filter((item) => {\n return item.data?.kind === 'dashboard' || item.isActive === true;\n });\n }\n\n if (sectionItems.length === 0) {\n return;\n }\n\n let title: string | undefined;\n if (group.title != null) {\n title = resolveLabel(group.title, tApp);\n }\n\n const isCollapsed = collapsedByGroupId?.[groupId];\n let onCollapsedChange: ((collapsed: boolean) => void) | undefined;\n if (onGroupCollapsedChange != null) {\n onCollapsedChange = (collapsed: boolean) => {\n onGroupCollapsedChange(groupId, collapsed);\n };\n }\n\n sections.push({\n id: groupId,\n title,\n icon: renderIcon(group.icon, undefined, 16),\n items: sectionItems,\n collapsible: group.behavior?.collapsible ?? true,\n defaultCollapsed: group.behavior?.defaultCollapsed ?? true,\n isCollapsed,\n onCollapsedChange,\n });\n });\n\n return sections;\n}\n"],"mappings":";;;;;;;;;;;AAmCA,IAAM,KACJ,GACA,GACA,IAAO,OAEH,KAAQ,OAGL,KAAY,OAFV,kBAAC,GAAD;CAAM,OAAO;CAAM,QAAQ;CAAM,eAAY;AAAQ,CAAA;AA2BhE,SAAgB,EACd,GACqC;CACrC,IAAM,EACJ,aACA,aACA,aACA,gBAAa,CAAC,GACd,YACA,gBACA,gBACA,SACA,MACA,qBAAkB,CAAC,GACnB,iBAAc,CAAC,GACf,gBACA,iBACA,uBACA,2BACA,sBAAmB,OACjB,GAEE,IAAS,EAAqB,GAAU,CAAO,GAC/C,IAAU,OAAO,QAAQ,CAAM,GAC/B,IAAY,IAAI,IAAI,CAAe,GACnC,IAAW,EAAE,qBAAqB,GAClC,IAAa,EAAE,uBAAuB,GACtC,IAAe,EAAE,yBAAyB,GAC1C,IAAoB,EAAuB,GAAQ,CAAO,GAC1D,IAAkB,GAAa,KAAK,CAAC,CAAC,YAAY,KAAK,IAEvD,KAAqB,MAEvB,MAAoB,MAAM,EAAM,YAAY,CAAC,CAAC,SAAS,CAAe,GAIpE,KAAmB,MAAuC;EAC9D,IAAI,KAAe,MACjB,OAAO;EAET,IAAM,IAAW,EAAU,IAAI,CAAQ,GACnC,IAAQ,GACR,IAAO;EAMX,OALI,MACF,IAAQ,GACR,IAAO,IAIP,kBAAC,UAAD;GACE,MAAK;GACL,WAAW;GACX,gBAAc;GACd,cAAY;GACZ,OAAO;GACP,UAAU,MAAU;IAGlB,AAFA,EAAM,eAAe,GACrB,EAAM,gBAAgB,GACtB,EAAY,CAAQ;GACtB;aAEA,kBAAC,GAAD;IAAM,OAAO;IAAI,QAAQ;IAAI,eAAY;GAAQ,CAAA;EAC3C,CAAA;CAEZ,GAEM,KACJ,GAKA,MACiC;EACjC,IAAM,IAAc,GA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5B,IAAM,IAAM,EAAkB,GAAW,CAAO,GAC1C,IAAO,EAAa;KACxB;KACA;KACA,MAAM,EAAU,QAAQ,EAAM;IAChC,CAAC;IACD,AAAI,KAAQ,QACV,EAAM,KAAK,CAAI;IAEjB;GACF;GACA,IAAI;GACJ,AAAI,EAAU,SAAS,SACrB,IAAY,EAAa,EAAU,OAAO,CAAI;GAEhD,IAAM,IAAO,EAAgB;IAC3B,UAAU,EAAU;IACpB;IACA,WAAW,EAAM;IACjB,UAAU,EAAU;IACpB;IACA,WAAW;GACb,CAAC;GACD,AAAI,KAAQ,QACV,EAAM,KAAK,CAAI;EAEnB,CAAC;EAGH,IAAI,IAAwC;EAO5C,IANI,KAAoB,EAAM,UAAU,wBAAwB,OAC9D,IAAe,EAAM,QAAQ,MACpB,EAAK,MAAM,SAAS,eAAe,EAAK,aAAa,EAC7D,IAGC,EAAa,WAAW,GAC1B;EAGF,IAAI;EACJ,AAAI,EAAM,SAAS,SACjB,IAAQ,EAAa,EAAM,OAAO,CAAI;EAGxC,IAAM,IAAc,IAAqB,IACrC;EAOJ,AANI,KAA0B,SAC5B,KAAqB,MAAuB;GAC1C,EAAuB,GAAS,CAAS;EAC3C,IAGF,EAAS,KAAK;GACZ,IAAI;GACJ;GACA,MAAM,EAAW,EAAM,MAAM,KAAA,GAAW,EAAE;GAC1C,OAAO;GACP,aAAa,EAAM,UAAU,eAAe;GAC5C,kBAAkB,EAAM,UAAU,oBAAoB;GACtD;GACA;EACF,CAAC;CACH,CAAC,GAEM;AACT"}
|
|
@@ -76,7 +76,7 @@ var e = (e, t) => e(t), t = (e, t) => !!(e === t || t !== "/" && e.startsWith(`$
|
|
|
76
76
|
return i.kind === "tool" && (a = {
|
|
77
77
|
kind: "tool",
|
|
78
78
|
id: e
|
|
79
|
-
}), n?.isItemVisible == null ? i.kind === "tool"
|
|
79
|
+
}), n?.isItemVisible == null ? i.kind === "tool" || i.hasList : n.isItemVisible(a, r);
|
|
80
80
|
}, m = (e, t, n, r) => {
|
|
81
81
|
let i = [], a = /* @__PURE__ */ new Set();
|
|
82
82
|
return Object.entries(e).forEach(([, e]) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebarUtils.js","names":[],"sources":["../../../../../src/components/backoffice/layout/sidebarUtils.ts"],"sourcesContent":["import type { TFunction } from 'i18next';\n\nimport type {\n BackofficeEntityManifestMap,\n I18nLabel,\n} from '@plumile/backoffice-core/types.js';\nimport type {\n BackofficeSidebarConfig,\n BackofficeIconComponent,\n BackofficeSidebarGroupConfig,\n BackofficeSidebarItemDescriptor,\n BackofficeSidebarItemConfig,\n BackofficeSidebarHubConfig,\n BackofficeSidebarHubGroupConfig,\n BackofficeResolvedSidebarHubConfig,\n} from '../../../provider/types.js';\n\nexport const resolveLabel = (label: I18nLabel, tApp: TFunction): string => {\n return label(tApp);\n};\n\nexport const isActivePath = (pathname: string, href: string): boolean => {\n if (pathname === href) {\n return true;\n }\n if (href !== '/' && pathname.startsWith(`${href}/`)) {\n return true;\n }\n return false;\n};\n\nexport const joinBackofficePath = (\n basePath: string,\n pathSegment: string,\n): string => {\n const normalizedBasePath = basePath.replace(/\\/+$/g, '');\n const normalizedPathSegment = pathSegment.replace(/^\\/+/g, '');\n if (normalizedBasePath === '') {\n return `/${normalizedPathSegment}`;\n }\n return `${normalizedBasePath}/${normalizedPathSegment}`;\n};\n\nexport const buildDefaultGroups = (\n entities: BackofficeEntityManifestMap,\n): Record<string, BackofficeSidebarGroupConfig> => {\n const entityIds = Object.keys(entities);\n\n return {\n main: {\n entities: entityIds,\n },\n };\n};\n\nexport const resolveSidebarGroups = (\n entities: BackofficeEntityManifestMap,\n sidebar: BackofficeSidebarConfig | undefined,\n): Record<string, BackofficeSidebarGroupConfig> => {\n return sidebar?.groups ?? buildDefaultGroups(entities);\n};\n\nexport type EntityGroupLookup = Map<\n string,\n {\n groupId: string;\n groupIcon?: BackofficeIconComponent;\n itemIcon?: BackofficeIconComponent;\n }\n>;\n\nexport const resolveItemDescriptor = (\n item: BackofficeSidebarItemConfig,\n): BackofficeSidebarItemDescriptor => {\n if (item.kind === 'dashboard') {\n return { kind: 'dashboard', id: item.id ?? 'dashboard' };\n }\n return { kind: item.kind, id: item.id };\n};\n\nexport const resolveGroupItems = <\n TManifest extends BackofficeEntityManifestMap = BackofficeEntityManifestMap,\n>(\n group: BackofficeSidebarGroupConfig<TManifest>,\n): readonly BackofficeSidebarItemConfig<TManifest>[] => {\n if (group.items != null) {\n return group.items;\n }\n return (group.entities?.map((entityId) => {\n return { kind: 'entity', id: entityId } as const;\n }) ?? []) as unknown as readonly BackofficeSidebarItemConfig<TManifest>[];\n};\n\nexport type BackofficeResolvedSidebarHubConfigFor<\n TManifest extends BackofficeEntityManifestMap = BackofficeEntityManifestMap,\n> = BackofficeSidebarHubConfig<TManifest> & {\n groups: readonly BackofficeSidebarHubGroupConfig<TManifest>[];\n};\n\nexport const resolveSidebarHubFor = <\n TManifest extends BackofficeEntityManifestMap = BackofficeEntityManifestMap,\n>(\n item: BackofficeSidebarHubConfig<TManifest>,\n sidebar: BackofficeSidebarConfig<TManifest> | undefined,\n): BackofficeResolvedSidebarHubConfigFor<TManifest> => {\n const registeredHub = sidebar?.hubs?.[item.id];\n return {\n ...registeredHub,\n ...item,\n groups: item.groups ?? registeredHub?.groups ?? [],\n };\n};\n\nexport const resolveSidebarHub = (\n item: BackofficeSidebarHubConfig,\n sidebar: BackofficeSidebarConfig | undefined,\n): BackofficeResolvedSidebarHubConfig => {\n return resolveSidebarHubFor(item, sidebar);\n};\n\nexport const resolveHubEntityIds = (\n hub: BackofficeResolvedSidebarHubConfig,\n): readonly string[] => {\n const output: string[] = [];\n const seen = new Set<string>();\n hub.groups.forEach((group) => {\n group.items.forEach((item) => {\n if (seen.has(item.id)) {\n return;\n }\n seen.add(item.id);\n output.push(item.id);\n });\n });\n return output;\n};\n\nexport type ResolvedSidebarHubEntry = {\n groupId: string | null;\n hub: BackofficeResolvedSidebarHubConfig;\n icon?: BackofficeIconComponent;\n};\n\nexport const resolveSidebarHubEntries = (\n groups: Record<string, BackofficeSidebarGroupConfig>,\n sidebar: BackofficeSidebarConfig | undefined,\n): readonly ResolvedSidebarHubEntry[] => {\n const output: ResolvedSidebarHubEntry[] = [];\n const seen = new Set<string>();\n\n Object.entries(groups).forEach(([groupId, group]) => {\n resolveGroupItems(group).forEach((item) => {\n if (item.kind !== 'hub' || seen.has(item.id)) {\n return;\n }\n seen.add(item.id);\n output.push({\n groupId,\n hub: resolveSidebarHub(item, sidebar),\n icon: item.icon ?? group.icon,\n });\n });\n });\n\n Object.values(sidebar?.hubs ?? {}).forEach((hub) => {\n if (seen.has(hub.id)) {\n return;\n }\n seen.add(hub.id);\n output.push({\n groupId: null,\n hub: resolveSidebarHub(hub, sidebar),\n icon: hub.icon,\n });\n });\n\n return output;\n};\n\nexport const resolveGroupEntityIds = (\n group: BackofficeSidebarGroupConfig,\n sidebar?: BackofficeSidebarConfig,\n): readonly string[] => {\n return resolveGroupItems(group).flatMap((item) => {\n if (item.kind === 'entity' || item.kind === 'tool') {\n return [item.id];\n }\n if (item.kind === 'hub') {\n return resolveHubEntityIds(resolveSidebarHub(item, sidebar));\n }\n return [];\n });\n};\n\nexport const buildEntityGroupLookup = (\n groups: Record<string, BackofficeSidebarGroupConfig>,\n sidebar?: BackofficeSidebarConfig,\n): EntityGroupLookup => {\n const lookup: EntityGroupLookup = new Map();\n\n Object.entries(groups).forEach(([groupId, group]) => {\n resolveGroupItems(group).forEach((item) => {\n if (item.kind === 'dashboard') {\n return;\n }\n\n if (item.kind === 'hub') {\n const hub = resolveSidebarHub(item, sidebar);\n resolveHubEntityIds(hub).forEach((entityId) => {\n if (!lookup.has(entityId)) {\n lookup.set(entityId, {\n groupId,\n groupIcon: group.icon,\n itemIcon: item.icon ?? hub.icon,\n });\n }\n });\n return;\n }\n\n if (!lookup.has(item.id)) {\n lookup.set(item.id, {\n groupId,\n groupIcon: group.icon,\n itemIcon: item.icon,\n });\n }\n });\n });\n\n return lookup;\n};\n\nconst isEntityVisible = (\n entityId: string,\n entities: BackofficeEntityManifestMap,\n sidebar: BackofficeSidebarConfig | undefined,\n permissions: unknown,\n): boolean => {\n const config = entities[entityId];\n if (config == null) {\n return false;\n }\n\n let descriptor: BackofficeSidebarItemDescriptor = {\n kind: 'entity',\n id: entityId,\n };\n if (config.kind === 'tool') {\n descriptor = { kind: 'tool', id: entityId };\n }\n\n if (sidebar?.isItemVisible != null) {\n return sidebar.isItemVisible(descriptor, permissions);\n }\n\n if (config.kind === 'tool') {\n return true;\n }\n return config.hasList;\n};\n\nexport const resolveVisibleEntityIds = (\n groups: Record<string, BackofficeSidebarGroupConfig>,\n entities: BackofficeEntityManifestMap,\n sidebar: BackofficeSidebarConfig | undefined,\n permissions: unknown,\n): string[] => {\n const output: string[] = [];\n const seen = new Set<string>();\n\n Object.entries(groups).forEach(([, group]) => {\n if (group.isVisible != null && !group.isVisible(permissions)) {\n return;\n }\n resolveGroupEntityIds(group, sidebar).forEach((entityId) => {\n if (seen.has(entityId)) {\n return;\n }\n if (!isEntityVisible(entityId, entities, sidebar, permissions)) {\n return;\n }\n seen.add(entityId);\n output.push(entityId);\n });\n });\n\n return output;\n};\n\nexport const resolveActiveEntityId = (\n pathname: string,\n entities: BackofficeEntityManifestMap,\n): string | null => {\n const entries = Object.entries(entities);\n for (const [entityId, config] of entries) {\n if (config.kind === 'tool') {\n if (isActivePath(pathname, config.routes.list)) {\n return entityId;\n }\n } else if (config.hasList && isActivePath(pathname, config.routes.list)) {\n return entityId;\n }\n }\n return null;\n};\n\nexport const resolveActiveGroupId = (\n groups: Record<string, BackofficeSidebarGroupConfig>,\n activeEntityId: string | null,\n entities: BackofficeEntityManifestMap,\n sidebar: BackofficeSidebarConfig | undefined,\n permissions: unknown,\n): string | null => {\n if (activeEntityId == null) {\n return null;\n }\n\n if (!isEntityVisible(activeEntityId, entities, sidebar, permissions)) {\n return null;\n }\n\n for (const [groupId, group] of Object.entries(groups)) {\n const isVisible = group.isVisible == null || group.isVisible(permissions);\n if (\n isVisible &&\n resolveGroupEntityIds(group, sidebar).includes(activeEntityId)\n ) {\n return groupId;\n }\n }\n\n return null;\n};\n"],"mappings":";AAiBA,IAAa,KAAgB,GAAkB,MACtC,EAAM,CAAI,GAGN,KAAgB,GAAkB,MAI7C,GAHI,MAAa,KAGb,MAAS,OAAO,EAAS,WAAW,GAAG,EAAK,EAAE,IAMvC,KACX,GACA,MACW;CACX,IAAM,IAAqB,EAAS,QAAQ,SAAS,EAAE,GACjD,IAAwB,EAAY,QAAQ,SAAS,EAAE;CAI7D,OAHI,MAAuB,KAClB,IAAI,MAEN,GAAG,EAAmB,GAAG;AAClC,GAEa,KACX,OAIO,EACL,MAAM,EACJ,UAJc,OAAO,KAAK,CAIhB,EACZ,EACF,IAGW,KACX,GACA,MAEO,GAAS,UAAU,EAAmB,CAAQ,GAY1C,KACX,MAEI,EAAK,SAAS,cACT;CAAE,MAAM;CAAa,IAAI,EAAK,MAAM;AAAY,IAElD;CAAE,MAAM,EAAK;CAAM,IAAI,EAAK;AAAG,GAG3B,KAGX,MAEI,EAAM,SAAS,OAGX,EAAM,UAAU,KAAK,OACpB;CAAE,MAAM;CAAU,IAAI;AAAS,EACvC,KAAK,CAAC,IAJE,EAAM,OAaJ,KAGX,GACA,MACqD;CACrD,IAAM,IAAgB,GAAS,OAAO,EAAK;CAC3C,OAAO;EACL,GAAG;EACH,GAAG;EACH,QAAQ,EAAK,UAAU,GAAe,UAAU,CAAC;CACnD;AACF,GAEa,KACX,GACA,MAEO,EAAqB,GAAM,CAAO,GAG9B,KACX,MACsB;CACtB,IAAM,IAAmB,CAAC,GACpB,oBAAO,IAAI,IAAY;CAU7B,OATA,EAAI,OAAO,SAAS,MAAU;EAC5B,EAAM,MAAM,SAAS,MAAS;GACxB,EAAK,IAAI,EAAK,EAAE,MAGpB,EAAK,IAAI,EAAK,EAAE,GAChB,EAAO,KAAK,EAAK,EAAE;EACrB,CAAC;CACH,CAAC,G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S,CAAW,GACjE,OAAO;CAGT,KAAK,IAAM,CAAC,GAAS,MAAU,OAAO,QAAQ,CAAM,GAElD,KADkB,EAAM,aAAa,QAAQ,EAAM,UAAU,CAAW,MAGtE,EAAsB,GAAO,CAAO,CAAC,CAAC,SAAS,CAAc,GAE7D,OAAO;CAIX,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"sidebarUtils.js","names":[],"sources":["../../../../../src/components/backoffice/layout/sidebarUtils.ts"],"sourcesContent":["import type { TFunction } from 'i18next';\n\nimport type {\n BackofficeEntityManifestMap,\n I18nLabel,\n} from '@plumile/backoffice-core/types.js';\nimport type {\n BackofficeSidebarConfig,\n BackofficeIconComponent,\n BackofficeSidebarGroupConfig,\n BackofficeSidebarItemDescriptor,\n BackofficeSidebarItemConfig,\n BackofficeSidebarHubConfig,\n BackofficeSidebarHubGroupConfig,\n BackofficeResolvedSidebarHubConfig,\n} from '../../../provider/types.js';\n\nexport const resolveLabel = (label: I18nLabel, tApp: TFunction): string => {\n return label(tApp);\n};\n\nexport const isActivePath = (pathname: string, href: string): boolean => {\n if (pathname === href) {\n return true;\n }\n if (href !== '/' && pathname.startsWith(`${href}/`)) {\n return true;\n }\n return false;\n};\n\nexport const joinBackofficePath = (\n basePath: string,\n pathSegment: string,\n): string => {\n const normalizedBasePath = basePath.replace(/\\/+$/g, '');\n const normalizedPathSegment = pathSegment.replace(/^\\/+/g, '');\n if (normalizedBasePath === '') {\n return `/${normalizedPathSegment}`;\n }\n return `${normalizedBasePath}/${normalizedPathSegment}`;\n};\n\nexport const buildDefaultGroups = (\n entities: BackofficeEntityManifestMap,\n): Record<string, BackofficeSidebarGroupConfig> => {\n const entityIds = Object.keys(entities);\n\n return {\n main: {\n entities: entityIds,\n },\n };\n};\n\nexport const resolveSidebarGroups = (\n entities: BackofficeEntityManifestMap,\n sidebar: BackofficeSidebarConfig | undefined,\n): Record<string, BackofficeSidebarGroupConfig> => {\n return sidebar?.groups ?? buildDefaultGroups(entities);\n};\n\nexport type EntityGroupLookup = Map<\n string,\n {\n groupId: string;\n groupIcon?: BackofficeIconComponent;\n itemIcon?: BackofficeIconComponent;\n }\n>;\n\nexport const resolveItemDescriptor = (\n item: BackofficeSidebarItemConfig,\n): BackofficeSidebarItemDescriptor => {\n if (item.kind === 'dashboard') {\n return { kind: 'dashboard', id: item.id ?? 'dashboard' };\n }\n return { kind: item.kind, id: item.id };\n};\n\nexport const resolveGroupItems = <\n TManifest extends BackofficeEntityManifestMap = BackofficeEntityManifestMap,\n>(\n group: BackofficeSidebarGroupConfig<TManifest>,\n): readonly BackofficeSidebarItemConfig<TManifest>[] => {\n if (group.items != null) {\n return group.items;\n }\n return (group.entities?.map((entityId) => {\n return { kind: 'entity', id: entityId } as const;\n }) ?? []) as unknown as readonly BackofficeSidebarItemConfig<TManifest>[];\n};\n\nexport type BackofficeResolvedSidebarHubConfigFor<\n TManifest extends BackofficeEntityManifestMap = BackofficeEntityManifestMap,\n> = BackofficeSidebarHubConfig<TManifest> & {\n groups: readonly BackofficeSidebarHubGroupConfig<TManifest>[];\n};\n\nexport const resolveSidebarHubFor = <\n TManifest extends BackofficeEntityManifestMap = BackofficeEntityManifestMap,\n>(\n item: BackofficeSidebarHubConfig<TManifest>,\n sidebar: BackofficeSidebarConfig<TManifest> | undefined,\n): BackofficeResolvedSidebarHubConfigFor<TManifest> => {\n const registeredHub = sidebar?.hubs?.[item.id];\n return {\n ...registeredHub,\n ...item,\n groups: item.groups ?? registeredHub?.groups ?? [],\n };\n};\n\nexport const resolveSidebarHub = (\n item: BackofficeSidebarHubConfig,\n sidebar: BackofficeSidebarConfig | undefined,\n): BackofficeResolvedSidebarHubConfig => {\n return resolveSidebarHubFor(item, sidebar);\n};\n\nexport const resolveHubEntityIds = (\n hub: BackofficeResolvedSidebarHubConfig,\n): readonly string[] => {\n const output: string[] = [];\n const seen = new Set<string>();\n hub.groups.forEach((group) => {\n group.items.forEach((item) => {\n if (seen.has(item.id)) {\n return;\n }\n seen.add(item.id);\n output.push(item.id);\n });\n });\n return output;\n};\n\nexport type ResolvedSidebarHubEntry = {\n groupId: string | null;\n hub: BackofficeResolvedSidebarHubConfig;\n icon?: BackofficeIconComponent;\n};\n\nexport const resolveSidebarHubEntries = (\n groups: Record<string, BackofficeSidebarGroupConfig>,\n sidebar: BackofficeSidebarConfig | undefined,\n): readonly ResolvedSidebarHubEntry[] => {\n const output: ResolvedSidebarHubEntry[] = [];\n const seen = new Set<string>();\n\n Object.entries(groups).forEach(([groupId, group]) => {\n resolveGroupItems(group).forEach((item) => {\n if (item.kind !== 'hub' || seen.has(item.id)) {\n return;\n }\n seen.add(item.id);\n output.push({\n groupId,\n hub: resolveSidebarHub(item, sidebar),\n icon: item.icon ?? group.icon,\n });\n });\n });\n\n Object.values(sidebar?.hubs ?? {}).forEach((hub) => {\n if (seen.has(hub.id)) {\n return;\n }\n seen.add(hub.id);\n output.push({\n groupId: null,\n hub: resolveSidebarHub(hub, sidebar),\n icon: hub.icon,\n });\n });\n\n return output;\n};\n\nexport const resolveGroupEntityIds = (\n group: BackofficeSidebarGroupConfig,\n sidebar?: BackofficeSidebarConfig,\n): readonly string[] => {\n return resolveGroupItems(group).flatMap((item) => {\n if (item.kind === 'entity' || item.kind === 'tool') {\n return [item.id];\n }\n if (item.kind === 'hub') {\n return resolveHubEntityIds(resolveSidebarHub(item, sidebar));\n }\n return [];\n });\n};\n\nexport const buildEntityGroupLookup = (\n groups: Record<string, BackofficeSidebarGroupConfig>,\n sidebar?: BackofficeSidebarConfig,\n): EntityGroupLookup => {\n const lookup: EntityGroupLookup = new Map();\n\n Object.entries(groups).forEach(([groupId, group]) => {\n resolveGroupItems(group).forEach((item) => {\n if (item.kind === 'dashboard') {\n return;\n }\n\n if (item.kind === 'hub') {\n const hub = resolveSidebarHub(item, sidebar);\n resolveHubEntityIds(hub).forEach((entityId) => {\n if (!lookup.has(entityId)) {\n lookup.set(entityId, {\n groupId,\n groupIcon: group.icon,\n itemIcon: item.icon ?? hub.icon,\n });\n }\n });\n return;\n }\n\n if (!lookup.has(item.id)) {\n lookup.set(item.id, {\n groupId,\n groupIcon: group.icon,\n itemIcon: item.icon,\n });\n }\n });\n });\n\n return lookup;\n};\n\nconst isEntityVisible = (\n entityId: string,\n entities: BackofficeEntityManifestMap,\n sidebar: BackofficeSidebarConfig | undefined,\n permissions: unknown,\n): boolean => {\n const config = entities[entityId];\n if (config == null) {\n return false;\n }\n\n let descriptor: BackofficeSidebarItemDescriptor = {\n kind: 'entity',\n id: entityId,\n };\n if (config.kind === 'tool') {\n descriptor = { kind: 'tool', id: entityId };\n }\n\n if (sidebar?.isItemVisible != null) {\n return sidebar.isItemVisible(descriptor, permissions);\n }\n\n if (config.kind === 'tool') {\n return true;\n }\n return config.hasList;\n};\n\nexport const resolveVisibleEntityIds = (\n groups: Record<string, BackofficeSidebarGroupConfig>,\n entities: BackofficeEntityManifestMap,\n sidebar: BackofficeSidebarConfig | undefined,\n permissions: unknown,\n): string[] => {\n const output: string[] = [];\n const seen = new Set<string>();\n\n Object.entries(groups).forEach(([, group]) => {\n if (group.isVisible != null && !group.isVisible(permissions)) {\n return;\n }\n resolveGroupEntityIds(group, sidebar).forEach((entityId) => {\n if (seen.has(entityId)) {\n return;\n }\n if (!isEntityVisible(entityId, entities, sidebar, permissions)) {\n return;\n }\n seen.add(entityId);\n output.push(entityId);\n });\n });\n\n return output;\n};\n\nexport const resolveActiveEntityId = (\n pathname: string,\n entities: BackofficeEntityManifestMap,\n): string | null => {\n const entries = Object.entries(entities);\n for (const [entityId, config] of entries) {\n if (config.kind === 'tool') {\n if (isActivePath(pathname, config.routes.list)) {\n return entityId;\n }\n } else if (config.hasList && isActivePath(pathname, config.routes.list)) {\n return entityId;\n }\n }\n return null;\n};\n\nexport const resolveActiveGroupId = (\n groups: Record<string, BackofficeSidebarGroupConfig>,\n activeEntityId: string | null,\n entities: BackofficeEntityManifestMap,\n sidebar: BackofficeSidebarConfig | undefined,\n permissions: unknown,\n): string | null => {\n if (activeEntityId == null) {\n return null;\n }\n\n if (!isEntityVisible(activeEntityId, entities, sidebar, permissions)) {\n return null;\n }\n\n for (const [groupId, group] of Object.entries(groups)) {\n const isVisible = group.isVisible == null || group.isVisible(permissions);\n if (\n isVisible &&\n resolveGroupEntityIds(group, sidebar).includes(activeEntityId)\n ) {\n return groupId;\n }\n }\n\n return null;\n};\n"],"mappings":";AAiBA,IAAa,KAAgB,GAAkB,MACtC,EAAM,CAAI,GAGN,KAAgB,GAAkB,MAI7C,GAHI,MAAa,KAGb,MAAS,OAAO,EAAS,WAAW,GAAG,EAAK,EAAE,IAMvC,KACX,GACA,MACW;CACX,IAAM,IAAqB,EAAS,QAAQ,SAAS,EAAE,GACjD,IAAwB,EAAY,QAAQ,SAAS,EAAE;CAI7D,OAHI,MAAuB,KAClB,IAAI,MAEN,GAAG,EAAmB,GAAG;AAClC,GAEa,KACX,OAIO,EACL,MAAM,EACJ,UAJc,OAAO,KAAK,CAIhB,EACZ,EACF,IAGW,KACX,GACA,MAEO,GAAS,UAAU,EAAmB,CAAQ,GAY1C,KACX,MAEI,EAAK,SAAS,cACT;CAAE,MAAM;CAAa,IAAI,EAAK,MAAM;AAAY,IAElD;CAAE,MAAM,EAAK;CAAM,IAAI,EAAK;AAAG,GAG3B,KAGX,MAEI,EAAM,SAAS,OAGX,EAAM,UAAU,KAAK,OACpB;CAAE,MAAM;CAAU,IAAI;AAAS,EACvC,KAAK,CAAC,IAJE,EAAM,OAaJ,KAGX,GACA,MACqD;CACrD,IAAM,IAAgB,GAAS,OAAO,EAAK;CAC3C,OAAO;EACL,GAAG;EACH,GAAG;EACH,QAAQ,EAAK,UAAU,GAAe,UAAU,CAAC;CACnD;AACF,GAEa,KACX,GACA,MAEO,EAAqB,GAAM,CAAO,GAG9B,KACX,MACsB;CACtB,IAAM,IAAmB,CAAC,GACpB,oBAAO,IAAI,IAAY;CAU7B,OATA,EAAI,OAAO,SAAS,MAAU;EAC5B,EAAM,MAAM,SAAS,MAAS;GACxB,EAAK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;AACT,GAEa,KACX,GACA,GACA,GACA,GACA,MACkB;CAKlB,IAJI,KAAkB,QAIlB,CAAC,EAAgB,GAAgB,GAAU,GAAS,CAAW,GACjE,OAAO;CAGT,KAAK,IAAM,CAAC,GAAS,MAAU,OAAO,QAAQ,CAAM,GAElD,KADkB,EAAM,aAAa,QAAQ,EAAM,UAAU,CAAW,MAGtE,EAAsB,GAAO,CAAO,CAAC,CAAC,SAAS,CAAc,GAE7D,OAAO;CAIX,OAAO;AACT"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* empty css */
|
|
2
1
|
//#region src/components/backoffice/list/RowFlagsCell.css.ts
|
|
3
2
|
var e = "txvbqb10mk txvbqb11k5 txvbqb12hd txvbqbxtg txvbqbls4", t = "txvbqbfqq txvbqbey txvbqbls4 txvbqbi8n txvbqb19us", n = "qbwcuex qbwcuer txvbqbfqq txvbqbey txvbqbls4 txvbqbh6d txvbqbo4m qbwcue11 qbwcuev txvbqb19hf txvbqbjmh txvbqbvat txvbqbub2";
|
|
4
3
|
//#endregion
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* empty css */
|
|
2
1
|
//#region src/components/backoffice/pickers/entityIdPickerDialog.css.ts
|
|
3
2
|
var e = "txvbqb10m7 txvbqb11js txvbqb12ig txvbqbxuj txvbqb1bgt txvbqb9j txvbqb18e2", t = "txvbqb10na txvbqb11kv txvbqb12it txvbqbxuw txvbqbfpn txvbqbey txvbqbls4 txvbqbhdl txvbqb1bgt", n = "txvbqb9j txvbqb1bgt";
|
|
4
3
|
//#endregion
|
|
@@ -1,25 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Spinner as a } from "@plumile/ui/backoffice/atoms/spinner/Spinner.js";
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation as t } from "react-i18next";
|
|
3
|
+
import { RouteFallback as n } from "@plumile/ui/components/routing/RouteFallback.js";
|
|
5
4
|
//#region src/components/backoffice/routing/BackofficeRouteFallback.tsx
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
size: 28,
|
|
13
|
-
ariaLabel: i
|
|
14
|
-
}), /* @__PURE__ */ n("div", {
|
|
15
|
-
className: e,
|
|
16
|
-
children: i
|
|
17
|
-
})]
|
|
18
|
-
}), s = () => {
|
|
19
|
-
let { t: e, i18n: t } = i("backofficeReact", { useSuspense: !1 }), r = "Loading...";
|
|
20
|
-
return t.isInitialized && (r = e("common.loading")), /* @__PURE__ */ n(o, { label: r });
|
|
5
|
+
var r = ({ label: t = "Loading..." }) => /* @__PURE__ */ e(n, {
|
|
6
|
+
variant: "page",
|
|
7
|
+
label: t
|
|
8
|
+
}), i = () => {
|
|
9
|
+
let { t: n, i18n: i } = t("backofficeReact", { useSuspense: !1 }), a = "Loading...";
|
|
10
|
+
return i.isInitialized && (a = n("common.loading")), /* @__PURE__ */ e(r, { label: a });
|
|
21
11
|
};
|
|
22
12
|
//#endregion
|
|
23
|
-
export {
|
|
13
|
+
export { i as BackofficeRouteFallback, i as default, r as BackofficeStaticRouteFallback };
|
|
24
14
|
|
|
25
15
|
//# sourceMappingURL=BackofficeRouteFallback.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeRouteFallback.js","names":[],"sources":["../../../../../src/components/backoffice/routing/BackofficeRouteFallback.tsx"],"sourcesContent":["import { type JSX } from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport {
|
|
1
|
+
{"version":3,"file":"BackofficeRouteFallback.js","names":[],"sources":["../../../../../src/components/backoffice/routing/BackofficeRouteFallback.tsx"],"sourcesContent":["import { type JSX } from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport { RouteFallback } from '@plumile/ui/components/routing/RouteFallback.js';\n\nexport type BackofficeRouteFallbackProps = {\n label?: string;\n};\n\nexport const BackofficeStaticRouteFallback = ({\n label = 'Loading...',\n}: BackofficeRouteFallbackProps): JSX.Element => {\n return <RouteFallback variant=\"page\" label={label} />;\n};\n\nexport const BackofficeRouteFallback = (): JSX.Element => {\n const { t, i18n } = useTranslation('backofficeReact', {\n useSuspense: false,\n });\n let label = 'Loading...';\n if (i18n.isInitialized) {\n label = t('common.loading');\n }\n\n return <BackofficeStaticRouteFallback label={label} />;\n};\n\nexport default BackofficeRouteFallback;\n"],"mappings":";;;;AASA,IAAa,KAAiC,EAC5C,WAAQ,mBAED,kBAAC,GAAD;CAAe,SAAQ;CAAc;AAAQ,CAAA,GAGzC,UAA6C;CACxD,IAAM,EAAE,MAAG,YAAS,EAAe,mBAAmB,EACpD,aAAa,GACf,CAAC,GACG,IAAQ;CAKZ,OAJI,EAAK,kBACP,IAAQ,EAAE,gBAAgB,IAGrB,kBAAC,GAAD,EAAsC,SAAQ,CAAA;AACvD"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* empty css */
|
|
2
1
|
//#region src/components/backoffice/routing/backofficeContentFallback.css.ts
|
|
3
2
|
var e = "txvbqbfpn txvbqbh4x txvbqbheb txvbqb19us txvbqbuo2", t = "txvbqbu5n", n = "txvbqbfq0 txvbqbheb txvbqbjdt", r = "txvbqbfpn txvbqbh4x txvbqbhdy txvbqbwxb txvbqbuhx txvbqb2up txvbqb28o txvbqb2sj txvbqb1d9 txvbqb1b8t";
|
|
4
3
|
//#endregion
|
|
@@ -140,8 +140,8 @@ var S = (e, t) => e(t), Te = (e, t) => e.fromGraphQL != null && t != null ? e.fr
|
|
|
140
140
|
typeof r == "string" && (i = r), typeof r == "number" && Number.isFinite(r) && (i = String(r));
|
|
141
141
|
let s = S(e.label, C);
|
|
142
142
|
if (e.kind === "text") {
|
|
143
|
-
let t =
|
|
144
|
-
return e.placeholderText != null && (
|
|
143
|
+
let t = e.placeholderLabel == null ? s : S(e.placeholderLabel, C), r = w("filters.placeholders.search", { label: t });
|
|
144
|
+
return e.placeholderText != null && (r = S(e.placeholderText, C)), /* @__PURE__ */ g(a, {
|
|
145
145
|
value: i,
|
|
146
146
|
onApply: (t) => {
|
|
147
147
|
let r = x(E.where, n, t, e.path);
|
|
@@ -150,14 +150,14 @@ var S = (e, t) => e(t), Te = (e, t) => e.fromGraphQL != null && t != null ? e.fr
|
|
|
150
150
|
where: r
|
|
151
151
|
});
|
|
152
152
|
},
|
|
153
|
-
placeholder:
|
|
154
|
-
ariaLabel:
|
|
153
|
+
placeholder: r,
|
|
154
|
+
ariaLabel: r,
|
|
155
155
|
className: d
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
158
|
if (e.kind === "datetime") {
|
|
159
|
-
let t =
|
|
160
|
-
return e.placeholderText != null && (
|
|
159
|
+
let t = e.placeholderLabel == null ? s : S(e.placeholderLabel, C), r = w("filters.placeholders.search", { label: t });
|
|
160
|
+
return e.placeholderText != null && (r = S(e.placeholderText, C)), /* @__PURE__ */ g(a, {
|
|
161
161
|
value: Oe(i),
|
|
162
162
|
onApply: (t) => {
|
|
163
163
|
let r = ke(t), i = x(E.where, n, r, e.path);
|
|
@@ -166,15 +166,15 @@ var S = (e, t) => e(t), Te = (e, t) => e.fromGraphQL != null && t != null ? e.fr
|
|
|
166
166
|
where: i
|
|
167
167
|
});
|
|
168
168
|
},
|
|
169
|
-
placeholder:
|
|
170
|
-
ariaLabel:
|
|
169
|
+
placeholder: r,
|
|
170
|
+
ariaLabel: r,
|
|
171
171
|
className: d,
|
|
172
172
|
type: "datetime-local"
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
175
|
if (e.kind === "number") {
|
|
176
|
-
let t =
|
|
177
|
-
return e.placeholderText != null && (
|
|
176
|
+
let t = e.placeholderLabel == null ? s : S(e.placeholderLabel, C), r = w("filters.placeholders.search", { label: t });
|
|
177
|
+
return e.placeholderText != null && (r = S(e.placeholderText, C)), /* @__PURE__ */ g(a, {
|
|
178
178
|
value: i,
|
|
179
179
|
onApply: (t) => {
|
|
180
180
|
let r = t.trim(), i = r === "" ? null : Number(r), a = x(E.where, n, Number.isFinite(i) ? i : null, e.path);
|
|
@@ -183,8 +183,8 @@ var S = (e, t) => e(t), Te = (e, t) => e.fromGraphQL != null && t != null ? e.fr
|
|
|
183
183
|
where: a
|
|
184
184
|
});
|
|
185
185
|
},
|
|
186
|
-
placeholder:
|
|
187
|
-
ariaLabel:
|
|
186
|
+
placeholder: r,
|
|
187
|
+
ariaLabel: r,
|
|
188
188
|
className: d,
|
|
189
189
|
inputMode: e.inputMode ?? "numeric",
|
|
190
190
|
type: "text"
|
|
@@ -301,8 +301,8 @@ var S = (e, t) => e(t), Te = (e, t) => e.fromGraphQL != null && t != null ? e.fr
|
|
|
301
301
|
});
|
|
302
302
|
}
|
|
303
303
|
if (e.kind === "stringList") {
|
|
304
|
-
let t =
|
|
305
|
-
return e.placeholderText != null && (
|
|
304
|
+
let t = e.placeholderLabel == null ? s : S(e.placeholderLabel, C), r = w("filters.placeholders.search", { label: t });
|
|
305
|
+
return e.placeholderText != null && (r = S(e.placeholderText, C)), /* @__PURE__ */ g(a, {
|
|
306
306
|
value: i,
|
|
307
307
|
onApply: (t) => {
|
|
308
308
|
let r = t.split(/[\n,]+/u).map((e) => e.trim()).filter((e) => e !== ""), i = x(E.where, n, r, e.path);
|
|
@@ -311,8 +311,8 @@ var S = (e, t) => e(t), Te = (e, t) => e.fromGraphQL != null && t != null ? e.fr
|
|
|
311
311
|
where: i
|
|
312
312
|
});
|
|
313
313
|
},
|
|
314
|
-
placeholder:
|
|
315
|
-
ariaLabel:
|
|
314
|
+
placeholder: r,
|
|
315
|
+
ariaLabel: r,
|
|
316
316
|
className: d
|
|
317
317
|
});
|
|
318
318
|
}
|
|
@@ -366,7 +366,7 @@ var S = (e, t) => e(t), Te = (e, t) => e.fromGraphQL != null && t != null ? e.fr
|
|
|
366
366
|
R.filters,
|
|
367
367
|
R.ui?.toolbar,
|
|
368
368
|
Ke
|
|
369
|
-
]), Y = p(() => R.filters.filter((e) => e.placement == null
|
|
369
|
+
]), Y = p(() => R.filters.filter((e) => e.placement == null || e.placement === "drawer" || e.placement === "both"), [R.filters]), X = p(() => J.find((e) => e.kind === "text"), [J]), qe = p(() => {
|
|
370
370
|
let e = J.filter((e) => e !== X);
|
|
371
371
|
return e.length === 0 ? null : /* @__PURE__ */ g("div", {
|
|
372
372
|
className: u,
|