@cosmicdrift/kumiko-renderer 0.414.0 → 0.416.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 -1
- package/dist/app/action-form-body.js +43 -16
- package/dist/app/action-form-support.d.ts +4 -1
- package/dist/app/action-form-support.js +8 -4
- package/dist/app/client-actions.js +6 -4
- package/dist/app/config-edit-body.js +13 -4
- package/dist/app/entity-list-screen.js +12 -9
- package/dist/app/extension-sections.d.ts +2 -0
- package/dist/app/list-facets.d.ts +1 -0
- package/dist/app/list-facets.js +10 -1
- package/dist/app/named-filter-facet.d.ts +0 -1
- package/dist/app/named-filter-facet.js +19 -10
- package/dist/app/projection-detail-body.js +8 -6
- package/dist/app/projection-detail-guidance-data.js +3 -1
- package/dist/app/projection-detail-guidance.d.ts +1 -1
- package/dist/app/projection-detail-guidance.js +45 -33
- package/dist/app/projection-detail-header-model.d.ts +1 -1
- package/dist/app/projection-detail-header-model.js +10 -5
- package/dist/app/projection-detail-header.js +5 -4
- package/dist/app/projection-detail-navigation.d.ts +6 -0
- package/dist/app/projection-detail-navigation.js +18 -4
- package/dist/app/screen-access.js +1 -2
- package/dist/app/screen-shared.d.ts +1 -0
- package/dist/app/screen-shared.js +23 -3
- package/dist/app/use-entity-list-payload.d.ts +2 -1
- package/dist/app/use-entity-list-payload.js +4 -2
- package/dist/app/use-projection-detail-actions.d.ts +14 -0
- package/dist/app/use-projection-detail-actions.js +40 -16
- package/dist/app/use-projection-detail-data.d.ts +2 -0
- package/dist/app/use-projection-detail-data.js +37 -10
- package/dist/app/use-row-decoration.d.ts +6 -4
- package/dist/app/use-row-decoration.js +67 -19
- package/dist/app/use-screen-list-rows.js +1 -1
- package/dist/card-options.d.ts +25 -0
- package/dist/card-options.js +1 -0
- package/dist/components/ai-assist-payload.d.ts +2 -0
- package/dist/components/ai-assist-payload.js +8 -0
- package/dist/components/edit-mounts.d.ts +3 -2
- package/dist/components/edit-mounts.js +2 -2
- package/dist/components/list-empty-state.d.ts +5 -0
- package/dist/components/list-empty-state.js +17 -1
- package/dist/components/multi-select-chips.d.ts +10 -0
- package/dist/components/multi-select-chips.js +18 -0
- package/dist/components/related-list-section.js +44 -32
- package/dist/components/related-photo-grid.d.ts +11 -0
- package/dist/components/related-photo-grid.js +40 -0
- package/dist/components/render-edit-action-button.d.ts +2 -2
- package/dist/components/render-edit-field-grid.js +3 -3
- package/dist/components/render-edit-header-actions.d.ts +2 -1
- package/dist/components/render-edit-header-actions.js +18 -1
- package/dist/components/render-edit-layout.js +2 -2
- package/dist/components/render-edit-logic.js +1 -0
- package/dist/components/render-edit-section-kinds.js +11 -0
- package/dist/components/render-edit-types.d.ts +11 -1
- package/dist/components/render-field-ai-assist.d.ts +13 -0
- package/dist/components/render-field-ai-assist.js +89 -0
- package/dist/components/render-field-choice-inputs.js +4 -0
- package/dist/components/render-field-control.d.ts +1 -1
- package/dist/components/render-field-control.js +18 -8
- package/dist/components/render-field-value-chips.d.ts +9 -0
- package/dist/components/render-field-value-chips.js +45 -0
- package/dist/components/render-field-write-only.js +12 -4
- package/dist/components/render-list-hint-columns.d.ts +2 -0
- package/dist/components/render-list-hint-columns.js +23 -0
- package/dist/components/render-list-toolbar-model.d.ts +2 -2
- package/dist/components/use-render-edit-sections.js +5 -1
- package/dist/components/use-render-list-columns.js +3 -3
- package/dist/context/screen-focus-context.d.ts +1 -1
- package/dist/context/screen-focus-context.js +3 -3
- package/dist/data-table-facet-types.d.ts +4 -0
- package/dist/headless/format/index.d.ts +1 -0
- package/dist/headless/format/index.js +20 -0
- package/dist/headless/format/phone.d.ts +1 -0
- package/dist/headless/format/phone.js +8 -0
- package/dist/headless/format/relative-time.d.ts +13 -0
- package/dist/headless/format/relative-time.js +60 -0
- package/dist/headless/format/safe-locale.d.ts +1 -0
- package/dist/headless/format/safe-locale.js +13 -0
- package/dist/headless/index.d.ts +3 -3
- package/dist/headless/index.js +3 -3
- package/dist/headless/pwa-service-worker-meta.d.ts +3 -0
- package/dist/headless/pwa-service-worker-meta.js +10 -0
- package/dist/headless/view-model/edit.d.ts +3 -2
- package/dist/headless/view-model/edit.js +78 -2
- package/dist/headless/view-model/field-text.d.ts +9 -0
- package/dist/headless/view-model/field-text.js +19 -0
- package/dist/headless/view-model/index.d.ts +1 -0
- package/dist/headless/view-model/index.js +1 -0
- package/dist/headless/view-model/types.d.ts +33 -3
- package/dist/i18n-defaults.js +4 -1
- package/dist/index.d.ts +1 -1
- package/dist/metric-types.d.ts +2 -0
- package/dist/primitives-record-guidance.d.ts +30 -1
- package/dist/primitives.d.ts +17 -27
- package/dist/web/app/dashboard-body.js +3 -2
- package/dist/web/app/dashboard-header.js +1 -1
- package/dist/web/app/dashboard-list-panel.js +9 -13
- package/dist/web/app/dashboard-panel-columns.d.ts +9 -0
- package/dist/web/app/dashboard-panel-columns.js +14 -0
- package/dist/web/app/dashboard-panels.d.ts +1 -0
- package/dist/web/app/dashboard-panels.js +9 -7
- package/dist/web/app/dashboard-reference-list-table.js +1 -0
- package/dist/web/app/dashboard-shared.js +3 -2
- package/dist/web/app/dashboard-stat-group-panel.d.ts +1 -0
- package/dist/web/app/dashboard-stat-group-panel.js +22 -8
- package/dist/web/app/dashboard-text-panel.d.ts +1 -0
- package/dist/web/app/dashboard-text-panel.js +18 -12
- package/dist/web/app/relative-time.d.ts +0 -5
- package/dist/web/app/relative-time.js +1 -20
- package/dist/web/drawn-icons.d.ts +6 -0
- package/dist/web/drawn-icons.js +30 -0
- package/dist/web/icons.js +6 -5
- package/dist/web/index.d.ts +2 -0
- package/dist/web/index.js +2 -0
- package/dist/web/layout/default-app-shell.js +3 -3
- package/dist/web/layout/nav-collapse-state.d.ts +2 -0
- package/dist/web/layout/nav-collapse-state.js +10 -0
- package/dist/web/layout/nav-tree.js +46 -23
- package/dist/web/layout/notification-bell.d.ts +7 -2
- package/dist/web/layout/notification-bell.js +16 -5
- package/dist/web/layout/shell-focus.d.ts +2 -2
- package/dist/web/layout/shell-focus.js +7 -3
- package/dist/web/layout/shell-header.d.ts +2 -1
- package/dist/web/layout/shell-header.js +56 -27
- package/dist/web/layout/shell-style.d.ts +3 -0
- package/dist/web/layout/shell-style.js +6 -0
- package/dist/web/layout/workspace-shell.d.ts +11 -1
- package/dist/web/layout/workspace-shell.js +6 -4
- package/dist/web/primitives/banner.d.ts +1 -1
- package/dist/web/primitives/banner.js +19 -9
- package/dist/web/primitives/card.js +18 -8
- package/dist/web/primitives/data-table/actions-column.d.ts +1 -1
- package/dist/web/primitives/data-table/actions-column.js +3 -1
- package/dist/web/primitives/data-table/card-body.d.ts +1 -1
- package/dist/web/primitives/data-table/card-body.js +11 -6
- package/dist/web/primitives/data-table/card-row.js +27 -18
- package/dist/web/primitives/data-table/data-cell-props.d.ts +2 -0
- package/dist/web/primitives/data-table/data-cell-props.js +2 -0
- package/dist/web/primitives/data-table/hint-cell.d.ts +1 -3
- package/dist/web/primitives/data-table/hint-cell.js +4 -10
- package/dist/web/primitives/data-table/row-click-guard.d.ts +2 -0
- package/dist/web/primitives/data-table/row-click-guard.js +19 -0
- package/dist/web/primitives/data-table/row-render-parts.d.ts +1 -1
- package/dist/web/primitives/data-table/row-render-parts.js +3 -2
- package/dist/web/primitives/data-table/sort-options-select.js +3 -3
- package/dist/web/primitives/data-table/table-body.js +2 -1
- package/dist/web/primitives/data-table/table-content.js +10 -6
- package/dist/web/primitives/data-table/table-view.js +8 -3
- package/dist/web/primitives/data-table/toolbar.d.ts +2 -0
- package/dist/web/primitives/data-table/toolbar.js +44 -9
- package/dist/web/primitives/data-table/totals-footer.js +4 -3
- package/dist/web/primitives/data-table-cell.d.ts +4 -1
- package/dist/web/primitives/data-table-cell.js +60 -20
- package/dist/web/primitives/default-form.js +6 -3
- package/dist/web/primitives/drawer.js +5 -1
- package/dist/web/primitives/facet-filter.d.ts +1 -1
- package/dist/web/primitives/facet-filter.js +16 -8
- package/dist/web/primitives/facet-search-filter.d.ts +2 -1
- package/dist/web/primitives/facet-search-filter.js +3 -2
- package/dist/web/primitives/facet-trigger-label.d.ts +8 -0
- package/dist/web/primitives/facet-trigger-label.js +9 -0
- package/dist/web/primitives/file-view-action.js +4 -1
- package/dist/web/primitives/form-footer-parts.js +4 -1
- package/dist/web/primitives/form.js +6 -8
- package/dist/web/primitives/index.js +4 -0
- package/dist/web/primitives/layout-elements.d.ts +1 -1
- package/dist/web/primitives/layout-elements.js +3 -3
- package/dist/web/primitives/locale-number.d.ts +0 -1
- package/dist/web/primitives/locale-number.js +1 -13
- package/dist/web/primitives/metric.js +17 -5
- package/dist/web/primitives/money-input.js +2 -1
- package/dist/web/primitives/narrow-pinned-footer.js +7 -3
- package/dist/web/primitives/number-input.js +2 -1
- package/dist/web/primitives/page-header.js +3 -2
- package/dist/web/primitives/pager.d.ts +3 -2
- package/dist/web/primitives/pager.js +16 -20
- package/dist/web/primitives/photo-grid.d.ts +3 -0
- package/dist/web/primitives/photo-grid.js +5 -0
- package/dist/web/primitives/record-breadcrumb.js +1 -1
- package/dist/web/primitives/record-steps.d.ts +1 -1
- package/dist/web/primitives/record-steps.js +11 -6
- package/dist/web/primitives/record-summary.d.ts +1 -1
- package/dist/web/primitives/record-summary.js +8 -3
- package/dist/web/primitives/segmented-select.js +6 -3
- package/dist/web/primitives/step-list.d.ts +3 -0
- package/dist/web/primitives/step-list.js +11 -0
- package/dist/web/primitives/tabs.js +6 -1
- package/dist/web/pwa/pwa-support.js +19 -1
- package/dist/web/ui/sidebar.d.ts +2 -1
- package/dist/web/ui/sidebar.js +4 -3
- package/dist/web/widgets/ai-text-field.js +3 -2
- package/dist/web/widgets/dashboard-list-cards.js +6 -14
- package/dist/web/widgets/dashboard-list.d.ts +10 -0
- package/dist/web/widgets/dashboard-list.js +36 -10
- package/dist/web/widgets/drawer-panel-class.d.ts +1 -0
- package/dist/web/widgets/drawer-panel-class.js +9 -1
- package/dist/web/widgets/drawer.js +2 -2
- package/dist/web/widgets/pdf-viewer-toolbar.js +3 -2
- package/dist/web/widgets/sheet-parts.js +3 -1
- package/dist/web/widgets/stat-box-cell.js +1 -1
- package/dist/web/widgets/stat.d.ts +7 -1
- package/dist/web/widgets/stat.js +12 -4
- package/dist/web/widgets/step-list-row.d.ts +4 -0
- package/dist/web/widgets/step-list-row.js +22 -14
- package/dist/web/widgets/step-list.d.ts +12 -4
- package/dist/web/widgets/step-list.js +38 -20
- package/package.json +5 -5
- package/src/changes.json +126 -0
- package/src/web/styles.css +6 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ActionFormScreenDefinition, RowActionDrawer, ToolbarAction } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
2
|
import { type ReactNode } from "react";
|
|
3
|
-
import type
|
|
3
|
+
import { type Translate } from "../headless/index.ts";
|
|
4
4
|
import type { FeatureSchema } from "./feature-schema.ts";
|
|
5
5
|
type DrawerLikeAction = Extract<ToolbarAction, {
|
|
6
6
|
kind: "drawer";
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { AiAssistPayloadProvider } from "../components/ai-assist-payload.js";
|
|
3
4
|
import { withDerivedValues } from "../components/form-derivation-patch.js";
|
|
4
5
|
import { RenderEdit } from "../components/render-edit.js";
|
|
5
6
|
import { useDispatcher } from "../context/dispatcher-context.js";
|
|
6
7
|
import { rendererWarn } from "../dev-console.js";
|
|
8
|
+
import { resolveFieldText, } from "../headless/index.js";
|
|
7
9
|
import { useLocale, useTranslation } from "../i18n.js";
|
|
8
10
|
import { InsideDrawerProvider, useInsideDrawer } from "../inside-drawer.js";
|
|
9
11
|
import { PageHeaderSlotAvailableProvider } from "../page-header-slot.js";
|
|
10
12
|
import { usePrimitives } from "../primitives.js";
|
|
11
13
|
import { screenFillsHeight } from "../screen-fills-height.js";
|
|
14
|
+
import { statusToneForOptionTone } from "../status-tone.js";
|
|
12
15
|
import { actionFormSubmittableFields, synthesizeActionFormEntity, synthesizeActionFormScreen, } from "./action-form-shim.js";
|
|
13
|
-
import { ActionFormLoadStatus, ActionFormSuccessBanner, isSecretFormField, resolveActionFormRecordId, resolveSuccessFacts, useActionFormLoad, } from "./action-form-support.js";
|
|
16
|
+
import { ActionFormLoadStatus, ActionFormSuccessBanner, DEFAULT_LOAD_ID_PARAM, isSecretFormField, resolveActionFormRecordId, resolveSuccessFacts, useActionFormLoad, } from "./action-form-support.js";
|
|
14
17
|
import { useAppFeatures } from "./app-features-context.js";
|
|
15
18
|
import { mergeSearchParamsIntoInitial, tenantCurrencyMoneyFieldNames, useMoneyCurrencyOverrides, } from "./entity-edit-prefill.js";
|
|
16
19
|
import { hiddenRequiredFieldsFilled, layoutFieldNames } from "./layout-fields.js";
|
|
@@ -116,7 +119,7 @@ export function ActionFormBody({ schema, screen, translate, entityId, initialOve
|
|
|
116
119
|
const appFeatures = useAppFeatures();
|
|
117
120
|
const insideDrawer = useInsideDrawer();
|
|
118
121
|
const locale = useLocale().locale();
|
|
119
|
-
const { Banner } = usePrimitives();
|
|
122
|
+
const { Banner, StatusBadge } = usePrimitives();
|
|
120
123
|
// Unused when drawer-hosted — onSuccess/onCancelOverride win below first.
|
|
121
124
|
const returnTarget = useReturnTarget(screen.id);
|
|
122
125
|
const submittableFields = useMemo(() => actionFormSubmittableFields(screen), [screen]);
|
|
@@ -135,14 +138,22 @@ export function ActionFormBody({ schema, screen, translate, entityId, initialOve
|
|
|
135
138
|
const loadableFieldNames = useMemo(() => Object.entries(submittableFields)
|
|
136
139
|
.filter(([, field]) => !isSecretFormField(field))
|
|
137
140
|
.map(([name]) => name), [submittableFields]);
|
|
138
|
-
const
|
|
141
|
+
const loadRecordId = screen.load !== undefined
|
|
139
142
|
? resolveActionFormRecordId({
|
|
140
143
|
routeEntityId: entityId,
|
|
141
144
|
drawerOverrides: initialOverrides,
|
|
142
145
|
searchParams: nav.searchParams,
|
|
143
146
|
})
|
|
144
|
-
: undefined
|
|
147
|
+
: undefined;
|
|
148
|
+
const loadState = useActionFormLoad(screen.load, loadRecordId, loadableFieldNames, screen.summary?.paramsFromLoad, initialOverrides);
|
|
149
|
+
// What an aiAssist query gets besides its chip params: the same context the form loads with.
|
|
150
|
+
const aiAssistPayload = useMemo(() => screen.load === undefined
|
|
151
|
+
? (initialOverrides ?? {})
|
|
152
|
+
: screen.load.singleton === true
|
|
153
|
+
? {}
|
|
154
|
+
: { [screen.load.idParam ?? DEFAULT_LOAD_ID_PARAM]: loadRecordId }, [screen.load, initialOverrides, loadRecordId]);
|
|
145
155
|
const loadedValues = loadState?.status === "ready" ? loadState.values : undefined;
|
|
156
|
+
const summaryLoadValues = loadState?.status === "ready" ? loadState.summaryValues : undefined;
|
|
146
157
|
const refetchLoadedValues = loadState?.status === "ready" ? loadState.refetch : undefined;
|
|
147
158
|
const initial = useMemo(() => {
|
|
148
159
|
// With `load` the loaded record is the only source of values: a crafted link
|
|
@@ -177,7 +188,7 @@ export function ActionFormBody({ schema, screen, translate, entityId, initialOve
|
|
|
177
188
|
const derivedInitial = useMemo(() => withDerivedValues(initial, screen.derive !== undefined ? screen : undefined), [initial, screen]);
|
|
178
189
|
const t = useTranslation();
|
|
179
190
|
const effectiveTranslate = translate ?? t;
|
|
180
|
-
const summary = useMemo(() => resolveActionFormSummary(screen.summary, initialOverrides, effectiveTranslate, locale), [screen.summary, initialOverrides, effectiveTranslate, locale]);
|
|
191
|
+
const summary = useMemo(() => resolveActionFormSummary(screen.summary, { ...summaryLoadValues, ...initialOverrides }, effectiveTranslate, locale), [screen.summary, summaryLoadValues, initialOverrides, effectiveTranslate, locale]);
|
|
181
192
|
const dispatcher = useDispatcher();
|
|
182
193
|
const [success, setSuccess] = useState(undefined);
|
|
183
194
|
// Bumped after a successful submit with resetOnSuccess: remounts RenderEdit, which
|
|
@@ -291,15 +302,31 @@ export function ActionFormBody({ schema, screen, translate, entityId, initialOve
|
|
|
291
302
|
if (loadState !== undefined && loadState.status !== "ready") {
|
|
292
303
|
return (_jsx(ActionFormLoadStatus, { state: loadState, screenId: screen.id, translate: effectiveTranslate }));
|
|
293
304
|
}
|
|
294
|
-
return (_jsx(RenderEdit, { screen: synthScreen, entity: synthEntity, featureName: schema.featureName, initial: derivedInitial, ...(screen.derive !== undefined && { formDerivation: screen }), actionFormScreenQn: qualifyScreenId(schema.featureName, screen.id),
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
+
return (_jsx(AiAssistPayloadProvider, { value: aiAssistPayload, children: _jsx(RenderEdit, { screen: synthScreen, entity: synthEntity, featureName: schema.featureName, initial: derivedInitial, ...(screen.derive !== undefined && { formDerivation: screen }), actionFormScreenQn: qualifyScreenId(schema.featureName, screen.id),
|
|
306
|
+
// Extension sections in the actionForm see the initial form values
|
|
307
|
+
// (incl. searchParams prefill, e.g. ?incidentId=...) as initialValues;
|
|
308
|
+
// unlike entityEdit there is no record they could draw context from.
|
|
309
|
+
extensionInitialValues: initial, ...(screen.submitPrefilled === true && {
|
|
310
|
+
submitWithoutChanges: hiddenRequiredFieldsFilled(synthScreen, screen.fields, initial),
|
|
311
|
+
}), ...((success !== undefined || screen.infoBand !== undefined) && {
|
|
312
|
+
leadContent: (_jsxs(_Fragment, { children: [screen.infoBand !== undefined && (_jsx(Banner, { variant: "primary", icon: "sparkles", density: "compact", testId: "kumiko-screen-action-form-info-band", children: effectiveTranslate(screen.infoBand) })), success !== undefined && _jsx(ActionFormSuccessBanner, { success: success })] })),
|
|
313
|
+
}), ...(screen.fieldBadges !== undefined &&
|
|
314
|
+
StatusBadge !== undefined && {
|
|
315
|
+
labelAppendix: (fieldName) => {
|
|
316
|
+
const badge = screen.fieldBadges?.[fieldName];
|
|
317
|
+
if (badge === undefined)
|
|
318
|
+
return undefined;
|
|
319
|
+
return (_jsx(StatusBadge, { value: effectiveTranslate(badge.label), tone: statusToneForOptionTone(badge.tone) ?? "muted", testId: `field-badge-${fieldName}` }));
|
|
320
|
+
},
|
|
321
|
+
}), writeCommand: screen.handler, payloadMode: "values", onSubmit: handleSubmitted, ...(handleCancel !== undefined && { onCancel: handleCancel }), onDirtyChange: handleDirtyChange, ...((insideDrawer || screenFillsHeight(screen)) && { fillScreenHeight: true }), ...((screen.submitLabel ?? submitLabelFallback) !== undefined && {
|
|
322
|
+
submitLabel: screen.submitLabel ?? submitLabelFallback,
|
|
323
|
+
}), ...(screen.submitStyle !== undefined && { submitVariant: screen.submitStyle }), ...(screen.footerActions !== undefined && { footerActions: screen.footerActions }), ...(screen.formErrorOnTop === true && { formErrorOnTop: true }), ...(screen.fieldDescriptions !== undefined && {
|
|
324
|
+
fieldDescription: (fieldName, values) => {
|
|
325
|
+
const ref = screen.fieldDescriptions?.[fieldName];
|
|
326
|
+
if (ref === undefined)
|
|
327
|
+
return undefined;
|
|
328
|
+
const { text, complete } = resolveFieldText(ref, values, effectiveTranslate);
|
|
329
|
+
return complete ? text : undefined;
|
|
330
|
+
},
|
|
331
|
+
}), ...(summary !== undefined && { summary }), ...(translate !== undefined && { translate }) }, formEpoch) }));
|
|
305
332
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ActionFormLoad, ActionFormSuccessFact } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
2
|
import { type ReactNode } from "react";
|
|
3
3
|
import type { DispatcherError, Translate } from "../headless/index.ts";
|
|
4
|
+
export declare const DEFAULT_LOAD_ID_PARAM = "id";
|
|
4
5
|
/** Record id of a `load` form: the route path id, else the drawer prefill `id`
|
|
5
6
|
* (the clicked row), else the URL `id` param. Only the id is read from these
|
|
6
7
|
* sources, never another value. */
|
|
@@ -21,6 +22,8 @@ export type ActionFormLoadState = {
|
|
|
21
22
|
} | {
|
|
22
23
|
readonly status: "ready";
|
|
23
24
|
readonly values: Readonly<Record<string, unknown>>;
|
|
25
|
+
/** `summary.paramsFromLoad` picked from the raw load result. */
|
|
26
|
+
readonly summaryValues: Readonly<Record<string, unknown>>;
|
|
24
27
|
readonly refetch: () => Promise<void>;
|
|
25
28
|
};
|
|
26
29
|
/** A sensitive, writeOnly or password field never takes a value from a loaded
|
|
@@ -28,7 +31,7 @@ export type ActionFormLoadState = {
|
|
|
28
31
|
export declare function isSecretFormField(field: unknown): boolean;
|
|
29
32
|
/** Loads the initial values of an actionForm declaring `load`; undefined for a
|
|
30
33
|
* form without `load`. */
|
|
31
|
-
export declare function useActionFormLoad(load: ActionFormLoad | undefined, recordId: string | undefined, fieldNames: readonly string[]): ActionFormLoadState | undefined;
|
|
34
|
+
export declare function useActionFormLoad(load: ActionFormLoad | undefined, recordId: string | undefined, fieldNames: readonly string[], summaryFieldNames?: readonly string[], prefill?: Readonly<Record<string, unknown>>): ActionFormLoadState | undefined;
|
|
32
35
|
/** Banner for every `load` state that is not "ready". */
|
|
33
36
|
export declare function ActionFormLoadStatus({ state, screenId, translate, }: {
|
|
34
37
|
readonly state: Exclude<ActionFormLoadState, {
|
|
@@ -5,7 +5,7 @@ import { useQuery } from "../hooks/use-query.js";
|
|
|
5
5
|
import { usePrimitives } from "../primitives.js";
|
|
6
6
|
import { QueryLoadingBanner } from "./query-state-banners.js";
|
|
7
7
|
import { dispatcherErrorText } from "./write-failed-error.js";
|
|
8
|
-
const DEFAULT_LOAD_ID_PARAM = "id";
|
|
8
|
+
export const DEFAULT_LOAD_ID_PARAM = "id";
|
|
9
9
|
function nonEmptyId(value) {
|
|
10
10
|
if (typeof value === "string" && value !== "")
|
|
11
11
|
return value;
|
|
@@ -39,10 +39,14 @@ function pickDeclaredFields(record, fieldNames) {
|
|
|
39
39
|
}
|
|
40
40
|
/** Loads the initial values of an actionForm declaring `load`; undefined for a
|
|
41
41
|
* form without `load`. */
|
|
42
|
-
export function useActionFormLoad(load, recordId, fieldNames) {
|
|
42
|
+
export function useActionFormLoad(load, recordId, fieldNames, summaryFieldNames = [], prefill) {
|
|
43
43
|
const isSingleton = load?.singleton === true;
|
|
44
|
-
const query = useQuery(load?.query ?? "",
|
|
44
|
+
const query = useQuery(load?.query ?? "", {
|
|
45
|
+
...(load?.passPrefill === true && prefill),
|
|
46
|
+
...(isSingleton ? {} : { [load?.idParam ?? DEFAULT_LOAD_ID_PARAM]: recordId }),
|
|
47
|
+
}, { enabled: load !== undefined && (isSingleton || recordId !== undefined) });
|
|
45
48
|
const values = useMemo(() => pickDeclaredFields(query.data, fieldNames), [query.data, fieldNames]);
|
|
49
|
+
const summaryValues = useMemo(() => pickDeclaredFields(query.data, summaryFieldNames), [query.data, summaryFieldNames]);
|
|
46
50
|
if (load === undefined)
|
|
47
51
|
return undefined;
|
|
48
52
|
if (!isSingleton && recordId === undefined)
|
|
@@ -53,7 +57,7 @@ export function useActionFormLoad(load, recordId, fieldNames) {
|
|
|
53
57
|
return { status: "loading" };
|
|
54
58
|
if (query.data === null)
|
|
55
59
|
return { status: "missing-record" };
|
|
56
|
-
return { status: "ready", values, refetch: query.refetch };
|
|
60
|
+
return { status: "ready", values, summaryValues, refetch: query.refetch };
|
|
57
61
|
}
|
|
58
62
|
/** Banner for every `load` state that is not "ready". */
|
|
59
63
|
export function ActionFormLoadStatus({ state, screenId, translate, }) {
|
|
@@ -52,9 +52,11 @@ export async function runClientAction(options) {
|
|
|
52
52
|
}
|
|
53
53
|
if (!outcome.ok)
|
|
54
54
|
return fail(translate(outcome.message));
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
if (action.successMessage !== false) {
|
|
56
|
+
notify?.({
|
|
57
|
+
tone: "success",
|
|
58
|
+
text: translate(action.successMessage ?? "kumiko.clientAction.success"),
|
|
59
|
+
});
|
|
60
|
+
}
|
|
59
61
|
return true;
|
|
60
62
|
}
|
|
@@ -96,6 +96,12 @@ function actionRowsAfterField(actions, translate) {
|
|
|
96
96
|
};
|
|
97
97
|
return { rowAfterField };
|
|
98
98
|
}
|
|
99
|
+
// A read-only field shows its value; resetting an override from its cascade would change it anyway.
|
|
100
|
+
function readOnlyLayoutFieldNames(screen) {
|
|
101
|
+
return new Set(layoutEditFields(screen)
|
|
102
|
+
.filter((spec) => spec.readOnly === true)
|
|
103
|
+
.map((spec) => spec.field));
|
|
104
|
+
}
|
|
99
105
|
// A field hidden by its `visible` condition (a provider's settings while another
|
|
100
106
|
// provider is picked) is not saved: the form saves what it shows.
|
|
101
107
|
function hiddenLayoutFieldNames(screen, values) {
|
|
@@ -196,6 +202,7 @@ export function ConfigEditBody({ schema, screen: declaredScreen, translate, }) {
|
|
|
196
202
|
screen.configKeys,
|
|
197
203
|
screen.scope,
|
|
198
204
|
]);
|
|
205
|
+
const readOnlyFields = useMemo(() => readOnlyLayoutFieldNames(synthScreen), [synthScreen]);
|
|
199
206
|
// Cascade lookup: qualifiedKey -> ConfigCascade for the cascade display
|
|
200
207
|
// under each field. Defensive `levels` shape check so foreign query mocks
|
|
201
208
|
// (e.g. configEdit unit tests that only mock `config:query:values`) do not
|
|
@@ -373,9 +380,11 @@ export function ConfigEditBody({ schema, screen: declaredScreen, translate, }) {
|
|
|
373
380
|
if (cascade === undefined)
|
|
374
381
|
return undefined;
|
|
375
382
|
const renderValue = cascadeValueRenderer(fieldName);
|
|
376
|
-
return (_jsx(ConfigCascadeView, { cascade: cascade, screenScope: screen.scope, qualifiedKey: screen.configKeys[fieldName], required: screen.requiredFields?.includes(fieldName) ?? false, ...(renderValue !== undefined && { renderValue }),
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
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) && {
|
|
384
|
+
onReset: async (key, scope) => {
|
|
385
|
+
await dispatcher.write("config:write:reset", { key, scope });
|
|
386
|
+
await Promise.allSettled([valuesQuery.refetch?.(), cascadeQuery.refetch?.()]);
|
|
387
|
+
},
|
|
388
|
+
}) }));
|
|
380
389
|
} }));
|
|
381
390
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { evalFieldCondition } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
3
3
|
import { resolveActionIcon } from "@cosmicdrift/kumiko-types/action-icon";
|
|
4
|
+
import { entityListDeclaresSearch } from "@cosmicdrift/kumiko-types/screen";
|
|
4
5
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
5
6
|
import { ListGroupPageBridges } from "../components/list-group-page-bridges.js";
|
|
6
7
|
import { RenderList } from "../components/render-list.js";
|
|
@@ -55,6 +56,15 @@ export function EntityListScreen({ schema, screen, translate, onRowClick, }) {
|
|
|
55
56
|
function toolbarDescriptionOf(description, isEmbedded, translate) {
|
|
56
57
|
return description === undefined || isEmbedded ? undefined : translate(description);
|
|
57
58
|
}
|
|
59
|
+
// Searchable default: explicit author choice wins, otherwise auto-on when
|
|
60
|
+
// the entity has searchable fields (dead toolbar slot otherwise — the
|
|
61
|
+
// server search index has nothing to filter). Gated on
|
|
62
|
+
// schema.searchAdapterMissing !== true regardless of source (explicit or
|
|
63
|
+
// auto) — a search bar the server can't serve would 422 at request-time;
|
|
64
|
+
// matches the boot-time check in api/server.ts.
|
|
65
|
+
function isEntityListSearchable(schema, screen, entity) {
|
|
66
|
+
return schema.searchAdapterMissing !== true && entityListDeclaresSearch(screen, entity);
|
|
67
|
+
}
|
|
58
68
|
function EntityListBody({ schema, screen, entity, translate, onRowClick, }) {
|
|
59
69
|
const isEmbeddedScreen = useIsEmbeddedScreen();
|
|
60
70
|
const featureName = schema.featureName;
|
|
@@ -92,9 +102,11 @@ function EntityListBody({ schema, screen, entity, translate, onRowClick, }) {
|
|
|
92
102
|
translate: effectiveTranslate,
|
|
93
103
|
urlState,
|
|
94
104
|
});
|
|
105
|
+
const searchable = isEntityListSearchable(schema, screen, entity);
|
|
95
106
|
const { filterPayload, listPayloadFor, queryPayload, effectiveSort } = useEntityListPayload({
|
|
96
107
|
screen,
|
|
97
108
|
entity,
|
|
109
|
+
searchable,
|
|
98
110
|
urlState,
|
|
99
111
|
rangeFilters: range.rangeFilters,
|
|
100
112
|
activeNamedFilter,
|
|
@@ -385,15 +397,6 @@ function EntityListBody({ schema, screen, entity, translate, onRowClick, }) {
|
|
|
385
397
|
: onRowClick !== undefined
|
|
386
398
|
? (row) => onRowClick(row, screen.entity)
|
|
387
399
|
: undefined;
|
|
388
|
-
// Searchable default: explicit author choice wins, otherwise auto-on when
|
|
389
|
-
// the entity has searchable fields (dead toolbar slot otherwise — the
|
|
390
|
-
// server search index has nothing to filter). Gated on
|
|
391
|
-
// schema.searchAdapterMissing !== true regardless of source (explicit or
|
|
392
|
-
// auto) — a search bar the server can't serve would 422 at request-time;
|
|
393
|
-
// matches the boot-time check in api/server.ts.
|
|
394
|
-
const searchable = schema.searchAdapterMissing !== true &&
|
|
395
|
-
(screen.searchable ??
|
|
396
|
-
Object.values(entity.fields).some((f) => "searchable" in f && f.searchable === true));
|
|
397
400
|
// Assemble pager props only for pagination="pages". The server total
|
|
398
401
|
// arrives async; until it is there RenderList renders the table without a
|
|
399
402
|
// pager (the pager has its own total>0 guard).
|
|
@@ -66,6 +66,8 @@ export type ExtensionSectionProps = {
|
|
|
66
66
|
* (`null` while the step's data loads) with whether the step already holds
|
|
67
67
|
* its data, so the step bar shows the step as done. */
|
|
68
68
|
readonly reportStepComplete?: (complete: boolean) => void;
|
|
69
|
+
/** Id of the active tab; only set in the `afterForm` slot of a projectionDetail screen with tabs, so the component can limit itself to one tab. */
|
|
70
|
+
readonly activeTabId?: string;
|
|
69
71
|
};
|
|
70
72
|
export type ExtensionSectionComponent = ComponentType<ExtensionSectionProps>;
|
|
71
73
|
export type ExtensionSectionsMap = Readonly<Record<string, ExtensionSectionComponent>>;
|
|
@@ -21,6 +21,7 @@ export type ResolvedFacetSpec = {
|
|
|
21
21
|
/** Author handler that serves the options instead of the entity list. */
|
|
22
22
|
readonly optionsQuery?: string;
|
|
23
23
|
};
|
|
24
|
+
readonly narrowPlacement?: "behind-filter";
|
|
24
25
|
/** Reference facets only: set once the bridge resolved it. Makes the facet searchable. */
|
|
25
26
|
readonly onSearchChange?: (query: string) => void;
|
|
26
27
|
readonly searching?: boolean;
|
package/dist/app/list-facets.js
CHANGED
|
@@ -22,6 +22,7 @@ function facetBase(spec) {
|
|
|
22
22
|
field: spec.field,
|
|
23
23
|
label: spec.label,
|
|
24
24
|
options: spec.options,
|
|
25
|
+
...(spec.narrowPlacement !== undefined && { narrowPlacement: spec.narrowPlacement }),
|
|
25
26
|
...(spec.onSearchChange !== undefined && { onSearchChange: spec.onSearchChange }),
|
|
26
27
|
...(spec.searching !== undefined && { searching: spec.searching }),
|
|
27
28
|
};
|
|
@@ -37,6 +38,7 @@ export function buildFacetChips(spec, config, translate) {
|
|
|
37
38
|
id: extra.id,
|
|
38
39
|
label: translate(extra.label),
|
|
39
40
|
values: extra.values,
|
|
41
|
+
...(extra.separatorAfter === true && { separatorAfter: true }),
|
|
40
42
|
});
|
|
41
43
|
return [
|
|
42
44
|
...extras.filter((extra) => extra.position !== "end").map(toChip),
|
|
@@ -56,7 +58,10 @@ export function buildEntityFilterFacets(specs, configs, translate, counts) {
|
|
|
56
58
|
const config = configs?.[spec.field];
|
|
57
59
|
if (config === false)
|
|
58
60
|
continue;
|
|
59
|
-
const base =
|
|
61
|
+
const base = {
|
|
62
|
+
...facetBase(spec),
|
|
63
|
+
...(config?.narrowPlacement !== undefined && { narrowPlacement: config.narrowPlacement }),
|
|
64
|
+
};
|
|
60
65
|
if (config?.display !== "chips") {
|
|
61
66
|
out.push(base);
|
|
62
67
|
continue;
|
|
@@ -150,12 +155,14 @@ export function resolveProjectionFacetSpecs(facets, translate, featureName) {
|
|
|
150
155
|
return facets.flatMap((facet) => {
|
|
151
156
|
if (facet.type === "dateRange")
|
|
152
157
|
return [];
|
|
158
|
+
const placement = facet.narrowPlacement !== undefined ? { narrowPlacement: facet.narrowPlacement } : {};
|
|
153
159
|
if (facet.type === "select") {
|
|
154
160
|
return [
|
|
155
161
|
{
|
|
156
162
|
field: facet.field,
|
|
157
163
|
type: "select",
|
|
158
164
|
label: tr(facet.label),
|
|
165
|
+
...placement,
|
|
159
166
|
options: facet.options.map((opt) => ({
|
|
160
167
|
value: opt.value,
|
|
161
168
|
label: tr(opt.label),
|
|
@@ -169,6 +176,7 @@ export function resolveProjectionFacetSpecs(facets, translate, featureName) {
|
|
|
169
176
|
field: facet.field,
|
|
170
177
|
type: "boolean",
|
|
171
178
|
label: tr(facet.label),
|
|
179
|
+
...placement,
|
|
172
180
|
options: [
|
|
173
181
|
{ value: "true", label: tr(facet.trueLabel) },
|
|
174
182
|
{ value: "false", label: tr(facet.falseLabel) },
|
|
@@ -182,6 +190,7 @@ export function resolveProjectionFacetSpecs(facets, translate, featureName) {
|
|
|
182
190
|
field: facet.field,
|
|
183
191
|
type: "reference",
|
|
184
192
|
label: tr(facet.label),
|
|
193
|
+
...placement,
|
|
185
194
|
options: [],
|
|
186
195
|
reference: {
|
|
187
196
|
refEntity: target.entityName,
|
|
@@ -6,7 +6,6 @@ import type { DataTableFacet } from "../primitives.tsx";
|
|
|
6
6
|
import type { FacetCountQuery } from "./facet-count-bridge.tsx";
|
|
7
7
|
export declare const NAMED_FILTER_FACET_FIELD = "__namedFilter";
|
|
8
8
|
type NamedFilterUrlState = Pick<ListUrlStateApi, "namedFilter" | "setFilter" | "setNamedFilter">;
|
|
9
|
-
export declare function isNamedFilterOffered(ref: NamedListFilterRef, userRoles: readonly string[] | undefined): boolean;
|
|
10
9
|
export declare function namedFilterCountKey(id: string | undefined): string;
|
|
11
10
|
/** One toggle chip (or one select entry) per named filter the user may open, rendered by the facet row. */
|
|
12
11
|
export declare function buildNamedFilterFacet(allRefs: readonly NamedListFilterRef[] | undefined, translate: Translate, userRoles: readonly string[] | undefined, options?: NamedFilterFacetOptions, counts?: Readonly<Record<string, number>>): DataTableFacet | undefined;
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
+
import { isUiAccessGranted } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
1
2
|
// Not a real field: keeps the named filter out of the `.f.<field>` facet namespace.
|
|
2
3
|
export const NAMED_FILTER_FACET_FIELD = "__namedFilter";
|
|
3
4
|
const NAMED_FILTER_ALL_CHIP_ID = "all";
|
|
4
|
-
// Unknown roles (undefined) deny a restricted filter, like role-gated screens do.
|
|
5
|
-
export function isNamedFilterOffered(ref, userRoles) {
|
|
6
|
-
const required = ref.roles;
|
|
7
|
-
return required === undefined || (userRoles ?? []).some((role) => required.includes(role));
|
|
8
|
-
}
|
|
9
5
|
// `undefined` is the "all" entry: the list without any named filter.
|
|
10
6
|
export function namedFilterCountKey(id) {
|
|
11
7
|
return `${NAMED_FILTER_FACET_FIELD}:${id ?? ""}`;
|
|
12
8
|
}
|
|
13
9
|
function offeredRefs(allRefs, userRoles) {
|
|
14
|
-
return allRefs?.filter((ref) =>
|
|
10
|
+
return allRefs?.filter((ref) => isUiAccessGranted(ref.access, userRoles)) ?? [];
|
|
15
11
|
}
|
|
16
12
|
/** One toggle chip (or one select entry) per named filter the user may open, rendered by the facet row. */
|
|
17
13
|
export function buildNamedFilterFacet(allRefs, translate, userRoles, options, counts = {}) {
|
|
@@ -20,14 +16,16 @@ export function buildNamedFilterFacet(allRefs, translate, userRoles, options, co
|
|
|
20
16
|
return undefined;
|
|
21
17
|
const isSelect = options?.display === "select";
|
|
22
18
|
const showCounts = options?.showCounts === true;
|
|
19
|
+
const hideEmpty = options?.hideEmpty === true;
|
|
23
20
|
const countOf = (id) => {
|
|
24
|
-
const count = showCounts ? counts[namedFilterCountKey(id)] : undefined;
|
|
21
|
+
const count = showCounts || hideEmpty ? counts[namedFilterCountKey(id)] : undefined;
|
|
25
22
|
return count === undefined ? {} : { count };
|
|
26
23
|
};
|
|
27
24
|
const chips = refs.map((ref) => ({
|
|
28
25
|
id: ref.id,
|
|
29
26
|
label: translate(ref.label),
|
|
30
27
|
values: [ref.id],
|
|
28
|
+
...(ref.separatorAfter === true && { separatorAfter: true }),
|
|
31
29
|
...countOf(ref.id),
|
|
32
30
|
}));
|
|
33
31
|
return {
|
|
@@ -48,7 +46,9 @@ export function buildNamedFilterFacet(allRefs, translate, userRoles, options, co
|
|
|
48
46
|
]
|
|
49
47
|
: chips,
|
|
50
48
|
...(isSelect && { display: "select" }),
|
|
49
|
+
...(options?.narrowPlacement !== undefined && { narrowPlacement: options.narrowPlacement }),
|
|
51
50
|
...(showCounts && { showCounts: true }),
|
|
51
|
+
...(hideEmpty && { hideEmpty: true }),
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
/** The list payload of one named filter reduced to a count: no sort and no paging, one row, the total. */
|
|
@@ -61,7 +61,7 @@ export function namedFilterCountPayload(listPayload) {
|
|
|
61
61
|
}
|
|
62
62
|
/** One count query per offered filter plus one for "all"; each takes the very payload the list would send for that filter. */
|
|
63
63
|
export function buildNamedFilterCountQueries(allRefs, userRoles, options, listPayloadFor) {
|
|
64
|
-
if (options?.showCounts !== true)
|
|
64
|
+
if (options?.showCounts !== true && options?.hideEmpty !== true)
|
|
65
65
|
return [];
|
|
66
66
|
const refs = offeredRefs(allRefs, userRoles);
|
|
67
67
|
if (refs.length === 0)
|
|
@@ -105,9 +105,18 @@ export function buildNamedFilterEmpty(allRefs, activeNamedFilter, search, otherN
|
|
|
105
105
|
const emptyState = allRefs?.find((ref) => ref.id === activeNamedFilter)?.emptyState;
|
|
106
106
|
if (emptyState === undefined || otherNarrowing || search.trim() !== "")
|
|
107
107
|
return undefined;
|
|
108
|
+
const { title, description, paramsQuery } = emptyState;
|
|
108
109
|
return {
|
|
109
|
-
title: translate(
|
|
110
|
-
...(
|
|
110
|
+
title: translate(title),
|
|
111
|
+
...(description !== undefined &&
|
|
112
|
+
(paramsQuery === undefined
|
|
113
|
+
? { description: translate(description) }
|
|
114
|
+
: {
|
|
115
|
+
describedByQuery: {
|
|
116
|
+
query: paramsQuery,
|
|
117
|
+
describe: (params) => translate(description, params),
|
|
118
|
+
},
|
|
119
|
+
})),
|
|
111
120
|
onReset,
|
|
112
121
|
};
|
|
113
122
|
}
|
|
@@ -47,7 +47,7 @@ export function ProjectionDetailBody({ schema, screen, translate, entityId, }) {
|
|
|
47
47
|
// entityId fallback (resolveExtensionEntityId in render-edit.tsx) would
|
|
48
48
|
// let a client-controlled value leak where none is meant to reach.
|
|
49
49
|
const effectiveEntityId = screen.singleton === true ? undefined : entityId;
|
|
50
|
-
const { activeSection, hasTabs, entity, detailScreen, detailQuery, reloadNonce, reloadDetail } = useProjectionDetailData({ screen, Tabs: primitives.Tabs, nav, effectiveEntityId });
|
|
50
|
+
const { activeSection, activeSections, visibleSections, hasTabs, entity, detailScreen, detailQuery, reloadNonce, reloadDetail, } = useProjectionDetailData({ screen, Tabs: primitives.Tabs, nav, effectiveEntityId });
|
|
51
51
|
// Header actions render directly via RenderEditActionButton
|
|
52
52
|
// headerActions moved out of RenderEdit's footer — this component owns
|
|
53
53
|
// the failure-surfacing state RenderEdit used to own for them.
|
|
@@ -63,7 +63,7 @@ export function ProjectionDetailBody({ schema, screen, translate, entityId, }) {
|
|
|
63
63
|
const returnTarget = screen.singleton === true ? undefined : returnTargetParam;
|
|
64
64
|
const drawer = useDrawerAction(schema);
|
|
65
65
|
const { openDrawer } = drawer;
|
|
66
|
-
const { buildSectionActions, buildItemActions, headerActions } = useProjectionDetailActions({
|
|
66
|
+
const { buildSectionActions, buildItemActions, headerActions, footerActions } = useProjectionDetailActions({
|
|
67
67
|
schema,
|
|
68
68
|
screen,
|
|
69
69
|
effectiveTranslate,
|
|
@@ -83,7 +83,7 @@ export function ProjectionDetailBody({ schema, screen, translate, entityId, }) {
|
|
|
83
83
|
const { hasMetrics, headerActionsList, hasHeaderActions, hasHeaderCard, renderedDetailScreen } = useProjectionDetailLayout({ screen, headerActions, hasTabs, detailScreen });
|
|
84
84
|
const recordId = detailQuery.data?.["id"];
|
|
85
85
|
const tabCounts = useRelatedListTabCounts({
|
|
86
|
-
sections: hasTabs ?
|
|
86
|
+
sections: hasTabs ? visibleSections : [],
|
|
87
87
|
parentId: effectiveEntityId ?? (typeof recordId === "string" ? recordId : undefined),
|
|
88
88
|
});
|
|
89
89
|
if (effectiveEntityId === undefined && screen.singleton !== true) {
|
|
@@ -104,7 +104,7 @@ export function ProjectionDetailBody({ schema, screen, translate, entityId, }) {
|
|
|
104
104
|
return renderRecordNotFound({ schema, screen, nav, returnTarget, effectiveTranslate });
|
|
105
105
|
}
|
|
106
106
|
const regionModel = {
|
|
107
|
-
screen,
|
|
107
|
+
screen: { ...screen, layout: { ...screen.layout, sections: visibleSections } },
|
|
108
108
|
record,
|
|
109
109
|
primitives,
|
|
110
110
|
effectiveTranslate,
|
|
@@ -129,13 +129,15 @@ export function ProjectionDetailBody({ schema, screen, translate, entityId, }) {
|
|
|
129
129
|
};
|
|
130
130
|
const regionPieces = deriveDetailRegionPieces(regionModel);
|
|
131
131
|
const renderHeaderContent = (headerSlot) => renderDetailHeaderContent(regionModel, regionPieces, headerSlot);
|
|
132
|
-
return (_jsxs(_Fragment, { 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 &&
|
|
132
|
+
return (_jsxs(_Fragment, { 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
|
+
footerHint: effectiveTranslate(screen.footerHint),
|
|
134
|
+
}), ...(hasTabs && activeSections.length === 1 && { hideSectionTitles: true }), ...(screenFillsHeight(screen) && { fillScreenHeight: true }), ...((hasHeaderCard ||
|
|
133
135
|
hasTabs ||
|
|
134
136
|
hasRecordGuidance(screen) ||
|
|
135
137
|
screen.slots?.header !== undefined ||
|
|
136
138
|
screen.recordTitleField !== undefined) && {
|
|
137
139
|
headerRegion: renderHeaderContent,
|
|
138
|
-
}), buildSectionActions: buildSectionActions, valueDisplay: screen.valueDisplay ?? "text" }, entityId), renderProjectionDrawerHost({
|
|
140
|
+
}), ...(footerActions !== undefined && footerActions.length > 0 && { actions: footerActions }), buildSectionActions: buildSectionActions, valueDisplay: screen.valueDisplay ?? "text" }, entityId), renderProjectionDrawerHost({
|
|
139
141
|
schema,
|
|
140
142
|
translate,
|
|
141
143
|
userRoles,
|
|
@@ -28,7 +28,7 @@ export function readNotice(value) {
|
|
|
28
28
|
return undefined;
|
|
29
29
|
// Typed keys are re-added only when valid, so a malformed tone or text can't ride along in `rest`.
|
|
30
30
|
// `rest` is only input for the banner actions' show/enabled predicates; it is never rendered.
|
|
31
|
-
const { title, text, tone, ...rest } = value;
|
|
31
|
+
const { title, text, narrowTitle, narrowText, tone, ...rest } = value;
|
|
32
32
|
if (typeof title !== "string" || title === "")
|
|
33
33
|
return undefined;
|
|
34
34
|
const parsedTone = readTone(tone);
|
|
@@ -36,6 +36,8 @@ export function readNotice(value) {
|
|
|
36
36
|
...rest,
|
|
37
37
|
title,
|
|
38
38
|
...(typeof text === "string" && { text }),
|
|
39
|
+
...(typeof narrowTitle === "string" && narrowTitle !== "" && { narrowTitle }),
|
|
40
|
+
...(typeof narrowText === "string" && narrowText !== "" && { narrowText }),
|
|
39
41
|
...(parsedTone !== undefined && { tone: parsedTone }),
|
|
40
42
|
};
|
|
41
43
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type RowAction } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
2
2
|
import { type ReactNode } from "react";
|
|
3
3
|
import type { RenderEditAction } from "../components/render-edit-types.ts";
|
|
4
4
|
import type { DetailHeaderModel } from "./projection-detail-header.tsx";
|