@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
|
@@ -1,13 +1,36 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { DrawnFilter, DrawnSearch } from "../../drawn-icons.js";
|
|
3
3
|
import { UNIFORM_BAR_CONTROLS_CLASSES } from "../../layout/uniform-bar-controls.js";
|
|
4
4
|
import { cn } from "../../lib/cn.js";
|
|
5
5
|
import { Button as UiButton } from "../../ui/button.js";
|
|
6
6
|
import { buildFacetCluster } from "./facet-cluster.js";
|
|
7
|
+
import { hasSortOptionsSelect, SortOptionsSelect } from "./sort-options-select.js";
|
|
7
8
|
import { ToolbarEndCluster, toolbarEndHasContent } from "./toolbar-end-cluster.js";
|
|
9
|
+
function isBehindFilter(m, facet) {
|
|
10
|
+
return facet.narrowPlacement === "behind-filter" && m.belowSm;
|
|
11
|
+
}
|
|
12
|
+
function hasBehindFilterFacets(m) {
|
|
13
|
+
return (m.filterFacets ?? []).some((facet) => isBehindFilter(m, facet));
|
|
14
|
+
}
|
|
15
|
+
function hasActiveBehindFilterFacet(m) {
|
|
16
|
+
return (m.filterFacets ?? []).some((facet) => isBehindFilter(m, facet) && (m.filterValues?.[facet.field]?.length ?? 0) > 0);
|
|
17
|
+
}
|
|
18
|
+
/** Facets that open behind the filter icon on a phone; the rest stays in the inline cluster. */
|
|
19
|
+
export function buildBehindFilterCluster(m) {
|
|
20
|
+
const behind = (m.filterFacets ?? []).filter((facet) => isBehindFilter(m, facet));
|
|
21
|
+
if (behind.length === 0)
|
|
22
|
+
return undefined;
|
|
23
|
+
return buildFacetCluster({
|
|
24
|
+
filterFacets: behind,
|
|
25
|
+
filterValues: m.filterValues,
|
|
26
|
+
onFilterChange: m.onFilterChange,
|
|
27
|
+
dense: false,
|
|
28
|
+
pills: false,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
8
31
|
export function buildModelFacetCluster(m) {
|
|
9
32
|
return buildFacetCluster({
|
|
10
|
-
filterFacets: m.filterFacets,
|
|
33
|
+
filterFacets: m.filterFacets?.filter((facet) => !isBehindFilter(m, facet)),
|
|
11
34
|
filterValues: m.filterValues,
|
|
12
35
|
onFilterChange: m.onFilterChange,
|
|
13
36
|
onFilterReset: m.onFilterReset,
|
|
@@ -18,13 +41,22 @@ export function buildModelFacetCluster(m) {
|
|
|
18
41
|
resetAll: m.resetAll,
|
|
19
42
|
notice: m.notice,
|
|
20
43
|
dense: m.fillsHeight,
|
|
44
|
+
pills: m.narrowFacets === "pills" && m.belowSm,
|
|
21
45
|
});
|
|
22
46
|
}
|
|
23
47
|
export function hasToolbarContent(m, facetCluster) {
|
|
24
48
|
return (m.toolbarStart !== undefined ||
|
|
25
49
|
facetCluster !== undefined ||
|
|
50
|
+
hasBehindFilterFacets(m) ||
|
|
51
|
+
hasVisibleSortOptions(m) ||
|
|
26
52
|
toolbarEndHasContent(m.view, m.exportList, m.toolbarEnd));
|
|
27
53
|
}
|
|
54
|
+
// The toolbar select is max-md:hidden; below md the card sort bar owns sorting, so a toolbar
|
|
55
|
+
// holding only the hidden select would render an empty row.
|
|
56
|
+
function hasVisibleSortOptions(m) {
|
|
57
|
+
return (!(m.toolbarSort === true ? m.belowSm : m.isNarrow) &&
|
|
58
|
+
hasSortOptionsSelect(m.sortOptions, m.onSortChange));
|
|
59
|
+
}
|
|
28
60
|
function toolbarClassName({ fillsHeight, isNarrow }) {
|
|
29
61
|
if (!fillsHeight)
|
|
30
62
|
return cn("flex flex-wrap items-center", UNIFORM_BAR_CONTROLS_CLASSES, "gap-3");
|
|
@@ -34,11 +66,14 @@ function toolbarClassName({ fillsHeight, isNarrow }) {
|
|
|
34
66
|
function renderToolbarStart(m, toolbarStart) {
|
|
35
67
|
return (_jsxs("div", { className: cn(m.fillsHeight
|
|
36
68
|
? "relative w-full md:w-[300px] max-md:flex-1 [&_input]:border-border-strong [&_input]:pl-8 [&_input]:max-md:h-11"
|
|
37
|
-
: "flex-1 min-w-48 max-w-sm"), children: [m.fillsHeight && (_jsx(
|
|
69
|
+
: cn("flex-1 min-w-48 max-w-sm", hasBehindFilterFacets(m) && "max-sm:max-w-none")), children: [m.fillsHeight && (_jsx(DrawnSearch, { className: "pointer-events-none absolute left-2.5 top-1/2 z-10 size-4 -translate-y-1/2 text-muted-foreground", "aria-hidden": "true" })), toolbarStart] }));
|
|
38
70
|
}
|
|
39
71
|
function renderFacetToggle(m, facetCluster) {
|
|
40
72
|
const { testId, facetsOpenNarrow, setFacetsOpenNarrow } = m;
|
|
41
|
-
|
|
73
|
+
const hasActiveFacet = hasActiveBehindFilterFacet(m);
|
|
74
|
+
return (_jsxs(_Fragment, { children: [_jsx(UiButton, { type: "button", variant: "outline", size: "icon",
|
|
75
|
+
// Like a set select pill: a facet that waits behind the toggle stays visible while the panel is closed.
|
|
76
|
+
className: cn("size-11", hasActiveFacet && "border-primary text-primary"), "data-active": hasActiveFacet, "aria-label": m.tableTranslate?.("kumiko.list.filter.toggle") ?? "Filter", "aria-expanded": facetsOpenNarrow, "data-testid": testId !== undefined ? `${testId}-filter-toggle` : "filter-toggle", onClick: () => setFacetsOpenNarrow((open) => !open), children: _jsx(DrawnFilter, { className: "size-4", "aria-hidden": "true" }) }), facetsOpenNarrow && _jsx("div", { className: "w-full", children: facetCluster })] }));
|
|
42
77
|
}
|
|
43
78
|
// With only end content (no search, no facets) the row has room for the description,
|
|
44
79
|
// so both share one line instead of stacking the description under the actions.
|
|
@@ -48,19 +83,47 @@ export function toolbarMergesDescription(m, facetCluster) {
|
|
|
48
83
|
facetCluster === undefined &&
|
|
49
84
|
toolbarEndHasContent(m.view, m.exportList, m.toolbarEnd));
|
|
50
85
|
}
|
|
86
|
+
function renderSortOptions(m) {
|
|
87
|
+
const { sortOptions, onSortChange, testId } = m;
|
|
88
|
+
if (onSortChange === undefined || !hasSortOptionsSelect(sortOptions, onSortChange)) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
return (_jsx(SortOptionsSelect, { options: sortOptions, sort: m.sort, onSortChange: onSortChange, testId: testId !== undefined ? `${testId}-sort-options` : "render-list-sort-options", className: m.toolbarSort === true ? "max-sm:hidden" : "max-md:hidden", bordered: m.toolbarSort === true }));
|
|
92
|
+
}
|
|
93
|
+
function hasOnlySelectFacets(m) {
|
|
94
|
+
return ((m.filterFacets ?? []).some((facet) => !isBehindFilter(m, facet)) &&
|
|
95
|
+
(m.dateRangeFacets?.length ?? 0) === 0 &&
|
|
96
|
+
(m.rangeFacets?.length ?? 0) === 0);
|
|
97
|
+
}
|
|
98
|
+
// Facets that wait behind the filter icon and the rest of the cluster share one toggle panel,
|
|
99
|
+
// never two toggles.
|
|
100
|
+
function renderFacetArea(m, facetCluster) {
|
|
101
|
+
const behindFilter = buildBehindFilterCluster(m);
|
|
102
|
+
if (!m.belowSm || (facetCluster === undefined && behindFilter === undefined)) {
|
|
103
|
+
return facetCluster;
|
|
104
|
+
}
|
|
105
|
+
if (facetCluster !== undefined && hasOnlySelectFacets(m)) {
|
|
106
|
+
const inline = _jsx("div", { className: "flex w-full flex-wrap gap-2", children: facetCluster });
|
|
107
|
+
if (behindFilter === undefined)
|
|
108
|
+
return inline;
|
|
109
|
+
return (_jsxs(_Fragment, { children: [renderFacetToggle(m, behindFilter), inline] }));
|
|
110
|
+
}
|
|
111
|
+
if (!m.fillsHeight && behindFilter === undefined)
|
|
112
|
+
return facetCluster;
|
|
113
|
+
return renderFacetToggle(m, _jsxs(_Fragment, { children: [behindFilter, facetCluster] }));
|
|
114
|
+
}
|
|
51
115
|
export function renderToolbar(m, facetCluster) {
|
|
52
116
|
const { testId, toolbarStart } = m;
|
|
53
|
-
const collapsesFacetsBehindButton = m.isNarrow && m.fillsHeight && facetCluster !== undefined;
|
|
54
117
|
const mergesDescription = toolbarMergesDescription(m, facetCluster);
|
|
55
118
|
return (_jsxs("div", { "data-testid": testId !== undefined ? `${testId}-toolbar` : "render-list-toolbar", className: cn(toolbarClassName(m), mergesDescription && "justify-between", mergesDescription && m.fillsHeight && !m.isNarrow && "md:py-2",
|
|
56
119
|
// A dashboard panel head above has no inset; the toolbar shares its edges like the table below.
|
|
57
|
-
m.fillsHeight && m.insideEmbeddedScreen && "px-0"), children: [mergesDescription && renderToolbarDescription(m, true, true), toolbarStart !== undefined && renderToolbarStart(m, toolbarStart),
|
|
120
|
+
m.fillsHeight && m.insideEmbeddedScreen && "px-0"), children: [mergesDescription && renderToolbarDescription(m, true, true), toolbarStart !== undefined && renderToolbarStart(m, toolbarStart), renderFacetArea(m, facetCluster), renderSortOptions(m), _jsx(ToolbarEndCluster, { view: m.view, columnLabels: new Map(m.schemaColumns.map((col) => [col.field, col.label])), exportList: m.exportList, toolbarEnd: m.toolbarEnd })] }));
|
|
58
121
|
}
|
|
59
122
|
export function renderToolbarDescription(m, hasToolbar, inToolbarRow = false) {
|
|
60
123
|
const { testId, toolbarDescription, fillsHeight, isNarrow } = m;
|
|
61
124
|
if (toolbarDescription === undefined)
|
|
62
125
|
return null;
|
|
63
|
-
return (_jsx("p", { "data-testid": testId !== undefined ? `${testId}-description` : "render-list-description", className: cn("m-0 text-sm text-muted-foreground",
|
|
126
|
+
return (_jsx("p", { "data-testid": testId !== undefined ? `${testId}-description` : "render-list-description", className: cn("m-0 text-sm text-muted-foreground max-sm:hidden",
|
|
64
127
|
// min-w-48 lets the actions wrap below the text instead of squeezing it.
|
|
65
128
|
inToolbarRow ? "min-w-48 flex-1" : "pb-2", !inToolbarRow && fillsHeight && (isNarrow ? "px-3" : "px-6"), !inToolbarRow && fillsHeight && !hasToolbar && "pt-4"), children: toolbarDescription }));
|
|
66
129
|
}
|
|
@@ -1,7 +1,27 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import type { DataTableTotals } from "../../../data-table-aggregate-types.ts";
|
|
3
|
+
import type { DataTableSummaryRow } from "../../../data-table-view-types.ts";
|
|
3
4
|
import type { ListColumnViewModel } from "../../../headless/index.ts";
|
|
4
5
|
import { type PinnedCellProps } from "./use-column-pins.ts";
|
|
6
|
+
/** Full-width row above the totals row, inside the same tfoot; the summary query's "label value · label value" pairs.
|
|
7
|
+
* When an item names a `column`, the row is drawn as table cells under their columns instead, without labels. */
|
|
8
|
+
export declare function SummaryFooterRow({ summary, colSpan, cellClassName, columns, cellPin, leadingCells, actionsCell, }: {
|
|
9
|
+
readonly summary: DataTableSummaryRow;
|
|
10
|
+
readonly colSpan: number;
|
|
11
|
+
readonly cellClassName?: string;
|
|
12
|
+
readonly columns: readonly ListColumnViewModel[];
|
|
13
|
+
readonly cellPin: (field: string) => PinnedCellProps;
|
|
14
|
+
readonly leadingCells: {
|
|
15
|
+
readonly select: boolean;
|
|
16
|
+
readonly expand: boolean;
|
|
17
|
+
};
|
|
18
|
+
readonly actionsCell: {
|
|
19
|
+
readonly fillsHeight: boolean;
|
|
20
|
+
} | undefined;
|
|
21
|
+
}): ReactNode;
|
|
22
|
+
export declare function SummaryCard({ summary }: {
|
|
23
|
+
readonly summary: DataTableSummaryRow;
|
|
24
|
+
}): ReactNode;
|
|
5
25
|
/** Footer row under the table body, one cell per visible column. */
|
|
6
26
|
export declare function TotalsFooterRow({ totals, columns, cellPin, leadingCells, actionsCell, cellClassName, }: {
|
|
7
27
|
readonly totals: DataTableTotals;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { uniqueLabelKeys } from "../../../app/unique-label-keys.js";
|
|
2
3
|
import { useOptionalTranslation } from "../../../index.js";
|
|
3
4
|
import { cn } from "../../lib/cn.js";
|
|
4
|
-
import { TableCell,
|
|
5
|
+
import { TableCell, TableRow } from "../../ui/table.js";
|
|
5
6
|
import { NUMERIC_COLUMN_TYPES } from "../data-table-cell.js";
|
|
6
7
|
import { stickyActionsCellClass } from "./actions-column.js";
|
|
8
|
+
import { HINT_TONE_TEXT_CLASS } from "./hint-cell.js";
|
|
7
9
|
import { MeasureValue, measureKindLabel, measureLabel } from "./measure-value.js";
|
|
8
10
|
import { EXPAND_COLUMN_KEY, SELECT_COLUMN_KEY } from "./use-column-pins.js";
|
|
9
11
|
function measuresOf(totals, field) {
|
|
@@ -26,17 +28,47 @@ function FooterMeasures({ measures, column, }) {
|
|
|
26
28
|
}
|
|
27
29
|
return (_jsx("span", { className: "inline-flex flex-col gap-0.5", children: measures.map((measure) => (_jsxs("span", { className: "inline-flex items-baseline justify-end gap-1.5", children: [_jsx("span", { className: "text-xs font-normal text-muted-foreground", children: measureKindLabel(measure.kind, translate) }), _jsx(MeasureValue, { measure: measure, column: column })] }, measure.kind))) }));
|
|
28
30
|
}
|
|
31
|
+
function SummaryItems({ summary }) {
|
|
32
|
+
const keys = uniqueLabelKeys(summary.items.map((item) => item.label ?? String(item.value)));
|
|
33
|
+
return (_jsx("span", { className: "text-sm text-muted-foreground", children: summary.items.map((item, index) => (_jsxs("span", { "data-testid": "list-summary-item", children: [index > 0 && " · ", item.label !== undefined && `${item.label} `, _jsx("span", { className: cn("font-medium tabular-nums text-foreground", item.tone !== undefined && HINT_TONE_TEXT_CLASS[item.tone]), children: item.value })] }, keys[index]))) }));
|
|
34
|
+
}
|
|
35
|
+
function SummaryCellValues({ items }) {
|
|
36
|
+
const keys = uniqueLabelKeys(items.map((item) => `${item.column ?? ""}-${item.label ?? ""}-${item.value}`));
|
|
37
|
+
return items.map((item, index) => (_jsx("span", { "data-testid": "list-summary-item", className: cn("me-2 font-medium tabular-nums text-foreground", item.tone !== undefined && HINT_TONE_TEXT_CLASS[item.tone]), children: item.value }, keys[index])));
|
|
38
|
+
}
|
|
39
|
+
/** Full-width row above the totals row, inside the same tfoot; the summary query's "label value · label value" pairs.
|
|
40
|
+
* When an item names a `column`, the row is drawn as table cells under their columns instead, without labels. */
|
|
41
|
+
export function SummaryFooterRow({ summary, colSpan, cellClassName, columns, cellPin, leadingCells, actionsCell, }) {
|
|
42
|
+
if (summary.items.some((item) => item.column !== undefined) && columns.length > 0) {
|
|
43
|
+
const fields = new Set(columns.map((column) => column.field));
|
|
44
|
+
const firstField = columns[0]?.field;
|
|
45
|
+
// An item naming a column that is not shown lands in the first column instead of vanishing.
|
|
46
|
+
const columnOf = (item) => item.column !== undefined && fields.has(item.column) ? item.column : firstField;
|
|
47
|
+
return (_jsxs(TableRow, { "data-testid": "list-summary", className: "hover:bg-transparent", children: [leadingCellKeys(leadingCells).map((key) => {
|
|
48
|
+
const pin = cellPin(key);
|
|
49
|
+
return _jsx(TableCell, { className: pin.className, style: pin.style }, key);
|
|
50
|
+
}), columns.map((column) => {
|
|
51
|
+
const pin = cellPin(column.field);
|
|
52
|
+
const items = summary.items.filter((item) => columnOf(item) === column.field);
|
|
53
|
+
return (_jsx(TableCell, { "data-testid": `list-summary-${column.field}`, className: cn(NUMERIC_COLUMN_TYPES.has(column.type) && "text-right", cellClassName, pin.className), style: pin.style, children: _jsx(SummaryCellValues, { items: items }) }, column.field));
|
|
54
|
+
}), actionsCell !== undefined && (_jsx(TableCell, { className: stickyActionsCellClass(actionsCell.fillsHeight, true) }))] }));
|
|
55
|
+
}
|
|
56
|
+
return (_jsx(TableRow, { "data-testid": "list-summary", className: "hover:bg-transparent", children: _jsx(TableCell, { colSpan: colSpan, className: cn("text-left", cellClassName), children: _jsx(SummaryItems, { summary: summary }) }) }));
|
|
57
|
+
}
|
|
58
|
+
export function SummaryCard({ summary }) {
|
|
59
|
+
return (_jsx("div", { "data-testid": "list-summary", className: "border-b border-border-row bg-muted/50 px-4 py-3 text-left", children: _jsx(SummaryItems, { summary: summary }) }));
|
|
60
|
+
}
|
|
29
61
|
/** Footer row under the table body, one cell per visible column. */
|
|
30
62
|
export function TotalsFooterRow({ totals, columns, cellPin, leadingCells, actionsCell, cellClassName, }) {
|
|
31
63
|
const translate = useOptionalTranslation();
|
|
32
|
-
return (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
64
|
+
return (_jsxs(TableRow, { "data-testid": "list-totals", className: "hover:bg-transparent", children: [leadingCellKeys(leadingCells).map((key) => {
|
|
65
|
+
const pin = cellPin(key);
|
|
66
|
+
return (_jsx(TableCell, { "data-testid": `list-totals-${key}`, className: pin.className, style: pin.style }, key));
|
|
67
|
+
}), columns.map((column, index) => {
|
|
68
|
+
const measures = measuresOf(totals, column.field);
|
|
69
|
+
const pin = cellPin(column.field);
|
|
70
|
+
return (_jsx(TableCell, { "data-testid": `list-totals-${column.field}`, className: cn("tabular-nums", NUMERIC_COLUMN_TYPES.has(column.type) && "text-right", cellClassName, pin.className), style: pin.style, children: measures.length > 0 ? (_jsx(FooterMeasures, { measures: measures, column: column })) : index === 0 ? (totalsLabel(translate)) : null }, column.field));
|
|
71
|
+
}), actionsCell !== undefined && (_jsx(TableCell, { className: stickyActionsCellClass(actionsCell.fillsHeight, true) }))] }));
|
|
40
72
|
}
|
|
41
73
|
/** Card layout: the totals as a labelled list under the cards. */
|
|
42
74
|
export function TotalsCard({ totals, columnOf, }) {
|
|
@@ -7,6 +7,7 @@ import { Checkbox } from "../../ui/checkbox.js";
|
|
|
7
7
|
import { TableCell, TableHead } from "../../ui/table.js";
|
|
8
8
|
import { cellTitle } from "../data-table-cell.js";
|
|
9
9
|
import { BulkSelectionBar } from "./bulk-selection-bar.js";
|
|
10
|
+
import { COLUMN_ROLE_ATTRIBUTE } from "./column-role.js";
|
|
10
11
|
import { EXPAND_TOGGLE_CELL_CLASS } from "./table-chrome.js";
|
|
11
12
|
import { useRowSelection } from "./use-row-selection.js";
|
|
12
13
|
const INACTIVE = {
|
|
@@ -55,7 +56,7 @@ export function useBulkSelection({ bulk, rows, titleField, rowTestId, flush, })
|
|
|
55
56
|
void execute(action);
|
|
56
57
|
}, onConfirm: (action) => void execute(action), onConfirmClose: () => setPendingAction(undefined), onCancel: run.cancel, onClear: selection.clear, onDismissResult: run.dismissResult })),
|
|
57
58
|
onKeyboardSelect: isRunning ? undefined : selection.toggle,
|
|
58
|
-
headerCell: (pin) => (_jsx(TableHead, { "data-testid": "column-select", className: cn(EXPAND_TOGGLE_CELL_CLASS, "text-center", pin.className), style: pin.style, children: _jsx(Checkbox, { checked: selection.allState === "all"
|
|
59
|
+
headerCell: (pin) => (_jsx(TableHead, { "data-testid": "column-select", [COLUMN_ROLE_ATTRIBUTE]: "select", className: cn(EXPAND_TOGGLE_CELL_CLASS, "text-center", pin.className), style: pin.style, children: _jsx(Checkbox, { checked: selection.allState === "all"
|
|
59
60
|
? true
|
|
60
61
|
: selection.allState === "some"
|
|
61
62
|
? "indeterminate"
|
|
@@ -48,6 +48,10 @@ function placePins(columns, pinOfField, measured, leading, hasActionsColumn) {
|
|
|
48
48
|
function pinnedStyle(placement, part, fillsHeight) {
|
|
49
49
|
const edgeLine = placement.side === "left" ? "inset -1px 0 0" : "inset 1px 0 0";
|
|
50
50
|
const shadows = [];
|
|
51
|
+
// Keeps the row-tone stripe: this inline box-shadow would replace the class-based one.
|
|
52
|
+
if (part === "body" && placement.side === "left") {
|
|
53
|
+
shadows.push("inset 3px 0 0 var(--row-stripe, transparent)");
|
|
54
|
+
}
|
|
51
55
|
if (placement.onInnerEdge)
|
|
52
56
|
shadows.push(`${edgeLine} var(--color-border)`);
|
|
53
57
|
if (part === "header" && fillsHeight)
|
|
@@ -18,6 +18,7 @@ export type DataTableModel = Omit<DataTableProps, "columns"> & {
|
|
|
18
18
|
readonly tableTranslate: ReturnType<typeof useOptionalTranslation>;
|
|
19
19
|
readonly tableLocale: ReturnType<typeof useOptionalLocale>;
|
|
20
20
|
readonly isNarrow: boolean;
|
|
21
|
+
readonly belowSm: boolean;
|
|
21
22
|
readonly density: ReturnType<typeof densityClasses>;
|
|
22
23
|
readonly facetsOpenNarrow: boolean;
|
|
23
24
|
readonly setFacetsOpenNarrow: Dispatch<SetStateAction<boolean>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useId, useState } from "react";
|
|
1
|
+
import { useId, useMemo, useState } from "react";
|
|
2
2
|
import { useIsEmbeddedScreen } from "../../../context/embedded-screen-context.js";
|
|
3
3
|
import { useOptionalLocale, useOptionalTranslation } from "../../../index.js";
|
|
4
|
-
import { useIsNarrowViewport } from "../use-narrow-viewport.js";
|
|
4
|
+
import { useIsBelowSmViewport, useIsNarrowViewport } from "../use-narrow-viewport.js";
|
|
5
5
|
import { isPinningActive, isResizingActive } from "./column-layout-mode.js";
|
|
6
6
|
import { densityClasses } from "./density.js";
|
|
7
7
|
import { buildDataTableItems } from "./group-band.js";
|
|
@@ -14,8 +14,9 @@ import { useViewColumns } from "./use-view-columns.js";
|
|
|
14
14
|
function resolveRowActions({ rowActions, onRowClick, rowActionMode, onCellChange, }) {
|
|
15
15
|
// The row click already runs rowClick actions, so with a clickable row they
|
|
16
16
|
// must not reappear in the kebab (a list whose only action is the rowClick
|
|
17
|
-
// one gets no actions column at all).
|
|
18
|
-
|
|
17
|
+
// one gets no actions column at all). "menu" mode is the exception: every row
|
|
18
|
+
// shows the kebab, and the opener is one of its entries.
|
|
19
|
+
const menuActions = rowActions !== undefined && onRowClick !== undefined && rowActionMode !== "menu"
|
|
19
20
|
? rowActions.filter((action) => action.rowClick !== true)
|
|
20
21
|
: rowActions;
|
|
21
22
|
// The table keeps every action in "inline" mode, and with editable cells the
|
|
@@ -36,7 +37,7 @@ function isEmptyTable({ rows, serverGroups }) {
|
|
|
36
37
|
return rows.length === 0 && (serverGroups?.groups.length ?? 0) === 0;
|
|
37
38
|
}
|
|
38
39
|
export function useDataTableState(props) {
|
|
39
|
-
const { columns:
|
|
40
|
+
const { columns: allColumns, rows, view, scrollBody, serverGroups, bulk, getRowTestId } = props;
|
|
40
41
|
// One locale/translate subscription per table — not per cell.
|
|
41
42
|
// Optional hooks: a bare DataTable outside LocaleProvider must not crash.
|
|
42
43
|
const tableTranslate = useOptionalTranslation();
|
|
@@ -45,6 +46,8 @@ export function useDataTableState(props) {
|
|
|
45
46
|
// affordance. Cards replace the table entirely below the breakpoint — same
|
|
46
47
|
// single-mount pattern as EmbeddedListInput/embedded-list-input.tsx.
|
|
47
48
|
const isNarrow = useIsNarrowViewport();
|
|
49
|
+
const belowSm = useIsBelowSmViewport();
|
|
50
|
+
const schemaColumns = useMemo(() => (isNarrow ? allColumns : allColumns.filter((col) => col.showOnNarrowOnly !== true)), [allColumns, isNarrow]);
|
|
48
51
|
const viewColumns = useViewColumns(schemaColumns, view, isNarrow);
|
|
49
52
|
const density = densityClasses(view, scrollBody === true);
|
|
50
53
|
const [facetsOpenNarrow, setFacetsOpenNarrow] = useState(false);
|
|
@@ -100,6 +103,7 @@ export function useDataTableState(props) {
|
|
|
100
103
|
tableTranslate,
|
|
101
104
|
tableLocale,
|
|
102
105
|
isNarrow,
|
|
106
|
+
belowSm,
|
|
103
107
|
density,
|
|
104
108
|
facetsOpenNarrow,
|
|
105
109
|
setFacetsOpenNarrow,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useLayoutEffect, useRef, useState } from "react";
|
|
2
2
|
import { ACTIONS_CONTENT_ATTRIBUTE } from "./actions-column.js";
|
|
3
|
+
import { COLUMN_ROLE_ATTRIBUTE } from "./column-role.js";
|
|
3
4
|
export const COLUMN_FIELD_ATTRIBUTE = "data-column-field";
|
|
4
5
|
export const EXPAND_COLUMN_WIDTH_PX = 40;
|
|
5
6
|
export const SELECT_COLUMN_WIDTH_PX = 40;
|
|
@@ -37,14 +38,14 @@ function measureHeaderRow(headerRow) {
|
|
|
37
38
|
let actions = 0;
|
|
38
39
|
for (const cell of headerRow.children) {
|
|
39
40
|
const field = cell.getAttribute(COLUMN_FIELD_ATTRIBUTE);
|
|
40
|
-
const
|
|
41
|
+
const role = cell.getAttribute(COLUMN_ROLE_ATTRIBUTE);
|
|
41
42
|
if (field !== null)
|
|
42
43
|
fields[field] = widthOfElement(cell);
|
|
43
|
-
else if (
|
|
44
|
+
else if (role === "select")
|
|
44
45
|
select = widthOfElement(cell);
|
|
45
|
-
else if (
|
|
46
|
+
else if (role === "expand")
|
|
46
47
|
expand = widthOfElement(cell);
|
|
47
|
-
else if (
|
|
48
|
+
else if (role === "actions")
|
|
48
49
|
actions = naturalActionsWidth(headerRow, cell);
|
|
49
50
|
}
|
|
50
51
|
return { fields, select, expand, actions };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MAX_BULK_SELECTION } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
|
-
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
2
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
const NOTHING_SELECTED = new Set();
|
|
4
4
|
function retained(previous, keep) {
|
|
5
5
|
const next = new Set([...previous].filter(keep));
|
|
@@ -8,37 +8,48 @@ function retained(previous, keep) {
|
|
|
8
8
|
/** Checkbox selection over the loaded rows, capped at MAX_BULK_SELECTION. Rows that leave the list leave the selection. */
|
|
9
9
|
export function useRowSelection(rows) {
|
|
10
10
|
const [selectedIds, setSelectedIds] = useState(NOTHING_SELECTED);
|
|
11
|
+
// Set by retainOnly: the reload that follows may pass through an empty list that must not drop the retained rows.
|
|
12
|
+
const awaitingReload = useRef(false);
|
|
13
|
+
const loadedIds = useMemo(() => new Set(rows.map((row) => row.id)), [rows]);
|
|
11
14
|
useEffect(() => {
|
|
12
|
-
// skip:
|
|
13
|
-
if (rows.length === 0)
|
|
15
|
+
// skip: the pending reload may pass through an empty list; keep the retained rows
|
|
16
|
+
if (rows.length === 0 && awaitingReload.current)
|
|
14
17
|
return;
|
|
15
|
-
|
|
16
|
-
setSelectedIds((previous) => retained(previous, (id) =>
|
|
17
|
-
}, [rows]);
|
|
18
|
+
awaitingReload.current = false;
|
|
19
|
+
setSelectedIds((previous) => retained(previous, (id) => loadedIds.has(id)));
|
|
20
|
+
}, [rows, loadedIds]);
|
|
18
21
|
const selectedRows = useMemo(() => rows.filter((row) => selectedIds.has(row.id)), [rows, selectedIds]);
|
|
19
22
|
const selectableCount = Math.min(rows.length, MAX_BULK_SELECTION);
|
|
20
23
|
const allState = selectedRows.length === 0 ? "none" : selectedRows.length >= selectableCount ? "all" : "some";
|
|
21
24
|
const toggle = useCallback((rowId) => {
|
|
25
|
+
awaitingReload.current = false;
|
|
22
26
|
setSelectedIds((previous) => {
|
|
23
27
|
const next = new Set(previous);
|
|
24
28
|
if (next.has(rowId))
|
|
25
29
|
next.delete(rowId);
|
|
26
|
-
else if (
|
|
30
|
+
else if (retained(previous, (id) => loadedIds.has(id)).size < MAX_BULK_SELECTION)
|
|
27
31
|
next.add(rowId);
|
|
28
32
|
return next;
|
|
29
33
|
});
|
|
30
|
-
}, []);
|
|
34
|
+
}, [loadedIds]);
|
|
31
35
|
const toggleAll = useCallback(() => {
|
|
36
|
+
awaitingReload.current = false;
|
|
32
37
|
setSelectedIds(allState === "all"
|
|
33
38
|
? NOTHING_SELECTED
|
|
34
39
|
: new Set(rows.slice(0, MAX_BULK_SELECTION).map((row) => row.id)));
|
|
35
40
|
}, [allState, rows]);
|
|
36
|
-
const retainOnly = useCallback((rowIds) =>
|
|
37
|
-
|
|
41
|
+
const retainOnly = useCallback((rowIds) => {
|
|
42
|
+
awaitingReload.current = rowIds.size > 0;
|
|
43
|
+
setSelectedIds((previous) => retained(previous, (id) => rowIds.has(id)));
|
|
44
|
+
}, []);
|
|
45
|
+
const clear = useCallback(() => {
|
|
46
|
+
awaitingReload.current = false;
|
|
47
|
+
setSelectedIds(NOTHING_SELECTED);
|
|
48
|
+
}, []);
|
|
38
49
|
return {
|
|
39
50
|
selectedRows,
|
|
40
51
|
isSelected: (rowId) => selectedIds.has(rowId),
|
|
41
|
-
isFull:
|
|
52
|
+
isFull: selectedRows.length >= MAX_BULK_SELECTION,
|
|
42
53
|
allState,
|
|
43
54
|
toggle,
|
|
44
55
|
toggleAll,
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { LIST_TABLE_DENSITIES } from "@cosmicdrift/kumiko-types/screen";
|
|
3
|
+
import { isOneOf } from "@cosmicdrift/kumiko-types/type-guards";
|
|
2
4
|
import { Columns3 } from "lucide-react";
|
|
3
5
|
import { Popover as PopoverPrimitive } from "radix-ui";
|
|
4
6
|
import { useOptionalTranslation } from "../../../index.js";
|
|
@@ -9,6 +11,9 @@ import { PinSection } from "./pin-section.js";
|
|
|
9
11
|
const POPOVER_CLASS = "z-50 flex w-72 max-w-[calc(100vw-2rem)] flex-col gap-3 rounded-md border bg-popover p-3 " +
|
|
10
12
|
"text-popover-foreground shadow-md max-h-[var(--radix-popover-content-available-height)] overflow-y-auto";
|
|
11
13
|
const SECTION_TITLE_CLASS = "m-0 text-xs font-medium text-muted-foreground";
|
|
14
|
+
function densityOf(value) {
|
|
15
|
+
return isOneOf(LIST_TABLE_DENSITIES, value) ? value : "comfortable";
|
|
16
|
+
}
|
|
12
17
|
/** The menu also opens for pinning or resizing alone: pins get a section, widths only the reset. */
|
|
13
18
|
export function viewHasMenu(view) {
|
|
14
19
|
if (view === undefined)
|
|
@@ -29,12 +34,13 @@ export function ViewMenu({ view, columnLabels, }) {
|
|
|
29
34
|
const pinnableFields = columns !== undefined
|
|
30
35
|
? columns.filter((column) => column.visible).map((column) => column.field)
|
|
31
36
|
: [...columnLabels.keys()];
|
|
32
|
-
return (_jsxs(PopoverPrimitive.Root, { children: [_jsx(PopoverPrimitive.Trigger, { asChild: true, children: _jsx(UiButton, { type: "button", variant: "outline", size: "icon", className: "size-9 max-md:size-11", "aria-label": label("kumiko.list.view.menu", "View"), "data-testid": "list-view-menu", children: _jsx(Columns3, { className: "size-4", "aria-hidden": "true" }) }) }), _jsx(PopoverPrimitive.Portal, { children: _jsxs(PopoverPrimitive.Content, { align: "end", sideOffset: 4, className: POPOVER_CLASS, "data-testid": "list-view-menu-content", children: [hasColumns && (_jsxs("section", { className: "flex flex-col gap-1", children: [_jsx("h3", { className: SECTION_TITLE_CLASS, children: label("kumiko.list.view.columns", "Columns") }), _jsx(ColumnPickerSection, { columns: columns, labels: columnLabels, onChange: onColumnsChange })] })), onDensityChange !== undefined && (_jsxs("section", { className: "flex flex-col gap-1", children: [_jsx("h3", { className: SECTION_TITLE_CLASS, children: label("kumiko.list.view.density", "Density") }), _jsx(SegmentedControl, { id: "list-view-density", name: "list-view-density", value: view.density, onChange: (next) => onDensityChange(next
|
|
37
|
+
return (_jsxs(PopoverPrimitive.Root, { children: [_jsx(PopoverPrimitive.Trigger, { asChild: true, children: _jsx(UiButton, { type: "button", variant: "outline", size: "icon", className: "size-9 max-md:size-11", "aria-label": label("kumiko.list.view.menu", "View"), "data-testid": "list-view-menu", children: _jsx(Columns3, { className: "size-4", "aria-hidden": "true" }) }) }), _jsx(PopoverPrimitive.Portal, { children: _jsxs(PopoverPrimitive.Content, { align: "end", sideOffset: 4, className: POPOVER_CLASS, "data-testid": "list-view-menu-content", children: [hasColumns && (_jsxs("section", { className: "flex flex-col gap-1", children: [_jsx("h3", { className: SECTION_TITLE_CLASS, children: label("kumiko.list.view.columns", "Columns") }), _jsx(ColumnPickerSection, { columns: columns, labels: columnLabels, onChange: onColumnsChange })] })), onDensityChange !== undefined && (_jsxs("section", { className: "flex flex-col gap-1", children: [_jsx("h3", { className: SECTION_TITLE_CLASS, children: label("kumiko.list.view.density", "Density") }), _jsx(SegmentedControl, { id: "list-view-density", name: "list-view-density", value: view.density, onChange: (next) => onDensityChange(densityOf(next)), options: [
|
|
33
38
|
{
|
|
34
39
|
value: "comfortable",
|
|
35
40
|
label: label("kumiko.list.view.density.comfortable", "Comfortable"),
|
|
36
41
|
},
|
|
37
42
|
{ value: "compact", label: label("kumiko.list.view.density.compact", "Compact") },
|
|
43
|
+
{ value: "relaxed", label: label("kumiko.list.view.density.relaxed", "Relaxed") },
|
|
38
44
|
], labelProps: { "aria-label": label("kumiko.list.view.density", "Density") } })] })), view.groupBy !== undefined && (_jsxs("section", { className: "flex flex-col gap-1", children: [_jsx("h3", { className: SECTION_TITLE_CLASS, children: label("kumiko.list.group.by", "Group by") }), _jsx(SegmentedControl, { id: "list-view-group-by", name: "list-view-group-by", value: view.groupBy.value, onChange: view.groupBy.onChange, options: [
|
|
39
45
|
{ value: "", label: label("kumiko.list.group.none", "None") },
|
|
40
46
|
...view.groupBy.fields.map((field) => ({
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { SelectOptionTone } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
2
|
import { type ReactNode } from "react";
|
|
3
|
-
import type { CellLink, CellLinkItem, ListColumnFileDisplay, ListRowViewModel, RuntimeCellLink, RuntimeCellLinkItems } from "../../headless/index.ts";
|
|
3
|
+
import type { CellLink, CellLinkItem, ListColumnCellDisplay, ListColumnFileDisplay, ListColumnHintViewModel, ListRowViewModel, RuntimeCellLink, RuntimeCellLinkItems } from "../../headless/index.ts";
|
|
4
4
|
import { type PrimitivesRegistry } from "../../index.ts";
|
|
5
|
+
import { type StatusBadgeTone } from "../widgets/status-badge.tsx";
|
|
5
6
|
import "../react-css-custom-properties.ts";
|
|
6
7
|
export declare function isEmptyCellValue(value: unknown): boolean;
|
|
7
8
|
export declare function isUnlabeledFalse(type: string, value: unknown, renderer: unknown): boolean;
|
|
@@ -40,7 +41,17 @@ type DataTableCellProps = {
|
|
|
40
41
|
readonly compactFile?: boolean;
|
|
41
42
|
readonly link?: CellLink;
|
|
42
43
|
readonly linkItems?: readonly CellLinkItem[];
|
|
44
|
+
readonly hint?: ListColumnHintViewModel;
|
|
45
|
+
readonly display?: ListColumnCellDisplay;
|
|
46
|
+
readonly badgeToneField?: string;
|
|
47
|
+
readonly badgeDot?: false;
|
|
48
|
+
readonly emptyPlaceholder?: false;
|
|
49
|
+
readonly onOpenRow?: () => void;
|
|
43
50
|
};
|
|
51
|
+
/** `display: "button"` draws a cell link as a small outline button. */
|
|
52
|
+
export declare const LINK_BUTTON_CLASS: string;
|
|
53
|
+
/** Badge tones by the list-wide ListBadgeTone words. */
|
|
54
|
+
export declare const LIST_BADGE_TONE: Readonly<Record<string, StatusBadgeTone>>;
|
|
44
55
|
export declare function cellLinkProp(col: {
|
|
45
56
|
readonly field: string;
|
|
46
57
|
readonly linkFor?: RuntimeCellLink | undefined;
|
|
@@ -50,7 +61,15 @@ export declare function cellLinkProp(col: {
|
|
|
50
61
|
readonly linkItems?: readonly CellLinkItem[];
|
|
51
62
|
};
|
|
52
63
|
export declare function rowToneClass(tone: SelectOptionTone | undefined): string;
|
|
64
|
+
/** Background class of the small tone dot that `rowToneMarker: "dot"` draws in front of a row. */
|
|
65
|
+
export declare function toneDotClass(tone: SelectOptionTone): string;
|
|
66
|
+
export declare function cardToneClass(tone: SelectOptionTone | undefined): string;
|
|
53
67
|
export declare const NUMERIC_COLUMN_TYPES: ReadonlySet<string>;
|
|
54
68
|
export declare const TABULAR_COLUMN_TYPES: ReadonlySet<string>;
|
|
55
|
-
export declare function
|
|
69
|
+
export declare function CellTextLink({ link, children, className, }: {
|
|
70
|
+
readonly link: CellLink;
|
|
71
|
+
readonly children: ReactNode;
|
|
72
|
+
readonly className?: string;
|
|
73
|
+
}): ReactNode;
|
|
74
|
+
export declare function DataTableCell({ value, row, field, type, renderer, optionLabels, optionTones, onChange, translate, locale, grouping, fileDisplay, compactFile, link, linkItems, hint, display, badgeToneField, badgeDot, emptyPlaceholder, onOpenRow, }: DataTableCellProps): ReactNode;
|
|
56
75
|
export {};
|