@cosmicdrift/kumiko-renderer 0.416.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 +1 -4
- package/dist/app/action-form-body.js +9 -8
- 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/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/grid-cell-for-field.js +1 -1
- package/dist/components/multi-select-chips.js +2 -1
- 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 +4 -2
- 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 +11 -0
- package/dist/components/render-field-ai-assist.js +3 -2
- package/dist/components/render-field-control.js +1 -1
- package/dist/components/render-field-value-chips.js +4 -2
- 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/headless/form/form-controller.d.ts +1 -0
- package/dist/headless/form/form-controller.js +1 -1
- package/dist/headless/format/index.js +5 -4
- package/dist/headless/format/relative-time.d.ts +2 -0
- package/dist/headless/format/relative-time.js +4 -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 +49 -4
- package/dist/hooks/use-list-table.js +11 -6
- package/dist/i18n-defaults.js +7 -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/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 +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-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 +123 -43
- 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/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/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,16 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { narrowAwareDescription } from "./narrow-description.js";
|
|
2
3
|
import { renderAllRequiredHint } from "./render-edit-banners.js";
|
|
3
4
|
import { renderFieldGrid } from "./render-edit-field-grid.js";
|
|
4
5
|
import { sectionNavAnchorId } from "./render-edit-helpers.js";
|
|
5
6
|
function renderTabbedGroupsSection(rc, section, sectionKey) {
|
|
6
7
|
const { Grid, Card } = rc.model.engine.state.primitives;
|
|
7
|
-
const groupsGrid = (_jsx(Grid, { columns: 1, children: section.groups?.map((group, groupIndex) => (_jsx(Card, { slots: { title: group.title },
|
|
8
|
+
const groupsGrid = (_jsx(Grid, { columns: 1, children: section.groups?.map((group, groupIndex) => (_jsx(Card, { slots: { title: group.title }, ...(rc.model.engine.props.recordSections?.labelTitles === true && {
|
|
9
|
+
options: { titleStyle: "label" },
|
|
10
|
+
}), testId: `section-${sectionKey}-group-${groupIndex}`, children: renderFieldGrid(rc.model, section, group.fields, group.columns, `${sectionKey}-group-${groupIndex}-grid`, group.columnsDeclared === true) }, group.title))) }, `${sectionKey}-groups`));
|
|
8
11
|
// `actions` on a `groups` section has no group of its own to
|
|
9
12
|
// sit in and would need an extra title-less Card around the
|
|
10
13
|
// group cards (Card-in-Card) — the boot-validator rejects that
|
|
11
14
|
// combination in tabs mode, so `sectionActionsEl` is always
|
|
12
15
|
// undefined here at runtime.
|
|
13
|
-
return rc.wrapWizardStep(sectionKey, _jsx(Card, { options: { framed: false }, ...(section.description !== undefined && {
|
|
16
|
+
return rc.wrapWizardStep(sectionKey, _jsx(Card, { options: { framed: false }, ...(section.description !== undefined && {
|
|
17
|
+
slots: { subtitle: narrowAwareDescription(section.description, section.descriptionNarrow) },
|
|
18
|
+
}), children: groupsGrid }, sectionKey));
|
|
14
19
|
}
|
|
15
20
|
function renderTabbedFieldsSection(rc, section, sectionKey) {
|
|
16
21
|
if (section.groups !== undefined)
|
|
@@ -23,10 +28,12 @@ function renderTabbedFieldsSection(rc, section, sectionKey) {
|
|
|
23
28
|
// description and actions, never the title text.
|
|
24
29
|
const cardEl = (_jsx(Card, { options: { framed: false }, ...((sectionActionsEl !== undefined || section.description !== undefined) && {
|
|
25
30
|
slots: {
|
|
26
|
-
...(section.description !== undefined && {
|
|
31
|
+
...(section.description !== undefined && {
|
|
32
|
+
subtitle: narrowAwareDescription(section.description, section.descriptionNarrow),
|
|
33
|
+
}),
|
|
27
34
|
...(sectionActionsEl !== undefined && { headerActions: sectionActionsEl }),
|
|
28
35
|
},
|
|
29
|
-
}), testId: `section-${sectionKey}`, children: renderFieldGrid(rc.model, section, section.fields, section.columns, `${sectionKey}-grid
|
|
36
|
+
}), testId: `section-${sectionKey}`, children: renderFieldGrid(rc.model, section, section.fields, section.columns, `${sectionKey}-grid`, section.columnsDeclared === true) }, sectionKey));
|
|
30
37
|
return rc.wrapWizardStep(sectionKey, cardEl);
|
|
31
38
|
}
|
|
32
39
|
// Suppress the section header when it would just repeat the form
|
|
@@ -36,26 +43,53 @@ function renderTabbedFieldsSection(rc, section, sectionKey) {
|
|
|
36
43
|
function resolveSectionTitle({ model, sectionIndex }, section) {
|
|
37
44
|
const { titles } = model;
|
|
38
45
|
const { state } = model.engine;
|
|
39
|
-
const repeatsTabLabel = state.isTabs && state.isStepped
|
|
46
|
+
const repeatsTabLabel = (state.isTabs && state.isStepped) ||
|
|
47
|
+
(sectionIndex === 0 && model.engine.props.recordSections?.omitFirstTitle === true);
|
|
40
48
|
if (titles.titleInSettingsHeader && sectionIndex === 0)
|
|
41
49
|
return section.title ?? titles.formTitle;
|
|
42
50
|
return section.title === titles.formTitle || repeatsTabLabel ? undefined : section.title;
|
|
43
51
|
}
|
|
44
52
|
function resolveSectionSubtitle({ model, sectionIndex }, section) {
|
|
45
53
|
const headerFallback = model.titles.titleInSettingsHeader && sectionIndex === 0;
|
|
46
|
-
return section.description
|
|
54
|
+
return (narrowAwareDescription(section.description, section.descriptionNarrow) ??
|
|
55
|
+
(headerFallback ? model.titles.formSubtitle : undefined));
|
|
56
|
+
}
|
|
57
|
+
function renderSectionFieldBody(model, section, sectionKey) {
|
|
58
|
+
const { Section } = model.engine.state.primitives;
|
|
59
|
+
if (section.groups === undefined) {
|
|
60
|
+
return renderFieldGrid(model, section, section.fields, section.columns, `${sectionKey}-grid`, section.columnsDeclared === true);
|
|
61
|
+
}
|
|
62
|
+
return section.groups.map((group, groupIndex) => (_jsx(Section, { title: group.title, titleStyle: "label", testId: `section-${sectionKey}-group-${groupIndex}`, children: renderFieldGrid(model, section, group.fields, group.columns, `${sectionKey}-group-${groupIndex}-grid`, group.columnsDeclared === true) }, group.title)));
|
|
63
|
+
}
|
|
64
|
+
function firstSectionRequiredHint(model, sectionIndex) {
|
|
65
|
+
const showsHint = model.engine.sections.showsAllRequiredHint &&
|
|
66
|
+
model.engine.state.insideDrawer &&
|
|
67
|
+
sectionIndex === 0;
|
|
68
|
+
return showsHint ? renderAllRequiredHint(model) : null;
|
|
69
|
+
}
|
|
70
|
+
function sectionHintProp(section, sectionKey, hintBelow) {
|
|
71
|
+
if (!hintBelow || typeof section.description !== "string")
|
|
72
|
+
return {};
|
|
73
|
+
return {
|
|
74
|
+
hint: {
|
|
75
|
+
text: section.description,
|
|
76
|
+
...(section.descriptionNarrow !== undefined && { textNarrow: section.descriptionNarrow }),
|
|
77
|
+
testId: `section-${sectionKey}-hint`,
|
|
78
|
+
},
|
|
79
|
+
};
|
|
47
80
|
}
|
|
48
81
|
function renderDefaultFieldsSection(rc, section, sectionKey) {
|
|
49
82
|
const { model, sectionIndex, sectionActionsEl } = rc;
|
|
50
83
|
const { Section } = model.engine.state.primitives;
|
|
51
84
|
const anchorId = sectionNavAnchorId(model.titles.sectionNavItems, sectionIndex);
|
|
52
85
|
const sectionTitle = resolveSectionTitle(rc, section);
|
|
53
|
-
|
|
86
|
+
// Record pages print the hint under the data (muted, first sentence bold)
|
|
87
|
+
// instead of between the label and the fields.
|
|
88
|
+
const labelTitles = model.engine.props.recordSections?.labelTitles === true;
|
|
89
|
+
const hintBelow = labelTitles && typeof section.description === "string";
|
|
90
|
+
const sectionSubtitle = hintBelow ? undefined : resolveSectionSubtitle(rc, section);
|
|
54
91
|
const sectionEl = (_jsxs(Section, { ...(anchorId !== undefined && { id: anchorId }), ...(sectionTitle !== undefined && { title: sectionTitle }), ...(sectionSubtitle !== undefined && { subtitle: sectionSubtitle }), ...(model.titles.stepRail &&
|
|
55
|
-
section.description !== undefined && { subtitleBelowLgOnly: true }), ...(section.icon !== undefined && { icon: section.icon }), ...(sectionActionsEl !== undefined && { actions: sectionActionsEl }), ...(model.footer.isSettingsList && { layout: "settings-list" }), testId: `section-${sectionKey}`, children: [model
|
|
56
|
-
model.engine.state.insideDrawer &&
|
|
57
|
-
sectionIndex === 0 &&
|
|
58
|
-
renderAllRequiredHint(model), renderFieldGrid(model, section, section.fields, section.columns, `${sectionKey}-grid`)] }, sectionKey));
|
|
92
|
+
section.description !== undefined && { subtitleBelowLgOnly: true }), ...(section.icon !== undefined && { icon: section.icon }), ...(labelTitles && { titleStyle: "label" }), ...sectionHintProp(section, sectionKey, hintBelow), ...(sectionActionsEl !== undefined && { actions: sectionActionsEl }), ...(model.footer.isSettingsList && { layout: "settings-list" }), testId: `section-${sectionKey}`, children: [firstSectionRequiredHint(model, sectionIndex), renderSectionFieldBody(model, section, sectionKey)] }, sectionKey));
|
|
59
93
|
return rc.wrapWizardStep(sectionKey, sectionEl);
|
|
60
94
|
}
|
|
61
95
|
export function renderFieldsSection(rc, section) {
|
|
@@ -82,7 +82,7 @@ function FooterStartGroup({ children, }) {
|
|
|
82
82
|
}
|
|
83
83
|
function renderCustomActions({ engine: { props, state }, layout, }) {
|
|
84
84
|
const { Button, Dialog } = state.primitives;
|
|
85
|
-
const button = (action) => (_jsx(RenderEditActionButton, { action: action, iconOnly: layout.iconOnlyMidActions, ...(action.pinnedOnPhone === true && { [FOOTER_ACTION_ROLE_PROP]: "inline" }), Button: Button, Dialog: Dialog, onError: state.setActionError }, action.id));
|
|
85
|
+
const button = (action) => (_jsx(RenderEditActionButton, { action: action, iconOnly: layout.iconOnlyMidActions, ...(action.pinnedOnPhone === true && { hideIcon: true }), ...(action.pinnedOnPhone === true && { [FOOTER_ACTION_ROLE_PROP]: "inline" }), Button: Button, Dialog: Dialog, onError: state.setActionError }, action.id));
|
|
86
86
|
const startActions = props.actions?.filter((action) => action.align === "start") ?? [];
|
|
87
87
|
const otherActions = props.actions?.filter((action) => action.align !== "start");
|
|
88
88
|
return (_jsxs(_Fragment, { children: [props.footerHint !== undefined && (_jsx("span", { "data-testid": "render-edit-footer-hint", className: "mr-auto min-w-0 text-[13px] text-muted-foreground max-sm:hidden", children: props.footerHint })), startActions.length > 0 && (_jsx(FooterStartGroup, { ...(startActions.some((action) => action.pinnedOnPhone === true) && {
|
|
@@ -57,7 +57,8 @@ function buildFormActionProps(model, header) {
|
|
|
57
57
|
layout.hasSecondaryFormActions && { secondaryActions: header.secondaryFormActions }),
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
-
function buildFormChromeProps(
|
|
60
|
+
function buildFormChromeProps(model, { formHeaderRegion, titleActionMount }) {
|
|
61
|
+
const { props, sections } = model.engine;
|
|
61
62
|
const { summary } = props;
|
|
62
63
|
return {
|
|
63
64
|
...(props.screen.layout.width !== undefined && { width: props.screen.layout.width }),
|
|
@@ -66,11 +67,12 @@ function buildFormChromeProps({ engine: { props, sections } }, { formHeaderRegio
|
|
|
66
67
|
...(sections.fillHeight && { fillHeight: sections.fillHeight }),
|
|
67
68
|
...(props.hideSectionTitles === true && { chromeless: true }),
|
|
68
69
|
...(summary !== undefined && { summary }),
|
|
70
|
+
...(props.formErrorOnTop === true && { topBanner: renderFormErrorBanner(model) }),
|
|
69
71
|
};
|
|
70
72
|
}
|
|
71
73
|
export function renderEditLayout(model) {
|
|
72
74
|
const { props, state, sections, handleSubmit } = model.engine;
|
|
73
75
|
const header = buildHeaderActions(model);
|
|
74
76
|
const { Form } = state.primitives;
|
|
75
|
-
return (_jsx(ExtensionFormRegistryProvider, { value: state.extensionFormRegistry, children: _jsxs(FormUploadTrackerProvider, { value: state.trackUpload, children: [state.menuActionConfirmDialog, renderPageHeader(model, header), _jsx(Form, { onSubmit: () => void handleSubmit(), ...(state.focusFirstErrorKey > 0 && { focusFirstErrorKey: state.focusFirstErrorKey }), ...buildFormHeadingProps(model), ...buildFormActionProps(model, header), testId: "render-edit-form", stickyActions: state.isWizard || props.fillScreenHeight === true, ...buildFormChromeProps(model, header), children: _jsxs(AllFieldsRequiredProvider, { value: sections.showsAllRequiredHint || props.screen.layout.hideRequiredMarker === true, children: [props.leadContent, sections.showsAllRequiredHint && !state.insideDrawer && renderAllRequiredHint(model), renderDraftPicker(model), renderWizardProgress(model), state.isTabs && state.isStepped && renderTabStrip(model),
|
|
77
|
+
return (_jsx(ExtensionFormRegistryProvider, { value: state.extensionFormRegistry, children: _jsxs(FormUploadTrackerProvider, { value: state.trackUpload, children: [state.menuActionConfirmDialog, renderPageHeader(model, header), _jsx(Form, { onSubmit: () => void handleSubmit(), ...(state.focusFirstErrorKey > 0 && { focusFirstErrorKey: state.focusFirstErrorKey }), ...buildFormHeadingProps(model), ...buildFormActionProps(model, header), testId: "render-edit-form", stickyActions: state.isWizard || props.fillScreenHeight === true, ...buildFormChromeProps(model, header), children: _jsxs(AllFieldsRequiredProvider, { value: sections.showsAllRequiredHint || props.screen.layout.hideRequiredMarker === true, children: [props.leadContent, sections.showsAllRequiredHint && !state.insideDrawer && renderAllRequiredHint(model), renderDraftPicker(model), renderWizardProgress(model), state.isTabs && state.isStepped && renderTabStrip(model), renderEditSections(model), renderAfterFormSlot(model), props.formErrorOnTop !== true && renderFormErrorBanner(model), renderRootIssueBanners(model), renderExtensionErrorBanner(model), renderActionErrorBanner(model), renderDeleteDialog(model)] }) })] }) }));
|
|
76
78
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ExtensionSectionMount } from "./edit-mounts.js";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { EditSlotMount, ExtensionSectionMount } from "./edit-mounts.js";
|
|
3
3
|
import { RelatedListSection } from "./related-list-section.js";
|
|
4
4
|
import { RenderEditActionButton } from "./render-edit-action-button.js";
|
|
5
5
|
import { renderFieldsSection } from "./render-edit-fields-section.js";
|
|
@@ -39,7 +39,8 @@ function renderRelatedListSection({ model, sectionIndex, sectionActionsEl }, sec
|
|
|
39
39
|
const anchorId = sectionNavAnchorId(model.titles.sectionNavItems, sectionIndex);
|
|
40
40
|
const mount = (_jsx(RelatedListSection, { ...(anchorId !== undefined && { anchorId }), section: section, parentId: parentId,
|
|
41
41
|
// @cast-boundary form-values: TValues is structurally a Record.
|
|
42
|
-
record: form.snapshot.values, featureName: props.featureName, translate: model.engine.state.translate, hideTitle: hideSectionTitles, ...(
|
|
42
|
+
record: form.snapshot.values, featureName: props.featureName, translate: model.engine.state.translate, hideTitle: hideSectionTitles, ...(props.recordSections?.labelTitles === true && { labelTitle: true }), ...(sectionIndex === 0 &&
|
|
43
|
+
props.recordSections?.omitFirstTitle === true && { omitTitle: true }), ...(refreshToken !== undefined && { refreshToken }), ...(hideSectionTitles !== true &&
|
|
43
44
|
sectionActionsEl !== undefined && { actions: sectionActionsEl }), ...(onRelatedListDrawerAction !== undefined && {
|
|
44
45
|
onOpenDrawer: onRelatedListDrawerAction,
|
|
45
46
|
}) }, section.title));
|
|
@@ -52,16 +53,20 @@ function renderStepListSection({ model, sectionIndex }, section) {
|
|
|
52
53
|
if (StepList === undefined || section.items.length === 0)
|
|
53
54
|
return null;
|
|
54
55
|
const items = section.items.map((item, index) => ({ id: String(index), ...item }));
|
|
55
|
-
return (_jsx(Section, { ...(section.title !== undefined &&
|
|
56
|
+
return (_jsx(Section, { ...(section.title !== undefined &&
|
|
57
|
+
!model.engine.props.hideSectionTitles &&
|
|
58
|
+
!(sectionIndex === 0 && model.engine.props.recordSections?.omitFirstTitle === true)
|
|
56
59
|
? { title: section.title }
|
|
57
|
-
: {}),
|
|
60
|
+
: {}), ...(model.engine.props.recordSections?.labelTitles === true && {
|
|
61
|
+
titleStyle: "label",
|
|
62
|
+
}), testId: "step-list-section", children: _jsx(StepList, { items: items, testId: "step-list" }) }, section.title ?? `step-list-${sectionIndex}`));
|
|
58
63
|
}
|
|
59
64
|
function renderWriteFormSection({ model, sectionIndex, sectionActionsEl }, section) {
|
|
60
65
|
const { props, state, sections } = model.engine;
|
|
61
66
|
// Own submit button + dispatcher call, entirely independent of
|
|
62
67
|
// this screen's (nonexistent, on projectionDetail) form submit —
|
|
63
68
|
// rejected at boot in wizard layouts, so no WizardStepGroup here.
|
|
64
|
-
return (_jsx(WriteFormSection, { section: section, featureName: props.featureName, translate: state.translate, hideTitle: props.hideSectionTitles, onSubmitted: () => props.onReload?.(), ...(sections.isLoneWriteFormTab && { onFooterAction: sections.setWriteFormFooterAction }), ...(sectionActionsEl !== undefined && { actions: sectionActionsEl }) }, section.title ?? `write-form-${sectionIndex}`));
|
|
69
|
+
return (_jsx(WriteFormSection, { section: section, featureName: props.featureName, translate: state.translate, hideTitle: props.hideSectionTitles, ...(props.recordSections?.labelTitles === true && { labelTitle: true }), onSubmitted: () => props.onReload?.(), recordValues: model.engine.form.snapshot.values, ...(sections.isLoneWriteFormTab && { onFooterAction: sections.setWriteFormFooterAction }), ...(sectionActionsEl !== undefined && { actions: sectionActionsEl }) }, section.title ?? `write-form-${sectionIndex}`));
|
|
65
70
|
}
|
|
66
71
|
function renderSectionByKind(rc, section) {
|
|
67
72
|
switch (section.kind) {
|
|
@@ -118,11 +123,44 @@ function createWizardStepWrapper({ engine: { props, state, steps } }, sectionInd
|
|
|
118
123
|
return (_jsx(WizardStepGroup, { hidden: stepHidden, ...(props.hideSectionTitles === true && { inset: true }), children: el }, key));
|
|
119
124
|
};
|
|
120
125
|
}
|
|
126
|
+
// `after` stands directly under its section card; the narrow options are CSS-only so the
|
|
127
|
+
// section stays mounted (its form state and queries survive a resize).
|
|
128
|
+
function withSectionPresentation(model, section, sectionIndex, node) {
|
|
129
|
+
const { props, form, sections, state } = model.engine;
|
|
130
|
+
const { FillContainer } = state.primitives;
|
|
131
|
+
if (node === null || FillContainer === undefined)
|
|
132
|
+
return node;
|
|
133
|
+
const narrowClass = section.hideOnNarrow === true
|
|
134
|
+
? "max-sm:hidden"
|
|
135
|
+
: section.showOnNarrowOnly === true
|
|
136
|
+
? "sm:hidden"
|
|
137
|
+
: undefined;
|
|
138
|
+
const titleClass = section.titleOnNarrow === false ? "max-sm:[&_[data-section-title]]:hidden" : undefined;
|
|
139
|
+
if (section.after === undefined && narrowClass === undefined && titleClass === undefined) {
|
|
140
|
+
return node;
|
|
141
|
+
}
|
|
142
|
+
return (_jsxs(FillContainer, { className: [narrowClass, titleClass, "gap-3"].filter((c) => c !== undefined).join(" "), children: [node, section.after !== undefined && (_jsx(EditSlotMount, { slot: section.after, slotName: "afterSection", screenId: props.screen.id, entityName: sections.vm.entityName, entityId: resolveExtensionEntityId(props.entityId, sections.vm.id), values: form.snapshot.values, ...(props.activeTabId !== undefined && { activeTabId: props.activeTabId }) }))] }, `section-presentation-${sectionIndex}`));
|
|
143
|
+
}
|
|
121
144
|
export function renderEditSections(model) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
sectionIndex,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
145
|
+
const rendered = model.engine.sections.filteredSections.map((section, sectionIndex) => ({
|
|
146
|
+
section,
|
|
147
|
+
node: withSectionPresentation(model, section, sectionIndex, renderSectionByKind({
|
|
148
|
+
model,
|
|
149
|
+
sectionIndex,
|
|
150
|
+
sectionActionsEl: renderSectionActions(model, section),
|
|
151
|
+
wrapWizardStep: createWizardStepWrapper(model, sectionIndex),
|
|
152
|
+
}, section)),
|
|
153
|
+
}));
|
|
154
|
+
const { FillContainer } = model.engine.state.primitives;
|
|
155
|
+
if (model.engine.props.recordSections?.photosBeside !== true || FillContainer === undefined) {
|
|
156
|
+
return rendered.map(({ node }) => node);
|
|
157
|
+
}
|
|
158
|
+
const photos = rendered.filter(({ section }) => isPhotoGridSection(section));
|
|
159
|
+
const rest = rendered.filter(({ section }) => !isPhotoGridSection(section));
|
|
160
|
+
if (photos.length === 0 || rest.length === 0)
|
|
161
|
+
return rendered.map(({ node }) => node);
|
|
162
|
+
return (_jsxs(FillContainer, { testId: "record-photos-beside", className: "grid grid-cols-1 items-start gap-x-8 gap-y-6 lg:grid-cols-[minmax(0,380px)_minmax(0,1fr)]", children: [_jsx(FillContainer, { className: "gap-6", children: rest.map(({ node }) => node) }), _jsx(FillContainer, { className: "gap-6", children: photos.map(({ node }) => node) })] }, "photos-beside"));
|
|
163
|
+
}
|
|
164
|
+
function isPhotoGridSection(section) {
|
|
165
|
+
return section.kind === "relatedList" && section.photoGrid !== undefined;
|
|
128
166
|
}
|
|
@@ -87,7 +87,7 @@ export function deriveTitles(engine, layout, footer) {
|
|
|
87
87
|
// or, without one, the screen title, so a form title above the sections repeats it.
|
|
88
88
|
titleInHeaderRegion: headerRegion !== undefined && PageHeader !== undefined && state.pageHeaderSlotAvailable,
|
|
89
89
|
stepRail: state.isWizard && layout.isScreenForm && StepBar !== undefined,
|
|
90
|
-
sectionNavItems: layout.isScreenForm && !state.isStepped
|
|
90
|
+
sectionNavItems: layout.isScreenForm && !state.isStepped && props.recordSections?.pageNavigation !== false
|
|
91
91
|
? deriveSectionNavItems(filteredSections, formTitle)
|
|
92
92
|
: [],
|
|
93
93
|
compactStepLabel: deriveCompactStepLabel(translate, filteredSections[currentStep]?.title, currentStep, lastStepIndex),
|
|
@@ -203,6 +203,17 @@ export type RenderEditProps<TValues extends FormValues, TCtx = unknown> = {
|
|
|
203
203
|
readonly hideSectionTitles?: boolean;
|
|
204
204
|
/** Id of the active tab of a tabbed projectionDetail; handed to the `afterForm` slot. */
|
|
205
205
|
readonly activeTabId?: string;
|
|
206
|
+
/** Record-view look of a projectionDetail; each key is opt-in. */
|
|
207
|
+
readonly recordSections?: {
|
|
208
|
+
/** Section titles render as small uppercase labels without separators. */
|
|
209
|
+
readonly labelTitles?: true;
|
|
210
|
+
/** The first section's title is the tab label right above it and is left out. */
|
|
211
|
+
readonly omitFirstTitle?: true;
|
|
212
|
+
/** `false` leaves out the "On this page" navigation. */
|
|
213
|
+
readonly pageNavigation?: false;
|
|
214
|
+
/** Fields sections and the photo-grid relatedList sit side by side from `lg` up. */
|
|
215
|
+
readonly photosBeside?: true;
|
|
216
|
+
};
|
|
206
217
|
/** Screen body fills the shell height: the form gets `fillHeight` and
|
|
207
218
|
* `stickyActions` (sections scroll, footer pinned). Set by KumikoScreen for
|
|
208
219
|
* screens with `fillHeight !== false`; dialogs and other embedded hosts
|
|
@@ -5,6 +5,7 @@ import { useOptionalDispatcher } from "../context/dispatcher-context.js";
|
|
|
5
5
|
import { useTranslation } from "../i18n.js";
|
|
6
6
|
import { usePrimitives } from "../primitives.js";
|
|
7
7
|
import { useAiAssistPayload } from "./ai-assist-payload.js";
|
|
8
|
+
import { choiceChipClass } from "./choice-chip-class.js";
|
|
8
9
|
// Mounted only with a dispatcher; without one the field stays a plain input.
|
|
9
10
|
export function AiAssistControl(props) {
|
|
10
11
|
const dispatcher = useOptionalDispatcher();
|
|
@@ -77,7 +78,7 @@ function AiAssistChips({ field, aiAssist, onChange, input, row }) {
|
|
|
77
78
|
setActive(next);
|
|
78
79
|
void run(next, undefined);
|
|
79
80
|
};
|
|
80
|
-
return (_jsxs(_Fragment, { children: [input, _jsxs("div", { className: "flex flex-wrap items-center gap-2", "data-testid": `field-ai-assist-${field.field}`, children: [aiAssist.chips?.map((chip, index) => (_jsx(Button, { variant: "secondary", size: "sm", pressed: active.has(index), disabled: busy || field.readOnly, testId: `field-ai-chip-${field.field}-${index}`, onClick: () => toggle(index), children: chip.label }, chip.label))), aiAssist.prompt !== undefined && (_jsx(Input, { kind: "text", id: `${field.field}-ai-instruction`, name: `${field.field}-ai-instruction`, value: instruction, onChange: setInstruction, onKeyDown: (event) => {
|
|
81
|
+
return (_jsxs(_Fragment, { children: [input, _jsxs("div", { className: "order-2 flex flex-wrap items-center gap-2", "data-testid": `field-ai-assist-${field.field}`, children: [aiAssist.chips?.map((chip, index) => (_jsx(Button, { variant: "secondary", size: "sm", className: choiceChipClass(active.has(index)), pressed: active.has(index), disabled: busy || field.readOnly, testId: `field-ai-chip-${field.field}-${index}`, onClick: () => toggle(index), children: active.has(index) ? `✓ ${chip.label}` : chip.label }, chip.label))), aiAssist.prompt !== undefined && (_jsx(Input, { kind: "text", id: `${field.field}-ai-instruction`, name: `${field.field}-ai-instruction`, value: instruction, onChange: setInstruction, onKeyDown: (event) => {
|
|
81
82
|
if (event.key !== "Enter")
|
|
82
83
|
return;
|
|
83
84
|
// Enter must not submit the host form.
|
|
@@ -85,5 +86,5 @@ function AiAssistChips({ field, aiAssist, onChange, input, row }) {
|
|
|
85
86
|
if (busy || field.readOnly || instruction.trim() === "")
|
|
86
87
|
return;
|
|
87
88
|
void run(active, instruction.trim());
|
|
88
|
-
}, disabled: busy || field.readOnly, placeholder: aiAssist.prompt.placeholder ?? t("kumiko.field.aiAssist.prompt"), testId: `field-ai-prompt-${field.field}` }))] }), note !== undefined && (_jsx("span", { className: "text-xs text-muted-foreground", "data-testid": `field-ai-note-${field.field}`, children: note })), failed && (_jsx(Banner, { variant: "error", testId: `field-ai-error-${field.field}`, children: t("kumiko.field.aiAssist.failed") }))] }));
|
|
89
|
+
}, disabled: busy || field.readOnly, placeholder: aiAssist.prompt.placeholder ?? t("kumiko.field.aiAssist.prompt"), testId: `field-ai-prompt-${field.field}` }))] }), note !== undefined && (_jsx("span", { className: "order-2 text-xs text-muted-foreground", "data-testid": `field-ai-note-${field.field}`, children: note })), failed && (_jsx(Banner, { variant: "error", testId: `field-ai-error-${field.field}`, children: t("kumiko.field.aiAssist.failed") }))] }));
|
|
89
90
|
}
|
|
@@ -77,7 +77,7 @@ const readOnlyTextRule = ({ field, Text, Link, appLocale, t, readOnlyText }) =>
|
|
|
77
77
|
if (href !== undefined) {
|
|
78
78
|
return (_jsx(Link, { href: href, className: "underline", testId: `field-value-${field.field}`, children: readOnlyDisplayText(field, appLocale, t) }));
|
|
79
79
|
}
|
|
80
|
-
return (_jsx(Text, { testId: `field-value-${field.field}`, children: readOnlyDisplayText(field, appLocale, t) }));
|
|
80
|
+
return (_jsx(Text, { testId: `field-value-${field.field}`, ...(field.concealed === true && { concealed: true }), children: readOnlyDisplayText(field, appLocale, t) }));
|
|
81
81
|
};
|
|
82
82
|
const writeOnlyRule = ({ field, id, hasError, onChange, changed, readOnlyText }) => {
|
|
83
83
|
if (field.type !== "text" || field.writeOnly !== true || readOnlyText)
|
|
@@ -2,6 +2,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { currencyDecimals, formatMoney, resolveSafeMoneyLocale, } from "../headless/index.js";
|
|
3
3
|
import { useOptionalLocale } from "../i18n.js";
|
|
4
4
|
import { usePrimitives } from "../primitives.js";
|
|
5
|
+
import { choiceChipClass } from "./choice-chip-class.js";
|
|
5
6
|
import { moneyPayload, resolveMoneyCurrency } from "./render-field-values.js";
|
|
6
7
|
function chipValues(row, from) {
|
|
7
8
|
const raw = row[from];
|
|
@@ -13,7 +14,8 @@ function chipText(field, value, currency, locale) {
|
|
|
13
14
|
const decimals = currencyDecimals(currency);
|
|
14
15
|
return formatMoney(Math.round(value * 10 ** decimals), currency, locale, Number.isInteger(value) ? 0 : decimals);
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
+
const text = new Intl.NumberFormat(resolveSafeMoneyLocale(locale)).format(value);
|
|
18
|
+
return typeof field.suffix === "string" ? `${text} ${field.suffix}` : text;
|
|
17
19
|
}
|
|
18
20
|
// The form holds a money value as { amount (major units), currency }.
|
|
19
21
|
function currentMajorValue(field) {
|
|
@@ -40,6 +42,6 @@ export function ValueChipsControl({ field, from, row, onChange, input, }) {
|
|
|
40
42
|
};
|
|
41
43
|
return (_jsxs(_Fragment, { children: [input, values.length > 0 && (_jsx(Grid, { columns: "auto", tight: true, testId: `field-value-chips-${field.field}`, children: values.map((value) => {
|
|
42
44
|
const selected = value === current;
|
|
43
|
-
return (_jsxs(Button, { variant: "secondary", size: "sm", pressed: selected, disabled: field.readOnly, testId: `field-value-chip-${field.field}-${value}`, onClick: () => pick(value), children: [selected ? "✓ " : "", chipText(field, value, currency, locale)] }, value));
|
|
45
|
+
return (_jsxs(Button, { variant: "secondary", size: "sm", className: choiceChipClass(selected), pressed: selected, disabled: field.readOnly, testId: `field-value-chip-${field.field}-${value}`, onClick: () => pick(value), children: [selected ? "✓ " : "", chipText(field, value, currency, locale)] }, value));
|
|
44
46
|
}) }))] }));
|
|
45
47
|
}
|
|
@@ -5,6 +5,7 @@ export declare function hintViewModel(hint: ListColumnHint, rowToneField: string
|
|
|
5
5
|
export declare function withDisplayColumns(columns: readonly ListColumnViewModel[], screen: EntityListScreenDefinition): readonly ListColumnViewModel[];
|
|
6
6
|
export declare function withPillColumns(columns: readonly ListColumnViewModel[], screen: EntityListScreenDefinition): readonly ListColumnViewModel[];
|
|
7
7
|
export declare function withEmptyPlaceholderColumns(columns: readonly ListColumnViewModel[], screen: EntityListScreenDefinition): readonly ListColumnViewModel[];
|
|
8
|
+
export declare function withCellStyleColumns(columns: readonly ListColumnViewModel[], screen: EntityListScreenDefinition): readonly ListColumnViewModel[];
|
|
8
9
|
export declare function withNarrowOnlyColumns(columns: readonly ListColumnViewModel[], screen: EntityListScreenDefinition): readonly ListColumnViewModel[];
|
|
9
10
|
export declare function withNarrowInlineColumns(columns: readonly ListColumnViewModel[], screen: EntityListScreenDefinition): readonly ListColumnViewModel[];
|
|
10
11
|
export declare function withHintColumns(columns: readonly ListColumnViewModel[], screen: EntityListScreenDefinition, translate: Translate): readonly ListColumnViewModel[];
|
|
@@ -19,7 +19,10 @@ export function hintViewModel(hint, rowToneField, translate) {
|
|
|
19
19
|
}
|
|
20
20
|
// Only "badge" is drawn by list tables; "button" is boot-rejected there (a row button is a rowAction) and "bar"/"datetime" are dashboard-only.
|
|
21
21
|
export function withDisplayColumns(columns, screen) {
|
|
22
|
-
const specs = new Map(screen.columns.map((spec) =>
|
|
22
|
+
const specs = new Map(screen.columns.map((spec) => {
|
|
23
|
+
const column = normalizeListColumn(spec);
|
|
24
|
+
return [column.field, column];
|
|
25
|
+
}));
|
|
23
26
|
return columns.map((col) => {
|
|
24
27
|
const spec = specs.get(col.field);
|
|
25
28
|
if (spec?.display !== "badge")
|
|
@@ -46,13 +49,35 @@ export function withPillColumns(columns, screen) {
|
|
|
46
49
|
});
|
|
47
50
|
}
|
|
48
51
|
export function withEmptyPlaceholderColumns(columns, screen) {
|
|
49
|
-
const
|
|
52
|
+
const placeholders = new Map(screen.columns.flatMap((spec) => {
|
|
50
53
|
const column = normalizeListColumn(spec);
|
|
51
|
-
return column.emptyPlaceholder ===
|
|
54
|
+
return column.emptyPlaceholder === undefined ? [] : [[column.field, column.emptyPlaceholder]];
|
|
52
55
|
}));
|
|
53
|
-
if (
|
|
56
|
+
if (placeholders.size === 0)
|
|
54
57
|
return columns;
|
|
55
|
-
return columns.map((col) =>
|
|
58
|
+
return columns.map((col) => {
|
|
59
|
+
const emptyPlaceholder = placeholders.get(col.field);
|
|
60
|
+
return emptyPlaceholder === undefined ? col : { ...col, emptyPlaceholder };
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
export function withCellStyleColumns(columns, screen) {
|
|
64
|
+
const specs = new Map(screen.columns.map((spec) => [normalizeListColumn(spec).field, normalizeListColumn(spec)]));
|
|
65
|
+
return columns.map((col) => {
|
|
66
|
+
const spec = specs.get(col.field);
|
|
67
|
+
if (spec === undefined)
|
|
68
|
+
return col;
|
|
69
|
+
const { ellipsis, multiline, cardAbove, emphasis, dateOnlyAfterDays, tone, cardBadge } = spec;
|
|
70
|
+
return {
|
|
71
|
+
...col,
|
|
72
|
+
...(ellipsis !== undefined && { ellipsis }),
|
|
73
|
+
...(multiline !== undefined && { multiline }),
|
|
74
|
+
...(cardAbove !== undefined && { cardAbove }),
|
|
75
|
+
...(emphasis !== undefined && { emphasis }),
|
|
76
|
+
...(dateOnlyAfterDays !== undefined && { dateOnlyAfterDays }),
|
|
77
|
+
...(tone !== undefined && { tone }),
|
|
78
|
+
...(cardBadge !== undefined && { cardBadge }),
|
|
79
|
+
};
|
|
80
|
+
});
|
|
56
81
|
}
|
|
57
82
|
export function withNarrowOnlyColumns(columns, screen) {
|
|
58
83
|
const narrowOnly = new Set(screen.columns.flatMap((spec) => {
|
|
@@ -119,8 +119,6 @@ function buildLinkItemsFor(lookup) {
|
|
|
119
119
|
}
|
|
120
120
|
function buildReferenceRenderer(lookup) {
|
|
121
121
|
const { col, map, labelField, unresolvedLabel } = lookup;
|
|
122
|
-
// A function renderer bypasses DataTableCell's empty path, so `emptyPlaceholder: false` is honoured here.
|
|
123
|
-
const empty = col.emptyPlaceholder === false ? "" : EMPTY_VALUE_PLACEHOLDER;
|
|
124
122
|
return (value, row) => {
|
|
125
123
|
// Server eager loading: when the server includes _refs, read the display
|
|
126
124
|
// value directly from the resolved row. This avoids a round trip
|
|
@@ -137,11 +135,11 @@ function buildReferenceRenderer(lookup) {
|
|
|
137
135
|
// Renderer-side fallback when server eager loading is not active.
|
|
138
136
|
if (Array.isArray(value)) {
|
|
139
137
|
if (value.length === 0)
|
|
140
|
-
return
|
|
138
|
+
return "";
|
|
141
139
|
return value.map((v) => map?.get(String(v)) ?? unresolvedLabel(String(v))).join(", ");
|
|
142
140
|
}
|
|
143
141
|
if (value === null || value === undefined || value === "")
|
|
144
|
-
return
|
|
142
|
+
return "";
|
|
145
143
|
const idStr = String(value);
|
|
146
144
|
return map?.get(idStr) ?? unresolvedLabel(idStr);
|
|
147
145
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { DataTableProps } from "../primitives.tsx";
|
|
2
2
|
/** Tints a row by the tone its `field` holds; other values leave the row untoned. */
|
|
3
3
|
export declare function rowToneFromField(field: string | undefined): DataTableProps["rowTone"];
|
|
4
|
+
/** Mutes a row whose `field` holds `true`. */
|
|
5
|
+
export declare function rowMutedFromField(field: string | undefined): DataTableProps["rowMuted"];
|
|
@@ -8,3 +8,9 @@ export function rowToneFromField(field) {
|
|
|
8
8
|
return isSelectOptionTone(tone) ? tone : undefined;
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
+
/** Mutes a row whose `field` holds `true`. */
|
|
12
|
+
export function rowMutedFromField(field) {
|
|
13
|
+
if (field === undefined)
|
|
14
|
+
return undefined;
|
|
15
|
+
return (row) => row.values[field] === true;
|
|
16
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ListNarrowFacets } from "@cosmicdrift/kumiko-types/screen";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
|
+
import type { DataTableProps } from "../primitives.tsx";
|
|
3
4
|
import type { RenderListProps } from "./render-list-types.ts";
|
|
4
5
|
type Pick2<K extends keyof RenderListProps> = Pick<RenderListProps, K>;
|
|
5
6
|
export declare function tableChromeProps(p: Pick2<"onRowClick" | "description"> & {
|
|
@@ -17,6 +18,9 @@ export declare function tableChromeProps(p: Pick2<"onRowClick" | "description">
|
|
|
17
18
|
};
|
|
18
19
|
export declare function tableSortPagingProps(p: Pick2<"sort" | "onSortChange" | "sortOptions" | "toolbarSort" | "pager" | "onReachEnd" | "loadingMore" | "hasMore"> & {
|
|
19
20
|
readonly narrowFacets?: ListNarrowFacets;
|
|
21
|
+
readonly screenToolbarSort?: boolean;
|
|
22
|
+
/** A stand-in screen is a locked preview: no paging. */
|
|
23
|
+
readonly isStandIn: boolean;
|
|
20
24
|
}): {
|
|
21
25
|
narrowFacets?: "pills" | undefined;
|
|
22
26
|
sort?: import("../primitives.tsx").DataTableSort | null | undefined;
|
|
@@ -35,11 +39,14 @@ export declare function tableSortPagingProps(p: Pick2<"sort" | "onSortChange" |
|
|
|
35
39
|
loadingMore?: boolean | undefined;
|
|
36
40
|
hasMore?: boolean | undefined;
|
|
37
41
|
};
|
|
38
|
-
export declare function tableRowProps(p: Pick2<"rowActions" | "rowActionMode" | "bulk" | "rowTone">
|
|
42
|
+
export declare function tableRowProps(p: Pick2<"rowActions" | "rowActionMode" | "bulk" | "rowTone"> & {
|
|
43
|
+
readonly rowMuted: DataTableProps["rowMuted"];
|
|
44
|
+
}): {
|
|
39
45
|
rowActions?: readonly import("../primitives.tsx").DataTableRowAction[] | undefined;
|
|
40
46
|
rowActionMode?: import("../primitives.tsx").DataTableRowActionMode | undefined;
|
|
41
47
|
bulk?: import("../data-table-bulk-types.ts").DataTableBulk | undefined;
|
|
42
48
|
rowTone?: ((row: import("../headless/index.ts").ListRowViewModel) => import("@cosmicdrift/kumiko-types/fields").SelectOptionTone | undefined) | undefined;
|
|
49
|
+
rowMuted?: ((row: import("../headless/index.ts").ListRowViewModel) => boolean) | undefined;
|
|
43
50
|
};
|
|
44
51
|
export declare function tableFilterProps(p: Pick2<"filterFacets" | "filterValues" | "onFilterChange" | "onFilterReset" | "dateRangeFacets" | "onDateRangeChange">): {
|
|
45
52
|
filterFacets?: readonly import("../data-table-facet-types.ts").DataTableFacet[] | undefined;
|
|
@@ -49,9 +56,13 @@ export declare function tableFilterProps(p: Pick2<"filterFacets" | "filterValues
|
|
|
49
56
|
dateRangeFacets?: readonly import("../data-table-facet-types.ts").DataTableDateRangeFacet[] | undefined;
|
|
50
57
|
onDateRangeChange?: ((field: string, bound: "from" | "to", value: string) => void) | undefined;
|
|
51
58
|
};
|
|
52
|
-
export declare function tableLayoutProps(p: Pick2<"chromeless" | "scrollBody" | "screenPadding" | "expandedRowIds" | "onToggleRowExpanded" | "renderExpandedRow">
|
|
59
|
+
export declare function tableLayoutProps(p: Pick2<"chromeless" | "scrollBody" | "hideCountFooter" | "plainPhoneCards" | "screenPadding" | "expandedRowIds" | "onToggleRowExpanded" | "renderExpandedRow"> & {
|
|
60
|
+
readonly isStandIn: boolean;
|
|
61
|
+
}): {
|
|
53
62
|
chromeless?: boolean | undefined;
|
|
54
63
|
scrollBody?: boolean | undefined;
|
|
64
|
+
hideCountFooter?: true | undefined;
|
|
65
|
+
plainPhoneCards?: boolean | undefined;
|
|
55
66
|
screenPadding?: boolean | undefined;
|
|
56
67
|
expandedRowIds?: ReadonlySet<string> | undefined;
|
|
57
68
|
onToggleRowExpanded?: ((rowId: string) => void) | undefined;
|
|
@@ -10,7 +10,9 @@ export function tableChromeProps(p) {
|
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
12
|
export function tableSortPagingProps(p) {
|
|
13
|
-
const { sort, onSortChange, sortOptions,
|
|
13
|
+
const { sort, onSortChange, sortOptions, onReachEnd, loadingMore, hasMore } = p;
|
|
14
|
+
const toolbarSort = p.toolbarSort ?? p.screenToolbarSort;
|
|
15
|
+
const pager = p.isStandIn ? undefined : p.pager;
|
|
14
16
|
return {
|
|
15
17
|
...(p.narrowFacets !== undefined && { narrowFacets: p.narrowFacets }),
|
|
16
18
|
...(sort !== undefined && { sort }),
|
|
@@ -24,12 +26,13 @@ export function tableSortPagingProps(p) {
|
|
|
24
26
|
};
|
|
25
27
|
}
|
|
26
28
|
export function tableRowProps(p) {
|
|
27
|
-
const { rowActions, rowActionMode, bulk, rowTone } = p;
|
|
29
|
+
const { rowActions, rowActionMode, bulk, rowTone, rowMuted } = p;
|
|
28
30
|
return {
|
|
29
31
|
...(rowActions !== undefined && { rowActions }),
|
|
30
32
|
...(rowActionMode !== undefined && { rowActionMode }),
|
|
31
33
|
...(bulk !== undefined && { bulk }),
|
|
32
34
|
...(rowTone !== undefined && { rowTone }),
|
|
35
|
+
...(rowMuted !== undefined && { rowMuted }),
|
|
33
36
|
};
|
|
34
37
|
}
|
|
35
38
|
export function tableFilterProps(p) {
|
|
@@ -44,10 +47,13 @@ export function tableFilterProps(p) {
|
|
|
44
47
|
};
|
|
45
48
|
}
|
|
46
49
|
export function tableLayoutProps(p) {
|
|
47
|
-
const { chromeless, scrollBody, screenPadding, expandedRowIds, onToggleRowExpanded, renderExpandedRow, } = p;
|
|
50
|
+
const { chromeless, scrollBody, plainPhoneCards, screenPadding, expandedRowIds, onToggleRowExpanded, renderExpandedRow, } = p;
|
|
51
|
+
const hideCountFooter = p.isStandIn || p.hideCountFooter === true;
|
|
48
52
|
return {
|
|
49
53
|
...(chromeless !== undefined && { chromeless }),
|
|
50
54
|
...(scrollBody !== undefined && { scrollBody }),
|
|
55
|
+
...(hideCountFooter && { hideCountFooter }),
|
|
56
|
+
...(plainPhoneCards !== undefined && { plainPhoneCards }),
|
|
51
57
|
...(screenPadding !== undefined && { screenPadding }),
|
|
52
58
|
...(expandedRowIds !== undefined && { expandedRowIds }),
|
|
53
59
|
...(onToggleRowExpanded !== undefined && { onToggleRowExpanded }),
|
|
@@ -104,6 +104,10 @@ export type RenderListProps = {
|
|
|
104
104
|
/** Forwarded to `DataTableProps.scrollBody` — bounds the table height and scrolls rows
|
|
105
105
|
* internally instead of growing the page (relatedList in a tabs-mode section). Default false. */
|
|
106
106
|
readonly scrollBody?: boolean;
|
|
107
|
+
/** Forwarded to `DataTableProps.hideCountFooter` (relatedList: the tab label already says how many). */
|
|
108
|
+
readonly hideCountFooter?: boolean;
|
|
109
|
+
/** Forwarded to `DataTableProps.plainPhoneCards` (relatedList: a history reads as a plain feed on the phone). */
|
|
110
|
+
readonly plainPhoneCards?: boolean;
|
|
107
111
|
/** Forwarded to `DataTableProps.screenPadding` — `true`: the table carries
|
|
108
112
|
* the shared screen padding because it is the screen body (entityList/
|
|
109
113
|
* projectionList). Explicit `false`: no padding at all — the host already
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, useState } from "react";
|
|
3
|
+
import { useIsStandInScreen } from "../app/locked-screen-header.js";
|
|
3
4
|
import { useTranslation } from "../i18n.js";
|
|
4
5
|
import { usePageHeaderCompact, usePageHeaderSlotAvailable } from "../page-header-slot.js";
|
|
5
6
|
import { usePrimitives } from "../primitives.js";
|
|
6
7
|
import { renderReferenceLookupBridges } from "./render-list-reference-bridge.js";
|
|
7
|
-
import { rowToneFromField } from "./render-list-row-tone.js";
|
|
8
|
+
import { rowMutedFromField, rowToneFromField } from "./render-list-row-tone.js";
|
|
8
9
|
import { tableChromeProps, tableFilterProps, tableLayoutProps, tableRowProps, tableSortPagingProps, } from "./render-list-table-props.js";
|
|
9
10
|
import { composeEmptyState, renderCreateButton, renderHeaderActions, renderMenuActionError, renderPageHeader, renderSearchInput, renderToolbarEnd, } from "./render-list-toolbar.js";
|
|
10
11
|
import { buildPromotedMenuItems, resolveItemNoun, resolveToolbarLabels, resolveToolbarTitle, splitToolbarActions, } from "./render-list-toolbar-model.js";
|
|
11
12
|
import { useRenderListColumns } from "./use-render-list-columns.js";
|
|
12
13
|
import { useRenderListSearch } from "./use-render-list-search.js";
|
|
13
14
|
export function RenderList(props) {
|
|
14
|
-
const { screen, entity, rows, featureName, translate: translateProp, onRowClick, emptyState, onCreate, createLabel, searchable = false, searchPlaceholder, description, emptyContent, narrowed = false, namedFilterEmpty, defaultFilterActive: defaultFilterActiveProp = false, itemNounKey, searchValue, onSearchChange, sort, onSortChange, sortOptions, toolbarSort, pager, onReachEnd, loadingMore, hasMore, rowActions, rowActionMode, bulk, rowTone, toolbarActions, filterFacets, filterValues, onFilterChange, onFilterReset, dateRangeFacets, onDateRangeChange, chromeless, scrollBody, screenPadding, expandedRowIds, onToggleRowExpanded, renderExpandedRow, ...tableBlockProps } = props;
|
|
15
|
+
const { screen, entity, rows, featureName, translate: translateProp, onRowClick, emptyState, onCreate, createLabel, searchable = false, searchPlaceholder, description, emptyContent, narrowed = false, namedFilterEmpty, defaultFilterActive: defaultFilterActiveProp = false, itemNounKey, searchValue, onSearchChange, sort, onSortChange, sortOptions, toolbarSort, pager, onReachEnd, loadingMore, hasMore, rowActions, rowActionMode, bulk, rowTone, toolbarActions, filterFacets, filterValues, onFilterChange, onFilterReset, dateRangeFacets, onDateRangeChange, chromeless, scrollBody, hideCountFooter, plainPhoneCards, screenPadding, expandedRowIds, onToggleRowExpanded, renderExpandedRow, ...tableBlockProps } = props;
|
|
15
16
|
// As in RenderEdit, fall back to the i18next context for translation;
|
|
16
17
|
// otherwise column headers would display raw i18n keys.
|
|
17
18
|
const t = useTranslation();
|
|
18
19
|
const translate = translateProp ?? t;
|
|
20
|
+
const isStandIn = useIsStandInScreen();
|
|
19
21
|
const { DataTable, Button, Dialog, Input, Banner, PageHeader } = usePrimitives();
|
|
20
22
|
const pageHeaderSlotAvailable = usePageHeaderSlotAvailable();
|
|
21
23
|
const pageHeaderCompact = usePageHeaderCompact();
|
|
@@ -28,6 +30,7 @@ export function RenderList(props) {
|
|
|
28
30
|
const [menuActionBusyId, setMenuActionBusyId] = useState(null);
|
|
29
31
|
const [menuActionError, setMenuActionError] = useState(null);
|
|
30
32
|
const effectiveRowTone = useMemo(() => rowTone ?? rowToneFromField(screen.rowToneField), [rowTone, screen.rowToneField]);
|
|
33
|
+
const rowMuted = useMemo(() => rowMutedFromField(screen.mutedRowField), [screen.mutedRowField]);
|
|
31
34
|
const { localQ, setLocalQ } = useRenderListSearch(searchValue, onSearchChange);
|
|
32
35
|
const { referenceRequests, handleLookupMap, enrichedVm } = useRenderListColumns({
|
|
33
36
|
screen,
|
|
@@ -114,12 +117,14 @@ export function RenderList(props) {
|
|
|
114
117
|
sort,
|
|
115
118
|
onSortChange,
|
|
116
119
|
sortOptions,
|
|
117
|
-
toolbarSort
|
|
120
|
+
toolbarSort,
|
|
121
|
+
screenToolbarSort: screen.toolbarSort,
|
|
122
|
+
isStandIn,
|
|
118
123
|
pager,
|
|
119
124
|
onReachEnd,
|
|
120
125
|
loadingMore,
|
|
121
126
|
hasMore,
|
|
122
|
-
}), ...tableRowProps({ rowActions, rowActionMode, bulk, rowTone: effectiveRowTone }), ...tableFilterProps({
|
|
127
|
+
}), ...tableRowProps({ rowActions, rowActionMode, bulk, rowTone: effectiveRowTone, rowMuted }), ...tableFilterProps({
|
|
123
128
|
filterFacets,
|
|
124
129
|
filterValues,
|
|
125
130
|
onFilterChange,
|
|
@@ -129,6 +134,9 @@ export function RenderList(props) {
|
|
|
129
134
|
}), ...tableLayoutProps({
|
|
130
135
|
chromeless,
|
|
131
136
|
scrollBody,
|
|
137
|
+
hideCountFooter,
|
|
138
|
+
isStandIn,
|
|
139
|
+
plainPhoneCards,
|
|
132
140
|
screenPadding,
|
|
133
141
|
expandedRowIds,
|
|
134
142
|
onToggleRowExpanded,
|