@cosmicdrift/kumiko-renderer 0.416.0 → 0.418.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-body.d.ts +1 -4
- package/dist/app/action-form-body.js +14 -9
- package/dist/app/action-form-preview.d.ts +13 -0
- package/dist/app/action-form-preview.js +66 -0
- package/dist/app/action-form-support.d.ts +6 -1
- package/dist/app/action-form-support.js +26 -9
- package/dist/app/config-edit-body.js +71 -79
- package/dist/app/entity-list-screen.js +1 -1
- package/dist/app/header-actions-bar.d.ts +3 -1
- package/dist/app/header-actions-bar.js +12 -4
- package/dist/app/list-bulk-actions.d.ts +8 -1
- package/dist/app/list-bulk-actions.js +28 -4
- package/dist/app/locked-screen-header.d.ts +2 -0
- package/dist/app/locked-screen-header.js +8 -1
- package/dist/app/projection-detail-body.js +24 -5
- package/dist/app/projection-detail-guidance.d.ts +1 -0
- package/dist/app/projection-detail-guidance.js +7 -4
- package/dist/app/projection-detail-header-model.js +4 -1
- package/dist/app/projection-detail-header-region.js +25 -9
- package/dist/app/projection-detail-header.d.ts +2 -0
- package/dist/app/projection-detail-header.js +30 -3
- package/dist/app/projection-list-shim.js +1 -0
- package/dist/app/row-actions.d.ts +4 -0
- package/dist/app/row-actions.js +19 -3
- package/dist/app/use-projection-detail-actions.d.ts +3 -1
- package/dist/app/use-projection-detail-actions.js +9 -1
- package/dist/app/use-projection-detail-data.js +17 -1
- package/dist/app/use-projection-list-data.js +1 -1
- package/dist/card-options.d.ts +2 -0
- package/dist/components/choice-chip-class.d.ts +1 -0
- package/dist/components/choice-chip-class.js +9 -0
- package/dist/components/edit-mounts.d.ts +1 -1
- package/dist/components/embedded-list-paste.js +2 -2
- package/dist/components/grid-cell-for-field.js +1 -1
- package/dist/components/multi-select-chips.js +7 -2
- package/dist/components/multi-select-count.d.ts +5 -0
- package/dist/components/multi-select-count.js +10 -0
- package/dist/components/narrow-description.d.ts +3 -0
- package/dist/components/narrow-description.js +12 -0
- package/dist/components/related-list-section.d.ts +5 -3
- package/dist/components/related-list-section.js +9 -4
- package/dist/components/related-photo-grid.js +17 -3
- package/dist/components/render-edit-field-grid.d.ts +12 -3
- package/dist/components/render-edit-field-grid.js +60 -18
- package/dist/components/render-edit-fields-section.js +45 -11
- package/dist/components/render-edit-header-actions.js +1 -1
- package/dist/components/render-edit-layout.js +5 -3
- package/dist/components/render-edit-section-kinds.js +50 -12
- package/dist/components/render-edit-titles.js +1 -1
- package/dist/components/render-edit-types.d.ts +13 -0
- package/dist/components/render-field-ai-assist.js +26 -7
- package/dist/components/render-field-choice-inputs.js +3 -0
- package/dist/components/render-field-control.js +1 -1
- package/dist/components/render-field-value-chips.js +6 -4
- package/dist/components/render-field-values.js +3 -3
- package/dist/components/render-list-hint-columns.d.ts +1 -0
- package/dist/components/render-list-hint-columns.js +30 -5
- package/dist/components/render-list-reference-columns.js +2 -4
- package/dist/components/render-list-row-tone.d.ts +2 -0
- package/dist/components/render-list-row-tone.js +6 -0
- package/dist/components/render-list-table-props.d.ts +13 -2
- package/dist/components/render-list-table-props.js +9 -3
- package/dist/components/render-list-types.d.ts +4 -0
- package/dist/components/render-list.js +12 -4
- package/dist/components/use-render-list-columns.js +3 -3
- package/dist/components/write-form-registry.d.ts +13 -0
- package/dist/components/write-form-registry.js +6 -0
- package/dist/components/write-form-section.d.ts +5 -1
- package/dist/components/write-form-section.js +55 -16
- package/dist/data-table-bulk-types.d.ts +11 -2
- package/dist/data-table-bulk-types.js +3 -1
- package/dist/headless/form/form-controller.d.ts +2 -0
- package/dist/headless/form/form-controller.js +2 -2
- package/dist/headless/format/index.d.ts +1 -1
- package/dist/headless/format/index.js +6 -5
- package/dist/headless/format/money.d.ts +5 -0
- package/dist/headless/format/money.js +10 -0
- package/dist/headless/format/relative-time.d.ts +2 -0
- package/dist/headless/format/relative-time.js +4 -1
- package/dist/headless/index.d.ts +1 -1
- package/dist/headless/index.js +1 -1
- package/dist/headless/view-model/edit.js +87 -37
- package/dist/headless/view-model/list.js +6 -0
- package/dist/headless/view-model/types.d.ts +50 -5
- package/dist/hooks/use-bulk-run.d.ts +2 -2
- package/dist/hooks/use-list-table.js +11 -6
- package/dist/i18n-defaults.js +8 -2
- package/dist/primitives-record-guidance.d.ts +4 -0
- package/dist/primitives-share-types.d.ts +82 -0
- package/dist/primitives-share-types.js +1 -0
- package/dist/primitives.d.ts +34 -83
- package/dist/web/app/bold-markup.d.ts +3 -0
- package/dist/web/app/bold-markup.js +14 -0
- package/dist/web/app/dashboard-body.js +5 -1
- package/dist/web/app/dashboard-list-panel.js +7 -4
- package/dist/web/app/dashboard-panels.js +31 -3
- package/dist/web/app/dashboard-shared.d.ts +3 -1
- package/dist/web/app/dashboard-shared.js +3 -3
- package/dist/web/app/dashboard-stat-group-panel.d.ts +1 -1
- package/dist/web/app/dashboard-stat-group-panel.js +16 -2
- package/dist/web/app/dashboard-text-panel.js +11 -6
- package/dist/web/app/relative-time.js +10 -1
- package/dist/web/components/config-cascade.d.ts +2 -1
- package/dist/web/components/config-cascade.js +16 -4
- package/dist/web/drawn-icons.js +2 -1
- package/dist/web/layout/header-action-pinned.d.ts +4 -2
- package/dist/web/layout/header-action-pinned.js +13 -4
- package/dist/web/layout/header-overflow-menu.d.ts +2 -0
- package/dist/web/layout/header-overflow-menu.js +2 -0
- package/dist/web/layout/nav-tree.js +1 -1
- package/dist/web/layout/notification-bell.js +13 -4
- 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.js +4 -1
- package/dist/web/layout/shell-header.js +15 -7
- package/dist/web/primitives/banner.js +14 -3
- package/dist/web/primitives/card.js +5 -3
- package/dist/web/primitives/combobox.js +2 -2
- package/dist/web/primitives/data-table/actions-column.js +1 -1
- package/dist/web/primitives/data-table/card-body.d.ts +1 -1
- package/dist/web/primitives/data-table/card-body.js +37 -14
- package/dist/web/primitives/data-table/card-frame.d.ts +2 -0
- package/dist/web/primitives/data-table/card-frame.js +3 -0
- package/dist/web/primitives/data-table/card-row.js +28 -9
- package/dist/web/primitives/data-table/card-sort-select.js +1 -1
- package/dist/web/primitives/data-table/card-view.js +1 -1
- package/dist/web/primitives/data-table/data-cell-props.d.ts +2 -1
- package/dist/web/primitives/data-table/data-cell-props.js +1 -0
- package/dist/web/primitives/data-table/density.d.ts +3 -1
- package/dist/web/primitives/data-table/density.js +11 -4
- package/dist/web/primitives/data-table/row-render-parts.d.ts +1 -1
- package/dist/web/primitives/data-table/row-render-parts.js +3 -5
- package/dist/web/primitives/data-table/sort-options-select.js +2 -2
- package/dist/web/primitives/data-table/sortable-header.js +4 -4
- package/dist/web/primitives/data-table/table-body.js +2 -1
- package/dist/web/primitives/data-table/table-chrome.js +1 -3
- package/dist/web/primitives/data-table/table-content.js +7 -11
- package/dist/web/primitives/data-table/table-data-cell.js +31 -17
- package/dist/web/primitives/data-table/table-header-row.js +1 -1
- package/dist/web/primitives/data-table/table-view.js +1 -1
- package/dist/web/primitives/data-table/toolbar.js +6 -7
- package/dist/web/primitives/data-table/use-bulk-selection.d.ts +1 -1
- package/dist/web/primitives/data-table/use-bulk-selection.js +5 -0
- package/dist/web/primitives/data-table/use-data-table-state.d.ts +6 -1
- package/dist/web/primitives/data-table/use-data-table-state.js +12 -2
- package/dist/web/primitives/data-table-cell.d.ts +13 -2
- package/dist/web/primitives/data-table-cell.js +125 -53
- package/dist/web/primitives/data-table.js +1 -1
- package/dist/web/primitives/default-form.d.ts +1 -1
- package/dist/web/primitives/default-form.js +11 -10
- package/dist/web/primitives/drawer.js +2 -7
- package/dist/web/primitives/facet-filter.d.ts +1 -1
- package/dist/web/primitives/facet-filter.js +2 -5
- package/dist/web/primitives/facet-search-filter.js +1 -1
- package/dist/web/primitives/facet-trigger-label.d.ts +1 -4
- package/dist/web/primitives/facet-trigger-label.js +4 -7
- package/dist/web/primitives/field.js +15 -8
- package/dist/web/primitives/form-footer-parts.js +2 -2
- package/dist/web/primitives/inline-suffix.d.ts +2 -0
- package/dist/web/primitives/inline-suffix.js +5 -0
- package/dist/web/primitives/input-choice-kinds.js +12 -2
- package/dist/web/primitives/input-number-kinds.js +2 -2
- package/dist/web/primitives/input-text-kinds.js +1 -1
- package/dist/web/primitives/layout-elements.d.ts +4 -4
- package/dist/web/primitives/layout-elements.js +49 -12
- package/dist/web/primitives/layout.d.ts +1 -1
- package/dist/web/primitives/layout.js +1 -1
- package/dist/web/primitives/metric.js +4 -5
- package/dist/web/primitives/money-input.js +8 -7
- package/dist/web/primitives/number-input.d.ts +2 -1
- package/dist/web/primitives/number-input.js +9 -4
- 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 +12 -21
- package/dist/web/primitives/photo-grid.js +2 -1
- package/dist/web/primitives/record-steps.d.ts +1 -1
- package/dist/web/primitives/record-steps.js +6 -15
- package/dist/web/primitives/row-actions.js +38 -24
- package/dist/web/primitives/use-container-narrow.d.ts +12 -0
- package/dist/web/primitives/use-container-narrow.js +42 -0
- package/dist/web/pwa/pwa-support.js +13 -7
- package/dist/web/ui/input.js +1 -1
- package/dist/web/ui/textarea.js +1 -1
- package/dist/web/widgets/dashboard-list-cards.js +6 -3
- package/dist/web/widgets/dashboard-list.d.ts +4 -1
- package/dist/web/widgets/dashboard-list.js +10 -5
- package/dist/web/widgets/progress-list.js +1 -1
- package/dist/web/widgets/stat-box-cell.js +1 -1
- package/package.json +5 -5
- package/src/changes.json +51 -0
- package/src/web/styles.css +3 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EditFieldSpec, EditSectionSpec, EmbeddedDerivedCellDef, FieldAffix, FieldAiAssist, FieldCondition, FieldFillAction, FieldIconKey, FieldRenderer, FieldValueChips, IconKey, ListBulkAction, ListColumnSpec, ListFacetSpec, ListSortSpec, ListTableOptions, OptionsQueryPayload, PlatformComponent, RelatedListEmptyStateVariant, RelatedListRowTone, RelatedListToolbarAction, RowAction, RowActionMode, ScreenSlots, SelectOptionTone } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
1
|
+
import type { EditFieldSpec, EditSectionSpec, EmbeddedDerivedCellDef, FieldAffix, FieldAiAssist, FieldBadge, FieldCondition, FieldFillAction, FieldIconKey, FieldRenderer, FieldValueChips, IconKey, ListBulkAction, ListColumnSpec, ListFacetSpec, ListSortSpec, ListTableOptions, OptionsQueryPayload, PlatformComponent, RelatedListEmptyStateVariant, RelatedListRowTone, RelatedListToolbarAction, RowAction, RowActionMode, ScreenSlots, SelectOptionTone } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
2
|
export type RuntimeRenderer = (value: unknown, row?: Readonly<Record<string, unknown>>) => string;
|
|
3
3
|
/** Where a cell's text links to. `href` comes from NavApi.hrefFor (new-tab and
|
|
4
4
|
* copy-link work); `onPress` is the in-app navigation for a plain click. */
|
|
@@ -58,6 +58,8 @@ export type ListColumnViewModel = {
|
|
|
58
58
|
readonly highlighted?: boolean;
|
|
59
59
|
/** Mirrors `ListColumnSpec.hideOnNarrow`: card layout skips the column. */
|
|
60
60
|
readonly hideOnNarrow?: boolean;
|
|
61
|
+
/** Mirrors `ListColumnSpec.hideWhenDocked`: a table in a narrow container skips the column. */
|
|
62
|
+
readonly hideWhenDocked?: true;
|
|
61
63
|
/** Mirrors `ListColumnSpec.showOnNarrowOnly`: the table layout skips the column. */
|
|
62
64
|
readonly showOnNarrowOnly?: boolean;
|
|
63
65
|
/** Mirrors `ListColumnSpec.narrowInline`: the card draws consecutive such columns on one line. */
|
|
@@ -85,8 +87,22 @@ export type ListColumnViewModel = {
|
|
|
85
87
|
readonly pillField?: string;
|
|
86
88
|
/** Row field naming the pill tone. */
|
|
87
89
|
readonly pillToneField?: string;
|
|
88
|
-
/**
|
|
89
|
-
readonly emptyPlaceholder?: false;
|
|
90
|
+
/** An empty cell stays blank; a string is shown muted in its place. */
|
|
91
|
+
readonly emptyPlaceholder?: string | false;
|
|
92
|
+
/** Mirrors `ListColumnSpec.ellipsis`: one line, cut with an ellipsis. */
|
|
93
|
+
readonly ellipsis?: true;
|
|
94
|
+
/** Mirrors `ListColumnSpec.multiline`: `\n` in the value breaks the line. */
|
|
95
|
+
readonly multiline?: true;
|
|
96
|
+
/** Mirrors `ListColumnSpec.cardAbove`. */
|
|
97
|
+
readonly cardAbove?: true;
|
|
98
|
+
/** Mirrors `ListColumnSpec.emphasis`: medium weight, foreground colour. */
|
|
99
|
+
readonly emphasis?: true;
|
|
100
|
+
/** Mirrors `ListColumnSpec.tone`. */
|
|
101
|
+
readonly tone?: "muted";
|
|
102
|
+
/** Mirrors `ListColumnSpec.cardBadge`. */
|
|
103
|
+
readonly cardBadge?: true;
|
|
104
|
+
/** Mirrors `ListColumnSpec.dateOnlyAfterDays`. */
|
|
105
|
+
readonly dateOnlyAfterDays?: number;
|
|
90
106
|
};
|
|
91
107
|
export type ListColumnCellDisplay = "badge" | "button";
|
|
92
108
|
export type ListColumnHintViewModel = {
|
|
@@ -191,7 +207,7 @@ export type EditFieldViewModel = {
|
|
|
191
207
|
* toggle instead of the default combobox dropdown. Set for
|
|
192
208
|
* `type: "select"` when SelectFieldDef.display is "radio" or "dropdown" —
|
|
193
209
|
* the renderer then skips its own radio-vs-dropdown heuristic. */
|
|
194
|
-
readonly display?: "checkboxes" | "chips" | "dropdown" | "radio";
|
|
210
|
+
readonly display?: "checkboxes" | "chips" | "dropdown" | "radio" | "count";
|
|
195
211
|
/** `type: "select"` only: tone per option, shown on the selected radio segment. */
|
|
196
212
|
readonly optionTones?: Readonly<Partial<Record<string, SelectOptionTone>>>;
|
|
197
213
|
/** Set for `type: "multiSelect"` when MultiSelectFieldDef.columns is
|
|
@@ -297,6 +313,14 @@ export type EditFieldViewModel = {
|
|
|
297
313
|
readonly aiAssist?: FieldAiAssist;
|
|
298
314
|
/** From EditFieldSpec.valueChips. */
|
|
299
315
|
readonly valueChips?: FieldValueChips;
|
|
316
|
+
/** From EditFieldSpec.concealed. */
|
|
317
|
+
readonly concealed?: true;
|
|
318
|
+
/** From EditFieldSpec.badge, a fixed `label` already translated. */
|
|
319
|
+
readonly badge?: FieldBadge;
|
|
320
|
+
/** From EditFieldSpec.hintField. */
|
|
321
|
+
readonly hintField?: string;
|
|
322
|
+
/** From EditFieldSpec.hideOnNarrow. */
|
|
323
|
+
readonly hideOnNarrow?: true;
|
|
300
324
|
/** Only set for an embedded-LIST field (`multiple: true`) — the per-cell
|
|
301
325
|
* metadata the renderer needs to draw each column/cell. Absent for a
|
|
302
326
|
* plain (non-list) embedded field. */
|
|
@@ -339,7 +363,16 @@ export type EditFieldViewModel = {
|
|
|
339
363
|
readonly field: string;
|
|
340
364
|
};
|
|
341
365
|
};
|
|
342
|
-
|
|
366
|
+
/** Presentation options copied from `EditSectionPresentation` onto every section view model. */
|
|
367
|
+
export type EditSectionPresentationViewModel = {
|
|
368
|
+
readonly titleOnNarrow?: false;
|
|
369
|
+
/** Translated `tabLabel`. */
|
|
370
|
+
readonly tabLabel?: string;
|
|
371
|
+
readonly after?: PlatformComponent;
|
|
372
|
+
readonly hideOnNarrow?: true;
|
|
373
|
+
readonly showOnNarrowOnly?: true;
|
|
374
|
+
};
|
|
375
|
+
export type EditSectionViewModel = (EditFieldsSectionViewModel | EditExtensionSectionViewModel | EditRelatedListSectionViewModel | EditWriteFormSectionViewModel | EditStepListSectionViewModel) & EditSectionPresentationViewModel;
|
|
343
376
|
export type EditFieldsSectionViewModel = {
|
|
344
377
|
readonly kind: "fields";
|
|
345
378
|
/** From `EditFieldsSection.id`. The boot-validator makes it mandatory under
|
|
@@ -359,6 +392,8 @@ export type EditFieldsSectionViewModel = {
|
|
|
359
392
|
/** Translated help text under the block heading, from
|
|
360
393
|
* `EditFieldsSection.description`. Renders even without `title`. */
|
|
361
394
|
readonly description?: string;
|
|
395
|
+
/** Translated `EditFieldsSection.descriptionNarrow`. */
|
|
396
|
+
readonly descriptionNarrow?: string;
|
|
362
397
|
/** Translated `EditFieldsSection.subtitle` (wizard step rail / up-next box). */
|
|
363
398
|
readonly subtitle?: string;
|
|
364
399
|
/** Translated `EditFieldsSection.upNextHint`. */
|
|
@@ -366,12 +401,16 @@ export type EditFieldsSectionViewModel = {
|
|
|
366
401
|
/** From `EditFieldsSection.summaryField` (wizard step rail). */
|
|
367
402
|
readonly summaryField?: string;
|
|
368
403
|
readonly columns: number;
|
|
404
|
+
/** True when the author declared `columns` (section or group); only then may a read-only
|
|
405
|
+
* section draw a label/value grid. */
|
|
406
|
+
readonly columnsDeclared?: true;
|
|
369
407
|
readonly fields: readonly EditFieldViewModel[];
|
|
370
408
|
/** From `EditFieldsSection.groups` — each entry's `fields` are the same
|
|
371
409
|
* view-model objects as `fields` above, re-grouped (not recomputed). */
|
|
372
410
|
readonly groups?: readonly {
|
|
373
411
|
readonly title: string;
|
|
374
412
|
readonly columns: number;
|
|
413
|
+
readonly columnsDeclared?: true;
|
|
375
414
|
readonly fields: readonly EditFieldViewModel[];
|
|
376
415
|
}[];
|
|
377
416
|
/** From `EditFieldsSection.icon` — closed IconKey vocabulary, renders
|
|
@@ -451,6 +490,8 @@ export type EditRelatedListSectionViewModel = {
|
|
|
451
490
|
readonly photoGrid?: {
|
|
452
491
|
readonly imageField: string;
|
|
453
492
|
readonly captionField?: string;
|
|
493
|
+
readonly badgeField?: string;
|
|
494
|
+
readonly badgeFirst?: true;
|
|
454
495
|
};
|
|
455
496
|
/** From `EditRelatedListSection.emptyState` — forwarded to the
|
|
456
497
|
* DataTable's `emptyState` prop when the section has zero rows. */
|
|
@@ -465,11 +506,15 @@ export type EditWriteFormSectionViewModel = {
|
|
|
465
506
|
readonly kind: "writeForm";
|
|
466
507
|
readonly title?: string;
|
|
467
508
|
readonly description?: string;
|
|
509
|
+
/** Translated `EditWriteFormSection.descriptionNarrow`. */
|
|
510
|
+
readonly descriptionNarrow?: string;
|
|
468
511
|
readonly columns: number;
|
|
469
512
|
readonly fields: readonly EditFieldViewModel[];
|
|
470
513
|
readonly icon?: IconKey;
|
|
471
514
|
readonly handler: string;
|
|
472
515
|
readonly submitLabel?: string;
|
|
516
|
+
/** From `EditWriteFormSection.submitWith`. */
|
|
517
|
+
readonly submitWith?: string;
|
|
473
518
|
/** From `EditWriteFormSection.actions`. */
|
|
474
519
|
readonly actions?: readonly RowAction[];
|
|
475
520
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DataTableBulkWriteAction } from "../data-table-bulk-types.ts";
|
|
2
2
|
import type { ListRowViewModel } from "../headless/index.ts";
|
|
3
3
|
/** Parallel row writes of one run; more would crowd out the list's own requests. */
|
|
4
4
|
export declare const BULK_WRITE_CONCURRENCY = 4;
|
|
@@ -10,7 +10,7 @@ export type BulkRunResult = {
|
|
|
10
10
|
readonly notStartedIds: readonly string[];
|
|
11
11
|
readonly firstFailureMessage?: string;
|
|
12
12
|
};
|
|
13
|
-
type BulkRunAction = Pick<
|
|
13
|
+
type BulkRunAction = Pick<DataTableBulkWriteAction, "appliesTo" | "writeRow">;
|
|
14
14
|
/** One write per row, at most `concurrency` at a time. Cancel stops new writes; running ones finish. */
|
|
15
15
|
export declare function runBulkWrites({ rows, action, isCancelled, onRowSettled, concurrency, }: {
|
|
16
16
|
readonly rows: readonly ListRowViewModel[];
|
|
@@ -29,18 +29,23 @@ export function useListTable({ storeKey, table, schemaColumns, url, local, expor
|
|
|
29
29
|
store.write(storeKey, kept);
|
|
30
30
|
}, [nav, urlParams, urlScreenId, localReset, store, storeKey]);
|
|
31
31
|
const resetAll = useMemo(() => (options.resetAll === true ? { active: !atDefault, onReset } : undefined), [options.resetAll, atDefault, onReset]);
|
|
32
|
+
// Without a column picker a hidden column only backs a facet: it stays out of the table, and
|
|
33
|
+
// leaving out onColumnsChange keeps the view menu closed.
|
|
34
|
+
const fixedColumns = useMemo(() => schemaColumns.some((column) => column.hidden === true)
|
|
35
|
+
? schemaColumns.map((column) => ({ field: column.field, visible: column.hidden !== true }))
|
|
36
|
+
: undefined, [schemaColumns]);
|
|
32
37
|
const hasView = options.columnPicker === true ||
|
|
33
38
|
options.density !== undefined ||
|
|
34
39
|
options.pinning === true ||
|
|
35
40
|
options.resizing === true ||
|
|
36
41
|
options.keyboardNavigation === true ||
|
|
37
|
-
viewState.groupByFields !== undefined
|
|
42
|
+
viewState.groupByFields !== undefined ||
|
|
43
|
+
fixedColumns !== undefined;
|
|
38
44
|
const view = useMemo(() => hasView
|
|
39
45
|
? {
|
|
40
|
-
...(viewState.columns !== undefined
|
|
41
|
-
columns: viewState.columns,
|
|
42
|
-
|
|
43
|
-
}),
|
|
46
|
+
...(viewState.columns !== undefined
|
|
47
|
+
? { columns: viewState.columns, onColumnsChange: viewState.setColumns }
|
|
48
|
+
: fixedColumns !== undefined && { columns: fixedColumns }),
|
|
44
49
|
density: viewState.density,
|
|
45
50
|
...(viewState.userChoosesDensity && { onDensityChange: viewState.setDensity }),
|
|
46
51
|
...(viewState.pins !== undefined && {
|
|
@@ -64,7 +69,7 @@ export function useListTable({ storeKey, table, schemaColumns, url, local, expor
|
|
|
64
69
|
viewIsDefault: viewState.viewIsDefault,
|
|
65
70
|
onViewReset: viewState.resetView,
|
|
66
71
|
}
|
|
67
|
-
: undefined, [hasView, viewState, options.keyboardNavigation]);
|
|
72
|
+
: undefined, [hasView, viewState, fixedColumns, options.keyboardNavigation]);
|
|
68
73
|
const exportEnabled = options.export?.xlsx === true;
|
|
69
74
|
const viewColumns = viewState.columns;
|
|
70
75
|
const exportList = useMemo(() => {
|
package/dist/i18n-defaults.js
CHANGED
|
@@ -156,14 +156,19 @@ export const kumikoDefaultTranslations = {
|
|
|
156
156
|
"kumiko.reference.system-user": "System",
|
|
157
157
|
"kumiko.reference.unknown-user": "Unknown",
|
|
158
158
|
"kumiko.pager.status": "{from}–{to} of {total}",
|
|
159
|
-
"kumiko.pager.
|
|
159
|
+
"kumiko.pager.statusEmpty": "0 of 0",
|
|
160
160
|
"kumiko.form.all-required": "All fields are required.",
|
|
161
161
|
"kumiko.pager.pageSize": "{size} per page",
|
|
162
|
+
"kumiko.pager.pageOf": "Page {page} of {total}",
|
|
163
|
+
"kumiko.time.justNow": "just now",
|
|
164
|
+
"kumiko.writeForm.unavailable": "This form is not open here. Open its tab first.",
|
|
165
|
+
"kumiko.writeForm.invalid": "Please check: {fields}",
|
|
162
166
|
"kumiko.pager.pageSizeLabel": "Entries per page",
|
|
163
167
|
"kumiko.list.count.noun": "{count} {noun}",
|
|
164
168
|
"kumiko.list.count.one": "1 entry",
|
|
165
169
|
"kumiko.list.count.other": "{count} entries",
|
|
166
170
|
"kumiko.list.row-actions.more": "More actions",
|
|
171
|
+
"kumiko.photo-grid.fallback-caption": "Photo {n}",
|
|
167
172
|
"kumiko.page-header.actions": "Page actions",
|
|
168
173
|
"kumiko.list.actions": "Actions",
|
|
169
174
|
"kumiko.sidebar.toggle": "Toggle sidebar",
|
|
@@ -177,6 +182,7 @@ export const kumikoDefaultTranslations = {
|
|
|
177
182
|
"kumiko.list.row.collapse": "Collapse {title}",
|
|
178
183
|
"kumiko.list.row.expand": "Expand {title}",
|
|
179
184
|
"kumiko.list.bulk.selected": "{count} selected",
|
|
185
|
+
"kumiko.form.selection-count": "{count} selected",
|
|
180
186
|
"kumiko.list.bulk.clear": "Clear selection",
|
|
181
187
|
"kumiko.list.bulk.limit": "At most {max} rows per selection",
|
|
182
188
|
"kumiko.list.bulk.select-all": "Select all rows on this page",
|
|
@@ -193,7 +199,7 @@ export const kumikoDefaultTranslations = {
|
|
|
193
199
|
"kumiko.list.bulk.result.dismiss": "Dismiss",
|
|
194
200
|
"kumiko.list.sort.by": "Sorted by {column}",
|
|
195
201
|
"kumiko.list.sort.prefix": "Sorted by",
|
|
196
|
-
"kumiko.list.sort.summary": "Sorted by {sort} {direction}
|
|
202
|
+
"kumiko.list.sort.summary": "Sorted by {sort} {direction}",
|
|
197
203
|
"kumiko.form.changed": "changed",
|
|
198
204
|
"kumiko.form.on-this-page": "On this page",
|
|
199
205
|
"kumiko.form.noUnsavedChanges": "No unsaved changes",
|
|
@@ -27,6 +27,10 @@ export type PhotoGridProps = {
|
|
|
27
27
|
/** FileRef id of the image; a tile without one shows a placeholder. */
|
|
28
28
|
readonly imageId?: string;
|
|
29
29
|
readonly caption?: string;
|
|
30
|
+
/** Short text shown as a warn badge on the image's top left. */
|
|
31
|
+
readonly badge?: string;
|
|
32
|
+
/** Moves the tile to the front on a phone (below `sm`); the DOM order stays. */
|
|
33
|
+
readonly leadsOnNarrow?: true;
|
|
30
34
|
readonly actions?: ReactNode;
|
|
31
35
|
}[];
|
|
32
36
|
readonly testId?: string;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/** One revealed value on a `secretMint` screen's confirm phase. */
|
|
3
|
+
export type SecretRevealValue = {
|
|
4
|
+
readonly label: string;
|
|
5
|
+
readonly value: string;
|
|
6
|
+
readonly copyable: boolean;
|
|
7
|
+
readonly multiline: boolean;
|
|
8
|
+
/** Render `value` as a scannable QR code instead of monospaced text — for
|
|
9
|
+
* an otpauth://-style enrollment URI. Platforms without a QR-capable
|
|
10
|
+
* SecretReveal primitive fall back to the monospaced display. */
|
|
11
|
+
readonly qr?: boolean;
|
|
12
|
+
};
|
|
13
|
+
/** One-time secret reveal — mint-form confirm phase. Renders each value
|
|
14
|
+
* monospaced (multiline splits it one line per entry, for recovery codes),
|
|
15
|
+
* with a per-value copy control when `copyable`. */
|
|
16
|
+
export type SecretRevealProps = {
|
|
17
|
+
readonly values: readonly SecretRevealValue[];
|
|
18
|
+
readonly copyLabel: string;
|
|
19
|
+
readonly copiedLabel: string;
|
|
20
|
+
readonly testId?: string;
|
|
21
|
+
};
|
|
22
|
+
/** Thumb-reach action row for custom screens: pinned to the bottom edge on
|
|
23
|
+
* narrow viewports (above the device's safe-area inset), inline otherwise.
|
|
24
|
+
* `children` are the forward actions and share the remaining width; `back`
|
|
25
|
+
* renders an icon-only back control in front of them. */
|
|
26
|
+
export type StickyActionBarProps = {
|
|
27
|
+
readonly children: ReactNode;
|
|
28
|
+
readonly back?: {
|
|
29
|
+
readonly onBack: () => void;
|
|
30
|
+
readonly label: string;
|
|
31
|
+
};
|
|
32
|
+
readonly testId?: string;
|
|
33
|
+
};
|
|
34
|
+
/** Copies `text` to the clipboard; the label flips to `copiedLabel` once
|
|
35
|
+
* the platform confirmed the write. */
|
|
36
|
+
export type CopyButtonProps = {
|
|
37
|
+
readonly text: string;
|
|
38
|
+
readonly label: string;
|
|
39
|
+
readonly copiedLabel: string;
|
|
40
|
+
readonly variant?: "primary" | "secondary";
|
|
41
|
+
/** Layout extras, merged via cn(). */
|
|
42
|
+
readonly className?: string;
|
|
43
|
+
readonly testId?: string;
|
|
44
|
+
};
|
|
45
|
+
/** Hands `text` to another app. "whatsapp" opens a WhatsApp chat prefilled
|
|
46
|
+
* with the text (to `phone` when given, otherwise the contact picker);
|
|
47
|
+
* "system" opens the platform share sheet and renders nothing where the
|
|
48
|
+
* platform has none. */
|
|
49
|
+
export type ShareButtonProps = {
|
|
50
|
+
readonly text: string;
|
|
51
|
+
readonly label: string;
|
|
52
|
+
readonly variant?: "primary" | "secondary";
|
|
53
|
+
/** Layout extras, merged via cn(). */
|
|
54
|
+
readonly className?: string;
|
|
55
|
+
readonly testId?: string;
|
|
56
|
+
} & ({
|
|
57
|
+
readonly target: "whatsapp";
|
|
58
|
+
readonly phone?: string;
|
|
59
|
+
} | {
|
|
60
|
+
readonly target: "system";
|
|
61
|
+
readonly title?: string;
|
|
62
|
+
readonly url?: string;
|
|
63
|
+
});
|
|
64
|
+
export type PromoPanelAction = {
|
|
65
|
+
readonly label: string;
|
|
66
|
+
readonly href: string;
|
|
67
|
+
readonly testId?: string;
|
|
68
|
+
} | {
|
|
69
|
+
readonly label: string;
|
|
70
|
+
readonly onClick: () => void;
|
|
71
|
+
readonly testId?: string;
|
|
72
|
+
};
|
|
73
|
+
/** Offer surface for upsells (e.g. "create an account"): its own tinted
|
|
74
|
+
* panel with eyebrow, headline, benefit content and one call to action, so
|
|
75
|
+
* an offer never reads like an info or error banner. */
|
|
76
|
+
export type PromoPanelProps = {
|
|
77
|
+
readonly title: string;
|
|
78
|
+
readonly eyebrow?: string;
|
|
79
|
+
readonly children?: ReactNode;
|
|
80
|
+
readonly action?: PromoPanelAction;
|
|
81
|
+
readonly testId?: string;
|
|
82
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/primitives.d.ts
CHANGED
|
@@ -118,8 +118,9 @@ export type BannerProps = {
|
|
|
118
118
|
* notice (e.g. secretMint's "this is shown only once"), "primary" for a call-to-action
|
|
119
119
|
* notice (neutral background, accent in the primary color; pair it with `title` and
|
|
120
120
|
* `actions`), "hint" for a quiet aside on a muted background (e.g. per-entry results of a
|
|
121
|
-
* submit, with an "Open" link in `actions`), "ok" for a completed state (e.g. "Done")
|
|
122
|
-
|
|
121
|
+
* submit, with an "Open" link in `actions`), "ok" for a completed state (e.g. "Done"),
|
|
122
|
+
* "assist" for an AI hint: soft primary surface, primary text, no border. */
|
|
123
|
+
readonly variant?: "error" | "info" | "loading" | "warning" | "primary" | "hint" | "ok" | "assist";
|
|
123
124
|
/** Title and text run on one line (text right behind the bold title); the text is dropped below sm, so a phone shows title and actions only. */
|
|
124
125
|
readonly inline?: boolean;
|
|
125
126
|
/** "compact" is one line: the title reads inline before the text. */
|
|
@@ -703,6 +704,8 @@ export type DataTableProps = {
|
|
|
703
704
|
readonly rows: readonly ListRowViewModel[];
|
|
704
705
|
/** Tints a row. Renderers without row tinting ignore it. */
|
|
705
706
|
readonly rowTone?: (row: ListRowViewModel) => SelectOptionTone | undefined;
|
|
707
|
+
/** Draws the whole row in the muted text colour. */
|
|
708
|
+
readonly rowMuted?: (row: ListRowViewModel) => boolean;
|
|
706
709
|
readonly onRowClick?: (row: ListRowViewModel) => void;
|
|
707
710
|
/** Current sorting, or null when unsorted. If columns contain a
|
|
708
711
|
* `sortable: true` field and `onSortChange` is set, the renderer makes
|
|
@@ -822,6 +825,11 @@ export type DataTableProps = {
|
|
|
822
825
|
* Default false: unchanged document-flow table that grows with its
|
|
823
826
|
* content, pager below the last row. */
|
|
824
827
|
readonly scrollBody?: boolean;
|
|
828
|
+
/** Drops the "n entries" footer of a `scrollBody` table (a pager stays). */
|
|
829
|
+
readonly hideCountFooter?: boolean;
|
|
830
|
+
/** Phone cards as a plain feed: no sort line, the above-title meta joined with commas, the last meta line in
|
|
831
|
+
* the text colour. Default false. */
|
|
832
|
+
readonly plainPhoneCards?: boolean;
|
|
825
833
|
/** Uses the shared screen padding (wider bottom inset) instead of the
|
|
826
834
|
* table's symmetric embedded inset — for a table that IS the screen body
|
|
827
835
|
* (entityList/projectionList), so a list screen ends at the same footer
|
|
@@ -919,6 +927,8 @@ export type FormProps = {
|
|
|
919
927
|
readonly title: string;
|
|
920
928
|
readonly subtitle?: string;
|
|
921
929
|
};
|
|
930
|
+
/** Rendered above everything else in the form body (above `summary`), e.g. the submit error. */
|
|
931
|
+
readonly topBanner?: ReactNode;
|
|
922
932
|
/** Titled sections for the "on this page" navigation next to a
|
|
923
933
|
* `screenForm`. The web impl shows it only with three or more entries. */
|
|
924
934
|
readonly sectionNav?: readonly FormSectionNavItem[];
|
|
@@ -954,6 +964,14 @@ export type SectionProps = {
|
|
|
954
964
|
* deletion, restrict processing) — border color only, no content change.
|
|
955
965
|
* Default "default" (normal card border). */
|
|
956
966
|
readonly variant?: "default" | "destructive";
|
|
967
|
+
/** "label": the title is a small uppercase muted label and the section has no separator line above it. Default "heading". */
|
|
968
|
+
readonly titleStyle?: "heading" | "label";
|
|
969
|
+
/** Small muted note under the section content on `sm` and up, above it on a phone. `textNarrow` is the phone wording; without it the first sentence is bold. */
|
|
970
|
+
readonly hint?: {
|
|
971
|
+
readonly text: string;
|
|
972
|
+
readonly textNarrow?: string;
|
|
973
|
+
readonly testId: string;
|
|
974
|
+
};
|
|
957
975
|
readonly testId?: string;
|
|
958
976
|
/** Rendered left of the title, `text-muted-foreground`, same optical
|
|
959
977
|
* size as the title. No effect without a `title` — an icon alone would
|
|
@@ -1009,6 +1027,8 @@ export type GridProps = {
|
|
|
1009
1027
|
readonly ariaLabelledBy?: string;
|
|
1010
1028
|
/** With `columns: "auto"`: the small gap of a chip row instead of the tile gap. */
|
|
1011
1029
|
readonly tight?: boolean;
|
|
1030
|
+
/** Read-only label/value facts: a true `columns`-wide grid with a tight gap, at most 2 columns below `sm`. Wins over `flow`. */
|
|
1031
|
+
readonly facts?: boolean;
|
|
1012
1032
|
};
|
|
1013
1033
|
/** Width class of a field cell inside a `flow` grid: sized by what the field holds. */
|
|
1014
1034
|
export type FieldCellWidth = "text" | "number" | "money" | "date" | "timestamp" | "select" | "full" | "toggle";
|
|
@@ -1018,6 +1038,8 @@ export type GridCellProps = {
|
|
|
1018
1038
|
readonly span?: number;
|
|
1019
1039
|
/** Only read inside a `flow` grid. */
|
|
1020
1040
|
readonly width?: FieldCellWidth;
|
|
1041
|
+
/** Hidden below the `sm` breakpoint. */
|
|
1042
|
+
readonly hideOnNarrow?: boolean;
|
|
1021
1043
|
readonly children: ReactNode;
|
|
1022
1044
|
};
|
|
1023
1045
|
/** Semantic text. Variants map to standard typography roles: `body` is
|
|
@@ -1029,6 +1051,10 @@ export type TextProps = {
|
|
|
1029
1051
|
readonly variant?: "body" | "small" | "code" | "required-mark" | "muted";
|
|
1030
1052
|
/** Pure ornament (e.g. a separator glyph): hidden from assistive tech. */
|
|
1031
1053
|
readonly decorative?: boolean;
|
|
1054
|
+
/** A value the viewer may not see: drawn muted with a lock icon before it. */
|
|
1055
|
+
readonly concealed?: boolean;
|
|
1056
|
+
/** Phone wording: `children` show from `sm` up, this text below it. */
|
|
1057
|
+
readonly narrow?: string;
|
|
1032
1058
|
readonly children: ReactNode;
|
|
1033
1059
|
readonly testId?: string;
|
|
1034
1060
|
};
|
|
@@ -1158,6 +1184,8 @@ export type ConfigCascadeViewProps = {
|
|
|
1158
1184
|
/** Display form of a level value (e.g. a select's label instead of its raw
|
|
1159
1185
|
* value). Absent = the raw value; a missing value keeps the no-value text. */
|
|
1160
1186
|
readonly renderValue?: (value: string | number | boolean) => ReactNode;
|
|
1187
|
+
/** Origin shown as an info icon with a tooltip instead of text lines; the level disclosure is dropped. */
|
|
1188
|
+
readonly compact?: boolean;
|
|
1161
1189
|
};
|
|
1162
1190
|
/** Card slots are named content regions, all optional. Adding slots is
|
|
1163
1191
|
* additive, so consumers do not need migration. `header` is an escape hatch:
|
|
@@ -1316,6 +1344,8 @@ export type PageHeaderProps = {
|
|
|
1316
1344
|
readonly title?: string;
|
|
1317
1345
|
/** Name of the loaded record; shown as an extra breadcrumb before the last one. */
|
|
1318
1346
|
readonly recordTitle?: string;
|
|
1347
|
+
/** Short record title for the phone top bar; wins over `recordTitle` there. */
|
|
1348
|
+
readonly narrowRecordTitle?: string;
|
|
1319
1349
|
readonly status?: ReactNode;
|
|
1320
1350
|
readonly actions?: ReactNode;
|
|
1321
1351
|
/** Screen renders its own h1: the shell header shows only the parent crumb, as text. */
|
|
@@ -1345,87 +1375,8 @@ export type ActionOverflowMenuProps = {
|
|
|
1345
1375
|
readonly label: string;
|
|
1346
1376
|
readonly testId?: string;
|
|
1347
1377
|
};
|
|
1348
|
-
|
|
1349
|
-
export type SecretRevealValue
|
|
1350
|
-
readonly label: string;
|
|
1351
|
-
readonly value: string;
|
|
1352
|
-
readonly copyable: boolean;
|
|
1353
|
-
readonly multiline: boolean;
|
|
1354
|
-
/** Render `value` as a scannable QR code instead of monospaced text — for
|
|
1355
|
-
* an otpauth://-style enrollment URI. Platforms without a QR-capable
|
|
1356
|
-
* SecretReveal primitive fall back to the monospaced display. */
|
|
1357
|
-
readonly qr?: boolean;
|
|
1358
|
-
};
|
|
1359
|
-
/** One-time secret reveal — mint-form confirm phase. Renders each value
|
|
1360
|
-
* monospaced (multiline splits it one line per entry, for recovery codes),
|
|
1361
|
-
* with a per-value copy control when `copyable`. */
|
|
1362
|
-
export type SecretRevealProps = {
|
|
1363
|
-
readonly values: readonly SecretRevealValue[];
|
|
1364
|
-
readonly copyLabel: string;
|
|
1365
|
-
readonly copiedLabel: string;
|
|
1366
|
-
readonly testId?: string;
|
|
1367
|
-
};
|
|
1368
|
-
/** Thumb-reach action row for custom screens: pinned to the bottom edge on
|
|
1369
|
-
* narrow viewports (above the device's safe-area inset), inline otherwise.
|
|
1370
|
-
* `children` are the forward actions and share the remaining width; `back`
|
|
1371
|
-
* renders an icon-only back control in front of them. */
|
|
1372
|
-
export type StickyActionBarProps = {
|
|
1373
|
-
readonly children: ReactNode;
|
|
1374
|
-
readonly back?: {
|
|
1375
|
-
readonly onBack: () => void;
|
|
1376
|
-
readonly label: string;
|
|
1377
|
-
};
|
|
1378
|
-
readonly testId?: string;
|
|
1379
|
-
};
|
|
1380
|
-
/** Copies `text` to the clipboard; the label flips to `copiedLabel` once
|
|
1381
|
-
* the platform confirmed the write. */
|
|
1382
|
-
export type CopyButtonProps = {
|
|
1383
|
-
readonly text: string;
|
|
1384
|
-
readonly label: string;
|
|
1385
|
-
readonly copiedLabel: string;
|
|
1386
|
-
readonly variant?: "primary" | "secondary";
|
|
1387
|
-
/** Layout extras, merged via cn(). */
|
|
1388
|
-
readonly className?: string;
|
|
1389
|
-
readonly testId?: string;
|
|
1390
|
-
};
|
|
1391
|
-
/** Hands `text` to another app. "whatsapp" opens a WhatsApp chat prefilled
|
|
1392
|
-
* with the text (to `phone` when given, otherwise the contact picker);
|
|
1393
|
-
* "system" opens the platform share sheet and renders nothing where the
|
|
1394
|
-
* platform has none. */
|
|
1395
|
-
export type ShareButtonProps = {
|
|
1396
|
-
readonly text: string;
|
|
1397
|
-
readonly label: string;
|
|
1398
|
-
readonly variant?: "primary" | "secondary";
|
|
1399
|
-
/** Layout extras, merged via cn(). */
|
|
1400
|
-
readonly className?: string;
|
|
1401
|
-
readonly testId?: string;
|
|
1402
|
-
} & ({
|
|
1403
|
-
readonly target: "whatsapp";
|
|
1404
|
-
readonly phone?: string;
|
|
1405
|
-
} | {
|
|
1406
|
-
readonly target: "system";
|
|
1407
|
-
readonly title?: string;
|
|
1408
|
-
readonly url?: string;
|
|
1409
|
-
});
|
|
1410
|
-
export type PromoPanelAction = {
|
|
1411
|
-
readonly label: string;
|
|
1412
|
-
readonly href: string;
|
|
1413
|
-
readonly testId?: string;
|
|
1414
|
-
} | {
|
|
1415
|
-
readonly label: string;
|
|
1416
|
-
readonly onClick: () => void;
|
|
1417
|
-
readonly testId?: string;
|
|
1418
|
-
};
|
|
1419
|
-
/** Offer surface for upsells (e.g. "create an account"): its own tinted
|
|
1420
|
-
* panel with eyebrow, headline, benefit content and one call to action, so
|
|
1421
|
-
* an offer never reads like an info or error banner. */
|
|
1422
|
-
export type PromoPanelProps = {
|
|
1423
|
-
readonly title: string;
|
|
1424
|
-
readonly eyebrow?: string;
|
|
1425
|
-
readonly children?: ReactNode;
|
|
1426
|
-
readonly action?: PromoPanelAction;
|
|
1427
|
-
readonly testId?: string;
|
|
1428
|
-
};
|
|
1378
|
+
import type { CopyButtonProps, PromoPanelProps, SecretRevealProps, ShareButtonProps, StickyActionBarProps } from "./primitives-share-types.ts";
|
|
1379
|
+
export type { CopyButtonProps, PromoPanelAction, PromoPanelProps, SecretRevealProps, SecretRevealValue, ShareButtonProps, StickyActionBarProps, } from "./primitives-share-types.ts";
|
|
1429
1380
|
export type CorePrimitives = {
|
|
1430
1381
|
readonly Button: ComponentType<ButtonProps>;
|
|
1431
1382
|
readonly Banner: ComponentType<BannerProps>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/** Renders `**bold**` runs of a plain text as <strong>; text without markers stays a single string. */
|
|
3
|
+
export function renderBoldMarkup(text) {
|
|
4
|
+
const pieces = text.split("**");
|
|
5
|
+
// An unpaired marker is literal text, not the start of a bold run up to the end.
|
|
6
|
+
if (pieces.length === 1 || pieces.length % 2 === 0)
|
|
7
|
+
return text;
|
|
8
|
+
let offset = 0;
|
|
9
|
+
return pieces.map((piece, pieceIndex) => {
|
|
10
|
+
const key = offset;
|
|
11
|
+
offset += piece.length + 2;
|
|
12
|
+
return pieceIndex % 2 === 1 ? (_jsx("strong", { className: "font-semibold", children: piece }, key)) : (_jsx("span", { children: piece }, key));
|
|
13
|
+
});
|
|
14
|
+
}
|
|
@@ -63,7 +63,11 @@ function renderDashboardPanel(panel, featureName, screenId, screenParams, transl
|
|
|
63
63
|
if (panel.kind === "screen") {
|
|
64
64
|
return (_jsx(HiddenOnNarrow, { hide: panel.hideOnNarrow === true, children: _jsx(ScreenPanelTile, { panel: panel, featureName: featureName, recordId: screenParams.recordId, translate: translate }) }, panel.id));
|
|
65
65
|
}
|
|
66
|
-
const label = panel.kind === "custom" || panel.label === undefined
|
|
66
|
+
const label = panel.kind === "custom" || panel.label === undefined
|
|
67
|
+
? undefined
|
|
68
|
+
: translate(panel.label, panel.kind === "progress-list" && panel.labelParams !== undefined
|
|
69
|
+
? Object.fromEntries(Object.keys(panel.labelParams).map((param) => [param, ""]))
|
|
70
|
+
: undefined);
|
|
67
71
|
return (_jsx(HiddenOnNarrow, { hide: panel.hideOnNarrow === true, children: _jsx(GatedGridCell, { panel: panel, screenParams: screenParams, label: label ?? panel.id, className: panelSpanClassName(panel), children: _jsx(PanelBody, { panel: panel, label: label, featureName: featureName, screenId: screenId, screenParams: screenParams, translate: translate }) }) }, panel.id));
|
|
68
72
|
}
|
|
69
73
|
export function WebDashboardBody({ featureName, screen, translate, }) {
|
|
@@ -51,11 +51,12 @@ function ListFooter({ link, data, narrow, translate, }) {
|
|
|
51
51
|
const userRoles = useUserRoles();
|
|
52
52
|
const total = knownTotal(data);
|
|
53
53
|
const remaining = total === undefined ? 0 : total - (data.rows ?? []).length;
|
|
54
|
-
const allowed =
|
|
54
|
+
const allowed = link.label !== undefined &&
|
|
55
|
+
navigateTargetAllows({ screen: link.screen }, appFeatures, userRoles) &&
|
|
55
56
|
namedFilterNavigateAllows(link, appFeatures, userRoles);
|
|
56
57
|
const target = dashboardNavigationLink(nav, link);
|
|
57
|
-
return (_jsxs(_Fragment, { children: [remaining > 0 && (_jsxs("span", { "data-testid": "dashboard-list-more", children: [translate((narrow ? (link.narrowMoreText ?? link.moreText) : link.moreText) ??
|
|
58
|
-
"kumiko.dashboard.list.more", { count: remaining }), allowed && " · "] })), allowed && (_jsx(Link, { href: target.href, onPress: target.onPress, testId: "dashboard-list-footer-link", className: "font-medium", children: translate(link.label) }))] }));
|
|
58
|
+
return (_jsxs(_Fragment, { children: [remaining > 0 && (_jsxs("span", { "data-testid": "dashboard-list-more", className: link.label === undefined && !narrow ? "text-muted-foreground" : undefined, children: [translate((narrow ? (link.narrowMoreText ?? link.moreText) : link.moreText) ??
|
|
59
|
+
"kumiko.dashboard.list.more", { count: remaining }), allowed && " · "] })), allowed && link.label !== undefined && (_jsx(Link, { href: target.href, onPress: target.onPress, testId: "dashboard-list-footer-link", className: "font-medium text-primary", children: translate(link.label) }))] }));
|
|
59
60
|
}
|
|
60
61
|
function rowLinkResolverOf(rowLink, resolveScreenLink) {
|
|
61
62
|
if (rowLink.screenField !== undefined) {
|
|
@@ -88,7 +89,7 @@ function NarrowCardsPanel({ panel, label, data, columns, featureName, translate,
|
|
|
88
89
|
const { formatPercent, formatNumber, formatDateTime } = useDashboardFormats();
|
|
89
90
|
const { footerLink } = panel;
|
|
90
91
|
const totalLabel = totalText(panel, data, true, translate);
|
|
91
|
-
return (_jsxs("section", { "data-testid": `dashboard-panel-${panel.id}`, className: "flex flex-col gap-2", children: [_jsxs("header", { className: "flex items-baseline justify-between gap-3", children: [_jsx("h2", { className: "text-sm font-semibold", children: label }), totalLabel !== undefined && (_jsx("span", { className: "text-xs text-muted-foreground", children: totalLabel }))] }), _jsx(DashboardReferenceListTable, { columns: columns, rows: data.rows ?? [], featureName: featureName, formatPercent: formatPercent, formatNumber: formatNumber, formatDateTime: formatDateTime, translate: translate, narrowCards: true, ...(panel.narrow?.titleField !== undefined && { titleField: panel.narrow.titleField }), ...(panel.rowToneField !== undefined && { rowToneField: panel.rowToneField }) }), footerLink !== undefined && (_jsx("footer", { className: "flex flex-wrap items-center gap-x-1 text-
|
|
92
|
+
return (_jsxs("section", { "data-testid": `dashboard-panel-${panel.id}`, className: "flex flex-col gap-2", children: [_jsxs("header", { className: "flex items-baseline justify-between gap-3", children: [_jsx("h2", { className: "text-sm font-semibold", children: label }), totalLabel !== undefined && (_jsx("span", { className: "text-xs text-muted-foreground", children: totalLabel }))] }), _jsx(DashboardReferenceListTable, { columns: columns, rows: data.rows ?? [], featureName: featureName, formatPercent: formatPercent, formatNumber: formatNumber, formatDateTime: formatDateTime, translate: translate, narrowCards: true, ...(panel.narrow?.titleField !== undefined && { titleField: panel.narrow.titleField }), ...(panel.rowToneField !== undefined && { rowToneField: panel.rowToneField }) }), footerLink !== undefined && (_jsx("footer", { "data-testid": "dashboard-list-more-bar", className: "flex flex-wrap items-center justify-center gap-x-1 text-sm font-medium text-primary", children: _jsx(ListFooter, { link: footerLink, data: data, narrow: true, translate: translate }) }))] }));
|
|
92
93
|
}
|
|
93
94
|
export function ListPanelBody({ panel, label, featureName, screenId, screenParams, translate, }) {
|
|
94
95
|
const { formatPercent, formatNumber, formatDateTime } = useDashboardFormats();
|
|
@@ -108,6 +109,7 @@ export function ListPanelBody({ panel, label, featureName, screenId, screenParam
|
|
|
108
109
|
badgeToneField: normalized.badgeToneField,
|
|
109
110
|
}),
|
|
110
111
|
...(normalized.badgeDot !== undefined && { badgeDot: normalized.badgeDot }),
|
|
112
|
+
...(normalized.badgeIcon !== undefined && { badgeIcon: normalized.badgeIcon }),
|
|
111
113
|
...(normalized.emptyPlaceholder !== undefined && {
|
|
112
114
|
emptyPlaceholder: normalized.emptyPlaceholder,
|
|
113
115
|
}),
|
|
@@ -123,6 +125,7 @@ export function ListPanelBody({ panel, label, featureName, screenId, screenParam
|
|
|
123
125
|
linkFor: screenLinkFor(resolveScreenLink, normalized.linkScreenField, normalized.linkParamsField),
|
|
124
126
|
}),
|
|
125
127
|
...(normalized.showOnNarrowOnly === true && { narrowOnly: true }),
|
|
128
|
+
...(normalized.hideOnNarrow === true && { hiddenInCards: true }),
|
|
126
129
|
...(hint !== undefined && { hint: hintViewModel(hint, panel.rowToneField, translate) }),
|
|
127
130
|
};
|
|
128
131
|
});
|