@plumile/backoffice-react 0.1.142 → 0.1.144
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.js.map +1 -1
- package/lib/esm/auth/TotpQrCode.js.map +1 -1
- package/lib/esm/auth/authRefreshNotice.css.js +1 -1
- package/lib/esm/auth/login/AuthPanel.js.map +1 -1
- package/lib/esm/auth/login/EmailCapturePanel.js.map +1 -1
- package/lib/esm/auth/login/LoginFlow.js.map +1 -1
- package/lib/esm/auth/login/MethodChooser.js.map +1 -1
- package/lib/esm/auth/login/MfaChallengeForm.js.map +1 -1
- package/lib/esm/auth/login/OidcButtons.js.map +1 -1
- package/lib/esm/auth/login/PasskeyLoginForm.js.map +1 -1
- package/lib/esm/auth/login/PasswordLoginPanel.js.map +1 -1
- package/lib/esm/auth/login/loginPage.css.js +1 -1
- package/lib/esm/auth/login/loginPage.css.js.map +1 -1
- package/lib/esm/auth/login/synchronizeAuthStatusQuery.js.map +1 -1
- package/lib/esm/auth/pages/AcceptInvitationScreen.js.map +1 -1
- package/lib/esm/auth/pages/PasswordResetCompleteScreen.js.map +1 -1
- package/lib/esm/auth/pages/PasswordResetRequestScreen.js.map +1 -1
- package/lib/esm/auth/pages/VerifyEmailScreen.js.map +1 -1
- package/lib/esm/components/backoffice/actions/BackofficeEntityActionFormDialog.js +14 -14
- package/lib/esm/components/backoffice/actions/BackofficeEntityActionFormDialog.js.map +1 -1
- package/lib/esm/components/backoffice/actions/LazyBackofficeEntityActionFormDialog.js.map +1 -1
- package/lib/esm/components/backoffice/actions/backofficeEntityActionFormDialog.css.js +1 -1
- package/lib/esm/components/backoffice/actions/toastViewAction.js.map +1 -1
- package/lib/esm/components/backoffice/billing/BackofficeBillingUsageChart.js +1 -1
- package/lib/esm/components/backoffice/billing/BackofficeBillingUsageChart.js.map +1 -1
- package/lib/esm/components/backoffice/billing/backofficeBillingUsageChart.css.js +1 -1
- package/lib/esm/components/backoffice/columns/buildDataTableColumns.js.map +1 -1
- package/lib/esm/components/backoffice/detail/BackofficeDetailBadgeRow.js.map +1 -1
- package/lib/esm/components/backoffice/detail/BackofficeDetailErrorList.js.map +1 -1
- package/lib/esm/components/backoffice/detail/BackofficeDetailFlagTag.js.map +1 -1
- package/lib/esm/components/backoffice/detail/BackofficeDetailRelationLink.js.map +1 -1
- package/lib/esm/components/backoffice/detail/BackofficeDetailRelationList.js.map +1 -1
- package/lib/esm/components/backoffice/detail/BackofficeDetailRelationListBlock.js.map +1 -1
- package/lib/esm/components/backoffice/detail/BackofficeDetailTaggedValue.js.map +1 -1
- package/lib/esm/components/backoffice/detail/BackofficeEntitySummaryHeader.js +6 -6
- package/lib/esm/components/backoffice/detail/BackofficeEntitySummaryHeader.js.map +1 -1
- package/lib/esm/components/backoffice/detail/BackofficeEnumLabel.js.map +1 -1
- package/lib/esm/components/backoffice/detail/BackofficeLifecycleTimelineSection.js.map +1 -1
- package/lib/esm/components/backoffice/detail/BackofficeReferenceValue.js.map +1 -1
- package/lib/esm/components/backoffice/detail/BackofficeRelationsSummaryGrid.js +1 -1
- package/lib/esm/components/backoffice/detail/BackofficeRelationsSummaryGrid.js.map +1 -1
- package/lib/esm/components/backoffice/detail/BackofficeStatusGroup.js.map +1 -1
- package/lib/esm/components/backoffice/detail/BackofficeStatusMetaBadge.js.map +1 -1
- package/lib/esm/components/backoffice/detail/BackofficeTokenUsageBreakdown.js.map +1 -1
- package/lib/esm/components/backoffice/detail/BackofficeUsageCostBreakdown.js +13 -13
- package/lib/esm/components/backoffice/detail/BackofficeUsageCostBreakdown.js.map +1 -1
- package/lib/esm/components/backoffice/detail/backofficeDetailBadgeRow.css.js +1 -1
- package/lib/esm/components/backoffice/detail/backofficeDetailErrorList.css.js +1 -1
- package/lib/esm/components/backoffice/detail/backofficeDetailLayout.css.js +1 -1
- package/lib/esm/components/backoffice/detail/backofficeDetailRelationLink.css.js +2 -1
- package/lib/esm/components/backoffice/detail/backofficeDetailRelationList.css.js +1 -1
- package/lib/esm/components/backoffice/detail/backofficeEntitySummaryHeader.css.js +1 -1
- package/lib/esm/components/backoffice/detail/backofficeRelationsSummaryGrid.css.js +1 -1
- package/lib/esm/components/backoffice/detail/backofficeUsageCostBreakdown.css.js +1 -1
- package/lib/esm/components/backoffice/detail/createBackofficeEntityLinkProps.js.map +1 -1
- package/lib/esm/components/backoffice/detail/detailPayloadUtils.js.map +1 -1
- package/lib/esm/components/backoffice/errors/BackofficeErrorBoundary.js.map +1 -1
- package/lib/esm/components/backoffice/filters/BackofficeFilterAction.js.map +1 -1
- package/lib/esm/components/backoffice/filters/DeferredFilterSearchInput.js.map +1 -1
- package/lib/esm/components/backoffice/filters/EntityFilterValue.js.map +1 -1
- package/lib/esm/components/backoffice/filters/EntityIdFilterField.js +1 -1
- package/lib/esm/components/backoffice/filters/EntityIdFilterField.js.map +1 -1
- package/lib/esm/components/backoffice/filters/backofficeFilterAction.css.js +1 -1
- package/lib/esm/components/backoffice/filters/backofficeFilterAction.css.js.map +1 -1
- package/lib/esm/components/backoffice/filters/deferredFilterSearchInput.css.js +1 -1
- package/lib/esm/components/backoffice/filters/entityIdFilterField.css.js +1 -1
- package/lib/esm/components/backoffice/hub/BackofficeHubTemplate.js +5 -5
- package/lib/esm/components/backoffice/hub/BackofficeHubTemplate.js.map +1 -1
- package/lib/esm/components/backoffice/hub/backofficeHubTemplate.css.js +1 -1
- package/lib/esm/components/backoffice/layout/BackofficePermissionsContext.js.map +1 -1
- package/lib/esm/components/backoffice/layout/backofficeSidebarActions.css.js +1 -1
- package/lib/esm/components/backoffice/layout/breadcrumb/BackofficeRightPageLayout.js.map +1 -1
- package/lib/esm/components/backoffice/layout/breadcrumb/BackofficeTopbarBreadcrumb.js +2 -2
- package/lib/esm/components/backoffice/layout/breadcrumb/BackofficeTopbarBreadcrumb.js.map +1 -1
- package/lib/esm/components/backoffice/layout/breadcrumb/BackofficeTopbarPortal.js.map +1 -1
- package/lib/esm/components/backoffice/layout/breadcrumb/BackofficeTopbarPortalContext.js.map +1 -1
- package/lib/esm/components/backoffice/layout/breadcrumb/assertValidBreadcrumb.js.map +1 -1
- package/lib/esm/components/backoffice/layout/breadcrumb/backofficeTopbarBreadcrumb.css.js +1 -1
- package/lib/esm/components/backoffice/layout/breadcrumb/buildBreadcrumbs.js.map +1 -1
- package/lib/esm/components/backoffice/layout/buildSidebarSections.js.map +1 -1
- package/lib/esm/components/backoffice/layout/mapViewerToSidebarProfileView.js.map +1 -1
- package/lib/esm/components/backoffice/layout/sidebarUtils.js.map +1 -1
- package/lib/esm/components/backoffice/links/BackofficeInlineLink.js.map +1 -1
- package/lib/esm/components/backoffice/links/BackofficeLink.js.map +1 -1
- package/lib/esm/components/backoffice/links/BackofficeLinkContent.js +1 -1
- package/lib/esm/components/backoffice/links/BackofficeLinkContent.js.map +1 -1
- package/lib/esm/components/backoffice/links/BackofficeLinkLabel.js.map +1 -1
- package/lib/esm/components/backoffice/links/backofficeLink.css.js +1 -1
- package/lib/esm/components/backoffice/links/resolveBackofficeLink.js.map +1 -1
- package/lib/esm/components/backoffice/links/resolveBackofficeTargetIcon.js.map +1 -1
- package/lib/esm/components/backoffice/links/useBackofficeLink.js.map +1 -1
- package/lib/esm/components/backoffice/list/RowFlagsCell.css.js +1 -1
- package/lib/esm/components/backoffice/list/RowFlagsCell.js.map +1 -1
- package/lib/esm/components/backoffice/overview/BackofficeOverviewLayout.js.map +1 -1
- package/lib/esm/components/backoffice/overview/backofficeOverviewLayout.css.js +1 -1
- package/lib/esm/components/backoffice/overview/backofficeOverviewLayout.css.js.map +1 -1
- package/lib/esm/components/backoffice/pickers/EntityIdPickerDialog.js.map +1 -1
- package/lib/esm/components/backoffice/pickers/entityIdPickerDialog.css.js +1 -1
- package/lib/esm/components/backoffice/refs/BackofficeEntityIdRef.js.map +1 -1
- package/lib/esm/components/backoffice/refs/BackofficeEntityLink.js.map +1 -1
- package/lib/esm/components/backoffice/refs/BackofficeRelatedCountLink.js.map +1 -1
- package/lib/esm/components/backoffice/refs/backofficeEntityIdRef.css.js +1 -2
- package/lib/esm/components/backoffice/refs/backofficeRelatedCountLink.css.js +1 -1
- package/lib/esm/components/backoffice/routing/BackofficeContentBoundary.js.map +1 -1
- package/lib/esm/components/backoffice/routing/BackofficeContentError.js.map +1 -1
- package/lib/esm/components/backoffice/routing/BackofficeContentFallback.js.map +1 -1
- package/lib/esm/components/backoffice/routing/BackofficeRouteFallback.js.map +1 -1
- package/lib/esm/components/backoffice/routing/BackofficeRoutePendingBar.js.map +1 -1
- package/lib/esm/components/backoffice/routing/backofficeContentBoundary.css.js +1 -1
- package/lib/esm/components/backoffice/routing/backofficeContentError.css.js +1 -1
- package/lib/esm/components/backoffice/routing/backofficeContentFallback.css.js +1 -1
- package/lib/esm/components/backoffice/routing/backofficeRouteFallback.css.js +1 -1
- package/lib/esm/components/backoffice/routing/backofficeRoutePendingBar.css.js +1 -1
- package/lib/esm/components/backoffice/routing/backofficeRoutePendingBar.css.js.map +1 -1
- package/lib/esm/components/backoffice/scaffolds/BackofficeEntityDetailScaffold.js.map +1 -1
- package/lib/esm/components/backoffice/scaffolds/BackofficeEntityListScaffold.js.map +1 -1
- package/lib/esm/components/backoffice/scaffolds/BackofficeListFilterContext.js.map +1 -1
- package/lib/esm/components/backoffice/scaffolds/BackofficeTabbedDetailShell.js.map +1 -1
- package/lib/esm/components/backoffice/scaffolds/backofficeEntityListScaffold.css.js +1 -1
- package/lib/esm/components/backoffice/scaffolds/backofficeTabbedDetailShell.css.js +1 -1
- package/lib/esm/components/backoffice/shared/BackofficeFilterableCell.js.map +1 -1
- package/lib/esm/components/backoffice/shared/BackofficeFormattedCurrency.js.map +1 -1
- package/lib/esm/components/backoffice/shared/BackofficeFormattedNumber.js.map +1 -1
- package/lib/esm/components/backoffice/shared/BackofficeInlineFilterRow.js.map +1 -1
- package/lib/esm/components/backoffice/shared/backofficeFilterableCell.css.js +5 -5
- package/lib/esm/components/backoffice/shared/backofficeFilterableCell.css.js.map +1 -1
- package/lib/esm/components/backoffice/shared/backofficeInlineFilterRow.css.js +1 -1
- package/lib/esm/components/backoffice/tools/BackofficeToolsDocPanel.js +1 -1
- package/lib/esm/components/backoffice/tools/BackofficeToolsDocPanel.js.map +1 -1
- package/lib/esm/components/backoffice/tools/BackofficeToolsErrorFallback.js.map +1 -1
- package/lib/esm/components/backoffice/tools/BackofficeToolsJsonForm.js.map +1 -1
- package/lib/esm/components/backoffice/tools/BackofficeToolsQueryBoundary.js.map +1 -1
- package/lib/esm/components/backoffice/tools/backofficeToolsDocPanel.css.js +1 -1
- package/lib/esm/components/backoffice/tools/backofficeToolsDocPanel.css.js.map +1 -1
- package/lib/esm/components/backoffice/tools/backofficeToolsForm.css.js +1 -1
- package/lib/esm/components/backoffice/tools/backofficeToolsJsonForm.css.js +1 -1
- package/lib/esm/components/backoffice/tools/parseToolJson.js.map +1 -1
- package/lib/esm/filters/filterHelpers.js.map +1 -1
- package/lib/esm/hooks/useAuth.js.map +1 -1
- package/lib/esm/hooks/useBackofficeAuth.js.map +1 -1
- package/lib/esm/hooks/useBackofficeInfiniteScrollSentinel.js.map +1 -1
- package/lib/esm/hooks/useBackofficeListRefetch.js.map +1 -1
- package/lib/esm/hooks/useBackofficeListUrlState.js.map +1 -1
- package/lib/esm/hooks/useBackofficeLoadMore.js.map +1 -1
- package/lib/esm/hooks/useBackofficeSessionAuth.js.map +1 -1
- package/lib/esm/hooks/useBackofficeSidebarPins.js.map +1 -1
- package/lib/esm/hooks/useConditionalSubscription.js.map +1 -1
- package/lib/esm/hooks/useCopyToClipboard.js.map +1 -1
- package/lib/esm/hooks/useInfiniteConnection.js.map +1 -1
- package/lib/esm/hooks/useRefetchNeededReload.js.map +1 -1
- package/lib/esm/hooks/useSidebarGroupCollapse.js.map +1 -1
- package/lib/esm/i18n/createI18nInstance.js.map +1 -1
- package/lib/esm/i18n/mergeResourceLanguages.js.map +1 -1
- package/lib/esm/i18n/resources.js.map +1 -1
- package/lib/esm/i18n/useBackofficeFormats.js.map +1 -1
- package/lib/esm/i18n/useBackofficeReactTranslation.js.map +1 -1
- package/lib/esm/i18n/useReviewStatusLabel.js.map +1 -1
- package/lib/esm/modules/base64.js.map +1 -1
- package/lib/esm/modules/formatFileSize.js.map +1 -1
- package/lib/esm/modules/webauthn.js.map +1 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/arrayLikeToArray.js.map +1 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js.map +1 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/defineProperty.js.map +1 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/interopRequireDefault.js.map +1 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/iterableToArray.js.map +1 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/nonIterableSpread.js.map +1 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/objectSpread2.js.map +1 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js.map +1 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/toConsumableArray.js.map +1 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/toPrimitive.js.map +1 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/toPropertyKey.js.map +1 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/typeof.js.map +1 -1
- package/lib/esm/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js.map +1 -1
- package/lib/esm/node_modules/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js.map +1 -1
- package/lib/esm/node_modules/fbjs/lib/areEqual.js.map +1 -1
- package/lib/esm/node_modules/invariant/browser.js.map +1 -1
- package/lib/esm/node_modules/relay-test-utils/index.js.map +1 -1
- 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.map +1 -1
- package/lib/esm/node_modules/relay-test-utils/lib/RelayResolverTestUtils.js.map +1 -1
- package/lib/esm/node_modules/relay-test-utils/lib/index.js.map +1 -1
- package/lib/esm/node_modules/relay-test-utils/lib/unwrapContainer.js.map +1 -1
- package/lib/esm/pages/BackofficeAcceptInvitationPage.js.map +1 -1
- package/lib/esm/pages/BackofficeDashboardPage.helpers.js.map +1 -1
- package/lib/esm/pages/BackofficeDashboardPage.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityDetailLayoutPage.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityDetailPage.helpers.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityDetailPage.js +2 -2
- package/lib/esm/pages/BackofficeEntityDetailPage.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityDetailPage.view-helpers.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityDetailUnknownPageRedirect.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityListPage.helpers.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityListPage.js.map +1 -1
- package/lib/esm/pages/BackofficeHubPage.js.map +1 -1
- package/lib/esm/pages/BackofficeLayoutPage.js.map +1 -1
- package/lib/esm/pages/BackofficeLoginPage.js.map +1 -1
- package/lib/esm/pages/BackofficePasswordResetCompletePage.js.map +1 -1
- package/lib/esm/pages/BackofficePasswordResetRequestPage.js.map +1 -1
- package/lib/esm/pages/BackofficeVerifyEmailPage.js.map +1 -1
- package/lib/esm/pages/backofficeDashboardPage.css.js +1 -1
- package/lib/esm/pages/backofficeEntityDetailPage.css.js +1 -1
- package/lib/esm/pages/backofficeEntityListPage.css.js +1 -1
- package/lib/esm/pages/detail/BackofficeEntityDetailLayoutContext.js.map +1 -1
- package/lib/esm/pages/detail/buildTabsItems.js.map +1 -1
- package/lib/esm/pages/detail/pageResolution.js.map +1 -1
- package/lib/esm/provider/BackofficeConfigContext.js.map +1 -1
- package/lib/esm/provider/BackofficeProvider.js.map +1 -1
- package/lib/esm/provider/dashboardRegistrations.js.map +1 -1
- package/lib/esm/provider/entityRegistry.js.map +1 -1
- package/lib/esm/provider/lazyValue.js.map +1 -1
- package/lib/esm/provider/useBackofficeEntityLoader.js.map +1 -1
- package/lib/esm/provider/useBackofficeLazyValue.js.map +1 -1
- package/lib/esm/relay/RelayProvider.js.map +1 -1
- package/lib/esm/relay/connectionUtils.js.map +1 -1
- package/lib/esm/relay/createInlineReader.js.map +1 -1
- package/lib/esm/relay/envHelpers.js.map +1 -1
- package/lib/esm/relay/environment.js.map +1 -1
- package/lib/esm/relay/mutationResult.js.map +1 -1
- package/lib/esm/router/backofficeAuthPaths.js.map +1 -1
- package/lib/esm/router/createBackofficeRoutes.js.map +1 -1
- package/lib/esm/storybook/relay/RelayStory.css.js +1 -1
- package/lib/esm/storybook/relay/RelayStory.js.map +1 -1
- package/lib/esm/storybook/relay/mockResolvers.js.map +1 -1
- package/lib/esm/style.css +1 -1
- package/lib/esm/subscriptions/useCursorResumableSubscription.js.map +1 -1
- package/lib/types/components/backoffice/errors/BackofficeErrorBoundary.stories.d.ts +1 -1
- package/lib/types/components/backoffice/errors/BackofficeErrorBoundary.stories.d.ts.map +1 -1
- package/lib/types/components/backoffice/overview/backofficeOverviewLayout.css.d.ts.map +1 -1
- package/lib/types/components/backoffice/tools/backofficeToolsDocPanel.css.d.ts.map +1 -1
- package/package.json +16 -16
|
@@ -22,7 +22,7 @@ var _ = /* @__PURE__ */ d(g, {
|
|
|
22
22
|
children: [/* @__PURE__ */ f("div", {
|
|
23
23
|
className: r,
|
|
24
24
|
children: [e.icon != null && /* @__PURE__ */ d("span", {
|
|
25
|
-
className: "
|
|
25
|
+
className: "txvbqbfca txvbqbey txvbqbldo txvbqb192m txvbqbj81 txvbqb2r3 txvbqb1atn txvbqb25s txvbqb2pn txvbqb1d9 txvbqb1b17 txvbqbgrx txvbqbrza",
|
|
26
26
|
"aria-hidden": "true",
|
|
27
27
|
children: e.icon
|
|
28
28
|
}), /* @__PURE__ */ f("span", {
|
|
@@ -31,7 +31,7 @@ var _ = /* @__PURE__ */ d(g, {
|
|
|
31
31
|
className: a,
|
|
32
32
|
children: e.title
|
|
33
33
|
}), e.description != null && /* @__PURE__ */ d("span", {
|
|
34
|
-
className: "
|
|
34
|
+
className: "txvbqb1b19 txvbqb9j",
|
|
35
35
|
children: e.description
|
|
36
36
|
})]
|
|
37
37
|
})]
|
|
@@ -54,11 +54,11 @@ var _ = /* @__PURE__ */ d(g, {
|
|
|
54
54
|
children: e.label
|
|
55
55
|
}),
|
|
56
56
|
n && /* @__PURE__ */ d("span", {
|
|
57
|
-
className: "
|
|
57
|
+
className: "txvbqb1b19 txvbqb9j txvbqbnr9 txvbqbwdt",
|
|
58
58
|
children: e.description
|
|
59
59
|
}),
|
|
60
60
|
r && /* @__PURE__ */ d("span", {
|
|
61
|
-
className: "
|
|
61
|
+
className: "txvbqb1b19 txvbqb96 txvbqbgwm txvbqb6a txvbqbmgb",
|
|
62
62
|
children: e.metaLabel
|
|
63
63
|
})
|
|
64
64
|
]
|
|
@@ -70,7 +70,7 @@ var _ = /* @__PURE__ */ d(g, {
|
|
|
70
70
|
}), /* @__PURE__ */ f("div", {
|
|
71
71
|
className: e,
|
|
72
72
|
children: [v != null && /* @__PURE__ */ d("div", {
|
|
73
|
-
className: "
|
|
73
|
+
className: "txvbqbtjz",
|
|
74
74
|
children: /* @__PURE__ */ d(h, {
|
|
75
75
|
value: v.value,
|
|
76
76
|
onChange: v.onChange,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeHubTemplate.js","names":[],"sources":["../../../../../src/components/backoffice/hub/BackofficeHubTemplate.tsx"],"sourcesContent":["import { type JSX, type ReactNode } from 'react';\nimport Link from '@plumile/router/routing/Link.js';\nimport { BackofficeEmptyState } from '@plumile/ui/backoffice/molecules/backoffice_empty_state/BackofficeEmptyState.js';\nimport { GlobalSearchInput } from '@plumile/ui/backoffice/molecules/global_search_input/GlobalSearchInput.js';\nimport { SidebarTasksSvg } from '@plumile/ui/icons/SidebarTasksSvg.js';\n\nimport * as styles from './backofficeHubTemplate.css.js';\n\nexport type BackofficeHubTemplateItemKind = 'entity' | 'tool';\n\nexport type BackofficeHubTemplateItem = {\n id: string;\n kind: BackofficeHubTemplateItemKind;\n label: string;\n href: string;\n icon?: ReactNode;\n description?: string | null;\n metaLabel?: string | null;\n};\n\nexport type BackofficeHubTemplateGroup = {\n id: string;\n title: string;\n description?: string | null;\n icon?: ReactNode;\n items: readonly BackofficeHubTemplateItem[];\n};\n\nexport type BackofficeHubTemplateEmptyState = {\n title: string;\n description: string;\n icon?: ReactNode;\n};\n\nexport type BackofficeHubTemplateSearch = {\n value: string;\n onChange: (value: string) => void;\n placeholder: string;\n};\n\nexport type BackofficeHubTemplateProps = {\n groups: readonly BackofficeHubTemplateGroup[];\n search?: BackofficeHubTemplateSearch;\n emptyState: BackofficeHubTemplateEmptyState;\n};\n\nconst fallbackIcon = (\n <SidebarTasksSvg width={20} height={20} aria-hidden=\"true\" />\n);\n\nexport const BackofficeHubTemplate = ({\n groups,\n search,\n emptyState,\n}: BackofficeHubTemplateProps): JSX.Element => {\n let body: JSX.Element;\n\n if (groups.length === 0) {\n body = (\n <BackofficeEmptyState\n title={emptyState.title}\n description={emptyState.description}\n icon={emptyState.icon ?? fallbackIcon}\n />\n );\n } else {\n body = (\n <div className={styles.groups}>\n {groups.map((group) => {\n return (\n <section key={group.id} className={styles.group}>\n <div className={styles.groupHeader}>\n {group.icon != null && (\n <span className={styles.groupIcon} aria-hidden=\"true\">\n {group.icon}\n </span>\n )}\n <span className={styles.groupHeading}>\n <h2 className={styles.groupTitle}>{group.title}</h2>\n {group.description != null && (\n <span className={styles.groupDescription}>\n {group.description}\n </span>\n )}\n </span>\n </div>\n <div className={styles.grid}>\n {group.items.map((item) => {\n const icon = item.icon ?? fallbackIcon;\n const hasDescription =\n item.description != null && item.description !== '';\n const hasMetaLabel =\n item.metaLabel != null && item.metaLabel !== '';\n\n return (\n <Link\n key={`${item.kind}-${item.id}`}\n to={item.href}\n className={styles.item}\n >\n <span className={styles.itemIcon} aria-hidden=\"true\">\n {icon}\n </span>\n <span className={styles.itemContent}>\n <span className={styles.itemTitle}>{item.label}</span>\n {hasDescription && (\n <span className={styles.itemDescription}>\n {item.description}\n </span>\n )}\n {hasMetaLabel && (\n <span className={styles.itemMeta}>\n {item.metaLabel}\n </span>\n )}\n </span>\n </Link>\n );\n })}\n </div>\n </section>\n );\n })}\n </div>\n );\n }\n\n return (\n <div className={styles.content}>\n {search != null && (\n <div className={styles.search}>\n <GlobalSearchInput\n value={search.value}\n onChange={search.onChange}\n placeholder={search.placeholder}\n />\n </div>\n )}\n {body}\n </div>\n );\n};\n\nexport default BackofficeHubTemplate;\n"],"mappings":";;;;;;;AA8CA,IAAM,IACJ,kBAAC,GAAD;CAAiB,OAAO;CAAI,QAAQ;CAAI,eAAY;
|
|
1
|
+
{"version":3,"file":"BackofficeHubTemplate.js","names":[],"sources":["../../../../../src/components/backoffice/hub/BackofficeHubTemplate.tsx"],"sourcesContent":["import { type JSX, type ReactNode } from 'react';\nimport Link from '@plumile/router/routing/Link.js';\nimport { BackofficeEmptyState } from '@plumile/ui/backoffice/molecules/backoffice_empty_state/BackofficeEmptyState.js';\nimport { GlobalSearchInput } from '@plumile/ui/backoffice/molecules/global_search_input/GlobalSearchInput.js';\nimport { SidebarTasksSvg } from '@plumile/ui/icons/SidebarTasksSvg.js';\n\nimport * as styles from './backofficeHubTemplate.css.js';\n\nexport type BackofficeHubTemplateItemKind = 'entity' | 'tool';\n\nexport type BackofficeHubTemplateItem = {\n id: string;\n kind: BackofficeHubTemplateItemKind;\n label: string;\n href: string;\n icon?: ReactNode;\n description?: string | null;\n metaLabel?: string | null;\n};\n\nexport type BackofficeHubTemplateGroup = {\n id: string;\n title: string;\n description?: string | null;\n icon?: ReactNode;\n items: readonly BackofficeHubTemplateItem[];\n};\n\nexport type BackofficeHubTemplateEmptyState = {\n title: string;\n description: string;\n icon?: ReactNode;\n};\n\nexport type BackofficeHubTemplateSearch = {\n value: string;\n onChange: (value: string) => void;\n placeholder: string;\n};\n\nexport type BackofficeHubTemplateProps = {\n groups: readonly BackofficeHubTemplateGroup[];\n search?: BackofficeHubTemplateSearch;\n emptyState: BackofficeHubTemplateEmptyState;\n};\n\nconst fallbackIcon = (\n <SidebarTasksSvg width={20} height={20} aria-hidden=\"true\" />\n);\n\nexport const BackofficeHubTemplate = ({\n groups,\n search,\n emptyState,\n}: BackofficeHubTemplateProps): JSX.Element => {\n let body: JSX.Element;\n\n if (groups.length === 0) {\n body = (\n <BackofficeEmptyState\n title={emptyState.title}\n description={emptyState.description}\n icon={emptyState.icon ?? fallbackIcon}\n />\n );\n } else {\n body = (\n <div className={styles.groups}>\n {groups.map((group) => {\n return (\n <section key={group.id} className={styles.group}>\n <div className={styles.groupHeader}>\n {group.icon != null && (\n <span className={styles.groupIcon} aria-hidden=\"true\">\n {group.icon}\n </span>\n )}\n <span className={styles.groupHeading}>\n <h2 className={styles.groupTitle}>{group.title}</h2>\n {group.description != null && (\n <span className={styles.groupDescription}>\n {group.description}\n </span>\n )}\n </span>\n </div>\n <div className={styles.grid}>\n {group.items.map((item) => {\n const icon = item.icon ?? fallbackIcon;\n const hasDescription =\n item.description != null && item.description !== '';\n const hasMetaLabel =\n item.metaLabel != null && item.metaLabel !== '';\n\n return (\n <Link\n key={`${item.kind}-${item.id}`}\n to={item.href}\n className={styles.item}\n >\n <span className={styles.itemIcon} aria-hidden=\"true\">\n {icon}\n </span>\n <span className={styles.itemContent}>\n <span className={styles.itemTitle}>{item.label}</span>\n {hasDescription && (\n <span className={styles.itemDescription}>\n {item.description}\n </span>\n )}\n {hasMetaLabel && (\n <span className={styles.itemMeta}>\n {item.metaLabel}\n </span>\n )}\n </span>\n </Link>\n );\n })}\n </div>\n </section>\n );\n })}\n </div>\n );\n }\n\n return (\n <div className={styles.content}>\n {search != null && (\n <div className={styles.search}>\n <GlobalSearchInput\n value={search.value}\n onChange={search.onChange}\n placeholder={search.placeholder}\n />\n </div>\n )}\n {body}\n </div>\n );\n};\n\nexport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BC,GAAG,EAAK,KAAK,GAAG,EAAK,IAoBtB;IAEV,CAAC;GACE,CAAA,CACE;KAlDK,EAAM,EAkDX,CAEZ;CACE,CAAA,GAKP,kBAAC,OAAD;EAAK,WAAW;YAAhB,CACG,KAAU,QACT,kBAAC,OAAD;GAAK,WAAW;aACd,kBAAC,GAAD;IACE,OAAO,EAAO;IACd,UAAU,EAAO;IACjB,aAAa,EAAO;GACrB,CAAA;EACE,CAAA,GAEN,CACE;;AAET"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* empty css */
|
|
2
2
|
//#region src/components/backoffice/hub/backofficeHubTemplate.css.ts
|
|
3
|
-
var e = "
|
|
3
|
+
var e = "txvbqbfb7 txvbqbgqh txvbqbh08", t = "txvbqbtjz", n = "txvbqbfb7 txvbqbgqh txvbqbh0l", r = "txvbqbfb7 txvbqbgqh txvbqbgzi", i = "txvbqbfb7 txvbqbel txvbqbgzi", a = "txvbqbfca txvbqbey txvbqbldo txvbqb192m txvbqbj81 txvbqb2r3 txvbqb1atn txvbqb25s txvbqb2pn txvbqb1d9 txvbqb1b17 txvbqbgrx txvbqbrza", o = "txvbqbfb7 txvbqbgqh txvbqbgys txvbqbuth", s = "txvbqba9 txvbqbgwz txvbqb1b15 txvbqbntf", c = "txvbqb1b19 txvbqb9j", l = "txvbqbfbk txvbqbizq txvbqbgzi", u = "u4nszr0 txvbqbfb7 txvbqbel txvbqbgzi txvbqbwi5 txvbqb2r3 txvbqb25s txvbqb2pn txvbqb1d9 txvbqb1atj txvbqb1b15 txvbqb3f txvbqbuth txvbqb7g txvbqb76 txvbqb7t", d = "txvbqbfca txvbqbey txvbqbldo txvbqb192z txvbqbj8e txvbqb2r3 txvbqb1atn txvbqb1b17 txvbqbgrx", f = "txvbqbfb7 txvbqbgqh txvbqbgys txvbqbuth", p = "txvbqbgwz txvbqb1b15 txvbqbwdt", m = "txvbqb1b19 txvbqb9j txvbqbnr9 txvbqbwdt", h = "txvbqb1b19 txvbqb96 txvbqbgwm txvbqb6a txvbqbmgb";
|
|
4
4
|
//#endregion
|
|
5
5
|
export { e as content, l as grid, r as group, c as groupDescription, i as groupHeader, o as groupHeading, a as groupIcon, s as groupTitle, n as groups, u as item, f as itemContent, m as itemDescription, d as itemIcon, h as itemMeta, p as itemTitle, t as search };
|
|
6
6
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficePermissionsContext.js","names":[],"sources":["../../../../../src/components/backoffice/layout/BackofficePermissionsContext.tsx"],"sourcesContent":["import { createContext, useContext, type JSX, type ReactNode } from 'react';\n\nconst BackofficePermissionsContext = createContext<unknown>(null);\n\nexport type BackofficePermissionsProviderProps = {\n children: ReactNode;\n permissions: unknown;\n};\n\nexport const BackofficePermissionsProvider = ({\n children,\n permissions,\n}: BackofficePermissionsProviderProps): JSX.Element => {\n return (\n <BackofficePermissionsContext.Provider value={permissions}>\n {children}\n </BackofficePermissionsContext.Provider>\n );\n};\n\nexport const useBackofficePermissions = (): unknown => {\n return useContext(BackofficePermissionsContext);\n};\n"],"mappings":";;;AAEA,IAAM,IAA+B,EAAuB,
|
|
1
|
+
{"version":3,"file":"BackofficePermissionsContext.js","names":[],"sources":["../../../../../src/components/backoffice/layout/BackofficePermissionsContext.tsx"],"sourcesContent":["import { createContext, useContext, type JSX, type ReactNode } from 'react';\n\nconst BackofficePermissionsContext = createContext<unknown>(null);\n\nexport type BackofficePermissionsProviderProps = {\n children: ReactNode;\n permissions: unknown;\n};\n\nexport const BackofficePermissionsProvider = ({\n children,\n permissions,\n}: BackofficePermissionsProviderProps): JSX.Element => {\n return (\n <BackofficePermissionsContext.Provider value={permissions}>\n {children}\n </BackofficePermissionsContext.Provider>\n );\n};\n\nexport const useBackofficePermissions = (): unknown => {\n return useContext(BackofficePermissionsContext);\n};\n"],"mappings":";;;AAEA,IAAM,IAA+B,EAAuB,IAAI,GAOnD,KAAiC,EAC5C,aACA,qBAGE,kBAAC,EAA6B,UAA9B;CAAuC,OAAO;CAC3C;AACoC,CAAA,GAI9B,UACJ,EAAW,CAA4B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* empty css */
|
|
2
2
|
//#region src/components/backoffice/layout/backofficeSidebarActions.css.ts
|
|
3
|
-
var e = "_1xws1b00
|
|
3
|
+
var e = "_1xws1b00 txvbqbfca txvbqbey txvbqbldo txvbqb191w txvbqbj7b txvbqb1qz txvbqb2ox txvbqb2r3 txvbqb1aqb txvbqbv txvbqbwh2 txvbqb7h txvbqb76 txvbqb7t";
|
|
4
4
|
//#endregion
|
|
5
5
|
export { e as actionButton };
|
|
6
6
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeRightPageLayout.js","names":[],"sources":["../../../../../../src/components/backoffice/layout/breadcrumb/BackofficeRightPageLayout.tsx"],"sourcesContent":["import { type JSX, type ReactNode } from 'react';\n\nimport { assertValidBreadcrumb } from './assertValidBreadcrumb.js';\nimport { BackofficeTopbarPortal } from './BackofficeTopbarPortal.js';\nimport { BackofficeTopbarBreadcrumb } from './BackofficeTopbarBreadcrumb.js';\nimport type { BackofficeTopbarBreadcrumbItem } from './types.js';\n\nexport type BackofficeRightPageLayoutProps = {\n breadcrumb: readonly BackofficeTopbarBreadcrumbItem[];\n children: ReactNode;\n};\n\nexport const BackofficeRightPageLayout = ({\n breadcrumb,\n children,\n}: BackofficeRightPageLayoutProps): JSX.Element => {\n const items = assertValidBreadcrumb(breadcrumb);\n\n return (\n <>\n <BackofficeTopbarPortal>\n <BackofficeTopbarBreadcrumb items={items} />\n </BackofficeTopbarPortal>\n <>{children}</>\n </>\n );\n};\n\nexport default BackofficeRightPageLayout;\n"],"mappings":";;;;;AAYA,IAAa,KAA6B,EACxC,eACA,kBAKE,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD,EAAmC,OAL3B,EAAsB,
|
|
1
|
+
{"version":3,"file":"BackofficeRightPageLayout.js","names":[],"sources":["../../../../../../src/components/backoffice/layout/breadcrumb/BackofficeRightPageLayout.tsx"],"sourcesContent":["import { type JSX, type ReactNode } from 'react';\n\nimport { assertValidBreadcrumb } from './assertValidBreadcrumb.js';\nimport { BackofficeTopbarPortal } from './BackofficeTopbarPortal.js';\nimport { BackofficeTopbarBreadcrumb } from './BackofficeTopbarBreadcrumb.js';\nimport type { BackofficeTopbarBreadcrumbItem } from './types.js';\n\nexport type BackofficeRightPageLayoutProps = {\n breadcrumb: readonly BackofficeTopbarBreadcrumbItem[];\n children: ReactNode;\n};\n\nexport const BackofficeRightPageLayout = ({\n breadcrumb,\n children,\n}: BackofficeRightPageLayoutProps): JSX.Element => {\n const items = assertValidBreadcrumb(breadcrumb);\n\n return (\n <>\n <BackofficeTopbarPortal>\n <BackofficeTopbarBreadcrumb items={items} />\n </BackofficeTopbarPortal>\n <>{children}</>\n </>\n );\n};\n\nexport default BackofficeRightPageLayout;\n"],"mappings":";;;;;AAYA,IAAa,KAA6B,EACxC,eACA,kBAKE,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD,EAAmC,OAL3B,EAAsB,CAKK,EAAQ,CAAA,EACrB,CAAA,GACxB,kBAAA,GAAA,EAAG,YAAW,CAAA,CACd,EAAA,CAAA"}
|
|
@@ -31,13 +31,13 @@ var g = (e) => {
|
|
|
31
31
|
children: [/* @__PURE__ */ p("li", {
|
|
32
32
|
className: o,
|
|
33
33
|
children: [x && /* @__PURE__ */ f("span", {
|
|
34
|
-
className: "_80s44h1 _80s44h0 qbwcuej qbwcueh
|
|
34
|
+
className: "_80s44h1 _80s44h0 qbwcuej qbwcueh txvbqbfca txvbqbey txvbqbldo txvbqb1qz txvbqb2ox txvbqb2r3 txvbqb1aqb txvbqb1b17 txvbqbv txvbqbwh2 txvbqb7h txvbqb76 txvbqb7t qbwcuei txvbqb1cc6 txvbqb1e3y qbwcue4 txvbqb1el8 txvbqb1ero qbwcue0 txvbqb1etc txvbqb1fls qbwcuex qbwcuer txvbqbgrx txvbqbnq6 qbwcue11 qbwcuev txvbqb192m txvbqbj81 txvbqbuwd txvbqbtwm txvbqb3f txvbqb1atn txvbqb1b15",
|
|
35
35
|
"aria-current": "page",
|
|
36
36
|
title: b,
|
|
37
37
|
children: w
|
|
38
38
|
}), !x && /* @__PURE__ */ f(m, {
|
|
39
39
|
to: y,
|
|
40
|
-
className: "_80s44h0 qbwcuej qbwcueh
|
|
40
|
+
className: "_80s44h0 qbwcuej qbwcueh txvbqbfca txvbqbey txvbqbldo txvbqb1qz txvbqb2ox txvbqb2r3 txvbqb1aqb txvbqb1b17 txvbqbv txvbqbwh2 txvbqb7h txvbqb76 txvbqb7t qbwcuei txvbqb1cc6 txvbqb1e3y qbwcue4 txvbqb1el8 txvbqb1ero qbwcue0 txvbqb1etc txvbqb1fls qbwcuex qbwcuer txvbqbgrx txvbqbnq6 qbwcue11 qbwcuev txvbqb192m txvbqbj81 txvbqbuwd txvbqbtwm txvbqb3f",
|
|
41
41
|
"aria-label": b,
|
|
42
42
|
title: b,
|
|
43
43
|
children: w
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeTopbarBreadcrumb.js","names":[],"sources":["../../../../../../src/components/backoffice/layout/breadcrumb/BackofficeTopbarBreadcrumb.tsx"],"sourcesContent":["import { type JSX } from 'react';\nimport Link from '@plumile/router/routing/Link.js';\nimport { SidebarHomeSvg } from '@plumile/ui/icons/SidebarHomeSvg.js';\n\nimport { BackofficeLink } from '../../links/BackofficeLink.js';\nimport { BackofficeLinkLabel } from '../../links/BackofficeLinkLabel.js';\nimport { useBackofficeReactTranslation } from '../../../../i18n/useBackofficeReactTranslation.js';\nimport type { BackofficeTopbarBreadcrumbItem } from './types.js';\nimport { useBackofficeTopbarPortalContext } from './BackofficeTopbarPortalContext.js';\nimport * as styles from './backofficeTopbarBreadcrumb.css.js';\n\nexport type BackofficeTopbarBreadcrumbProps = {\n items: readonly BackofficeTopbarBreadcrumbItem[];\n};\n\nconst getBreadcrumbItemKey = (item: BackofficeTopbarBreadcrumbItem): string => {\n const { target } = item;\n if (target.kind === 'dashboard') {\n return `${item.kind}-dashboard`;\n }\n if (target.kind === 'entity-list') {\n return `${item.kind}-entity-list-${target.entityId}`;\n }\n if (target.kind === 'entity-detail') {\n return `${item.kind}-entity-detail-${target.entityId}-${target.id}`;\n }\n if (target.kind === 'entity-detail-page') {\n return `${item.kind}-entity-detail-page-${target.entityId}-${target.id}-${target.pageId}`;\n }\n if (target.kind === 'tool') {\n return `${item.kind}-tool-${target.toolId}`;\n }\n if (target.kind === 'hub') {\n return `${item.kind}-hub-${target.hubId}`;\n }\n return `${item.kind}-href-${target.href}`;\n};\n\nexport const BackofficeTopbarBreadcrumb = ({\n items,\n}: BackofficeTopbarBreadcrumbProps): JSX.Element => {\n const { t } = useBackofficeReactTranslation();\n const { dashboardHref, dashboardLabel } = useBackofficeTopbarPortalContext();\n let isDashboardCurrent = false;\n const [firstItem] = items;\n if (items.length === 1 && firstItem != null) {\n isDashboardCurrent =\n firstItem.target.kind === 'dashboard' && firstItem.kind === 'current';\n }\n let visibleItems: readonly BackofficeTopbarBreadcrumbItem[] = items;\n if (isDashboardCurrent) {\n visibleItems = [];\n }\n\n const homeContent = (\n <>\n <SidebarHomeSvg width={16} height={16} aria-hidden=\"true\" />\n <span className={styles.homeLabel}>{dashboardLabel}</span>\n </>\n );\n\n return (\n <nav className={styles.nav} aria-label={t('common.breadcrumb')}>\n <ol className={styles.list}>\n <li className={styles.item}>\n {isDashboardCurrent && (\n <span\n className={styles.homeCurrent}\n aria-current=\"page\"\n title={dashboardLabel}\n >\n {homeContent}\n </span>\n )}\n {!isDashboardCurrent && (\n <Link\n to={dashboardHref}\n className={styles.homeLink}\n aria-label={dashboardLabel}\n title={dashboardLabel}\n >\n {homeContent}\n </Link>\n )}\n </li>\n {visibleItems.map((item, index) => {\n const isCurrent = item.kind === 'current';\n const key = getBreadcrumbItemKey(item);\n let icon: 'auto' | 'none' = 'none';\n if (index === 0) {\n icon = 'auto';\n }\n let content: JSX.Element;\n\n if (!isCurrent) {\n content = (\n <BackofficeLink\n target={item.target}\n label={item.label}\n className={styles.link}\n icon={icon}\n />\n );\n } else {\n content = (\n <BackofficeLinkLabel\n target={item.target}\n label={item.label}\n className={styles.current}\n icon={icon}\n />\n );\n }\n\n return (\n <li key={key} className={styles.item}>\n <span className={styles.separator} aria-hidden=\"true\">\n /\n </span>\n {content}\n </li>\n );\n })}\n </ol>\n </nav>\n );\n};\n\nexport default BackofficeTopbarBreadcrumb;\n"],"mappings":";;;;;;;;;AAeA,IAAM,KAAwB,MAAiD;CAC7E,IAAM,EAAE,cAAW;CAmBnB,OAlBI,EAAO,SAAS,cACX,GAAG,EAAK,KAAK,cAElB,EAAO,SAAS,gBACX,GAAG,EAAK,KAAK,eAAe,EAAO,aAExC,EAAO,SAAS,kBACX,GAAG,EAAK,KAAK,iBAAiB,EAAO,SAAS,GAAG,EAAO,OAE7D,EAAO,SAAS,uBACX,GAAG,EAAK,KAAK,sBAAsB,EAAO,SAAS,GAAG,EAAO,GAAG,GAAG,EAAO,WAE/E,EAAO,SAAS,SACX,GAAG,EAAK,KAAK,QAAQ,EAAO,WAEjC,EAAO,SAAS,QACX,GAAG,EAAK,KAAK,OAAO,EAAO,UAE7B,GAAG,EAAK,KAAK,QAAQ,EAAO;
|
|
1
|
+
{"version":3,"file":"BackofficeTopbarBreadcrumb.js","names":[],"sources":["../../../../../../src/components/backoffice/layout/breadcrumb/BackofficeTopbarBreadcrumb.tsx"],"sourcesContent":["import { type JSX } from 'react';\nimport Link from '@plumile/router/routing/Link.js';\nimport { SidebarHomeSvg } from '@plumile/ui/icons/SidebarHomeSvg.js';\n\nimport { BackofficeLink } from '../../links/BackofficeLink.js';\nimport { BackofficeLinkLabel } from '../../links/BackofficeLinkLabel.js';\nimport { useBackofficeReactTranslation } from '../../../../i18n/useBackofficeReactTranslation.js';\nimport type { BackofficeTopbarBreadcrumbItem } from './types.js';\nimport { useBackofficeTopbarPortalContext } from './BackofficeTopbarPortalContext.js';\nimport * as styles from './backofficeTopbarBreadcrumb.css.js';\n\nexport type BackofficeTopbarBreadcrumbProps = {\n items: readonly BackofficeTopbarBreadcrumbItem[];\n};\n\nconst getBreadcrumbItemKey = (item: BackofficeTopbarBreadcrumbItem): string => {\n const { target } = item;\n if (target.kind === 'dashboard') {\n return `${item.kind}-dashboard`;\n }\n if (target.kind === 'entity-list') {\n return `${item.kind}-entity-list-${target.entityId}`;\n }\n if (target.kind === 'entity-detail') {\n return `${item.kind}-entity-detail-${target.entityId}-${target.id}`;\n }\n if (target.kind === 'entity-detail-page') {\n return `${item.kind}-entity-detail-page-${target.entityId}-${target.id}-${target.pageId}`;\n }\n if (target.kind === 'tool') {\n return `${item.kind}-tool-${target.toolId}`;\n }\n if (target.kind === 'hub') {\n return `${item.kind}-hub-${target.hubId}`;\n }\n return `${item.kind}-href-${target.href}`;\n};\n\nexport const BackofficeTopbarBreadcrumb = ({\n items,\n}: BackofficeTopbarBreadcrumbProps): JSX.Element => {\n const { t } = useBackofficeReactTranslation();\n const { dashboardHref, dashboardLabel } = useBackofficeTopbarPortalContext();\n let isDashboardCurrent = false;\n const [firstItem] = items;\n if (items.length === 1 && firstItem != null) {\n isDashboardCurrent =\n firstItem.target.kind === 'dashboard' && firstItem.kind === 'current';\n }\n let visibleItems: readonly BackofficeTopbarBreadcrumbItem[] = items;\n if (isDashboardCurrent) {\n visibleItems = [];\n }\n\n const homeContent = (\n <>\n <SidebarHomeSvg width={16} height={16} aria-hidden=\"true\" />\n <span className={styles.homeLabel}>{dashboardLabel}</span>\n </>\n );\n\n return (\n <nav className={styles.nav} aria-label={t('common.breadcrumb')}>\n <ol className={styles.list}>\n <li className={styles.item}>\n {isDashboardCurrent && (\n <span\n className={styles.homeCurrent}\n aria-current=\"page\"\n title={dashboardLabel}\n >\n {homeContent}\n </span>\n )}\n {!isDashboardCurrent && (\n <Link\n to={dashboardHref}\n className={styles.homeLink}\n aria-label={dashboardLabel}\n title={dashboardLabel}\n >\n {homeContent}\n </Link>\n )}\n </li>\n {visibleItems.map((item, index) => {\n const isCurrent = item.kind === 'current';\n const key = getBreadcrumbItemKey(item);\n let icon: 'auto' | 'none' = 'none';\n if (index === 0) {\n icon = 'auto';\n }\n let content: JSX.Element;\n\n if (!isCurrent) {\n content = (\n <BackofficeLink\n target={item.target}\n label={item.label}\n className={styles.link}\n icon={icon}\n />\n );\n } else {\n content = (\n <BackofficeLinkLabel\n target={item.target}\n label={item.label}\n className={styles.current}\n icon={icon}\n />\n );\n }\n\n return (\n <li key={key} className={styles.item}>\n <span className={styles.separator} aria-hidden=\"true\">\n /\n </span>\n {content}\n </li>\n );\n })}\n </ol>\n </nav>\n );\n};\n\nexport default BackofficeTopbarBreadcrumb;\n"],"mappings":";;;;;;;;;AAeA,IAAM,KAAwB,MAAiD;CAC7E,IAAM,EAAE,cAAW;CAmBnB,OAlBI,EAAO,SAAS,cACX,GAAG,EAAK,KAAK,cAElB,EAAO,SAAS,gBACX,GAAG,EAAK,KAAK,eAAe,EAAO,aAExC,EAAO,SAAS,kBACX,GAAG,EAAK,KAAK,iBAAiB,EAAO,SAAS,GAAG,EAAO,OAE7D,EAAO,SAAS,uBACX,GAAG,EAAK,KAAK,sBAAsB,EAAO,SAAS,GAAG,EAAO,GAAG,GAAG,EAAO,WAE/E,EAAO,SAAS,SACX,GAAG,EAAK,KAAK,QAAQ,EAAO,WAEjC,EAAO,SAAS,QACX,GAAG,EAAK,KAAK,OAAO,EAAO,UAE7B,GAAG,EAAK,KAAK,QAAQ,EAAO;AACrC,GAEa,KAA8B,EACzC,eACkD;CAClD,IAAM,EAAE,SAAM,EAA8B,GACtC,EAAE,kBAAe,sBAAmB,EAAiC,GACvE,IAAqB,IACnB,CAAC,KAAa;CACpB,AAAI,EAAM,WAAW,KAAK,KAAa,SACrC,IACE,EAAU,OAAO,SAAS,eAAe,EAAU,SAAS;CAEhE,IAAI,IAA0D;CAC9D,AAAI,MACF,IAAe,CAAC;CAGlB,IAAM,IACJ,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,GAAD;EAAgB,OAAO;EAAI,QAAQ;EAAI,eAAY;CAAQ,CAAA,GAC3D,kBAAC,QAAD;EAAM,WAAW;YAAmB;CAAqB,CAAA,CACzD,EAAA,CAAA;CAGJ,OACE,kBAAC,OAAD;EAAK,WAAW;EAAY,cAAY,EAAE,mBAAmB;YAC3D,kBAAC,MAAD;GAAI,WAAW;aAAf,CACE,kBAAC,MAAD;IAAI,WAAW;cAAf,CACG,KACC,kBAAC,QAAD;KACE,WAAW;KACX,gBAAa;KACb,OAAO;eAEN;IACG,CAAA,GAEP,CAAC,KACA,kBAAC,GAAD;KACE,IAAI;KACJ,WAAW;KACX,cAAY;KACZ,OAAO;eAEN;IACG,CAAA,CAEN;OACH,EAAa,KAAK,GAAM,MAAU;IACjC,IAAM,IAAY,EAAK,SAAS,WAC1B,IAAM,EAAqB,CAAI,GACjC,IAAwB;IAC5B,AAAI,MAAU,MACZ,IAAO;IAET,IAAI;IAsBJ,OApBA,AACE,IADG,IAWD,kBAAC,GAAD;KACE,QAAQ,EAAK;KACb,OAAO,EAAK;KACZ,WAAW;KACL;IACP,CAAA,IAdD,kBAAC,GAAD;KACE,QAAQ,EAAK;KACb,OAAO,EAAK;KACZ,WAAW;KACL;IACP,CAAA,GAcH,kBAAC,MAAD;KAAc,WAAW;eAAzB,CACE,kBAAC,QAAD;MAAM,WAAW;MAAkB,eAAY;gBAAO;KAEhD,CAAA,GACL,CACC;OALK,CAKL;GAER,CAAC,CACC;;CACD,CAAA;AAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeTopbarPortal.js","names":[],"sources":["../../../../../../src/components/backoffice/layout/breadcrumb/BackofficeTopbarPortal.tsx"],"sourcesContent":["import { type JSX, type ReactNode } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { useBackofficeTopbarPortalContext } from './BackofficeTopbarPortalContext.js';\n\nexport type BackofficeTopbarPortalProps = {\n children: ReactNode;\n};\n\nexport const BackofficeTopbarPortal = ({\n children,\n}: BackofficeTopbarPortalProps): JSX.Element | null => {\n const { target } = useBackofficeTopbarPortalContext();\n if (target == null) {\n throw new Error(\n 'Backoffice topbar target is missing. Ensure BackofficeLayoutPage provides a topbar breadcrumb mount target before rendering right-side pages.',\n );\n }\n return createPortal(children, target);\n};\n\nexport default BackofficeTopbarPortal;\n"],"mappings":";;;AASA,IAAa,KAA0B,EACrC,kBACqD;CACrD,IAAM,EAAE,cAAW,
|
|
1
|
+
{"version":3,"file":"BackofficeTopbarPortal.js","names":[],"sources":["../../../../../../src/components/backoffice/layout/breadcrumb/BackofficeTopbarPortal.tsx"],"sourcesContent":["import { type JSX, type ReactNode } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { useBackofficeTopbarPortalContext } from './BackofficeTopbarPortalContext.js';\n\nexport type BackofficeTopbarPortalProps = {\n children: ReactNode;\n};\n\nexport const BackofficeTopbarPortal = ({\n children,\n}: BackofficeTopbarPortalProps): JSX.Element | null => {\n const { target } = useBackofficeTopbarPortalContext();\n if (target == null) {\n throw new Error(\n 'Backoffice topbar target is missing. Ensure BackofficeLayoutPage provides a topbar breadcrumb mount target before rendering right-side pages.',\n );\n }\n return createPortal(children, target);\n};\n\nexport default BackofficeTopbarPortal;\n"],"mappings":";;;AASA,IAAa,KAA0B,EACrC,kBACqD;CACrD,IAAM,EAAE,cAAW,EAAiC;CACpD,IAAI,KAAU,MACZ,MAAU,MACR,+IACF;CAEF,OAAO,EAAa,GAAU,CAAM;AACtC"}
|
package/lib/esm/components/backoffice/layout/breadcrumb/BackofficeTopbarPortalContext.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeTopbarPortalContext.js","names":[],"sources":["../../../../../../src/components/backoffice/layout/breadcrumb/BackofficeTopbarPortalContext.tsx"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nexport type BackofficeTopbarPortalContextValue = {\n target: HTMLDivElement | null;\n dashboardHref: string;\n dashboardLabel: string;\n};\n\nconst BackofficeTopbarPortalContext =\n createContext<BackofficeTopbarPortalContextValue | null>(null);\n\nexport const BackofficeTopbarPortalContextProvider =\n BackofficeTopbarPortalContext.Provider;\n\nexport const useOptionalBackofficeTopbarPortalContext =\n (): BackofficeTopbarPortalContextValue | null => {\n return useContext(BackofficeTopbarPortalContext);\n };\n\nexport const useBackofficeTopbarPortalContext =\n (): BackofficeTopbarPortalContextValue => {\n const context = useContext(BackofficeTopbarPortalContext);\n if (context == null) {\n throw new Error(\n 'BackofficeTopbarPortalContext is missing. Ensure pages are rendered under BackofficeLayoutPage.',\n );\n }\n return context;\n };\n"],"mappings":";;AAQA,IAAM,IACJ,EAAyD,
|
|
1
|
+
{"version":3,"file":"BackofficeTopbarPortalContext.js","names":[],"sources":["../../../../../../src/components/backoffice/layout/breadcrumb/BackofficeTopbarPortalContext.tsx"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nexport type BackofficeTopbarPortalContextValue = {\n target: HTMLDivElement | null;\n dashboardHref: string;\n dashboardLabel: string;\n};\n\nconst BackofficeTopbarPortalContext =\n createContext<BackofficeTopbarPortalContextValue | null>(null);\n\nexport const BackofficeTopbarPortalContextProvider =\n BackofficeTopbarPortalContext.Provider;\n\nexport const useOptionalBackofficeTopbarPortalContext =\n (): BackofficeTopbarPortalContextValue | null => {\n return useContext(BackofficeTopbarPortalContext);\n };\n\nexport const useBackofficeTopbarPortalContext =\n (): BackofficeTopbarPortalContextValue => {\n const context = useContext(BackofficeTopbarPortalContext);\n if (context == null) {\n throw new Error(\n 'BackofficeTopbarPortalContext is missing. Ensure pages are rendered under BackofficeLayoutPage.',\n );\n }\n return context;\n };\n"],"mappings":";;AAQA,IAAM,IACJ,EAAyD,IAAI,GAElD,IACX,EAA8B,UAEnB,UAEF,EAAW,CAA6B,GAGtC,UAC+B;CACxC,IAAM,IAAU,EAAW,CAA6B;CACxD,IAAI,KAAW,MACb,MAAU,MACR,iGACF;CAEF,OAAO;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertValidBreadcrumb.js","names":[],"sources":["../../../../../../src/components/backoffice/layout/breadcrumb/assertValidBreadcrumb.ts"],"sourcesContent":["import type {\n BackofficeTopbarBreadcrumbItem,\n BreadcrumbContractErrorCode,\n} from './types.js';\n\nconst formatContractError = (\n code: BreadcrumbContractErrorCode,\n details?: string,\n): Error => {\n if (details == null) {\n return new Error(`Invalid breadcrumb contract: ${code}`);\n }\n return new Error(`Invalid breadcrumb contract: ${code} (${details})`);\n};\n\nconst getBreadcrumbItemId = (item: BackofficeTopbarBreadcrumbItem): string => {\n const { target } = item as {\n readonly target?: BackofficeTopbarBreadcrumbItem['target'];\n };\n if (target == null) {\n return '';\n }\n if (target.kind === 'dashboard') {\n return 'dashboard';\n }\n if (target.kind === 'entity-list') {\n return `${target.entityId}-list`;\n }\n if (target.kind === 'entity-detail') {\n return `${target.entityId}-entity-${target.id}`;\n }\n if (target.kind === 'entity-detail-page') {\n return `${target.entityId}-page-${target.id}-${target.pageId}`;\n }\n if (target.kind === 'tool') {\n return `tool-${target.toolId}`;\n }\n if (target.kind === 'hub') {\n return `hub-${target.hubId}`;\n }\n return `href-${target.href}`;\n};\n\nexport const assertValidBreadcrumb = (\n items: readonly BackofficeTopbarBreadcrumbItem[] | null | undefined,\n): readonly BackofficeTopbarBreadcrumbItem[] => {\n if (items == null) {\n throw formatContractError('MISSING_BREADCRUMB');\n }\n if (items.length === 0) {\n throw formatContractError('EMPTY_BREADCRUMB');\n }\n\n const seen = new Set<string>();\n items.forEach((item, index) => {\n const id = getBreadcrumbItemId(item);\n if (id.trim() === '') {\n throw formatContractError('INVALID_SEGMENT_ID', `index=${index}`);\n }\n\n if (seen.has(id)) {\n throw formatContractError('INVALID_SEGMENT_ID', `duplicate id=\"${id}\"`);\n }\n seen.add(id);\n });\n\n const last = items[items.length - 1];\n if (last?.kind !== 'current') {\n throw formatContractError('MISSING_CURRENT_SEGMENT');\n }\n\n return items;\n};\n"],"mappings":";AAKA,IAAM,KACJ,GACA,MAGa,MADT,KAAW,OACI,gCAAgC,MAElC,gCAAgC,EAAK,IAAI,EAAQ,
|
|
1
|
+
{"version":3,"file":"assertValidBreadcrumb.js","names":[],"sources":["../../../../../../src/components/backoffice/layout/breadcrumb/assertValidBreadcrumb.ts"],"sourcesContent":["import type {\n BackofficeTopbarBreadcrumbItem,\n BreadcrumbContractErrorCode,\n} from './types.js';\n\nconst formatContractError = (\n code: BreadcrumbContractErrorCode,\n details?: string,\n): Error => {\n if (details == null) {\n return new Error(`Invalid breadcrumb contract: ${code}`);\n }\n return new Error(`Invalid breadcrumb contract: ${code} (${details})`);\n};\n\nconst getBreadcrumbItemId = (item: BackofficeTopbarBreadcrumbItem): string => {\n const { target } = item as {\n readonly target?: BackofficeTopbarBreadcrumbItem['target'];\n };\n if (target == null) {\n return '';\n }\n if (target.kind === 'dashboard') {\n return 'dashboard';\n }\n if (target.kind === 'entity-list') {\n return `${target.entityId}-list`;\n }\n if (target.kind === 'entity-detail') {\n return `${target.entityId}-entity-${target.id}`;\n }\n if (target.kind === 'entity-detail-page') {\n return `${target.entityId}-page-${target.id}-${target.pageId}`;\n }\n if (target.kind === 'tool') {\n return `tool-${target.toolId}`;\n }\n if (target.kind === 'hub') {\n return `hub-${target.hubId}`;\n }\n return `href-${target.href}`;\n};\n\nexport const assertValidBreadcrumb = (\n items: readonly BackofficeTopbarBreadcrumbItem[] | null | undefined,\n): readonly BackofficeTopbarBreadcrumbItem[] => {\n if (items == null) {\n throw formatContractError('MISSING_BREADCRUMB');\n }\n if (items.length === 0) {\n throw formatContractError('EMPTY_BREADCRUMB');\n }\n\n const seen = new Set<string>();\n items.forEach((item, index) => {\n const id = getBreadcrumbItemId(item);\n if (id.trim() === '') {\n throw formatContractError('INVALID_SEGMENT_ID', `index=${index}`);\n }\n\n if (seen.has(id)) {\n throw formatContractError('INVALID_SEGMENT_ID', `duplicate id=\"${id}\"`);\n }\n seen.add(id);\n });\n\n const last = items[items.length - 1];\n if (last?.kind !== 'current') {\n throw formatContractError('MISSING_CURRENT_SEGMENT');\n }\n\n return items;\n};\n"],"mappings":";AAKA,IAAM,KACJ,GACA,MAGa,MADT,KAAW,OACI,gCAAgC,MAElC,gCAAgC,EAAK,IAAI,EAAQ,EAFT,GAKrD,KAAuB,MAAiD;CAC5E,IAAM,EAAE,cAAW;CAwBnB,OArBI,KAAU,OACL,KAEL,EAAO,SAAS,cACX,cAEL,EAAO,SAAS,gBACX,GAAG,EAAO,SAAS,SAExB,EAAO,SAAS,kBACX,GAAG,EAAO,SAAS,UAAU,EAAO,OAEzC,EAAO,SAAS,uBACX,GAAG,EAAO,SAAS,QAAQ,EAAO,GAAG,GAAG,EAAO,WAEpD,EAAO,SAAS,SACX,QAAQ,EAAO,WAEpB,EAAO,SAAS,QACX,OAAO,EAAO,UAEhB,QAAQ,EAAO;AACxB,GAEa,KACX,MAC8C;CAC9C,IAAI,KAAS,MACX,MAAM,EAAoB,oBAAoB;CAEhD,IAAI,EAAM,WAAW,GACnB,MAAM,EAAoB,kBAAkB;CAG9C,IAAM,oBAAO,IAAI,IAAY;CAc7B,IAbA,EAAM,SAAS,GAAM,MAAU;EAC7B,IAAM,IAAK,EAAoB,CAAI;EACnC,IAAI,EAAG,KAAK,MAAM,IAChB,MAAM,EAAoB,sBAAsB,SAAS,GAAO;EAGlE,IAAI,EAAK,IAAI,CAAE,GACb,MAAM,EAAoB,sBAAsB,iBAAiB,EAAG,EAAE;EAExE,EAAK,IAAI,CAAE;CACb,CAAC,GAEY,EAAM,EAAM,SAAS,IACxB,SAAS,WACjB,MAAM,EAAoB,yBAAyB;CAGrD,OAAO;AACT"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* empty css */
|
|
2
2
|
/* empty css */
|
|
3
3
|
//#region src/components/backoffice/layout/breadcrumb/backofficeTopbarBreadcrumb.css.ts
|
|
4
|
-
var e = "
|
|
4
|
+
var e = "txvbqbfca txvbqbey", t = "txvbqbfca txvbqbey txvbqbgz5 txvbqbntf txvbqbwh2 txvbqbnsc", n = "txvbqbfca txvbqbey txvbqbgz5", r = "txvbqb1b17 txvbqb9j txvbqbnr9", i = "_80s44h0 qbwcuej qbwcueh txvbqbfca txvbqbey txvbqbldo txvbqb1qz txvbqb2ox txvbqb2r3 txvbqb1aqb txvbqb1b17 txvbqbv txvbqbwh2 txvbqb7h txvbqb76 txvbqb7t qbwcuei txvbqb1cc6 txvbqb1e3y qbwcue4 txvbqb1el8 txvbqb1ero qbwcue0 txvbqb1etc txvbqb1fls qbwcuex qbwcuer txvbqbgrx txvbqbnq6 qbwcue11 qbwcuev txvbqb192m txvbqbj81 txvbqbuwd txvbqbtwm txvbqb3f", a = "_80s44h1 _80s44h0 qbwcuej qbwcueh txvbqbfca txvbqbey txvbqbldo txvbqb1qz txvbqb2ox txvbqb2r3 txvbqb1aqb txvbqb1b17 txvbqbv txvbqbwh2 txvbqb7h txvbqb76 txvbqb7t qbwcuei txvbqb1cc6 txvbqb1e3y qbwcue4 txvbqb1el8 txvbqb1ero qbwcue0 txvbqb1etc txvbqb1fls qbwcuex qbwcuer txvbqbgrx txvbqbnq6 qbwcue11 qbwcuev txvbqb192m txvbqbj81 txvbqbuwd txvbqbtwm txvbqb3f txvbqb1atn txvbqb1b15", o = "_4k5f060 txvbqb1qz txvbqb2ox txvbqb1j txvbqbjlr txvbqbo9b txvbqbwcq txvbqbwh2 txvbqb133e txvbqb19gc", s = "_80s44h2 qbwcuep qbwcuen txvbqbfca txvbqbey txvbqbgys txvbqb1b15 txvbqb3f txvbqb7h txvbqb75 txvbqb7t qbwcueo txvbqb1fol qbwcue0 txvbqb1etc txvbqb1fls txvbqb1b17 txvbqb9j txvbqbnr9", c = "txvbqb1b15 txvbqb9j txvbqbnr9 txvbqbgwz";
|
|
5
5
|
//#endregion
|
|
6
6
|
export { c as current, a as homeCurrent, o as homeLabel, i as homeLink, n as item, s as link, t as list, e as nav, r as separator };
|
|
7
7
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildBreadcrumbs.js","names":[],"sources":["../../../../../../src/components/backoffice/layout/breadcrumb/buildBreadcrumbs.ts"],"sourcesContent":["import type { TFunction } from 'i18next';\n\nimport type {\n BackofficeEntityManifestMap,\n BackofficeManifestDetailEntityId,\n BackofficeManifestListEntityId,\n BackofficeManifestToolId,\n BackofficeResolvedDetailLayoutFacetConfig,\n BackofficeResolvedDetailPageFacetConfig,\n BackofficeRuntimeResolvedListFacetConfig,\n I18nLabel,\n} from '@plumile/backoffice-core/types.js';\n\nimport type { BackofficeTopbarBreadcrumbItem } from './types.js';\n\nconst resolveLabel = (label: I18nLabel, tApp: TFunction): string => {\n return label(tApp);\n};\n\nexport const resolveEntityTitleFromDetailHeader = <\n LayoutView extends object,\n>(input: {\n layoutView: LayoutView;\n detailHeader: BackofficeResolvedDetailLayoutFacetConfig['header'];\n tApp: TFunction;\n}): string => {\n const titleValue = input.detailHeader.titleValue?.(\n input.layoutView,\n input.tApp,\n );\n if (typeof titleValue === 'string' && titleValue.trim() !== '') {\n return titleValue;\n }\n\n const title = resolveLabel(input.detailHeader.title, input.tApp);\n if (title.trim() !== '') {\n return title;\n }\n\n const maybeId = (input.layoutView as { id?: unknown }).id;\n if (typeof maybeId === 'string' && maybeId.trim() !== '') {\n return maybeId;\n }\n\n return '';\n};\n\nexport const buildDashboardBreadcrumb = (\n t: TFunction,\n): readonly BackofficeTopbarBreadcrumbItem[] => {\n return [\n {\n kind: 'current',\n target: { kind: 'dashboard' },\n label: t('sidebar.items.dashboard'),\n },\n ];\n};\n\nexport const buildHubBreadcrumb = <\n TManifest extends BackofficeEntityManifestMap = BackofficeEntityManifestMap,\n>(input: {\n id: string;\n title: string;\n}): readonly BackofficeTopbarBreadcrumbItem<TManifest>[] => {\n return [\n {\n kind: 'current',\n target: { kind: 'hub', hubId: input.id },\n label: input.title,\n },\n ];\n};\n\nexport const buildEntityListBreadcrumb = <\n TManifest extends BackofficeEntityManifestMap = BackofficeEntityManifestMap,\n>(\n config: BackofficeRuntimeResolvedListFacetConfig,\n tApp: TFunction,\n): readonly BackofficeTopbarBreadcrumbItem<TManifest>[] => {\n return [\n {\n kind: 'current',\n target: {\n kind: 'entity-list',\n entityId: config.id as BackofficeManifestListEntityId<TManifest>,\n },\n label: resolveLabel(config.label, tApp),\n },\n ];\n};\n\nexport const buildEntityDetailBreadcrumb = <\n TManifest extends BackofficeEntityManifestMap = BackofficeEntityManifestMap,\n>(input: {\n config:\n | BackofficeResolvedDetailLayoutFacetConfig\n | BackofficeResolvedDetailPageFacetConfig;\n tApp: TFunction;\n entityId: string;\n layoutView: unknown;\n pageLabel: string;\n pageId?: string;\n}): readonly BackofficeTopbarBreadcrumbItem<TManifest>[] => {\n const listLabel = resolveLabel(input.config.label, input.tApp);\n const entityTitle = resolveEntityTitleFromDetailHeader({\n layoutView: input.layoutView as object,\n detailHeader: input.config.header,\n tApp: input.tApp,\n });\n\n return [\n {\n kind: 'link',\n target: {\n kind: 'entity-list',\n entityId: input.config.id as BackofficeManifestListEntityId<TManifest>,\n },\n label: listLabel,\n },\n {\n kind: 'link',\n target: {\n kind: 'entity-detail',\n entityId: input.config\n .id as BackofficeManifestDetailEntityId<TManifest>,\n id: input.entityId,\n },\n label: entityTitle,\n },\n {\n kind: 'current',\n target: {\n kind: 'entity-detail-page',\n entityId: input.config\n .id as BackofficeManifestDetailEntityId<TManifest>,\n id: input.entityId,\n pageId: input.pageId ?? input.pageLabel,\n } as never,\n label: input.pageLabel,\n },\n ];\n};\n\nexport const buildToolBreadcrumb = <\n TManifest extends BackofficeEntityManifestMap = BackofficeEntityManifestMap,\n>(input: {\n id?: BackofficeManifestToolId<TManifest> | string;\n title: string;\n}): readonly BackofficeTopbarBreadcrumbItem<TManifest>[] => {\n let target: BackofficeTopbarBreadcrumbItem<TManifest>['target'] = {\n kind: 'href',\n href: `/tools/${input.title}`,\n };\n if (input.id != null) {\n target = {\n kind: 'tool',\n toolId: input.id as BackofficeManifestToolId<TManifest>,\n };\n }\n return [\n {\n kind: 'current',\n target,\n label: input.title,\n },\n ];\n};\n"],"mappings":";AAeA,IAAM,KAAgB,GAAkB,MAC/B,EAAM,
|
|
1
|
+
{"version":3,"file":"buildBreadcrumbs.js","names":[],"sources":["../../../../../../src/components/backoffice/layout/breadcrumb/buildBreadcrumbs.ts"],"sourcesContent":["import type { TFunction } from 'i18next';\n\nimport type {\n BackofficeEntityManifestMap,\n BackofficeManifestDetailEntityId,\n BackofficeManifestListEntityId,\n BackofficeManifestToolId,\n BackofficeResolvedDetailLayoutFacetConfig,\n BackofficeResolvedDetailPageFacetConfig,\n BackofficeRuntimeResolvedListFacetConfig,\n I18nLabel,\n} from '@plumile/backoffice-core/types.js';\n\nimport type { BackofficeTopbarBreadcrumbItem } from './types.js';\n\nconst resolveLabel = (label: I18nLabel, tApp: TFunction): string => {\n return label(tApp);\n};\n\nexport const resolveEntityTitleFromDetailHeader = <\n LayoutView extends object,\n>(input: {\n layoutView: LayoutView;\n detailHeader: BackofficeResolvedDetailLayoutFacetConfig['header'];\n tApp: TFunction;\n}): string => {\n const titleValue = input.detailHeader.titleValue?.(\n input.layoutView,\n input.tApp,\n );\n if (typeof titleValue === 'string' && titleValue.trim() !== '') {\n return titleValue;\n }\n\n const title = resolveLabel(input.detailHeader.title, input.tApp);\n if (title.trim() !== '') {\n return title;\n }\n\n const maybeId = (input.layoutView as { id?: unknown }).id;\n if (typeof maybeId === 'string' && maybeId.trim() !== '') {\n return maybeId;\n }\n\n return '';\n};\n\nexport const buildDashboardBreadcrumb = (\n t: TFunction,\n): readonly BackofficeTopbarBreadcrumbItem[] => {\n return [\n {\n kind: 'current',\n target: { kind: 'dashboard' },\n label: t('sidebar.items.dashboard'),\n },\n ];\n};\n\nexport const buildHubBreadcrumb = <\n TManifest extends BackofficeEntityManifestMap = BackofficeEntityManifestMap,\n>(input: {\n id: string;\n title: string;\n}): readonly BackofficeTopbarBreadcrumbItem<TManifest>[] => {\n return [\n {\n kind: 'current',\n target: { kind: 'hub', hubId: input.id },\n label: input.title,\n },\n ];\n};\n\nexport const buildEntityListBreadcrumb = <\n TManifest extends BackofficeEntityManifestMap = BackofficeEntityManifestMap,\n>(\n config: BackofficeRuntimeResolvedListFacetConfig,\n tApp: TFunction,\n): readonly BackofficeTopbarBreadcrumbItem<TManifest>[] => {\n return [\n {\n kind: 'current',\n target: {\n kind: 'entity-list',\n entityId: config.id as BackofficeManifestListEntityId<TManifest>,\n },\n label: resolveLabel(config.label, tApp),\n },\n ];\n};\n\nexport const buildEntityDetailBreadcrumb = <\n TManifest extends BackofficeEntityManifestMap = BackofficeEntityManifestMap,\n>(input: {\n config:\n | BackofficeResolvedDetailLayoutFacetConfig\n | BackofficeResolvedDetailPageFacetConfig;\n tApp: TFunction;\n entityId: string;\n layoutView: unknown;\n pageLabel: string;\n pageId?: string;\n}): readonly BackofficeTopbarBreadcrumbItem<TManifest>[] => {\n const listLabel = resolveLabel(input.config.label, input.tApp);\n const entityTitle = resolveEntityTitleFromDetailHeader({\n layoutView: input.layoutView as object,\n detailHeader: input.config.header,\n tApp: input.tApp,\n });\n\n return [\n {\n kind: 'link',\n target: {\n kind: 'entity-list',\n entityId: input.config.id as BackofficeManifestListEntityId<TManifest>,\n },\n label: listLabel,\n },\n {\n kind: 'link',\n target: {\n kind: 'entity-detail',\n entityId: input.config\n .id as BackofficeManifestDetailEntityId<TManifest>,\n id: input.entityId,\n },\n label: entityTitle,\n },\n {\n kind: 'current',\n target: {\n kind: 'entity-detail-page',\n entityId: input.config\n .id as BackofficeManifestDetailEntityId<TManifest>,\n id: input.entityId,\n pageId: input.pageId ?? input.pageLabel,\n } as never,\n label: input.pageLabel,\n },\n ];\n};\n\nexport const buildToolBreadcrumb = <\n TManifest extends BackofficeEntityManifestMap = BackofficeEntityManifestMap,\n>(input: {\n id?: BackofficeManifestToolId<TManifest> | string;\n title: string;\n}): readonly BackofficeTopbarBreadcrumbItem<TManifest>[] => {\n let target: BackofficeTopbarBreadcrumbItem<TManifest>['target'] = {\n kind: 'href',\n href: `/tools/${input.title}`,\n };\n if (input.id != null) {\n target = {\n kind: 'tool',\n toolId: input.id as BackofficeManifestToolId<TManifest>,\n };\n }\n return [\n {\n kind: 'current',\n target,\n label: input.title,\n },\n ];\n};\n"],"mappings":";AAeA,IAAM,KAAgB,GAAkB,MAC/B,EAAM,CAAI,GAGN,KAEX,MAIY;CACZ,IAAM,IAAa,EAAM,aAAa,aACpC,EAAM,YACN,EAAM,IACR;CACA,IAAI,OAAO,KAAe,YAAY,EAAW,KAAK,MAAM,IAC1D,OAAO;CAGT,IAAM,IAAQ,EAAa,EAAM,aAAa,OAAO,EAAM,IAAI;CAC/D,IAAI,EAAM,KAAK,MAAM,IACnB,OAAO;CAGT,IAAM,IAAW,EAAM,WAAgC;CAKvD,OAJI,OAAO,KAAY,YAAY,EAAQ,KAAK,MAAM,KAC7C,IAGF;AACT,GAEa,KACX,MAEO,CACL;CACE,MAAM;CACN,QAAQ,EAAE,MAAM,YAAY;CAC5B,OAAO,EAAE,yBAAyB;AACpC,CACF,GAGW,KAEX,MAIO,CACL;CACE,MAAM;CACN,QAAQ;EAAE,MAAM;EAAO,OAAO,EAAM;CAAG;CACvC,OAAO,EAAM;AACf,CACF,GAGW,KAGX,GACA,MAEO,CACL;CACE,MAAM;CACN,QAAQ;EACN,MAAM;EACN,UAAU,EAAO;CACnB;CACA,OAAO,EAAa,EAAO,OAAO,CAAI;AACxC,CACF,GAGW,KAEX,MAS0D;CAC1D,IAAM,IAAY,EAAa,EAAM,OAAO,OAAO,EAAM,IAAI,GACvD,IAAc,EAAmC;EACrD,YAAY,EAAM;EAClB,cAAc,EAAM,OAAO;EAC3B,MAAM,EAAM;CACd,CAAC;CAED,OAAO;EACL;GACE,MAAM;GACN,QAAQ;IACN,MAAM;IACN,UAAU,EAAM,OAAO;GACzB;GACA,OAAO;EACT;EACA;GACE,MAAM;GACN,QAAQ;IACN,MAAM;IACN,UAAU,EAAM,OACb;IACH,IAAI,EAAM;GACZ;GACA,OAAO;EACT;EACA;GACE,MAAM;GACN,QAAQ;IACN,MAAM;IACN,UAAU,EAAM,OACb;IACH,IAAI,EAAM;IACV,QAAQ,EAAM,UAAU,EAAM;GAChC;GACA,OAAO,EAAM;EACf;CACF;AACF,GAEa,KAEX,MAG0D;CAC1D,IAAI,IAA8D;EAChE,MAAM;EACN,MAAM,UAAU,EAAM;CACxB;CAOA,OANI,EAAM,MAAM,SACd,IAAS;EACP,MAAM;EACN,QAAQ,EAAM;CAChB,IAEK,CACL;EACE,MAAM;EACN;EACA,OAAO,EAAM;CACf,CACF;AACF"}
|
|
@@ -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,OAG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AAQ,QACV,EAAM,KAAK,EAAK;IAElB;EAGJ,IAAI,IAAwC;EAO5C,IANI,KAAoB,EAAM,UAAU,wBAAwB,OAC9D,IAAe,EAAM,QAAQ,MACpB,EAAK,MAAM,SAAS,eAAe,EAAK,aAAa,GAC5D,GAGA,EAAa,WAAW,GAC1B;EAGF,IAAI;EACJ,AAAI,EAAM,SAAS,SACjB,IAAQ,EAAa,EAAM,OAAO,EAAK;EAGzC,IAAM,IAAc,IAAqB,IACrC;EAOJ,AANI,KAA0B,SAC5B,KAAqB,MAAuB;GAC1C,EAAuB,GAAS,EAAU;MAI9C,EAAS,KAAK;GACZ,IAAI;GACJ;GACA,MAAM,EAAW,EAAM,MAAM,KAAA,GAAW,GAAG;GAC3C,OAAO;GACP,aAAa,EAAM,UAAU,eAAe;GAC5C,kBAAkB,EAAM,UAAU,oBAAoB;GACtD;GACA;GACD,CAAC;GACF,EAEK"}
|
|
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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jB;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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapViewerToSidebarProfileView.js","names":[],"sources":["../../../../../src/components/backoffice/layout/mapViewerToSidebarProfileView.ts"],"sourcesContent":["import type { SidebarProfileViewer } from '@plumile/ui/components/navigation/sidebar/SidebarProfileMenu.js';\n\nexport type BackofficeViewerIdentity = {\n id: string;\n firstName: string;\n lastName: string;\n email: string;\n initials: string;\n};\n\ntype MapViewerToSidebarProfileViewInput = {\n viewer: BackofficeViewerIdentity | null | undefined;\n unknownUserLabel: string;\n};\n\nconst sanitizeToken = (value: string | null | undefined): string => {\n return value?.trim() ?? '';\n};\n\nexport const mapViewerToSidebarProfileView = ({\n viewer,\n unknownUserLabel,\n}: MapViewerToSidebarProfileViewInput): SidebarProfileViewer => {\n const firstName = sanitizeToken(viewer?.firstName);\n const lastName = sanitizeToken(viewer?.lastName);\n const joinedDisplayName = [firstName, lastName]\n .filter((token) => {\n return token !== '';\n })\n .join(' ')\n .trim();\n let displayName = joinedDisplayName;\n if (displayName === '') {\n displayName = unknownUserLabel;\n }\n\n const email = sanitizeToken(viewer?.email);\n const initialsToken = sanitizeToken(viewer?.initials);\n let initials = initialsToken;\n if (initials === '') {\n initials = '?';\n }\n\n const ariaParts = [displayName];\n if (email !== '') {\n ariaParts.push(email);\n }\n\n return {\n displayName,\n email,\n initials,\n ariaLabel: ariaParts.join(' - '),\n };\n};\n\nexport default mapViewerToSidebarProfileView;\n"],"mappings":";AAeA,IAAM,KAAiB,MACd,GAAO,
|
|
1
|
+
{"version":3,"file":"mapViewerToSidebarProfileView.js","names":[],"sources":["../../../../../src/components/backoffice/layout/mapViewerToSidebarProfileView.ts"],"sourcesContent":["import type { SidebarProfileViewer } from '@plumile/ui/components/navigation/sidebar/SidebarProfileMenu.js';\n\nexport type BackofficeViewerIdentity = {\n id: string;\n firstName: string;\n lastName: string;\n email: string;\n initials: string;\n};\n\ntype MapViewerToSidebarProfileViewInput = {\n viewer: BackofficeViewerIdentity | null | undefined;\n unknownUserLabel: string;\n};\n\nconst sanitizeToken = (value: string | null | undefined): string => {\n return value?.trim() ?? '';\n};\n\nexport const mapViewerToSidebarProfileView = ({\n viewer,\n unknownUserLabel,\n}: MapViewerToSidebarProfileViewInput): SidebarProfileViewer => {\n const firstName = sanitizeToken(viewer?.firstName);\n const lastName = sanitizeToken(viewer?.lastName);\n const joinedDisplayName = [firstName, lastName]\n .filter((token) => {\n return token !== '';\n })\n .join(' ')\n .trim();\n let displayName = joinedDisplayName;\n if (displayName === '') {\n displayName = unknownUserLabel;\n }\n\n const email = sanitizeToken(viewer?.email);\n const initialsToken = sanitizeToken(viewer?.initials);\n let initials = initialsToken;\n if (initials === '') {\n initials = '?';\n }\n\n const ariaParts = [displayName];\n if (email !== '') {\n ariaParts.push(email);\n }\n\n return {\n displayName,\n email,\n initials,\n ariaLabel: ariaParts.join(' - '),\n };\n};\n\nexport default mapViewerToSidebarProfileView;\n"],"mappings":";AAeA,IAAM,KAAiB,MACd,GAAO,KAAK,KAAK,IAGb,KAAiC,EAC5C,WACA,0BAC8D;CAS9D,IAAI,IANsB,CAFR,EAAc,GAAQ,SAEb,GADV,EAAc,GAAQ,QACD,CAAQ,EAC3C,QAAQ,MACA,MAAU,EAClB,EACA,KAAK,GAAG,EACR,KACe;CAClB,AAAI,MAAgB,OAClB,IAAc;CAGhB,IAAM,IAAQ,EAAc,GAAQ,KAAK,GAErC,IADkB,EAAc,GAAQ,QAC7B;CACf,AAAI,MAAa,OACf,IAAW;CAGb,IAAM,IAAY,CAAC,CAAW;CAK9B,OAJI,MAAU,MACZ,EAAU,KAAK,CAAK,GAGf;EACL;EACA;EACA;EACA,WAAW,EAAU,KAAK,KAAK;CACjC;AACF"}
|
|
@@ -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,EAAK,EAGP,KAAgB,GAAkB,MAI7C,GAHI,MAAa,KAGb,MAAS,OAAO,EAAS,WAAW,GAAG,EAAK,GAAG,GAMxC,KACX,GACA,MACW;CACX,IAAM,IAAqB,EAAS,QAAQ,SAAS,GAAG,EAClD,IAAwB,EAAY,QAAQ,SAAS,GAAG;CAI9D,OAHI,MAAuB,KAClB,IAAI,MAEN,GAAG,EAAmB,GAAG;GAGrB,KACX,OAIO,EACL,MAAM,EACJ,UAJc,OAAO,KAAK,EAIhB,EACX,EACF,GAGU,KACX,GACA,MAEO,GAAS,UAAU,EAAmB,EAAS,EAY3C,KACX,MAEI,EAAK,SAAS,cACT;CAAE,MAAM;CAAa,IAAI,EAAK,MAAM;CAAa,GAEnD;CAAE,MAAM,EAAK;CAAM,IAAI,EAAK;CAAI,EAG5B,KAGX,MAEI,EAAM,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B,EAAO,KAAK,EAAS;IACrB;GACF,EAEK;GAGI,KACX,GACA,MACkB;CAClB,IAAM,IAAU,OAAO,QAAQ,EAAS;CACxC,KAAK,IAAM,CAAC,GAAU,MAAW,GAC/B,IAAI,EAAO,SAAS;MACd,EAAa,GAAU,EAAO,OAAO,KAAK,EAC5C,OAAO;QAEJ,IAAI,EAAO,WAAW,EAAa,GAAU,EAAO,OAAO,KAAK,EACrE,OAAO;CAGX,OAAO;GAGI,KACX,GACA,GACA,GACA,GACA,MACkB;CAKlB,IAJI,KAAkB,QAIlB,CAAC,EAAgB,GAAgB,GAAU,GAAS,EAAY,EAClE,OAAO;CAGT,KAAK,IAAM,CAAC,GAAS,MAAU,OAAO,QAAQ,EAAO,EAEnD,KADkB,EAAM,aAAa,QAAQ,EAAM,UAAU,EAAY,KAGvE,EAAsB,GAAO,EAAQ,CAAC,SAAS,EAAe,EAE9D,OAAO;CAIX,OAAO"}
|
|
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;AA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,CAAQ,GACjB,EAAO,KAAK,CAAQ;EACtB,CAAC;CACH,CAAC,GAEM;AACT,GAEa,KACX,GACA,MACkB;CAClB,IAAM,IAAU,OAAO,QAAQ,CAAQ;CACvC,KAAK,IAAM,CAAC,GAAU,MAAW,GAC/B,IAAI,EAAO,SAAS;MACd,EAAa,GAAU,EAAO,OAAO,IAAI,GAC3C,OAAO;CAAA,OAEJ,IAAI,EAAO,WAAW,EAAa,GAAU,EAAO,OAAO,IAAI,GACpE,OAAO;CAGX,OAAO;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,EAAE,SAAS,CAAc,GAE7D,OAAO;CAIX,OAAO;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeInlineLink.js","names":[],"sources":["../../../../../src/components/backoffice/links/BackofficeInlineLink.tsx"],"sourcesContent":["import { type JSX, type MouseEventHandler, type ReactNode } from 'react';\nimport Link from '@plumile/router/routing/Link.js';\n\nimport type { BackofficeEntityManifestMap } from '@plumile/backoffice-core/types.js';\n\nimport { BackofficeLinkContent } from './BackofficeLinkContent.js';\nimport type { BackofficeLinkTarget } from './types.js';\nimport { useBackofficeLink } from './useBackofficeLink.js';\n\nexport type BackofficeInlineLinkProps<\n TManifest extends BackofficeEntityManifestMap = BackofficeEntityManifestMap,\n> = {\n target: BackofficeLinkTarget<TManifest>;\n label?: ReactNode;\n className?: string;\n title?: string;\n ariaLabel?: string;\n icon?: 'auto' | 'none';\n openInNewTab?: boolean;\n endAdornment?: ReactNode;\n onClick?: MouseEventHandler<HTMLAnchorElement>;\n children?: ReactNode;\n};\n\nexport const BackofficeInlineLink = <\n TManifest extends BackofficeEntityManifestMap = BackofficeEntityManifestMap,\n>({\n target,\n label,\n className,\n title,\n ariaLabel,\n icon = 'auto',\n openInNewTab = false,\n endAdornment,\n onClick,\n children,\n}: BackofficeInlineLinkProps<TManifest>): JSX.Element => {\n const link = useBackofficeLink(target, {\n label: children ?? label,\n });\n\n let linkProps: { target?: '_blank'; rel?: 'noreferrer' } = {};\n if (openInNewTab) {\n linkProps = { target: '_blank', rel: 'noreferrer' };\n }\n\n return (\n <Link\n to={link.href}\n className={className}\n title={title}\n aria-label={ariaLabel}\n onClick={onClick}\n {...linkProps}\n >\n <BackofficeLinkContent\n icon={link.icon}\n label={link.label}\n showIcon={icon === 'auto'}\n endAdornment={endAdornment}\n />\n </Link>\n );\n};\n\nexport default BackofficeInlineLink;\n"],"mappings":";;;;;AAwBA,IAAa,KAEX,EACA,WACA,UACA,cACA,UACA,cACA,UAAO,QACP,kBAAe,IACf,iBACA,YACA,kBACuD;CACvD,IAAM,IAAO,EAAkB,GAAQ,EACrC,OAAO,KAAY,
|
|
1
|
+
{"version":3,"file":"BackofficeInlineLink.js","names":[],"sources":["../../../../../src/components/backoffice/links/BackofficeInlineLink.tsx"],"sourcesContent":["import { type JSX, type MouseEventHandler, type ReactNode } from 'react';\nimport Link from '@plumile/router/routing/Link.js';\n\nimport type { BackofficeEntityManifestMap } from '@plumile/backoffice-core/types.js';\n\nimport { BackofficeLinkContent } from './BackofficeLinkContent.js';\nimport type { BackofficeLinkTarget } from './types.js';\nimport { useBackofficeLink } from './useBackofficeLink.js';\n\nexport type BackofficeInlineLinkProps<\n TManifest extends BackofficeEntityManifestMap = BackofficeEntityManifestMap,\n> = {\n target: BackofficeLinkTarget<TManifest>;\n label?: ReactNode;\n className?: string;\n title?: string;\n ariaLabel?: string;\n icon?: 'auto' | 'none';\n openInNewTab?: boolean;\n endAdornment?: ReactNode;\n onClick?: MouseEventHandler<HTMLAnchorElement>;\n children?: ReactNode;\n};\n\nexport const BackofficeInlineLink = <\n TManifest extends BackofficeEntityManifestMap = BackofficeEntityManifestMap,\n>({\n target,\n label,\n className,\n title,\n ariaLabel,\n icon = 'auto',\n openInNewTab = false,\n endAdornment,\n onClick,\n children,\n}: BackofficeInlineLinkProps<TManifest>): JSX.Element => {\n const link = useBackofficeLink(target, {\n label: children ?? label,\n });\n\n let linkProps: { target?: '_blank'; rel?: 'noreferrer' } = {};\n if (openInNewTab) {\n linkProps = { target: '_blank', rel: 'noreferrer' };\n }\n\n return (\n <Link\n to={link.href}\n className={className}\n title={title}\n aria-label={ariaLabel}\n onClick={onClick}\n {...linkProps}\n >\n <BackofficeLinkContent\n icon={link.icon}\n label={link.label}\n showIcon={icon === 'auto'}\n endAdornment={endAdornment}\n />\n </Link>\n );\n};\n\nexport default BackofficeInlineLink;\n"],"mappings":";;;;;AAwBA,IAAa,KAEX,EACA,WACA,UACA,cACA,UACA,cACA,UAAO,QACP,kBAAe,IACf,iBACA,YACA,kBACuD;CACvD,IAAM,IAAO,EAAkB,GAAQ,EACrC,OAAO,KAAY,EACrB,CAAC,GAEG,IAAuD,CAAC;CAK5D,OAJI,MACF,IAAY;EAAE,QAAQ;EAAU,KAAK;CAAa,IAIlD,kBAAC,GAAD;EACE,IAAI,EAAK;EACE;EACJ;EACP,cAAY;EACH;EACT,GAAI;YAEJ,kBAAC,GAAD;GACE,MAAM,EAAK;GACX,OAAO,EAAK;GACZ,UAAU,MAAS;GACL;EACf,CAAA;CACG,CAAA;AAEV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeLink.js","names":[],"sources":["../../../../../src/components/backoffice/links/BackofficeLink.tsx"],"sourcesContent":["import { type JSX, type ReactNode } from 'react';\nimport Link from '@plumile/router/routing/Link.js';\n\nimport type { BackofficeEntityManifestMap } from '@plumile/backoffice-core/types.js';\n\nimport { BackofficeLinkContent } from './BackofficeLinkContent.js';\nimport type { BackofficeLinkTarget } from './types.js';\nimport { useBackofficeLink } from './useBackofficeLink.js';\n\nexport type BackofficeLinkProps<\n TManifest extends BackofficeEntityManifestMap = BackofficeEntityManifestMap,\n> = {\n target: BackofficeLinkTarget<TManifest>;\n label?: ReactNode;\n className?: string;\n icon?: 'auto' | 'none';\n children?: ReactNode;\n};\n\nexport const BackofficeLink = <\n TManifest extends BackofficeEntityManifestMap = BackofficeEntityManifestMap,\n>({\n target,\n label,\n className,\n icon = 'auto',\n children,\n}: BackofficeLinkProps<TManifest>): JSX.Element => {\n const link = useBackofficeLink(target, {\n label: children ?? label,\n });\n\n return (\n <Link to={link.href} className={className}>\n <BackofficeLinkContent\n icon={link.icon}\n label={link.label}\n showIcon={icon === 'auto'}\n />\n </Link>\n );\n};\n\nexport default BackofficeLink;\n"],"mappings":";;;;;AAmBA,IAAa,KAEX,EACA,WACA,UACA,cACA,UAAO,QACP,kBACiD;CACjD,IAAM,IAAO,EAAkB,GAAQ,EACrC,OAAO,KAAY,
|
|
1
|
+
{"version":3,"file":"BackofficeLink.js","names":[],"sources":["../../../../../src/components/backoffice/links/BackofficeLink.tsx"],"sourcesContent":["import { type JSX, type ReactNode } from 'react';\nimport Link from '@plumile/router/routing/Link.js';\n\nimport type { BackofficeEntityManifestMap } from '@plumile/backoffice-core/types.js';\n\nimport { BackofficeLinkContent } from './BackofficeLinkContent.js';\nimport type { BackofficeLinkTarget } from './types.js';\nimport { useBackofficeLink } from './useBackofficeLink.js';\n\nexport type BackofficeLinkProps<\n TManifest extends BackofficeEntityManifestMap = BackofficeEntityManifestMap,\n> = {\n target: BackofficeLinkTarget<TManifest>;\n label?: ReactNode;\n className?: string;\n icon?: 'auto' | 'none';\n children?: ReactNode;\n};\n\nexport const BackofficeLink = <\n TManifest extends BackofficeEntityManifestMap = BackofficeEntityManifestMap,\n>({\n target,\n label,\n className,\n icon = 'auto',\n children,\n}: BackofficeLinkProps<TManifest>): JSX.Element => {\n const link = useBackofficeLink(target, {\n label: children ?? label,\n });\n\n return (\n <Link to={link.href} className={className}>\n <BackofficeLinkContent\n icon={link.icon}\n label={link.label}\n showIcon={icon === 'auto'}\n />\n </Link>\n );\n};\n\nexport default BackofficeLink;\n"],"mappings":";;;;;AAmBA,IAAa,KAEX,EACA,WACA,UACA,cACA,UAAO,QACP,kBACiD;CACjD,IAAM,IAAO,EAAkB,GAAQ,EACrC,OAAO,KAAY,EACrB,CAAC;CAED,OACE,kBAAC,GAAD;EAAM,IAAI,EAAK;EAAiB;YAC9B,kBAAC,GAAD;GACE,MAAM,EAAK;GACX,OAAO,EAAK;GACZ,UAAU,MAAS;EACpB,CAAA;CACG,CAAA;AAEV"}
|
|
@@ -5,7 +5,7 @@ var i = ({ icon: i, label: a, showIcon: o = !0, endAdornment: s }) => /* @__PURE
|
|
|
5
5
|
className: e,
|
|
6
6
|
children: [
|
|
7
7
|
o && i != null && /* @__PURE__ */ n("span", {
|
|
8
|
-
className: "
|
|
8
|
+
className: "txvbqbfca txvbqbey txvbqbldo txvbqb1axf txvbqbfif txvbqb19xb txvbqbk2q",
|
|
9
9
|
"aria-hidden": "true",
|
|
10
10
|
children: /* @__PURE__ */ n(i, {
|
|
11
11
|
width: 14,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeLinkContent.js","names":[],"sources":["../../../../../src/components/backoffice/links/BackofficeLinkContent.tsx"],"sourcesContent":["import { type JSX, type ReactNode } from 'react';\n\nimport type { BackofficeIconComponent } from '../../../provider/types.js';\nimport * as styles from './backofficeLink.css.js';\n\nexport type BackofficeLinkContentProps = {\n icon?: BackofficeIconComponent;\n label: ReactNode;\n showIcon?: boolean;\n endAdornment?: ReactNode;\n};\n\nexport const BackofficeLinkContent = ({\n icon: Icon,\n label,\n showIcon = true,\n endAdornment,\n}: BackofficeLinkContentProps): JSX.Element => {\n return (\n <span className={styles.content}>\n {showIcon && Icon != null && (\n <span className={styles.icon} aria-hidden=\"true\">\n <Icon width={14} height={14} aria-hidden=\"true\" />\n </span>\n )}\n <span className={styles.label}>{label}</span>\n {endAdornment}\n </span>\n );\n};\n"],"mappings":";;;AAYA,IAAa,KAAyB,EACpC,MAAM,GACN,OAAA,GACA,cAAW,IACX,sBAGE,kBAAC,QAAD;CAAM,WAAW;WAAjB;EACG,KAAY,KAAQ,QACnB,kBAAC,QAAD;GAAM,WAAW;GAAa,eAAY;aACxC,kBAAC,GAAD;IAAM,OAAO;IAAI,QAAQ;IAAI,eAAY;
|
|
1
|
+
{"version":3,"file":"BackofficeLinkContent.js","names":[],"sources":["../../../../../src/components/backoffice/links/BackofficeLinkContent.tsx"],"sourcesContent":["import { type JSX, type ReactNode } from 'react';\n\nimport type { BackofficeIconComponent } from '../../../provider/types.js';\nimport * as styles from './backofficeLink.css.js';\n\nexport type BackofficeLinkContentProps = {\n icon?: BackofficeIconComponent;\n label: ReactNode;\n showIcon?: boolean;\n endAdornment?: ReactNode;\n};\n\nexport const BackofficeLinkContent = ({\n icon: Icon,\n label,\n showIcon = true,\n endAdornment,\n}: BackofficeLinkContentProps): JSX.Element => {\n return (\n <span className={styles.content}>\n {showIcon && Icon != null && (\n <span className={styles.icon} aria-hidden=\"true\">\n <Icon width={14} height={14} aria-hidden=\"true\" />\n </span>\n )}\n <span className={styles.label}>{label}</span>\n {endAdornment}\n </span>\n );\n};\n"],"mappings":";;;AAYA,IAAa,KAAyB,EACpC,MAAM,GACN,OAAA,GACA,cAAW,IACX,sBAGE,kBAAC,QAAD;CAAM,WAAW;WAAjB;EACG,KAAY,KAAQ,QACnB,kBAAC,QAAD;GAAM,WAAW;GAAa,eAAY;aACxC,kBAAC,GAAD;IAAM,OAAO;IAAI,QAAQ;IAAI,eAAY;GAAQ,CAAA;EAC7C,CAAA;EAER,kBAAC,QAAD;GAAM,WAAW;aAAe;EAAY,CAAA;EAC3C;CACG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeLinkLabel.js","names":[],"sources":["../../../../../src/components/backoffice/links/BackofficeLinkLabel.tsx"],"sourcesContent":["import { type JSX, type ReactNode } from 'react';\n\nimport type { BackofficeEntityManifestMap } from '@plumile/backoffice-core/types.js';\n\nimport { BackofficeLinkContent } from './BackofficeLinkContent.js';\nimport type { BackofficeLinkTarget } from './types.js';\nimport { useBackofficeLink } from './useBackofficeLink.js';\n\nexport type BackofficeLinkLabelProps<\n TManifest extends BackofficeEntityManifestMap = BackofficeEntityManifestMap,\n> = {\n target: BackofficeLinkTarget<TManifest>;\n label?: ReactNode;\n className?: string;\n icon?: 'auto' | 'none';\n};\n\nexport const BackofficeLinkLabel = <\n TManifest extends BackofficeEntityManifestMap = BackofficeEntityManifestMap,\n>({\n target,\n label,\n className,\n icon = 'auto',\n}: BackofficeLinkLabelProps<TManifest>): JSX.Element => {\n const link = useBackofficeLink(target, { label });\n\n return (\n <span className={className}>\n <BackofficeLinkContent\n icon={link.icon}\n label={link.label}\n showIcon={icon === 'auto'}\n />\n </span>\n );\n};\n\nexport default BackofficeLinkLabel;\n"],"mappings":";;;;AAiBA,IAAa,KAEX,EACA,WACA,UACA,cACA,UAAO,aAC+C;CACtD,IAAM,IAAO,EAAkB,GAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"BackofficeLinkLabel.js","names":[],"sources":["../../../../../src/components/backoffice/links/BackofficeLinkLabel.tsx"],"sourcesContent":["import { type JSX, type ReactNode } from 'react';\n\nimport type { BackofficeEntityManifestMap } from '@plumile/backoffice-core/types.js';\n\nimport { BackofficeLinkContent } from './BackofficeLinkContent.js';\nimport type { BackofficeLinkTarget } from './types.js';\nimport { useBackofficeLink } from './useBackofficeLink.js';\n\nexport type BackofficeLinkLabelProps<\n TManifest extends BackofficeEntityManifestMap = BackofficeEntityManifestMap,\n> = {\n target: BackofficeLinkTarget<TManifest>;\n label?: ReactNode;\n className?: string;\n icon?: 'auto' | 'none';\n};\n\nexport const BackofficeLinkLabel = <\n TManifest extends BackofficeEntityManifestMap = BackofficeEntityManifestMap,\n>({\n target,\n label,\n className,\n icon = 'auto',\n}: BackofficeLinkLabelProps<TManifest>): JSX.Element => {\n const link = useBackofficeLink(target, { label });\n\n return (\n <span className={className}>\n <BackofficeLinkContent\n icon={link.icon}\n label={link.label}\n showIcon={icon === 'auto'}\n />\n </span>\n );\n};\n\nexport default BackofficeLinkLabel;\n"],"mappings":";;;;AAiBA,IAAa,KAEX,EACA,WACA,UACA,cACA,UAAO,aAC+C;CACtD,IAAM,IAAO,EAAkB,GAAQ,EAAE,SAAM,CAAC;CAEhD,OACE,kBAAC,QAAD;EAAiB;YACf,kBAAC,GAAD;GACE,MAAM,EAAK;GACX,OAAO,EAAK;GACZ,UAAU,MAAS;EACpB,CAAA;CACG,CAAA;AAEV"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* empty css */
|
|
2
2
|
//#region src/components/backoffice/links/backofficeLink.css.ts
|
|
3
|
-
var e = "
|
|
3
|
+
var e = "txvbqbfca txvbqbey txvbqbgys", t = "txvbqbfca txvbqbey txvbqbldo txvbqb1axf txvbqbfif txvbqb19xb txvbqbk2q", n = "txvbqbuth";
|
|
4
4
|
//#endregion
|
|
5
5
|
export { e as content, t as icon, n as label };
|
|
6
6
|
|