@cosmicdrift/kumiko-renderer 0.413.1 → 0.414.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 (334) hide show
  1. package/dist/app/action-form-support.js +4 -0
  2. package/dist/app/content-previews.d.ts +39 -0
  3. package/dist/app/content-previews.js +28 -0
  4. package/dist/app/entity-edit-screen.js +2 -5
  5. package/dist/app/entity-list-screen.js +30 -50
  6. package/dist/app/form-schema.d.ts +1 -0
  7. package/dist/app/form-schema.js +24 -0
  8. package/dist/app/list-sort-options.d.ts +4 -0
  9. package/dist/app/list-sort-options.js +11 -0
  10. package/dist/app/named-filter-facet.d.ts +17 -3
  11. package/dist/app/named-filter-facet.js +88 -5
  12. package/dist/app/projection-detail-body.d.ts +2 -4
  13. package/dist/app/projection-detail-body.js +7 -1
  14. package/dist/app/projection-detail-guidance-data.d.ts +7 -0
  15. package/dist/app/projection-detail-guidance-data.js +101 -0
  16. package/dist/app/projection-detail-guidance.d.ts +13 -0
  17. package/dist/app/projection-detail-guidance.js +197 -0
  18. package/dist/app/projection-detail-header-model.d.ts +1 -3
  19. package/dist/app/projection-detail-header-model.js +4 -8
  20. package/dist/app/projection-detail-header-region.d.ts +2 -1
  21. package/dist/app/projection-detail-header-region.js +63 -23
  22. package/dist/app/projection-detail-header.d.ts +6 -1
  23. package/dist/app/projection-detail-header.js +75 -18
  24. package/dist/app/projection-detail-states.d.ts +3 -3
  25. package/dist/app/projection-list-body.js +4 -2
  26. package/dist/app/projection-list-render.js +3 -1
  27. package/dist/app/projection-list-shim.d.ts +4 -1
  28. package/dist/app/projection-list-shim.js +35 -8
  29. package/dist/app/reference-link.d.ts +3 -2
  30. package/dist/app/reference-link.js +19 -4
  31. package/dist/app/row-actions.js +3 -3
  32. package/dist/app/screen-access.d.ts +4 -0
  33. package/dist/app/screen-access.js +19 -0
  34. package/dist/app/screen-shared.js +3 -1
  35. package/dist/app/unique-label-keys.d.ts +1 -0
  36. package/dist/app/unique-label-keys.js +9 -0
  37. package/dist/app/use-entity-list-payload.d.ts +25 -0
  38. package/dist/app/use-entity-list-payload.js +57 -0
  39. package/dist/app/use-entity-range-facets.js +2 -3
  40. package/dist/app/use-facet-counts.d.ts +5 -0
  41. package/dist/app/use-facet-counts.js +7 -0
  42. package/dist/app/use-list-summary-row.d.ts +10 -0
  43. package/dist/app/use-list-summary-row.js +33 -0
  44. package/dist/app/use-named-filter-queue.d.ts +20 -0
  45. package/dist/app/use-named-filter-queue.js +9 -0
  46. package/dist/app/use-projection-detail-actions.d.ts +4 -4
  47. package/dist/app/use-projection-detail-actions.js +30 -1
  48. package/dist/app/use-projection-list-data.d.ts +5 -0
  49. package/dist/app/use-projection-list-data.js +35 -6
  50. package/dist/app/use-projection-list-query.d.ts +2 -0
  51. package/dist/app/use-projection-list-query.js +29 -16
  52. package/dist/app/use-related-list-tab-counts.js +5 -1
  53. package/dist/app/use-row-decoration.d.ts +11 -0
  54. package/dist/app/use-row-decoration.js +55 -0
  55. package/dist/app/use-screen-list-rows.d.ts +4 -1
  56. package/dist/app/use-screen-list-rows.js +14 -5
  57. package/dist/app/use-screen-list-table.d.ts +3 -1
  58. package/dist/app/use-screen-list-table.js +10 -1
  59. package/dist/app/write-failed-error.d.ts +1 -0
  60. package/dist/app/write-failed-error.js +10 -0
  61. package/dist/compact-tap-classes.d.ts +1 -0
  62. package/dist/compact-tap-classes.js +3 -0
  63. package/dist/components/embedded-list-field.js +13 -12
  64. package/dist/components/list-empty-state.d.ts +8 -1
  65. package/dist/components/list-empty-state.js +4 -1
  66. package/dist/components/list-group-page-bridges.d.ts +1 -1
  67. package/dist/components/list-group-page-bridges.js +2 -2
  68. package/dist/components/related-list-section.js +4 -22
  69. package/dist/components/render-edit-action-button.d.ts +3 -1
  70. package/dist/components/render-edit-action-button.js +5 -3
  71. package/dist/components/render-edit-render-model.d.ts +2 -2
  72. package/dist/components/render-edit-types.d.ts +4 -2
  73. package/dist/components/render-edit.js +3 -1
  74. package/dist/components/render-list-hint-columns.d.ts +8 -0
  75. package/dist/components/render-list-hint-columns.js +77 -0
  76. package/dist/components/render-list-reference-columns.js +4 -2
  77. package/dist/components/render-list-row-tone.d.ts +3 -0
  78. package/dist/components/render-list-row-tone.js +10 -0
  79. package/dist/components/render-list-table-props.d.ts +9 -1
  80. package/dist/components/render-list-table-props.js +4 -1
  81. package/dist/components/render-list-toolbar-action.d.ts +1 -2
  82. package/dist/components/render-list-toolbar-model.d.ts +3 -0
  83. package/dist/components/render-list-toolbar-model.js +21 -6
  84. package/dist/components/render-list-toolbar.d.ts +3 -2
  85. package/dist/components/render-list-toolbar.js +8 -6
  86. package/dist/components/render-list-types.d.ts +6 -1
  87. package/dist/components/render-list.js +26 -7
  88. package/dist/components/use-render-edit-controlled-sync.js +3 -5
  89. package/dist/components/use-render-edit-draft-save.js +7 -9
  90. package/dist/components/use-render-edit-schema.d.ts +3 -0
  91. package/dist/components/use-render-edit-schema.js +15 -0
  92. package/dist/components/use-render-edit-state.d.ts +1 -0
  93. package/dist/components/use-render-edit-state.js +4 -1
  94. package/dist/components/use-render-edit-steps.js +2 -3
  95. package/dist/components/use-render-list-columns.d.ts +3 -1
  96. package/dist/components/use-render-list-columns.js +22 -10
  97. package/dist/context/screen-focus-context.d.ts +14 -0
  98. package/dist/context/screen-focus-context.js +28 -0
  99. package/dist/data-table-facet-types.d.ts +2 -0
  100. package/dist/data-table-view-types.d.ts +20 -1
  101. package/dist/headless/form/form-controller.js +3 -1
  102. package/dist/headless/form/zod-bridge.d.ts +7 -1
  103. package/dist/headless/form/zod-bridge.js +10 -0
  104. package/dist/headless/index.d.ts +2 -1
  105. package/dist/headless/index.js +1 -0
  106. package/dist/headless/pwa-service-worker-meta.d.ts +1 -0
  107. package/dist/headless/pwa-service-worker-meta.js +3 -0
  108. package/dist/headless/view-model/index.d.ts +1 -1
  109. package/dist/headless/view-model/list-file-display.js +3 -2
  110. package/dist/headless/view-model/list.js +16 -0
  111. package/dist/headless/view-model/types.d.ts +33 -0
  112. package/dist/hooks/list-column-layout.js +2 -1
  113. package/dist/hooks/list-server-groups.js +14 -1
  114. package/dist/hooks/list-state-schema.d.ts +1 -0
  115. package/dist/hooks/list-state-schema.js +9 -1
  116. package/dist/hooks/use-debounced-value.d.ts +1 -0
  117. package/dist/hooks/use-debounced-value.js +11 -0
  118. package/dist/hooks/use-list-aggregates.d.ts +5 -1
  119. package/dist/hooks/use-list-aggregates.js +9 -5
  120. package/dist/hooks/use-list-table.d.ts +2 -1
  121. package/dist/hooks/use-list-table.js +3 -9
  122. package/dist/hooks/use-list-url-state.d.ts +2 -0
  123. package/dist/hooks/use-list-url-state.js +12 -4
  124. package/dist/hooks/use-list-view-state.js +23 -3
  125. package/dist/hooks/use-reference-lookup.js +7 -2
  126. package/dist/hooks/use-remembered-list-params.d.ts +6 -2
  127. package/dist/hooks/use-remembered-list-params.js +18 -3
  128. package/dist/hooks/use-store.js +0 -1
  129. package/dist/i18n-defaults.js +37 -2
  130. package/dist/index.d.ts +7 -2
  131. package/dist/index.js +4 -1
  132. package/dist/live/dispatcher-live.js +2 -0
  133. package/dist/metric-types.d.ts +2 -0
  134. package/dist/primitives-record-guidance.d.ts +53 -0
  135. package/dist/primitives-record-guidance.js +1 -0
  136. package/dist/primitives.d.ts +41 -31
  137. package/dist/server-clock.d.ts +6 -0
  138. package/dist/server-clock.js +20 -0
  139. package/dist/session/session-ended.d.ts +1 -0
  140. package/dist/session/session-ended.js +2 -2
  141. package/dist/status-tone.d.ts +1 -0
  142. package/dist/status-tone.js +5 -0
  143. package/dist/web/app/browser-locale.js +1 -1
  144. package/dist/web/app/client-plugin.d.ts +6 -1
  145. package/dist/web/app/create-app.d.ts +2 -1
  146. package/dist/web/app/create-app.js +15 -5
  147. package/dist/web/app/dashboard-body.js +25 -11
  148. package/dist/web/app/dashboard-header.d.ts +2 -1
  149. package/dist/web/app/dashboard-header.js +19 -7
  150. package/dist/web/app/dashboard-list-panel.d.ts +12 -0
  151. package/dist/web/app/dashboard-list-panel.js +149 -0
  152. package/dist/web/app/dashboard-narrow-gate.d.ts +6 -0
  153. package/dist/web/app/dashboard-narrow-gate.js +6 -0
  154. package/dist/web/app/dashboard-narrow-order.d.ts +3 -0
  155. package/dist/web/app/dashboard-narrow-order.js +6 -0
  156. package/dist/web/app/dashboard-navigation-link.d.ts +12 -0
  157. package/dist/web/app/dashboard-navigation-link.js +21 -0
  158. package/dist/web/app/dashboard-panels.d.ts +6 -23
  159. package/dist/web/app/dashboard-panels.js +53 -123
  160. package/dist/web/app/dashboard-reference-list-table.d.ts +5 -1
  161. package/dist/web/app/dashboard-reference-list-table.js +12 -4
  162. package/dist/web/app/dashboard-shared.d.ts +23 -7
  163. package/dist/web/app/dashboard-shared.js +44 -17
  164. package/dist/web/app/dashboard-stat-group-panel.d.ts +13 -0
  165. package/dist/web/app/dashboard-stat-group-panel.js +67 -0
  166. package/dist/web/app/dashboard-text-panel.d.ts +12 -0
  167. package/dist/web/app/dashboard-text-panel.js +163 -0
  168. package/dist/web/app/dashboard-text.d.ts +2 -0
  169. package/dist/web/app/dashboard-text.js +1 -1
  170. package/dist/web/app/dashboard-visibility.js +1 -1
  171. package/dist/web/app/relative-time.js +2 -1
  172. package/dist/web/editor/editor-footer.d.ts +28 -0
  173. package/dist/web/editor/editor-footer.js +23 -0
  174. package/dist/web/editor/editor-frame.d.ts +23 -0
  175. package/dist/web/editor/editor-frame.js +24 -0
  176. package/dist/web/editor/editor-header.d.ts +36 -0
  177. package/dist/web/editor/editor-header.js +30 -0
  178. package/dist/web/editor/editor-rail.d.ts +32 -0
  179. package/dist/web/editor/editor-rail.js +37 -0
  180. package/dist/web/editor/editor-workbench.d.ts +34 -0
  181. package/dist/web/editor/editor-workbench.js +19 -0
  182. package/dist/web/editor/index.d.ts +6 -0
  183. package/dist/web/editor/index.js +6 -0
  184. package/dist/web/editor/relative-when.d.ts +1 -0
  185. package/dist/web/editor/relative-when.js +18 -0
  186. package/dist/web/index.d.ts +7 -1
  187. package/dist/web/index.js +5 -1
  188. package/dist/web/layout/default-app-shell.js +6 -4
  189. package/dist/web/layout/focus-aware-sidebar.d.ts +4 -7
  190. package/dist/web/layout/focus-aware-sidebar.js +5 -7
  191. package/dist/web/layout/header-action-pinned.d.ts +8 -0
  192. package/dist/web/layout/header-action-pinned.js +25 -0
  193. package/dist/web/layout/nav-collapse-state.d.ts +5 -0
  194. package/dist/web/layout/nav-collapse-state.js +66 -0
  195. package/dist/web/layout/nav-tree.js +25 -5
  196. package/dist/web/layout/page-header-slot.d.ts +2 -0
  197. package/dist/web/layout/page-header-slot.js +4 -0
  198. package/dist/web/layout/screen-focus.d.ts +8 -0
  199. package/dist/web/layout/screen-focus.js +42 -0
  200. package/dist/web/layout/shell-focus.d.ts +6 -5
  201. package/dist/web/layout/shell-focus.js +12 -9
  202. package/dist/web/layout/shell-header.js +38 -10
  203. package/dist/web/layout/sidebar-open-state.d.ts +6 -0
  204. package/dist/web/layout/sidebar-open-state.js +28 -0
  205. package/dist/web/layout/uniform-bar-controls.d.ts +2 -2
  206. package/dist/web/layout/uniform-bar-controls.js +4 -3
  207. package/dist/web/layout/use-in-app-inbox.js +8 -1
  208. package/dist/web/layout/workspace-shell.js +6 -4
  209. package/dist/web/lib/upload-file-ref.d.ts +2 -2
  210. package/dist/web/lib/upload-file-ref.js +4 -9
  211. package/dist/web/presence/use-presence.js +7 -2
  212. package/dist/web/primitives/banner.d.ts +1 -1
  213. package/dist/web/primitives/banner.js +14 -6
  214. package/dist/web/primitives/calendar-day-picker.js +24 -5
  215. package/dist/web/primitives/card.js +1 -1
  216. package/dist/web/primitives/code-input.js +6 -1
  217. package/dist/web/primitives/data-table/actions-column.d.ts +1 -0
  218. package/dist/web/primitives/data-table/actions-column.js +4 -2
  219. package/dist/web/primitives/data-table/card-body.d.ts +5 -0
  220. package/dist/web/primitives/data-table/card-body.js +47 -5
  221. package/dist/web/primitives/data-table/card-frame.d.ts +8 -0
  222. package/dist/web/primitives/data-table/card-frame.js +9 -0
  223. package/dist/web/primitives/data-table/card-row.js +40 -7
  224. package/dist/web/primitives/data-table/card-sort-select.d.ts +6 -2
  225. package/dist/web/primitives/data-table/card-sort-select.js +10 -7
  226. package/dist/web/primitives/data-table/card-view.js +12 -2
  227. package/dist/web/primitives/data-table/column-picker-section.js +9 -2
  228. package/dist/web/primitives/data-table/column-resize-handle.js +3 -4
  229. package/dist/web/primitives/data-table/column-role.d.ts +1 -0
  230. package/dist/web/primitives/data-table/column-role.js +1 -0
  231. package/dist/web/primitives/data-table/data-cell-props.d.ts +5 -0
  232. package/dist/web/primitives/data-table/data-cell-props.js +5 -0
  233. package/dist/web/primitives/data-table/density.js +1 -0
  234. package/dist/web/primitives/data-table/facet-cluster.d.ts +2 -1
  235. package/dist/web/primitives/data-table/facet-cluster.js +2 -2
  236. package/dist/web/primitives/data-table/group-band.js +4 -0
  237. package/dist/web/primitives/data-table/hint-cell.d.ts +16 -0
  238. package/dist/web/primitives/data-table/hint-cell.js +74 -0
  239. package/dist/web/primitives/data-table/hint-column-width.d.ts +3 -0
  240. package/dist/web/primitives/data-table/hint-column-width.js +11 -0
  241. package/dist/web/primitives/data-table/measure-value.js +2 -3
  242. package/dist/web/primitives/data-table/row-action-column.d.ts +3 -0
  243. package/dist/web/primitives/data-table/row-action-column.js +4 -0
  244. package/dist/web/primitives/data-table/sort-options-select.d.ts +22 -0
  245. package/dist/web/primitives/data-table/sort-options-select.js +46 -0
  246. package/dist/web/primitives/data-table/sortable-header.d.ts +3 -1
  247. package/dist/web/primitives/data-table/sortable-header.js +5 -3
  248. package/dist/web/primitives/data-table/table-body.d.ts +1 -1
  249. package/dist/web/primitives/data-table/table-body.js +5 -3
  250. package/dist/web/primitives/data-table/table-chrome.js +3 -1
  251. package/dist/web/primitives/data-table/table-content.js +10 -5
  252. package/dist/web/primitives/data-table/table-data-cell.js +9 -3
  253. package/dist/web/primitives/data-table/table-header-row.js +5 -2
  254. package/dist/web/primitives/data-table/table-view.js +17 -3
  255. package/dist/web/primitives/data-table/toolbar-end-cluster.js +1 -1
  256. package/dist/web/primitives/data-table/toolbar.js +31 -3
  257. package/dist/web/primitives/data-table/totals-footer.d.ts +20 -0
  258. package/dist/web/primitives/data-table/totals-footer.js +40 -9
  259. package/dist/web/primitives/data-table/use-bulk-selection.js +2 -1
  260. package/dist/web/primitives/data-table/use-column-pins.js +4 -0
  261. package/dist/web/primitives/data-table/use-data-table-state.d.ts +1 -0
  262. package/dist/web/primitives/data-table/use-data-table-state.js +9 -5
  263. package/dist/web/primitives/data-table/use-measured-column-widths.js +5 -4
  264. package/dist/web/primitives/data-table/use-row-selection.js +22 -11
  265. package/dist/web/primitives/data-table/view-menu.js +7 -1
  266. package/dist/web/primitives/data-table-cell.d.ts +21 -2
  267. package/dist/web/primitives/data-table-cell.js +96 -19
  268. package/dist/web/primitives/embedded-file-cell.js +3 -2
  269. package/dist/web/primitives/embedded-list-cards.js +3 -4
  270. package/dist/web/primitives/facet-filter.d.ts +4 -2
  271. package/dist/web/primitives/facet-filter.js +26 -3
  272. package/dist/web/primitives/facet-search-filter.js +1 -1
  273. package/dist/web/primitives/file-thumbnail.d.ts +6 -2
  274. package/dist/web/primitives/file-thumbnail.js +13 -6
  275. package/dist/web/primitives/file-upload.js +3 -2
  276. package/dist/web/primitives/file-view-action.d.ts +6 -0
  277. package/dist/web/primitives/file-view-action.js +19 -0
  278. package/dist/web/primitives/files-dropzone.js +20 -9
  279. package/dist/web/primitives/form-footer-parts.d.ts +0 -1
  280. package/dist/web/primitives/form.js +0 -1
  281. package/dist/web/primitives/hint-reason-row.d.ts +32 -0
  282. package/dist/web/primitives/hint-reason-row.js +45 -0
  283. package/dist/web/primitives/index.js +6 -0
  284. package/dist/web/primitives/layout-elements.d.ts +1 -1
  285. package/dist/web/primitives/layout-elements.js +2 -2
  286. package/dist/web/primitives/metric.js +8 -6
  287. package/dist/web/primitives/page-header.d.ts +1 -1
  288. package/dist/web/primitives/page-header.js +8 -1
  289. package/dist/web/primitives/pager.js +29 -18
  290. package/dist/web/primitives/reason-box.d.ts +20 -0
  291. package/dist/web/primitives/reason-box.js +13 -0
  292. package/dist/web/primitives/record-breadcrumb.d.ts +3 -0
  293. package/dist/web/primitives/record-breadcrumb.js +11 -0
  294. package/dist/web/primitives/record-steps.d.ts +3 -0
  295. package/dist/web/primitives/record-steps.js +45 -0
  296. package/dist/web/primitives/record-summary.d.ts +3 -0
  297. package/dist/web/primitives/record-summary.js +18 -0
  298. package/dist/web/primitives/row-actions.d.ts +3 -1
  299. package/dist/web/primitives/row-actions.js +14 -5
  300. package/dist/web/primitives/segmented-select.js +5 -7
  301. package/dist/web/pwa/pwa-support.d.ts +4 -0
  302. package/dist/web/pwa/pwa-support.js +113 -0
  303. package/dist/web/sse/live-events.js +2 -2
  304. package/dist/web/tokens.js +0 -3
  305. package/dist/web/widgets/chart-parts.d.ts +7 -1
  306. package/dist/web/widgets/chart-parts.js +10 -4
  307. package/dist/web/widgets/collapsible-section.js +1 -1
  308. package/dist/web/widgets/dashboard-list-cards.d.ts +17 -0
  309. package/dist/web/widgets/dashboard-list-cards.js +54 -0
  310. package/dist/web/widgets/dashboard-list.d.ts +37 -5
  311. package/dist/web/widgets/dashboard-list.js +95 -20
  312. package/dist/web/widgets/drawer-sizing.js +1 -1
  313. package/dist/web/widgets/floating-panel.js +4 -2
  314. package/dist/web/widgets/index.d.ts +2 -0
  315. package/dist/web/widgets/index.js +2 -0
  316. package/dist/web/widgets/infinity-list.js +18 -11
  317. package/dist/web/widgets/preview-width-frame.d.ts +7 -0
  318. package/dist/web/widgets/preview-width-frame.js +10 -0
  319. package/dist/web/widgets/section-card.d.ts +1 -1
  320. package/dist/web/widgets/stacked-area-chrome.js +3 -3
  321. package/dist/web/widgets/stacked-area-tooltip.js +2 -10
  322. package/dist/web/widgets/stat-box-cell.d.ts +19 -0
  323. package/dist/web/widgets/stat-box-cell.js +10 -0
  324. package/dist/web/widgets/stat.d.ts +10 -1
  325. package/dist/web/widgets/stat.js +14 -5
  326. package/dist/web/widgets/status-badge.d.ts +7 -5
  327. package/dist/web/widgets/status-badge.js +2 -2
  328. package/dist/web/widgets/step-bar.d.ts +1 -1
  329. package/dist/web/widgets/step-bar.js +37 -7
  330. package/dist/web/widgets/upload-zone.d.ts +8 -1
  331. package/dist/web/widgets/upload-zone.js +13 -3
  332. package/package.json +5 -5
  333. package/src/changes.json +217 -0
  334. package/src/web/styles.css +9 -0
@@ -10,12 +10,10 @@ export function useRenderEditControlledSync({ props, state, form, draft, }) {
10
10
  useEffect(() => {
11
11
  onDirtyChangeRef.current?.(hasUnsavedInput);
12
12
  }, [hasUnsavedInput]);
13
- // Draft wizards keep their input server-side, so leaving loses nothing.
13
+ // Draft wizards keep their input server-side, but a running upload is not in the form value yet.
14
14
  const persistsDraft = state.isWizard && props.screen.layout.draft === true;
15
- useUnsavedInputSource(() => !persistsDraft &&
16
- (controller.getSnapshot().isDirty ||
17
- state.extensionDirtyRef.current ||
18
- state.pendingUploadsRef.current > 0));
15
+ useUnsavedInputSource(() => state.pendingUploadsRef.current > 0 ||
16
+ (!persistsDraft && (controller.getSnapshot().isDirty || state.extensionDirtyRef.current)));
19
17
  useWizardFormDraftRestore({
20
18
  screenId: props.screen.id,
21
19
  isCreateMode: state.isCreateMode,
@@ -37,15 +37,13 @@ export function useRenderEditDraftSave(props, state, form) {
37
37
  else
38
38
  controller.rebaseFields(fields);
39
39
  }, [controller]);
40
- // `saveDraft` (defined below) is a fresh closure every render, over that
41
- // render's `draftKey`/`draftId` — the ref lets the debounce timer below
42
- // always call the CURRENT one even though the timer was scheduled by an
43
- // earlier render's patch() call. `currentStepRef` gives it the current
44
- // wizard step without depending on `currentStep` (computed further down,
45
- // from `filteredSections`) at the point patchAndScheduleDraftSave itself
46
- // is defined — kept fresh where `currentStep` is computed below.
40
+ // `saveDraft` (built in RenderEdit, render-edit.tsx) is a fresh closure every
41
+ // render, over that render's `draftKey`/`draftId` — the ref lets the debounce
42
+ // timer below always call the CURRENT one even though the timer was scheduled
43
+ // by an earlier render's patch() call. `currentStepRef` gives it the current
44
+ // wizard step; it is set in useRenderEditSteps, which runs after this hook.
47
45
  const saveDraftRef = useRef(() => { });
48
- // `handleSubmit` (defined below) is a fresh closure over this render's
46
+ // `handleSubmit` (built in RenderEdit, render-edit.tsx) is a fresh closure over this render's
49
47
  // snapshot/extensionDirty, while the onControlsReady effect fires once per
50
48
  // mount — the ref lets controls.submit() always reach the current one.
51
49
  const handleSubmitRef = useRef(async () => { });
@@ -74,7 +72,7 @@ export function useRenderEditDraftSave(props, state, form) {
74
72
  // patch() (controlled mode, extension sections) applies immediately —
75
73
  // only the resulting draft save is debounced, so a patch() burst
76
74
  // (VIN-decode filling several fields, or onChange fanning a keystroke out
77
- // through patch(), see the VIN-decode test above) collapses into one save.
75
+ // through patch(), see the VIN-decode test in render-edit-controlled-wizard.test.tsx) collapses into one save.
78
76
  const patchAndScheduleDraftSave = useCallback((partial) => {
79
77
  controller.setValues(partial);
80
78
  // skip: no draft screen, locked, or already submitted
@@ -0,0 +1,3 @@
1
+ import type { FormValues } from "../headless/index.ts";
2
+ import type { RenderEditProps } from "./render-edit-types.ts";
3
+ export declare function useEffectiveFormSchema<TValues extends FormValues, TCtx>(props: RenderEditProps<TValues, TCtx>): RenderEditProps<TValues, TCtx>["schema"];
@@ -0,0 +1,15 @@
1
+ import { useMemo } from "react";
2
+ import { allOfSchemas, buildFormSchema } from "../app/form-schema.js";
3
+ import { isCreateModeEntityId } from "./use-render-edit-state.js";
4
+ // The field-derived required checks always run; a caller `schema` only adds rules.
5
+ // For payloadMode "changes" a field still equal to its loaded value is exempt,
6
+ // matching what the server presence-checks.
7
+ export function useEffectiveFormSchema(props) {
8
+ const { entity, screen, initial, entityId, payloadMode, schema } = props;
9
+ const isCreateMode = isCreateModeEntityId(entityId);
10
+ const unchangedFrom = !isCreateMode && payloadMode === "changes" ? initial : undefined;
11
+ return useMemo(() => {
12
+ const fieldSchema = buildFormSchema(entity, screen, isCreateMode ? "create" : "update", unchangedFrom);
13
+ return schema === undefined ? fieldSchema : allOfSchemas(schema, fieldSchema);
14
+ }, [entity, screen, isCreateMode, unchangedFrom, schema]);
15
+ }
@@ -2,6 +2,7 @@ import type { EntityEditScreenDefinition } from "@cosmicdrift/kumiko-framework/u
2
2
  import type { ErrorNotice } from "../app/error-reference.tsx";
3
3
  import type { DispatcherError, FieldIssue, Translate } from "../headless/index.ts";
4
4
  import type { FormErrorSource } from "./render-edit-helpers.tsx";
5
+ export declare function isCreateModeEntityId(entityId: string | null | undefined): boolean;
5
6
  export declare function useRenderEditState({ screen, entityId, translate: translateProp, }: {
6
7
  readonly screen: EntityEditScreenDefinition;
7
8
  readonly entityId: string | null | undefined;
@@ -97,6 +97,9 @@ function useExtensionComposition() {
97
97
  runExtensionSubmits,
98
98
  };
99
99
  }
100
+ export function isCreateModeEntityId(entityId) {
101
+ return entityId === undefined || entityId === null || entityId === "";
102
+ }
100
103
  export function useRenderEditState({ screen, entityId, translate: translateProp, }) {
101
104
  // Translate fallback: when the caller does not provide a translate function,
102
105
  // consume the i18next context directly. Otherwise field labels would remain raw
@@ -114,7 +117,7 @@ export function useRenderEditState({ screen, entityId, translate: translateProp,
114
117
  // step-transition path below stays wizard-only.
115
118
  const isTabs = screen.layout.mode === "tabs";
116
119
  const draftEnabled = isWizard && screen.layout.draft === true && dispatcher !== undefined;
117
- const isCreateMode = entityId === undefined || entityId === null || entityId === "";
120
+ const isCreateMode = isCreateModeEntityId(entityId);
118
121
  const draftStorage = useDraftStorage();
119
122
  const feedback = useSubmitFeedbackState();
120
123
  const stepState = useStepState();
@@ -23,9 +23,8 @@ export function useRenderEditSteps({ props, state, form, draft, sections, }) {
23
23
  const { schema } = props;
24
24
  const { isWizard, isCreateMode, passedStepKeys, extensionStepComplete } = state;
25
25
  const { currentStep, lastStepIndex } = computeCurrentStep(state.isTabs, state.activeTabId, state.rawStep, filteredSections);
26
- // Kept fresh for patchAndScheduleDraftSave's debounce timer above, which
27
- // is defined before `currentStep` exists (it depends on `filteredSections`,
28
- // computed further up from `vm`) and so cannot close over it directly.
26
+ // Kept fresh for patchAndScheduleDraftSave's debounce timer: useRenderEditDraftSave
27
+ // runs before this hook, so `currentStep` does not exist there yet.
29
28
  draft.refs.currentStepRef.current = currentStep;
30
29
  const isLastWizardStep = currentStep >= lastStepIndex;
31
30
  const wizardDoneSteps = useMemo(() => {
@@ -1,6 +1,8 @@
1
1
  import type { EntityDefinition, EntityListScreenDefinition } from "@cosmicdrift/kumiko-framework/ui-types";
2
2
  import { type ScreenLinkResolver } from "../app/reference-link.ts";
3
- import type { ListColumnViewModel, ListViewModel, Translate } from "../headless/index.ts";
3
+ import type { ListColumnViewModel, ListViewModel, RuntimeCellLink, Translate } from "../headless/index.ts";
4
+ /** Cell link to the screen a row names in `screenField`, parametrized by the row's `paramsField` object. */
5
+ export declare function screenLinkFor(resolveScreenLink: ScreenLinkResolver, screenField: string, paramsField: string | undefined): RuntimeCellLink;
4
6
  export declare function withScreenLinks(columns: readonly ListColumnViewModel[], screen: EntityListScreenDefinition, resolveScreenLink: ScreenLinkResolver): readonly ListColumnViewModel[];
5
7
  type RenderListColumnsInput = {
6
8
  readonly screen: EntityListScreenDefinition;
@@ -2,29 +2,40 @@ import { normalizeListColumn } from "@cosmicdrift/kumiko-framework/ui-types";
2
2
  import { useMemo } from "react";
3
3
  import { useReferenceLinkResolver, useScreenLinkResolver, } from "../app/reference-link.js";
4
4
  import { computeListViewModel } from "../headless/index.js";
5
+ import { withDisplayColumns, withEmptyPlaceholderColumns, withHintColumns, withNarrowOnlyColumns, } from "./render-list-hint-columns.js";
5
6
  import { enrichReferenceColumns, selectReferenceColumns } from "./render-list-reference-columns.js";
6
7
  import { useReferenceColumnLookups } from "./use-reference-column-lookups.js";
8
+ /** Cell link to the screen a row names in `screenField`, parametrized by the row's `paramsField` object. */
9
+ export function screenLinkFor(resolveScreenLink, screenField, paramsField) {
10
+ return (_value, row) => {
11
+ const screenQn = row?.[screenField];
12
+ if (typeof screenQn !== "string")
13
+ return undefined;
14
+ return resolveScreenLink(screenQn, paramsField === undefined ? undefined : row?.[paramsField]);
15
+ };
16
+ }
7
17
  // A column whose rows name their own target screen links each cell there.
8
18
  export function withScreenLinks(columns, screen, resolveScreenLink) {
9
19
  const linkFields = new Map();
10
20
  for (const spec of screen.columns) {
11
21
  const normalized = normalizeListColumn(spec);
12
22
  if (normalized.linkScreenField !== undefined) {
13
- linkFields.set(normalized.field, normalized.linkScreenField);
23
+ linkFields.set(normalized.field, {
24
+ screenField: normalized.linkScreenField,
25
+ paramsField: normalized.linkParamsField,
26
+ });
14
27
  }
15
28
  }
16
29
  if (linkFields.size === 0)
17
30
  return columns;
18
31
  return columns.map((col) => {
19
- const linkScreenField = linkFields.get(col.field);
20
- if (linkScreenField === undefined)
32
+ const linkFieldNames = linkFields.get(col.field);
33
+ if (linkFieldNames === undefined)
21
34
  return col;
22
35
  return {
23
36
  ...col,
24
- linkFor: (_value, row) => {
25
- const screenQn = row?.[linkScreenField];
26
- return typeof screenQn === "string" ? resolveScreenLink(screenQn) : undefined;
27
- },
37
+ rowActionLink: true,
38
+ linkFor: screenLinkFor(resolveScreenLink, linkFieldNames.screenField, linkFieldNames.paramsField),
28
39
  };
29
40
  });
30
41
  }
@@ -41,14 +52,15 @@ export function useRenderListColumns(input) {
41
52
  const { referenceRequests, handleLookupMap, referenceLookups } = useReferenceColumnLookups(rows, referenceColumns);
42
53
  const resolveReferenceLink = useReferenceLinkResolver();
43
54
  const resolveScreenLink = useScreenLinkResolver();
44
- const enrichedColumns = useMemo(() => withScreenLinks(enrichReferenceColumns({
45
- columns: vm.columns,
55
+ const enrichedColumns = useMemo(() => withNarrowOnlyColumns(withDisplayColumns(withHintColumns(withScreenLinks(enrichReferenceColumns({
56
+ // Flag first: the reference renderer reads it while it is built.
57
+ columns: withEmptyPlaceholderColumns(vm.columns, screen),
46
58
  referenceColumns,
47
59
  referenceLookups,
48
60
  resolveReferenceLink,
49
61
  featureName,
50
62
  translate,
51
- }), screen, resolveScreenLink), [
63
+ }), screen, resolveScreenLink), screen, translate), screen), screen), [
52
64
  vm.columns,
53
65
  referenceColumns,
54
66
  referenceLookups,
@@ -0,0 +1,14 @@
1
+ import { type ReactNode } from "react";
2
+ /** The record an open screen is about, reported for consumers such as assistants. */
3
+ export type ScreenFocus = {
4
+ readonly entityName: string;
5
+ readonly recordId: string;
6
+ readonly label: string;
7
+ readonly facts?: Readonly<Record<string, string>>;
8
+ };
9
+ export declare function ScreenFocusProvider({ children }: {
10
+ readonly children: ReactNode;
11
+ }): ReactNode;
12
+ export declare function useScreenFocus(): ScreenFocus | null;
13
+ /** Reports the focus while the calling screen is mounted; compared by value, cleared on unmount. */
14
+ export declare function useSetScreenFocus(focus: ScreenFocus | null): void;
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext, useEffect, useRef, useState } from "react";
3
+ const ScreenFocusContext = createContext(null);
4
+ const noopSetScreenFocus = () => { };
5
+ const SetScreenFocusContext = createContext(noopSetScreenFocus);
6
+ export function ScreenFocusProvider({ children }) {
7
+ const [focus, setFocus] = useState(null);
8
+ return (_jsx(SetScreenFocusContext, { value: setFocus, children: _jsx(ScreenFocusContext, { value: focus, children: children }) }));
9
+ }
10
+ export function useScreenFocus() {
11
+ return useContext(ScreenFocusContext);
12
+ }
13
+ /** Reports the focus while the calling screen is mounted; compared by value, cleared on unmount. */
14
+ export function useSetScreenFocus(focus) {
15
+ const setFocus = useContext(SetScreenFocusContext);
16
+ const key = focus === null ? null : JSON.stringify(focus);
17
+ const lastReported = useRef({
18
+ key,
19
+ focus,
20
+ });
21
+ if (lastReported.current.key !== key)
22
+ lastReported.current = { key, focus };
23
+ const stableFocus = lastReported.current.focus;
24
+ useEffect(() => {
25
+ setFocus(stableFocus);
26
+ return () => setFocus(null);
27
+ }, [setFocus, stableFocus]);
28
+ }
@@ -12,6 +12,8 @@ export type DataTableFacet = {
12
12
  /** Present: render the facet as a row of single-choice toggle chips instead
13
13
  * of a dropdown. A chip is pressed while the selection equals its values. */
14
14
  readonly chips?: readonly DataTableFacetChip[];
15
+ /** Chips only: "select" renders the chips as one single-choice dropdown instead of a row of toggles. */
16
+ readonly display?: "select";
15
17
  /** Chips only: show each chip's `count` next to its label. */
16
18
  readonly showCounts?: boolean;
17
19
  /** Chips only: hide chips whose `count` is 0 (unless pressed). */
@@ -1,4 +1,5 @@
1
- import type { ListColumnPin, ListTableDensity } from "@cosmicdrift/kumiko-types/screen";
1
+ import type { SelectOptionTone } from "@cosmicdrift/kumiko-types/fields";
2
+ import type { ListColumnPin, ListNarrowFacets, ListTableDensity, ListTableFrame } from "@cosmicdrift/kumiko-types/screen";
2
3
  import type { DataTableListNotice, DataTableRangeBound, DataTableRangeFacet, DataTableServerGroups, DataTableTotals } from "./data-table-aggregate-types.ts";
3
4
  export type DataTableDensity = ListTableDensity;
4
5
  export type DataTableColumnPin = ListColumnPin;
@@ -56,6 +57,18 @@ export type DataTableExport = {
56
57
  /** Visible column ids in display order. */
57
58
  readonly columns: readonly string[];
58
59
  };
60
+ export type DataTableSummaryItem = {
61
+ /** Absent: the cell shows the value alone, for values that carry their own meaning ("7 need action"). */
62
+ readonly label?: string;
63
+ readonly value: string | number;
64
+ readonly tone?: SelectOptionTone;
65
+ /** Column field the value stands under when the table draws the row as cells; absent goes to the first column. */
66
+ readonly column?: string;
67
+ };
68
+ /** One line of "label value" pairs (the label is optional) under the rows, answered by the screen's summaryRow query. */
69
+ export type DataTableSummaryRow = {
70
+ readonly items: readonly DataTableSummaryItem[];
71
+ };
59
72
  /** The DataTable props a screen's `table` block feeds. */
60
73
  export type DataTableTableBlock = {
61
74
  /** View menu (column picker, density); absent = no menu. */
@@ -66,8 +79,14 @@ export type DataTableTableBlock = {
66
79
  readonly exportList?: DataTableExport;
67
80
  /** Smaller (12px) semibold header row. */
68
81
  readonly compactHeader?: boolean;
82
+ /** "card": table, summary row and pager in one bordered card from sm; bordered cards with a gap below sm. */
83
+ readonly frame?: ListTableFrame;
84
+ /** "pills": below sm the select facets render as rounded pill triggers with a stronger border. */
85
+ readonly narrowFacets?: ListNarrowFacets;
69
86
  /** Present: the rows are grouped on the server; replaces pager and infinite scroll. */
70
87
  readonly serverGroups?: DataTableServerGroups;
88
+ /** Present: a footer line above the totals row with the summary query's items. */
89
+ readonly summaryRow?: DataTableSummaryRow;
71
90
  /** Present: a footer row with the server-computed totals of the filtered list. */
72
91
  readonly totals?: DataTableTotals;
73
92
  /** Present: the toolbar says the answer is incomplete and asks to narrow the list. */
@@ -63,6 +63,8 @@ function valuesDiff(current, initial) {
63
63
  // Fixing that needs real per-field seed-tracking (which value was actually
64
64
  // user-set vs. defaulted), not just a wider strip predicate here.
65
65
  // The seed of an untouched optional money field (buildInitialValues); never a valid payload value.
66
+ // Stripped only while the initial value was that seed too: clearing a stored amount must reach the
67
+ // server, which rejects it visibly instead of keeping the old amount silently.
66
68
  function isCurrencyOnlyMoney(value) {
67
69
  return (typeof value === "object" &&
68
70
  value !== null &&
@@ -77,7 +79,7 @@ function stripUntouchedEmptyStrings(values, initial, forceIncludeEmpty) {
77
79
  // Value-based seed strip, except keys previously submitted as "" after a
78
80
  // real clear — those must survive post-rebase submits.
79
81
  const untouchedEmptyString = !forceIncludeEmpty.has(key) && v[key] === "" && ini[key] === "";
80
- if (untouchedEmptyString || isCurrencyOnlyMoney(v[key])) {
82
+ if (untouchedEmptyString || (isCurrencyOnlyMoney(v[key]) && isCurrencyOnlyMoney(ini[key]))) {
81
83
  out ??= { ...v };
82
84
  delete out[key];
83
85
  }
@@ -1,4 +1,4 @@
1
- import type { ZodError } from "zod";
1
+ import type { ZodError, ZodIssue } from "zod";
2
2
  import type { FieldIssue } from "../dispatcher/index.ts";
3
3
  export declare function zodErrorToFieldIssues(error: ZodError): FieldIssue[];
4
4
  export declare function relevantFieldIssues(issues: readonly FieldIssue[], opts: {
@@ -7,4 +7,10 @@ export declare function relevantFieldIssues(issues: readonly FieldIssue[], opts:
7
7
  readonly includeRoot?: boolean;
8
8
  }): FieldIssue[];
9
9
  export declare const I18N_KEY_PARAM = "i18nKey";
10
+ export declare function asCustomIssue(issue: ZodIssue): {
11
+ readonly code: "custom";
12
+ readonly path: PropertyKey[];
13
+ readonly message: string;
14
+ readonly params: Record<string, unknown>;
15
+ };
10
16
  export declare function groupIssuesByPath(issues: readonly FieldIssue[]): Record<string, readonly FieldIssue[]>;
@@ -93,6 +93,16 @@ function extractIssueParams(issue) {
93
93
  }
94
94
  return Object.keys(out).length > 0 ? out : undefined;
95
95
  }
96
+ // Re-raises an issue from another schema as a custom issue that still resolves
97
+ // to the same i18n key and params, so schemas can be merged without zod's raw-issue typing.
98
+ export function asCustomIssue(issue) {
99
+ return {
100
+ code: "custom",
101
+ path: issue.path,
102
+ message: issue.message,
103
+ params: { ...extractIssueParams(issue), [I18N_KEY_PARAM]: resolveI18nKey(issue) },
104
+ };
105
+ }
96
106
  // Groups a flat FieldIssue list into the `errors` map carried by a
97
107
  // FormSnapshot. A field with multiple issues (e.g. both "required" and
98
108
  // "min") keeps both — UIs that only render the first can pick the first
@@ -9,7 +9,8 @@ export { applyFormatSpec, currencyDecimals, DOCUMENT_FALLBACK_CURRENCY, EMPTY_VA
9
9
  export type { NavDefinition, NavNode, NavRegistrySlice, NavTree, ResolveNavigationOptions, } from "./nav/index.ts";
10
10
  export { resolveNavigation } from "./nav/index.ts";
11
11
  export { pluralKey } from "./plural-key.ts";
12
+ export { PWA_SERVICE_WORKER_META_NAME } from "./pwa-service-worker-meta.ts";
12
13
  export type { Store, WritableStore } from "./store/index.ts";
13
14
  export { createStore, shallowEqual } from "./store/index.ts";
14
- export type { CellLink, CellLinkItem, ComputeEditViewModelInput, ComputeListViewModelInput, DerivedCellRoundingTarget, EditExtensionSectionViewModel, EditFieldSpec, EditFieldsSectionViewModel, EditFieldViewModel, EditFormMode, EditRelatedListSectionViewModel, EditSectionSpec, EditSectionViewModel, EditViewModel, EditWriteFormSectionViewModel, EmbeddedDerivedOp, EmbeddedListCellViewModel, EmbeddedListIssueGroups, FieldConditionCtx, FieldRenderer, ListColumnFileDisplay, ListColumnSpec, ListColumnViewModel, ListRowViewModel, ListViewModel, RuntimeCellLink, RuntimeCellLinkItems, RuntimeRenderer, ScreenSlots, Translate, } from "./view-model/index.ts";
15
+ export type { CellLink, CellLinkItem, ComputeEditViewModelInput, ComputeListViewModelInput, DerivedCellRoundingTarget, EditExtensionSectionViewModel, EditFieldSpec, EditFieldsSectionViewModel, EditFieldViewModel, EditFormMode, EditRelatedListSectionViewModel, EditSectionSpec, EditSectionViewModel, EditViewModel, EditWriteFormSectionViewModel, EmbeddedDerivedOp, EmbeddedListCellViewModel, EmbeddedListIssueGroups, FieldConditionCtx, FieldRenderer, ListColumnCellDisplay, ListColumnFileDisplay, ListColumnHintViewModel, ListColumnSpec, ListColumnViewModel, ListRowViewModel, ListViewModel, RuntimeCellLink, RuntimeCellLinkItems, RuntimeRenderer, ScreenSlots, Translate, } from "./view-model/index.ts";
15
16
  export { buildOptionLabels, computeDerivedCellValue, computeEditViewModel, computeListViewModel, computeRelatedListSectionViewModel, embeddedCellLabelKey, embeddedCellOptionLabelKey, fieldLabelKey, fieldOptionLabelKey, fieldOptionLabelKeyPrefix, groupEmbeddedListIssues, roundDerivedCellValue, sumEmbeddedListColumn, withDerivedCells, } from "./view-model/index.ts";
@@ -6,5 +6,6 @@ export { createFormController, groupIssuesByPath, I18N_KEY_PARAM, relevantFieldI
6
6
  export { applyFormatSpec, currencyDecimals, DOCUMENT_FALLBACK_CURRENCY, EMPTY_VALUE_PLACEHOLDER, escapeHtml, escapeHtmlAttr, escapeXml, formatDocumentDate, formatDocumentMoney, formatDocumentPercent, formatMoney, html, isSafeHref, RawHtml, raw, resolveSafeMoneyLocale, stripControlChars, toInstant, } from "./format/index.js";
7
7
  export { resolveNavigation } from "./nav/index.js";
8
8
  export { pluralKey } from "./plural-key.js";
9
+ export { PWA_SERVICE_WORKER_META_NAME } from "./pwa-service-worker-meta.js";
9
10
  export { createStore, shallowEqual } from "./store/index.js";
10
11
  export { buildOptionLabels, computeDerivedCellValue, computeEditViewModel, computeListViewModel, computeRelatedListSectionViewModel, embeddedCellLabelKey, embeddedCellOptionLabelKey, fieldLabelKey, fieldOptionLabelKey, fieldOptionLabelKeyPrefix, groupEmbeddedListIssues, roundDerivedCellValue, sumEmbeddedListColumn, withDerivedCells, } from "./view-model/index.js";
@@ -0,0 +1 @@
1
+ export declare const PWA_SERVICE_WORKER_META_NAME = "kumiko-pwa-sw";
@@ -0,0 +1,3 @@
1
+ // The server writes this meta into the HTML shell only when the app enables `pwa`, and the
2
+ // web client registers the service worker named in its content only when it finds it.
3
+ export const PWA_SERVICE_WORKER_META_NAME = "kumiko-pwa-sw";
@@ -4,4 +4,4 @@ export type { DerivedCellRoundingTarget, EmbeddedDerivedOp, EmbeddedListIssueGro
4
4
  export { computeDerivedCellValue, groupEmbeddedListIssues, roundDerivedCellValue, sumEmbeddedListColumn, withDerivedCells, } from "./embedded-list.ts";
5
5
  export type { ComputeListViewModelInput } from "./list.ts";
6
6
  export { buildOptionLabels, computeListViewModel, embeddedCellLabelKey, embeddedCellOptionLabelKey, fieldLabelKey, fieldOptionLabelKey, fieldOptionLabelKeyPrefix, } from "./list.ts";
7
- export type { CellLink, CellLinkItem, EditExtensionSectionViewModel, EditFieldSpec, EditFieldsSectionViewModel, EditFieldViewModel, EditRelatedListSectionViewModel, EditSectionSpec, EditSectionViewModel, EditViewModel, EditWriteFormSectionViewModel, EmbeddedListCellViewModel, FieldConditionCtx, FieldRenderer, ListColumnFileDisplay, ListColumnSpec, ListColumnViewModel, ListRowViewModel, ListViewModel, RuntimeCellLink, RuntimeCellLinkItems, RuntimeRenderer, ScreenSlots, Translate, } from "./types.ts";
7
+ export type { CellLink, CellLinkItem, EditExtensionSectionViewModel, EditFieldSpec, EditFieldsSectionViewModel, EditFieldViewModel, EditRelatedListSectionViewModel, EditSectionSpec, EditSectionViewModel, EditViewModel, EditWriteFormSectionViewModel, EmbeddedListCellViewModel, FieldConditionCtx, FieldRenderer, ListColumnCellDisplay, ListColumnFileDisplay, ListColumnHintViewModel, ListColumnSpec, ListColumnViewModel, ListRowViewModel, ListViewModel, RuntimeCellLink, RuntimeCellLinkItems, RuntimeRenderer, ScreenSlots, Translate, } from "./types.ts";
@@ -5,8 +5,9 @@ function fromFormatSpec(renderer) {
5
5
  if (typeof renderer !== "object" || renderer === null || !("format" in renderer)) {
6
6
  return undefined;
7
7
  }
8
- if (renderer.format === "file")
9
- return { kind: "file" };
8
+ if (renderer.format === "file") {
9
+ return renderer.viewInDrawer === true ? { kind: "file", viewInDrawer: true } : { kind: "file" };
10
+ }
10
11
  if (renderer.format !== "image")
11
12
  return undefined;
12
13
  return renderer.variant === undefined
@@ -29,6 +29,7 @@ const LIST_COLUMN_RESOLVERS = [
29
29
  derivedFieldColumn,
30
30
  rowMetaColumn,
31
31
  virtualRendererColumn,
32
+ rowDecorationColumn,
32
33
  ];
33
34
  function resolveListColumn(input, column) {
34
35
  for (const resolve of LIST_COLUMN_RESOLVERS) {
@@ -188,6 +189,21 @@ function virtualRendererColumn(input, column) {
188
189
  ...(column.hideOnNarrow === true && { hideOnNarrow: true }),
189
190
  };
190
191
  }
192
+ // A column naming a field of the screen's rowDecoration query: the value lives
193
+ // in the merged row, so there is no entity metadata and the cell is plain text.
194
+ function rowDecorationColumn(input, column) {
195
+ // skip: without a rowDecoration an unknown column stays an authoring error
196
+ if (input.screen.rowDecoration === undefined)
197
+ return undefined;
198
+ return {
199
+ field: column.field,
200
+ label: translatedColumnLabel(input, column),
201
+ type: "text",
202
+ sortable: false,
203
+ ...(column.renderer !== undefined && { renderer: column.renderer }),
204
+ ...(column.hideOnNarrow === true && { hideOnNarrow: true }),
205
+ };
206
+ }
191
207
  // The wire carries `true` (set) / `null` (empty) for writeOnly fields; the cell shows a word, not "true".
192
208
  function writeOnlyRowFormatter(input) {
193
209
  const { screen, entity, translate } = input;
@@ -22,6 +22,7 @@ export type ListColumnFileDisplay = {
22
22
  readonly variant?: string;
23
23
  } | {
24
24
  readonly kind: "file";
25
+ readonly viewInDrawer?: true;
25
26
  };
26
27
  export type ListColumnViewModel = {
27
28
  readonly field: string;
@@ -29,6 +30,8 @@ export type ListColumnViewModel = {
29
30
  readonly type: string;
30
31
  readonly renderer?: FieldRenderer | RuntimeRenderer;
31
32
  readonly linkFor?: RuntimeCellLink;
33
+ /** Per-row action link column: a text link right-aligned without header text from sm, a small outline button on cards. */
34
+ readonly rowActionLink?: boolean;
32
35
  readonly linkItemsFor?: RuntimeCellLinkItems;
33
36
  readonly sortable: boolean;
34
37
  /** Only for `type: "select"` or `type: "multiSelect"` — translated option
@@ -55,6 +58,8 @@ export type ListColumnViewModel = {
55
58
  readonly highlighted?: boolean;
56
59
  /** Mirrors `ListColumnSpec.hideOnNarrow`: card layout skips the column. */
57
60
  readonly hideOnNarrow?: boolean;
61
+ /** Mirrors `ListColumnSpec.showOnNarrowOnly`: the table layout skips the column. */
62
+ readonly showOnNarrowOnly?: boolean;
58
63
  /** Only for `type: "number"` — mirrors `NumberFieldDef.grouping` (default
59
64
  * `true`). `false` renders without thousands-separators (e.g. a model
60
65
  * year). */
@@ -63,6 +68,34 @@ export type ListColumnViewModel = {
63
68
  * `{ format: "image" | "file" }` renderer. The cell shows a thumbnail or the
64
69
  * file name instead of the FileRef UUID. */
65
70
  readonly fileDisplay?: ListColumnFileDisplay;
71
+ /** "To do" cell (`ListColumnSpec.hint`), `emptyLabel` already translated. */
72
+ readonly hint?: ListColumnHintViewModel;
73
+ /** Start width and floor in px of a hint column; unlike other columns they apply without `table.resizing`. */
74
+ readonly width?: number;
75
+ readonly minWidth?: number;
76
+ /** `ListColumnSpec.display` for list tables: a status pill or a link drawn as a button. */
77
+ readonly display?: ListColumnCellDisplay;
78
+ /** Row field naming the pill tone; only with `display: "badge"`. */
79
+ readonly badgeToneField?: string;
80
+ /** `false`: the pill has no leading dot. */
81
+ readonly badgeDot?: false;
82
+ /** `false`: an empty cell stays blank instead of showing "—". */
83
+ readonly emptyPlaceholder?: false;
84
+ };
85
+ export type ListColumnCellDisplay = "badge" | "button";
86
+ export type ListColumnHintViewModel = {
87
+ readonly detailField?: string;
88
+ /** `ListColumnHint.narrowDetailField`: replaces `detailField` in the phone card. */
89
+ readonly narrowDetailField?: string;
90
+ readonly toneField?: string;
91
+ readonly reasonField?: string;
92
+ readonly reasonOpenField?: string;
93
+ readonly reasonTitleField?: string;
94
+ /** `ListColumnHint.plainSentence`: the sentence keeps the normal text color. */
95
+ readonly plainSentence?: boolean;
96
+ readonly emptyLabel: string;
97
+ /** Label of the reason toggle, already translated. */
98
+ readonly reasonLabel: string;
66
99
  };
67
100
  export type ListRowViewModel = {
68
101
  readonly id: string;
@@ -1,7 +1,8 @@
1
+ import { LIST_COLUMN_MAX_WIDTH_PX } from "@cosmicdrift/kumiko-types/screen";
1
2
  export const DEFAULT_COLUMN_WIDTH_PX = 160;
2
3
  export const DEFAULT_MIN_COLUMN_WIDTH_PX = 64;
3
4
  /** Upper bound so a tampered stored width cannot blow the table up. */
4
- export const MAX_COLUMN_WIDTH_PX = 2000;
5
+ export const MAX_COLUMN_WIDTH_PX = LIST_COLUMN_MAX_WIDTH_PX;
5
6
  export function defaultPins(schema) {
6
7
  const pins = {};
7
8
  for (const column of schema) {
@@ -1,4 +1,5 @@
1
1
  import { relatedListGroupHeaderLabel, relatedListGroupKey, } from "@cosmicdrift/kumiko-types/screen";
2
+ import { rendererWarn } from "../dev-console.js";
2
3
  import { groupPageKey, groupPagePayload, loadedGroupPages, } from "./list-group-pages.js";
3
4
  export function freshLoadState(resetKey) {
4
5
  return {
@@ -19,12 +20,24 @@ export function measuresOf(totals, group) {
19
20
  function startsCollapsed(declared, key) {
20
21
  return (declared?.collapsedWhen !== undefined && key === relatedListGroupKey(declared.collapsedWhen));
21
22
  }
23
+ // Groupings declared before the dateField/{lastDate} placeholder was removed still carry it in app texts.
24
+ const REMOVED_LAST_DATE_PLACEHOLDER = "{lastDate}";
25
+ const warnedRemovedPlaceholderKeys = new Set();
26
+ function withoutRemovedPlaceholder(text, labelKey) {
27
+ if (!text.includes(REMOVED_LAST_DATE_PLACEHOLDER))
28
+ return text;
29
+ if (!warnedRemovedPlaceholderKeys.has(labelKey)) {
30
+ warnedRemovedPlaceholderKeys.add(labelKey);
31
+ rendererWarn(`[kumiko] Translation "${labelKey}" uses ${REMOVED_LAST_DATE_PLACEHOLDER}, which grouping no longer provides; use a max measure in table.totals instead.`);
32
+ }
33
+ return text.replaceAll(REMOVED_LAST_DATE_PLACEHOLDER, "").trim();
34
+ }
22
35
  function headerLabel(input, key, group) {
23
36
  const serverLabel = group.label ?? undefined;
24
37
  const labelKey = input.declared === undefined ? undefined : relatedListGroupHeaderLabel(input.declared, key);
25
38
  if (labelKey === undefined)
26
39
  return serverLabel;
27
- return input.translate(labelKey, { count: group.count, value: serverLabel ?? key });
40
+ return withoutRemovedPlaceholder(input.translate(labelKey, { count: group.count, value: serverLabel ?? key }), labelKey);
28
41
  }
29
42
  function pageRequests(input, group, key, pages, requestedPages) {
30
43
  const requests = [];
@@ -23,6 +23,7 @@ export type KnownListFields = {
23
23
  readonly columnFields: readonly string[];
24
24
  readonly filterFields: readonly string[];
25
25
  };
26
+ export declare const NAMED_FILTER_PARAM_SUFFIX = "filter";
26
27
  /** Drops what the screen no longer has (renamed field, removed column) so an old
27
28
  * session never feeds dead keys into the URL or the column picker. */
28
29
  export declare function sanitizeStoredListState(raw: unknown, known: KnownListFields): StoredListState | undefined;
@@ -25,7 +25,15 @@ export function parseStoredListStateJson(text) {
25
25
  return undefined;
26
26
  }
27
27
  }
28
- const PLAIN_PARAM_SUFFIXES = new Set(["sort", "dir", "q", "page", "size"]);
28
+ export const NAMED_FILTER_PARAM_SUFFIX = "filter";
29
+ const PLAIN_PARAM_SUFFIXES = new Set([
30
+ "sort",
31
+ "dir",
32
+ "q",
33
+ "page",
34
+ "size",
35
+ NAMED_FILTER_PARAM_SUFFIX,
36
+ ]);
29
37
  const FILTER_PREFIX = "f.";
30
38
  const RANGE_BOUND_SUFFIXES = [".from", ".to", ".min", ".max"];
31
39
  function isKnownParamSuffix(suffix, filterFields) {
@@ -0,0 +1 @@
1
+ export declare function useDebouncedValue<T>(value: T, delayMs: number): T;
@@ -0,0 +1,11 @@
1
+ import { useEffect, useState } from "react";
2
+ // Unlike useDeferredValue this waits for a quiet period, so a burst of
3
+ // keystrokes triggers one server round-trip instead of one per keystroke.
4
+ export function useDebouncedValue(value, delayMs) {
5
+ const [debounced, setDebounced] = useState(value);
6
+ useEffect(() => {
7
+ const timer = setTimeout(() => setDebounced(value), delayMs);
8
+ return () => clearTimeout(timer);
9
+ }, [value, delayMs]);
10
+ return debounced;
11
+ }
@@ -11,12 +11,16 @@ type ListAggregatesArgs = {
11
11
  readonly pageSize: number;
12
12
  readonly paging: ListGroupPaging;
13
13
  readonly translate: Translate;
14
+ /** Holds the aggregate queries, e.g. while remembered params are restored. */
15
+ readonly paused?: boolean;
14
16
  };
15
17
  export type ListGroupPagesProps = {
16
18
  readonly queryType: string;
17
19
  readonly requests: readonly ListGroupPageRequest[];
18
20
  readonly onResult: (pageKey: string, result: ListGroupPageResult) => void;
19
21
  readonly refreshNonce: number;
22
+ /** Bridges remount when it changes: useQuery keeps the previous payload's data. */
23
+ readonly resetKey: string;
20
24
  };
21
25
  export type ListAggregates = {
22
26
  readonly grouped: boolean;
@@ -34,5 +38,5 @@ export type ListAggregates = {
34
38
  };
35
39
  /** Server-side grouping and totals of a list: groups are the load unit, each open
36
40
  * and visible group pages through its own rows; nothing is summed on the client. */
37
- export declare function useListAggregates({ queryType, payload, table, groupField, pageSize, paging, translate, }: ListAggregatesArgs): ListAggregates;
41
+ export declare function useListAggregates({ queryType, payload, table, groupField, pageSize, paging, translate, paused, }: ListAggregatesArgs): ListAggregates;
38
42
  export {};