@cosmicdrift/kumiko-renderer 0.413.0 → 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/form-pending-uploads.d.ts +8 -0
- package/dist/components/form-pending-uploads.js +27 -0
- 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-form-actions.js +6 -3
- package/dist/components/render-edit-layout.js +2 -1
- package/dist/components/render-edit-render-model.d.ts +2 -2
- package/dist/components/render-edit-submit.js +2 -1
- 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 +5 -4
- 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 +4 -0
- package/dist/components/use-render-edit-state.js +9 -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 +8 -2
- package/dist/index.js +5 -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 +10 -6
- 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 +15 -11
- 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 +18 -4
- 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 +223 -0
- package/src/web/styles.css +9 -0
|
@@ -5,10 +5,17 @@ export type ListEmptyStateContent = {
|
|
|
5
5
|
readonly description?: string;
|
|
6
6
|
readonly action?: RenderEditAction;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type NamedFilterEmptyContent = {
|
|
9
|
+
readonly title: string;
|
|
10
|
+
readonly description?: string;
|
|
11
|
+
readonly onReset: () => void;
|
|
12
|
+
};
|
|
13
|
+
export declare function ListEmptyStateBody({ content, narrowed, namedFilterEmpty, defaultFilterActive, onShowAll, createButton, translate, }: {
|
|
9
14
|
readonly content: ListEmptyStateContent | undefined;
|
|
10
15
|
/** A search term or changed filter produced the empty result, so "create the first one" would mislead. */
|
|
11
16
|
readonly narrowed: boolean;
|
|
17
|
+
/** The active named filter has its own empty sentence; shown instead of the generic "no matches" text. */
|
|
18
|
+
readonly namedFilterEmpty?: NamedFilterEmptyContent | undefined;
|
|
12
19
|
/** A default filter is on and nothing else narrows: rows may exist outside it. */
|
|
13
20
|
readonly defaultFilterActive?: boolean;
|
|
14
21
|
readonly onShowAll?: () => void;
|
|
@@ -3,9 +3,12 @@ import { useState } from "react";
|
|
|
3
3
|
import { ErrorReference } from "../app/error-reference.js";
|
|
4
4
|
import { usePrimitives } from "../primitives.js";
|
|
5
5
|
import { RenderEditActionButton } from "./render-edit-action-button.js";
|
|
6
|
-
export function ListEmptyStateBody({ content, narrowed, defaultFilterActive = false, onShowAll, createButton, translate, }) {
|
|
6
|
+
export function ListEmptyStateBody({ content, narrowed, namedFilterEmpty, defaultFilterActive = false, onShowAll, createButton, translate, }) {
|
|
7
7
|
const { Text, Button, Dialog, Banner } = usePrimitives();
|
|
8
8
|
const [actionError, setActionError] = useState(null);
|
|
9
|
+
if (narrowed && namedFilterEmpty !== undefined) {
|
|
10
|
+
return (_jsxs(_Fragment, { children: [_jsx(Text, { children: namedFilterEmpty.title }), namedFilterEmpty.description !== undefined && (_jsx(Text, { variant: "small", children: namedFilterEmpty.description })), _jsx(Button, { variant: "secondary", onClick: namedFilterEmpty.onReset, testId: "render-list-empty-reset-filter", children: translate("kumiko.list.empty.resetFilter") })] }));
|
|
11
|
+
}
|
|
9
12
|
if (narrowed)
|
|
10
13
|
return _jsx(Text, { children: translate("kumiko.list.empty.filtered") });
|
|
11
14
|
if (defaultFilterActive) {
|
|
@@ -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,
|
|
@@ -2,6 +2,9 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { FOOTER_ACTION_ROLE_PROP, NARROW_LABEL_PROP, STICKY_PRIMARY_ACTION_PROP, } from "../primitives.js";
|
|
3
3
|
import { EditSlotMount } from "./edit-mounts.js";
|
|
4
4
|
import { isSubmitBlockedByLayoutCondition, resolveExtensionEntityId } from "./render-edit-logic.js";
|
|
5
|
+
function isSubmitHeldBack(state) {
|
|
6
|
+
return state.isSubmitting || state.pendingUploads > 0;
|
|
7
|
+
}
|
|
5
8
|
function renderWizardBackButton({ engine: { state, nav }, footer, }) {
|
|
6
9
|
const { Button } = state.primitives;
|
|
7
10
|
return (footer.showWizardBack && (_jsx(Button, { type: "button", variant: "secondary", icon: "chevron-left", onClick: nav.handleWizardBack, testId: "render-edit-wizard-back", [FOOTER_ACTION_ROLE_PROP]: "back", children: state.translate("kumiko.actions.back") })));
|
|
@@ -16,7 +19,7 @@ function renderSaveAndCloseButton({ engine: { props, state, steps, handleSubmit
|
|
|
16
19
|
return (state.isWizard &&
|
|
17
20
|
(!steps.isLastWizardStep || saveAndCloseOnCreate) &&
|
|
18
21
|
footer.showsSubmit &&
|
|
19
|
-
(!state.isCreateMode || saveAndCloseOnCreate) && (_jsx(Button, { type: "button", variant: "ghost", disabled: state
|
|
22
|
+
(!state.isCreateMode || saveAndCloseOnCreate) && (_jsx(Button, { type: "button", variant: "ghost", disabled: isSubmitHeldBack(state) || props.disabled, onClick: () => void handleSubmit({ saveNow: true }), testId: "render-edit-wizard-save-close", [STICKY_PRIMARY_ACTION_PROP]: true, children: state.translate("kumiko.wizard.save-and-close") })));
|
|
20
23
|
}
|
|
21
24
|
function renderWizardNextButton({ engine: { state }, footer, }) {
|
|
22
25
|
const { Button } = state.primitives;
|
|
@@ -29,7 +32,7 @@ function renderWizardNextButton({ engine: { state }, footer, }) {
|
|
|
29
32
|
function renderFooterActionButtons({ engine: { props, state, form, handleSubmit }, footer, }) {
|
|
30
33
|
const { Button } = state.primitives;
|
|
31
34
|
return (footer.showSubmit &&
|
|
32
|
-
props.footerActions?.map((action) => (_jsx(Button, { type: "button", variant: action.variant ?? "secondary", ...(action.icon !== undefined && { icon: action.icon }), disabled: state
|
|
35
|
+
props.footerActions?.map((action) => (_jsx(Button, { type: "button", variant: action.variant ?? "secondary", ...(action.icon !== undefined && { icon: action.icon }), disabled: isSubmitHeldBack(state) || props.disabled, onClick: () => {
|
|
33
36
|
form.controller.setValues(action.patch); // @cast-boundary form-values
|
|
34
37
|
void handleSubmit();
|
|
35
38
|
}, testId: `render-edit-footer-action-${action.id}`, children: state.translate(action.label) }, action.id))));
|
|
@@ -49,7 +52,7 @@ function isSubmitDisabled({ engine: { props, state, form }, footer, }) {
|
|
|
49
52
|
!state.insideDrawer &&
|
|
50
53
|
props.submitWithoutChanges !== true;
|
|
51
54
|
return (isPristine ||
|
|
52
|
-
state
|
|
55
|
+
isSubmitHeldBack(state) ||
|
|
53
56
|
props.disabled ||
|
|
54
57
|
props.submitBlocked ||
|
|
55
58
|
isSubmitBlockedByLayoutCondition(props.screen.layout, form.snapshot.values));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { ExtensionFormRegistryProvider } from "../app/extension-form-submit.js";
|
|
3
|
+
import { FormUploadTrackerProvider } from "./form-pending-uploads.js";
|
|
3
4
|
import { renderActionErrorBanner, renderAllRequiredHint, renderDeleteDialog, renderDraftPicker, renderExtensionErrorBanner, renderFormErrorBanner, renderRootIssueBanners, renderTabStrip, renderWizardProgress, } from "./render-edit-banners.js";
|
|
4
5
|
import { renderFormActions } from "./render-edit-form-actions.js";
|
|
5
6
|
import { buildHeaderActions } from "./render-edit-header-actions.js";
|
|
@@ -71,5 +72,5 @@ export function renderEditLayout(model) {
|
|
|
71
72
|
const { props, state, sections, handleSubmit } = model.engine;
|
|
72
73
|
const header = buildHeaderActions(model);
|
|
73
74
|
const { Form } = state.primitives;
|
|
74
|
-
return (
|
|
75
|
+
return (_jsx(ExtensionFormRegistryProvider, { value: state.extensionFormRegistry, children: _jsxs(FormUploadTrackerProvider, { value: state.trackUpload, children: [state.menuActionConfirmDialog, renderPageHeader(model, header), _jsx(Form, { onSubmit: () => void handleSubmit(), ...(state.focusFirstErrorKey > 0 && { focusFirstErrorKey: state.focusFirstErrorKey }), ...buildFormHeadingProps(model), ...buildFormActionProps(model, header), testId: "render-edit-form", stickyActions: state.isWizard || props.fillScreenHeight === true, ...buildFormChromeProps(model, header), children: _jsxs(AllFieldsRequiredProvider, { value: sections.showsAllRequiredHint || props.screen.layout.hideRequiredMarker === true, children: [props.leadContent, sections.showsAllRequiredHint && !state.insideDrawer && renderAllRequiredHint(model), renderDraftPicker(model), renderWizardProgress(model), state.isTabs && state.isStepped && renderTabStrip(model), renderEditSections(model), renderFormErrorBanner(model), renderRootIssueBanners(model), renderExtensionErrorBanner(model), renderActionErrorBanner(model), renderDeleteDialog(model)] }) })] }) }));
|
|
75
76
|
}
|
|
@@ -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 {};
|
|
@@ -77,7 +77,8 @@ export function createHandleSubmit(engine) {
|
|
|
77
77
|
return (props.disabled === true ||
|
|
78
78
|
props.submitBlocked === true ||
|
|
79
79
|
isSubmitBlockedByLayoutCondition(props.screen.layout, controller.getSnapshot().values) ||
|
|
80
|
-
isSubmittingRef.current
|
|
80
|
+
isSubmittingRef.current ||
|
|
81
|
+
state.pendingUploadsRef.current > 0);
|
|
81
82
|
}
|
|
82
83
|
// Awaits only where the original did: a validation-blocked customSubmit
|
|
83
84
|
// must settle in the same tick so setIsSubmitting(true/false) batch.
|
|
@@ -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 }) }));
|