@cosmicdrift/kumiko-renderer 0.413.1 → 0.415.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/action-form-support.js +4 -0
- package/dist/app/content-previews.d.ts +39 -0
- package/dist/app/content-previews.js +28 -0
- package/dist/app/entity-edit-screen.js +2 -5
- package/dist/app/entity-list-screen.js +42 -59
- package/dist/app/form-schema.d.ts +1 -0
- package/dist/app/form-schema.js +24 -0
- package/dist/app/list-facets.d.ts +1 -0
- package/dist/app/list-facets.js +10 -1
- package/dist/app/list-sort-options.d.ts +4 -0
- package/dist/app/list-sort-options.js +11 -0
- package/dist/app/named-filter-facet.d.ts +16 -3
- package/dist/app/named-filter-facet.js +97 -5
- package/dist/app/projection-detail-body.d.ts +2 -4
- package/dist/app/projection-detail-body.js +7 -1
- package/dist/app/projection-detail-guidance-data.d.ts +7 -0
- package/dist/app/projection-detail-guidance-data.js +103 -0
- package/dist/app/projection-detail-guidance.d.ts +13 -0
- package/dist/app/projection-detail-guidance.js +197 -0
- package/dist/app/projection-detail-header-model.d.ts +1 -3
- package/dist/app/projection-detail-header-model.js +4 -8
- package/dist/app/projection-detail-header-region.d.ts +2 -1
- package/dist/app/projection-detail-header-region.js +63 -23
- package/dist/app/projection-detail-header.d.ts +6 -1
- package/dist/app/projection-detail-header.js +76 -18
- package/dist/app/projection-detail-navigation.d.ts +2 -0
- package/dist/app/projection-detail-navigation.js +13 -3
- package/dist/app/projection-detail-states.d.ts +3 -3
- package/dist/app/projection-list-body.js +4 -2
- package/dist/app/projection-list-render.js +3 -1
- package/dist/app/projection-list-shim.d.ts +4 -1
- package/dist/app/projection-list-shim.js +35 -8
- package/dist/app/reference-link.d.ts +3 -2
- package/dist/app/reference-link.js +19 -4
- package/dist/app/row-actions.js +3 -3
- package/dist/app/screen-access.d.ts +4 -0
- package/dist/app/screen-access.js +18 -0
- package/dist/app/screen-shared.js +3 -1
- package/dist/app/unique-label-keys.d.ts +1 -0
- package/dist/app/unique-label-keys.js +9 -0
- package/dist/app/use-entity-list-payload.d.ts +26 -0
- package/dist/app/use-entity-list-payload.js +59 -0
- package/dist/app/use-entity-range-facets.js +2 -3
- package/dist/app/use-facet-counts.d.ts +5 -0
- package/dist/app/use-facet-counts.js +7 -0
- package/dist/app/use-list-summary-row.d.ts +10 -0
- package/dist/app/use-list-summary-row.js +33 -0
- package/dist/app/use-named-filter-queue.d.ts +20 -0
- package/dist/app/use-named-filter-queue.js +9 -0
- package/dist/app/use-projection-detail-actions.d.ts +5 -4
- package/dist/app/use-projection-detail-actions.js +42 -1
- package/dist/app/use-projection-list-data.d.ts +5 -0
- package/dist/app/use-projection-list-data.js +35 -6
- package/dist/app/use-projection-list-query.d.ts +2 -0
- package/dist/app/use-projection-list-query.js +29 -16
- package/dist/app/use-related-list-tab-counts.js +5 -1
- package/dist/app/use-row-decoration.d.ts +13 -0
- package/dist/app/use-row-decoration.js +103 -0
- package/dist/app/use-screen-list-rows.d.ts +4 -1
- package/dist/app/use-screen-list-rows.js +14 -5
- package/dist/app/use-screen-list-table.d.ts +3 -1
- package/dist/app/use-screen-list-table.js +10 -1
- package/dist/app/write-failed-error.d.ts +1 -0
- package/dist/app/write-failed-error.js +10 -0
- package/dist/card-options.d.ts +25 -0
- package/dist/card-options.js +1 -0
- package/dist/compact-tap-classes.d.ts +1 -0
- package/dist/compact-tap-classes.js +3 -0
- package/dist/components/embedded-list-field.js +13 -12
- package/dist/components/list-empty-state.d.ts +13 -1
- package/dist/components/list-empty-state.js +20 -1
- package/dist/components/list-group-page-bridges.d.ts +1 -1
- package/dist/components/list-group-page-bridges.js +2 -2
- package/dist/components/related-list-section.js +4 -22
- package/dist/components/render-edit-action-button.d.ts +3 -1
- package/dist/components/render-edit-action-button.js +5 -3
- package/dist/components/render-edit-render-model.d.ts +2 -2
- package/dist/components/render-edit-types.d.ts +4 -2
- package/dist/components/render-edit.js +3 -1
- package/dist/components/render-list-hint-columns.d.ts +9 -0
- package/dist/components/render-list-hint-columns.js +87 -0
- package/dist/components/render-list-reference-columns.js +4 -2
- package/dist/components/render-list-row-tone.d.ts +3 -0
- package/dist/components/render-list-row-tone.js +10 -0
- package/dist/components/render-list-table-props.d.ts +9 -1
- package/dist/components/render-list-table-props.js +4 -1
- package/dist/components/render-list-toolbar-action.d.ts +1 -2
- package/dist/components/render-list-toolbar-model.d.ts +4 -1
- package/dist/components/render-list-toolbar-model.js +21 -6
- package/dist/components/render-list-toolbar.d.ts +3 -2
- package/dist/components/render-list-toolbar.js +8 -6
- package/dist/components/render-list-types.d.ts +6 -1
- package/dist/components/render-list.js +26 -7
- package/dist/components/use-render-edit-controlled-sync.js +3 -5
- package/dist/components/use-render-edit-draft-save.js +7 -9
- package/dist/components/use-render-edit-schema.d.ts +3 -0
- package/dist/components/use-render-edit-schema.js +15 -0
- package/dist/components/use-render-edit-state.d.ts +1 -0
- package/dist/components/use-render-edit-state.js +4 -1
- package/dist/components/use-render-edit-steps.js +2 -3
- package/dist/components/use-render-list-columns.d.ts +3 -1
- package/dist/components/use-render-list-columns.js +22 -10
- package/dist/context/screen-focus-context.d.ts +14 -0
- package/dist/context/screen-focus-context.js +28 -0
- package/dist/data-table-facet-types.d.ts +6 -0
- package/dist/data-table-view-types.d.ts +20 -1
- package/dist/headless/form/form-controller.js +3 -1
- package/dist/headless/form/zod-bridge.d.ts +7 -1
- package/dist/headless/form/zod-bridge.js +10 -0
- package/dist/headless/index.d.ts +2 -1
- package/dist/headless/index.js +1 -0
- package/dist/headless/pwa-service-worker-meta.d.ts +4 -0
- package/dist/headless/pwa-service-worker-meta.js +13 -0
- package/dist/headless/view-model/index.d.ts +1 -1
- package/dist/headless/view-model/list-file-display.js +3 -2
- package/dist/headless/view-model/list.js +16 -0
- package/dist/headless/view-model/types.d.ts +37 -0
- package/dist/hooks/list-column-layout.js +2 -1
- package/dist/hooks/list-server-groups.js +14 -1
- package/dist/hooks/list-state-schema.d.ts +1 -0
- package/dist/hooks/list-state-schema.js +9 -1
- package/dist/hooks/use-debounced-value.d.ts +1 -0
- package/dist/hooks/use-debounced-value.js +11 -0
- package/dist/hooks/use-list-aggregates.d.ts +5 -1
- package/dist/hooks/use-list-aggregates.js +9 -5
- package/dist/hooks/use-list-table.d.ts +2 -1
- package/dist/hooks/use-list-table.js +3 -9
- package/dist/hooks/use-list-url-state.d.ts +2 -0
- package/dist/hooks/use-list-url-state.js +12 -4
- package/dist/hooks/use-list-view-state.js +23 -3
- package/dist/hooks/use-reference-lookup.js +7 -2
- package/dist/hooks/use-remembered-list-params.d.ts +6 -2
- package/dist/hooks/use-remembered-list-params.js +18 -3
- package/dist/hooks/use-store.js +0 -1
- package/dist/i18n-defaults.js +39 -3
- package/dist/index.d.ts +7 -2
- package/dist/index.js +4 -1
- package/dist/live/dispatcher-live.js +2 -0
- package/dist/metric-types.d.ts +4 -0
- package/dist/primitives-record-guidance.d.ts +55 -0
- package/dist/primitives-record-guidance.js +1 -0
- package/dist/primitives.d.ts +47 -54
- package/dist/server-clock.d.ts +6 -0
- package/dist/server-clock.js +20 -0
- package/dist/session/session-ended.d.ts +1 -0
- package/dist/session/session-ended.js +2 -2
- package/dist/status-tone.d.ts +1 -0
- package/dist/status-tone.js +5 -0
- package/dist/web/app/browser-locale.js +1 -1
- package/dist/web/app/client-plugin.d.ts +6 -1
- package/dist/web/app/create-app.d.ts +2 -1
- package/dist/web/app/create-app.js +15 -5
- package/dist/web/app/dashboard-body.js +25 -11
- package/dist/web/app/dashboard-header.d.ts +2 -1
- package/dist/web/app/dashboard-header.js +19 -7
- package/dist/web/app/dashboard-list-panel.d.ts +12 -0
- package/dist/web/app/dashboard-list-panel.js +144 -0
- package/dist/web/app/dashboard-narrow-gate.d.ts +6 -0
- package/dist/web/app/dashboard-narrow-gate.js +6 -0
- package/dist/web/app/dashboard-narrow-order.d.ts +3 -0
- package/dist/web/app/dashboard-narrow-order.js +6 -0
- package/dist/web/app/dashboard-navigation-link.d.ts +12 -0
- package/dist/web/app/dashboard-navigation-link.js +21 -0
- package/dist/web/app/dashboard-panels.d.ts +7 -23
- package/dist/web/app/dashboard-panels.js +55 -123
- package/dist/web/app/dashboard-reference-list-table.d.ts +5 -1
- package/dist/web/app/dashboard-reference-list-table.js +13 -4
- package/dist/web/app/dashboard-shared.d.ts +23 -7
- package/dist/web/app/dashboard-shared.js +45 -17
- package/dist/web/app/dashboard-stat-group-panel.d.ts +14 -0
- package/dist/web/app/dashboard-stat-group-panel.js +74 -0
- package/dist/web/app/dashboard-text-panel.d.ts +12 -0
- package/dist/web/app/dashboard-text-panel.js +167 -0
- package/dist/web/app/dashboard-text.d.ts +2 -0
- package/dist/web/app/dashboard-text.js +1 -1
- package/dist/web/app/dashboard-visibility.js +1 -1
- package/dist/web/app/relative-time.js +2 -1
- package/dist/web/drawn-icons.d.ts +6 -0
- package/dist/web/drawn-icons.js +30 -0
- package/dist/web/editor/editor-footer.d.ts +28 -0
- package/dist/web/editor/editor-footer.js +23 -0
- package/dist/web/editor/editor-frame.d.ts +23 -0
- package/dist/web/editor/editor-frame.js +24 -0
- package/dist/web/editor/editor-header.d.ts +36 -0
- package/dist/web/editor/editor-header.js +30 -0
- package/dist/web/editor/editor-rail.d.ts +32 -0
- package/dist/web/editor/editor-rail.js +37 -0
- package/dist/web/editor/editor-workbench.d.ts +34 -0
- package/dist/web/editor/editor-workbench.js +19 -0
- package/dist/web/editor/index.d.ts +6 -0
- package/dist/web/editor/index.js +6 -0
- package/dist/web/editor/relative-when.d.ts +1 -0
- package/dist/web/editor/relative-when.js +18 -0
- package/dist/web/icons.js +6 -5
- package/dist/web/index.d.ts +9 -1
- package/dist/web/index.js +7 -1
- package/dist/web/layout/default-app-shell.js +6 -4
- package/dist/web/layout/focus-aware-sidebar.d.ts +4 -7
- package/dist/web/layout/focus-aware-sidebar.js +5 -7
- package/dist/web/layout/header-action-pinned.d.ts +8 -0
- package/dist/web/layout/header-action-pinned.js +25 -0
- package/dist/web/layout/nav-collapse-state.d.ts +7 -0
- package/dist/web/layout/nav-collapse-state.js +76 -0
- package/dist/web/layout/nav-tree.js +71 -28
- package/dist/web/layout/notification-bell.d.ts +7 -2
- package/dist/web/layout/notification-bell.js +16 -5
- package/dist/web/layout/page-header-slot.d.ts +2 -0
- package/dist/web/layout/page-header-slot.js +4 -0
- package/dist/web/layout/screen-focus.d.ts +8 -0
- package/dist/web/layout/screen-focus.js +42 -0
- package/dist/web/layout/shell-focus.d.ts +5 -4
- package/dist/web/layout/shell-focus.js +14 -7
- package/dist/web/layout/shell-header.d.ts +2 -1
- package/dist/web/layout/shell-header.js +84 -27
- package/dist/web/layout/shell-style.d.ts +3 -0
- package/dist/web/layout/shell-style.js +6 -0
- package/dist/web/layout/sidebar-open-state.d.ts +6 -0
- package/dist/web/layout/sidebar-open-state.js +28 -0
- package/dist/web/layout/uniform-bar-controls.d.ts +2 -2
- package/dist/web/layout/uniform-bar-controls.js +4 -3
- package/dist/web/layout/use-in-app-inbox.js +8 -1
- package/dist/web/layout/workspace-shell.d.ts +11 -1
- package/dist/web/layout/workspace-shell.js +9 -5
- package/dist/web/lib/upload-file-ref.d.ts +2 -2
- package/dist/web/lib/upload-file-ref.js +4 -9
- package/dist/web/presence/use-presence.js +7 -2
- package/dist/web/primitives/banner.d.ts +1 -1
- package/dist/web/primitives/banner.js +22 -9
- package/dist/web/primitives/calendar-day-picker.js +24 -5
- package/dist/web/primitives/card.js +18 -8
- package/dist/web/primitives/code-input.js +6 -1
- package/dist/web/primitives/data-table/actions-column.d.ts +2 -1
- package/dist/web/primitives/data-table/actions-column.js +7 -3
- package/dist/web/primitives/data-table/card-body.d.ts +6 -1
- package/dist/web/primitives/data-table/card-body.js +53 -6
- package/dist/web/primitives/data-table/card-frame.d.ts +8 -0
- package/dist/web/primitives/data-table/card-frame.js +9 -0
- package/dist/web/primitives/data-table/card-row.js +44 -7
- package/dist/web/primitives/data-table/card-sort-select.d.ts +6 -2
- package/dist/web/primitives/data-table/card-sort-select.js +10 -7
- package/dist/web/primitives/data-table/card-view.js +12 -2
- package/dist/web/primitives/data-table/column-picker-section.js +9 -2
- package/dist/web/primitives/data-table/column-resize-handle.js +3 -4
- package/dist/web/primitives/data-table/column-role.d.ts +1 -0
- package/dist/web/primitives/data-table/column-role.js +1 -0
- package/dist/web/primitives/data-table/data-cell-props.d.ts +5 -0
- package/dist/web/primitives/data-table/data-cell-props.js +5 -0
- package/dist/web/primitives/data-table/density.js +1 -0
- package/dist/web/primitives/data-table/facet-cluster.d.ts +2 -1
- package/dist/web/primitives/data-table/facet-cluster.js +2 -2
- package/dist/web/primitives/data-table/group-band.js +4 -0
- package/dist/web/primitives/data-table/hint-cell.d.ts +14 -0
- package/dist/web/primitives/data-table/hint-cell.js +68 -0
- package/dist/web/primitives/data-table/hint-column-width.d.ts +3 -0
- package/dist/web/primitives/data-table/hint-column-width.js +11 -0
- package/dist/web/primitives/data-table/measure-value.js +2 -3
- package/dist/web/primitives/data-table/row-action-column.d.ts +3 -0
- package/dist/web/primitives/data-table/row-action-column.js +4 -0
- package/dist/web/primitives/data-table/row-render-parts.d.ts +1 -1
- package/dist/web/primitives/data-table/row-render-parts.js +3 -2
- package/dist/web/primitives/data-table/sort-options-select.d.ts +22 -0
- package/dist/web/primitives/data-table/sort-options-select.js +46 -0
- package/dist/web/primitives/data-table/sortable-header.d.ts +3 -1
- package/dist/web/primitives/data-table/sortable-header.js +5 -3
- package/dist/web/primitives/data-table/table-body.d.ts +1 -1
- package/dist/web/primitives/data-table/table-body.js +5 -3
- package/dist/web/primitives/data-table/table-chrome.js +3 -1
- package/dist/web/primitives/data-table/table-content.js +12 -7
- package/dist/web/primitives/data-table/table-data-cell.js +9 -3
- package/dist/web/primitives/data-table/table-header-row.js +5 -2
- package/dist/web/primitives/data-table/table-view.js +22 -3
- package/dist/web/primitives/data-table/toolbar-end-cluster.js +1 -1
- package/dist/web/primitives/data-table/toolbar.d.ts +2 -0
- package/dist/web/primitives/data-table/toolbar.js +70 -7
- package/dist/web/primitives/data-table/totals-footer.d.ts +20 -0
- package/dist/web/primitives/data-table/totals-footer.js +41 -9
- package/dist/web/primitives/data-table/use-bulk-selection.js +2 -1
- package/dist/web/primitives/data-table/use-column-pins.js +4 -0
- package/dist/web/primitives/data-table/use-data-table-state.d.ts +1 -0
- package/dist/web/primitives/data-table/use-data-table-state.js +9 -5
- package/dist/web/primitives/data-table/use-measured-column-widths.js +5 -4
- package/dist/web/primitives/data-table/use-row-selection.js +22 -11
- package/dist/web/primitives/data-table/view-menu.js +7 -1
- package/dist/web/primitives/data-table-cell.d.ts +21 -2
- package/dist/web/primitives/data-table-cell.js +129 -26
- package/dist/web/primitives/embedded-file-cell.js +3 -2
- package/dist/web/primitives/embedded-list-cards.js +3 -4
- package/dist/web/primitives/facet-filter.d.ts +5 -3
- package/dist/web/primitives/facet-filter.js +36 -5
- package/dist/web/primitives/facet-search-filter.d.ts +2 -1
- package/dist/web/primitives/facet-search-filter.js +3 -2
- package/dist/web/primitives/facet-trigger-label.d.ts +8 -0
- package/dist/web/primitives/facet-trigger-label.js +9 -0
- package/dist/web/primitives/file-thumbnail.d.ts +6 -2
- package/dist/web/primitives/file-thumbnail.js +13 -6
- package/dist/web/primitives/file-upload.js +3 -2
- package/dist/web/primitives/file-view-action.d.ts +6 -0
- package/dist/web/primitives/file-view-action.js +22 -0
- package/dist/web/primitives/files-dropzone.js +20 -9
- package/dist/web/primitives/form-footer-parts.d.ts +0 -1
- package/dist/web/primitives/form.js +0 -1
- package/dist/web/primitives/hint-reason-row.d.ts +32 -0
- package/dist/web/primitives/hint-reason-row.js +45 -0
- package/dist/web/primitives/index.js +6 -0
- package/dist/web/primitives/layout-elements.d.ts +1 -1
- package/dist/web/primitives/layout-elements.js +3 -3
- package/dist/web/primitives/metric.js +20 -6
- package/dist/web/primitives/page-header.d.ts +1 -1
- package/dist/web/primitives/page-header.js +10 -2
- package/dist/web/primitives/pager.d.ts +3 -2
- package/dist/web/primitives/pager.js +31 -24
- package/dist/web/primitives/reason-box.d.ts +20 -0
- package/dist/web/primitives/reason-box.js +13 -0
- package/dist/web/primitives/record-breadcrumb.d.ts +3 -0
- package/dist/web/primitives/record-breadcrumb.js +11 -0
- package/dist/web/primitives/record-steps.d.ts +3 -0
- package/dist/web/primitives/record-steps.js +50 -0
- package/dist/web/primitives/record-summary.d.ts +3 -0
- package/dist/web/primitives/record-summary.js +18 -0
- package/dist/web/primitives/row-actions.d.ts +3 -1
- package/dist/web/primitives/row-actions.js +14 -5
- package/dist/web/primitives/segmented-select.js +10 -9
- package/dist/web/primitives/tabs.js +6 -1
- package/dist/web/pwa/pwa-support.d.ts +4 -0
- package/dist/web/pwa/pwa-support.js +131 -0
- package/dist/web/sse/live-events.js +2 -2
- package/dist/web/tokens.js +0 -3
- package/dist/web/ui/sidebar.d.ts +2 -1
- package/dist/web/ui/sidebar.js +4 -3
- package/dist/web/widgets/ai-text-field.js +3 -2
- package/dist/web/widgets/chart-parts.d.ts +7 -1
- package/dist/web/widgets/chart-parts.js +10 -4
- package/dist/web/widgets/collapsible-section.js +1 -1
- package/dist/web/widgets/dashboard-list-cards.d.ts +17 -0
- package/dist/web/widgets/dashboard-list-cards.js +46 -0
- package/dist/web/widgets/dashboard-list.d.ts +45 -5
- package/dist/web/widgets/dashboard-list.js +126 -25
- package/dist/web/widgets/drawer-panel-class.d.ts +1 -0
- package/dist/web/widgets/drawer-panel-class.js +9 -1
- package/dist/web/widgets/drawer-sizing.js +1 -1
- package/dist/web/widgets/drawer.js +2 -2
- package/dist/web/widgets/floating-panel.js +4 -2
- package/dist/web/widgets/index.d.ts +2 -0
- package/dist/web/widgets/index.js +2 -0
- package/dist/web/widgets/infinity-list.js +18 -11
- package/dist/web/widgets/pdf-viewer-toolbar.js +3 -2
- package/dist/web/widgets/preview-width-frame.d.ts +7 -0
- package/dist/web/widgets/preview-width-frame.js +10 -0
- package/dist/web/widgets/section-card.d.ts +1 -1
- package/dist/web/widgets/sheet-parts.js +3 -1
- package/dist/web/widgets/stacked-area-chrome.js +3 -3
- package/dist/web/widgets/stacked-area-tooltip.js +2 -10
- package/dist/web/widgets/stat-box-cell.d.ts +19 -0
- package/dist/web/widgets/stat-box-cell.js +10 -0
- package/dist/web/widgets/stat.d.ts +16 -1
- package/dist/web/widgets/stat.js +24 -7
- package/dist/web/widgets/status-badge.d.ts +7 -5
- package/dist/web/widgets/status-badge.js +2 -2
- package/dist/web/widgets/step-bar.d.ts +1 -1
- package/dist/web/widgets/step-bar.js +37 -7
- package/dist/web/widgets/step-list-row.d.ts +4 -0
- package/dist/web/widgets/step-list-row.js +22 -14
- package/dist/web/widgets/step-list.d.ts +12 -4
- package/dist/web/widgets/step-list.js +38 -20
- package/dist/web/widgets/upload-zone.d.ts +8 -1
- package/dist/web/widgets/upload-zone.js +13 -3
- package/package.json +5 -5
- package/src/changes.json +289 -0
- package/src/web/styles.css +15 -0
|
@@ -11,10 +11,12 @@ import { useDrawerAction } from "./action-form-body.js";
|
|
|
11
11
|
import { useAppFeatures } from "./app-features-context.js";
|
|
12
12
|
import { useClientActionRuntime } from "./client-actions.js";
|
|
13
13
|
import { useNav } from "./nav.js";
|
|
14
|
+
import { hasRecordGuidance } from "./projection-detail-guidance-data.js";
|
|
14
15
|
import { deriveDetailRegionPieces, renderDetailHeaderContent, } from "./projection-detail-header-region.js";
|
|
15
16
|
import { renderDetailQueryError, renderMissingIdBanner, renderRecordNotFound, } from "./projection-detail-states.js";
|
|
16
17
|
import { renderProjectionDrawerHost } from "./projection-drawer-host.js";
|
|
17
18
|
import { QueryLoadingBanner } from "./query-state-banners.js";
|
|
19
|
+
import { useReferenceLinkResolver } from "./reference-link.js";
|
|
18
20
|
import { useReturnHost, useReturnTarget } from "./return-to.js";
|
|
19
21
|
import { useProjectionDetailActions } from "./use-projection-detail-actions.js";
|
|
20
22
|
import { useProjectionDetailData } from "./use-projection-detail-data.js";
|
|
@@ -54,13 +56,14 @@ export function ProjectionDetailBody({ schema, screen, translate, entityId, }) {
|
|
|
54
56
|
const userRoles = useUserRoles();
|
|
55
57
|
const dispatcher = useOptionalDispatcher();
|
|
56
58
|
const clientActions = useClientActionRuntime();
|
|
59
|
+
const resolveReference = useReferenceLinkResolver();
|
|
57
60
|
const host = useReturnHost();
|
|
58
61
|
const returnTargetParam = useReturnTarget(screen.id);
|
|
59
62
|
// A singleton has no record route to come back to — same as entityEdit.
|
|
60
63
|
const returnTarget = screen.singleton === true ? undefined : returnTargetParam;
|
|
61
64
|
const drawer = useDrawerAction(schema);
|
|
62
65
|
const { openDrawer } = drawer;
|
|
63
|
-
const { buildSectionActions, headerActions } = useProjectionDetailActions({
|
|
66
|
+
const { buildSectionActions, buildItemActions, headerActions } = useProjectionDetailActions({
|
|
64
67
|
schema,
|
|
65
68
|
screen,
|
|
66
69
|
effectiveTranslate,
|
|
@@ -121,11 +124,14 @@ export function ProjectionDetailBody({ schema, screen, translate, entityId, }) {
|
|
|
121
124
|
hasTabs,
|
|
122
125
|
tabCounts,
|
|
123
126
|
activeSection,
|
|
127
|
+
resolveReference,
|
|
128
|
+
buildItemActions,
|
|
124
129
|
};
|
|
125
130
|
const regionPieces = deriveDetailRegionPieces(regionModel);
|
|
126
131
|
const renderHeaderContent = (headerSlot) => renderDetailHeaderContent(regionModel, regionPieces, headerSlot);
|
|
127
132
|
return (_jsxs(_Fragment, { children: [refetchErrorBanner, _jsx(RenderEdit, { refreshToken: reloadNonce, screen: renderedDetailScreen, entity: entity, featureName: schema.featureName, initial: record, entityId: effectiveEntityId, customSubmit: async () => ({ isSuccess: true, validationBlocked: false, data: undefined }), onReload: reloadDetail, onRelatedListDrawerAction: openDrawer, ...(translate !== undefined && { translate }), ...(hasTabs && { hideSectionTitles: true }), ...(screenFillsHeight(screen) && { fillScreenHeight: true }), ...((hasHeaderCard ||
|
|
128
133
|
hasTabs ||
|
|
134
|
+
hasRecordGuidance(screen) ||
|
|
129
135
|
screen.slots?.header !== undefined ||
|
|
130
136
|
screen.recordTitleField !== undefined) && {
|
|
131
137
|
headerRegion: renderHeaderContent,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ProjectionDetailScreenDefinition, RecordBreadcrumbItem, RecordNotice, RecordProgress, RecordStep, SelectOptionTone } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
|
+
export declare function readTone(value: unknown): SelectOptionTone | undefined;
|
|
3
|
+
export declare function readBreadcrumbItems(value: unknown): RecordBreadcrumbItem[];
|
|
4
|
+
export declare function readNotice(value: unknown): RecordNotice | undefined;
|
|
5
|
+
export declare function readSteps(value: unknown): RecordStep[];
|
|
6
|
+
export declare function isRecordProgressArray(value: unknown): value is readonly RecordProgress[];
|
|
7
|
+
export declare function hasRecordGuidance(screen: ProjectionDetailScreenDefinition): boolean;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { isPlainObject } from "@cosmicdrift/kumiko-types/type-guards";
|
|
2
|
+
import { isSelectOptionTone } from "../status-tone.js";
|
|
3
|
+
function optionalString(value) {
|
|
4
|
+
return typeof value === "string" && value !== "" ? value : undefined;
|
|
5
|
+
}
|
|
6
|
+
export function readTone(value) {
|
|
7
|
+
return isSelectOptionTone(value) ? value : undefined;
|
|
8
|
+
}
|
|
9
|
+
export function readBreadcrumbItems(value) {
|
|
10
|
+
if (!Array.isArray(value))
|
|
11
|
+
return [];
|
|
12
|
+
const items = [];
|
|
13
|
+
for (const raw of value) {
|
|
14
|
+
if (!isPlainObject(raw) || typeof raw["label"] !== "string" || raw["label"] === "")
|
|
15
|
+
continue;
|
|
16
|
+
const entity = optionalString(raw["entity"]);
|
|
17
|
+
const id = optionalString(raw["id"]);
|
|
18
|
+
items.push({
|
|
19
|
+
label: raw["label"],
|
|
20
|
+
...(entity !== undefined && { entity }),
|
|
21
|
+
...(id !== undefined && { id }),
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return items;
|
|
25
|
+
}
|
|
26
|
+
export function readNotice(value) {
|
|
27
|
+
if (!isPlainObject(value))
|
|
28
|
+
return undefined;
|
|
29
|
+
// Typed keys are re-added only when valid, so a malformed tone or text can't ride along in `rest`.
|
|
30
|
+
// `rest` is only input for the banner actions' show/enabled predicates; it is never rendered.
|
|
31
|
+
const { title, text, narrowTitle, narrowText, tone, ...rest } = value;
|
|
32
|
+
if (typeof title !== "string" || title === "")
|
|
33
|
+
return undefined;
|
|
34
|
+
const parsedTone = readTone(tone);
|
|
35
|
+
return {
|
|
36
|
+
...rest,
|
|
37
|
+
title,
|
|
38
|
+
...(typeof text === "string" && { text }),
|
|
39
|
+
...(typeof narrowTitle === "string" && narrowTitle !== "" && { narrowTitle }),
|
|
40
|
+
...(typeof narrowText === "string" && narrowText !== "" && { narrowText }),
|
|
41
|
+
...(parsedTone !== undefined && { tone: parsedTone }),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function readStepWhy(why, whyOpen, whyTitle) {
|
|
45
|
+
return {
|
|
46
|
+
...(typeof why === "string" && why !== "" && { why }),
|
|
47
|
+
...(whyOpen === true && { whyOpen: true }),
|
|
48
|
+
...(typeof whyTitle === "string" && whyTitle !== "" && { whyTitle }),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export function readSteps(value) {
|
|
52
|
+
if (!Array.isArray(value))
|
|
53
|
+
return [];
|
|
54
|
+
const steps = [];
|
|
55
|
+
const seenIds = new Set();
|
|
56
|
+
for (const raw of value) {
|
|
57
|
+
if (!isPlainObject(raw))
|
|
58
|
+
continue;
|
|
59
|
+
// `rest` is only input for the step actions' show/enabled predicates; it is never rendered.
|
|
60
|
+
const { id, title, detail, why, whyOpen, whyTitle, tone, ...rest } = raw;
|
|
61
|
+
if (typeof id !== "string" || id === "" || typeof title !== "string" || title === "") {
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
// The id is the React key and the test id; the first step of an id wins.
|
|
65
|
+
if (seenIds.has(id))
|
|
66
|
+
continue;
|
|
67
|
+
seenIds.add(id);
|
|
68
|
+
const parsedTone = readTone(tone);
|
|
69
|
+
steps.push({
|
|
70
|
+
...rest,
|
|
71
|
+
id,
|
|
72
|
+
title,
|
|
73
|
+
...(typeof detail === "string" && { detail }),
|
|
74
|
+
...readStepWhy(why, whyOpen, whyTitle),
|
|
75
|
+
...(parsedTone !== undefined && { tone: parsedTone }),
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return steps;
|
|
79
|
+
}
|
|
80
|
+
function isRecordProgress(value) {
|
|
81
|
+
if (!isPlainObject(value))
|
|
82
|
+
return false;
|
|
83
|
+
const { title, steps, currentIndex } = value;
|
|
84
|
+
return (typeof title === "string" &&
|
|
85
|
+
typeof currentIndex === "number" &&
|
|
86
|
+
Number.isFinite(currentIndex) &&
|
|
87
|
+
Array.isArray(steps) &&
|
|
88
|
+
steps.every((step) => isPlainObject(step) &&
|
|
89
|
+
typeof step["id"] === "string" &&
|
|
90
|
+
typeof step["label"] === "string" &&
|
|
91
|
+
typeof step["done"] === "boolean" &&
|
|
92
|
+
(step["detail"] === undefined || typeof step["detail"] === "string")));
|
|
93
|
+
}
|
|
94
|
+
export function isRecordProgressArray(value) {
|
|
95
|
+
return Array.isArray(value) && value.every(isRecordProgress);
|
|
96
|
+
}
|
|
97
|
+
export function hasRecordGuidance(screen) {
|
|
98
|
+
return (screen.breadcrumb !== undefined ||
|
|
99
|
+
screen.summary !== undefined ||
|
|
100
|
+
screen.banner !== undefined ||
|
|
101
|
+
screen.steps !== undefined ||
|
|
102
|
+
screen.progress !== undefined);
|
|
103
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { RowAction } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
import type { RenderEditAction } from "../components/render-edit-types.ts";
|
|
4
|
+
import type { DetailHeaderModel } from "./projection-detail-header.tsx";
|
|
5
|
+
import type { ReferenceLinkResolver } from "./reference-link.ts";
|
|
6
|
+
export type DetailGuidanceModel = DetailHeaderModel & {
|
|
7
|
+
readonly resolveReference: ReferenceLinkResolver;
|
|
8
|
+
readonly buildItemActions: (actions: readonly RowAction[], item: Readonly<Record<string, unknown>>) => readonly RenderEditAction[] | undefined;
|
|
9
|
+
};
|
|
10
|
+
export declare function wrapLayout(primitives: DetailGuidanceModel["primitives"], className: string, node: ReactNode): ReactNode;
|
|
11
|
+
export declare function renderDetailBreadcrumb(model: DetailGuidanceModel): ReactNode;
|
|
12
|
+
/** Summary, banner, progress and steps in reading order; blocks whose record field holds nothing drop out. */
|
|
13
|
+
export declare function renderDetailGuidance(model: DetailGuidanceModel): ReactNode;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment } from "react";
|
|
3
|
+
import { RenderEditActionButton } from "../components/render-edit-action-button.js";
|
|
4
|
+
import { pluralKey } from "../headless/plural-key.js";
|
|
5
|
+
import { isRecordProgressArray, readBreadcrumbItems, readNotice, readSteps, readTone, } from "./projection-detail-guidance-data.js";
|
|
6
|
+
import { uniqueLabelKeys } from "./unique-label-keys.js";
|
|
7
|
+
const BANNER_VARIANT = {
|
|
8
|
+
neutral: "info",
|
|
9
|
+
accent: "primary",
|
|
10
|
+
ok: "ok",
|
|
11
|
+
warn: "warning",
|
|
12
|
+
bad: "error",
|
|
13
|
+
critical: "error",
|
|
14
|
+
};
|
|
15
|
+
const BANNER_ICON = {
|
|
16
|
+
neutral: "info",
|
|
17
|
+
accent: "info",
|
|
18
|
+
ok: "info",
|
|
19
|
+
warn: "info",
|
|
20
|
+
bad: "info",
|
|
21
|
+
critical: "info",
|
|
22
|
+
};
|
|
23
|
+
// The app layer may not render DOM tags, so layout classes ride on FillContainer; hosts without it (native) fall back to plain stacking.
|
|
24
|
+
export function wrapLayout(primitives, className, node) {
|
|
25
|
+
const { FillContainer } = primitives;
|
|
26
|
+
return FillContainer !== undefined ? (_jsx(FillContainer, { className: className, children: node })) : (node);
|
|
27
|
+
}
|
|
28
|
+
function renderActionButtons(model, resolved, specs) {
|
|
29
|
+
const { Button, Dialog, Grid } = model.primitives;
|
|
30
|
+
const hiddenIconIds = hiddenIconIdsOf(specs);
|
|
31
|
+
const button = (action, hideIcon = hiddenIconIds.has(action.id)) => (_jsx(RenderEditActionButton, { action: action, size: "sm", hideIcon: hideIcon, Button: Button, Dialog: Dialog, onError: model.setActionError }, action.id));
|
|
32
|
+
return (_jsx(Grid, { columns: "auto", children: resolved.map((action) => {
|
|
33
|
+
const narrowLabel = specs?.find((spec) => spec.id === action.id)?.narrowLabel;
|
|
34
|
+
if (narrowLabel === undefined || model.primitives.FillContainer === undefined) {
|
|
35
|
+
return button(action);
|
|
36
|
+
}
|
|
37
|
+
// The viewport is a CSS matter in this layer: both labels render, one is hidden per breakpoint.
|
|
38
|
+
return (_jsxs(Fragment, { children: [wrapLayout(model.primitives, "max-sm:hidden", button(action)), wrapLayout(model.primitives, "sm:hidden", button({
|
|
39
|
+
...action,
|
|
40
|
+
id: `${action.id}-narrow`,
|
|
41
|
+
label: model.effectiveTranslate(narrowLabel),
|
|
42
|
+
}, hiddenIconIds.has(action.id)))] }, action.id));
|
|
43
|
+
}) }));
|
|
44
|
+
}
|
|
45
|
+
function hiddenIconIdsOf(actions) {
|
|
46
|
+
return new Set((actions ?? []).filter((action) => action.hideIcon === true).map((a) => a.id));
|
|
47
|
+
}
|
|
48
|
+
function resolveItemActions(model, actions, item) {
|
|
49
|
+
if (actions === undefined || actions.length === 0)
|
|
50
|
+
return [];
|
|
51
|
+
return model.buildItemActions(actions, item) ?? [];
|
|
52
|
+
}
|
|
53
|
+
function renderItemActions(model, actions, item) {
|
|
54
|
+
const resolved = resolveItemActions(model, actions, item);
|
|
55
|
+
return resolved.length === 0 ? undefined : renderActionButtons(model, resolved, actions);
|
|
56
|
+
}
|
|
57
|
+
export function renderDetailBreadcrumb(model) {
|
|
58
|
+
const spec = model.screen.breadcrumb;
|
|
59
|
+
if (spec === undefined)
|
|
60
|
+
return undefined;
|
|
61
|
+
const raw = readBreadcrumbItems(model.record[spec.field]);
|
|
62
|
+
if (raw.length === 0)
|
|
63
|
+
return undefined;
|
|
64
|
+
const items = raw.map((item) => {
|
|
65
|
+
const link = item.entity !== undefined && item.id !== undefined
|
|
66
|
+
? model.resolveReference(item.entity, item.id)
|
|
67
|
+
: undefined;
|
|
68
|
+
return { label: item.label, ...(link !== undefined && { link }) };
|
|
69
|
+
});
|
|
70
|
+
const keys = uniqueLabelKeys(items.map((item) => item.label));
|
|
71
|
+
const { RecordBreadcrumb, Text, Link } = model.primitives;
|
|
72
|
+
const ariaLabel = model.effectiveTranslate("kumiko.detail.breadcrumb");
|
|
73
|
+
const testId = "kumiko-screen-projection-detail-breadcrumb";
|
|
74
|
+
if (RecordBreadcrumb !== undefined) {
|
|
75
|
+
return wrapLayout(model.primitives, "max-sm:hidden", _jsx(RecordBreadcrumb, { items: items, ariaLabel: ariaLabel, testId: testId }));
|
|
76
|
+
}
|
|
77
|
+
return (_jsx(Text, { testId: testId, children: items.map((item, index) => (_jsxs(Fragment, { children: [index > 0 && (_jsx(Text, { variant: "muted", decorative: true, children: " / " })), item.link !== undefined ? (_jsx(Link, { href: item.link.href, ...(item.link.onPress !== undefined && { onPress: item.link.onPress }), children: item.label })) : (_jsx(Text, { children: item.label }))] }, keys[index]))) }));
|
|
78
|
+
}
|
|
79
|
+
function renderSummary(model) {
|
|
80
|
+
const spec = model.screen.summary;
|
|
81
|
+
if (spec === undefined)
|
|
82
|
+
return undefined;
|
|
83
|
+
const text = model.record[spec.field];
|
|
84
|
+
if (typeof text !== "string" || text === "")
|
|
85
|
+
return undefined;
|
|
86
|
+
const narrowRaw = spec.narrowField !== undefined ? model.record[spec.narrowField] : undefined;
|
|
87
|
+
const narrowText = typeof narrowRaw === "string" && narrowRaw !== "" ? narrowRaw : undefined;
|
|
88
|
+
const toneRaw = spec.toneField !== undefined ? model.record[spec.toneField] : undefined;
|
|
89
|
+
const tone = readTone(toneRaw);
|
|
90
|
+
const { RecordSummary, Text } = model.primitives;
|
|
91
|
+
const testId = "kumiko-screen-projection-detail-summary";
|
|
92
|
+
if (RecordSummary !== undefined) {
|
|
93
|
+
return (_jsx(RecordSummary, { text: text, ...(narrowText !== undefined && { narrowText }), ...(tone !== undefined && { tone }), testId: testId }));
|
|
94
|
+
}
|
|
95
|
+
return _jsx(Text, { testId: testId, children: text });
|
|
96
|
+
}
|
|
97
|
+
function renderBanner(model) {
|
|
98
|
+
const spec = model.screen.banner;
|
|
99
|
+
if (spec === undefined)
|
|
100
|
+
return undefined;
|
|
101
|
+
const notice = readNotice(model.record[spec.field]);
|
|
102
|
+
if (notice === undefined)
|
|
103
|
+
return undefined;
|
|
104
|
+
const { Banner } = model.primitives;
|
|
105
|
+
const actions = renderItemActions(model, spec.actions, notice);
|
|
106
|
+
return wrapLayout(model.primitives, GUIDANCE_INSET, _jsx(Banner, { variant: BANNER_VARIANT[notice.tone ?? "neutral"], icon: BANNER_ICON[notice.tone ?? "neutral"], title: notice.title, ...(notice.narrowTitle !== undefined && { narrowTitle: notice.narrowTitle }), ...(notice.narrowText !== undefined && { narrowText: notice.narrowText }), inline: true, ...(actions !== undefined && { actions }), testId: "kumiko-screen-projection-detail-banner", children: notice.text }));
|
|
107
|
+
}
|
|
108
|
+
function renderSteps(model) {
|
|
109
|
+
const spec = model.screen.steps;
|
|
110
|
+
if (spec === undefined)
|
|
111
|
+
return undefined;
|
|
112
|
+
const { effectiveTranslate: t, record } = model;
|
|
113
|
+
const steps = readSteps(record[spec.field]);
|
|
114
|
+
const title = t(spec.title ?? "kumiko.detail.steps.title");
|
|
115
|
+
const subtitleRaw = spec.subtitleField !== undefined ? record[spec.subtitleField] : undefined;
|
|
116
|
+
const subtitle = typeof subtitleRaw === "string" && subtitleRaw !== "" ? subtitleRaw : undefined;
|
|
117
|
+
const emptyLabel = t(spec.emptyLabel ?? "kumiko.detail.steps.empty");
|
|
118
|
+
const items = steps.map((step) => {
|
|
119
|
+
const [mainAction, ...otherActions] = resolveItemActions(model, spec.actions, step);
|
|
120
|
+
return {
|
|
121
|
+
id: step.id,
|
|
122
|
+
title: step.title,
|
|
123
|
+
...(step.narrowTitle !== undefined && { narrowTitle: step.narrowTitle }),
|
|
124
|
+
...(step.detail !== undefined && { detail: step.detail }),
|
|
125
|
+
...(step.narrowDetail !== undefined && { narrowDetail: step.narrowDetail }),
|
|
126
|
+
...(step.tone !== undefined && { tone: step.tone }),
|
|
127
|
+
...(step.why !== undefined && { reason: step.why }),
|
|
128
|
+
...(step.why !== undefined && step.whyOpen === true && { reasonOpen: true }),
|
|
129
|
+
...(step.why !== undefined && step.whyTitle !== undefined && { reasonTitle: step.whyTitle }),
|
|
130
|
+
...(mainAction !== undefined && {
|
|
131
|
+
actions: renderActionButtons(model, [mainAction], spec.actions),
|
|
132
|
+
}),
|
|
133
|
+
...(otherActions.length > 0 && {
|
|
134
|
+
moreActions: renderActionButtons(model, otherActions, spec.actions),
|
|
135
|
+
}),
|
|
136
|
+
};
|
|
137
|
+
});
|
|
138
|
+
const { RecordSteps, Card, Text } = model.primitives;
|
|
139
|
+
const testId = "kumiko-screen-projection-detail-steps";
|
|
140
|
+
if (RecordSteps !== undefined) {
|
|
141
|
+
return (_jsx(RecordSteps, { title: title, ...(subtitle !== undefined && { subtitle }), emptyLabel: emptyLabel, reasonLabel: t("kumiko.detail.steps.reason"), ...(spec.narrowLimit !== undefined && {
|
|
142
|
+
narrowLimit: spec.narrowLimit,
|
|
143
|
+
moreLabel: (count) => t(pluralKey(spec.narrowMoreLabel ?? "kumiko.detail.steps.more", count), { count }),
|
|
144
|
+
lessLabel: t("kumiko.detail.steps.less"),
|
|
145
|
+
}), items: items, count: items.length, testId: testId }));
|
|
146
|
+
}
|
|
147
|
+
return (_jsx(Card, { slots: { title, ...(subtitle !== undefined && { subtitle }) }, testId: testId, children: items.length === 0 ? (_jsx(Text, { variant: "muted", children: emptyLabel })) : (items.map((item) => (_jsxs(Fragment, { children: [_jsx(Text, { children: item.title }), item.detail !== undefined && _jsx(Text, { variant: "muted", children: item.detail }), item.reason !== undefined && _jsx(Text, { variant: "muted", children: item.reason }), item.actions, item.moreActions] }, item.id)))) }));
|
|
148
|
+
}
|
|
149
|
+
function renderProgress(model, stacked) {
|
|
150
|
+
const spec = model.screen.progress;
|
|
151
|
+
if (spec === undefined)
|
|
152
|
+
return undefined;
|
|
153
|
+
const chains = model.record[spec.field];
|
|
154
|
+
const { StepBar, Card, Text } = model.primitives;
|
|
155
|
+
if (StepBar === undefined || !isRecordProgressArray(chains) || chains.length === 0) {
|
|
156
|
+
return undefined;
|
|
157
|
+
}
|
|
158
|
+
const t = model.effectiveTranslate;
|
|
159
|
+
const cards = chains.flatMap((chain, index) => {
|
|
160
|
+
if (chain.steps.length === 0)
|
|
161
|
+
return [];
|
|
162
|
+
const currentIndex = Math.min(Math.max(Math.trunc(chain.currentIndex), 0), chain.steps.length - 1);
|
|
163
|
+
const current = chain.steps[currentIndex];
|
|
164
|
+
const testId = `record-progress-${index}`;
|
|
165
|
+
return [
|
|
166
|
+
_jsxs(Card, { slots: {
|
|
167
|
+
title: chain.title,
|
|
168
|
+
...(stacked && {
|
|
169
|
+
subtitle: t("kumiko.detail.progress.step-of", {
|
|
170
|
+
current: currentIndex + 1,
|
|
171
|
+
total: chain.steps.length,
|
|
172
|
+
}),
|
|
173
|
+
}),
|
|
174
|
+
}, options: { headerLayout: "inline" }, testId: testId, children: [_jsx(StepBar, { steps: chain.steps.map((step) => step.label), currentIndex: currentIndex, doneSteps: chain.steps.map((step) => step.done), narrowLayout: "steps", ...(stacked && {
|
|
175
|
+
orientation: "stacked",
|
|
176
|
+
subtitles: chain.steps.map((step) => step.detail),
|
|
177
|
+
}), compactLabel: t("kumiko.wizard.step-with-title", {
|
|
178
|
+
current: currentIndex + 1,
|
|
179
|
+
total: chain.steps.length,
|
|
180
|
+
title: current?.label ?? "",
|
|
181
|
+
}), testId: `${testId}-bar` }), !stacked && current !== undefined && (_jsxs(Text, { variant: "muted", testId: `${testId}-up-next`, children: [t("kumiko.wizard.up-next"), ": ", current.label, current.detail !== undefined ? ` · ${current.detail}` : ""] }))] }, testId),
|
|
182
|
+
];
|
|
183
|
+
});
|
|
184
|
+
return cards.length === 0 ? undefined : cards;
|
|
185
|
+
}
|
|
186
|
+
// RecordSteps and the summary carry their own px-6; the progress cards and the banner are bare, so they need the same inset to line up with the metric tiles.
|
|
187
|
+
const GUIDANCE_INSET = "px-6 max-sm:px-4";
|
|
188
|
+
const PROGRESS_INSET = "flex min-w-0 flex-col gap-4 px-6 py-2 max-sm:px-4";
|
|
189
|
+
/** Summary, banner, progress and steps in reading order; blocks whose record field holds nothing drop out. */
|
|
190
|
+
export function renderDetailGuidance(model) {
|
|
191
|
+
const { progress, steps } = model.screen;
|
|
192
|
+
const beside = progress?.placement === "beside-steps" && steps !== undefined;
|
|
193
|
+
const progressNode = renderProgress(model, beside);
|
|
194
|
+
const progressInset = progress?.hideOnNarrow === true ? `${PROGRESS_INSET} max-sm:hidden` : PROGRESS_INSET;
|
|
195
|
+
return (_jsxs(_Fragment, { children: [renderSummary(model), renderBanner(model), beside ? (wrapLayout(model.primitives, "grid grid-cols-1 items-stretch gap-4 lg:grid-cols-12", _jsxs(_Fragment, { children: [wrapLayout(model.primitives, progressNode !== undefined ? "min-w-0 lg:col-span-8" : "min-w-0 lg:col-span-12", renderSteps(model)), progressNode !== undefined &&
|
|
196
|
+
wrapLayout(model.primitives, `${progressInset} lg:col-span-4 lg:flex lg:flex-col lg:pl-0 lg:[&>*]:flex-1`, progressNode)] }))) : (_jsxs(_Fragment, { children: [progressNode !== undefined && wrapLayout(model.primitives, progressInset, progressNode), renderSteps(model)] }))] }));
|
|
197
|
+
}
|
|
@@ -4,6 +4,7 @@ import { type Translate } from "../headless/index.ts";
|
|
|
4
4
|
import { type StatusBadgeOptionTone } from "../primitives.tsx";
|
|
5
5
|
export declare function headerStatusTone(header: NonNullable<ProjectionDetailScreenDefinition["header"]>, record: Readonly<Record<string, unknown>>): StatusBadgeOptionTone | undefined;
|
|
6
6
|
export declare function resolveHeaderStatusText(screen: ProjectionDetailScreenDefinition, record: Readonly<Record<string, unknown>>, translate: Translate): string;
|
|
7
|
+
export declare function formatOrRaw(format: FormatSpec | undefined, raw: unknown, translate: Translate): string;
|
|
7
8
|
export declare function resolveSubtitleHref(header: ProjectionDetailScreenDefinition["header"], record: Readonly<Record<string, unknown>>): string | undefined;
|
|
8
9
|
export type DetailTabItem = {
|
|
9
10
|
readonly id: string;
|
|
@@ -11,6 +12,3 @@ export type DetailTabItem = {
|
|
|
11
12
|
readonly count?: number;
|
|
12
13
|
};
|
|
13
14
|
export declare function buildDetailTabItems(sections: ProjectionDetailScreenDefinition["layout"]["sections"], record: Readonly<Record<string, unknown>>, translate: Translate, queryCounts?: Readonly<Record<string, number>>): DetailTabItem[];
|
|
14
|
-
export declare function resolveMetricText(metric: {
|
|
15
|
-
readonly format?: FormatSpec;
|
|
16
|
-
}, raw: unknown, translate: Translate): string;
|
|
@@ -36,8 +36,11 @@ export function resolveHeaderStatusText(screen, record, translate) {
|
|
|
36
36
|
if (statusField === undefined)
|
|
37
37
|
return "";
|
|
38
38
|
const raw = record[statusField];
|
|
39
|
-
const rawText = String(raw ?? "");
|
|
40
39
|
const format = screen.header?.statusFormat ?? layoutStatusFormat(screen, statusField);
|
|
40
|
+
return formatOrRaw(format, raw, translate);
|
|
41
|
+
}
|
|
42
|
+
export function formatOrRaw(format, raw, translate) {
|
|
43
|
+
const rawText = String(raw ?? "");
|
|
41
44
|
if (format === undefined)
|
|
42
45
|
return rawText;
|
|
43
46
|
const formatted = applyFormatSpec(format, raw, translate);
|
|
@@ -62,10 +65,3 @@ export function buildDetailTabItems(sections, record, translate, queryCounts = {
|
|
|
62
65
|
};
|
|
63
66
|
});
|
|
64
67
|
}
|
|
65
|
-
export function resolveMetricText(metric, raw, translate) {
|
|
66
|
-
const rawText = String(raw ?? "");
|
|
67
|
-
if (metric.format === undefined)
|
|
68
|
-
return rawText;
|
|
69
|
-
const formatted = applyFormatSpec(metric.format, raw, translate);
|
|
70
|
-
return formatted === "" ? rawText : formatted;
|
|
71
|
-
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { ProjectionDetailScreenDefinition } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
import type { ErrorNotice } from "./error-reference.tsx";
|
|
4
|
+
import { type DetailGuidanceModel } from "./projection-detail-guidance.tsx";
|
|
4
5
|
import { type DetailHeaderModel } from "./projection-detail-header.tsx";
|
|
5
|
-
export type DetailRegionModel =
|
|
6
|
+
export type DetailRegionModel = DetailGuidanceModel & {
|
|
6
7
|
readonly actionError: ErrorNotice | null;
|
|
7
8
|
readonly pageHeaderSlotAvailable: boolean;
|
|
8
9
|
readonly pageHeaderCompactContext: boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { resolveRecordTitle } from "../components/render-edit-helpers.js";
|
|
3
3
|
import { requestLeave } from "../leave-guard.js";
|
|
4
|
-
import {
|
|
5
|
-
import { buildMetricItems, renderActionErrorBanner, renderBandSubtitle, renderHeaderActionsContent, renderHeaderSubtitleSlot, renderHeaderTitleSlot, renderMetricsBlock, renderStatusBadge, } from "./projection-detail-header.js";
|
|
4
|
+
import { renderDetailBreadcrumb, renderDetailGuidance, wrapLayout, } from "./projection-detail-guidance.js";
|
|
5
|
+
import { buildMetricItems, renderActionErrorBanner, renderBandSubtitle, renderHeaderActionsContent, renderHeaderSubtitleSlot, renderHeaderTitleSlot, renderMetricsBlock, renderRecordTitleBlock, renderStatusBadge, } from "./projection-detail-header.js";
|
|
6
6
|
import { buildDetailTabItems } from "./projection-detail-header-model.js";
|
|
7
7
|
export function deriveDetailRegionPieces(model) {
|
|
8
8
|
const { screen, record, primitives, actionError, hasHeaderActions } = model;
|
|
@@ -39,32 +39,72 @@ export function deriveDetailRegionPieces(model) {
|
|
|
39
39
|
actionErrorBanner,
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
+
// Tailwind needs the literal class strings.
|
|
43
|
+
const NARROW_METRICS_ORDER = "max-md:order-1";
|
|
44
|
+
// The split band keeps the padding of the single band: the lead part drops its bottom, the tiles
|
|
45
|
+
// part trades its top for the band's gap-3.
|
|
46
|
+
const LEAD_BAND_SHARED_PADDING = "[&>*]:pb-0";
|
|
47
|
+
const TILES_BAND_SHARED_PADDING = "[&>*]:pt-3";
|
|
48
|
+
const NARROW_TABS_ORDER = "max-md:order-2";
|
|
49
|
+
function usesNarrowMetricsOrder(model) {
|
|
50
|
+
return model.screen.metricsPlacement?.narrow === "after-guidance";
|
|
51
|
+
}
|
|
52
|
+
function wrapNarrowOrder(model, orderClass, node) {
|
|
53
|
+
return usesNarrowMetricsOrder(model) ? wrapLayout(model.primitives, orderClass, node) : node;
|
|
54
|
+
}
|
|
55
|
+
// Only the metric tiles move below the guidance on narrow screens; the lead and the
|
|
56
|
+
// subtitle/status line stay under the title, so they get their own tile-less band.
|
|
57
|
+
function renderBandWithNarrowMetrics(model, metricItems, subtitle, lead) {
|
|
58
|
+
const { hasMetrics, primitives } = model;
|
|
59
|
+
const { MetricBand } = primitives;
|
|
60
|
+
if (!usesNarrowMetricsOrder(model) || !hasMetrics) {
|
|
61
|
+
return renderMetricsBlock(model, metricItems, subtitle, lead);
|
|
62
|
+
}
|
|
63
|
+
const splitsBand = MetricBand !== undefined && (subtitle !== undefined || lead !== undefined);
|
|
64
|
+
return (_jsxs(_Fragment, { children: [splitsBand &&
|
|
65
|
+
wrapLayout(primitives, LEAD_BAND_SHARED_PADDING, _jsx(MetricBand, { testId: "kumiko-screen-projection-detail-metrics-lead", subtitle: subtitle, ...(lead !== undefined && { lead }), children: undefined })), wrapNarrowOrder(model, splitsBand ? `${NARROW_METRICS_ORDER} ${TILES_BAND_SHARED_PADDING}` : NARROW_METRICS_ORDER, renderMetricsBlock(model, metricItems, MetricBand !== undefined ? undefined : subtitle))] }));
|
|
66
|
+
}
|
|
67
|
+
function shortTitleOf(header, record) {
|
|
68
|
+
const value = header?.shortTitle === undefined ? undefined : record[header.shortTitle];
|
|
69
|
+
return typeof value === "string" && value !== "" ? value : undefined;
|
|
70
|
+
}
|
|
42
71
|
function renderPageHeaderBranch(model, pieces, headerSlot, PageHeader) {
|
|
43
|
-
const { screen, record, primitives,
|
|
44
|
-
const {
|
|
45
|
-
const { pageHeaderCompact, recordTitle, statusBadge,
|
|
72
|
+
const { screen, record, primitives, hasHeaderActions, hasMetrics } = model;
|
|
73
|
+
const { MetricBand } = primitives;
|
|
74
|
+
const { pageHeaderCompact, recordTitle, statusBadge, metricItems } = pieces;
|
|
46
75
|
const header = screen.header;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
76
|
+
// Only an explicit `header` gets the body title block; recordTitleField alone keeps the shell
|
|
77
|
+
// header title and breadcrumb.
|
|
78
|
+
const titleText = header !== undefined ? String(record[header.title] ?? "") : undefined;
|
|
79
|
+
// The title block owns chip and subtitle, so neither the shell header nor the band repeats them.
|
|
80
|
+
const hasTitleBlock = titleText !== undefined;
|
|
81
|
+
const bandSubtitle = hasTitleBlock ? undefined : pieces.bandSubtitle;
|
|
82
|
+
return (_jsxs(_Fragment, { children: [_jsx(PageHeader, { ...(hasTitleBlock && { bodyTitle: true }), ...(hasTitleBlock &&
|
|
83
|
+
!pageHeaderCompact && { recordTitle: shortTitleOf(header, record) ?? titleText }), ...(header === undefined && recordTitle !== undefined && { title: recordTitle }), ...(!pageHeaderCompact &&
|
|
84
|
+
statusBadge !== undefined && {
|
|
85
|
+
status: statusBadge,
|
|
86
|
+
}), ...(hasHeaderActions && {
|
|
87
|
+
actions: renderHeaderActionsContent(model, { compact: pageHeaderCompact, PageHeader }),
|
|
88
|
+
}) }), titleText !== undefined &&
|
|
89
|
+
renderRecordTitleBlock(model, titleText, statusBadge, pieces.headerSubtitleSlot, !pageHeaderCompact), MetricBand === undefined && bandSubtitle, MetricBand === undefined && headerSlot, (hasMetrics || bandSubtitle !== undefined || headerSlot !== undefined) &&
|
|
54
90
|
(MetricBand !== undefined || hasMetrics) &&
|
|
55
|
-
|
|
91
|
+
renderBandWithNarrowMetrics(model, metricItems, bandSubtitle, MetricBand !== undefined ? headerSlot : undefined), pieces.actionErrorBanner] }));
|
|
56
92
|
}
|
|
57
93
|
function renderHeaderCardBranch(model, pieces, headerSlot) {
|
|
58
94
|
const { primitives, hasHeaderActions, hasMetrics, hasHeaderCard } = model;
|
|
59
95
|
const { Card } = primitives;
|
|
60
96
|
const { recordTitle, headerTitleSlot, headerSubtitleSlot, headerActionsContent } = pieces;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
97
|
+
// Metrics must leave the head card to take part in the narrow reordering.
|
|
98
|
+
const metricsOutsideCard = usesNarrowMetricsOrder(model) && hasMetrics;
|
|
99
|
+
return (_jsxs(_Fragment, { children: [(hasHeaderCard || headerSlot !== undefined || recordTitle !== undefined) && (_jsxs(Card, { slots: {
|
|
100
|
+
...(headerTitleSlot !== undefined && { title: headerTitleSlot }),
|
|
101
|
+
...(headerTitleSlot === undefined &&
|
|
102
|
+
recordTitle !== undefined && { title: recordTitle }),
|
|
103
|
+
...(headerSubtitleSlot !== undefined && { subtitle: headerSubtitleSlot }),
|
|
104
|
+
...(headerSlot !== undefined && { headerContent: headerSlot }),
|
|
105
|
+
...(hasHeaderActions && { headerActions: headerActionsContent }),
|
|
106
|
+
}, children: [hasMetrics && !metricsOutsideCard && renderMetricsBlock(model, pieces.metricItems), pieces.actionErrorBanner] })), metricsOutsideCard &&
|
|
107
|
+
wrapNarrowOrder(model, NARROW_METRICS_ORDER, renderMetricsBlock(model, pieces.metricItems))] }));
|
|
68
108
|
}
|
|
69
109
|
function renderDetailTabs(model, activeSection, Tabs) {
|
|
70
110
|
const { screen, record, effectiveTranslate, nav } = model;
|
|
@@ -74,10 +114,10 @@ export function renderDetailHeaderContent(model, pieces, headerSlot) {
|
|
|
74
114
|
const { hasTabs, activeSection } = model;
|
|
75
115
|
const { PageHeader } = pieces;
|
|
76
116
|
const { Tabs } = model.primitives;
|
|
77
|
-
return (_jsxs(_Fragment, { children: [PageHeader !== undefined
|
|
117
|
+
return (_jsxs(_Fragment, { children: [renderDetailBreadcrumb(model), PageHeader !== undefined
|
|
78
118
|
? renderPageHeaderBranch(model, pieces, headerSlot, PageHeader)
|
|
79
|
-
: renderHeaderCardBranch(model, pieces, headerSlot), hasTabs &&
|
|
119
|
+
: renderHeaderCardBranch(model, pieces, headerSlot), renderDetailGuidance(model), hasTabs &&
|
|
80
120
|
activeSection !== undefined &&
|
|
81
121
|
Tabs !== undefined &&
|
|
82
|
-
renderDetailTabs(model, activeSection, Tabs)] }));
|
|
122
|
+
wrapNarrowOrder(model, NARROW_TABS_ORDER, renderDetailTabs(model, activeSection, Tabs))] }));
|
|
83
123
|
}
|
|
@@ -20,8 +20,13 @@ export type DetailHeaderModel = {
|
|
|
20
20
|
readonly headerActionsList: readonly RenderEditAction[];
|
|
21
21
|
readonly setActionError: Dispatch<SetStateAction<ErrorNotice | null>>;
|
|
22
22
|
};
|
|
23
|
-
export
|
|
23
|
+
export type PageHeaderActionsOptions = {
|
|
24
|
+
readonly compact: boolean;
|
|
25
|
+
readonly PageHeader: ReturnType<typeof usePrimitives>["PageHeader"];
|
|
26
|
+
};
|
|
27
|
+
export declare function renderHeaderActionsContent(model: DetailHeaderModel, pageHeaderOptions?: PageHeaderActionsOptions): ReactNode;
|
|
24
28
|
export declare function renderHeaderTitleSlot(model: DetailHeaderModel): ReactNode;
|
|
29
|
+
export declare function renderRecordTitleBlock(model: DetailHeaderModel, titleText: string, statusBadge: ReactNode, subtitle: ReactNode, chipInBar: boolean): ReactNode;
|
|
25
30
|
export declare function renderHeaderSubtitleSlot(model: DetailHeaderModel): ReactNode;
|
|
26
31
|
export declare function buildMetricItems(model: DetailHeaderModel): ReactNode[] | undefined;
|
|
27
32
|
export declare function renderMetricsBlock(model: DetailHeaderModel, metricItems: ReactNode[] | undefined, subtitle?: ReactNode, lead?: ReactNode): ReactNode;
|