@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.
Files changed (167) hide show
  1. package/dist/app/action-form-body.d.ts +1 -4
  2. package/dist/app/action-form-body.js +9 -8
  3. package/dist/app/config-edit-body.js +71 -79
  4. package/dist/app/entity-list-screen.js +1 -1
  5. package/dist/app/header-actions-bar.d.ts +3 -1
  6. package/dist/app/header-actions-bar.js +12 -4
  7. package/dist/app/locked-screen-header.d.ts +2 -0
  8. package/dist/app/locked-screen-header.js +8 -1
  9. package/dist/app/projection-detail-body.js +24 -5
  10. package/dist/app/projection-detail-guidance.d.ts +1 -0
  11. package/dist/app/projection-detail-guidance.js +7 -4
  12. package/dist/app/projection-detail-header-model.js +4 -1
  13. package/dist/app/projection-detail-header-region.js +25 -9
  14. package/dist/app/projection-detail-header.d.ts +2 -0
  15. package/dist/app/projection-detail-header.js +30 -3
  16. package/dist/app/projection-list-shim.js +1 -0
  17. package/dist/app/row-actions.d.ts +4 -0
  18. package/dist/app/row-actions.js +19 -3
  19. package/dist/app/use-projection-detail-actions.d.ts +3 -1
  20. package/dist/app/use-projection-detail-actions.js +9 -1
  21. package/dist/app/use-projection-detail-data.js +17 -1
  22. package/dist/app/use-projection-list-data.js +1 -1
  23. package/dist/card-options.d.ts +2 -0
  24. package/dist/components/choice-chip-class.d.ts +1 -0
  25. package/dist/components/choice-chip-class.js +9 -0
  26. package/dist/components/edit-mounts.d.ts +1 -1
  27. package/dist/components/grid-cell-for-field.js +1 -1
  28. package/dist/components/multi-select-chips.js +2 -1
  29. package/dist/components/narrow-description.d.ts +3 -0
  30. package/dist/components/narrow-description.js +12 -0
  31. package/dist/components/related-list-section.d.ts +5 -3
  32. package/dist/components/related-list-section.js +9 -4
  33. package/dist/components/related-photo-grid.js +17 -3
  34. package/dist/components/render-edit-field-grid.d.ts +12 -3
  35. package/dist/components/render-edit-field-grid.js +60 -18
  36. package/dist/components/render-edit-fields-section.js +45 -11
  37. package/dist/components/render-edit-header-actions.js +1 -1
  38. package/dist/components/render-edit-layout.js +4 -2
  39. package/dist/components/render-edit-section-kinds.js +50 -12
  40. package/dist/components/render-edit-titles.js +1 -1
  41. package/dist/components/render-edit-types.d.ts +11 -0
  42. package/dist/components/render-field-ai-assist.js +3 -2
  43. package/dist/components/render-field-control.js +1 -1
  44. package/dist/components/render-field-value-chips.js +4 -2
  45. package/dist/components/render-list-hint-columns.d.ts +1 -0
  46. package/dist/components/render-list-hint-columns.js +30 -5
  47. package/dist/components/render-list-reference-columns.js +2 -4
  48. package/dist/components/render-list-row-tone.d.ts +2 -0
  49. package/dist/components/render-list-row-tone.js +6 -0
  50. package/dist/components/render-list-table-props.d.ts +13 -2
  51. package/dist/components/render-list-table-props.js +9 -3
  52. package/dist/components/render-list-types.d.ts +4 -0
  53. package/dist/components/render-list.js +12 -4
  54. package/dist/components/use-render-list-columns.js +3 -3
  55. package/dist/components/write-form-registry.d.ts +13 -0
  56. package/dist/components/write-form-registry.js +6 -0
  57. package/dist/components/write-form-section.d.ts +5 -1
  58. package/dist/components/write-form-section.js +55 -16
  59. package/dist/headless/form/form-controller.d.ts +1 -0
  60. package/dist/headless/form/form-controller.js +1 -1
  61. package/dist/headless/format/index.js +5 -4
  62. package/dist/headless/format/relative-time.d.ts +2 -0
  63. package/dist/headless/format/relative-time.js +4 -1
  64. package/dist/headless/view-model/edit.js +87 -37
  65. package/dist/headless/view-model/list.js +6 -0
  66. package/dist/headless/view-model/types.d.ts +49 -4
  67. package/dist/hooks/use-list-table.js +11 -6
  68. package/dist/i18n-defaults.js +7 -2
  69. package/dist/primitives-record-guidance.d.ts +4 -0
  70. package/dist/primitives-share-types.d.ts +82 -0
  71. package/dist/primitives-share-types.js +1 -0
  72. package/dist/primitives.d.ts +34 -83
  73. package/dist/web/app/bold-markup.d.ts +3 -0
  74. package/dist/web/app/bold-markup.js +14 -0
  75. package/dist/web/app/dashboard-body.js +5 -1
  76. package/dist/web/app/dashboard-list-panel.js +7 -4
  77. package/dist/web/app/dashboard-panels.js +31 -3
  78. package/dist/web/app/dashboard-shared.d.ts +3 -1
  79. package/dist/web/app/dashboard-shared.js +3 -3
  80. package/dist/web/app/dashboard-stat-group-panel.d.ts +1 -1
  81. package/dist/web/app/dashboard-stat-group-panel.js +16 -2
  82. package/dist/web/app/dashboard-text-panel.js +11 -6
  83. package/dist/web/app/relative-time.js +10 -1
  84. package/dist/web/components/config-cascade.d.ts +2 -1
  85. package/dist/web/components/config-cascade.js +16 -4
  86. package/dist/web/drawn-icons.js +2 -1
  87. package/dist/web/layout/header-action-pinned.d.ts +4 -2
  88. package/dist/web/layout/header-action-pinned.js +13 -4
  89. package/dist/web/layout/header-overflow-menu.d.ts +2 -0
  90. package/dist/web/layout/header-overflow-menu.js +2 -0
  91. package/dist/web/layout/notification-bell.js +12 -3
  92. package/dist/web/layout/page-header-slot.d.ts +2 -0
  93. package/dist/web/layout/page-header-slot.js +4 -0
  94. package/dist/web/layout/screen-focus.js +4 -1
  95. package/dist/web/layout/shell-header.js +13 -5
  96. package/dist/web/primitives/banner.js +14 -3
  97. package/dist/web/primitives/card.js +5 -3
  98. package/dist/web/primitives/combobox.js +2 -2
  99. package/dist/web/primitives/data-table/actions-column.js +1 -1
  100. package/dist/web/primitives/data-table/card-body.d.ts +1 -1
  101. package/dist/web/primitives/data-table/card-body.js +37 -14
  102. package/dist/web/primitives/data-table/card-frame.d.ts +2 -0
  103. package/dist/web/primitives/data-table/card-frame.js +3 -0
  104. package/dist/web/primitives/data-table/card-row.js +28 -9
  105. package/dist/web/primitives/data-table/card-sort-select.js +1 -1
  106. package/dist/web/primitives/data-table/card-view.js +1 -1
  107. package/dist/web/primitives/data-table/data-cell-props.d.ts +2 -1
  108. package/dist/web/primitives/data-table/data-cell-props.js +1 -0
  109. package/dist/web/primitives/data-table/density.d.ts +3 -1
  110. package/dist/web/primitives/data-table/density.js +11 -4
  111. package/dist/web/primitives/data-table/row-render-parts.d.ts +1 -1
  112. package/dist/web/primitives/data-table/row-render-parts.js +3 -5
  113. package/dist/web/primitives/data-table/sort-options-select.js +2 -2
  114. package/dist/web/primitives/data-table/sortable-header.js +4 -4
  115. package/dist/web/primitives/data-table/table-body.js +2 -1
  116. package/dist/web/primitives/data-table/table-chrome.js +1 -3
  117. package/dist/web/primitives/data-table/table-content.js +7 -11
  118. package/dist/web/primitives/data-table/table-data-cell.js +31 -17
  119. package/dist/web/primitives/data-table/table-header-row.js +1 -1
  120. package/dist/web/primitives/data-table/table-view.js +1 -1
  121. package/dist/web/primitives/data-table/toolbar.js +6 -7
  122. package/dist/web/primitives/data-table/use-data-table-state.d.ts +6 -1
  123. package/dist/web/primitives/data-table/use-data-table-state.js +12 -2
  124. package/dist/web/primitives/data-table-cell.d.ts +13 -2
  125. package/dist/web/primitives/data-table-cell.js +123 -43
  126. package/dist/web/primitives/data-table.js +1 -1
  127. package/dist/web/primitives/default-form.d.ts +1 -1
  128. package/dist/web/primitives/default-form.js +11 -10
  129. package/dist/web/primitives/drawer.js +2 -7
  130. package/dist/web/primitives/facet-filter.d.ts +1 -1
  131. package/dist/web/primitives/facet-filter.js +2 -5
  132. package/dist/web/primitives/facet-search-filter.js +1 -1
  133. package/dist/web/primitives/facet-trigger-label.d.ts +1 -4
  134. package/dist/web/primitives/facet-trigger-label.js +4 -7
  135. package/dist/web/primitives/field.js +15 -8
  136. package/dist/web/primitives/form-footer-parts.js +2 -2
  137. package/dist/web/primitives/inline-suffix.d.ts +2 -0
  138. package/dist/web/primitives/inline-suffix.js +5 -0
  139. package/dist/web/primitives/input-choice-kinds.js +12 -2
  140. package/dist/web/primitives/input-number-kinds.js +2 -2
  141. package/dist/web/primitives/input-text-kinds.js +1 -1
  142. package/dist/web/primitives/layout-elements.d.ts +4 -4
  143. package/dist/web/primitives/layout-elements.js +49 -12
  144. package/dist/web/primitives/layout.d.ts +1 -1
  145. package/dist/web/primitives/layout.js +1 -1
  146. package/dist/web/primitives/money-input.js +8 -7
  147. package/dist/web/primitives/number-input.d.ts +2 -1
  148. package/dist/web/primitives/number-input.js +9 -4
  149. package/dist/web/primitives/page-header.d.ts +1 -1
  150. package/dist/web/primitives/page-header.js +8 -1
  151. package/dist/web/primitives/pager.js +12 -21
  152. package/dist/web/primitives/photo-grid.js +2 -1
  153. package/dist/web/primitives/record-steps.d.ts +1 -1
  154. package/dist/web/primitives/record-steps.js +6 -15
  155. package/dist/web/primitives/row-actions.js +38 -24
  156. package/dist/web/primitives/use-container-narrow.d.ts +12 -0
  157. package/dist/web/primitives/use-container-narrow.js +42 -0
  158. package/dist/web/ui/input.js +1 -1
  159. package/dist/web/ui/textarea.js +1 -1
  160. package/dist/web/widgets/dashboard-list-cards.js +6 -3
  161. package/dist/web/widgets/dashboard-list.d.ts +4 -1
  162. package/dist/web/widgets/dashboard-list.js +10 -5
  163. package/dist/web/widgets/progress-list.js +1 -1
  164. package/dist/web/widgets/stat-box-cell.js +1 -1
  165. package/package.json +5 -5
  166. package/src/changes.json +51 -0
  167. package/src/web/styles.css +3 -2
@@ -1,5 +1,5 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Fragment } from "react";
2
+ import { Children, Fragment } from "react";
3
3
  import { isSelectOptionTone } from "../status-tone.js";
4
4
  import { ErrorReference } from "./error-reference.js";
5
5
  import { HeaderActionsBar } from "./header-actions-bar.js";
@@ -9,11 +9,14 @@ import { navigateTargetAllows } from "./screen-access.js";
9
9
  export function renderHeaderActionsContent(model, pageHeaderOptions) {
10
10
  const { screen, primitives, headerActionsList, setActionError } = model;
11
11
  const { Grid, Button, Dialog, ActionOverflowMenu } = primitives;
12
+ const menuActionIds = (screen.actions ?? [])
13
+ .filter((action) => action.placement === "menu")
14
+ .map((action) => action.id);
12
15
  return (_jsx(Grid, { columns: "auto", testId: "kumiko-screen-projection-detail-actions", children: _jsx(HeaderActionsBar, { actions: headerActionsList, Button: Button, Dialog: Dialog, ActionOverflowMenu: ActionOverflowMenu, onError: setActionError, ...(pageHeaderOptions !== undefined && {
13
16
  collapseAfterPrimary: true,
14
17
  compact: pageHeaderOptions.compact,
15
18
  PageHeader: pageHeaderOptions.PageHeader,
16
- }), ...(screen.primaryAction !== undefined && { preferredPrimaryId: screen.primaryAction }), ...(screen.inlineActions !== undefined && { inlineActionIds: screen.inlineActions }) }) }));
19
+ }), ...(screen.primaryAction !== undefined && { preferredPrimaryId: screen.primaryAction }), ...(screen.inlineActions !== undefined && { inlineActionIds: screen.inlineActions }), ...(menuActionIds.length > 0 && { menuActionIds }) }) }));
17
20
  }
18
21
  // Plain Text, not Heading — the Card title slot already renders as its own
19
22
  // heading element (h3); nesting another heading (h1) inside it is invalid HTML.
@@ -28,7 +31,9 @@ export function renderHeaderTitleSlot(model) {
28
31
  // beside it only where the shell bar does not carry it (phone); on desktop the bar shows it.
29
32
  export function renderRecordTitleBlock(model, titleText, statusBadge, subtitle, chipInBar) {
30
33
  const { Grid, Heading, FillContainer } = model.primitives;
31
- const block = (_jsxs(_Fragment, { children: [_jsxs(Grid, { columns: "auto", testId: "kumiko-screen-projection-detail-title-block", children: [_jsx(Heading, { variant: "page", testId: "kumiko-screen-projection-detail-title", children: titleText }), !chipInBar && statusBadge] }), subtitle] }));
34
+ // With a mobileSummary the phone shows only the H1 and that line: chip and subtitle give way.
35
+ const hiddenOnPhone = (node) => FillContainer !== undefined && mobileSummaryLineOf(model) !== undefined && node != null ? (_jsx(FillContainer, { className: "max-sm:hidden", children: node })) : (node);
36
+ const block = (_jsxs(_Fragment, { children: [_jsxs(Grid, { columns: "auto", testId: "kumiko-screen-projection-detail-title-block", children: [_jsx(Heading, { variant: "page", testId: "kumiko-screen-projection-detail-title", children: titleText }), !chipInBar && hiddenOnPhone(statusBadge)] }), hiddenOnPhone(subtitle)] }));
32
37
  return FillContainer !== undefined ? (_jsx(FillContainer, { className: "flex flex-col gap-1 px-6 pt-2 max-sm:px-4", children: block })) : (block);
33
38
  }
34
39
  function renderSubtitleParts(model, subtitleParts) {
@@ -129,6 +134,28 @@ export function buildMetricItems(model) {
129
134
  }
130
135
  // Metrics are a dl band when the primitive exists; the old Grid stays as the fallback.
131
136
  export function renderMetricsBlock(model, metricItems, subtitle, lead) {
137
+ const { FillContainer } = model.primitives;
138
+ if (mobileSummaryLineOf(model) === undefined || FillContainer === undefined) {
139
+ return renderPlainMetricsBlock(model, metricItems, subtitle, lead);
140
+ }
141
+ // Tiles give way to the summary line (rendered under the title) below sm; display:none keeps one copy for assistive tech.
142
+ const hiddenOnPhone = Children.map(metricItems, (item) => (_jsx(FillContainer, { className: "max-sm:hidden", children: item }))) ?? undefined;
143
+ const band = renderPlainMetricsBlock(model, hiddenOnPhone, subtitle, lead);
144
+ return subtitle === undefined && lead === undefined ? (_jsx(FillContainer, { className: "max-sm:hidden", children: band })) : (band);
145
+ }
146
+ function mobileSummaryLineOf(model) {
147
+ const raw = model.screen.mobileSummary === undefined ? undefined : model.record[model.screen.mobileSummary];
148
+ return typeof raw === "string" && raw !== "" ? raw : undefined;
149
+ }
150
+ /** The phone-only line right under the title; nothing when the screen has no `mobileSummary` or the field is empty. */
151
+ export function renderMobileSummary(model) {
152
+ const { FillContainer, Text } = model.primitives;
153
+ const line = mobileSummaryLineOf(model);
154
+ if (line === undefined || FillContainer === undefined)
155
+ return undefined;
156
+ return (_jsx(FillContainer, { className: "px-6 pt-1 text-left sm:hidden max-sm:px-4", children: _jsx(Text, { variant: "muted", testId: "kumiko-screen-projection-detail-mobile-summary", children: line }) }));
157
+ }
158
+ function renderPlainMetricsBlock(model, metricItems, subtitle, lead) {
132
159
  const { screen, primitives } = model;
133
160
  const { MetricBand, Grid } = primitives;
134
161
  return MetricBand !== undefined ? (_jsx(MetricBand, { testId: "kumiko-screen-projection-detail-metrics", subtitle: subtitle, ...(lead !== undefined && { lead }), ...(screen.metricsStyle === "tiles" && { tiles: true }), children: metricItems })) : (_jsx(Grid, { columns: screen.metrics?.length ?? 1, testId: "kumiko-screen-projection-detail-metrics", children: metricItems }));
@@ -50,6 +50,7 @@ export function synthesizeProjectionEntity(columns, sortable) {
50
50
  function rowPresentation(screen) {
51
51
  return {
52
52
  ...(screen.rowToneField !== undefined && { rowToneField: screen.rowToneField }),
53
+ ...(screen.mutedRowField !== undefined && { mutedRowField: screen.mutedRowField }),
53
54
  ...(screen.rowRenderer !== undefined && { rowRenderer: screen.rowRenderer }),
54
55
  };
55
56
  }
@@ -1,6 +1,7 @@
1
1
  import type { EntityEditScreenDefinition, FeatureSchema, RelatedListToolbarAction, RowAction, RowActionClientAction, RowActionDrawer, RowActionNavigate, RowActionWriteHandler, RowFieldExtractor, ToolbarAction } from "@cosmicdrift/kumiko-framework/ui-types";
2
2
  import type { RenderEditAction } from "../components/render-edit-types.ts";
3
3
  import type { ToolbarActionButton } from "../components/render-list.tsx";
4
+ import type { WriteFormRegistry } from "../components/write-form-registry.ts";
4
5
  import type { Dispatcher, ListRowViewModel, Translate } from "../headless/index.ts";
5
6
  import type { DataTableRowAction } from "../primitives.tsx";
6
7
  import { type ClientActionRuntime } from "./client-actions.tsx";
@@ -110,5 +111,8 @@ export declare function buildRecordActions(options: {
110
111
  * form holds unsaved input so it is not lost silently. */
111
112
  readonly discardChanges?: DiscardChanges;
112
113
  readonly clientActions?: ClientActionRuntime;
114
+ readonly writeForms?: WriteFormRegistry;
115
+ /** Ids of the actions that a writeForm section submits (`submitWith`). */
116
+ readonly submitWithIds?: ReadonlySet<string>;
113
117
  }): readonly RenderEditAction[] | undefined;
114
118
  export {};
@@ -465,7 +465,7 @@ export function deletesShownRecord(action, payload, shownRecordId) {
465
465
  payload["id"] === shownRecordId);
466
466
  }
467
467
  function buildWriteHandlerRecordAction(action, options) {
468
- const { record, translate, actionIcon, dispatcher, onWriteSuccess, defaultWritePayloadId, onRecordLeft, discardChanges, } = options;
468
+ const { record, translate, actionIcon, dispatcher, onWriteSuccess, defaultWritePayloadId, onRecordLeft, discardChanges, writeForms, submitWithIds, } = options;
469
469
  const shownRecordId = defaultWritePayloadId ?? record["id"];
470
470
  const confirm = withDiscardHint(action.confirm !== undefined ? translate(action.confirm) : undefined, discardChanges);
471
471
  // The discard label wins: the action then also throws away the unsaved input.
@@ -480,13 +480,27 @@ function buildWriteHandlerRecordAction(action, options) {
480
480
  ...(confirm !== undefined && { confirm }),
481
481
  ...(confirmLabel !== undefined && { confirmLabel }),
482
482
  onPress: async () => {
483
- const payload = action.payload !== undefined
483
+ const ownPayload = action.payload !== undefined
484
484
  ? evalRowExtractor(action.payload, record)
485
485
  : { id: shownRecordId };
486
+ // A form submitted by this action (writeForm `submitWith`) validates first; no write on error.
487
+ const form = writeForms?.get(action.id);
488
+ // A form is not mounted (other tab, hidden by visibleWhen): writing only the own payload would
489
+ // silently skip its fields.
490
+ if (form === undefined && submitWithIds?.has(action.id) === true) {
491
+ rendererError(`kumiko-screen: action "${action.id}" submits a writeForm that is not mounted`);
492
+ throw new Error(translate("kumiko.writeForm.unavailable"));
493
+ }
494
+ // A form hidden by CSS (phone/desktop only) shows no inline errors, so the failure is named here.
495
+ if (form !== undefined && !form.validate()) {
496
+ throw new Error(translate("kumiko.writeForm.invalid", { fields: form.invalidFieldLabels().join(", ") }));
497
+ }
498
+ const payload = form === undefined ? ownPayload : { ...ownPayload, ...form.getValues() };
486
499
  const result = await dispatcher.write(action.handler, payload);
487
500
  if (!result.isSuccess) {
488
501
  throw new WriteFailedError(result.error, dispatcherErrorText(result.error, translate));
489
502
  }
503
+ form?.rebase();
490
504
  const deletedShownRecord = deletesShownRecord(action, payload, shownRecordId);
491
505
  if (onRecordLeft !== undefined && (action.redirect !== undefined || deletedShownRecord)) {
492
506
  onRecordLeft(action, result.data, deletedShownRecord);
@@ -504,7 +518,7 @@ function buildWriteHandlerRecordAction(action, options) {
504
518
  // resolved against the record currently being viewed/edited, independent of
505
519
  // any table row.
506
520
  export function buildRecordActions(options) {
507
- const { actions, record, translate, nav, host, dispatcher, openDrawer, onWriteSuccess, onRecordLeft, defaultScreenTargetEntityId, sameEntityScreenId, defaultWritePayloadId, discardChanges, clientActions, } = options;
521
+ const { actions, record, translate, nav, host, dispatcher, openDrawer, onWriteSuccess, onRecordLeft, defaultScreenTargetEntityId, sameEntityScreenId, defaultWritePayloadId, discardChanges, clientActions, writeForms, submitWithIds, } = options;
508
522
  const out = [];
509
523
  for (const action of actions) {
510
524
  if (action.visible !== undefined && !evalFieldCondition(action.visible, record))
@@ -558,6 +572,8 @@ export function buildRecordActions(options) {
558
572
  defaultWritePayloadId,
559
573
  onRecordLeft,
560
574
  discardChanges,
575
+ writeForms,
576
+ submitWithIds,
561
577
  }));
562
578
  }
563
579
  return out.length > 0 ? out : undefined;
@@ -1,5 +1,6 @@
1
- import type { RowAction } from "@cosmicdrift/kumiko-framework/ui-types";
1
+ import { type RowAction } from "@cosmicdrift/kumiko-framework/ui-types";
2
2
  import type { RenderEditAction } from "../components/render-edit.tsx";
3
+ import type { WriteFormRegistry } from "../components/write-form-registry.ts";
3
4
  import type { useOptionalDispatcher } from "../context/dispatcher-context.tsx";
4
5
  import type { useUserRoles } from "../context/user-roles-context.tsx";
5
6
  import type { Translate } from "../headless/index.ts";
@@ -27,6 +28,7 @@ type DetailActionsInput = {
27
28
  readonly detailQuery: ReturnType<typeof useProjectionDetailData>["detailQuery"];
28
29
  readonly reloadDetail: ReturnType<typeof useProjectionDetailData>["reloadDetail"];
29
30
  readonly activeTabId: string | undefined;
31
+ readonly writeForms: WriteFormRegistry;
30
32
  };
31
33
  export declare function useProjectionDetailActions(input: DetailActionsInput): {
32
34
  buildSectionActions: (actions: readonly RowAction[]) => readonly RenderEditAction[] | undefined;
@@ -1,3 +1,4 @@
1
+ import { isWriteFormEditSection, } from "@cosmicdrift/kumiko-framework/ui-types";
1
2
  import { resolveActionIcon } from "@cosmicdrift/kumiko-types/action-icon";
2
3
  import { useCallback, useMemo } from "react";
3
4
  import { lastSegment } from "./qn.js";
@@ -10,7 +11,7 @@ function isShownOnTab(action, activeTabId) {
10
11
  (activeTabId !== undefined && action.showOnTabs.includes(activeTabId)));
11
12
  }
12
13
  export function useProjectionDetailActions(input) {
13
- const { schema, screen, effectiveTranslate, effectiveEntityId, nav, host, dispatcher, clientActions, appFeatures, userRoles, returnTarget, openDrawer, detailQuery, reloadDetail, activeTabId, } = input;
14
+ const { schema, screen, effectiveTranslate, effectiveEntityId, nav, host, dispatcher, clientActions, appFeatures, userRoles, returnTarget, openDrawer, detailQuery, reloadDetail, activeTabId, writeForms, } = input;
14
15
  const handleRecordLeft = useCallback((action, resultData, deletedShownRecord) => {
15
16
  const record = detailQuery.data ?? {};
16
17
  // Never return onto the just-deleted record.
@@ -153,6 +154,9 @@ export function useProjectionDetailActions(input) {
153
154
  sameEntityScreenId,
154
155
  ]);
155
156
  const footerIds = screen.footerActions;
157
+ const submitWithIds = useMemo(() => new Set(screen.layout.sections.flatMap((section) => isWriteFormEditSection(section) && section.submitWith !== undefined
158
+ ? [section.submitWith]
159
+ : [])), [screen.layout.sections]);
156
160
  const recordActions = useMemo(() => {
157
161
  const declaredHasEdit = screen.actions?.some((a) => a.id === "edit") === true;
158
162
  const resolved = buildRecordActions({
@@ -167,6 +171,8 @@ export function useProjectionDetailActions(input) {
167
171
  onRecordLeft: handleRecordLeft,
168
172
  sameEntityScreenId,
169
173
  clientActions,
174
+ writeForms,
175
+ submitWithIds,
170
176
  });
171
177
  // skip: a declared or unavailable edit action leaves the resolved list untouched
172
178
  if (defaultEditAction === undefined || declaredHasEdit)
@@ -186,6 +192,8 @@ export function useProjectionDetailActions(input) {
186
192
  openDrawer,
187
193
  handleRecordLeft,
188
194
  sameEntityScreenId,
195
+ writeForms,
196
+ submitWithIds,
189
197
  ]);
190
198
  // footerActions render in RenderEdit's pinned footer, so the header bar must not repeat them.
191
199
  const headerActions = useMemo(() => footerIds === undefined
@@ -37,11 +37,27 @@ export function useProjectionDetailData(input) {
37
37
  }, [isTabsMode, Tabs, screen.id]);
38
38
  const entity = useMemo(() => synthesizeProjectionDetailEntity(screen.layout), [screen.layout]);
39
39
  const detailScreen = useMemo(() => {
40
+ if (activeSections.length > 0 && screen.layout.narrowTabs === false) {
41
+ // Below `sm` there is no tab strip: every visible section renders, the ones of the
42
+ // other tabs only on the phone. A `hideOnNarrow` section of another tab has no place at
43
+ // all (hideOnNarrow would win over showOnNarrowOnly and show it on desktop).
44
+ const sections = visibleSections.flatMap((section) => {
45
+ if (activeSections.includes(section))
46
+ return [section];
47
+ if ("hideOnNarrow" in section && section.hideOnNarrow === true)
48
+ return [];
49
+ return [{ ...section, showOnNarrowOnly: true }];
50
+ });
51
+ return synthesizeProjectionDetailScreen({
52
+ ...screen,
53
+ layout: { ...screen.layout, sections },
54
+ });
55
+ }
40
56
  const source = activeSections.length > 0
41
57
  ? { ...screen, layout: { ...screen.layout, sections: activeSections } }
42
58
  : screen;
43
59
  return synthesizeProjectionDetailScreen(source);
44
- }, [screen, activeSections]);
60
+ }, [screen, activeSections, visibleSections]);
45
61
  // A writeForm section's handler creates a new record (see EditWriteFormSection's
46
62
  // doc) — both the outer record (header/metrics/other sections) and a sibling
47
63
  // relatedList section's own independently-fetched rows must reflect it. A
@@ -39,8 +39,8 @@ export function useProjectionListData(input) {
39
39
  const filterFacets = useMemo(() => {
40
40
  const namedFacet = buildNamedFilterFacet(screen.namedFilters, effectiveTranslate, userRoles, screen.namedFilterFacet, facetCounts);
41
41
  return [
42
- ...(namedFacet !== undefined ? [namedFacet] : []),
43
42
  ...buildFilterFacets(resolvedFacetSpecs),
43
+ ...(namedFacet !== undefined ? [namedFacet] : []),
44
44
  ];
45
45
  }, [
46
46
  resolvedFacetSpecs,
@@ -22,4 +22,6 @@ export type CardOptions = {
22
22
  readonly screenBody?: boolean;
23
23
  /** "inline": title and subtitle on one baseline row at 16px inset, compact padding (the board's side panel). Default "stacked". */
24
24
  readonly headerLayout?: "stacked" | "inline";
25
+ /** "label": the title is a small uppercase muted label. Default "heading". */
26
+ readonly titleStyle?: "heading" | "label";
25
27
  };
@@ -0,0 +1 @@
1
+ export declare function choiceChipClass(selected: boolean): string;
@@ -0,0 +1,9 @@
1
+ // Shared look of toggle chips in forms (multiSelect chips, value chips, AI-assist chips): 26px
2
+ // pill with a 1px border; a chosen chip gets a primary border and a light primary fill. Passed as
3
+ // Button `className`; the phone keeps the same height instead of the 44px touch minimum.
4
+ const CHOICE_CHIP_BASE = "h-[26px] rounded-full border px-3 text-[13px] font-medium max-md:min-h-[26px]";
5
+ export function choiceChipClass(selected) {
6
+ return selected
7
+ ? `${CHOICE_CHIP_BASE} border-primary bg-primary/10 text-primary ring-0`
8
+ : `${CHOICE_CHIP_BASE} border-border bg-background text-foreground`;
9
+ }
@@ -21,7 +21,7 @@ export declare function ExtensionSectionMount({ section, entityName: hostEntityN
21
21
  }): ReactNode;
22
22
  export declare function EditSlotMount({ slot, slotName, screenId, entityName, entityId, values, markSaved, hasUnsavedChanges, wizardStep, activeTabId, }: {
23
23
  readonly slot: PlatformComponent;
24
- readonly slotName: "header" | "titleAction" | "afterForm" | "footer";
24
+ readonly slotName: "header" | "titleAction" | "afterForm" | "afterSection" | "footer";
25
25
  readonly screenId: string;
26
26
  readonly entityName: string;
27
27
  readonly entityId: string | null;
@@ -38,5 +38,5 @@ export function GridCellForField({ field, columns, issues, onChange, onSuggest,
38
38
  field.embeddedListCells !== undefined &&
39
39
  field.label === sectionTitle;
40
40
  const effectiveSpan = field.span !== undefined ? Math.min(field.span, columns) : 1;
41
- return (_jsx(GridCell, { span: effectiveSpan, ...(flow === true && { width: fieldCellWidth(field) }), children: _jsx(RenderField, { field: field, ...(issues !== undefined && { issues }), onChange: onChange, ...(onSuggest !== undefined && { onSuggest }), featureName: featureName, ...(labelAppendix !== undefined && { labelAppendix }), ...(fieldAppendix !== undefined && { fieldAppendix }), ...(appendixPlacement !== undefined && { appendixPlacement }), ...(description !== undefined && { description }), ...(status !== undefined && { status }), allIssues: allIssues, valueDisplay: valueDisplay, row: row, ...(changed === true && { changed }), ...(layout !== undefined && { layout }), ...(accent === true && { accent }), ...(fillDisabled === true && { fillDisabled }), ...(hideLabel && { hideLabel }) }) }));
41
+ return (_jsx(GridCell, { span: effectiveSpan, ...(flow === true && { width: fieldCellWidth(field) }), ...(field.hideOnNarrow === true && { hideOnNarrow: true }), children: _jsx(RenderField, { field: field, ...(issues !== undefined && { issues }), onChange: onChange, ...(onSuggest !== undefined && { onSuggest }), featureName: featureName, ...(labelAppendix !== undefined && { labelAppendix }), ...(fieldAppendix !== undefined && { fieldAppendix }), ...(appendixPlacement !== undefined && { appendixPlacement }), ...(description !== undefined && { description }), ...(status !== undefined && { status }), allIssues: allIssues, valueDisplay: valueDisplay, row: row, ...(changed === true && { changed }), ...(layout !== undefined && { layout }), ...(accent === true && { accent }), ...(fillDisabled === true && { fillDisabled }), ...(hideLabel && { hideLabel }) }) }));
42
42
  }
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { usePrimitives } from "../primitives.js";
3
+ import { choiceChipClass } from "./choice-chip-class.js";
3
4
  // MultiSelectFieldDef's `display: "chips"`: every option is a toggle chip, ticked once chosen.
4
5
  export function MultiSelectChips({ field, id, options, value, onChange, }) {
5
6
  const { Button, Grid } = usePrimitives();
@@ -13,6 +14,6 @@ export function MultiSelectChips({ field, id, options, value, onChange, }) {
13
14
  };
14
15
  return (_jsx(Grid, { columns: "auto", tight: true, ariaLabelledBy: `${id}-label`, children: options.map((opt) => {
15
16
  const isSelected = selected.has(opt.value);
16
- return (_jsx(Button, { variant: isSelected ? "primary" : "secondary", size: "sm", pressed: isSelected, disabled: field.readOnly === true || opt.disabled === true, testId: `${id}-chip-${opt.value}`, onClick: () => toggle(opt.value), children: isSelected ? `✓ ${opt.label}` : opt.label }, opt.value));
17
+ return (_jsx(Button, { variant: "secondary", size: "sm", className: choiceChipClass(isSelected), pressed: isSelected, disabled: field.readOnly === true || opt.disabled === true, testId: `${id}-chip-${opt.value}`, onClick: () => toggle(opt.value), children: isSelected ? `✓ ${opt.label}` : opt.label }, opt.value));
17
18
  }) }));
18
19
  }
@@ -0,0 +1,3 @@
1
+ import type { ReactNode } from "react";
2
+ /** The full description from `sm` up, the short one on the phone. */
3
+ export declare function narrowAwareDescription(description: string | undefined, descriptionNarrow: string | undefined): ReactNode;
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { usePrimitives } from "../primitives.js";
3
+ function NarrowDescription({ description, descriptionNarrow, }) {
4
+ const { Text } = usePrimitives();
5
+ return _jsx(Text, { narrow: descriptionNarrow, children: description });
6
+ }
7
+ /** The full description from `sm` up, the short one on the phone. */
8
+ export function narrowAwareDescription(description, descriptionNarrow) {
9
+ if (description === undefined || descriptionNarrow === undefined)
10
+ return description;
11
+ return _jsx(NarrowDescription, { description: description, descriptionNarrow: descriptionNarrow });
12
+ }
@@ -1,7 +1,7 @@
1
1
  import type { RowActionDrawer } from "@cosmicdrift/kumiko-framework/ui-types";
2
2
  import { type ReactNode } from "react";
3
3
  import type { EditRelatedListSectionViewModel, Translate } from "../headless/index.ts";
4
- export declare function RelatedListSection({ section, parentId, record, featureName, translate, hideTitle, grow, onOpenDrawer, actions, anchorId, embedded, onAfterWrite, refreshToken, }: {
4
+ export declare function RelatedListSection({ section, parentId, record, featureName, translate, hideTitle, labelTitle, omitTitle, onOpenDrawer, actions, anchorId, embedded, onAfterWrite, refreshToken, }: {
5
5
  readonly section: EditRelatedListSectionViewModel;
6
6
  readonly parentId: string;
7
7
  /** The enclosing projectionDetail's own record (the "Akte") — evaluates
@@ -11,8 +11,10 @@ export declare function RelatedListSection({ section, parentId, record, featureN
11
11
  readonly featureName: string;
12
12
  readonly translate?: Translate;
13
13
  readonly hideTitle?: boolean;
14
- /** Under a fixed-height screen the tab panel chain stretches so the count footer sits at the bottom. */
15
- readonly grow?: boolean;
14
+ /** The stacked section title is a small uppercase label. */
15
+ readonly labelTitle?: boolean;
16
+ /** The stacked section has no title (the tab label above it says the same). */
17
+ readonly omitTitle?: boolean;
16
18
  /** Opens a drawer-kind rowAction. Supplied by the parent
17
19
  * (ProjectionDetailBody), which owns schema + the actual Drawer render —
18
20
  * this component only ever invokes the callback. */
@@ -115,7 +115,7 @@ function buildRelatedListRowClick(section, nav, host, onOpenDrawer) {
115
115
  }
116
116
  };
117
117
  }
118
- export function RelatedListSection({ section, parentId, record, featureName, translate, hideTitle, grow, onOpenDrawer, actions, anchorId, embedded, onAfterWrite, refreshToken, }) {
118
+ export function RelatedListSection({ section, parentId, record, featureName, translate, hideTitle, labelTitle, omitTitle, onOpenDrawer, actions, anchorId, embedded, onAfterWrite, refreshToken, }) {
119
119
  const { Banner, Section, FillContainer, PhotoGrid } = usePrimitives();
120
120
  const [emptyStateActionError, setEmptyStateActionError] = useState(null);
121
121
  const t = useTranslation();
@@ -317,7 +317,12 @@ export function RelatedListSection({ section, parentId, record, featureName, tra
317
317
  onFilterReset,
318
318
  }), ...(onRowClick !== undefined && { onRowClick }), ...(rowActions !== undefined && { rowActions }), ...(section.rowActionMode !== undefined && { rowActionMode: section.rowActionMode }), ...(bulk !== undefined && { bulk }), ...(rowTone !== undefined && { rowTone }), ...(toolbarActionButtons !== undefined && { toolbarActions: toolbarActionButtons }), ...(emptyStateContent !== undefined && { emptyState: emptyStateContent }), ...listTable, ...(aggregates.serverGroups !== undefined && {
319
319
  serverGroups: aggregates.serverGroups,
320
- }), ...(aggregates.totals !== undefined && { totals: aggregates.totals }), ...(aggregates.notice !== undefined && { notice: aggregates.notice }), screenPadding: false, ...(hideTitle === true && { scrollBody: true, chromeless: true }), ...(embedded === true && { chromeless: true }) }) }))] }));
320
+ }), ...(aggregates.totals !== undefined && { totals: aggregates.totals }), ...(aggregates.notice !== undefined && { notice: aggregates.notice }), screenPadding: false, ...(hideTitle === true && {
321
+ scrollBody: true,
322
+ chromeless: true,
323
+ hideCountFooter: true,
324
+ plainPhoneCards: true,
325
+ }), ...(embedded === true && { chromeless: true }) }) }))] }));
321
326
  // hideTitle (tabs mode) → the caller (render-edit.tsx) already wraps this
322
327
  // component's own return value in the same Card frame every other tab
323
328
  // kind gets — no card here, or the two would nest. `scrollBody` caps the
@@ -335,7 +340,7 @@ export function RelatedListSection({ section, parentId, record, featureName, tra
335
340
  return (_jsxs(_Fragment, { children: [bridges, _jsx(EmbeddedRelatedListCard, { title: `${section.title}${countSuffix}`, actions: actions, testId: `related-list-${section.title}-${parentId}`, children: content })] }));
336
341
  }
337
342
  if (hideTitle) {
338
- return (_jsxs(_Fragment, { children: [bridges, FillContainer !== undefined ? (_jsx(FillContainer, { ...(grow === true && { grow: true }), children: content })) : (content)] }));
343
+ return (_jsxs(_Fragment, { children: [bridges, FillContainer !== undefined ? (_jsx(FillContainer, { testId: "related-list-card", className: "mx-6 my-3 overflow-hidden rounded-[9px] border border-border bg-card max-sm:mx-4 max-sm:rounded-none max-sm:border-0 max-sm:bg-transparent [&_thead_th]:bg-muted", children: content })) : (content)] }));
339
344
  }
340
- return (_jsxs(_Fragment, { children: [bridges, _jsx(Section, { title: section.title, ...(anchorId !== undefined && { id: anchorId }), ...(actions !== undefined && { actions }), testId: `related-list-${section.title}`, children: content })] }));
345
+ return (_jsxs(_Fragment, { children: [bridges, _jsx(Section, { ...(omitTitle !== true && { title: section.title }), ...(labelTitle === true && { titleStyle: "label" }), ...(anchorId !== undefined && { id: anchorId }), ...(actions !== undefined && { actions }), testId: `related-list-${section.title}`, children: content })] }));
341
346
  }
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { fileIdsOf } from "../file-ids-of.js";
3
+ import { useTranslation } from "../i18n.js";
3
4
  import { usePrimitives } from "../primitives.js";
4
5
  import { RenderEditActionButton } from "./render-edit-action-button.js";
5
6
  function viewModelOf(row) {
@@ -8,18 +9,31 @@ function viewModelOf(row) {
8
9
  // One tile per row: the row's image and its row actions as buttons. The same
9
10
  // DataTableRowAction list the table would get, so confirm and visibility behave alike.
10
11
  export function RelatedPhotoGrid({ rows, photoGrid, rowActions, onActionError, testId, }) {
12
+ const t = useTranslation();
11
13
  const { PhotoGrid, Button, Dialog } = usePrimitives();
12
14
  if (PhotoGrid === undefined)
13
15
  return null;
14
- const { imageField, captionField } = photoGrid;
16
+ const { imageField, captionField, badgeField } = photoGrid;
17
+ const leadsOnNarrow = (row) => {
18
+ if (photoGrid.badgeFirst !== true || badgeField === undefined)
19
+ return false;
20
+ const value = row[badgeField];
21
+ return typeof value === "string" && value !== "";
22
+ };
15
23
  return (_jsx(PhotoGrid, { ...(testId !== undefined && { testId }), tiles: rows.map((row, index) => {
16
24
  const vm = viewModelOf(row);
17
- const caption = captionField === undefined ? undefined : row[captionField];
25
+ const captionValue = captionField === undefined ? undefined : row[captionField];
26
+ const caption = typeof captionValue === "string" && captionValue !== ""
27
+ ? captionValue
28
+ : t("kumiko.photo-grid.fallback-caption", { n: index + 1 });
29
+ const badge = badgeField === undefined ? undefined : row[badgeField];
18
30
  const imageId = fileIdsOf(row[imageField])[0];
19
31
  return {
20
32
  id: vm.id === "" ? String(index) : vm.id,
21
33
  ...(imageId !== undefined && { imageId }),
22
- ...(typeof caption === "string" && caption !== "" && { caption }),
34
+ caption,
35
+ ...(typeof badge === "string" && badge !== "" && { badge }),
36
+ ...(leadsOnNarrow(row) && { leadsOnNarrow: true }),
23
37
  actions: (rowActions ?? [])
24
38
  .filter((action) => action.isVisible?.(vm) !== false)
25
39
  .map((action) => (_jsx(RenderEditActionButton, { action: {
@@ -1,4 +1,13 @@
1
- import { type ReactNode } from "react";
1
+ import { type ComponentType, type ReactNode } from "react";
2
2
  import type { EditFieldViewModel, FormValues } from "../headless/index.ts";
3
- import type { FieldsSection, RenderEditModel } from "./render-edit-render-model.ts";
4
- export declare function renderFieldGrid<TValues extends FormValues, TCtx>(model: RenderEditModel<TValues, TCtx>, section: FieldsSection, fields: readonly EditFieldViewModel[], columns: number, gridKey: string): ReactNode;
3
+ import type { StatusBadgeProps } from "../primitives.tsx";
4
+ import type { FieldsSection, RenderEditModel, ResolvedRenderEditProps } from "./render-edit-render-model.ts";
5
+ type AppendixProps = Pick<ResolvedRenderEditProps<FormValues>, "labelAppendix" | "fieldAppendix" | "fieldAppendixPlacement" | "fieldDescription">;
6
+ export declare function appendixCellProps(props: AppendixProps, field: EditFieldViewModel, values: Readonly<Record<string, unknown>>, StatusBadge: ComponentType<StatusBadgeProps> | undefined): {
7
+ labelAppendix?: ReactNode;
8
+ fieldAppendix?: ReactNode;
9
+ appendixPlacement?: "above-control" | "below-control" | undefined;
10
+ description?: string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | undefined;
11
+ };
12
+ export declare function renderFieldGrid<TValues extends FormValues, TCtx>(model: RenderEditModel<TValues, TCtx>, section: FieldsSection, fields: readonly EditFieldViewModel[], columns: number, gridKey: string, columnsDeclared?: boolean): ReactNode;
13
+ export {};
@@ -1,21 +1,48 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Fragment } from "react";
3
- import { GridCellForField } from "./grid-cell-for-field.js";
4
- function appendixCellProps(props, fieldName, values) {
3
+ import { statusToneForOptionTone } from "../status-tone.js";
4
+ import { fieldCellWidth, GridCellForField } from "./grid-cell-for-field.js";
5
+ function nonEmptyText(value) {
6
+ return typeof value === "string" && value.trim() !== "" ? value : undefined;
7
+ }
8
+ function declaredBadge(field, values, StatusBadge) {
9
+ if (field.badge === undefined || StatusBadge === undefined)
10
+ return undefined;
11
+ const text = "label" in field.badge ? field.badge.label : nonEmptyText(values[field.badge.field]);
12
+ if (text === undefined)
13
+ return undefined;
14
+ return (_jsx(StatusBadge, { value: text, tone: statusToneForOptionTone(field.badge.tone) ?? "muted", testId: `field-badge-${field.field}` }));
15
+ }
16
+ export function appendixCellProps(props, field, values, StatusBadge) {
5
17
  const { labelAppendix, fieldAppendix, fieldAppendixPlacement, fieldDescription } = props;
18
+ const fieldName = field.field;
19
+ const badge = declaredBadge(field, values, StatusBadge);
20
+ const hint = field.hintField !== undefined ? nonEmptyText(values[field.hintField]) : undefined;
21
+ const declaredDescription = fieldDescription?.(fieldName, values);
6
22
  return {
7
23
  ...(labelAppendix !== undefined && { labelAppendix: labelAppendix(fieldName) }),
24
+ ...(labelAppendix === undefined && badge !== undefined && { labelAppendix: badge }),
8
25
  ...(fieldAppendix !== undefined && { fieldAppendix: fieldAppendix(fieldName) }),
9
26
  ...(fieldAppendixPlacement !== undefined && { appendixPlacement: fieldAppendixPlacement }),
10
- ...(fieldDescription !== undefined && { description: fieldDescription(fieldName, values) }),
27
+ ...((declaredDescription ?? hint) !== undefined && {
28
+ description: declaredDescription ?? hint,
29
+ }),
11
30
  };
12
31
  }
13
- function createFieldCellRenderer(model, section, columns) {
32
+ // Multi-line and wide kinds (textarea, lists, files) take the whole row of a facts grid; a plain
33
+ // read-only text would also count as full width, so the width is asked as if the field were editable.
34
+ function spanLongValue(field, columns) {
35
+ if (field.span !== undefined || fieldCellWidth({ ...field, readOnly: false }) !== "full") {
36
+ return field;
37
+ }
38
+ return { ...field, span: columns };
39
+ }
40
+ function createFieldCellRenderer(model, section, columns, facts) {
14
41
  const { props, state, form } = model.engine;
15
42
  const { snapshot } = form;
16
43
  const { GridCell } = state.primitives;
17
44
  const { isSettingsList, isCreate } = model.footer;
18
- const { usesFieldFlow } = model.titles;
45
+ const usesFieldFlow = model.titles.usesFieldFlow && !facts;
19
46
  const { disabled, fieldAccent } = props;
20
47
  const showsChangedMarker = !isCreate || props.markChangedFields;
21
48
  const clearErrorsAndValidate = (fieldName) => {
@@ -23,25 +50,40 @@ function createFieldCellRenderer(model, section, columns) {
23
50
  if (props.validateOnChange === true)
24
51
  form.controller.validate([fieldName]);
25
52
  };
26
- return (field) => (_jsx(GridCellForField, { field: disabled ? { ...field, readOnly: true } : field, columns: columns, ...(!isSettingsList && usesFieldFlow && { flow: true }), ...(isSettingsList && {
27
- layout: "row",
28
- accent: fieldAccent?.(field.field) === true,
29
- }), issues: snapshot.errors[field.field], onChange: (v) => {
30
- model.setFieldUntyped(field.field, v);
31
- clearErrorsAndValidate(field.field);
32
- }, ...(props.actionFormScreenQn !== undefined && {
33
- onSuggest: (value) => form.controller.seedField(field.field, value),
34
- }), GridCell: GridCell, featureName: props.featureName, ...appendixCellProps(props, field.field, snapshot.values), allIssues: snapshot.errors, valueDisplay: props.valueDisplay, row: snapshot.values, ...(disabled && { fillDisabled: true }), ...(props.hideSectionTitles !== true &&
35
- section.title !== undefined && { sectionTitle: section.title }), ...(showsChangedMarker && field.field in snapshot.changes && { changed: true }) }, field.field));
53
+ return (rawField) => {
54
+ const field = facts ? spanLongValue(rawField, columns) : rawField;
55
+ return (_jsx(GridCellForField, { field: disabled ? { ...field, readOnly: true } : field, columns: columns, ...(!isSettingsList && usesFieldFlow && { flow: true }), ...(isSettingsList && {
56
+ layout: "row",
57
+ accent: fieldAccent?.(field.field) === true,
58
+ }), issues: snapshot.errors[field.field], onChange: (v) => {
59
+ model.setFieldUntyped(field.field, v);
60
+ clearErrorsAndValidate(field.field);
61
+ }, ...(props.actionFormScreenQn !== undefined && {
62
+ onSuggest: (value) => form.controller.seedField(field.field, value),
63
+ }), GridCell: GridCell, featureName: props.featureName, ...appendixCellProps(props, field, snapshot.values, state.primitives.StatusBadge), allIssues: snapshot.errors, valueDisplay: props.valueDisplay, row: snapshot.values, ...(disabled && { fillDisabled: true }), ...(props.hideSectionTitles !== true &&
64
+ section.title !== undefined && { sectionTitle: section.title }), ...(showsChangedMarker && field.field in snapshot.changes && { changed: true }) }, field.field));
65
+ };
66
+ }
67
+ // Read-only text values with a declared column count form a label/value grid; the flow layout
68
+ // would ignore `columns` and give every value the full width. Without a declared count the
69
+ // stacked layout stays, so existing records do not reflow.
70
+ function isReadOnlyFactsGrid(model, fields, columns, columnsDeclared) {
71
+ return (columnsDeclared &&
72
+ columns > 1 &&
73
+ !model.footer.isSettingsList &&
74
+ model.engine.props.valueDisplay === "text" &&
75
+ fields.length > 0 &&
76
+ fields.every((field) => field.readOnly));
36
77
  }
37
- export function renderFieldGrid(model, section, fields, columns, gridKey) {
78
+ export function renderFieldGrid(model, section, fields, columns, gridKey, columnsDeclared = false) {
38
79
  const { Grid, GridCell } = model.engine.state.primitives;
39
80
  const { rowAfterField } = model.engine.props;
40
81
  const dirty = Object.keys(model.engine.form.snapshot.changes).length > 0;
41
82
  const { isSettingsList } = model.footer;
42
83
  const { usesFieldFlow } = model.titles;
43
- const renderCell = createFieldCellRenderer(model, section, columns);
44
- return (_jsx(Grid, { columns: columns, ...(isSettingsList ? { list: true } : usesFieldFlow && { flow: true }), children: fields.map((field) => {
84
+ const facts = isReadOnlyFactsGrid(model, fields, columns, columnsDeclared);
85
+ const renderCell = createFieldCellRenderer(model, section, columns, facts);
86
+ return (_jsx(Grid, { columns: columns, ...(facts && { facts: true }), ...(isSettingsList ? { list: true } : usesFieldFlow && !facts && { flow: true }), children: fields.map((field) => {
45
87
  const extraRow = rowAfterField?.(field.field, { dirty });
46
88
  if (extraRow === undefined)
47
89
  return renderCell(field);