@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
|
@@ -22,7 +22,7 @@ export declare function DrawerHost({ schema, drawerAction, drawerScreen, drawerI
|
|
|
22
22
|
readonly onClose: () => void;
|
|
23
23
|
readonly onSuccess: () => void;
|
|
24
24
|
}): ReactNode;
|
|
25
|
-
export declare function ActionFormBody({ schema, screen, translate, entityId, initialOverrides, onSuccess,
|
|
25
|
+
export declare function ActionFormBody({ schema, screen, translate, entityId, initialOverrides, onSuccess, onDirtyChange, submitLabelFallback, }: {
|
|
26
26
|
readonly schema: FeatureSchema;
|
|
27
27
|
readonly screen: ActionFormScreenDefinition;
|
|
28
28
|
readonly translate?: Translate;
|
|
@@ -36,9 +36,6 @@ export declare function ActionFormBody({ schema, screen, translate, entityId, in
|
|
|
36
36
|
* drawer + refetches its list; a declared `screen.redirect` then navigates
|
|
37
37
|
* (without returnTo, a drawer is no navigation target). */
|
|
38
38
|
readonly onSuccess?: () => void;
|
|
39
|
-
/** Drawer-hosted usage: replaces the cancelTarget/redirect-based Cancel
|
|
40
|
-
* handler so Cancel closes the drawer instead of navigating. */
|
|
41
|
-
readonly onCancelOverride?: () => void;
|
|
42
39
|
/** Drawer-hosted usage: reports unsaved input so the host can confirm
|
|
43
40
|
* before discarding it. */
|
|
44
41
|
readonly onDirtyChange?: (dirty: boolean) => void;
|
|
@@ -91,7 +91,7 @@ export function DrawerHost({ schema, drawerAction, drawerScreen, drawerInitialVa
|
|
|
91
91
|
}), onSuccess: () => {
|
|
92
92
|
setHasUnsavedInput(false);
|
|
93
93
|
onSuccess();
|
|
94
|
-
},
|
|
94
|
+
}, onDirtyChange: setHasUnsavedInput, submitLabelFallback: drawerAction.label })) }) }) }), _jsx(Dialog, { open: confirmDiscardOpen, onOpenChange: setConfirmDiscardOpen, title: t("kumiko.drawer.discard.title"), description: t("kumiko.drawer.discard.body"), confirmLabel: t("kumiko.drawer.discard.confirm"), cancelLabel: t("kumiko.drawer.discard.cancel"), variant: "danger", initialFocus: "cancel", onConfirm: closeAndReset, testId: "drawer-discard-dialog" })] }));
|
|
95
95
|
}
|
|
96
96
|
function declaresSuccessContent(screen) {
|
|
97
97
|
return ((screen.successLinks?.length ?? 0) > 0 ||
|
|
@@ -114,13 +114,13 @@ function buildSuccessState(text, screen, resultData, context) {
|
|
|
114
114
|
// to entityEdit, only the submit path switches from the CRUD verb to the
|
|
115
115
|
// author-declared handler QN + payloadMode="values" (send all form values
|
|
116
116
|
// instead of only the changes).
|
|
117
|
-
export function ActionFormBody({ schema, screen, translate, entityId, initialOverrides, onSuccess,
|
|
117
|
+
export function ActionFormBody({ schema, screen, translate, entityId, initialOverrides, onSuccess, onDirtyChange, submitLabelFallback, }) {
|
|
118
118
|
const nav = useNav();
|
|
119
119
|
const appFeatures = useAppFeatures();
|
|
120
120
|
const insideDrawer = useInsideDrawer();
|
|
121
121
|
const locale = useLocale().locale();
|
|
122
122
|
const { Banner, StatusBadge } = usePrimitives();
|
|
123
|
-
// Unused when drawer-hosted — onSuccess
|
|
123
|
+
// Unused when drawer-hosted — onSuccess wins below first.
|
|
124
124
|
const returnTarget = useReturnTarget(screen.id);
|
|
125
125
|
const submittableFields = useMemo(() => actionFormSubmittableFields(screen), [screen]);
|
|
126
126
|
const synthEntity = useMemo(() => synthesizeActionFormEntity(submittableFields), [submittableFields]);
|
|
@@ -282,15 +282,16 @@ export function ActionFormBody({ schema, screen, translate, entityId, initialOve
|
|
|
282
282
|
// `false` switches the button off explicitly (single-action screens where
|
|
283
283
|
// cancel would just be submit-without-sending).
|
|
284
284
|
// returnTo wins over the declared target when both are present.
|
|
285
|
+
// A drawer closes through its × / Esc (which confirms unsaved input), so its footer has no Cancel.
|
|
285
286
|
const handleCancel = useMemo(() => {
|
|
286
|
-
if (
|
|
287
|
-
return
|
|
287
|
+
if (insideDrawer)
|
|
288
|
+
return undefined;
|
|
288
289
|
const target = screen.cancelTarget ??
|
|
289
290
|
(screen.redirect !== undefined ? redirectScreenTarget(screen.redirect) : undefined);
|
|
290
291
|
if (target === undefined || target === false)
|
|
291
292
|
return undefined;
|
|
292
293
|
return () => navigateToReturnOr(nav, returnTarget, () => nav.navigate({ screenId: lastSegment(target) }));
|
|
293
|
-
}, [nav, screen.redirect, screen.cancelTarget,
|
|
294
|
+
}, [nav, screen.redirect, screen.cancelTarget, insideDrawer, returnTarget]);
|
|
294
295
|
// Rendering the form before a tenant-declared currency lands would show the
|
|
295
296
|
// fallback and, on a fast click, submit it — hold instead.
|
|
296
297
|
if (currencyLoading) {
|
|
@@ -309,7 +310,7 @@ export function ActionFormBody({ schema, screen, translate, entityId, initialOve
|
|
|
309
310
|
extensionInitialValues: initial, ...(screen.submitPrefilled === true && {
|
|
310
311
|
submitWithoutChanges: hiddenRequiredFieldsFilled(synthScreen, screen.fields, initial),
|
|
311
312
|
}), ...((success !== undefined || screen.infoBand !== undefined) && {
|
|
312
|
-
leadContent: (_jsxs(_Fragment, { children: [screen.infoBand !== undefined && (_jsx(Banner, { variant: "
|
|
313
|
+
leadContent: (_jsxs(_Fragment, { children: [screen.infoBand !== undefined && (_jsx(Banner, { variant: "assist", icon: "sparkles", density: "compact", testId: "kumiko-screen-action-form-info-band", children: effectiveTranslate(screen.infoBand) })), success !== undefined && _jsx(ActionFormSuccessBanner, { success: success })] })),
|
|
313
314
|
}), ...(screen.fieldBadges !== undefined &&
|
|
314
315
|
StatusBadge !== undefined && {
|
|
315
316
|
labelAppendix: (fieldName) => {
|
|
@@ -320,7 +321,7 @@ export function ActionFormBody({ schema, screen, translate, entityId, initialOve
|
|
|
320
321
|
},
|
|
321
322
|
}), writeCommand: screen.handler, payloadMode: "values", onSubmit: handleSubmitted, ...(handleCancel !== undefined && { onCancel: handleCancel }), onDirtyChange: handleDirtyChange, ...((insideDrawer || screenFillsHeight(screen)) && { fillScreenHeight: true }), ...((screen.submitLabel ?? submitLabelFallback) !== undefined && {
|
|
322
323
|
submitLabel: screen.submitLabel ?? submitLabelFallback,
|
|
323
|
-
}), ...(screen.submitStyle !== undefined && { submitVariant: screen.submitStyle }), ...(screen.footerActions !== undefined && { footerActions: screen.footerActions }),
|
|
324
|
+
}), ...(screen.submitStyle !== undefined && { submitVariant: screen.submitStyle }), ...(screen.footerActions !== undefined && { footerActions: screen.footerActions }), formErrorOnTop: true, ...(screen.fieldDescriptions !== undefined && {
|
|
324
325
|
fieldDescription: (fieldName, values) => {
|
|
325
326
|
const ref = screen.fieldDescriptions?.[fieldName];
|
|
326
327
|
if (ref === undefined)
|
|
@@ -114,6 +114,58 @@ function isEmptyNumericFormValue(value) {
|
|
|
114
114
|
return true;
|
|
115
115
|
return typeof value === "number" && !Number.isFinite(value);
|
|
116
116
|
}
|
|
117
|
+
// Same wire shape as a writeOnly config field: null removes, a string replaces.
|
|
118
|
+
function secretChangeCommand(secretKey, value, secretScopePayload) {
|
|
119
|
+
if (value === null) {
|
|
120
|
+
return { type: "secrets:write:delete", payload: { key: secretKey, ...secretScopePayload } };
|
|
121
|
+
}
|
|
122
|
+
if (typeof value === "string" && value.trim() !== "") {
|
|
123
|
+
return { type: "secrets:write:set", payload: { key: secretKey, value, ...secretScopePayload } };
|
|
124
|
+
}
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
// One changed form value to its write command; undefined when nothing has to be sent.
|
|
128
|
+
function configChangeCommand({ shortName, value, screen, secretKey, secretScopePayload, }) {
|
|
129
|
+
if (secretKey !== undefined)
|
|
130
|
+
return secretChangeCommand(secretKey, value, secretScopePayload);
|
|
131
|
+
const qualified = screen.configKeys[shortName];
|
|
132
|
+
if (qualified === undefined)
|
|
133
|
+
return undefined;
|
|
134
|
+
const fieldDef = screen.fields[shortName]; // @cast-boundary schema-walk
|
|
135
|
+
const ftype = fieldDef?.type;
|
|
136
|
+
const reset = {
|
|
137
|
+
type: "config:write:reset",
|
|
138
|
+
payload: { key: qualified, scope: screen.scope },
|
|
139
|
+
};
|
|
140
|
+
if (isWriteOnlyTextField(screen.fields[shortName])) {
|
|
141
|
+
// true (untouched/undone) and "" mean keep the stored secret; null removes it.
|
|
142
|
+
if (value === null)
|
|
143
|
+
return reset;
|
|
144
|
+
if (typeof value === "string" && value !== "") {
|
|
145
|
+
return {
|
|
146
|
+
type: "config:write:set",
|
|
147
|
+
payload: { key: qualified, value, scope: screen.scope },
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
return undefined;
|
|
151
|
+
}
|
|
152
|
+
// A query-backed select is cleared to "" when its dependent value became
|
|
153
|
+
// invalid. config:write:set would store that as an empty override (the
|
|
154
|
+
// badge shows "Mandant" with no value); reset falls back to the inherited
|
|
155
|
+
// value. set can't do it: deleting the row is irreversible, reset is
|
|
156
|
+
// the high-risk handler.
|
|
157
|
+
if (ftype === "select" && fieldDef?.optionsQuery !== undefined && value === "")
|
|
158
|
+
return reset;
|
|
159
|
+
// Cleared number/money: drop this scope's override instead of storing an empty value.
|
|
160
|
+
const storedValue = ftype === "money" ? unwrapMoneyValue(value) : value;
|
|
161
|
+
if ((ftype === "number" || ftype === "money") && isEmptyNumericFormValue(storedValue)) {
|
|
162
|
+
return reset;
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
type: "config:write:set",
|
|
166
|
+
payload: { key: qualified, value: storedValue, scope: screen.scope },
|
|
167
|
+
};
|
|
168
|
+
}
|
|
117
169
|
export function ConfigEditBody({ schema, screen: declaredScreen, translate, }) {
|
|
118
170
|
const { ConfigCascadeView } = usePrimitives();
|
|
119
171
|
const t = useTranslation();
|
|
@@ -234,80 +286,17 @@ export function ConfigEditBody({ schema, screen: declaredScreen, translate, }) {
|
|
|
234
286
|
for (const [shortName, value] of Object.entries(snapshot.changes)) {
|
|
235
287
|
if (hiddenFieldNames.has(shortName))
|
|
236
288
|
continue;
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
else if (typeof value === "string" && value.trim() !== "") {
|
|
248
|
-
commandFieldNames.push(shortName);
|
|
249
|
-
commands.push({
|
|
250
|
-
type: "secrets:write:set",
|
|
251
|
-
payload: { key: secretKey, value, ...secretScopePayload },
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
continue;
|
|
255
|
-
}
|
|
256
|
-
const qualified = screen.configKeys[shortName];
|
|
257
|
-
if (qualified === undefined)
|
|
258
|
-
continue;
|
|
259
|
-
const fieldDef = screen.fields[shortName];
|
|
260
|
-
const ftype = fieldDef?.type;
|
|
261
|
-
if (isWriteOnlyTextField(screen.fields[shortName])) {
|
|
262
|
-
// true (untouched/undone) and "" mean keep the stored secret; null removes it.
|
|
263
|
-
if (value === null) {
|
|
264
|
-
commandFieldNames.push(shortName);
|
|
265
|
-
commands.push({
|
|
266
|
-
type: "config:write:reset",
|
|
267
|
-
payload: { key: qualified, scope: screen.scope },
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
else if (typeof value === "string" && value !== "") {
|
|
271
|
-
commandFieldNames.push(shortName);
|
|
272
|
-
commands.push({
|
|
273
|
-
type: "config:write:set",
|
|
274
|
-
payload: { key: qualified, value, scope: screen.scope },
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
continue;
|
|
278
|
-
}
|
|
279
|
-
// A query-backed select is cleared to "" when its dependent value became
|
|
280
|
-
// invalid. config:write:set would store that as an empty override (the
|
|
281
|
-
// badge shows "Mandant" with no value); reset falls back to the inherited
|
|
282
|
-
// value. set can't do it: deleting the row is irreversible, reset is
|
|
283
|
-
// the high-risk handler.
|
|
284
|
-
if (ftype === "select" && fieldDef?.optionsQuery !== undefined && value === "") {
|
|
285
|
-
commandFieldNames.push(shortName);
|
|
286
|
-
commands.push({
|
|
287
|
-
type: "config:write:reset",
|
|
288
|
-
payload: { key: qualified, scope: screen.scope },
|
|
289
|
-
});
|
|
290
|
-
continue;
|
|
291
|
-
}
|
|
292
|
-
// Cleared number/money: drop this scope's override instead of storing an empty value.
|
|
293
|
-
if ((ftype === "number" || ftype === "money") &&
|
|
294
|
-
isEmptyNumericFormValue(ftype === "money" ? unwrapMoneyValue(value) : value)) {
|
|
295
|
-
commandFieldNames.push(shortName);
|
|
296
|
-
commands.push({
|
|
297
|
-
type: "config:write:reset",
|
|
298
|
-
payload: { key: qualified, scope: screen.scope },
|
|
299
|
-
});
|
|
289
|
+
const command = configChangeCommand({
|
|
290
|
+
shortName,
|
|
291
|
+
value,
|
|
292
|
+
screen,
|
|
293
|
+
secretKey: secretKeys?.[shortName],
|
|
294
|
+
secretScopePayload,
|
|
295
|
+
});
|
|
296
|
+
if (command === undefined)
|
|
300
297
|
continue;
|
|
301
|
-
}
|
|
302
298
|
commandFieldNames.push(shortName);
|
|
303
|
-
commands.push(
|
|
304
|
-
type: "config:write:set",
|
|
305
|
-
payload: {
|
|
306
|
-
key: qualified,
|
|
307
|
-
value: ftype === "money" ? unwrapMoneyValue(value) : value,
|
|
308
|
-
scope: screen.scope,
|
|
309
|
-
},
|
|
310
|
-
});
|
|
299
|
+
commands.push(command);
|
|
311
300
|
}
|
|
312
301
|
if (commands.length === 0) {
|
|
313
302
|
return { validationBlocked: false, isSuccess: true, data: undefined };
|
|
@@ -334,9 +323,7 @@ export function ConfigEditBody({ schema, screen: declaredScreen, translate, }) {
|
|
|
334
323
|
dispatcher,
|
|
335
324
|
synthScreen,
|
|
336
325
|
secretKeys,
|
|
337
|
-
screen
|
|
338
|
-
screen.fields,
|
|
339
|
-
screen.scope,
|
|
326
|
+
screen,
|
|
340
327
|
valuesQuery.refetch,
|
|
341
328
|
cascadeQuery.refetch,
|
|
342
329
|
secretsQuery.refetch,
|
|
@@ -369,22 +356,27 @@ export function ConfigEditBody({ schema, screen: declaredScreen, translate, }) {
|
|
|
369
356
|
return undefined;
|
|
370
357
|
return (value) => buildOptionLabels(effectiveTranslate, (option) => fieldOptionLabelKey(schema.featureName, synthScreen.entity, fieldName, option), [String(value)])[String(value)];
|
|
371
358
|
};
|
|
372
|
-
|
|
373
|
-
|
|
359
|
+
const compact = screen.compact === true;
|
|
360
|
+
const form = (_jsx(RenderEdit, { screen: synthScreen, entity: synthEntity, featureName: schema.featureName, initial: initial, schema: boundsSchema, customSubmit: customSubmit, dirtyFooter: true, validateOnChange: true, ...(screenFillsHeight(screen) && { fillScreenHeight: true }), ...(screen.submitLabel !== undefined && { submitLabel: screen.submitLabel }), ...(translate !== undefined && { translate }), fieldAppendixPlacement: "below-control", ...(compact && { recordSections: { labelTitles: true } }), ...(!compact && {
|
|
361
|
+
fieldAccent: (fieldName) => cascades[fieldName]?.levels.find((level) => level.isActive)?.source ===
|
|
362
|
+
CONFIG_SCOPE_SOURCE[screen.scope],
|
|
363
|
+
markChangedFields: true,
|
|
364
|
+
}), ...actionRowsAfterField(screen.actions, effectiveTranslate), ...(screen.fieldDescriptions !== undefined && {
|
|
374
365
|
fieldDescription: (fieldName) => {
|
|
375
366
|
const key = screen.fieldDescriptions?.[fieldName];
|
|
376
367
|
return key === undefined ? undefined : effectiveTranslate(key);
|
|
377
368
|
},
|
|
378
369
|
}), fieldAppendix: (fieldName) => {
|
|
379
370
|
const cascade = cascades[fieldName];
|
|
380
|
-
if (cascade === undefined)
|
|
371
|
+
if (compact || cascade === undefined)
|
|
381
372
|
return undefined;
|
|
382
373
|
const renderValue = cascadeValueRenderer(fieldName);
|
|
383
|
-
return (_jsx(ConfigCascadeView, { cascade: cascade, screenScope: screen.scope, qualifiedKey: screen.configKeys[fieldName], required: screen.requiredFields?.includes(fieldName) ?? false, ...(renderValue !== undefined && { renderValue }), ...(!readOnlyFields.has(fieldName) && {
|
|
374
|
+
return (_jsx(ConfigCascadeView, { cascade: cascade, screenScope: screen.scope, qualifiedKey: screen.configKeys[fieldName], compact: true, required: screen.requiredFields?.includes(fieldName) ?? false, ...(renderValue !== undefined && { renderValue }), ...(!readOnlyFields.has(fieldName) && {
|
|
384
375
|
onReset: async (key, scope) => {
|
|
385
376
|
await dispatcher.write("config:write:reset", { key, scope });
|
|
386
377
|
await Promise.allSettled([valuesQuery.refetch?.(), cascadeQuery.refetch?.()]);
|
|
387
378
|
},
|
|
388
379
|
}) }));
|
|
389
380
|
} }));
|
|
381
|
+
return compact ? (_jsx("div", { "data-testid": "config-edit-compact", className: "h-full min-h-0 [&>form>div:first-child]:mx-0 [&>form>div:first-child]:max-w-[940px] [&_.relative>input]:pl-3 [&_.relative>svg.pointer-events-none]:hidden", children: form })) : (form);
|
|
390
382
|
}
|
|
@@ -162,8 +162,8 @@ function EntityListBody({ schema, screen, entity, translate, onRowClick, }) {
|
|
|
162
162
|
const filterFacets = useMemo(() => {
|
|
163
163
|
const namedFacet = buildNamedFilterFacet(screen.namedFilters, effectiveTranslate, userRoles, screen.namedFilterFacet, facetCounts);
|
|
164
164
|
return [
|
|
165
|
-
...(namedFacet !== undefined ? [namedFacet] : []),
|
|
166
165
|
...buildEntityFilterFacets(mergeReferenceFacetOptions(entityFacetSpecs, entityReferenceFacetOptions), screen.facets, effectiveTranslate, facetCounts),
|
|
166
|
+
...(namedFacet !== undefined ? [namedFacet] : []),
|
|
167
167
|
];
|
|
168
168
|
}, [
|
|
169
169
|
entityFacetSpecs,
|
|
@@ -2,11 +2,13 @@ import type { ReactNode } from "react";
|
|
|
2
2
|
import type { RenderEditAction } from "../components/render-edit-types.ts";
|
|
3
3
|
import type { usePrimitives } from "../primitives.tsx";
|
|
4
4
|
import type { ErrorNotice } from "./error-reference.tsx";
|
|
5
|
-
export declare function HeaderActionsBar({ actions, Button, Dialog, ActionOverflowMenu, onError, collapseAfterPrimary, compact, preferredPrimaryId, inlineActionIds, PageHeader, overflowTestId, }: {
|
|
5
|
+
export declare function HeaderActionsBar({ actions, Button, Dialog, ActionOverflowMenu, onError, collapseAfterPrimary, compact, preferredPrimaryId, inlineActionIds, menuActionIds, PageHeader, overflowTestId, }: {
|
|
6
6
|
/** `primaryAction` of the screen: wins over the edit/primary-style precedence. */
|
|
7
7
|
readonly preferredPrimaryId?: string;
|
|
8
8
|
/** `inlineActions` of the screen: stay buttons next to the primary instead of the menu. */
|
|
9
9
|
readonly inlineActionIds?: readonly string[];
|
|
10
|
+
/** `placement: "menu"` actions of the screen: always in the menu, never a button. */
|
|
11
|
+
readonly menuActionIds?: readonly string[];
|
|
10
12
|
/** Header slot layout: only the primary action stays a button, the rest goes into the menu. */
|
|
11
13
|
readonly collapseAfterPrimary?: boolean;
|
|
12
14
|
/** Phone-width shell header: an icon-only primary button, the rest in the shell's overflow menu. */
|
|
@@ -9,21 +9,29 @@ import { compactHeaderPrimary, orderPlainHeaderActions, splitHeaderActions, } fr
|
|
|
9
9
|
// state for menu items: RenderEditActionButton already owns a per-button
|
|
10
10
|
// confirm dialog for the always-visible primary action, but a menu item has
|
|
11
11
|
// no button of its own to carry one.
|
|
12
|
-
export function HeaderActionsBar({ actions, Button, Dialog, ActionOverflowMenu, onError, collapseAfterPrimary = false, compact = false, preferredPrimaryId, inlineActionIds, PageHeader, overflowTestId = "kumiko-screen-projection-detail-actions-overflow", }) {
|
|
12
|
+
export function HeaderActionsBar({ actions, Button, Dialog, ActionOverflowMenu, onError, collapseAfterPrimary = false, compact = false, preferredPrimaryId, inlineActionIds, menuActionIds, PageHeader, overflowTestId = "kumiko-screen-projection-detail-actions-overflow", }) {
|
|
13
13
|
const t = useTranslation();
|
|
14
14
|
const { toMenuItem, confirmDialog: pendingActionDialog } = useActionMenuItems({
|
|
15
15
|
Dialog,
|
|
16
16
|
onError,
|
|
17
17
|
});
|
|
18
18
|
if (compact && PageHeader !== undefined) {
|
|
19
|
-
const compactPrimary = compactHeaderPrimary(actions, preferredPrimaryId);
|
|
19
|
+
const compactPrimary = compactHeaderPrimary(actions.filter((a) => !menuActionIds?.includes(a.id)), preferredPrimaryId);
|
|
20
20
|
const overflowActions = actions.filter((a) => a !== compactPrimary?.action);
|
|
21
21
|
return (_jsxs(_Fragment, { children: [compactPrimary !== undefined && (_jsx(RenderEditActionButton, { action: compactPrimary.action, Button: Button, Dialog: Dialog, iconOnly: compactPrimary.iconOnly, onError: onError }, compactPrimary.action.id)), overflowActions.length > 0 && (_jsx(PageHeader, { overflowItems: overflowActions.map(toMenuItem) })), pendingActionDialog] }));
|
|
22
22
|
}
|
|
23
|
+
const dangerMenuActions = actions.filter((action) => (collapseAfterPrimary && action.style === "danger") ||
|
|
24
|
+
(ActionOverflowMenu !== undefined && menuActionIds?.includes(action.id) === true));
|
|
25
|
+
const visibleCandidates = actions.filter((action) => !dangerMenuActions.includes(action));
|
|
23
26
|
const maxPlainButtons = collapseAfterPrimary ? 1 : 2;
|
|
24
|
-
if (
|
|
27
|
+
if (ActionOverflowMenu === undefined ||
|
|
28
|
+
(visibleCandidates.length <= maxPlainButtons && dangerMenuActions.length === 0)) {
|
|
25
29
|
return (_jsx(_Fragment, { children: orderPlainHeaderActions(actions, preferredPrimaryId).map((action) => (_jsx(RenderEditActionButton, { action: action, Button: Button, Dialog: Dialog, hideIcon: true, onError: onError }, action.id))) }));
|
|
26
30
|
}
|
|
27
|
-
const
|
|
31
|
+
const split = visibleCandidates.length <= maxPlainButtons
|
|
32
|
+
? { buttons: orderPlainHeaderActions(visibleCandidates, preferredPrimaryId), menu: [] }
|
|
33
|
+
: splitHeaderActions(visibleCandidates, preferredPrimaryId, inlineActionIds);
|
|
34
|
+
const { buttons } = split;
|
|
35
|
+
const menu = [...split.menu, ...dangerMenuActions];
|
|
28
36
|
return (_jsxs(_Fragment, { children: [buttons.map((action) => (_jsx(RenderEditActionButton, { action: action, Button: Button, Dialog: Dialog, hideIcon: true, onError: onError }, action.id))), menu.length > 0 && (_jsx(ActionOverflowMenu, { label: t("kumiko.list.row-actions.more"), testId: overflowTestId, items: menu.map(toMenuItem) })), pendingActionDialog] }));
|
|
29
37
|
}
|
|
@@ -7,3 +7,5 @@ export declare function LockedHeaderScope({ standInScreenId, children, }: {
|
|
|
7
7
|
readonly standInScreenId?: string;
|
|
8
8
|
readonly children?: ReactNode;
|
|
9
9
|
}): ReactNode;
|
|
10
|
+
/** True while the screen renders as the stand-in of a locked screen (`visibleWhen` + `fallback`). */
|
|
11
|
+
export declare function useIsStandInScreen(): boolean;
|
|
@@ -15,6 +15,9 @@ function LockedScreenHeader({ standInScreenId }) {
|
|
|
15
15
|
// every mounted PageHeader overwrites and clears on unmount, so only the outermost scope mounts
|
|
16
16
|
// a header; nested scopes report the screen that finally renders up to it.
|
|
17
17
|
const ReportStandInContext = createContext(undefined);
|
|
18
|
+
// Separate from ReportStandInContext: the stand-in's own KumikoScreen wraps its body in a
|
|
19
|
+
// StandInChainBoundary, which clears the report context, so that one cannot tell a body it is a stand-in.
|
|
20
|
+
const StandInScreenContext = createContext(false);
|
|
18
21
|
/** Screen bodies (and anything embedded in them) are not part of a fallback chain. */
|
|
19
22
|
export function StandInChainBoundary({ children }) {
|
|
20
23
|
return (_jsx(ReportStandInContext.Provider, { value: undefined, children: children }));
|
|
@@ -29,5 +32,9 @@ export function LockedHeaderScope({ standInScreenId, children, }) {
|
|
|
29
32
|
reportToOuter({ screenId: effectiveScreenId });
|
|
30
33
|
return () => reportToOuter(undefined);
|
|
31
34
|
}, [reportToOuter, effectiveScreenId]);
|
|
32
|
-
return (_jsxs(_Fragment, { children: [reportToOuter === undefined && (_jsx(LockedScreenHeader, { ...(effectiveScreenId !== undefined && { standInScreenId: effectiveScreenId }) })), _jsx(ReportStandInContext.Provider, { value: setInner, children: children })] }));
|
|
35
|
+
return (_jsxs(_Fragment, { children: [reportToOuter === undefined && (_jsx(LockedScreenHeader, { ...(effectiveScreenId !== undefined && { standInScreenId: effectiveScreenId }) })), _jsx(StandInScreenContext.Provider, { value: standInScreenId !== undefined, children: _jsx(ReportStandInContext.Provider, { value: setInner, children: children }) })] }));
|
|
36
|
+
}
|
|
37
|
+
/** True while the screen renders as the stand-in of a locked screen (`visibleWhen` + `fallback`). */
|
|
38
|
+
export function useIsStandInScreen() {
|
|
39
|
+
return useContext(StandInScreenContext);
|
|
33
40
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { evalFieldCondition } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
3
|
import { useState } from "react";
|
|
3
4
|
import { RenderEdit } from "../components/render-edit.js";
|
|
5
|
+
import { WriteFormRegistryProvider } from "../components/write-form-registry.js";
|
|
4
6
|
import { useOptionalDispatcher } from "../context/dispatcher-context.js";
|
|
5
7
|
import { useUserRoles } from "../context/user-roles-context.js";
|
|
6
8
|
import { useLocale, useTranslation } from "../i18n.js";
|
|
@@ -52,6 +54,8 @@ export function ProjectionDetailBody({ schema, screen, translate, entityId, }) {
|
|
|
52
54
|
// headerActions moved out of RenderEdit's footer — this component owns
|
|
53
55
|
// the failure-surfacing state RenderEdit used to own for them.
|
|
54
56
|
const [actionError, setActionError] = useState(null);
|
|
57
|
+
// writeForm sections register here so an action with `submitWith` can send their values.
|
|
58
|
+
const [writeForms] = useState(() => new Map());
|
|
55
59
|
const appFeatures = useAppFeatures();
|
|
56
60
|
const userRoles = useUserRoles();
|
|
57
61
|
const dispatcher = useOptionalDispatcher();
|
|
@@ -79,6 +83,7 @@ export function ProjectionDetailBody({ schema, screen, translate, entityId, }) {
|
|
|
79
83
|
detailQuery,
|
|
80
84
|
reloadDetail,
|
|
81
85
|
activeTabId: activeSection?.id,
|
|
86
|
+
writeForms,
|
|
82
87
|
});
|
|
83
88
|
const { hasMetrics, headerActionsList, hasHeaderActions, hasHeaderCard, renderedDetailScreen } = useProjectionDetailLayout({ screen, headerActions, hasTabs, detailScreen });
|
|
84
89
|
const recordId = detailQuery.data?.["id"];
|
|
@@ -103,8 +108,13 @@ export function ProjectionDetailBody({ schema, screen, translate, entityId, }) {
|
|
|
103
108
|
if (!record) {
|
|
104
109
|
return renderRecordNotFound({ schema, screen, nav, returnTarget, effectiveTranslate });
|
|
105
110
|
}
|
|
111
|
+
const visibleMetrics = screen.metrics?.filter((metric) => metric.visibleWhen === undefined || evalFieldCondition(metric.visibleWhen, { ...record }));
|
|
106
112
|
const regionModel = {
|
|
107
|
-
screen: {
|
|
113
|
+
screen: {
|
|
114
|
+
...screen,
|
|
115
|
+
...(visibleMetrics !== undefined && { metrics: visibleMetrics }),
|
|
116
|
+
layout: { ...screen.layout, sections: visibleSections },
|
|
117
|
+
},
|
|
108
118
|
record,
|
|
109
119
|
primitives,
|
|
110
120
|
effectiveTranslate,
|
|
@@ -119,7 +129,7 @@ export function ProjectionDetailBody({ schema, screen, translate, entityId, }) {
|
|
|
119
129
|
pageHeaderSlotAvailable,
|
|
120
130
|
pageHeaderCompactContext,
|
|
121
131
|
hasHeaderActions,
|
|
122
|
-
hasMetrics,
|
|
132
|
+
hasMetrics: hasMetrics && (visibleMetrics?.length ?? 0) > 0,
|
|
123
133
|
hasHeaderCard,
|
|
124
134
|
hasTabs,
|
|
125
135
|
tabCounts,
|
|
@@ -129,9 +139,18 @@ export function ProjectionDetailBody({ schema, screen, translate, entityId, }) {
|
|
|
129
139
|
};
|
|
130
140
|
const regionPieces = deriveDetailRegionPieces(regionModel);
|
|
131
141
|
const renderHeaderContent = (headerSlot) => renderDetailHeaderContent(regionModel, regionPieces, headerSlot);
|
|
132
|
-
return (_jsxs(
|
|
142
|
+
return (_jsxs(WriteFormRegistryProvider, { value: writeForms, children: [refetchErrorBanner, _jsx(RenderEdit, { refreshToken: reloadNonce, screen: renderedDetailScreen, entity: entity, featureName: schema.featureName, initial: record, entityId: effectiveEntityId, customSubmit: async () => ({ isSuccess: true, validationBlocked: false, data: undefined }), onReload: reloadDetail, onRelatedListDrawerAction: openDrawer, ...(translate !== undefined && { translate }), ...(hasTabs && activeSection !== undefined && { activeTabId: activeSection.id }), ...(screen.footerHint !== undefined && {
|
|
133
143
|
footerHint: effectiveTranslate(screen.footerHint),
|
|
134
|
-
}), ...(hasTabs &&
|
|
144
|
+
}), ...(hasTabs &&
|
|
145
|
+
activeSections.length === 1 &&
|
|
146
|
+
screen.layout.narrowTabs !== false && { hideSectionTitles: true }), recordSections: {
|
|
147
|
+
labelTitles: true,
|
|
148
|
+
...(hasTabs &&
|
|
149
|
+
activeSections.length > 1 &&
|
|
150
|
+
activeSections[0]?.tabLabel === undefined && { omitFirstTitle: true }),
|
|
151
|
+
...(screen.pageNavigation === false && { pageNavigation: false }),
|
|
152
|
+
...(screen.photosBeside === true && { photosBeside: true }),
|
|
153
|
+
}, ...(screenFillsHeight(screen) && { fillScreenHeight: true }), ...((hasHeaderCard ||
|
|
135
154
|
hasTabs ||
|
|
136
155
|
hasRecordGuidance(screen) ||
|
|
137
156
|
screen.slots?.header !== undefined ||
|
|
@@ -9,5 +9,6 @@ export type DetailGuidanceModel = DetailHeaderModel & {
|
|
|
9
9
|
};
|
|
10
10
|
export declare function wrapLayout(primitives: DetailGuidanceModel["primitives"], className: string, node: ReactNode): ReactNode;
|
|
11
11
|
export declare function renderDetailBreadcrumb(model: DetailGuidanceModel): ReactNode;
|
|
12
|
+
export declare function renderDetailSummary(model: DetailGuidanceModel): ReactNode;
|
|
12
13
|
/** Summary, banner, progress and steps in reading order; blocks whose record field holds nothing drop out. */
|
|
13
14
|
export declare function renderDetailGuidance(model: DetailGuidanceModel): ReactNode;
|
|
@@ -77,7 +77,7 @@ export function renderDetailBreadcrumb(model) {
|
|
|
77
77
|
}
|
|
78
78
|
return (_jsx(Text, { testId: testId, children: items.map((item, index) => (_jsxs(Fragment, { children: [index > 0 && (_jsx(Text, { variant: "muted", decorative: true, children: " / " })), item.link !== undefined ? (_jsx(Link, { href: item.link.href, ...(item.link.onPress !== undefined && { onPress: item.link.onPress }), children: item.label })) : (_jsx(Text, { children: item.label }))] }, keys[index]))) }));
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
export function renderDetailSummary(model) {
|
|
81
81
|
const spec = model.screen.summary;
|
|
82
82
|
if (spec === undefined)
|
|
83
83
|
return undefined;
|
|
@@ -104,7 +104,7 @@ function renderBanner(model) {
|
|
|
104
104
|
return undefined;
|
|
105
105
|
const { Banner } = model.primitives;
|
|
106
106
|
const actions = renderItemActions(model, spec.actions, notice);
|
|
107
|
-
return wrapLayout(model.primitives, GUIDANCE_INSET, _jsx(Banner, { variant: BANNER_VARIANT[notice.tone ?? "neutral"], icon: BANNER_ICON[notice.tone ?? "neutral"], title: notice.title, ...(notice.narrowTitle !== undefined && { narrowTitle: notice.narrowTitle }), ...(notice.narrowText !== undefined && { narrowText: notice.narrowText }), inline: true, ...(actions !== undefined && { actions }), testId: "kumiko-screen-projection-detail-banner", children: notice.text }));
|
|
107
|
+
return wrapLayout(model.primitives, GUIDANCE_INSET, _jsx(Banner, { variant: BANNER_VARIANT[notice.tone ?? "neutral"], ...(spec.iconless !== true && { icon: BANNER_ICON[notice.tone ?? "neutral"] }), title: notice.title, ...(notice.narrowTitle !== undefined && { narrowTitle: notice.narrowTitle }), ...(notice.narrowText !== undefined && { narrowText: notice.narrowText }), inline: true, ...(actions !== undefined && { actions }), testId: "kumiko-screen-projection-detail-banner", children: notice.text }));
|
|
108
108
|
}
|
|
109
109
|
function buildStepItem(model, spec, step) {
|
|
110
110
|
const [mainAction, ...otherActions] = resolveItemActions(model, spec.actions, step);
|
|
@@ -204,6 +204,9 @@ export function renderDetailGuidance(model) {
|
|
|
204
204
|
const beside = progress?.placement === "beside-steps" && steps !== undefined;
|
|
205
205
|
const progressNode = renderProgress(model, beside);
|
|
206
206
|
const progressInset = progress?.hideOnNarrow === true ? `${PROGRESS_INSET} max-sm:hidden` : PROGRESS_INSET;
|
|
207
|
-
|
|
208
|
-
|
|
207
|
+
const lower = (_jsx(_Fragment, { children: beside ? (wrapLayout(model.primitives, "grid grid-cols-1 items-stretch gap-4 lg:grid-cols-12", _jsxs(_Fragment, { children: [wrapLayout(model.primitives, progressNode !== undefined ? "min-w-0 lg:col-span-8" : "min-w-0 lg:col-span-12", renderSteps(model)), progressNode !== undefined &&
|
|
208
|
+
wrapLayout(model.primitives, `${progressInset} lg:col-span-4 lg:flex lg:flex-col lg:pl-0 lg:[&>*]:flex-1`, progressNode)] }))) : (_jsxs(_Fragment, { children: [progressNode !== undefined && wrapLayout(model.primitives, progressInset, progressNode), renderSteps(model)] })) }));
|
|
209
|
+
return (_jsxs(_Fragment, { children: [renderBanner(model), model.screen.metricsPlacement?.narrow === "before-steps"
|
|
210
|
+
? wrapLayout(model.primitives, "max-md:order-2", lower)
|
|
211
|
+
: lower] }));
|
|
209
212
|
}
|
|
@@ -65,7 +65,10 @@ export function buildDetailTabItems(sections, record, translate, queryCounts = {
|
|
|
65
65
|
const count = typeof countValue === "number" && Number.isFinite(countValue) ? countValue : undefined;
|
|
66
66
|
return {
|
|
67
67
|
id: section.id ?? "",
|
|
68
|
-
label: translate(
|
|
68
|
+
label: translate(sections.find((s) => s.id === section.id && s.tabLabel !== undefined)?.tabLabel ??
|
|
69
|
+
section.title ??
|
|
70
|
+
section.id ??
|
|
71
|
+
""),
|
|
69
72
|
...(count !== undefined && { count }),
|
|
70
73
|
};
|
|
71
74
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { resolveRecordTitle } from "../components/render-edit-helpers.js";
|
|
3
3
|
import { requestLeave } from "../leave-guard.js";
|
|
4
|
-
import { renderDetailBreadcrumb, renderDetailGuidance, wrapLayout, } from "./projection-detail-guidance.js";
|
|
5
|
-
import { buildMetricItems, renderActionErrorBanner, renderBandSubtitle, renderHeaderActionsContent, renderHeaderSubtitleSlot, renderHeaderTitleSlot, renderMetricsBlock, renderRecordTitleBlock, renderStatusBadge, } from "./projection-detail-header.js";
|
|
4
|
+
import { renderDetailBreadcrumb, renderDetailGuidance, renderDetailSummary, wrapLayout, } from "./projection-detail-guidance.js";
|
|
5
|
+
import { buildMetricItems, renderActionErrorBanner, renderBandSubtitle, renderHeaderActionsContent, renderHeaderSubtitleSlot, renderHeaderTitleSlot, renderMetricsBlock, renderMobileSummary, renderRecordTitleBlock, renderStatusBadge, } from "./projection-detail-header.js";
|
|
6
6
|
import { buildDetailTabItems } from "./projection-detail-header-model.js";
|
|
7
7
|
export function deriveDetailRegionPieces(model) {
|
|
8
8
|
const { screen, record, primitives, actionError, hasHeaderActions } = model;
|
|
@@ -46,12 +46,26 @@ const NARROW_METRICS_ORDER = "max-md:order-1";
|
|
|
46
46
|
const LEAD_BAND_SHARED_PADDING = "[&>*]:pb-0";
|
|
47
47
|
const TILES_BAND_SHARED_PADDING = "[&>*]:pt-3";
|
|
48
48
|
const NARROW_TABS_ORDER = "max-md:order-2";
|
|
49
|
+
const NARROW_TABS_ORDER_AFTER_STEPS = "max-md:order-3";
|
|
49
50
|
function usesNarrowMetricsOrder(model) {
|
|
50
|
-
return model.screen.metricsPlacement?.narrow
|
|
51
|
+
return model.screen.metricsPlacement?.narrow !== undefined;
|
|
52
|
+
}
|
|
53
|
+
function narrowTabsOrder(model) {
|
|
54
|
+
return model.screen.metricsPlacement?.narrow === "before-steps"
|
|
55
|
+
? NARROW_TABS_ORDER_AFTER_STEPS
|
|
56
|
+
: NARROW_TABS_ORDER;
|
|
51
57
|
}
|
|
52
58
|
function wrapNarrowOrder(model, orderClass, node) {
|
|
53
59
|
return usesNarrowMetricsOrder(model) ? wrapLayout(model.primitives, orderClass, node) : node;
|
|
54
60
|
}
|
|
61
|
+
// `narrowTabs: false` drops the strip on the phone; the sections then stand one under the other.
|
|
62
|
+
function wrapTabStrip(model, strip) {
|
|
63
|
+
const classes = [
|
|
64
|
+
usesNarrowMetricsOrder(model) ? narrowTabsOrder(model) : undefined,
|
|
65
|
+
model.screen.layout.narrowTabs === false ? "max-sm:hidden" : undefined,
|
|
66
|
+
].filter((c) => c !== undefined);
|
|
67
|
+
return classes.length === 0 ? strip : wrapLayout(model.primitives, classes.join(" "), strip);
|
|
68
|
+
}
|
|
55
69
|
// Only the metric tiles move below the guidance on narrow screens; the lead and the
|
|
56
70
|
// subtitle/status line stay under the title, so they get their own tile-less band.
|
|
57
71
|
function renderBandWithNarrowMetrics(model, metricItems, subtitle, lead) {
|
|
@@ -79,16 +93,18 @@ function renderPageHeaderBranch(model, pieces, headerSlot, PageHeader) {
|
|
|
79
93
|
// The title block owns chip and subtitle, so neither the shell header nor the band repeats them.
|
|
80
94
|
const hasTitleBlock = titleText !== undefined;
|
|
81
95
|
const bandSubtitle = hasTitleBlock ? undefined : pieces.bandSubtitle;
|
|
82
|
-
return (_jsxs(_Fragment, { children: [_jsx(PageHeader, { ...(hasTitleBlock && { bodyTitle: true }), ...(hasTitleBlock &&
|
|
83
|
-
|
|
96
|
+
return (_jsxs(_Fragment, { children: [_jsx(PageHeader, { ...(hasTitleBlock && { bodyTitle: true }), ...(hasTitleBlock && { recordTitle: shortTitleOf(header, record) ?? titleText }), ...(header?.narrowTitle !== undefined && {
|
|
97
|
+
narrowRecordTitle: model.effectiveTranslate(header.narrowTitle),
|
|
98
|
+
}), ...(header === undefined && recordTitle !== undefined && { title: recordTitle }), ...(!hasTitleBlock &&
|
|
99
|
+
!pageHeaderCompact &&
|
|
84
100
|
statusBadge !== undefined && {
|
|
85
101
|
status: statusBadge,
|
|
86
102
|
}), ...(hasHeaderActions && {
|
|
87
103
|
actions: renderHeaderActionsContent(model, { compact: pageHeaderCompact, PageHeader }),
|
|
88
104
|
}) }), titleText !== undefined &&
|
|
89
|
-
renderRecordTitleBlock(model, titleText, statusBadge, pieces.headerSubtitleSlot,
|
|
105
|
+
renderRecordTitleBlock(model, titleText, statusBadge, pieces.headerSubtitleSlot, false), hasTitleBlock && renderMobileSummary(model), hasTitleBlock && renderDetailSummary(model), MetricBand === undefined && bandSubtitle, MetricBand === undefined && headerSlot, (hasMetrics || bandSubtitle !== undefined || headerSlot !== undefined) &&
|
|
90
106
|
(MetricBand !== undefined || hasMetrics) &&
|
|
91
|
-
renderBandWithNarrowMetrics(model, metricItems, bandSubtitle, MetricBand !== undefined ? headerSlot : undefined), pieces.actionErrorBanner] }));
|
|
107
|
+
renderBandWithNarrowMetrics(model, metricItems, bandSubtitle, MetricBand !== undefined ? headerSlot : undefined), !hasTitleBlock && renderMobileSummary(model), !hasTitleBlock && renderDetailSummary(model), pieces.actionErrorBanner] }));
|
|
92
108
|
}
|
|
93
109
|
function renderHeaderCardBranch(model, pieces, headerSlot) {
|
|
94
110
|
const { primitives, hasHeaderActions, hasMetrics, hasHeaderCard } = model;
|
|
@@ -103,7 +119,7 @@ function renderHeaderCardBranch(model, pieces, headerSlot) {
|
|
|
103
119
|
...(headerSubtitleSlot !== undefined && { subtitle: headerSubtitleSlot }),
|
|
104
120
|
...(headerSlot !== undefined && { headerContent: headerSlot }),
|
|
105
121
|
...(hasHeaderActions && { headerActions: headerActionsContent }),
|
|
106
|
-
}, children: [hasMetrics && !metricsOutsideCard && renderMetricsBlock(model, pieces.metricItems), pieces.actionErrorBanner] })), metricsOutsideCard &&
|
|
122
|
+
}, children: [hasMetrics && !metricsOutsideCard && renderMetricsBlock(model, pieces.metricItems), pieces.actionErrorBanner] })), renderMobileSummary(model), renderDetailSummary(model), metricsOutsideCard &&
|
|
107
123
|
wrapNarrowOrder(model, NARROW_METRICS_ORDER, renderMetricsBlock(model, pieces.metricItems))] }));
|
|
108
124
|
}
|
|
109
125
|
function renderDetailTabs(model, activeSection, Tabs) {
|
|
@@ -119,5 +135,5 @@ export function renderDetailHeaderContent(model, pieces, headerSlot) {
|
|
|
119
135
|
: renderHeaderCardBranch(model, pieces, headerSlot), renderDetailGuidance(model), hasTabs &&
|
|
120
136
|
activeSection !== undefined &&
|
|
121
137
|
Tabs !== undefined &&
|
|
122
|
-
|
|
138
|
+
wrapTabStrip(model, renderDetailTabs(model, activeSection, Tabs))] }));
|
|
123
139
|
}
|
|
@@ -30,6 +30,8 @@ export declare function renderRecordTitleBlock(model: DetailHeaderModel, titleTe
|
|
|
30
30
|
export declare function renderHeaderSubtitleSlot(model: DetailHeaderModel): ReactNode;
|
|
31
31
|
export declare function buildMetricItems(model: DetailHeaderModel): ReactNode[] | undefined;
|
|
32
32
|
export declare function renderMetricsBlock(model: DetailHeaderModel, metricItems: ReactNode[] | undefined, subtitle?: ReactNode, lead?: ReactNode): ReactNode;
|
|
33
|
+
/** The phone-only line right under the title; nothing when the screen has no `mobileSummary` or the field is empty. */
|
|
34
|
+
export declare function renderMobileSummary(model: DetailHeaderModel): ReactNode;
|
|
33
35
|
export declare function renderStatusBadge(model: DetailHeaderModel): ReactNode;
|
|
34
36
|
export declare function renderBandSubtitle(model: DetailHeaderModel, statusBadge: ReactNode, headerSubtitleSlot: ReactNode, pageHeaderCompact: boolean): ReactNode;
|
|
35
37
|
export declare function renderActionErrorBanner(model: DetailHeaderModel, actionError: ErrorNotice): ReactNode;
|