@cosmicdrift/kumiko-renderer 0.415.0 → 0.417.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 +2 -5
- package/dist/app/action-form-body.js +50 -22
- package/dist/app/action-form-support.d.ts +4 -1
- package/dist/app/action-form-support.js +8 -4
- package/dist/app/client-actions.js +6 -4
- package/dist/app/config-edit-body.js +83 -82
- package/dist/app/entity-list-screen.js +1 -1
- package/dist/app/extension-sections.d.ts +2 -0
- package/dist/app/header-actions-bar.d.ts +3 -1
- package/dist/app/header-actions-bar.js +12 -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 +29 -8
- package/dist/app/projection-detail-guidance.d.ts +2 -1
- package/dist/app/projection-detail-guidance.js +45 -30
- package/dist/app/projection-detail-header-model.d.ts +1 -1
- package/dist/app/projection-detail-header-model.js +14 -6
- 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 +31 -4
- package/dist/app/projection-detail-navigation.d.ts +4 -0
- package/dist/app/projection-detail-navigation.js +5 -1
- 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/screen-shared.d.ts +1 -0
- package/dist/app/screen-shared.js +23 -3
- package/dist/app/use-projection-detail-actions.d.ts +16 -1
- package/dist/app/use-projection-detail-actions.js +23 -3
- package/dist/app/use-projection-detail-data.d.ts +2 -0
- package/dist/app/use-projection-detail-data.js +53 -10
- package/dist/app/use-projection-list-data.js +1 -1
- package/dist/card-options.d.ts +2 -0
- package/dist/components/ai-assist-payload.d.ts +2 -0
- package/dist/components/ai-assist-payload.js +8 -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 +3 -2
- package/dist/components/edit-mounts.js +2 -2
- package/dist/components/grid-cell-for-field.js +1 -1
- package/dist/components/multi-select-chips.d.ts +10 -0
- package/dist/components/multi-select-chips.js +19 -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 +52 -35
- package/dist/components/related-photo-grid.d.ts +11 -0
- package/dist/components/related-photo-grid.js +54 -0
- package/dist/components/render-edit-action-button.d.ts +2 -2
- 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.d.ts +2 -1
- package/dist/components/render-edit-header-actions.js +18 -1
- package/dist/components/render-edit-layout.js +5 -3
- package/dist/components/render-edit-logic.js +1 -0
- package/dist/components/render-edit-section-kinds.js +59 -10
- package/dist/components/render-edit-titles.js +1 -1
- package/dist/components/render-edit-types.d.ts +22 -1
- package/dist/components/render-field-ai-assist.d.ts +13 -0
- package/dist/components/render-field-ai-assist.js +90 -0
- package/dist/components/render-field-choice-inputs.js +4 -0
- package/dist/components/render-field-control.d.ts +1 -1
- package/dist/components/render-field-control.js +19 -9
- package/dist/components/render-field-value-chips.d.ts +9 -0
- package/dist/components/render-field-value-chips.js +47 -0
- package/dist/components/render-field-write-only.js +12 -4
- package/dist/components/render-list-hint-columns.d.ts +2 -0
- package/dist/components/render-list-hint-columns.js +43 -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-edit-sections.js +5 -1
- 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/headless/form/form-controller.d.ts +1 -0
- package/dist/headless/form/form-controller.js +1 -1
- package/dist/headless/format/index.d.ts +1 -0
- package/dist/headless/format/index.js +21 -0
- package/dist/headless/format/phone.d.ts +1 -0
- package/dist/headless/format/phone.js +8 -0
- package/dist/headless/format/relative-time.d.ts +15 -0
- package/dist/headless/format/relative-time.js +63 -0
- package/dist/headless/format/safe-locale.d.ts +1 -0
- package/dist/headless/format/safe-locale.js +13 -0
- package/dist/headless/index.d.ts +2 -2
- package/dist/headless/index.js +2 -2
- package/dist/headless/view-model/edit.d.ts +3 -2
- package/dist/headless/view-model/edit.js +162 -36
- package/dist/headless/view-model/field-text.d.ts +9 -0
- package/dist/headless/view-model/field-text.js +19 -0
- package/dist/headless/view-model/index.d.ts +1 -0
- package/dist/headless/view-model/index.js +1 -0
- package/dist/headless/view-model/list.js +6 -0
- package/dist/headless/view-model/types.d.ts +76 -5
- package/dist/hooks/use-list-table.js +11 -6
- package/dist/i18n-defaults.js +9 -2
- package/dist/index.d.ts +1 -1
- package/dist/primitives-record-guidance.d.ts +32 -1
- package/dist/primitives-share-types.d.ts +82 -0
- package/dist/primitives-share-types.js +1 -0
- package/dist/primitives.d.ts +44 -86
- 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 +8 -3
- package/dist/web/app/dashboard-list-panel.js +8 -4
- package/dist/web/app/dashboard-panel-columns.d.ts +9 -0
- package/dist/web/app/dashboard-panel-columns.js +14 -0
- 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 +4 -4
- package/dist/web/app/dashboard-stat-group-panel.d.ts +1 -1
- package/dist/web/app/dashboard-stat-group-panel.js +24 -3
- package/dist/web/app/dashboard-text-panel.d.ts +1 -0
- package/dist/web/app/dashboard-text-panel.js +18 -11
- package/dist/web/app/relative-time.d.ts +0 -5
- package/dist/web/app/relative-time.js +11 -21
- 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/notification-bell.js +12 -3
- 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 +13 -5
- package/dist/web/primitives/banner.js +24 -8
- 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 +34 -10
- 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 +4 -1
- package/dist/web/primitives/data-table/data-cell-props.js +3 -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-click-guard.d.ts +2 -0
- package/dist/web/primitives/data-table/row-click-guard.js +19 -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 -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 +3 -1
- package/dist/web/primitives/data-table/table-chrome.js +1 -3
- package/dist/web/primitives/data-table/table-content.js +6 -6
- 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-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 +17 -3
- package/dist/web/primitives/data-table-cell.js +130 -36
- 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 +15 -11
- package/dist/web/primitives/drawer.js +2 -3
- 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 +6 -3
- package/dist/web/primitives/form.js +6 -8
- package/dist/web/primitives/index.js +4 -0
- 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 +50 -13
- package/dist/web/primitives/layout.d.ts +1 -1
- package/dist/web/primitives/layout.js +1 -1
- package/dist/web/primitives/locale-number.d.ts +0 -1
- package/dist/web/primitives/locale-number.js +1 -13
- package/dist/web/primitives/money-input.js +10 -8
- package/dist/web/primitives/narrow-pinned-footer.js +7 -3
- package/dist/web/primitives/number-input.d.ts +2 -1
- package/dist/web/primitives/number-input.js +11 -5
- 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.d.ts +3 -0
- package/dist/web/primitives/photo-grid.js +6 -0
- package/dist/web/primitives/record-steps.d.ts +1 -1
- package/dist/web/primitives/record-steps.js +7 -16
- package/dist/web/primitives/record-summary.d.ts +1 -1
- package/dist/web/primitives/record-summary.js +8 -3
- package/dist/web/primitives/row-actions.js +38 -24
- package/dist/web/primitives/step-list.d.ts +3 -0
- package/dist/web/primitives/step-list.js +11 -0
- package/dist/web/primitives/use-container-narrow.d.ts +12 -0
- package/dist/web/primitives/use-container-narrow.js +42 -0
- 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 +6 -1
- package/dist/web/widgets/dashboard-list.js +12 -7
- package/dist/web/widgets/drawer-panel-class.js +1 -1
- 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 +105 -0
- package/src/web/styles.css +3 -2
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { availableSelectOptions, evalFieldCondition, isExtensionEditSection, isFieldRequired, isFieldsEditSection, isFieldVisible, isFormDerivationInputMode, isUnusedFallbackOperand, isWriteFormEditSection, normalizeEditField, parseRefTarget, sectionFieldSpecs, WRITE_FORM_SECTION_ENTITY, } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
|
+
import { SELECT_OPTION_TONES } from "@cosmicdrift/kumiko-types/fields";
|
|
3
|
+
import { isOneOf, propertyOf } from "@cosmicdrift/kumiko-types/type-guards";
|
|
2
4
|
import { buildEmbeddedListCell } from "./embedded-list-cells.js";
|
|
5
|
+
import { resolveFieldText } from "./field-text.js";
|
|
3
6
|
import { buildOptionLabels, fieldLabelKey, fieldOptionLabelKey } from "./list.js";
|
|
4
7
|
// Resolves a writeForm section's own fieldDefs/fields through the same
|
|
5
8
|
// per-field pipeline as a plain fields section, by reusing the pipeline
|
|
@@ -33,6 +36,9 @@ function computeWriteFormSectionViewModel(sectionSpec, screenId, values, transla
|
|
|
33
36
|
...(sectionSpec.description !== undefined && {
|
|
34
37
|
description: translate(sectionSpec.description),
|
|
35
38
|
}),
|
|
39
|
+
...(sectionSpec.descriptionNarrow !== undefined && {
|
|
40
|
+
descriptionNarrow: translate(sectionSpec.descriptionNarrow),
|
|
41
|
+
}),
|
|
36
42
|
columns: sectionSpec.columns ?? 1,
|
|
37
43
|
fields,
|
|
38
44
|
...(sectionSpec.icon !== undefined && { icon: sectionSpec.icon }),
|
|
@@ -40,6 +46,7 @@ function computeWriteFormSectionViewModel(sectionSpec, screenId, values, transla
|
|
|
40
46
|
...(sectionSpec.submitLabel !== undefined && {
|
|
41
47
|
submitLabel: translate(sectionSpec.submitLabel),
|
|
42
48
|
}),
|
|
49
|
+
...(sectionSpec.submitWith !== undefined && { submitWith: sectionSpec.submitWith }),
|
|
43
50
|
...(sectionSpec.actions !== undefined && { actions: sectionSpec.actions }),
|
|
44
51
|
};
|
|
45
52
|
}
|
|
@@ -61,6 +68,48 @@ function translateSectionTexts(section, translate) {
|
|
|
61
68
|
function wasEmptiedByWriteExclusion(declaredFieldSpecs, remainingFields) {
|
|
62
69
|
return declaredFieldSpecs.length > 0 && remainingFields.length === 0;
|
|
63
70
|
}
|
|
71
|
+
function readOptionalString(entry, key) {
|
|
72
|
+
const value = propertyOf(entry, key);
|
|
73
|
+
return typeof value === "string" ? value : undefined;
|
|
74
|
+
}
|
|
75
|
+
function readStepListItem(entry) {
|
|
76
|
+
const title = readOptionalString(entry, "title");
|
|
77
|
+
if (title === undefined)
|
|
78
|
+
return undefined;
|
|
79
|
+
const status = readOptionalString(entry, "status");
|
|
80
|
+
const statusTone = propertyOf(entry, "statusTone");
|
|
81
|
+
const description = readOptionalString(entry, "description");
|
|
82
|
+
return {
|
|
83
|
+
title,
|
|
84
|
+
...(status !== undefined && { status }),
|
|
85
|
+
...(isOneOf(SELECT_OPTION_TONES, statusTone) && { statusTone }),
|
|
86
|
+
...(description !== undefined && { description }),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
// Malformed entries of the record's array are skipped: the screen must not crash on a bad row.
|
|
90
|
+
export function computeStepListSectionViewModel(sectionSpec, values, translate) {
|
|
91
|
+
const raw = values[sectionSpec.field];
|
|
92
|
+
const items = Array.isArray(raw) ? raw : [];
|
|
93
|
+
return {
|
|
94
|
+
kind: "stepList",
|
|
95
|
+
...(sectionSpec.id !== undefined && { id: sectionSpec.id }),
|
|
96
|
+
...(sectionSpec.title !== undefined && { title: translate(sectionSpec.title) }),
|
|
97
|
+
items: items.flatMap((entry) => {
|
|
98
|
+
const item = readStepListItem(entry);
|
|
99
|
+
if (item === undefined)
|
|
100
|
+
return [];
|
|
101
|
+
const { title, status, statusTone, description } = item;
|
|
102
|
+
return [
|
|
103
|
+
{
|
|
104
|
+
title: translate(title),
|
|
105
|
+
...(status !== undefined && { status: translate(status) }),
|
|
106
|
+
...(statusTone !== undefined && { statusTone }),
|
|
107
|
+
...(description !== undefined && { description: translate(description) }),
|
|
108
|
+
},
|
|
109
|
+
];
|
|
110
|
+
}),
|
|
111
|
+
};
|
|
112
|
+
}
|
|
64
113
|
// relatedList runs its own query — nothing here to resolve against
|
|
65
114
|
// entity/values, the spec passes through verbatim.
|
|
66
115
|
export function computeRelatedListSectionViewModel(sectionSpec, translate) {
|
|
@@ -69,19 +118,30 @@ export function computeRelatedListSectionViewModel(sectionSpec, translate) {
|
|
|
69
118
|
...(sectionSpec.id !== undefined && { id: sectionSpec.id }),
|
|
70
119
|
title: translate(sectionSpec.title),
|
|
71
120
|
query: sectionSpec.query,
|
|
72
|
-
...(sectionSpec.parentParam !== undefined && { parentParam: sectionSpec.parentParam }),
|
|
73
|
-
...(sectionSpec.parentFilter !== undefined && { parentFilter: sectionSpec.parentFilter }),
|
|
74
121
|
columns: sectionSpec.columns,
|
|
75
|
-
...(sectionSpec.entity !== undefined && { entity: sectionSpec.entity }),
|
|
76
122
|
...(sectionSpec.description !== undefined && {
|
|
77
123
|
description: translate(sectionSpec.description),
|
|
78
124
|
}),
|
|
125
|
+
...relatedListQueryProps(sectionSpec),
|
|
126
|
+
...relatedListRowProps(sectionSpec),
|
|
127
|
+
...relatedListEmptyStateProps(sectionSpec, translate),
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function relatedListQueryProps(sectionSpec) {
|
|
131
|
+
return {
|
|
132
|
+
...(sectionSpec.parentParam !== undefined && { parentParam: sectionSpec.parentParam }),
|
|
133
|
+
...(sectionSpec.parentFilter !== undefined && { parentFilter: sectionSpec.parentFilter }),
|
|
134
|
+
...(sectionSpec.entity !== undefined && { entity: sectionSpec.entity }),
|
|
79
135
|
...(sectionSpec.itemNoun !== undefined && { itemNoun: sectionSpec.itemNoun }),
|
|
80
136
|
...(sectionSpec.pageSize !== undefined && { pageSize: sectionSpec.pageSize }),
|
|
81
137
|
...(sectionSpec.table !== undefined && { table: sectionSpec.table }),
|
|
82
138
|
...(sectionSpec.defaultSort !== undefined && { defaultSort: sectionSpec.defaultSort }),
|
|
83
139
|
...(sectionSpec.searchable !== undefined && { searchable: sectionSpec.searchable }),
|
|
84
140
|
...(sectionSpec.facets !== undefined && { facets: sectionSpec.facets }),
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function relatedListRowProps(sectionSpec) {
|
|
144
|
+
return {
|
|
85
145
|
...(sectionSpec.rowClick !== undefined && { rowClick: sectionSpec.rowClick }),
|
|
86
146
|
...(sectionSpec.rowActions !== undefined && { rowActions: sectionSpec.rowActions }),
|
|
87
147
|
...(sectionSpec.rowActionMode !== undefined && { rowActionMode: sectionSpec.rowActionMode }),
|
|
@@ -89,29 +149,33 @@ export function computeRelatedListSectionViewModel(sectionSpec, translate) {
|
|
|
89
149
|
...(sectionSpec.rowTone !== undefined && { rowTone: sectionSpec.rowTone }),
|
|
90
150
|
...(sectionSpec.toolbarActions !== undefined && { toolbarActions: sectionSpec.toolbarActions }),
|
|
91
151
|
...(sectionSpec.actions !== undefined && { actions: sectionSpec.actions }),
|
|
92
|
-
...(sectionSpec.
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
152
|
+
...(sectionSpec.photoGrid !== undefined && { photoGrid: sectionSpec.photoGrid }),
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function relatedListEmptyStateProps(sectionSpec, translate) {
|
|
156
|
+
const { emptyState } = sectionSpec;
|
|
157
|
+
if (emptyState === undefined)
|
|
158
|
+
return {};
|
|
159
|
+
return {
|
|
160
|
+
emptyState: {
|
|
161
|
+
title: translate(emptyState.title),
|
|
162
|
+
...(emptyState.description !== undefined && {
|
|
163
|
+
description: translate(emptyState.description),
|
|
164
|
+
}),
|
|
165
|
+
// Action stays untranslated, same convention as rowActions/
|
|
166
|
+
// toolbarActions above — the renderer's row-actions builder
|
|
167
|
+
// translates `action.label` at button-build time.
|
|
168
|
+
...(emptyState.action !== undefined && { action: emptyState.action }),
|
|
169
|
+
...(emptyState.variants !== undefined && {
|
|
170
|
+
variants: emptyState.variants.map((variant) => ({
|
|
171
|
+
when: variant.when,
|
|
172
|
+
title: translate(variant.title),
|
|
173
|
+
...(variant.description !== undefined && {
|
|
174
|
+
description: translate(variant.description),
|
|
175
|
+
}),
|
|
176
|
+
})),
|
|
177
|
+
}),
|
|
178
|
+
},
|
|
115
179
|
};
|
|
116
180
|
}
|
|
117
181
|
function translateAffix(affix, translate) {
|
|
@@ -129,6 +193,41 @@ function deriveFieldAffixHints(normalized, translate) {
|
|
|
129
193
|
...(normalized.fillAction !== undefined && {
|
|
130
194
|
fillAction: { ...normalized.fillAction, label: translate(normalized.fillAction.label) },
|
|
131
195
|
}),
|
|
196
|
+
...(normalized.aiAssist !== undefined && {
|
|
197
|
+
aiAssist: {
|
|
198
|
+
query: normalized.aiAssist.query,
|
|
199
|
+
resultField: normalized.aiAssist.resultField,
|
|
200
|
+
...(normalized.aiAssist.noteField !== undefined && {
|
|
201
|
+
noteField: normalized.aiAssist.noteField,
|
|
202
|
+
}),
|
|
203
|
+
...(normalized.aiAssist.contextFields !== undefined && {
|
|
204
|
+
contextFields: normalized.aiAssist.contextFields,
|
|
205
|
+
}),
|
|
206
|
+
...(normalized.aiAssist.chips !== undefined && {
|
|
207
|
+
chips: normalized.aiAssist.chips.map((chip) => ({
|
|
208
|
+
...chip,
|
|
209
|
+
label: translate(chip.label),
|
|
210
|
+
})),
|
|
211
|
+
}),
|
|
212
|
+
...(normalized.aiAssist.prompt !== undefined && {
|
|
213
|
+
prompt: {
|
|
214
|
+
param: normalized.aiAssist.prompt.param,
|
|
215
|
+
...(normalized.aiAssist.prompt.placeholder !== undefined && {
|
|
216
|
+
placeholder: translate(normalized.aiAssist.prompt.placeholder),
|
|
217
|
+
}),
|
|
218
|
+
},
|
|
219
|
+
}),
|
|
220
|
+
},
|
|
221
|
+
}),
|
|
222
|
+
...(normalized.valueChips !== undefined && { valueChips: normalized.valueChips }),
|
|
223
|
+
...(normalized.concealed === true && { concealed: true }),
|
|
224
|
+
...(normalized.badge !== undefined && {
|
|
225
|
+
badge: "label" in normalized.badge
|
|
226
|
+
? { label: translate(normalized.badge.label), tone: normalized.badge.tone }
|
|
227
|
+
: normalized.badge,
|
|
228
|
+
}),
|
|
229
|
+
...(normalized.hintField !== undefined && { hintField: normalized.hintField }),
|
|
230
|
+
...(normalized.hideOnNarrow === true && { hideOnNarrow: true }),
|
|
132
231
|
};
|
|
133
232
|
}
|
|
134
233
|
function deriveSelectOptionsQuery(fieldDef) {
|
|
@@ -384,19 +483,25 @@ function isEditFieldRequired(normalized, fieldDef, values) {
|
|
|
384
483
|
? evalFieldCondition(normalized.required, values)
|
|
385
484
|
: isFieldRequired(fieldDef, values);
|
|
386
485
|
}
|
|
486
|
+
function computeNonFieldsSectionViewModel(sectionSpec, screenId, values, translate, featureName) {
|
|
487
|
+
if (isExtensionEditSection(sectionSpec)) {
|
|
488
|
+
return buildExtensionSectionViewModel(sectionSpec, translate);
|
|
489
|
+
}
|
|
490
|
+
if (isWriteFormEditSection(sectionSpec)) {
|
|
491
|
+
return computeWriteFormSectionViewModel(sectionSpec, screenId, values, translate, featureName);
|
|
492
|
+
}
|
|
493
|
+
if (sectionSpec.kind === "stepList") {
|
|
494
|
+
return computeStepListSectionViewModel(sectionSpec, values, translate);
|
|
495
|
+
}
|
|
496
|
+
return computeRelatedListSectionViewModel(sectionSpec, translate);
|
|
497
|
+
}
|
|
387
498
|
export function computeEditViewModel(input) {
|
|
388
499
|
const { screen, entity, values, translate, featureName, mode, entityId, derivation, actionFormScreenQn, } = input;
|
|
389
500
|
const excludedFields = new Set(mode === undefined ? [] : screen.writeExcludedFields?.[mode]);
|
|
390
501
|
const isHiddenByExclusion = (fieldSpec) => mode === "create" && excludedFields.has(normalizeEditField(fieldSpec).field);
|
|
391
|
-
const
|
|
392
|
-
if (isExtensionEditSection(sectionSpec)) {
|
|
393
|
-
return buildExtensionSectionViewModel(sectionSpec, translate);
|
|
394
|
-
}
|
|
395
|
-
if (isWriteFormEditSection(sectionSpec)) {
|
|
396
|
-
return computeWriteFormSectionViewModel(sectionSpec, screen.id, values, translate, featureName);
|
|
397
|
-
}
|
|
502
|
+
const baseSections = screen.layout.sections.map((sectionSpec) => {
|
|
398
503
|
if (!isFieldsEditSection(sectionSpec)) {
|
|
399
|
-
return
|
|
504
|
+
return computeNonFieldsSectionViewModel(sectionSpec, screen.id, values, translate, featureName);
|
|
400
505
|
}
|
|
401
506
|
// `groups` flattens into the same per-field pipeline as plain `fields`;
|
|
402
507
|
// the group structure below just re-groups the computed views by name.
|
|
@@ -423,8 +528,8 @@ export function computeEditViewModel(input) {
|
|
|
423
528
|
? parseRefTarget(normalized.refEntity, featureName)
|
|
424
529
|
: undefined;
|
|
425
530
|
const effectiveType = declaredRefTarget !== undefined ? "reference" : fieldDef.type;
|
|
426
|
-
const label =
|
|
427
|
-
fieldLabelKey(featureName, screen.entity, normalized.field));
|
|
531
|
+
const label = resolveFieldText(screen.fieldLabels?.[normalized.field] ??
|
|
532
|
+
fieldLabelKey(featureName, screen.entity, normalized.field), values, translate).text;
|
|
428
533
|
const visible = isEditFieldVisible(normalized, fieldDef, values);
|
|
429
534
|
// `readOnly` (camelCase) is the name on both sides: EditFieldSpec
|
|
430
535
|
// in the engine, and the view-model emitted here. One convention
|
|
@@ -485,6 +590,7 @@ export function computeEditViewModel(input) {
|
|
|
485
590
|
.map((group) => ({
|
|
486
591
|
title: translate(group.title),
|
|
487
592
|
columns: group.columns ?? 2,
|
|
593
|
+
...(group.columns !== undefined && { columnsDeclared: true }),
|
|
488
594
|
fields: group.fields.map((fieldSpec) => {
|
|
489
595
|
const fieldName = normalizeEditField(fieldSpec).field;
|
|
490
596
|
const fieldView = fields.find((f) => f.field === fieldName);
|
|
@@ -501,14 +607,24 @@ export function computeEditViewModel(input) {
|
|
|
501
607
|
visible,
|
|
502
608
|
emptiedByWriteExclusion: wasEmptiedByWriteExclusion(declaredFieldSpecs, fields),
|
|
503
609
|
...translateSectionTexts(sectionSpec, translate),
|
|
610
|
+
...(sectionSpec.descriptionNarrow !== undefined && {
|
|
611
|
+
descriptionNarrow: translate(sectionSpec.descriptionNarrow),
|
|
612
|
+
}),
|
|
504
613
|
...(sectionSpec.summaryField !== undefined && { summaryField: sectionSpec.summaryField }),
|
|
505
614
|
columns: sectionSpec.columns ?? defaultColumns,
|
|
615
|
+
...(sectionSpec.columns !== undefined && { columnsDeclared: true }),
|
|
506
616
|
fields,
|
|
507
617
|
...(groups !== undefined && { groups }),
|
|
508
618
|
...(sectionSpec.icon !== undefined && { icon: sectionSpec.icon }),
|
|
509
619
|
...(sectionSpec.actions !== undefined && { actions: sectionSpec.actions }),
|
|
510
620
|
};
|
|
511
621
|
});
|
|
622
|
+
const sections = baseSections.map((section, index) => {
|
|
623
|
+
const sectionSpec = screen.layout.sections[index];
|
|
624
|
+
return sectionSpec === undefined
|
|
625
|
+
? section
|
|
626
|
+
: withSectionPresentation(section, sectionSpec, translate);
|
|
627
|
+
});
|
|
512
628
|
const idValue = values["id"];
|
|
513
629
|
const id = typeof idValue === "string" ? idValue : null;
|
|
514
630
|
return {
|
|
@@ -519,6 +635,16 @@ export function computeEditViewModel(input) {
|
|
|
519
635
|
...(screen.slots && { slots: screen.slots }),
|
|
520
636
|
};
|
|
521
637
|
}
|
|
638
|
+
function withSectionPresentation(section, spec, translate) {
|
|
639
|
+
return {
|
|
640
|
+
...section,
|
|
641
|
+
...(spec.tabLabel !== undefined && { tabLabel: translate(spec.tabLabel) }),
|
|
642
|
+
...(spec.after !== undefined && { after: spec.after }),
|
|
643
|
+
...(spec.hideOnNarrow === true && { hideOnNarrow: true }),
|
|
644
|
+
...(spec.showOnNarrowOnly === true && { showOnNarrowOnly: true }),
|
|
645
|
+
...(spec.titleOnNarrow === false && { titleOnNarrow: false }),
|
|
646
|
+
};
|
|
647
|
+
}
|
|
522
648
|
// Resolves a FieldCondition against the current row values.
|
|
523
649
|
// `undefined` means "not declared" — caller substitutes the default.
|
|
524
650
|
function evalCondition(condition, fallback, values) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FieldTextRef } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
|
+
import type { Translate } from "./types.ts";
|
|
3
|
+
export declare function fieldTextKey(ref: FieldTextRef): string;
|
|
4
|
+
/** Translates a label or help text, filling `{placeholder}`s from the form values (hidden
|
|
5
|
+
* fields included). `complete` is false while any referenced value is empty. */
|
|
6
|
+
export declare function resolveFieldText(ref: FieldTextRef, values: Readonly<Record<string, unknown>>, translate: Translate): {
|
|
7
|
+
readonly text: string;
|
|
8
|
+
readonly complete: boolean;
|
|
9
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function fieldTextKey(ref) {
|
|
2
|
+
return typeof ref === "string" ? ref : ref.key;
|
|
3
|
+
}
|
|
4
|
+
/** Translates a label or help text, filling `{placeholder}`s from the form values (hidden
|
|
5
|
+
* fields included). `complete` is false while any referenced value is empty. */
|
|
6
|
+
export function resolveFieldText(ref, values, translate) {
|
|
7
|
+
if (typeof ref === "string")
|
|
8
|
+
return { text: translate(ref), complete: true };
|
|
9
|
+
const params = {};
|
|
10
|
+
let complete = true;
|
|
11
|
+
for (const [placeholder, fieldName] of Object.entries(ref.params)) {
|
|
12
|
+
const value = values[fieldName];
|
|
13
|
+
const text = value === undefined || value === null ? "" : String(value);
|
|
14
|
+
if (text === "")
|
|
15
|
+
complete = false;
|
|
16
|
+
params[placeholder] = text;
|
|
17
|
+
}
|
|
18
|
+
return { text: translate(ref.key, params), complete };
|
|
19
|
+
}
|
|
@@ -2,6 +2,7 @@ export type { ComputeEditViewModelInput, EditFormMode } from "./edit.ts";
|
|
|
2
2
|
export { computeEditViewModel, computeRelatedListSectionViewModel } from "./edit.ts";
|
|
3
3
|
export type { DerivedCellRoundingTarget, EmbeddedDerivedOp, EmbeddedListIssueGroups, } from "./embedded-list.ts";
|
|
4
4
|
export { computeDerivedCellValue, groupEmbeddedListIssues, roundDerivedCellValue, sumEmbeddedListColumn, withDerivedCells, } from "./embedded-list.ts";
|
|
5
|
+
export { fieldTextKey, resolveFieldText } from "./field-text.ts";
|
|
5
6
|
export type { ComputeListViewModelInput } from "./list.ts";
|
|
6
7
|
export { buildOptionLabels, computeListViewModel, embeddedCellLabelKey, embeddedCellOptionLabelKey, fieldLabelKey, fieldOptionLabelKey, fieldOptionLabelKeyPrefix, } from "./list.ts";
|
|
7
8
|
export type { CellLink, CellLinkItem, EditExtensionSectionViewModel, EditFieldSpec, EditFieldsSectionViewModel, EditFieldViewModel, EditRelatedListSectionViewModel, EditSectionSpec, EditSectionViewModel, EditViewModel, EditWriteFormSectionViewModel, EmbeddedListCellViewModel, FieldConditionCtx, FieldRenderer, ListColumnCellDisplay, ListColumnFileDisplay, ListColumnHintViewModel, ListColumnSpec, ListColumnViewModel, ListRowViewModel, ListViewModel, RuntimeCellLink, RuntimeCellLinkItems, RuntimeRenderer, ScreenSlots, Translate, } from "./types.ts";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { computeEditViewModel, computeRelatedListSectionViewModel } from "./edit.js";
|
|
2
2
|
export { computeDerivedCellValue, groupEmbeddedListIssues, roundDerivedCellValue, sumEmbeddedListColumn, withDerivedCells, } from "./embedded-list.js";
|
|
3
|
+
export { fieldTextKey, resolveFieldText } from "./field-text.js";
|
|
3
4
|
export { buildOptionLabels, computeListViewModel, embeddedCellLabelKey, embeddedCellOptionLabelKey, fieldLabelKey, fieldOptionLabelKey, fieldOptionLabelKeyPrefix, } from "./list.js";
|
|
@@ -74,6 +74,7 @@ function declaredReferenceColumn(input, column) {
|
|
|
74
74
|
refLabelField: column.refLabelField ?? "id",
|
|
75
75
|
...(column.renderer !== undefined && { renderer: column.renderer }),
|
|
76
76
|
...(column.hideOnNarrow === true && { hideOnNarrow: true }),
|
|
77
|
+
...(column.hideWhenDocked === true && { hideWhenDocked: true }),
|
|
77
78
|
};
|
|
78
79
|
}
|
|
79
80
|
function storedFieldColumn(input, column) {
|
|
@@ -89,6 +90,7 @@ function storedFieldColumn(input, column) {
|
|
|
89
90
|
...(column.renderer !== undefined && { renderer: column.renderer }),
|
|
90
91
|
...storedFieldMetadata(input, column, fieldDef),
|
|
91
92
|
...(column.hideOnNarrow === true && { hideOnNarrow: true }),
|
|
93
|
+
...(column.hideWhenDocked === true && { hideWhenDocked: true }),
|
|
92
94
|
};
|
|
93
95
|
}
|
|
94
96
|
// Key order is part of the serialized view model, so it stays fixed here.
|
|
@@ -141,6 +143,7 @@ function derivedFieldColumn(input, column) {
|
|
|
141
143
|
sortable: "sortable" in derivedDef && derivedDef.sortable === true,
|
|
142
144
|
...(column.renderer !== undefined && { renderer: column.renderer }),
|
|
143
145
|
...(column.hideOnNarrow === true && { hideOnNarrow: true }),
|
|
146
|
+
...(column.hideWhenDocked === true && { hideWhenDocked: true }),
|
|
144
147
|
};
|
|
145
148
|
}
|
|
146
149
|
// Row-meta column (id/tenantId/version/insertedAt/modifiedAt/...) —
|
|
@@ -163,6 +166,7 @@ function rowMetaColumn(input, column) {
|
|
|
163
166
|
sortable: rowMetaRef === undefined,
|
|
164
167
|
...(column.renderer !== undefined && { renderer: column.renderer }),
|
|
165
168
|
...(column.hideOnNarrow === true && { hideOnNarrow: true }),
|
|
169
|
+
...(column.hideWhenDocked === true && { hideWhenDocked: true }),
|
|
166
170
|
...(rowMetaRef !== undefined && {
|
|
167
171
|
refEntity: rowMetaRef.refEntity,
|
|
168
172
|
refFeature: rowMetaRef.refFeature,
|
|
@@ -187,6 +191,7 @@ function virtualRendererColumn(input, column) {
|
|
|
187
191
|
sortable: false,
|
|
188
192
|
renderer: column.renderer,
|
|
189
193
|
...(column.hideOnNarrow === true && { hideOnNarrow: true }),
|
|
194
|
+
...(column.hideWhenDocked === true && { hideWhenDocked: true }),
|
|
190
195
|
};
|
|
191
196
|
}
|
|
192
197
|
// A column naming a field of the screen's rowDecoration query: the value lives
|
|
@@ -202,6 +207,7 @@ function rowDecorationColumn(input, column) {
|
|
|
202
207
|
sortable: false,
|
|
203
208
|
...(column.renderer !== undefined && { renderer: column.renderer }),
|
|
204
209
|
...(column.hideOnNarrow === true && { hideOnNarrow: true }),
|
|
210
|
+
...(column.hideWhenDocked === true && { hideWhenDocked: true }),
|
|
205
211
|
};
|
|
206
212
|
}
|
|
207
213
|
// The wire carries `true` (set) / `null` (empty) for writeOnly fields; the cell shows a word, not "true".
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EditFieldSpec, EditSectionSpec, EmbeddedDerivedCellDef, FieldAffix, FieldCondition, FieldFillAction, FieldIconKey, FieldRenderer, 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. */
|
|
@@ -81,8 +83,26 @@ export type ListColumnViewModel = {
|
|
|
81
83
|
readonly badgeToneField?: string;
|
|
82
84
|
/** `false`: the pill has no leading dot. */
|
|
83
85
|
readonly badgeDot?: false;
|
|
84
|
-
/**
|
|
85
|
-
readonly
|
|
86
|
+
/** Row field with the label of a pill drawn beside the cell value (`ListColumnSpec.pillField`). */
|
|
87
|
+
readonly pillField?: string;
|
|
88
|
+
/** Row field naming the pill tone. */
|
|
89
|
+
readonly pillToneField?: string;
|
|
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;
|
|
86
106
|
};
|
|
87
107
|
export type ListColumnCellDisplay = "badge" | "button";
|
|
88
108
|
export type ListColumnHintViewModel = {
|
|
@@ -187,7 +207,7 @@ export type EditFieldViewModel = {
|
|
|
187
207
|
* toggle instead of the default combobox dropdown. Set for
|
|
188
208
|
* `type: "select"` when SelectFieldDef.display is "radio" or "dropdown" —
|
|
189
209
|
* the renderer then skips its own radio-vs-dropdown heuristic. */
|
|
190
|
-
readonly display?: "checkboxes" | "dropdown" | "radio";
|
|
210
|
+
readonly display?: "checkboxes" | "chips" | "dropdown" | "radio";
|
|
191
211
|
/** `type: "select"` only: tone per option, shown on the selected radio segment. */
|
|
192
212
|
readonly optionTones?: Readonly<Partial<Record<string, SelectOptionTone>>>;
|
|
193
213
|
/** Set for `type: "multiSelect"` when MultiSelectFieldDef.columns is
|
|
@@ -289,6 +309,18 @@ export type EditFieldViewModel = {
|
|
|
289
309
|
readonly suffix?: FieldAffix;
|
|
290
310
|
/** From EditFieldSpec.fillAction, `label` already translated. */
|
|
291
311
|
readonly fillAction?: FieldFillAction;
|
|
312
|
+
/** From EditFieldSpec.aiAssist, chip labels and the prompt placeholder already translated. */
|
|
313
|
+
readonly aiAssist?: FieldAiAssist;
|
|
314
|
+
/** From EditFieldSpec.valueChips. */
|
|
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;
|
|
292
324
|
/** Only set for an embedded-LIST field (`multiple: true`) — the per-cell
|
|
293
325
|
* metadata the renderer needs to draw each column/cell. Absent for a
|
|
294
326
|
* plain (non-list) embedded field. */
|
|
@@ -331,7 +363,16 @@ export type EditFieldViewModel = {
|
|
|
331
363
|
readonly field: string;
|
|
332
364
|
};
|
|
333
365
|
};
|
|
334
|
-
|
|
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;
|
|
335
376
|
export type EditFieldsSectionViewModel = {
|
|
336
377
|
readonly kind: "fields";
|
|
337
378
|
/** From `EditFieldsSection.id`. The boot-validator makes it mandatory under
|
|
@@ -351,6 +392,8 @@ export type EditFieldsSectionViewModel = {
|
|
|
351
392
|
/** Translated help text under the block heading, from
|
|
352
393
|
* `EditFieldsSection.description`. Renders even without `title`. */
|
|
353
394
|
readonly description?: string;
|
|
395
|
+
/** Translated `EditFieldsSection.descriptionNarrow`. */
|
|
396
|
+
readonly descriptionNarrow?: string;
|
|
354
397
|
/** Translated `EditFieldsSection.subtitle` (wizard step rail / up-next box). */
|
|
355
398
|
readonly subtitle?: string;
|
|
356
399
|
/** Translated `EditFieldsSection.upNextHint`. */
|
|
@@ -358,12 +401,16 @@ export type EditFieldsSectionViewModel = {
|
|
|
358
401
|
/** From `EditFieldsSection.summaryField` (wizard step rail). */
|
|
359
402
|
readonly summaryField?: string;
|
|
360
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;
|
|
361
407
|
readonly fields: readonly EditFieldViewModel[];
|
|
362
408
|
/** From `EditFieldsSection.groups` — each entry's `fields` are the same
|
|
363
409
|
* view-model objects as `fields` above, re-grouped (not recomputed). */
|
|
364
410
|
readonly groups?: readonly {
|
|
365
411
|
readonly title: string;
|
|
366
412
|
readonly columns: number;
|
|
413
|
+
readonly columnsDeclared?: true;
|
|
367
414
|
readonly fields: readonly EditFieldViewModel[];
|
|
368
415
|
}[];
|
|
369
416
|
/** From `EditFieldsSection.icon` — closed IconKey vocabulary, renders
|
|
@@ -394,6 +441,19 @@ export type EditExtensionSectionViewModel = {
|
|
|
394
441
|
/** From `EditExtensionSection.actions`. */
|
|
395
442
|
readonly actions?: readonly RowAction[];
|
|
396
443
|
};
|
|
444
|
+
export type EditStepListSectionViewModel = {
|
|
445
|
+
readonly kind: "stepList";
|
|
446
|
+
readonly id?: string;
|
|
447
|
+
readonly title?: string;
|
|
448
|
+
/** Read from the record at view-model time; texts are already translated. */
|
|
449
|
+
readonly items: readonly {
|
|
450
|
+
readonly title: string;
|
|
451
|
+
readonly status?: string;
|
|
452
|
+
readonly statusTone?: SelectOptionTone;
|
|
453
|
+
readonly description?: string;
|
|
454
|
+
}[];
|
|
455
|
+
readonly actions?: undefined;
|
|
456
|
+
};
|
|
397
457
|
export type EditRelatedListSectionViewModel = {
|
|
398
458
|
readonly kind: "relatedList";
|
|
399
459
|
readonly id?: string;
|
|
@@ -426,6 +486,13 @@ export type EditRelatedListSectionViewModel = {
|
|
|
426
486
|
* Section's title row, distinct from `toolbarActions` (which render
|
|
427
487
|
* above the table itself). */
|
|
428
488
|
readonly actions?: readonly RowAction[];
|
|
489
|
+
/** From `EditRelatedListSection.photoGrid` — draws the rows as image tiles. */
|
|
490
|
+
readonly photoGrid?: {
|
|
491
|
+
readonly imageField: string;
|
|
492
|
+
readonly captionField?: string;
|
|
493
|
+
readonly badgeField?: string;
|
|
494
|
+
readonly badgeFirst?: true;
|
|
495
|
+
};
|
|
429
496
|
/** From `EditRelatedListSection.emptyState` — forwarded to the
|
|
430
497
|
* DataTable's `emptyState` prop when the section has zero rows. */
|
|
431
498
|
readonly emptyState?: {
|
|
@@ -439,11 +506,15 @@ export type EditWriteFormSectionViewModel = {
|
|
|
439
506
|
readonly kind: "writeForm";
|
|
440
507
|
readonly title?: string;
|
|
441
508
|
readonly description?: string;
|
|
509
|
+
/** Translated `EditWriteFormSection.descriptionNarrow`. */
|
|
510
|
+
readonly descriptionNarrow?: string;
|
|
442
511
|
readonly columns: number;
|
|
443
512
|
readonly fields: readonly EditFieldViewModel[];
|
|
444
513
|
readonly icon?: IconKey;
|
|
445
514
|
readonly handler: string;
|
|
446
515
|
readonly submitLabel?: string;
|
|
516
|
+
/** From `EditWriteFormSection.submitWith`. */
|
|
517
|
+
readonly submitWith?: string;
|
|
447
518
|
/** From `EditWriteFormSection.actions`. */
|
|
448
519
|
readonly actions?: readonly RowAction[];
|
|
449
520
|
};
|
|
@@ -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
|
@@ -48,6 +48,8 @@ export const kumikoDefaultTranslations = {
|
|
|
48
48
|
"kumiko.field.file-list.preview": "Preview",
|
|
49
49
|
"kumiko.field.file-list.view": "View",
|
|
50
50
|
"kumiko.field.fillAction.failed": "Could not fetch a suggestion.",
|
|
51
|
+
"kumiko.field.aiAssist.prompt": "Tell the AI what to change",
|
|
52
|
+
"kumiko.field.aiAssist.failed": "The AI could not rewrite the text.",
|
|
51
53
|
"kumiko.field.writeOnly.remove": "Remove stored value",
|
|
52
54
|
"kumiko.field.writeOnly.set": "Set",
|
|
53
55
|
"kumiko.field.writeOnly.maskedSet": "•••••••••• set",
|
|
@@ -154,14 +156,19 @@ export const kumikoDefaultTranslations = {
|
|
|
154
156
|
"kumiko.reference.system-user": "System",
|
|
155
157
|
"kumiko.reference.unknown-user": "Unknown",
|
|
156
158
|
"kumiko.pager.status": "{from}–{to} of {total}",
|
|
157
|
-
"kumiko.pager.
|
|
159
|
+
"kumiko.pager.statusEmpty": "0 of 0",
|
|
158
160
|
"kumiko.form.all-required": "All fields are required.",
|
|
159
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}",
|
|
160
166
|
"kumiko.pager.pageSizeLabel": "Entries per page",
|
|
161
167
|
"kumiko.list.count.noun": "{count} {noun}",
|
|
162
168
|
"kumiko.list.count.one": "1 entry",
|
|
163
169
|
"kumiko.list.count.other": "{count} entries",
|
|
164
170
|
"kumiko.list.row-actions.more": "More actions",
|
|
171
|
+
"kumiko.photo-grid.fallback-caption": "Photo {n}",
|
|
165
172
|
"kumiko.page-header.actions": "Page actions",
|
|
166
173
|
"kumiko.list.actions": "Actions",
|
|
167
174
|
"kumiko.sidebar.toggle": "Toggle sidebar",
|
|
@@ -191,7 +198,7 @@ export const kumikoDefaultTranslations = {
|
|
|
191
198
|
"kumiko.list.bulk.result.dismiss": "Dismiss",
|
|
192
199
|
"kumiko.list.sort.by": "Sorted by {column}",
|
|
193
200
|
"kumiko.list.sort.prefix": "Sorted by",
|
|
194
|
-
"kumiko.list.sort.summary": "Sorted by {sort} {direction}
|
|
201
|
+
"kumiko.list.sort.summary": "Sorted by {sort} {direction}",
|
|
195
202
|
"kumiko.form.changed": "changed",
|
|
196
203
|
"kumiko.form.on-this-page": "On this page",
|
|
197
204
|
"kumiko.form.noUnsavedChanges": "No unsaved changes",
|