@cosmicdrift/kumiko-renderer 0.413.1 → 0.415.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/action-form-support.js +4 -0
- package/dist/app/content-previews.d.ts +39 -0
- package/dist/app/content-previews.js +28 -0
- package/dist/app/entity-edit-screen.js +2 -5
- package/dist/app/entity-list-screen.js +42 -59
- package/dist/app/form-schema.d.ts +1 -0
- package/dist/app/form-schema.js +24 -0
- package/dist/app/list-facets.d.ts +1 -0
- package/dist/app/list-facets.js +10 -1
- package/dist/app/list-sort-options.d.ts +4 -0
- package/dist/app/list-sort-options.js +11 -0
- package/dist/app/named-filter-facet.d.ts +16 -3
- package/dist/app/named-filter-facet.js +97 -5
- package/dist/app/projection-detail-body.d.ts +2 -4
- package/dist/app/projection-detail-body.js +7 -1
- package/dist/app/projection-detail-guidance-data.d.ts +7 -0
- package/dist/app/projection-detail-guidance-data.js +103 -0
- package/dist/app/projection-detail-guidance.d.ts +13 -0
- package/dist/app/projection-detail-guidance.js +197 -0
- package/dist/app/projection-detail-header-model.d.ts +1 -3
- package/dist/app/projection-detail-header-model.js +4 -8
- package/dist/app/projection-detail-header-region.d.ts +2 -1
- package/dist/app/projection-detail-header-region.js +63 -23
- package/dist/app/projection-detail-header.d.ts +6 -1
- package/dist/app/projection-detail-header.js +76 -18
- package/dist/app/projection-detail-navigation.d.ts +2 -0
- package/dist/app/projection-detail-navigation.js +13 -3
- package/dist/app/projection-detail-states.d.ts +3 -3
- package/dist/app/projection-list-body.js +4 -2
- package/dist/app/projection-list-render.js +3 -1
- package/dist/app/projection-list-shim.d.ts +4 -1
- package/dist/app/projection-list-shim.js +35 -8
- package/dist/app/reference-link.d.ts +3 -2
- package/dist/app/reference-link.js +19 -4
- package/dist/app/row-actions.js +3 -3
- package/dist/app/screen-access.d.ts +4 -0
- package/dist/app/screen-access.js +18 -0
- package/dist/app/screen-shared.js +3 -1
- package/dist/app/unique-label-keys.d.ts +1 -0
- package/dist/app/unique-label-keys.js +9 -0
- package/dist/app/use-entity-list-payload.d.ts +26 -0
- package/dist/app/use-entity-list-payload.js +59 -0
- package/dist/app/use-entity-range-facets.js +2 -3
- package/dist/app/use-facet-counts.d.ts +5 -0
- package/dist/app/use-facet-counts.js +7 -0
- package/dist/app/use-list-summary-row.d.ts +10 -0
- package/dist/app/use-list-summary-row.js +33 -0
- package/dist/app/use-named-filter-queue.d.ts +20 -0
- package/dist/app/use-named-filter-queue.js +9 -0
- package/dist/app/use-projection-detail-actions.d.ts +5 -4
- package/dist/app/use-projection-detail-actions.js +42 -1
- package/dist/app/use-projection-list-data.d.ts +5 -0
- package/dist/app/use-projection-list-data.js +35 -6
- package/dist/app/use-projection-list-query.d.ts +2 -0
- package/dist/app/use-projection-list-query.js +29 -16
- package/dist/app/use-related-list-tab-counts.js +5 -1
- package/dist/app/use-row-decoration.d.ts +13 -0
- package/dist/app/use-row-decoration.js +103 -0
- package/dist/app/use-screen-list-rows.d.ts +4 -1
- package/dist/app/use-screen-list-rows.js +14 -5
- package/dist/app/use-screen-list-table.d.ts +3 -1
- package/dist/app/use-screen-list-table.js +10 -1
- package/dist/app/write-failed-error.d.ts +1 -0
- package/dist/app/write-failed-error.js +10 -0
- package/dist/card-options.d.ts +25 -0
- package/dist/card-options.js +1 -0
- package/dist/compact-tap-classes.d.ts +1 -0
- package/dist/compact-tap-classes.js +3 -0
- package/dist/components/embedded-list-field.js +13 -12
- package/dist/components/list-empty-state.d.ts +13 -1
- package/dist/components/list-empty-state.js +20 -1
- package/dist/components/list-group-page-bridges.d.ts +1 -1
- package/dist/components/list-group-page-bridges.js +2 -2
- package/dist/components/related-list-section.js +4 -22
- package/dist/components/render-edit-action-button.d.ts +3 -1
- package/dist/components/render-edit-action-button.js +5 -3
- package/dist/components/render-edit-render-model.d.ts +2 -2
- package/dist/components/render-edit-types.d.ts +4 -2
- package/dist/components/render-edit.js +3 -1
- package/dist/components/render-list-hint-columns.d.ts +9 -0
- package/dist/components/render-list-hint-columns.js +87 -0
- package/dist/components/render-list-reference-columns.js +4 -2
- package/dist/components/render-list-row-tone.d.ts +3 -0
- package/dist/components/render-list-row-tone.js +10 -0
- package/dist/components/render-list-table-props.d.ts +9 -1
- package/dist/components/render-list-table-props.js +4 -1
- package/dist/components/render-list-toolbar-action.d.ts +1 -2
- package/dist/components/render-list-toolbar-model.d.ts +4 -1
- package/dist/components/render-list-toolbar-model.js +21 -6
- package/dist/components/render-list-toolbar.d.ts +3 -2
- package/dist/components/render-list-toolbar.js +8 -6
- package/dist/components/render-list-types.d.ts +6 -1
- package/dist/components/render-list.js +26 -7
- package/dist/components/use-render-edit-controlled-sync.js +3 -5
- package/dist/components/use-render-edit-draft-save.js +7 -9
- package/dist/components/use-render-edit-schema.d.ts +3 -0
- package/dist/components/use-render-edit-schema.js +15 -0
- package/dist/components/use-render-edit-state.d.ts +1 -0
- package/dist/components/use-render-edit-state.js +4 -1
- package/dist/components/use-render-edit-steps.js +2 -3
- package/dist/components/use-render-list-columns.d.ts +3 -1
- package/dist/components/use-render-list-columns.js +22 -10
- package/dist/context/screen-focus-context.d.ts +14 -0
- package/dist/context/screen-focus-context.js +28 -0
- package/dist/data-table-facet-types.d.ts +6 -0
- package/dist/data-table-view-types.d.ts +20 -1
- package/dist/headless/form/form-controller.js +3 -1
- package/dist/headless/form/zod-bridge.d.ts +7 -1
- package/dist/headless/form/zod-bridge.js +10 -0
- package/dist/headless/index.d.ts +2 -1
- package/dist/headless/index.js +1 -0
- package/dist/headless/pwa-service-worker-meta.d.ts +4 -0
- package/dist/headless/pwa-service-worker-meta.js +13 -0
- package/dist/headless/view-model/index.d.ts +1 -1
- package/dist/headless/view-model/list-file-display.js +3 -2
- package/dist/headless/view-model/list.js +16 -0
- package/dist/headless/view-model/types.d.ts +37 -0
- package/dist/hooks/list-column-layout.js +2 -1
- package/dist/hooks/list-server-groups.js +14 -1
- package/dist/hooks/list-state-schema.d.ts +1 -0
- package/dist/hooks/list-state-schema.js +9 -1
- package/dist/hooks/use-debounced-value.d.ts +1 -0
- package/dist/hooks/use-debounced-value.js +11 -0
- package/dist/hooks/use-list-aggregates.d.ts +5 -1
- package/dist/hooks/use-list-aggregates.js +9 -5
- package/dist/hooks/use-list-table.d.ts +2 -1
- package/dist/hooks/use-list-table.js +3 -9
- package/dist/hooks/use-list-url-state.d.ts +2 -0
- package/dist/hooks/use-list-url-state.js +12 -4
- package/dist/hooks/use-list-view-state.js +23 -3
- package/dist/hooks/use-reference-lookup.js +7 -2
- package/dist/hooks/use-remembered-list-params.d.ts +6 -2
- package/dist/hooks/use-remembered-list-params.js +18 -3
- package/dist/hooks/use-store.js +0 -1
- package/dist/i18n-defaults.js +39 -3
- package/dist/index.d.ts +7 -2
- package/dist/index.js +4 -1
- package/dist/live/dispatcher-live.js +2 -0
- package/dist/metric-types.d.ts +4 -0
- package/dist/primitives-record-guidance.d.ts +55 -0
- package/dist/primitives-record-guidance.js +1 -0
- package/dist/primitives.d.ts +47 -54
- package/dist/server-clock.d.ts +6 -0
- package/dist/server-clock.js +20 -0
- package/dist/session/session-ended.d.ts +1 -0
- package/dist/session/session-ended.js +2 -2
- package/dist/status-tone.d.ts +1 -0
- package/dist/status-tone.js +5 -0
- package/dist/web/app/browser-locale.js +1 -1
- package/dist/web/app/client-plugin.d.ts +6 -1
- package/dist/web/app/create-app.d.ts +2 -1
- package/dist/web/app/create-app.js +15 -5
- package/dist/web/app/dashboard-body.js +25 -11
- package/dist/web/app/dashboard-header.d.ts +2 -1
- package/dist/web/app/dashboard-header.js +19 -7
- package/dist/web/app/dashboard-list-panel.d.ts +12 -0
- package/dist/web/app/dashboard-list-panel.js +144 -0
- package/dist/web/app/dashboard-narrow-gate.d.ts +6 -0
- package/dist/web/app/dashboard-narrow-gate.js +6 -0
- package/dist/web/app/dashboard-narrow-order.d.ts +3 -0
- package/dist/web/app/dashboard-narrow-order.js +6 -0
- package/dist/web/app/dashboard-navigation-link.d.ts +12 -0
- package/dist/web/app/dashboard-navigation-link.js +21 -0
- package/dist/web/app/dashboard-panels.d.ts +7 -23
- package/dist/web/app/dashboard-panels.js +55 -123
- package/dist/web/app/dashboard-reference-list-table.d.ts +5 -1
- package/dist/web/app/dashboard-reference-list-table.js +13 -4
- package/dist/web/app/dashboard-shared.d.ts +23 -7
- package/dist/web/app/dashboard-shared.js +45 -17
- package/dist/web/app/dashboard-stat-group-panel.d.ts +14 -0
- package/dist/web/app/dashboard-stat-group-panel.js +74 -0
- package/dist/web/app/dashboard-text-panel.d.ts +12 -0
- package/dist/web/app/dashboard-text-panel.js +167 -0
- package/dist/web/app/dashboard-text.d.ts +2 -0
- package/dist/web/app/dashboard-text.js +1 -1
- package/dist/web/app/dashboard-visibility.js +1 -1
- package/dist/web/app/relative-time.js +2 -1
- package/dist/web/drawn-icons.d.ts +6 -0
- package/dist/web/drawn-icons.js +30 -0
- package/dist/web/editor/editor-footer.d.ts +28 -0
- package/dist/web/editor/editor-footer.js +23 -0
- package/dist/web/editor/editor-frame.d.ts +23 -0
- package/dist/web/editor/editor-frame.js +24 -0
- package/dist/web/editor/editor-header.d.ts +36 -0
- package/dist/web/editor/editor-header.js +30 -0
- package/dist/web/editor/editor-rail.d.ts +32 -0
- package/dist/web/editor/editor-rail.js +37 -0
- package/dist/web/editor/editor-workbench.d.ts +34 -0
- package/dist/web/editor/editor-workbench.js +19 -0
- package/dist/web/editor/index.d.ts +6 -0
- package/dist/web/editor/index.js +6 -0
- package/dist/web/editor/relative-when.d.ts +1 -0
- package/dist/web/editor/relative-when.js +18 -0
- package/dist/web/icons.js +6 -5
- package/dist/web/index.d.ts +9 -1
- package/dist/web/index.js +7 -1
- package/dist/web/layout/default-app-shell.js +6 -4
- package/dist/web/layout/focus-aware-sidebar.d.ts +4 -7
- package/dist/web/layout/focus-aware-sidebar.js +5 -7
- package/dist/web/layout/header-action-pinned.d.ts +8 -0
- package/dist/web/layout/header-action-pinned.js +25 -0
- package/dist/web/layout/nav-collapse-state.d.ts +7 -0
- package/dist/web/layout/nav-collapse-state.js +76 -0
- package/dist/web/layout/nav-tree.js +71 -28
- package/dist/web/layout/notification-bell.d.ts +7 -2
- package/dist/web/layout/notification-bell.js +16 -5
- package/dist/web/layout/page-header-slot.d.ts +2 -0
- package/dist/web/layout/page-header-slot.js +4 -0
- package/dist/web/layout/screen-focus.d.ts +8 -0
- package/dist/web/layout/screen-focus.js +42 -0
- package/dist/web/layout/shell-focus.d.ts +5 -4
- package/dist/web/layout/shell-focus.js +14 -7
- package/dist/web/layout/shell-header.d.ts +2 -1
- package/dist/web/layout/shell-header.js +84 -27
- package/dist/web/layout/shell-style.d.ts +3 -0
- package/dist/web/layout/shell-style.js +6 -0
- package/dist/web/layout/sidebar-open-state.d.ts +6 -0
- package/dist/web/layout/sidebar-open-state.js +28 -0
- package/dist/web/layout/uniform-bar-controls.d.ts +2 -2
- package/dist/web/layout/uniform-bar-controls.js +4 -3
- package/dist/web/layout/use-in-app-inbox.js +8 -1
- package/dist/web/layout/workspace-shell.d.ts +11 -1
- package/dist/web/layout/workspace-shell.js +9 -5
- package/dist/web/lib/upload-file-ref.d.ts +2 -2
- package/dist/web/lib/upload-file-ref.js +4 -9
- package/dist/web/presence/use-presence.js +7 -2
- package/dist/web/primitives/banner.d.ts +1 -1
- package/dist/web/primitives/banner.js +22 -9
- package/dist/web/primitives/calendar-day-picker.js +24 -5
- package/dist/web/primitives/card.js +18 -8
- package/dist/web/primitives/code-input.js +6 -1
- package/dist/web/primitives/data-table/actions-column.d.ts +2 -1
- package/dist/web/primitives/data-table/actions-column.js +7 -3
- package/dist/web/primitives/data-table/card-body.d.ts +6 -1
- package/dist/web/primitives/data-table/card-body.js +53 -6
- package/dist/web/primitives/data-table/card-frame.d.ts +8 -0
- package/dist/web/primitives/data-table/card-frame.js +9 -0
- package/dist/web/primitives/data-table/card-row.js +44 -7
- package/dist/web/primitives/data-table/card-sort-select.d.ts +6 -2
- package/dist/web/primitives/data-table/card-sort-select.js +10 -7
- package/dist/web/primitives/data-table/card-view.js +12 -2
- package/dist/web/primitives/data-table/column-picker-section.js +9 -2
- package/dist/web/primitives/data-table/column-resize-handle.js +3 -4
- package/dist/web/primitives/data-table/column-role.d.ts +1 -0
- package/dist/web/primitives/data-table/column-role.js +1 -0
- package/dist/web/primitives/data-table/data-cell-props.d.ts +5 -0
- package/dist/web/primitives/data-table/data-cell-props.js +5 -0
- package/dist/web/primitives/data-table/density.js +1 -0
- package/dist/web/primitives/data-table/facet-cluster.d.ts +2 -1
- package/dist/web/primitives/data-table/facet-cluster.js +2 -2
- package/dist/web/primitives/data-table/group-band.js +4 -0
- package/dist/web/primitives/data-table/hint-cell.d.ts +14 -0
- package/dist/web/primitives/data-table/hint-cell.js +68 -0
- package/dist/web/primitives/data-table/hint-column-width.d.ts +3 -0
- package/dist/web/primitives/data-table/hint-column-width.js +11 -0
- package/dist/web/primitives/data-table/measure-value.js +2 -3
- package/dist/web/primitives/data-table/row-action-column.d.ts +3 -0
- package/dist/web/primitives/data-table/row-action-column.js +4 -0
- package/dist/web/primitives/data-table/row-render-parts.d.ts +1 -1
- package/dist/web/primitives/data-table/row-render-parts.js +3 -2
- package/dist/web/primitives/data-table/sort-options-select.d.ts +22 -0
- package/dist/web/primitives/data-table/sort-options-select.js +46 -0
- package/dist/web/primitives/data-table/sortable-header.d.ts +3 -1
- package/dist/web/primitives/data-table/sortable-header.js +5 -3
- package/dist/web/primitives/data-table/table-body.d.ts +1 -1
- package/dist/web/primitives/data-table/table-body.js +5 -3
- package/dist/web/primitives/data-table/table-chrome.js +3 -1
- package/dist/web/primitives/data-table/table-content.js +12 -7
- package/dist/web/primitives/data-table/table-data-cell.js +9 -3
- package/dist/web/primitives/data-table/table-header-row.js +5 -2
- package/dist/web/primitives/data-table/table-view.js +22 -3
- package/dist/web/primitives/data-table/toolbar-end-cluster.js +1 -1
- package/dist/web/primitives/data-table/toolbar.d.ts +2 -0
- package/dist/web/primitives/data-table/toolbar.js +70 -7
- package/dist/web/primitives/data-table/totals-footer.d.ts +20 -0
- package/dist/web/primitives/data-table/totals-footer.js +41 -9
- package/dist/web/primitives/data-table/use-bulk-selection.js +2 -1
- package/dist/web/primitives/data-table/use-column-pins.js +4 -0
- package/dist/web/primitives/data-table/use-data-table-state.d.ts +1 -0
- package/dist/web/primitives/data-table/use-data-table-state.js +9 -5
- package/dist/web/primitives/data-table/use-measured-column-widths.js +5 -4
- package/dist/web/primitives/data-table/use-row-selection.js +22 -11
- package/dist/web/primitives/data-table/view-menu.js +7 -1
- package/dist/web/primitives/data-table-cell.d.ts +21 -2
- package/dist/web/primitives/data-table-cell.js +129 -26
- package/dist/web/primitives/embedded-file-cell.js +3 -2
- package/dist/web/primitives/embedded-list-cards.js +3 -4
- package/dist/web/primitives/facet-filter.d.ts +5 -3
- package/dist/web/primitives/facet-filter.js +36 -5
- package/dist/web/primitives/facet-search-filter.d.ts +2 -1
- package/dist/web/primitives/facet-search-filter.js +3 -2
- package/dist/web/primitives/facet-trigger-label.d.ts +8 -0
- package/dist/web/primitives/facet-trigger-label.js +9 -0
- package/dist/web/primitives/file-thumbnail.d.ts +6 -2
- package/dist/web/primitives/file-thumbnail.js +13 -6
- package/dist/web/primitives/file-upload.js +3 -2
- package/dist/web/primitives/file-view-action.d.ts +6 -0
- package/dist/web/primitives/file-view-action.js +22 -0
- package/dist/web/primitives/files-dropzone.js +20 -9
- package/dist/web/primitives/form-footer-parts.d.ts +0 -1
- package/dist/web/primitives/form.js +0 -1
- package/dist/web/primitives/hint-reason-row.d.ts +32 -0
- package/dist/web/primitives/hint-reason-row.js +45 -0
- package/dist/web/primitives/index.js +6 -0
- package/dist/web/primitives/layout-elements.d.ts +1 -1
- package/dist/web/primitives/layout-elements.js +3 -3
- package/dist/web/primitives/metric.js +20 -6
- package/dist/web/primitives/page-header.d.ts +1 -1
- package/dist/web/primitives/page-header.js +10 -2
- package/dist/web/primitives/pager.d.ts +3 -2
- package/dist/web/primitives/pager.js +31 -24
- package/dist/web/primitives/reason-box.d.ts +20 -0
- package/dist/web/primitives/reason-box.js +13 -0
- package/dist/web/primitives/record-breadcrumb.d.ts +3 -0
- package/dist/web/primitives/record-breadcrumb.js +11 -0
- package/dist/web/primitives/record-steps.d.ts +3 -0
- package/dist/web/primitives/record-steps.js +50 -0
- package/dist/web/primitives/record-summary.d.ts +3 -0
- package/dist/web/primitives/record-summary.js +18 -0
- package/dist/web/primitives/row-actions.d.ts +3 -1
- package/dist/web/primitives/row-actions.js +14 -5
- package/dist/web/primitives/segmented-select.js +10 -9
- package/dist/web/primitives/tabs.js +6 -1
- package/dist/web/pwa/pwa-support.d.ts +4 -0
- package/dist/web/pwa/pwa-support.js +131 -0
- package/dist/web/sse/live-events.js +2 -2
- package/dist/web/tokens.js +0 -3
- package/dist/web/ui/sidebar.d.ts +2 -1
- package/dist/web/ui/sidebar.js +4 -3
- package/dist/web/widgets/ai-text-field.js +3 -2
- package/dist/web/widgets/chart-parts.d.ts +7 -1
- package/dist/web/widgets/chart-parts.js +10 -4
- package/dist/web/widgets/collapsible-section.js +1 -1
- package/dist/web/widgets/dashboard-list-cards.d.ts +17 -0
- package/dist/web/widgets/dashboard-list-cards.js +46 -0
- package/dist/web/widgets/dashboard-list.d.ts +45 -5
- package/dist/web/widgets/dashboard-list.js +126 -25
- package/dist/web/widgets/drawer-panel-class.d.ts +1 -0
- package/dist/web/widgets/drawer-panel-class.js +9 -1
- package/dist/web/widgets/drawer-sizing.js +1 -1
- package/dist/web/widgets/drawer.js +2 -2
- package/dist/web/widgets/floating-panel.js +4 -2
- package/dist/web/widgets/index.d.ts +2 -0
- package/dist/web/widgets/index.js +2 -0
- package/dist/web/widgets/infinity-list.js +18 -11
- package/dist/web/widgets/pdf-viewer-toolbar.js +3 -2
- package/dist/web/widgets/preview-width-frame.d.ts +7 -0
- package/dist/web/widgets/preview-width-frame.js +10 -0
- package/dist/web/widgets/section-card.d.ts +1 -1
- package/dist/web/widgets/sheet-parts.js +3 -1
- package/dist/web/widgets/stacked-area-chrome.js +3 -3
- package/dist/web/widgets/stacked-area-tooltip.js +2 -10
- package/dist/web/widgets/stat-box-cell.d.ts +19 -0
- package/dist/web/widgets/stat-box-cell.js +10 -0
- package/dist/web/widgets/stat.d.ts +16 -1
- package/dist/web/widgets/stat.js +24 -7
- package/dist/web/widgets/status-badge.d.ts +7 -5
- package/dist/web/widgets/status-badge.js +2 -2
- package/dist/web/widgets/step-bar.d.ts +1 -1
- package/dist/web/widgets/step-bar.js +37 -7
- package/dist/web/widgets/step-list-row.d.ts +4 -0
- package/dist/web/widgets/step-list-row.js +22 -14
- package/dist/web/widgets/step-list.d.ts +12 -4
- package/dist/web/widgets/step-list.js +38 -20
- package/dist/web/widgets/upload-zone.d.ts +8 -1
- package/dist/web/widgets/upload-zone.js +13 -3
- package/package.json +5 -5
- package/src/changes.json +289 -0
- package/src/web/styles.css +15 -0
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { SELECT_OPTION_TONES } from "@cosmicdrift/kumiko-types/fields";
|
|
3
2
|
import { PII_ERASED_SENTINEL } from "@cosmicdrift/kumiko-types/kms-adapter-types";
|
|
4
3
|
import { propertyOf } from "@cosmicdrift/kumiko-types/type-guards";
|
|
5
4
|
import { Check } from "lucide-react";
|
|
6
5
|
import { Fragment } from "react";
|
|
7
6
|
import { rendererWarn } from "../../dev-console.js";
|
|
7
|
+
import { fileIdsOf } from "../../file-ids-of.js";
|
|
8
8
|
import { applyFormatSpec, EMPTY_VALUE_PLACEHOLDER, isSafeHref } from "../../headless/index.js";
|
|
9
9
|
import { statusToneForOptionTone, statusToneForValue, useColumnRenderer, useOptionalPrimitives, } from "../../index.js";
|
|
10
|
+
import { isSelectOptionTone } from "../../status-tone.js";
|
|
10
11
|
import { Badge } from "../ui/badge.js";
|
|
12
|
+
import { buttonVariants } from "../ui/button.js";
|
|
11
13
|
import { StatusBadge } from "../widgets/status-badge.js";
|
|
14
|
+
import { HintCell } from "./data-table/hint-cell.js";
|
|
12
15
|
import { FileDisplayCell } from "./file-thumbnail.js";
|
|
16
|
+
import { FileViewAction } from "./file-view-action.js";
|
|
13
17
|
import { currencyDecimals, formatMoney } from "./money-input.js";
|
|
14
18
|
import "../react-css-custom-properties.js";
|
|
15
19
|
import { isPlainPrimaryClick } from "./layout-elements.js";
|
|
@@ -218,9 +222,6 @@ export function selectPill(value, optionLabels, optionTones, locale, RegisteredS
|
|
|
218
222
|
// dashboard-01 pattern: outline badge + muted instead of a filled secondary.
|
|
219
223
|
return (_jsx(Badge, { variant: "outline", className: "px-1.5 text-muted-foreground", children: label }));
|
|
220
224
|
}
|
|
221
|
-
function isSelectOptionTone(value) {
|
|
222
|
-
return SELECT_OPTION_TONES.some((tone) => tone === value);
|
|
223
|
-
}
|
|
224
225
|
// enumOption's `tones` arrive with the untyped spec, so each entry is checked here.
|
|
225
226
|
function enumOptionTones(spec) {
|
|
226
227
|
const tones = spec["tones"];
|
|
@@ -234,6 +235,18 @@ function enumOptionTones(spec) {
|
|
|
234
235
|
}
|
|
235
236
|
return out;
|
|
236
237
|
}
|
|
238
|
+
function EmptyCell({ placeholder }) {
|
|
239
|
+
return (_jsx("span", { "data-empty-cell": "true", className: "text-muted-foreground", children: placeholder === false ? null : EMPTY_VALUE_PLACEHOLDER }));
|
|
240
|
+
}
|
|
241
|
+
/** `display: "button"` draws a cell link as a small outline button. */
|
|
242
|
+
export const LINK_BUTTON_CLASS = buttonVariants({ variant: "outline", size: "sm" });
|
|
243
|
+
/** Badge tones by the list-wide ListBadgeTone words. */
|
|
244
|
+
export const LIST_BADGE_TONE = {
|
|
245
|
+
positive: "ok",
|
|
246
|
+
warn: "warn",
|
|
247
|
+
negative: "bad",
|
|
248
|
+
neutral: "muted",
|
|
249
|
+
};
|
|
237
250
|
// A multi reference may list the same id twice; the occurrence count keeps React keys unique.
|
|
238
251
|
function uniqueLinkItemKeys(items) {
|
|
239
252
|
const seen = new Map();
|
|
@@ -255,16 +268,46 @@ export function cellLinkProp(col, row, allowed) {
|
|
|
255
268
|
...(linkItems !== undefined && { linkItems }),
|
|
256
269
|
};
|
|
257
270
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
271
|
+
// Tone is a left stripe, not a fill: a tinted row reads as selected or disabled and fights the
|
|
272
|
+
// opaque sticky actions cell. Rows draw it as an inset shadow on the first cell (a border on a
|
|
273
|
+
// <tr> collapses away), cards as a real border. The colour also lands in --row-stripe because a
|
|
274
|
+
// pinned cell sets its own inline box-shadow, which would otherwise replace the stripe.
|
|
275
|
+
const ROW_STRIPE_SHADOW_CLASS = "[&>td:first-child]:shadow-[inset_4px_0_0_var(--row-stripe)]";
|
|
276
|
+
const ROW_TONE_STRIPE_CLASS = {
|
|
277
|
+
bad: `${ROW_STRIPE_SHADOW_CLASS} [&>td:first-child]:[--row-stripe:var(--color-status-bad)]`,
|
|
278
|
+
warn: `${ROW_STRIPE_SHADOW_CLASS} [&>td:first-child]:[--row-stripe:var(--color-status-warn)]`,
|
|
279
|
+
ok: `${ROW_STRIPE_SHADOW_CLASS} [&>td:first-child]:[--row-stripe:var(--color-status-ok)]`,
|
|
280
|
+
critical: `${ROW_STRIPE_SHADOW_CLASS} [&>td:first-child]:[--row-stripe:var(--color-status-critical)]`,
|
|
281
|
+
accent: `${ROW_STRIPE_SHADOW_CLASS} [&>td:first-child]:[--row-stripe:var(--color-primary)]`,
|
|
264
282
|
neutral: "",
|
|
265
283
|
};
|
|
284
|
+
// Inner 4px stripe (board .m-card): the card keeps its own border, the stripe sits inside the padding.
|
|
285
|
+
const CARD_STRIPE_BASE = "relative pl-6 before:absolute before:inset-y-2.5 before:left-2.5 before:w-1 before:rounded-[2px] before:content-['']";
|
|
286
|
+
const CARD_TONE_STRIPE_CLASS = {
|
|
287
|
+
bad: `${CARD_STRIPE_BASE} before:bg-status-bad`,
|
|
288
|
+
warn: `${CARD_STRIPE_BASE} before:bg-status-warn`,
|
|
289
|
+
ok: `${CARD_STRIPE_BASE} before:bg-status-ok`,
|
|
290
|
+
critical: `${CARD_STRIPE_BASE} before:bg-status-critical`,
|
|
291
|
+
accent: `${CARD_STRIPE_BASE} before:bg-primary`,
|
|
292
|
+
neutral: `${CARD_STRIPE_BASE} before:bg-border-strong`,
|
|
293
|
+
};
|
|
266
294
|
export function rowToneClass(tone) {
|
|
267
|
-
return tone === undefined ? "" :
|
|
295
|
+
return tone === undefined ? "" : ROW_TONE_STRIPE_CLASS[tone];
|
|
296
|
+
}
|
|
297
|
+
const TONE_DOT_CLASS = {
|
|
298
|
+
bad: "bg-status-bad",
|
|
299
|
+
warn: "bg-status-warn",
|
|
300
|
+
ok: "bg-status-ok",
|
|
301
|
+
critical: "bg-status-critical",
|
|
302
|
+
accent: "bg-primary",
|
|
303
|
+
neutral: "bg-status-neutral",
|
|
304
|
+
};
|
|
305
|
+
/** Background class of the small tone dot that `rowToneMarker: "dot"` draws in front of a row. */
|
|
306
|
+
export function toneDotClass(tone) {
|
|
307
|
+
return TONE_DOT_CLASS[tone];
|
|
308
|
+
}
|
|
309
|
+
export function cardToneClass(tone) {
|
|
310
|
+
return tone === undefined ? "" : CARD_TONE_STRIPE_CLASS[tone];
|
|
268
311
|
}
|
|
269
312
|
export const NUMERIC_COLUMN_TYPES = new Set([
|
|
270
313
|
"number",
|
|
@@ -281,8 +324,8 @@ export const TABULAR_COLUMN_TYPES = new Set([
|
|
|
281
324
|
]);
|
|
282
325
|
// A plain <a>, not DefaultLink: the click must not reach the row's own click
|
|
283
326
|
// handler, which opens the same record's row action.
|
|
284
|
-
function CellTextLink({ link, children, }) {
|
|
285
|
-
return (_jsx("a", { href: isSafeHref(link.href) ? link.href : "#", className:
|
|
327
|
+
export function CellTextLink({ link, children, className = "text-primary underline-offset-4 hover:underline", }) {
|
|
328
|
+
return (_jsx("a", { href: isSafeHref(link.href) ? link.href : "#", className: className, onClick: (event) => {
|
|
286
329
|
event.stopPropagation();
|
|
287
330
|
if (!isPlainPrimaryClick(event))
|
|
288
331
|
return;
|
|
@@ -290,6 +333,44 @@ function CellTextLink({ link, children, }) {
|
|
|
290
333
|
link.onPress();
|
|
291
334
|
}, children: children }));
|
|
292
335
|
}
|
|
336
|
+
function isFunctionRenderer(renderer) {
|
|
337
|
+
return typeof renderer === "function";
|
|
338
|
+
}
|
|
339
|
+
function isFormatSpecRenderer(renderer) {
|
|
340
|
+
return typeof renderer === "object" && renderer !== null && "format" in renderer;
|
|
341
|
+
}
|
|
342
|
+
// Same text the cell shows without `display`: a reference-lookup renderer or FormatSpec must win over the raw value.
|
|
343
|
+
function plainCellText({ value, row, type, renderer, optionLabels, locale, field, grouping, translate, }) {
|
|
344
|
+
if (isFunctionRenderer(renderer)) {
|
|
345
|
+
return renderer(value, row);
|
|
346
|
+
}
|
|
347
|
+
if (isFormatSpecRenderer(renderer)) {
|
|
348
|
+
return applyFormatSpec({ ...renderer, locale: renderer.locale ?? locale }, value, translate);
|
|
349
|
+
}
|
|
350
|
+
return defaultCellRender(value, type, optionLabels, locale, field, grouping);
|
|
351
|
+
}
|
|
352
|
+
// A list column's `display` (badge pill, outline link button); undefined = fall through to the normal paths.
|
|
353
|
+
function renderDisplayCell({ display, value, textOf, row, badgeToneField, badgeDot, emptyPlaceholder, link, }) {
|
|
354
|
+
// A column renderer skips the generic empty-cell path, so a pill or button would otherwise wrap nothing.
|
|
355
|
+
if ((display === "badge" || display === "button") && isEmptyCellValue(value)) {
|
|
356
|
+
return _jsx(EmptyCell, { placeholder: emptyPlaceholder });
|
|
357
|
+
}
|
|
358
|
+
if (display === "badge") {
|
|
359
|
+
const toneKey = badgeToneField === undefined ? undefined : row[badgeToneField];
|
|
360
|
+
const tone = (typeof toneKey === "string" ? LIST_BADGE_TONE[toneKey] : undefined) ?? "muted";
|
|
361
|
+
return (_jsx(StatusBadge, { tone: tone, dot: badgeDot !== false, children: textOf() }));
|
|
362
|
+
}
|
|
363
|
+
if (display === "button" && link !== undefined) {
|
|
364
|
+
return (_jsx(CellTextLink, { link: link, className: LINK_BUTTON_CLASS, children: textOf() }));
|
|
365
|
+
}
|
|
366
|
+
return undefined;
|
|
367
|
+
}
|
|
368
|
+
function renderFileCell({ value, fileDisplay, compactFile, translate, }) {
|
|
369
|
+
const [firstFileId] = fileIdsOf(value);
|
|
370
|
+
return (_jsxs("span", { className: "inline-flex items-center gap-3", children: [_jsx(FileDisplayCell, { value: value, display: fileDisplay, compact: compactFile, fallbackLabel: translate?.("kumiko.field.file-upload.attached") ?? "File attached" }), fileDisplay.kind === "file" &&
|
|
371
|
+
fileDisplay.viewInDrawer === true &&
|
|
372
|
+
firstFileId !== undefined && _jsx(FileViewAction, { fileId: firstFileId })] }));
|
|
373
|
+
}
|
|
293
374
|
// Cell renderer as a component (instead of a plain function) so the
|
|
294
375
|
// useColumnRenderer hook can read from the provider. The four paths:
|
|
295
376
|
// 1. FormatSpec (`{ format: "timestamp" }` etc.) -> applyFormatSpec.
|
|
@@ -299,43 +380,65 @@ function CellTextLink({ link, children, }) {
|
|
|
299
380
|
// "X" via useColumnRenderer and renders `<X value row column/>`.
|
|
300
381
|
// Not registered -> one-time warning + default fallback.
|
|
301
382
|
// 4. Otherwise -> defaultCellRender (type-based string renderer).
|
|
302
|
-
export function DataTableCell({ value, row, field, type, renderer, optionLabels, optionTones, onChange, translate, locale, grouping = true, fileDisplay, compactFile = false, link, linkItems, }) {
|
|
383
|
+
export function DataTableCell({ value, row, field, type, renderer, optionLabels, optionTones, onChange, translate, locale, grouping = true, fileDisplay, compactFile = false, link, linkItems, hint, display, badgeToneField, badgeDot, emptyPlaceholder, onOpenRow, }) {
|
|
303
384
|
const componentRef = isComponentRendererRef(renderer);
|
|
304
385
|
const ResolvedComponent = useColumnRenderer(componentRef?.name);
|
|
305
386
|
const RegisteredStatusBadge = useOptionalPrimitives()?.StatusBadge;
|
|
387
|
+
if (hint !== undefined) {
|
|
388
|
+
return (_jsx(HintCell, { value: value, row: row, hint: hint, ...(onOpenRow !== undefined && { onOpen: onOpenRow }) }));
|
|
389
|
+
}
|
|
306
390
|
if (isEmptyCellValue(value) && typeof renderer !== "function" && componentRef === undefined) {
|
|
307
|
-
return
|
|
391
|
+
return _jsx(EmptyCell, { placeholder: emptyPlaceholder });
|
|
308
392
|
}
|
|
309
393
|
if (value === PII_ERASED_SENTINEL && translate !== undefined) {
|
|
310
394
|
return translate("kumiko.pii.erased");
|
|
311
395
|
}
|
|
396
|
+
const displayCell = renderDisplayCell({
|
|
397
|
+
display,
|
|
398
|
+
value,
|
|
399
|
+
textOf: () => plainCellText({
|
|
400
|
+
value,
|
|
401
|
+
row,
|
|
402
|
+
type,
|
|
403
|
+
renderer,
|
|
404
|
+
optionLabels,
|
|
405
|
+
locale,
|
|
406
|
+
field,
|
|
407
|
+
grouping,
|
|
408
|
+
translate,
|
|
409
|
+
}),
|
|
410
|
+
row,
|
|
411
|
+
badgeToneField,
|
|
412
|
+
badgeDot,
|
|
413
|
+
emptyPlaceholder,
|
|
414
|
+
link,
|
|
415
|
+
});
|
|
416
|
+
if (displayCell !== undefined)
|
|
417
|
+
return displayCell;
|
|
312
418
|
if (typeof value === "boolean" &&
|
|
313
419
|
isBooleanColumn(type, renderer) &&
|
|
314
420
|
(renderer === undefined || isUnlabeledBooleanFormat(renderer))) {
|
|
315
421
|
return _jsx(BooleanCell, { value: value, translate: translate });
|
|
316
422
|
}
|
|
317
|
-
if (isUnlabeledFalse(type, value, renderer))
|
|
318
|
-
return
|
|
319
|
-
}
|
|
423
|
+
if (isUnlabeledFalse(type, value, renderer))
|
|
424
|
+
return _jsx(EmptyCell, { placeholder: emptyPlaceholder });
|
|
320
425
|
if (fileDisplay !== undefined) {
|
|
321
|
-
return (
|
|
426
|
+
return renderFileCell({ value, fileDisplay, compactFile, translate });
|
|
322
427
|
}
|
|
323
|
-
if (
|
|
324
|
-
const
|
|
325
|
-
const
|
|
326
|
-
const tones = enumOptionTones(spec);
|
|
428
|
+
if (isFormatSpecRenderer(renderer)) {
|
|
429
|
+
const text = applyFormatSpec({ ...renderer, locale: renderer.locale ?? locale }, value, translate);
|
|
430
|
+
const tones = enumOptionTones(renderer);
|
|
327
431
|
if (tones !== undefined && typeof value === "string") {
|
|
328
432
|
return selectPill(value, { [value]: text }, tones, locale, RegisteredStatusBadge);
|
|
329
433
|
}
|
|
330
434
|
return link === undefined ? text : _jsx(CellTextLink, { link: link, children: text });
|
|
331
435
|
}
|
|
332
|
-
if (
|
|
436
|
+
if (isFunctionRenderer(renderer)) {
|
|
333
437
|
if (linkItems !== undefined) {
|
|
334
438
|
const linkItemKeys = uniqueLinkItemKeys(linkItems);
|
|
335
439
|
return (_jsx(_Fragment, { children: linkItems.map((item, index) => (_jsxs(Fragment, { children: [index > 0 && ", ", item.link === undefined ? (item.label) : (_jsx(CellTextLink, { link: item.link, children: item.label }))] }, linkItemKeys[index]))) }));
|
|
336
440
|
}
|
|
337
|
-
const
|
|
338
|
-
const text = fn(value, row);
|
|
441
|
+
const text = renderer(value, row);
|
|
339
442
|
return link === undefined ? text : _jsx(CellTextLink, { link: link, children: text });
|
|
340
443
|
}
|
|
341
444
|
if (componentRef !== undefined) {
|
|
@@ -6,11 +6,12 @@ import { Loader2, Plus, X } from "lucide-react";
|
|
|
6
6
|
import { useRef, useState } from "react";
|
|
7
7
|
import { fileIdsOf } from "../../file-ids-of.js";
|
|
8
8
|
import { useSessionEndedSignal, useTrackFormUpload, useTranslation } from "../../index.js";
|
|
9
|
+
import { isSessionEndedCause } from "../../session/session-ended.js";
|
|
9
10
|
import { toAcceptAttr } from "../lib/accept-attr.js";
|
|
10
11
|
import { cn } from "../lib/cn.js";
|
|
11
12
|
import { resizeImageBeforeUpload } from "../lib/resize-image.js";
|
|
12
13
|
import { uploadErrorKey } from "../lib/upload-error-key.js";
|
|
13
|
-
import {
|
|
14
|
+
import { uploadFileRef } from "../lib/upload-file-ref.js";
|
|
14
15
|
import { FileNameLink, FileThumbnail } from "./file-thumbnail.js";
|
|
15
16
|
export function EmbeddedFileCell({ cellId, label, column, value, readOnly, uploadTarget, onChange, }) {
|
|
16
17
|
const t = useTranslation();
|
|
@@ -39,7 +40,7 @@ export function EmbeddedFileCell({ cellId, label, column, value, readOnly, uploa
|
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
42
|
catch (cause) {
|
|
42
|
-
if (
|
|
43
|
+
if (isSessionEndedCause(cause))
|
|
43
44
|
sessionEnded?.notify();
|
|
44
45
|
setError(t(uploadErrorKey(cause)));
|
|
45
46
|
}
|
|
@@ -33,9 +33,8 @@ export function EmbeddedListCards(props) {
|
|
|
33
33
|
return (_jsxs("div", { "data-testid": testIdFor("mobile"), className: "md:hidden flex flex-col gap-3", children: [rows.map((row, rowIndex) => {
|
|
34
34
|
const isLastRow = rowIndex === rows.length - 1;
|
|
35
35
|
const rowIssuesForRow = rowIssues?.[rowIndex];
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
column.isHiddenInRow?.(row) !== true;
|
|
36
|
+
const isShownInRow = (column) => column.hiddenInCard !== true && column.isHiddenInRow?.(row) !== true;
|
|
37
|
+
const isVisible = (column) => column !== titleColumn && isShownInRow(column);
|
|
39
38
|
const renderControl = (column) => renderCellControl({
|
|
40
39
|
cellId: cellId(rowIndex, column.field),
|
|
41
40
|
label: cellLabel(column, rowIndex),
|
|
@@ -51,7 +50,7 @@ export function EmbeddedListCards(props) {
|
|
|
51
50
|
});
|
|
52
51
|
const renderIssues = (column) => (_jsx(IssueMessages, { issues: cellIssues?.[`${rowIndex}.${column.field}`], testId: testIdFor(`cell-${rowIndex}-${column.field}-errors`) }));
|
|
53
52
|
const anchorHasAttachment = (anchor) => columns.find((other) => other.cardAttachedTo === anchor.field &&
|
|
54
|
-
other
|
|
53
|
+
isShownInRow(other) &&
|
|
55
54
|
other.field !== anchor.field);
|
|
56
55
|
return (_jsxs("div", { "data-testid": testIdFor(`row-${rowIndex}`), className: "flex flex-col gap-3 rounded-lg border bg-card p-4", children: [titleColumn !== undefined && (_jsxs("div", { "data-testid": testIdFor(`row-${rowIndex}-title`), className: "font-medium", children: [rowIndex + 1, " ", readOnlyCellText(titleColumn, row[titleColumn.field], currency, locale)] })), columns.map((column, columnIndex) => {
|
|
57
56
|
if (!isVisible(column))
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type DataTableDateRangeFacet, type DataTableFacet } from "../../index.ts";
|
|
3
3
|
import "../react-css-custom-properties.ts";
|
|
4
|
-
export declare function FacetFilter({ facet, selected, onChange, dense, }: {
|
|
4
|
+
export declare function FacetFilter({ facet, selected, onChange, dense, pill, }: {
|
|
5
5
|
facet: DataTableFacet;
|
|
6
6
|
selected: readonly string[];
|
|
7
7
|
onChange: (field: string, values: readonly string[]) => void;
|
|
8
8
|
/** Toolbar of a scrollBody table: h32 with the stronger border. */
|
|
9
9
|
dense?: boolean;
|
|
10
|
+
/** Compact pill trigger for the dropdown facets: rounded, auto width. */
|
|
11
|
+
pill?: boolean;
|
|
10
12
|
}): ReactNode;
|
|
11
13
|
export declare function DateRangeFacetFilter({ facet, onChange, }: {
|
|
12
14
|
facet: DataTableDateRangeFacet;
|
|
@@ -1,36 +1,67 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { ChevronDown } from "lucide-react";
|
|
3
|
+
import { Fragment } from "react";
|
|
4
|
+
import { useOptionalTranslation, } from "../../index.js";
|
|
3
5
|
import { cn } from "../lib/cn.js";
|
|
4
6
|
import { Badge } from "../ui/badge.js";
|
|
5
7
|
import { Button as UiButton } from "../ui/button.js";
|
|
6
|
-
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuTrigger, } from "./dropdown-menu.js";
|
|
8
|
+
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuTrigger, } from "./dropdown-menu.js";
|
|
7
9
|
import "../react-css-custom-properties.js";
|
|
8
10
|
import { DefaultButton } from "./button.js";
|
|
9
11
|
import { FacetSearchFilter } from "./facet-search-filter.js";
|
|
12
|
+
import { FACET_PILL_CLASSES, FacetTriggerLabel } from "./facet-trigger-label.js";
|
|
10
13
|
// ---- DataTable (shadcn: Table) ----
|
|
11
14
|
function sameValueSet(a, b) {
|
|
12
15
|
return a.length === b.length && a.every((value) => b.includes(value));
|
|
13
16
|
}
|
|
17
|
+
// "All" (no values) always stays; with hideEmpty an entry at 0 only stays while it is the active selection.
|
|
18
|
+
function visibleChips(facet, selected) {
|
|
19
|
+
return (facet.chips ?? []).filter((chip) => facet.hideEmpty !== true ||
|
|
20
|
+
chip.values.length === 0 ||
|
|
21
|
+
chip.count !== 0 ||
|
|
22
|
+
sameValueSet(selected, chip.values));
|
|
23
|
+
}
|
|
14
24
|
// Single-choice chip row for a facet with `chips`: a chip is pressed while the
|
|
15
25
|
// current selection equals its values, a click replaces the selection.
|
|
16
26
|
function FacetChips({ facet, selected, onChange, }) {
|
|
17
|
-
const chips = (facet
|
|
27
|
+
const chips = visibleChips(facet, selected);
|
|
18
28
|
return (_jsx("div", { role: "group", "aria-label": facet.label, className: "flex flex-wrap items-center gap-1.5", "data-testid": `facet-${facet.field}`, children: chips.map((chip) => (_jsxs(DefaultButton, { variant: "secondary", size: "sm", pressed: sameValueSet(selected, chip.values), onClick: () => onChange(facet.field, chip.values), testId: `facet-${facet.field}-${chip.id}`, className: "rounded-full", children: [chip.label, facet.showCounts === true && chip.count !== undefined && (_jsx("span", { className: "tabular-nums text-muted-foreground", children: chip.count }))] }, chip.id))) }));
|
|
19
29
|
}
|
|
30
|
+
// Single-choice dropdown for a chips facet with display "select": the trigger names the
|
|
31
|
+
// active entry, and turns primary-bordered once a chip other than the empty selection is on.
|
|
32
|
+
function FacetSelect({ facet, selected, onChange, dense, pill, }) {
|
|
33
|
+
const chips = visibleChips(facet, selected);
|
|
34
|
+
const isFiltered = selected.length > 0;
|
|
35
|
+
// A stale URL can name an entry the facet does not offer; showing "all" then would misstate the list.
|
|
36
|
+
const active = chips.find((chip) => sameValueSet(selected, chip.values)) ??
|
|
37
|
+
(isFiltered ? undefined : chips[0]);
|
|
38
|
+
return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(UiButton, { variant: "outline", size: "sm", className: cn("h-9", dense && "border-border-strong px-2.5", pill && FACET_PILL_CLASSES, isFiltered && "border-primary"), "data-testid": `facet-${facet.field}`, children: [_jsx("span", { className: "text-muted-foreground", children: active === undefined ? facet.label : `${facet.label}: ` }), active !== undefined && (_jsx("span", { "data-testid": `facet-${facet.field}-value`, className: isFiltered ? "font-medium text-primary" : "text-foreground", children: active.label })), _jsx(ChevronDown, { className: "text-muted-foreground" })] }) }), _jsx(DropdownMenuContent, { align: "start", className: "max-h-[var(--radix-dropdown-menu-content-available-height)] w-56 overflow-y-auto", children: _jsx(DropdownMenuRadioGroup, { value: active?.id ?? "", onValueChange: (id) => {
|
|
39
|
+
if (id === active?.id)
|
|
40
|
+
return;
|
|
41
|
+
const chip = chips.find((candidate) => candidate.id === id);
|
|
42
|
+
if (chip !== undefined)
|
|
43
|
+
onChange(facet.field, chip.values);
|
|
44
|
+
}, children: chips.map((chip) => (_jsxs(Fragment, { children: [_jsxs(DropdownMenuRadioItem, { value: chip.id, "data-testid": `facet-${facet.field}-${chip.id}`, children: [_jsx("span", { className: "flex-1", children: chip.label }), facet.showCounts === true && chip.count !== undefined && (_jsx("span", { className: "ml-auto pl-4 tabular-nums text-muted-foreground", children: chip.count }))] }), chip.separatorAfter === true && _jsx(DropdownMenuSeparator, {})] }, chip.id))) }) })] }));
|
|
45
|
+
}
|
|
20
46
|
// Faceted filter dropdown: outline button (like shadcn's "Columns" toggle) +
|
|
21
47
|
// multi-select checkboxes. Active selection -> count badge on the button.
|
|
22
|
-
export function FacetFilter({ facet, selected, onChange, dense = false, }) {
|
|
48
|
+
export function FacetFilter({ facet, selected, onChange, dense = false, pill = false, }) {
|
|
49
|
+
const translate = useOptionalTranslation();
|
|
50
|
+
const allLabel = translate?.("kumiko.list.filter.all") ?? "All";
|
|
23
51
|
const toggle = (value, checked) => {
|
|
24
52
|
const next = checked ? [...selected, value] : selected.filter((v) => v !== value);
|
|
25
53
|
onChange(facet.field, next);
|
|
26
54
|
};
|
|
55
|
+
if (facet.chips !== undefined && facet.display === "select") {
|
|
56
|
+
return (_jsx(FacetSelect, { facet: facet, selected: selected, onChange: onChange, dense: dense, pill: pill }));
|
|
57
|
+
}
|
|
27
58
|
if (facet.chips !== undefined) {
|
|
28
59
|
return _jsx(FacetChips, { facet: facet, selected: selected, onChange: onChange });
|
|
29
60
|
}
|
|
30
61
|
if (facet.onSearchChange !== undefined) {
|
|
31
|
-
return (_jsx(FacetSearchFilter, { facet: facet, onSearchChange: facet.onSearchChange, selected: selected, onChange: onChange, dense: dense }));
|
|
62
|
+
return (_jsx(FacetSearchFilter, { facet: facet, onSearchChange: facet.onSearchChange, selected: selected, onChange: onChange, dense: dense, pill: pill }));
|
|
32
63
|
}
|
|
33
|
-
return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(UiButton, { variant: "outline", size: "sm", className: cn("h-9", dense && "border-border-strong px-2.5"), "data-testid": `facet-${facet.field}`, children: [facet.label, selected.length > 0 && (_jsx(Badge, { variant: "secondary", className: "ml-1 rounded-sm px-1 font-normal tabular-nums", children: selected.length })), _jsx(ChevronDown, { className: "text-muted-foreground" })] }) }), _jsx(DropdownMenuContent, { align: "start", className: "max-h-[var(--radix-dropdown-menu-content-available-height)] w-44 overflow-y-auto", children: facet.options.map((opt) => (_jsx(DropdownMenuCheckboxItem, { checked: selected.includes(opt.value), onCheckedChange: (checked) => toggle(opt.value, checked), onSelect: (e) => e.preventDefault(), "data-testid": `facet-${facet.field}-${opt.value}`, children: opt.label }, opt.value))) })] }));
|
|
64
|
+
return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(UiButton, { variant: "outline", size: "sm", className: cn("h-9", dense && "border-border-strong px-2.5", pill && FACET_PILL_CLASSES), "data-testid": `facet-${facet.field}`, children: [selected.length === 0 ? (_jsx(FacetTriggerLabel, { field: facet.field, label: facet.label, emptyValueLabel: allLabel, showEmptyValue: !pill })) : (facet.label), selected.length > 0 && (_jsx(Badge, { variant: "secondary", className: "ml-1 rounded-sm px-1 font-normal tabular-nums", children: selected.length })), _jsx(ChevronDown, { className: "text-muted-foreground" })] }) }), _jsx(DropdownMenuContent, { align: "start", className: "max-h-[var(--radix-dropdown-menu-content-available-height)] w-44 overflow-y-auto", children: facet.options.map((opt) => (_jsx(DropdownMenuCheckboxItem, { checked: selected.includes(opt.value), onCheckedChange: (checked) => toggle(opt.value, checked), onSelect: (e) => e.preventDefault(), "data-testid": `facet-${facet.field}-${opt.value}`, children: opt.label }, opt.value))) })] }));
|
|
34
65
|
}
|
|
35
66
|
// Time-range filter: two native <input type="date"> instead of a
|
|
36
67
|
// dropdown — the browser supplies the calendar, the locale and the keyboard
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import { type DataTableFacet } from "../../index.ts";
|
|
3
|
-
export declare function FacetSearchFilter({ facet, onSearchChange, selected, onChange, dense, }: {
|
|
3
|
+
export declare function FacetSearchFilter({ facet, onSearchChange, selected, onChange, dense, pill, }: {
|
|
4
4
|
facet: DataTableFacet;
|
|
5
5
|
onSearchChange: (query: string) => void;
|
|
6
6
|
selected: readonly string[];
|
|
7
7
|
onChange: (field: string, values: readonly string[]) => void;
|
|
8
8
|
dense: boolean;
|
|
9
|
+
pill: boolean;
|
|
9
10
|
}): ReactNode;
|
|
@@ -10,7 +10,8 @@ import { REFERENCE_SEARCH_DEBOUNCE_MS, useTranslation } from "../../index.js";
|
|
|
10
10
|
import { cn } from "../lib/cn.js";
|
|
11
11
|
import { Badge } from "../ui/badge.js";
|
|
12
12
|
import { Button as UiButton } from "../ui/button.js";
|
|
13
|
-
|
|
13
|
+
import { FACET_PILL_CLASSES, FacetTriggerLabel } from "./facet-trigger-label.js";
|
|
14
|
+
export function FacetSearchFilter({ facet, onSearchChange, selected, onChange, dense, pill, }) {
|
|
14
15
|
const t = useTranslation();
|
|
15
16
|
const [open, setOpen] = useState(false);
|
|
16
17
|
const [searchTerm, setSearchTerm] = useState("");
|
|
@@ -25,7 +26,7 @@ export function FacetSearchFilter({ facet, onSearchChange, selected, onChange, d
|
|
|
25
26
|
const toggle = (value) => {
|
|
26
27
|
onChange(facet.field, selected.includes(value) ? selected.filter((v) => v !== value) : [...selected, value]);
|
|
27
28
|
};
|
|
28
|
-
return (_jsxs(PopoverPrimitive.Root, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverPrimitive.Trigger, { asChild: true, children: _jsxs(UiButton, { variant: "outline", size: "sm", className: cn("h-9", dense && "border-border-strong px-2.5"), "data-testid": `facet-${facet.field}`, children: [facet.label, selected.length > 0 && (_jsx(Badge, { variant: "secondary", className: "ml-1 rounded-sm px-1 font-normal tabular-nums", children: selected.length })), _jsx(ChevronDown, { className: "text-muted-foreground" })] }) }), _jsx(PopoverPrimitive.Portal, { children: _jsx(PopoverPrimitive.Content, { align: "start", sideOffset: 4, className: "z-50 w-64 rounded-md border bg-popover p-0 text-popover-foreground shadow-md outline-none", children: _jsxs(Command, { shouldFilter: false, children: [_jsxs("div", { className: "relative", children: [_jsx(Command.Input, { value: searchTerm, onValueChange: setSearchTerm, placeholder: t("kumiko.combobox.search-placeholder"), "data-testid": `facet-${facet.field}-search`, className: "flex h-9 w-full border-0 border-b border-border bg-transparent px-3 py-1 text-sm outline-none placeholder:text-muted-foreground" }), facet.searching === true && (_jsx(Loader2, { className: "absolute right-2 top-2.5 h-4 w-4 animate-spin text-muted-foreground" }))] }), _jsxs(Command.List, { className: "max-h-64 overflow-y-auto p-1", children: [_jsx(Command.Empty, { className: "py-3 text-center text-sm text-muted-foreground", children: facet.searching === true
|
|
29
|
+
return (_jsxs(PopoverPrimitive.Root, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverPrimitive.Trigger, { asChild: true, children: _jsxs(UiButton, { variant: "outline", size: "sm", className: cn("h-9", dense && "border-border-strong px-2.5", pill && FACET_PILL_CLASSES), "data-testid": `facet-${facet.field}`, children: [selected.length === 0 ? (_jsx(FacetTriggerLabel, { field: facet.field, label: facet.label, emptyValueLabel: t("kumiko.list.filter.all"), showEmptyValue: !pill })) : (facet.label), selected.length > 0 && (_jsx(Badge, { variant: "secondary", className: "ml-1 rounded-sm px-1 font-normal tabular-nums", children: selected.length })), _jsx(ChevronDown, { className: "text-muted-foreground" })] }) }), _jsx(PopoverPrimitive.Portal, { children: _jsx(PopoverPrimitive.Content, { align: "start", sideOffset: 4, className: "z-50 w-64 rounded-md border bg-popover p-0 text-popover-foreground shadow-md outline-none", children: _jsxs(Command, { shouldFilter: false, children: [_jsxs("div", { className: "relative", children: [_jsx(Command.Input, { value: searchTerm, onValueChange: setSearchTerm, placeholder: t("kumiko.combobox.search-placeholder"), "data-testid": `facet-${facet.field}-search`, className: "flex h-9 w-full border-0 border-b border-border bg-transparent px-3 py-1 text-sm outline-none placeholder:text-muted-foreground" }), facet.searching === true && (_jsx(Loader2, { className: "absolute right-2 top-2.5 h-4 w-4 animate-spin text-muted-foreground" }))] }), _jsxs(Command.List, { className: "max-h-64 overflow-y-auto p-1", children: [_jsx(Command.Empty, { className: "py-3 text-center text-sm text-muted-foreground", children: facet.searching === true
|
|
29
30
|
? t("kumiko.combobox.loading")
|
|
30
31
|
: t("kumiko.combobox.empty") }), facet.options.map((opt) => (_jsxs(Command.Item, { value: opt.value, onSelect: () => toggle(opt.value), "data-testid": `facet-${facet.field}-${opt.value}`, className: "relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground", children: [selected.includes(opt.value) && (_jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: _jsx(Check, { className: "h-4 w-4" }) })), opt.label] }, opt.value)))] })] }) }) })] }));
|
|
31
32
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export declare const FACET_PILL_CLASSES = "h-9 rounded-full border-border-strong px-3";
|
|
3
|
+
export declare function FacetTriggerLabel({ field, label, emptyValueLabel, showEmptyValue, }: {
|
|
4
|
+
readonly field: string;
|
|
5
|
+
readonly label: string;
|
|
6
|
+
readonly emptyValueLabel: string;
|
|
7
|
+
readonly showEmptyValue: boolean;
|
|
8
|
+
}): ReactNode;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export const FACET_PILL_CLASSES = "h-9 rounded-full border-border-strong px-3";
|
|
3
|
+
// The label keeps its trailing ": " so textContent reads "Label: Value"; the button gap draws the space.
|
|
4
|
+
// A pill with nothing chosen names the facet only, like the boards ("Property ▾").
|
|
5
|
+
export function FacetTriggerLabel({ field, label, emptyValueLabel, showEmptyValue, }) {
|
|
6
|
+
if (!showEmptyValue)
|
|
7
|
+
return _jsx("span", { className: "text-muted-foreground", children: label });
|
|
8
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { className: "text-muted-foreground", children: `${label}: ` }), _jsx("span", { "data-testid": `facet-${field}-value`, className: "text-foreground", children: emptyValueLabel })] }));
|
|
9
|
+
}
|
|
@@ -8,13 +8,18 @@ export declare function FileThumbnail({ fileId, variant, className, testId, }: {
|
|
|
8
8
|
readonly className?: string;
|
|
9
9
|
readonly testId?: string;
|
|
10
10
|
}): ReactNode;
|
|
11
|
-
type FileMeta = {
|
|
11
|
+
export type FileMeta = {
|
|
12
12
|
readonly fileName: string;
|
|
13
13
|
readonly mimeType: string | undefined;
|
|
14
14
|
};
|
|
15
15
|
/** File names are per-user data and the server re-checks access per request, so
|
|
16
16
|
* the cache must not outlive the session that filled it. */
|
|
17
17
|
export declare function clearFileMetaCache(): void;
|
|
18
|
+
/** `settled` is false while the lookup runs, so "still loading" and "no meta for this id" differ. */
|
|
19
|
+
export declare function useFileMetaResult(fileId: string): {
|
|
20
|
+
readonly meta: FileMeta | null;
|
|
21
|
+
readonly settled: boolean;
|
|
22
|
+
};
|
|
18
23
|
export declare function useFileMeta(fileId: string): FileMeta | null;
|
|
19
24
|
export declare function FileNameLink({ fileId, fallbackLabel, className, }: {
|
|
20
25
|
readonly fileId: string;
|
|
@@ -31,4 +36,3 @@ export declare function FileDisplayCell({ value, display, fallbackLabel, compact
|
|
|
31
36
|
readonly fallbackLabel: string;
|
|
32
37
|
readonly compact?: boolean;
|
|
33
38
|
}): ReactNode;
|
|
34
|
-
export {};
|
|
@@ -93,7 +93,7 @@ function flushPendingMetaIds() {
|
|
|
93
93
|
}
|
|
94
94
|
function loadFileMeta(fileId) {
|
|
95
95
|
const cached = metaCache.get(fileId);
|
|
96
|
-
if (cached)
|
|
96
|
+
if (cached !== undefined)
|
|
97
97
|
return cached;
|
|
98
98
|
const promise = new Promise((resolve) => {
|
|
99
99
|
if (pendingMetaIds.size === 0)
|
|
@@ -112,23 +112,30 @@ function loadFileMeta(fileId) {
|
|
|
112
112
|
metaCache.set(fileId, promise);
|
|
113
113
|
return promise;
|
|
114
114
|
}
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
/** `settled` is false while the lookup runs, so "still loading" and "no meta for this id" differ. */
|
|
116
|
+
export function useFileMetaResult(fileId) {
|
|
117
|
+
const [result, setResult] = useState({
|
|
118
|
+
meta: null,
|
|
119
|
+
settled: false,
|
|
120
|
+
});
|
|
117
121
|
const validId = isUuid(fileId);
|
|
118
122
|
useEffect(() => {
|
|
119
123
|
let cancelled = false;
|
|
120
|
-
|
|
124
|
+
setResult({ meta: null, settled: false });
|
|
121
125
|
if (!validId)
|
|
122
126
|
return;
|
|
123
127
|
void loadFileMeta(fileId).then((loaded) => {
|
|
124
128
|
if (!cancelled)
|
|
125
|
-
|
|
129
|
+
setResult({ meta: loaded, settled: true });
|
|
126
130
|
});
|
|
127
131
|
return () => {
|
|
128
132
|
cancelled = true;
|
|
129
133
|
};
|
|
130
134
|
}, [fileId, validId]);
|
|
131
|
-
return
|
|
135
|
+
return result;
|
|
136
|
+
}
|
|
137
|
+
export function useFileMeta(fileId) {
|
|
138
|
+
return useFileMetaResult(fileId).meta;
|
|
132
139
|
}
|
|
133
140
|
export function FileNameLink({ fileId, fallbackLabel, className, }) {
|
|
134
141
|
const fileName = useFileMeta(fileId)?.fileName ?? null;
|
|
@@ -7,10 +7,11 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
7
7
|
import { ImageIcon, Loader2, Upload } from "lucide-react";
|
|
8
8
|
import { useRef, useState } from "react";
|
|
9
9
|
import { useSessionEndedSignal, useTrackFormUpload, useTranslation } from "../../index.js";
|
|
10
|
+
import { isSessionEndedCause } from "../../session/session-ended.js";
|
|
10
11
|
import { toAcceptAttr } from "../lib/accept-attr.js";
|
|
11
12
|
import { resizeImageBeforeUpload } from "../lib/resize-image.js";
|
|
12
13
|
import { uploadErrorKey } from "../lib/upload-error-key.js";
|
|
13
|
-
import {
|
|
14
|
+
import { uploadFileRef } from "../lib/upload-file-ref.js";
|
|
14
15
|
import { Button as UiButton } from "../ui/button.js";
|
|
15
16
|
import { FileNameLink, FileThumbnail } from "./file-thumbnail.js";
|
|
16
17
|
// React's input typings have no `webkitdirectory`; spreading keeps it typed-cast-free.
|
|
@@ -47,7 +48,7 @@ export function FileUploadInput({ kind, id, value, onChange, accept, disabled, e
|
|
|
47
48
|
});
|
|
48
49
|
}
|
|
49
50
|
catch (cause) {
|
|
50
|
-
if (
|
|
51
|
+
if (isSessionEndedCause(cause))
|
|
51
52
|
sessionEnded?.notify();
|
|
52
53
|
setError(t(uploadErrorKey(cause)));
|
|
53
54
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
/** "View" action for a stored file: renders only for PDFs and opens the viewer in a drawer.
|
|
3
|
+
* The MIME type comes from `useFileMeta`, so a list of rows costs one batched meta request. */
|
|
4
|
+
export declare function FileViewAction({ fileId }: {
|
|
5
|
+
readonly fileId: string;
|
|
6
|
+
}): ReactNode;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { isUuid } from "@cosmicdrift/kumiko-types/identifiers";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { useTranslation } from "../../index.js";
|
|
5
|
+
import { Button } from "../ui/button.js";
|
|
6
|
+
import { PdfPreview } from "../widgets/pdf-preview.js";
|
|
7
|
+
import { DefaultDrawer } from "./drawer.js";
|
|
8
|
+
import { fileOriginalUrl, useFileMeta } from "./file-thumbnail.js";
|
|
9
|
+
const PDF_MIME_TYPE = "application/pdf";
|
|
10
|
+
/** "View" action for a stored file: renders only for PDFs and opens the viewer in a drawer.
|
|
11
|
+
* The MIME type comes from `useFileMeta`, so a list of rows costs one batched meta request. */
|
|
12
|
+
export function FileViewAction({ fileId }) {
|
|
13
|
+
const t = useTranslation();
|
|
14
|
+
const meta = useFileMeta(fileId);
|
|
15
|
+
const [open, setOpen] = useState(false);
|
|
16
|
+
if (!isUuid(fileId) || meta?.mimeType !== PDF_MIME_TYPE)
|
|
17
|
+
return null;
|
|
18
|
+
return (_jsxs(_Fragment, { children: [_jsx(Button, { type: "button", variant: "link", size: "sm", onClick: (event) => {
|
|
19
|
+
event.stopPropagation();
|
|
20
|
+
setOpen(true);
|
|
21
|
+
}, "data-testid": `file-view-${fileId}`, children: t("kumiko.field.file-list.view") }), _jsx(DefaultDrawer, { open: open, onOpenChange: setOpen, title: meta.fileName, testId: `file-view-drawer-${fileId}`, children: _jsx("div", { className: "min-h-0 flex-1", children: _jsx(PdfPreview, { variant: "viewer", fill: true, source: { url: fileOriginalUrl(fileId) }, testId: `file-view-pdf-${fileId}` }) }) })] }));
|
|
22
|
+
}
|
|
@@ -2,11 +2,24 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
// Drop zone for a `files` / `images` field with `display: "dropzone"`: one status row per picked
|
|
3
3
|
// file, the field value is the array of FileRef ids of the files that uploaded. Failed files stay
|
|
4
4
|
// out of the value; removing a row removes its id.
|
|
5
|
+
import { isUuid } from "@cosmicdrift/kumiko-types/identifiers";
|
|
5
6
|
import { useEffect, useRef } from "react";
|
|
6
7
|
import { useSessionEndedSignal, useTrackFormUpload, useTranslation } from "../../index.js";
|
|
8
|
+
import { isSessionEndedCause } from "../../session/session-ended.js";
|
|
7
9
|
import { FileCountLimitError, uploadErrorKey } from "../lib/upload-error-key.js";
|
|
8
|
-
import {
|
|
10
|
+
import { uploadFileRef } from "../lib/upload-file-ref.js";
|
|
9
11
|
import { UploadZone } from "../widgets/upload-zone.js";
|
|
12
|
+
import { useFileMetaResult } from "./file-thumbnail.js";
|
|
13
|
+
function FileRefName({ fileId }) {
|
|
14
|
+
const t = useTranslation();
|
|
15
|
+
const { meta, settled } = useFileMetaResult(fileId);
|
|
16
|
+
// A non-UUID value has no meta to resolve; show it as is.
|
|
17
|
+
if (!isUuid(fileId))
|
|
18
|
+
return fileId;
|
|
19
|
+
if (meta)
|
|
20
|
+
return meta.fileName;
|
|
21
|
+
return settled ? t("kumiko.field.dropzone.file-unavailable") : "…";
|
|
22
|
+
}
|
|
10
23
|
export function FilesDropzoneInput({ id, value, onChange, accept, maxSize, maxCount, disabled, entityType, uploadActionForm, entityId, fieldName, testId, }) {
|
|
11
24
|
const t = useTranslation();
|
|
12
25
|
const sessionEnded = useSessionEndedSignal();
|
|
@@ -30,15 +43,13 @@ export function FilesDropzoneInput({ id, value, onChange, accept, maxSize, maxCo
|
|
|
30
43
|
}
|
|
31
44
|
uploadsRunning.current += 1;
|
|
32
45
|
try {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return fileId;
|
|
38
|
-
});
|
|
46
|
+
const fileId = await uploadFileRef(file, target);
|
|
47
|
+
latestIds.current = [...latestIds.current, fileId];
|
|
48
|
+
onChange(latestIds.current);
|
|
49
|
+
return fileId;
|
|
39
50
|
}
|
|
40
51
|
catch (cause) {
|
|
41
|
-
if (
|
|
52
|
+
if (isSessionEndedCause(cause))
|
|
42
53
|
sessionEnded?.notify();
|
|
43
54
|
throw cause;
|
|
44
55
|
}
|
|
@@ -57,5 +68,5 @@ export function FilesDropzoneInput({ id, value, onChange, accept, maxSize, maxCo
|
|
|
57
68
|
? t("kumiko.field.dropzone.limit-count", { count: maxCount })
|
|
58
69
|
: undefined,
|
|
59
70
|
].filter((part) => part !== undefined);
|
|
60
|
-
return (_jsx(UploadZone, { testId: testId ?? `${id}-dropzone`, title: t("kumiko.field.dropzone.title"), ...(limits.length > 0 && { hint: limits.join(" · ") }), ...(accept !== undefined && { accept }), ...(disabled !== undefined && { disabled }), doneValues: value, onUpload: uploadOne, onRemove: removeOne, describeError: (cause) => t(uploadErrorKey(cause), { count: maxCount }) }));
|
|
71
|
+
return (_jsx(UploadZone, { testId: testId ?? `${id}-dropzone`, title: t("kumiko.field.dropzone.title"), ...(limits.length > 0 && { hint: limits.join(" · ") }), ...(accept !== undefined && { accept }), ...(disabled !== undefined && { disabled }), doneValues: value, trackUpload: trackFormUpload, labelForValue: (fileId) => _jsx(FileRefName, { fileId: fileId }), onUpload: uploadOne, onRemove: removeOne, describeError: (cause) => t(uploadErrorKey(cause), { count: maxCount }) }));
|
|
61
72
|
}
|