@cosmicdrift/kumiko-renderer 0.413.1 → 0.414.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 +30 -50
- package/dist/app/form-schema.d.ts +1 -0
- package/dist/app/form-schema.js +24 -0
- 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 +17 -3
- package/dist/app/named-filter-facet.js +88 -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 +101 -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 +75 -18
- 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 +19 -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 +25 -0
- package/dist/app/use-entity-list-payload.js +57 -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 +4 -4
- package/dist/app/use-projection-detail-actions.js +30 -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 +11 -0
- package/dist/app/use-row-decoration.js +55 -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/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 +8 -1
- package/dist/components/list-empty-state.js +4 -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 +8 -0
- package/dist/components/render-list-hint-columns.js +77 -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 +3 -0
- 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 +2 -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 +1 -0
- package/dist/headless/pwa-service-worker-meta.js +3 -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 +33 -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 +37 -2
- 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 +2 -0
- package/dist/primitives-record-guidance.d.ts +53 -0
- package/dist/primitives-record-guidance.js +1 -0
- package/dist/primitives.d.ts +41 -31
- 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 +149 -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 +6 -23
- package/dist/web/app/dashboard-panels.js +53 -123
- package/dist/web/app/dashboard-reference-list-table.d.ts +5 -1
- package/dist/web/app/dashboard-reference-list-table.js +12 -4
- package/dist/web/app/dashboard-shared.d.ts +23 -7
- package/dist/web/app/dashboard-shared.js +44 -17
- package/dist/web/app/dashboard-stat-group-panel.d.ts +13 -0
- package/dist/web/app/dashboard-stat-group-panel.js +67 -0
- package/dist/web/app/dashboard-text-panel.d.ts +12 -0
- package/dist/web/app/dashboard-text-panel.js +163 -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/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/index.d.ts +7 -1
- package/dist/web/index.js +5 -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 +5 -0
- package/dist/web/layout/nav-collapse-state.js +66 -0
- package/dist/web/layout/nav-tree.js +25 -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 +6 -5
- package/dist/web/layout/shell-focus.js +12 -9
- package/dist/web/layout/shell-header.js +38 -10
- 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.js +6 -4
- 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 +14 -6
- package/dist/web/primitives/calendar-day-picker.js +24 -5
- package/dist/web/primitives/card.js +1 -1
- package/dist/web/primitives/code-input.js +6 -1
- package/dist/web/primitives/data-table/actions-column.d.ts +1 -0
- package/dist/web/primitives/data-table/actions-column.js +4 -2
- package/dist/web/primitives/data-table/card-body.d.ts +5 -0
- package/dist/web/primitives/data-table/card-body.js +47 -5
- 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 +40 -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 +16 -0
- package/dist/web/primitives/data-table/hint-cell.js +74 -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/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 +10 -5
- 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 +17 -3
- package/dist/web/primitives/data-table/toolbar-end-cluster.js +1 -1
- package/dist/web/primitives/data-table/toolbar.js +31 -3
- package/dist/web/primitives/data-table/totals-footer.d.ts +20 -0
- package/dist/web/primitives/data-table/totals-footer.js +40 -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 +96 -19
- 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 +4 -2
- package/dist/web/primitives/facet-filter.js +26 -3
- package/dist/web/primitives/facet-search-filter.js +1 -1
- 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 +19 -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 +2 -2
- package/dist/web/primitives/metric.js +8 -6
- package/dist/web/primitives/page-header.d.ts +1 -1
- package/dist/web/primitives/page-header.js +8 -1
- package/dist/web/primitives/pager.js +29 -18
- 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 +45 -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 +5 -7
- package/dist/web/pwa/pwa-support.d.ts +4 -0
- package/dist/web/pwa/pwa-support.js +113 -0
- package/dist/web/sse/live-events.js +2 -2
- package/dist/web/tokens.js +0 -3
- 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 +54 -0
- package/dist/web/widgets/dashboard-list.d.ts +37 -5
- package/dist/web/widgets/dashboard-list.js +95 -20
- package/dist/web/widgets/drawer-sizing.js +1 -1
- 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/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/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 +10 -1
- package/dist/web/widgets/stat.js +14 -5
- 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/upload-zone.d.ts +8 -1
- package/dist/web/widgets/upload-zone.js +13 -3
- package/package.json +5 -5
- package/src/changes.json +217 -0
- package/src/web/styles.css +9 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import type { ListGroupPagesProps } from "../hooks/use-list-aggregates.ts";
|
|
3
|
-
export declare function ListGroupPageBridges({ queryType, requests, onResult, refreshNonce, }: ListGroupPagesProps): ReactNode;
|
|
3
|
+
export declare function ListGroupPageBridges({ queryType, requests, onResult, refreshNonce, resetKey, }: ListGroupPagesProps): ReactNode;
|
|
@@ -26,6 +26,6 @@ function GroupPageBridge({ pageKey, queryType, payload, onResult, refreshNonce,
|
|
|
26
26
|
}, [refreshNonce, refetch]);
|
|
27
27
|
return null;
|
|
28
28
|
}
|
|
29
|
-
export function ListGroupPageBridges({ queryType, requests, onResult, refreshNonce, }) {
|
|
30
|
-
return (_jsx(_Fragment, { children: requests.map((request) => (_jsx(GroupPageBridge, { pageKey: request.pageKey, queryType: queryType, payload: request.payload, onResult: onResult, refreshNonce: refreshNonce }, request.pageKey))) }));
|
|
29
|
+
export function ListGroupPageBridges({ queryType, requests, onResult, refreshNonce, resetKey, }) {
|
|
30
|
+
return (_jsx(_Fragment, { children: requests.map((request) => (_jsx(GroupPageBridge, { pageKey: request.pageKey, queryType: queryType, payload: request.payload, onResult: onResult, refreshNonce: refreshNonce }, `${resetKey}|${request.pageKey}`))) }));
|
|
31
31
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { evalFieldCondition, normalizeListColumn, parseRefTarget, } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
|
+
import { evalFieldCondition, normalizeListColumn, parseRefTarget, pickEmptyStateText, } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
3
3
|
import { useCallback, useMemo, useState } from "react";
|
|
4
4
|
import { useAppFeatures } from "../app/app-features-context.js";
|
|
5
5
|
import { useClientActionRuntime } from "../app/client-actions.js";
|
|
@@ -7,7 +7,7 @@ import { ErrorReference } from "../app/error-reference.js";
|
|
|
7
7
|
import { useListBulk } from "../app/list-bulk-actions.js";
|
|
8
8
|
import { buildFilterFacets, buildFilterPayload, mergeReferenceFacetOptions, resolveProjectionFacetSpecs, } from "../app/list-facets.js";
|
|
9
9
|
import { useNav } from "../app/nav.js";
|
|
10
|
-
import {
|
|
10
|
+
import { valueTypeField } from "../app/projection-list-shim.js";
|
|
11
11
|
import { ReferenceFacetBridges, withReferenceFacetState, } from "../app/reference-facet-bridge.js";
|
|
12
12
|
import { navigateWithReturnTo, useReturnHost } from "../app/return-to.js";
|
|
13
13
|
import { buildDefaultEditRowAction, buildProjectionRowActions, buildProjectionToolbarActions, buildRecordActions, findRowClickAction, runDrawerRowAction, runProjectionRowNavigate, } from "../app/row-actions.js";
|
|
@@ -67,20 +67,6 @@ function synthesizeRelatedListEntity(columns, sourceEntity) {
|
|
|
67
67
|
...(sourceEntity?.derivedFields !== undefined && { derivedFields: sourceEntity.derivedFields }),
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
-
function valueTypeField(valueType, sortable) {
|
|
71
|
-
switch (valueType) {
|
|
72
|
-
case "number":
|
|
73
|
-
// decimal renders through the same number formatter; digits come from the column spec, not scale
|
|
74
|
-
case "decimal":
|
|
75
|
-
return { type: "number", sortable };
|
|
76
|
-
case "bigInt":
|
|
77
|
-
return { type: "bigInt", sortable };
|
|
78
|
-
case "money":
|
|
79
|
-
return { type: "money", sortable };
|
|
80
|
-
case undefined:
|
|
81
|
-
return { type: "text", allowPlaintext: SYNTHESIZED_FIELD_PII_REASON, sortable };
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
70
|
// Mirrors row-actions.ts's own warnDrawerActionDropped (module-private
|
|
85
71
|
// there, so not reusable directly) — a drawer-kind emptyState.action with no
|
|
86
72
|
// onOpenDrawer wired is dropped (not rendered) with a dev warning, same as a
|
|
@@ -93,11 +79,6 @@ function buildRowTone(rule) {
|
|
|
93
79
|
return undefined;
|
|
94
80
|
return (row) => (evalFieldCondition(rule, { ...row.values }) ? rule.tone : undefined);
|
|
95
81
|
}
|
|
96
|
-
function pickEmptyStateText(emptyState, record) {
|
|
97
|
-
if (emptyState === undefined)
|
|
98
|
-
return undefined;
|
|
99
|
-
return (emptyState.variants?.find((variant) => evalFieldCondition(variant.when, record)) ?? emptyState);
|
|
100
|
-
}
|
|
101
82
|
export function RelatedListSection({ section, parentId, record, featureName, translate, hideTitle, grow, onOpenDrawer, actions, anchorId, embedded, onAfterWrite, refreshToken, }) {
|
|
102
83
|
const { Banner, Section, Card, FillContainer, Text, Button, Dialog } = usePrimitives();
|
|
103
84
|
const [emptyStateActionError, setEmptyStateActionError] = useState(null);
|
|
@@ -139,7 +120,8 @@ export function RelatedListSection({ section, parentId, record, featureName, tra
|
|
|
139
120
|
}), [section.columns, listEntityName]);
|
|
140
121
|
// Local state, not URL state: a section `id` is optional, so there is no
|
|
141
122
|
// stable URL key to namespace against — the section's sort is local for the
|
|
142
|
-
// same reason.
|
|
123
|
+
// same reason. With `table.rememberState` the state is seeded from and written back to
|
|
124
|
+
// the list-state store instead, so it survives a reload.
|
|
143
125
|
const { search, filters, sort, setSearch, setFilters, setSort, listTable, groupField } = useRelatedListState(section, nav.route?.screenId);
|
|
144
126
|
const facetSpecs = useMemo(() => resolveProjectionFacetSpecs(section.facets, effectiveTranslate, featureName), [section.facets, effectiveTranslate, featureName]);
|
|
145
127
|
const [referenceFacetOptions, setReferenceFacetOptions] = useState({});
|
|
@@ -10,13 +10,15 @@ export declare function RenderEditActionConfirmDialog({ action, open, onOpenChan
|
|
|
10
10
|
readonly onConfirm: () => void | Promise<void>;
|
|
11
11
|
readonly Dialog: ReturnType<typeof usePrimitives>["Dialog"];
|
|
12
12
|
}): ReactNode;
|
|
13
|
-
export declare function RenderEditActionButton({ action, iconOnly, hideIcon, Button, Dialog, onError, }: {
|
|
13
|
+
export declare function RenderEditActionButton({ action, iconOnly, hideIcon, size, Button, Dialog, onError, }: {
|
|
14
14
|
readonly action: RenderEditAction;
|
|
15
15
|
/** Group-level collapse (see `shouldRenderActionsIconOnly`) — only takes
|
|
16
16
|
* effect when this action actually resolved an icon. */
|
|
17
17
|
readonly iconOnly?: boolean;
|
|
18
18
|
/** Record-header actions are text-only; the icon still shows when collapsed to icon-only. */
|
|
19
19
|
readonly hideIcon?: boolean;
|
|
20
|
+
/** Compact buttons for dense rows; an icon-only collapse keeps its own size. */
|
|
21
|
+
readonly size?: "sm";
|
|
20
22
|
readonly Button: ReturnType<typeof usePrimitives>["Button"];
|
|
21
23
|
readonly Dialog: ReturnType<typeof usePrimitives>["Dialog"];
|
|
22
24
|
readonly onError: (notice: ErrorNotice | null) => void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import { errorNoticeOf } from "../app/error-reference.js";
|
|
4
|
+
import { COMPACT_TAP_CLASSES } from "../compact-tap-classes.js";
|
|
4
5
|
// Same rule as RowActionWriteHandler: "danger" forces a confirm even
|
|
5
6
|
// without an explicit confirm key — unless `confirmRequired` overrides it
|
|
6
7
|
// (schema-driven navigate/drawer actions, where the target form is itself
|
|
@@ -15,7 +16,7 @@ export function RenderEditActionConfirmDialog({ action, open, onOpenChange, onCo
|
|
|
15
16
|
// render-list.tsx's ToolbarActionView (each RenderEditAction is
|
|
16
17
|
// independently bound by the caller, there is no shared trigger pipeline
|
|
17
18
|
// to hook into like the built-in onDelete/onSubmit paths have).
|
|
18
|
-
export function RenderEditActionButton({ action, iconOnly = false, hideIcon = false, Button, Dialog, onError, }) {
|
|
19
|
+
export function RenderEditActionButton({ action, iconOnly = false, hideIcon = false, size, Button, Dialog, onError, }) {
|
|
19
20
|
const [busy, setBusy] = useState(false);
|
|
20
21
|
const [confirmOpen, setConfirmOpen] = useState(false);
|
|
21
22
|
const trigger = async () => {
|
|
@@ -31,9 +32,10 @@ export function RenderEditActionButton({ action, iconOnly = false, hideIcon = fa
|
|
|
31
32
|
setBusy(false);
|
|
32
33
|
}
|
|
33
34
|
};
|
|
34
|
-
|
|
35
|
+
// `display: "link"` wins over a plain style; only a danger style keeps its look.
|
|
36
|
+
const variant = action.display === "link" && action.style !== "danger" ? "link" : (action.style ?? "secondary");
|
|
35
37
|
const showIconOnly = iconOnly && action.icon !== undefined;
|
|
36
|
-
return (_jsxs(_Fragment, { children: [_jsx(Button, { type: "button", variant: variant, loading: busy, ...(action.icon !== undefined && (!hideIcon || showIconOnly) && { icon: action.icon }), ...(showIconOnly && {
|
|
38
|
+
return (_jsxs(_Fragment, { children: [_jsx(Button, { type: "button", variant: variant, loading: busy, ...(action.icon !== undefined && (!hideIcon || showIconOnly) && { icon: action.icon }), ...(!showIconOnly && size !== undefined && { size, className: COMPACT_TAP_CLASSES }), ...(showIconOnly && {
|
|
37
39
|
size: "icon",
|
|
38
40
|
ariaLabel: action.label,
|
|
39
41
|
title: action.label,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import type { EditSectionViewModel,
|
|
2
|
+
import type { EditSectionViewModel, FormValues } from "../headless/index.ts";
|
|
3
3
|
import type { FooterFlags, LayoutFlags } from "./render-edit-layout-flags.ts";
|
|
4
4
|
import type { TitleModel } from "./render-edit-titles.ts";
|
|
5
5
|
import type { RenderEditProps } from "./render-edit-types.ts";
|
|
@@ -43,7 +43,6 @@ export type RenderEditEngine<TValues extends FormValues, TCtx = unknown> = Rende
|
|
|
43
43
|
readonly saveNow?: boolean;
|
|
44
44
|
}) => Promise<void>;
|
|
45
45
|
};
|
|
46
|
-
export type { EditSectionViewModel, EditViewModel };
|
|
47
46
|
export type RenderEditModel<TValues extends FormValues, TCtx = unknown> = {
|
|
48
47
|
readonly engine: RenderEditEngine<TValues, TCtx>;
|
|
49
48
|
readonly layout: LayoutFlags;
|
|
@@ -61,3 +60,4 @@ export type SectionRenderContext<TValues extends FormValues, TCtx = unknown> = {
|
|
|
61
60
|
export type FieldsSection = Extract<EditSectionViewModel, {
|
|
62
61
|
readonly kind: "fields";
|
|
63
62
|
}>;
|
|
63
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActionFormFooterAction, EntityDefinition, EntityEditScreenDefinition, FormDerivationScreen, IconKey, RowAction, RowActionDrawer } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
1
|
+
import type { ActionFormFooterAction, EntityDefinition, EntityEditScreenDefinition, FormDerivationScreen, IconKey, RowAction, RowActionDisplay, RowActionDrawer } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
import type * as z from "zod";
|
|
4
4
|
import type { DispatcherError, FormSnapshot, FormValues, SubmitResult, Translate } from "../headless/index.ts";
|
|
@@ -131,7 +131,7 @@ export type RenderEditProps<TValues extends FormValues, TCtx = unknown> = {
|
|
|
131
131
|
* `controller.validate()` call) that ignores issues on hidden fields and
|
|
132
132
|
* outside the `fields` scope, like submit() does, so it does not paint field errors into
|
|
133
133
|
* the UI and can diverge from the currently rendered `snapshot.errors` —
|
|
134
|
-
*
|
|
134
|
+
* covers the required fields of the screen plus `schema`. A caller that patches a fresh object
|
|
135
135
|
* reference on every call must not do so unconditionally: `setValues` is
|
|
136
136
|
* a no-op when the merged value is reference-equal to the current one,
|
|
137
137
|
* so only a converging patch settles instead of looping. Without this
|
|
@@ -244,6 +244,8 @@ export type RenderEditAction = {
|
|
|
244
244
|
readonly label: string;
|
|
245
245
|
readonly onPress: () => void | Promise<void>;
|
|
246
246
|
readonly style?: "primary" | "secondary" | "danger";
|
|
247
|
+
/** `"link"` draws the action as a text link; `style: "danger"` keeps its colour. */
|
|
248
|
+
readonly display?: RowActionDisplay;
|
|
247
249
|
readonly confirm?: string;
|
|
248
250
|
readonly confirmLabel?: string;
|
|
249
251
|
/** Overrides the default "danger implies a confirm dialog" rule. Schema-driven
|
|
@@ -8,6 +8,7 @@ import { createWizardNavigation } from "./render-edit-wizard-navigation.js";
|
|
|
8
8
|
import { useRenderEditControlledSync } from "./use-render-edit-controlled-sync.js";
|
|
9
9
|
import { useRenderEditDraftSave } from "./use-render-edit-draft-save.js";
|
|
10
10
|
import { useRenderEditForm } from "./use-render-edit-form.js";
|
|
11
|
+
import { useEffectiveFormSchema } from "./use-render-edit-schema.js";
|
|
11
12
|
import { useRenderEditSections } from "./use-render-edit-sections.js";
|
|
12
13
|
import { useRenderEditState } from "./use-render-edit-state.js";
|
|
13
14
|
import { useRenderEditSteps } from "./use-render-edit-steps.js";
|
|
@@ -17,7 +18,8 @@ function footerSlotName(screen) {
|
|
|
17
18
|
return footerSlot !== undefined ? extensionSectionName(footerSlot) : undefined;
|
|
18
19
|
}
|
|
19
20
|
export function RenderEdit(rawProps) {
|
|
20
|
-
const
|
|
21
|
+
const effectiveSchema = useEffectiveFormSchema(rawProps);
|
|
22
|
+
const props = { ...resolveRenderEditProps(rawProps), schema: effectiveSchema };
|
|
21
23
|
const state = useRenderEditState({
|
|
22
24
|
screen: props.screen,
|
|
23
25
|
entityId: props.entityId,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { EntityListScreenDefinition, ListColumnHint } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
|
+
import type { ListColumnHintViewModel, ListColumnViewModel, Translate } from "../headless/index.ts";
|
|
3
|
+
/** The hint's tone falls back to the list's `rowToneField`. */
|
|
4
|
+
export declare function hintViewModel(hint: ListColumnHint, rowToneField: string | undefined, translate: Translate): ListColumnHintViewModel;
|
|
5
|
+
export declare function withDisplayColumns(columns: readonly ListColumnViewModel[], screen: EntityListScreenDefinition): readonly ListColumnViewModel[];
|
|
6
|
+
export declare function withEmptyPlaceholderColumns(columns: readonly ListColumnViewModel[], screen: EntityListScreenDefinition): readonly ListColumnViewModel[];
|
|
7
|
+
export declare function withNarrowOnlyColumns(columns: readonly ListColumnViewModel[], screen: EntityListScreenDefinition): readonly ListColumnViewModel[];
|
|
8
|
+
export declare function withHintColumns(columns: readonly ListColumnViewModel[], screen: EntityListScreenDefinition, translate: Translate): readonly ListColumnViewModel[];
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { normalizeListColumn } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
|
+
const HINT_EMPTY_LABEL_KEY = "kumiko.list.hint.empty";
|
|
3
|
+
const HINT_REASON_LABEL_KEY = "kumiko.list.hint.reason";
|
|
4
|
+
/** The hint's tone falls back to the list's `rowToneField`. */
|
|
5
|
+
export function hintViewModel(hint, rowToneField, translate) {
|
|
6
|
+
const toneField = hint.toneField ?? rowToneField;
|
|
7
|
+
return {
|
|
8
|
+
emptyLabel: translate(hint.emptyLabel ?? HINT_EMPTY_LABEL_KEY),
|
|
9
|
+
reasonLabel: translate(HINT_REASON_LABEL_KEY),
|
|
10
|
+
...(hint.reasonField !== undefined && { reasonField: hint.reasonField }),
|
|
11
|
+
...(hint.reasonOpenField !== undefined && { reasonOpenField: hint.reasonOpenField }),
|
|
12
|
+
...(hint.reasonTitleField !== undefined && { reasonTitleField: hint.reasonTitleField }),
|
|
13
|
+
...(hint.detailField !== undefined && { detailField: hint.detailField }),
|
|
14
|
+
...(hint.narrowDetailField !== undefined && { narrowDetailField: hint.narrowDetailField }),
|
|
15
|
+
...(hint.plainSentence === true && { plainSentence: true }),
|
|
16
|
+
...(toneField !== undefined && { toneField }),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
// Only "badge" is drawn by list tables; "button" is boot-rejected there (a row button is a rowAction) and "bar"/"datetime" are dashboard-only.
|
|
20
|
+
export function withDisplayColumns(columns, screen) {
|
|
21
|
+
const specs = new Map(screen.columns.map((spec) => [normalizeListColumn(spec).field, normalizeListColumn(spec)]));
|
|
22
|
+
return columns.map((col) => {
|
|
23
|
+
const spec = specs.get(col.field);
|
|
24
|
+
if (spec?.display !== "badge")
|
|
25
|
+
return col;
|
|
26
|
+
return {
|
|
27
|
+
...col,
|
|
28
|
+
display: spec.display,
|
|
29
|
+
...(spec.badgeToneField !== undefined && { badgeToneField: spec.badgeToneField }),
|
|
30
|
+
...(spec.badgeDot !== undefined && { badgeDot: spec.badgeDot }),
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
export function withEmptyPlaceholderColumns(columns, screen) {
|
|
35
|
+
const blank = new Set(screen.columns.flatMap((spec) => {
|
|
36
|
+
const column = normalizeListColumn(spec);
|
|
37
|
+
return column.emptyPlaceholder === false ? [column.field] : [];
|
|
38
|
+
}));
|
|
39
|
+
if (blank.size === 0)
|
|
40
|
+
return columns;
|
|
41
|
+
return columns.map((col) => (blank.has(col.field) ? { ...col, emptyPlaceholder: false } : col));
|
|
42
|
+
}
|
|
43
|
+
export function withNarrowOnlyColumns(columns, screen) {
|
|
44
|
+
const narrowOnly = new Set(screen.columns.flatMap((spec) => {
|
|
45
|
+
const column = normalizeListColumn(spec);
|
|
46
|
+
return column.showOnNarrowOnly === true ? [column.field] : [];
|
|
47
|
+
}));
|
|
48
|
+
if (narrowOnly.size === 0)
|
|
49
|
+
return columns;
|
|
50
|
+
return columns.map((col) => narrowOnly.has(col.field) ? { ...col, showOnNarrowOnly: true } : col);
|
|
51
|
+
}
|
|
52
|
+
// The hint cell owns its rendering: DataTableCell ignores the column's renderer and links once a hint is set.
|
|
53
|
+
export function withHintColumns(columns, screen, translate) {
|
|
54
|
+
const hints = new Map();
|
|
55
|
+
const normalized = new Map();
|
|
56
|
+
for (const spec of screen.columns) {
|
|
57
|
+
const column = normalizeListColumn(spec);
|
|
58
|
+
if (column.hint === undefined)
|
|
59
|
+
continue;
|
|
60
|
+
hints.set(column.field, column.hint);
|
|
61
|
+
normalized.set(column.field, column);
|
|
62
|
+
}
|
|
63
|
+
if (hints.size === 0)
|
|
64
|
+
return columns;
|
|
65
|
+
return columns.map((col) => {
|
|
66
|
+
const hint = hints.get(col.field);
|
|
67
|
+
if (hint === undefined)
|
|
68
|
+
return col;
|
|
69
|
+
const { width, minWidth } = normalized.get(col.field) ?? {};
|
|
70
|
+
return {
|
|
71
|
+
...col,
|
|
72
|
+
hint: hintViewModel(hint, screen.rowToneField, translate),
|
|
73
|
+
...(width !== undefined && { width }),
|
|
74
|
+
...(minWidth !== undefined && { minWidth }),
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
}
|
|
@@ -119,6 +119,8 @@ function buildLinkItemsFor(lookup) {
|
|
|
119
119
|
}
|
|
120
120
|
function buildReferenceRenderer(lookup) {
|
|
121
121
|
const { col, map, labelField, unresolvedLabel } = lookup;
|
|
122
|
+
// A function renderer bypasses DataTableCell's empty path, so `emptyPlaceholder: false` is honoured here.
|
|
123
|
+
const empty = col.emptyPlaceholder === false ? "" : EMPTY_VALUE_PLACEHOLDER;
|
|
122
124
|
return (value, row) => {
|
|
123
125
|
// Server eager loading: when the server includes _refs, read the display
|
|
124
126
|
// value directly from the resolved row. This avoids a round trip
|
|
@@ -135,11 +137,11 @@ function buildReferenceRenderer(lookup) {
|
|
|
135
137
|
// Renderer-side fallback when server eager loading is not active.
|
|
136
138
|
if (Array.isArray(value)) {
|
|
137
139
|
if (value.length === 0)
|
|
138
|
-
return
|
|
140
|
+
return empty;
|
|
139
141
|
return value.map((v) => map?.get(String(v)) ?? unresolvedLabel(String(v))).join(", ");
|
|
140
142
|
}
|
|
141
143
|
if (value === null || value === undefined || value === "")
|
|
142
|
-
return
|
|
144
|
+
return empty;
|
|
143
145
|
const idStr = String(value);
|
|
144
146
|
return map?.get(idStr) ?? unresolvedLabel(idStr);
|
|
145
147
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { isSelectOptionTone } from "../status-tone.js";
|
|
2
|
+
/** Tints a row by the tone its `field` holds; other values leave the row untoned. */
|
|
3
|
+
export function rowToneFromField(field) {
|
|
4
|
+
if (field === undefined)
|
|
5
|
+
return undefined;
|
|
6
|
+
return (row) => {
|
|
7
|
+
const tone = row.values[field];
|
|
8
|
+
return isSelectOptionTone(tone) ? tone : undefined;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ListNarrowFacets } from "@cosmicdrift/kumiko-types/screen";
|
|
1
2
|
import type { ReactNode } from "react";
|
|
2
3
|
import type { RenderListProps } from "./render-list-types.ts";
|
|
3
4
|
type Pick2<K extends keyof RenderListProps> = Pick<RenderListProps, K>;
|
|
@@ -14,9 +15,16 @@ export declare function tableChromeProps(p: Pick2<"onRowClick" | "description">
|
|
|
14
15
|
toolbarEnd?: string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined;
|
|
15
16
|
itemNoun?: ((count: number) => string) | undefined;
|
|
16
17
|
};
|
|
17
|
-
export declare function tableSortPagingProps(p: Pick2<"sort" | "onSortChange" | "pager" | "onReachEnd" | "loadingMore" | "hasMore">
|
|
18
|
+
export declare function tableSortPagingProps(p: Pick2<"sort" | "onSortChange" | "sortOptions" | "toolbarSort" | "pager" | "onReachEnd" | "loadingMore" | "hasMore"> & {
|
|
19
|
+
readonly narrowFacets?: ListNarrowFacets;
|
|
20
|
+
}): {
|
|
21
|
+
narrowFacets?: "pills" | undefined;
|
|
18
22
|
sort?: import("../primitives.tsx").DataTableSort | null | undefined;
|
|
19
23
|
onSortChange?: ((next: import("../index.ts").ListSort | null) => void) | undefined;
|
|
24
|
+
sortOptions?: readonly (import("../primitives.tsx").DataTableSort & {
|
|
25
|
+
readonly label: string;
|
|
26
|
+
})[] | undefined;
|
|
27
|
+
toolbarSort?: true | undefined;
|
|
20
28
|
pager?: {
|
|
21
29
|
readonly page: number;
|
|
22
30
|
readonly limit: number;
|
|
@@ -10,10 +10,13 @@ export function tableChromeProps(p) {
|
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
12
|
export function tableSortPagingProps(p) {
|
|
13
|
-
const { sort, onSortChange, pager, onReachEnd, loadingMore, hasMore } = p;
|
|
13
|
+
const { sort, onSortChange, sortOptions, toolbarSort, pager, onReachEnd, loadingMore, hasMore } = p;
|
|
14
14
|
return {
|
|
15
|
+
...(p.narrowFacets !== undefined && { narrowFacets: p.narrowFacets }),
|
|
15
16
|
...(sort !== undefined && { sort }),
|
|
16
17
|
...(onSortChange !== undefined && { onSortChange }),
|
|
18
|
+
...(sortOptions !== undefined && { sortOptions }),
|
|
19
|
+
...(toolbarSort === true && { toolbarSort }),
|
|
17
20
|
...(pager !== undefined && { pager }),
|
|
18
21
|
...(onReachEnd !== undefined && { onReachEnd }),
|
|
19
22
|
...(loadingMore !== undefined && { loadingMore }),
|
|
@@ -12,8 +12,7 @@ export type ToolbarActionButton = {
|
|
|
12
12
|
* destructive, but the target form is the confirmation. */
|
|
13
13
|
readonly confirmRequired?: boolean;
|
|
14
14
|
readonly onTrigger: () => Promise<void> | void;
|
|
15
|
-
/**
|
|
16
|
-
* ToolbarAction has no author-declared icon field, unlike RowAction. */
|
|
15
|
+
/** The action's declared icon, else the id-derived default (ACTION_ICON_BY_ID). */
|
|
17
16
|
readonly icon?: IconKey;
|
|
18
17
|
};
|
|
19
18
|
export declare function ToolbarActionView({ action, iconOnly, Button, Dialog, Banner, }: {
|
|
@@ -8,13 +8,16 @@ type ToolbarModelInput = {
|
|
|
8
8
|
readonly pageHeaderSlotAvailable: boolean;
|
|
9
9
|
readonly pageHeaderCompact: boolean;
|
|
10
10
|
readonly createInPageHeader: boolean;
|
|
11
|
+
readonly toolbarActionsPlacement: "header" | "toolbar" | undefined;
|
|
11
12
|
};
|
|
13
|
+
export declare function withPlusIconFallback(action: ToolbarActionButton, actions: readonly ToolbarActionButton[]): ToolbarActionButton;
|
|
12
14
|
export type ToolbarActionSplit = {
|
|
13
15
|
readonly toolbarIconOnly: boolean;
|
|
14
16
|
readonly promotedToolbarActions: readonly ToolbarActionButton[];
|
|
15
17
|
readonly promotedInOverflowMenu: boolean;
|
|
16
18
|
readonly toolbarActionsInToolbar: readonly ToolbarActionButton[];
|
|
17
19
|
readonly hasToolbarActionsInToolbar: boolean;
|
|
20
|
+
readonly actionsInToolbar: boolean;
|
|
18
21
|
};
|
|
19
22
|
export declare function splitToolbarActions(input: ToolbarModelInput): ToolbarActionSplit;
|
|
20
23
|
type MenuItemInput = {
|
|
@@ -5,19 +5,32 @@ import { needsActionConfirm } from "./render-edit-action-button.js";
|
|
|
5
5
|
function isHeaderPromotableToolbarAction(action) {
|
|
6
6
|
return action.style === "primary" && !needsActionConfirm(action);
|
|
7
7
|
}
|
|
8
|
+
// Several icon-less primary actions would all show the same fallback "plus" icon, so it
|
|
9
|
+
// only applies to a sole one (same reasoning as the header's overflow menu below).
|
|
10
|
+
export function withPlusIconFallback(action, actions) {
|
|
11
|
+
const isIconlessPrimary = (a) => a.style === "primary" && a.icon === undefined;
|
|
12
|
+
return isIconlessPrimary(action) && actions.filter(isIconlessPrimary).length === 1
|
|
13
|
+
? { ...action, icon: "plus" }
|
|
14
|
+
: action;
|
|
15
|
+
}
|
|
8
16
|
export function splitToolbarActions(input) {
|
|
9
|
-
const { toolbarActions, pageHeaderAvailable, pageHeaderSlotAvailable, pageHeaderCompact, createInPageHeader, } = input;
|
|
17
|
+
const { toolbarActions, pageHeaderAvailable, pageHeaderSlotAvailable, pageHeaderCompact, createInPageHeader, toolbarActionsPlacement, } = input;
|
|
18
|
+
// From md up; below it the compact header keeps the actions.
|
|
19
|
+
const actionsInToolbar = toolbarActionsPlacement === "toolbar" && !pageHeaderCompact;
|
|
10
20
|
const hasToolbarActions = toolbarActions !== undefined && toolbarActions.length > 0;
|
|
11
21
|
const toolbarIconOnly = hasToolbarActions && shouldRenderActionsIconOnly(toolbarActions);
|
|
12
22
|
// Every primary toolbar action takes the page-header slot, left of the create
|
|
13
23
|
// button (which stays the rightmost primary action): labelled on desktop, so
|
|
14
24
|
// projection lists look like entity lists. On phones an icon button, or, next to
|
|
15
|
-
// the create button, an entry in the header's overflow
|
|
16
|
-
// room for
|
|
17
|
-
const promotedToolbarActions = pageHeaderAvailable && pageHeaderSlotAvailable
|
|
25
|
+
// the create button or beside another promoted action, an entry in the header's overflow
|
|
26
|
+
// menu: the header has no room for labelled actions.
|
|
27
|
+
const promotedToolbarActions = pageHeaderAvailable && pageHeaderSlotAvailable && !actionsInToolbar
|
|
18
28
|
? (toolbarActions?.filter(isHeaderPromotableToolbarAction) ?? [])
|
|
19
29
|
: [];
|
|
20
|
-
|
|
30
|
+
// Several icon-less actions would otherwise all show the same fallback "plus" icon.
|
|
31
|
+
const promotedInOverflowMenu = pageHeaderCompact &&
|
|
32
|
+
promotedToolbarActions.length > 0 &&
|
|
33
|
+
(createInPageHeader || promotedToolbarActions.length > 1);
|
|
21
34
|
const toolbarActionsInToolbar = toolbarActions?.filter((a) => !promotedToolbarActions.includes(a)) ?? [];
|
|
22
35
|
const hasToolbarActionsInToolbar = toolbarActionsInToolbar.length > 0;
|
|
23
36
|
return {
|
|
@@ -26,6 +39,7 @@ export function splitToolbarActions(input) {
|
|
|
26
39
|
promotedInOverflowMenu,
|
|
27
40
|
toolbarActionsInToolbar,
|
|
28
41
|
hasToolbarActionsInToolbar,
|
|
42
|
+
actionsInToolbar,
|
|
29
43
|
};
|
|
30
44
|
}
|
|
31
45
|
export function buildPromotedMenuItems(input) {
|
|
@@ -65,7 +79,8 @@ export function resolveToolbarLabels(input) {
|
|
|
65
79
|
return { effectiveCreateLabel, effectiveSearchPlaceholder };
|
|
66
80
|
}
|
|
67
81
|
export function resolveItemNoun(input) {
|
|
68
|
-
const { screen, translate,
|
|
82
|
+
const { screen, translate, featureName } = input;
|
|
83
|
+
const itemNounKey = input.itemNounKey ?? screen.itemNounKey;
|
|
69
84
|
const nounKey = itemNounKey ?? `${featureName}:entity:${screen.entity}:noun`;
|
|
70
85
|
return (itemNounKey !== undefined || !screen.entity.startsWith("__")) &&
|
|
71
86
|
translate(nounKey, { count: 2 }) !== nounKey
|
|
@@ -2,8 +2,8 @@ import type { EntityListScreenDefinition } from "@cosmicdrift/kumiko-framework/u
|
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
import type { Translate } from "../headless/index.ts";
|
|
4
4
|
import type { ActionMenuItemSpec, usePrimitives } from "../primitives.tsx";
|
|
5
|
-
import { type ListEmptyStateContent } from "./list-empty-state.tsx";
|
|
6
|
-
import type
|
|
5
|
+
import { type ListEmptyStateContent, type NamedFilterEmptyContent } from "./list-empty-state.tsx";
|
|
6
|
+
import { type ToolbarActionSplit } from "./render-list-toolbar-model.ts";
|
|
7
7
|
type Primitives = ReturnType<typeof usePrimitives>;
|
|
8
8
|
export type ListToolbarModel = {
|
|
9
9
|
readonly screen: EntityListScreenDefinition;
|
|
@@ -26,6 +26,7 @@ type EmptyStateModel = {
|
|
|
26
26
|
readonly onCreate: (() => void) | undefined;
|
|
27
27
|
readonly emptyContent: ListEmptyStateContent | undefined;
|
|
28
28
|
readonly narrowed: boolean;
|
|
29
|
+
readonly namedFilterEmpty: NamedFilterEmptyContent | undefined;
|
|
29
30
|
readonly defaultFilterActive: boolean;
|
|
30
31
|
readonly onFilterReset: (() => void) | undefined;
|
|
31
32
|
readonly translate: Translate;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ListEmptyStateBody } from "./list-empty-state.js";
|
|
2
|
+
import { ListEmptyStateBody, } from "./list-empty-state.js";
|
|
3
3
|
import { ListHeaderSlotMount } from "./render-list-header-slot.js";
|
|
4
4
|
import { ToolbarActionView } from "./render-list-toolbar-action.js";
|
|
5
|
+
import { withPlusIconFallback } from "./render-list-toolbar-model.js";
|
|
5
6
|
export function renderCreateButton(model) {
|
|
6
7
|
const { Button, onCreate, createInPageHeader, pageHeaderCompact, effectiveCreateLabel } = model;
|
|
7
8
|
return onCreate !== undefined && createInPageHeader && pageHeaderCompact ? (_jsx(Button, { variant: "primary", icon: "plus", size: "icon", ariaLabel: effectiveCreateLabel, title: effectiveCreateLabel, onClick: onCreate, testId: "render-list-create" })) : onCreate !== undefined ? (_jsx(Button, { variant: "primary", icon: "plus", onClick: onCreate, testId: "render-list-create", className: "px-3.5", children: effectiveCreateLabel })) : undefined;
|
|
@@ -13,12 +14,13 @@ export function renderHeaderActions(model, createButton) {
|
|
|
13
14
|
}
|
|
14
15
|
export function renderToolbarEnd(model, createButton) {
|
|
15
16
|
const { screen, Button, Dialog, Banner, onCreate, createInPageHeader, split } = model;
|
|
16
|
-
const { toolbarActionsInToolbar, hasToolbarActionsInToolbar, toolbarIconOnly } = split;
|
|
17
|
+
const { toolbarActionsInToolbar, hasToolbarActionsInToolbar, toolbarIconOnly, actionsInToolbar } = split;
|
|
17
18
|
const hasHeaderSlot = screen.slots?.header !== undefined;
|
|
19
|
+
const createButtonFirst = actionsInToolbar && !createInPageHeader;
|
|
18
20
|
return hasHeaderSlot ||
|
|
19
21
|
hasToolbarActionsInToolbar ||
|
|
20
|
-
(onCreate !== undefined && !createInPageHeader) ? (_jsxs(_Fragment, { children: [hasHeaderSlot && _jsx(ListHeaderSlotMount, { screen: screen }), hasToolbarActionsInToolbar &&
|
|
21
|
-
toolbarActionsInToolbar.map((a) => (_jsx(ToolbarActionView, { action: a, iconOnly: toolbarIconOnly, Button: Button, Dialog: Dialog, Banner: Banner }, a.id))), !createInPageHeader && createButton] })) : undefined;
|
|
22
|
+
(onCreate !== undefined && !createInPageHeader) ? (_jsxs(_Fragment, { children: [hasHeaderSlot && _jsx(ListHeaderSlotMount, { screen: screen }), createButtonFirst && createButton, hasToolbarActionsInToolbar &&
|
|
23
|
+
toolbarActionsInToolbar.map((a) => (_jsx(ToolbarActionView, { action: actionsInToolbar ? withPlusIconFallback(a, toolbarActionsInToolbar) : a, iconOnly: toolbarIconOnly, Button: Button, Dialog: Dialog, Banner: Banner }, a.id))), !createButtonFirst && !createInPageHeader && createButton] })) : undefined;
|
|
22
24
|
}
|
|
23
25
|
export function renderSearchInput(Input, localQ, setLocalQ, placeholder) {
|
|
24
26
|
return (_jsx(Input, { kind: "text", id: "render-list-search", name: "search", value: localQ, onChange: setLocalQ, placeholder: placeholder }));
|
|
@@ -28,9 +30,9 @@ export function renderSearchInput(Input, localQ, setLocalQ, placeholder) {
|
|
|
28
30
|
// Without onCreate or an override, DataTable uses its default
|
|
29
31
|
// (`kumiko.list.no-entries`).
|
|
30
32
|
export function composeEmptyState(model) {
|
|
31
|
-
const { Button, emptyState, onCreate, emptyContent, narrowed, defaultFilterActive, onFilterReset, translate, createInPageHeader, effectiveCreateLabel, } = model;
|
|
33
|
+
const { Button, emptyState, onCreate, emptyContent, narrowed, namedFilterEmpty, defaultFilterActive, onFilterReset, translate, createInPageHeader, effectiveCreateLabel, } = model;
|
|
32
34
|
return (emptyState ??
|
|
33
|
-
(onCreate !== undefined || emptyContent !== undefined || narrowed || defaultFilterActive ? (_jsx(ListEmptyStateBody, { content: emptyContent, narrowed: narrowed, defaultFilterActive: defaultFilterActive, ...(onFilterReset !== undefined && { onShowAll: onFilterReset }), translate: translate, createButton: onCreate !== undefined && !narrowed && !defaultFilterActive && !createInPageHeader ? (_jsx(Button, { variant: "primary", icon: "plus", onClick: onCreate, testId: "render-list-empty-create", children: effectiveCreateLabel })) : undefined })) : undefined));
|
|
35
|
+
(onCreate !== undefined || emptyContent !== undefined || narrowed || defaultFilterActive ? (_jsx(ListEmptyStateBody, { content: emptyContent, narrowed: narrowed, namedFilterEmpty: namedFilterEmpty, defaultFilterActive: defaultFilterActive, ...(onFilterReset !== undefined && { onShowAll: onFilterReset }), translate: translate, createButton: onCreate !== undefined && !narrowed && !defaultFilterActive && !createInPageHeader ? (_jsx(Button, { variant: "primary", icon: "plus", onClick: onCreate, testId: "render-list-empty-create", children: effectiveCreateLabel })) : undefined })) : undefined));
|
|
34
36
|
}
|
|
35
37
|
export function renderPageHeader(PageHeader, headerActions, promotedInOverflowMenu, promotedMenuItems) {
|
|
36
38
|
return (_jsx(PageHeader, { actions: headerActions, ...(promotedInOverflowMenu && { overflowItems: promotedMenuItems }) }));
|
|
@@ -3,7 +3,7 @@ import type { ReactNode } from "react";
|
|
|
3
3
|
import type { ListRowViewModel, Translate } from "../headless/index.ts";
|
|
4
4
|
import type { ListSort } from "../hooks/use-list-url-state.ts";
|
|
5
5
|
import type { DataTableDateRangeFacet, DataTableFacet, DataTableProps, DataTableRowAction, DataTableRowActionMode, DataTableTableBlockProps } from "../primitives.tsx";
|
|
6
|
-
import type { ListEmptyStateContent } from "./list-empty-state.tsx";
|
|
6
|
+
import type { ListEmptyStateContent, NamedFilterEmptyContent } from "./list-empty-state.tsx";
|
|
7
7
|
import type { ToolbarActionButton } from "./render-list-toolbar-action.tsx";
|
|
8
8
|
export type RenderListProps = {
|
|
9
9
|
readonly screen: EntityListScreenDefinition;
|
|
@@ -34,6 +34,8 @@ export type RenderListProps = {
|
|
|
34
34
|
readonly emptyContent?: ListEmptyStateContent;
|
|
35
35
|
/** Search or filters changed the result; the empty box then says "no matches". */
|
|
36
36
|
readonly narrowed?: boolean;
|
|
37
|
+
/** Empty sentence of the active named filter (already translated) with its reset; shown instead of "no matches" when no search term is set. */
|
|
38
|
+
readonly namedFilterEmpty?: NamedFilterEmptyContent;
|
|
37
39
|
/** Nothing was narrowed by the user, but a default filter is still on; the empty box then offers "show all" instead of "create the first one". */
|
|
38
40
|
readonly defaultFilterActive?: boolean;
|
|
39
41
|
/** Plural-forms key for the footer count noun; default is the entity's `:noun` convention key. */
|
|
@@ -49,6 +51,9 @@ export type RenderListProps = {
|
|
|
49
51
|
readonly sort?: ListSort | null;
|
|
50
52
|
/** Called with the next sort state after a header click. */
|
|
51
53
|
readonly onSortChange?: (next: ListSort | null) => void;
|
|
54
|
+
/** Labelled sort choices (labels already translated) for the "Sorted by" select. */
|
|
55
|
+
readonly sortOptions?: DataTableProps["sortOptions"];
|
|
56
|
+
readonly toolbarSort?: DataTableProps["toolbarSort"];
|
|
52
57
|
/** Pager props for pagination="pages". If undefined, no pager UI is
|
|
53
58
|
* rendered; the default or infinite mode is used. KumikoScreen supplies
|
|
54
59
|
* this according to screen.pagination. */
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
2
|
+
import { useMemo, useState } from "react";
|
|
3
3
|
import { useTranslation } from "../i18n.js";
|
|
4
4
|
import { usePageHeaderCompact, usePageHeaderSlotAvailable } from "../page-header-slot.js";
|
|
5
5
|
import { usePrimitives } from "../primitives.js";
|
|
6
6
|
import { renderReferenceLookupBridges } from "./render-list-reference-bridge.js";
|
|
7
|
+
import { rowToneFromField } from "./render-list-row-tone.js";
|
|
7
8
|
import { tableChromeProps, tableFilterProps, tableLayoutProps, tableRowProps, tableSortPagingProps, } from "./render-list-table-props.js";
|
|
8
9
|
import { composeEmptyState, renderCreateButton, renderHeaderActions, renderMenuActionError, renderPageHeader, renderSearchInput, renderToolbarEnd, } from "./render-list-toolbar.js";
|
|
9
10
|
import { buildPromotedMenuItems, resolveItemNoun, resolveToolbarLabels, resolveToolbarTitle, splitToolbarActions, } from "./render-list-toolbar-model.js";
|
|
10
11
|
import { useRenderListColumns } from "./use-render-list-columns.js";
|
|
11
12
|
import { useRenderListSearch } from "./use-render-list-search.js";
|
|
12
13
|
export function RenderList(props) {
|
|
13
|
-
const { screen, entity, rows, featureName, translate: translateProp, onRowClick, emptyState, onCreate, createLabel, searchable = false, searchPlaceholder, description, emptyContent, narrowed = false, defaultFilterActive: defaultFilterActiveProp = false, itemNounKey, searchValue, onSearchChange, sort, onSortChange, pager, onReachEnd, loadingMore, hasMore, rowActions, rowActionMode, bulk, rowTone, toolbarActions, filterFacets, filterValues, onFilterChange, onFilterReset, dateRangeFacets, onDateRangeChange, chromeless, scrollBody, screenPadding, expandedRowIds, onToggleRowExpanded, renderExpandedRow, ...tableBlockProps } = props;
|
|
14
|
+
const { screen, entity, rows, featureName, translate: translateProp, onRowClick, emptyState, onCreate, createLabel, searchable = false, searchPlaceholder, description, emptyContent, narrowed = false, namedFilterEmpty, defaultFilterActive: defaultFilterActiveProp = false, itemNounKey, searchValue, onSearchChange, sort, onSortChange, sortOptions, toolbarSort, pager, onReachEnd, loadingMore, hasMore, rowActions, rowActionMode, bulk, rowTone, toolbarActions, filterFacets, filterValues, onFilterChange, onFilterReset, dateRangeFacets, onDateRangeChange, chromeless, scrollBody, screenPadding, expandedRowIds, onToggleRowExpanded, renderExpandedRow, ...tableBlockProps } = props;
|
|
14
15
|
// As in RenderEdit, fall back to the i18next context for translation;
|
|
15
16
|
// otherwise column headers would display raw i18n keys.
|
|
16
17
|
const t = useTranslation();
|
|
@@ -18,11 +19,15 @@ export function RenderList(props) {
|
|
|
18
19
|
const { DataTable, Button, Dialog, Input, Banner, PageHeader } = usePrimitives();
|
|
19
20
|
const pageHeaderSlotAvailable = usePageHeaderSlotAvailable();
|
|
20
21
|
const pageHeaderCompact = usePageHeaderCompact();
|
|
21
|
-
const
|
|
22
|
+
const pageHeaderOffersCreate = onCreate !== undefined && PageHeader !== undefined && pageHeaderSlotAvailable;
|
|
23
|
+
// Compact means below md (not sm): components stay platform-agnostic, so the toolbar button
|
|
24
|
+
// starts at md, and between sm and md the compact header keeps its "+".
|
|
25
|
+
const createInPageHeader = pageHeaderOffersCreate && (screen.createPlacement !== "toolbar" || pageHeaderCompact);
|
|
22
26
|
// Promoted actions that moved into the phone header's overflow menu have no button of
|
|
23
27
|
// their own, so their busy and error state lives here.
|
|
24
28
|
const [menuActionBusyId, setMenuActionBusyId] = useState(null);
|
|
25
29
|
const [menuActionError, setMenuActionError] = useState(null);
|
|
30
|
+
const effectiveRowTone = useMemo(() => rowTone ?? rowToneFromField(screen.rowToneField), [rowTone, screen.rowToneField]);
|
|
26
31
|
const { localQ, setLocalQ } = useRenderListSearch(searchValue, onSearchChange);
|
|
27
32
|
const { referenceRequests, handleLookupMap, enrichedVm } = useRenderListColumns({
|
|
28
33
|
screen,
|
|
@@ -56,6 +61,7 @@ export function RenderList(props) {
|
|
|
56
61
|
pageHeaderSlotAvailable,
|
|
57
62
|
pageHeaderCompact,
|
|
58
63
|
createInPageHeader,
|
|
64
|
+
toolbarActionsPlacement: screen.toolbarActionsPlacement,
|
|
59
65
|
});
|
|
60
66
|
const toolbarModel = {
|
|
61
67
|
screen,
|
|
@@ -84,23 +90,36 @@ export function RenderList(props) {
|
|
|
84
90
|
onCreate,
|
|
85
91
|
emptyContent,
|
|
86
92
|
narrowed,
|
|
93
|
+
namedFilterEmpty,
|
|
87
94
|
defaultFilterActive: defaultFilterActiveProp && onFilterReset !== undefined,
|
|
88
95
|
onFilterReset,
|
|
89
96
|
translate,
|
|
90
|
-
createInPageHeader,
|
|
97
|
+
createInPageHeader: pageHeaderOffersCreate,
|
|
91
98
|
effectiveCreateLabel,
|
|
92
99
|
});
|
|
93
100
|
const toolbarTitle = resolveToolbarTitle(screen, translate);
|
|
94
|
-
return (_jsxs(_Fragment, { children: [headerActions !== undefined &&
|
|
101
|
+
return (_jsxs(_Fragment, { children: [(headerActions !== undefined || split.promotedInOverflowMenu) &&
|
|
95
102
|
PageHeader !== undefined &&
|
|
96
|
-
renderPageHeader(PageHeader, headerActions, split.promotedInOverflowMenu, promotedMenuItems),
|
|
103
|
+
renderPageHeader(PageHeader, headerActions, split.promotedInOverflowMenu, promotedMenuItems), split.promotedInOverflowMenu &&
|
|
104
|
+
menuActionError !== null &&
|
|
105
|
+
renderMenuActionError(Banner, menuActionError), renderReferenceLookupBridges(referenceRequests, handleLookupMap), _jsx(DataTable, { columns: enrichedVm.columns, rows: enrichedVm.rows, toolbarTitle: toolbarTitle, ...tableChromeProps({
|
|
97
106
|
onRowClick,
|
|
98
107
|
composedEmptyState,
|
|
99
108
|
toolbarStart,
|
|
100
109
|
description,
|
|
101
110
|
toolbarEnd,
|
|
102
111
|
itemNoun,
|
|
103
|
-
}), ...tableSortPagingProps({
|
|
112
|
+
}), ...tableSortPagingProps({
|
|
113
|
+
narrowFacets: screen.narrowFacets,
|
|
114
|
+
sort,
|
|
115
|
+
onSortChange,
|
|
116
|
+
sortOptions,
|
|
117
|
+
toolbarSort: toolbarSort ?? screen.toolbarSort,
|
|
118
|
+
pager,
|
|
119
|
+
onReachEnd,
|
|
120
|
+
loadingMore,
|
|
121
|
+
hasMore,
|
|
122
|
+
}), ...tableRowProps({ rowActions, rowActionMode, bulk, rowTone: effectiveRowTone }), ...tableFilterProps({
|
|
104
123
|
filterFacets,
|
|
105
124
|
filterValues,
|
|
106
125
|
onFilterChange,
|