@viewkitjs/views 0.1.0 → 0.3.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 (390) hide show
  1. package/CHANGELOG.md +767 -1
  2. package/README.md +92 -41
  3. package/dist/atoms/LoadMore.js +11 -1
  4. package/dist/atoms/Row.js +1 -1
  5. package/dist/atoms/RowMenu.d.ts +1 -1
  6. package/dist/atoms/RowMenu.js +20 -6
  7. package/dist/atoms/types.d.ts +4 -4
  8. package/dist/cells/cell-format.d.ts +3 -3
  9. package/dist/cells/cell-title.d.ts +1 -2
  10. package/dist/cells/cell-title.js +2 -2
  11. package/dist/cells/cell-values.js +6 -3
  12. package/dist/contract.d.ts +79 -8
  13. package/dist/contract.js +55 -8
  14. package/dist/display/converted.d.ts +19 -0
  15. package/dist/display/converted.js +12 -0
  16. package/dist/display/format.d.ts +16 -1
  17. package/dist/display/format.js +10 -1
  18. package/dist/display/index.d.ts +2 -1
  19. package/dist/display/index.js +2 -1
  20. package/dist/display/link-click.d.ts +11 -0
  21. package/dist/display/link-click.js +3 -0
  22. package/dist/display/link.js +12 -6
  23. package/dist/display/location.d.ts +4 -3
  24. package/dist/display/location.js +12 -5
  25. package/dist/display/multi-value.d.ts +1 -1
  26. package/dist/display/multi-value.js +1 -1
  27. package/dist/display/options.d.ts +8 -2
  28. package/dist/display/percent.js +10 -3
  29. package/dist/display/phone.d.ts +2 -1
  30. package/dist/display/phone.js +11 -2
  31. package/dist/display/relation.js +1 -1
  32. package/dist/editors/ChipsEditor.d.ts +9 -4
  33. package/dist/editors/ChipsEditor.js +7 -3
  34. package/dist/editors/DateEditor.d.ts +21 -6
  35. package/dist/editors/DateEditor.js +118 -30
  36. package/dist/editors/EditorPanel.d.ts +61 -0
  37. package/dist/editors/EditorPanel.js +54 -0
  38. package/dist/editors/LocationEditor.d.ts +3 -0
  39. package/dist/editors/LocationEditor.js +28 -21
  40. package/dist/editors/NameEditor.d.ts +3 -0
  41. package/dist/editors/NameEditor.js +15 -10
  42. package/dist/editors/NumberEditor.d.ts +3 -0
  43. package/dist/editors/NumberEditor.js +7 -7
  44. package/dist/editors/RangeEditor.d.ts +16 -1
  45. package/dist/editors/RangeEditor.js +22 -6
  46. package/dist/editors/RelationEditor.d.ts +13 -28
  47. package/dist/editors/RelationEditor.js +17 -40
  48. package/dist/editors/RelationSetEditor.d.ts +53 -0
  49. package/dist/editors/RelationSetEditor.js +112 -0
  50. package/dist/editors/SelectEditor.d.ts +21 -3
  51. package/dist/editors/SelectEditor.js +55 -9
  52. package/dist/editors/TextEditor.d.ts +51 -0
  53. package/dist/editors/TextEditor.js +81 -0
  54. package/dist/editors/ValueListEditor.d.ts +5 -2
  55. package/dist/editors/ValueListEditor.js +11 -9
  56. package/dist/editors/edit-cores.d.ts +13 -10
  57. package/dist/editors/edit-cores.js +7 -6
  58. package/dist/editors/edit-session.d.ts +21 -11
  59. package/dist/editors/edit-session.js +19 -5
  60. package/dist/editors/keep-inside.d.ts +12 -0
  61. package/dist/editors/keep-inside.js +20 -0
  62. package/dist/editors/open-value.d.ts +21 -0
  63. package/dist/editors/open-value.js +36 -0
  64. package/dist/editors/open-values.d.ts +4 -0
  65. package/dist/editors/open-values.js +7 -0
  66. package/dist/editors/relation-kinds.d.ts +7 -0
  67. package/dist/editors/relation-kinds.js +21 -0
  68. package/dist/editors/relation-panel.d.ts +69 -0
  69. package/dist/editors/relation-panel.js +40 -0
  70. package/dist/field-row/FieldNoteLine.d.ts +14 -0
  71. package/dist/field-row/FieldNoteLine.js +14 -0
  72. package/dist/field-row/FieldRow.d.ts +73 -0
  73. package/dist/field-row/FieldRow.js +157 -0
  74. package/dist/field-row/FieldRowLane.d.ts +19 -0
  75. package/dist/field-row/FieldRowLane.js +11 -0
  76. package/dist/field-row/editors/RowChipsEditor.d.ts +11 -0
  77. package/dist/field-row/editors/RowChipsEditor.js +25 -0
  78. package/dist/field-row/editors/RowDateEditor.d.ts +16 -0
  79. package/dist/field-row/editors/RowDateEditor.js +18 -0
  80. package/dist/field-row/editors/RowEditor.d.ts +39 -0
  81. package/dist/field-row/editors/RowEditor.js +64 -0
  82. package/dist/field-row/editors/RowNameEditor.d.ts +4 -0
  83. package/dist/field-row/editors/RowNameEditor.js +15 -0
  84. package/dist/field-row/editors/RowNumberEditor.d.ts +12 -0
  85. package/dist/field-row/editors/RowNumberEditor.js +18 -0
  86. package/dist/field-row/editors/RowPlaceEditor.d.ts +8 -0
  87. package/dist/field-row/editors/RowPlaceEditor.js +18 -0
  88. package/dist/field-row/editors/RowRangeEditor.d.ts +4 -0
  89. package/dist/field-row/editors/RowRangeEditor.js +15 -0
  90. package/dist/field-row/editors/RowRelationEditor.d.ts +20 -0
  91. package/dist/field-row/editors/RowRelationEditor.js +77 -0
  92. package/dist/field-row/editors/RowSelectEditor.d.ts +13 -0
  93. package/dist/field-row/editors/RowSelectEditor.js +23 -0
  94. package/dist/field-row/editors/RowTextEditor.d.ts +15 -0
  95. package/dist/field-row/editors/RowTextEditor.js +16 -0
  96. package/dist/field-row/editors/RowValueListEditor.d.ts +4 -0
  97. package/dist/field-row/editors/RowValueListEditor.js +21 -0
  98. package/dist/field-row/editors/host.d.ts +59 -0
  99. package/dist/field-row/editors/host.js +1 -0
  100. package/dist/field-row/editors/row-session.d.ts +49 -0
  101. package/dist/field-row/editors/row-session.js +49 -0
  102. package/dist/field-row/index.d.ts +5 -0
  103. package/dist/field-row/index.js +5 -0
  104. package/dist/field-row/row-target.d.ts +20 -0
  105. package/dist/field-row/row-target.js +3 -0
  106. package/dist/field-row/useFieldWrite.d.ts +45 -0
  107. package/dist/field-row/useFieldWrite.js +190 -0
  108. package/dist/field-row/useRowSettlement.d.ts +33 -0
  109. package/dist/field-row/useRowSettlement.js +23 -0
  110. package/dist/fields/binding.d.ts +7 -2
  111. package/dist/fields/binding.js +13 -6
  112. package/dist/fields/currency.d.ts +0 -10
  113. package/dist/fields/currency.js +0 -14
  114. package/dist/fields/edit-core-types.d.ts +9 -9
  115. package/dist/fields/edit-core-types.js +6 -6
  116. package/dist/fields/money.d.ts +6 -0
  117. package/dist/fields/money.js +11 -0
  118. package/dist/fields/number-edit.d.ts +6 -0
  119. package/dist/fields/number-edit.js +4 -0
  120. package/dist/fields/prepare-write.js +6 -1
  121. package/dist/fields/relation-source-types.d.ts +12 -0
  122. package/dist/fields/write-target.d.ts +50 -0
  123. package/dist/fields/write-target.js +10 -0
  124. package/dist/filters/filter-model.d.ts +0 -1
  125. package/dist/filters/registry.d.ts +3 -36
  126. package/dist/filters/registry.js +0 -38
  127. package/dist/grid/chrome/GridAddColumn.d.ts +11 -0
  128. package/dist/grid/chrome/GridAddColumn.js +29 -0
  129. package/dist/grid/chrome/GridAggregateMenu.d.ts +31 -0
  130. package/dist/grid/chrome/GridAggregateMenu.js +29 -0
  131. package/dist/grid/chrome/GridCellEditors.d.ts +71 -0
  132. package/dist/grid/chrome/GridCellEditors.js +126 -0
  133. package/dist/grid/chrome/GridCellOutline.d.ts +49 -0
  134. package/dist/grid/chrome/GridCellOutline.js +16 -0
  135. package/dist/grid/chrome/GridChipsEditor.d.ts +38 -0
  136. package/dist/grid/chrome/GridChipsEditor.js +35 -0
  137. package/dist/grid/chrome/GridColumnColorSection.d.ts +11 -0
  138. package/dist/grid/chrome/GridColumnColorSection.js +40 -0
  139. package/dist/grid/chrome/GridColumnDateSection.d.ts +23 -0
  140. package/dist/grid/chrome/GridColumnDateSection.js +23 -0
  141. package/dist/grid/chrome/GridColumnDurationSection.d.ts +19 -0
  142. package/dist/grid/chrome/GridColumnDurationSection.js +24 -0
  143. package/dist/grid/chrome/GridColumnMenu.d.ts +101 -0
  144. package/dist/grid/chrome/GridColumnMenu.js +103 -0
  145. package/dist/grid/chrome/GridColumnNumberSection.d.ts +25 -0
  146. package/dist/grid/chrome/GridColumnNumberSection.js +27 -0
  147. package/dist/grid/chrome/GridColumnPercentSection.d.ts +15 -0
  148. package/dist/grid/chrome/GridColumnPercentSection.js +16 -0
  149. package/dist/grid/chrome/GridColumnSortSection.d.ts +18 -0
  150. package/dist/grid/chrome/GridColumnSortSection.js +16 -0
  151. package/dist/grid/chrome/GridDateEditor.d.ts +34 -0
  152. package/dist/grid/chrome/GridDateEditor.js +19 -0
  153. package/dist/grid/chrome/GridFlyout.d.ts +44 -0
  154. package/dist/grid/chrome/GridFlyout.js +80 -0
  155. package/dist/grid/chrome/GridFooter.d.ts +33 -0
  156. package/dist/grid/chrome/GridFooter.js +85 -0
  157. package/dist/grid/chrome/GridGroupMenu.d.ts +37 -0
  158. package/dist/grid/chrome/GridGroupMenu.js +64 -0
  159. package/dist/grid/chrome/GridHeader.d.ts +66 -0
  160. package/dist/grid/chrome/GridHeader.js +42 -0
  161. package/dist/grid/chrome/GridLongTextEditor.d.ts +55 -0
  162. package/dist/grid/chrome/GridLongTextEditor.js +69 -0
  163. package/dist/grid/chrome/GridMenuRow.d.ts +15 -0
  164. package/dist/grid/chrome/GridMenuRow.js +15 -0
  165. package/dist/grid/chrome/GridNameEditor.d.ts +24 -0
  166. package/dist/grid/chrome/GridNameEditor.js +21 -0
  167. package/dist/grid/chrome/GridNumberEditor.d.ts +49 -0
  168. package/dist/grid/chrome/GridNumberEditor.js +51 -0
  169. package/dist/grid/chrome/GridPlaceEditor.d.ts +26 -0
  170. package/dist/grid/chrome/GridPlaceEditor.js +22 -0
  171. package/dist/grid/chrome/GridRangeEditor.d.ts +30 -0
  172. package/dist/grid/chrome/GridRangeEditor.js +21 -0
  173. package/dist/grid/chrome/GridRelationEditor.d.ts +45 -0
  174. package/dist/grid/chrome/GridRelationEditor.js +92 -0
  175. package/dist/grid/chrome/GridResizeHandle.d.ts +19 -0
  176. package/dist/grid/chrome/GridResizeHandle.js +19 -0
  177. package/dist/grid/chrome/GridRow.d.ts +31 -0
  178. package/dist/grid/chrome/GridRow.js +179 -0
  179. package/dist/grid/chrome/GridRowActions.d.ts +32 -0
  180. package/dist/grid/chrome/GridRowActions.js +25 -0
  181. package/dist/grid/chrome/GridRowCells.d.ts +4 -0
  182. package/dist/grid/chrome/GridRowCells.js +128 -0
  183. package/dist/grid/chrome/GridRowGlyph.d.ts +12 -0
  184. package/dist/grid/chrome/GridRowGlyph.js +13 -0
  185. package/dist/grid/chrome/GridSelectEditor.d.ts +33 -0
  186. package/dist/grid/chrome/GridSelectEditor.js +43 -0
  187. package/dist/grid/chrome/GridStructure.d.ts +47 -0
  188. package/dist/grid/chrome/GridStructure.js +41 -0
  189. package/dist/grid/chrome/GridTable.d.ts +4 -0
  190. package/dist/grid/chrome/GridTable.js +192 -0
  191. package/dist/grid/chrome/GridTableSurface.d.ts +52 -0
  192. package/dist/grid/chrome/GridTableSurface.js +15 -0
  193. package/dist/grid/chrome/GridTextEditor.d.ts +45 -0
  194. package/dist/grid/chrome/GridTextEditor.js +38 -0
  195. package/dist/grid/chrome/GridValueListEditor.d.ts +30 -0
  196. package/dist/grid/chrome/GridValueListEditor.js +19 -0
  197. package/dist/grid/chrome/StuckMarker.d.ts +16 -0
  198. package/dist/grid/chrome/StuckMarker.js +34 -0
  199. package/dist/grid/chrome/cell-clipboard.d.ts +9 -0
  200. package/dist/grid/chrome/cell-clipboard.js +28 -0
  201. package/dist/grid/chrome/cell-cut-off.d.ts +11 -0
  202. package/dist/grid/chrome/cell-cut-off.js +20 -0
  203. package/dist/grid/chrome/cells.d.ts +21 -0
  204. package/dist/grid/chrome/cells.js +19 -0
  205. package/dist/grid/chrome/checks.d.ts +32 -0
  206. package/dist/grid/chrome/checks.js +32 -0
  207. package/dist/grid/chrome/column-glyph.d.ts +14 -0
  208. package/dist/grid/chrome/column-glyph.js +44 -0
  209. package/dist/grid/chrome/editors.d.ts +9 -0
  210. package/dist/grid/chrome/editors.js +10 -0
  211. package/dist/grid/chrome/grid-cell-classes.d.ts +53 -0
  212. package/dist/grid/chrome/grid-cell-classes.js +32 -0
  213. package/dist/grid/chrome/grid-cell-link.d.ts +13 -0
  214. package/dist/grid/chrome/grid-cell-link.js +9 -0
  215. package/dist/grid/chrome/grid-edit-session.d.ts +63 -0
  216. package/dist/grid/chrome/grid-edit-session.js +118 -0
  217. package/dist/grid/chrome/grid-hover.d.ts +60 -0
  218. package/dist/grid/chrome/grid-hover.js +81 -0
  219. package/dist/grid/chrome/grid-menu-focus.d.ts +43 -0
  220. package/dist/grid/chrome/grid-menu-focus.js +93 -0
  221. package/dist/grid/chrome/grid-menu-search.d.ts +7 -0
  222. package/dist/grid/chrome/grid-menu-search.js +7 -0
  223. package/dist/grid/chrome/grid-row-menu-key.d.ts +15 -0
  224. package/dist/grid/chrome/grid-row-menu-key.js +36 -0
  225. package/dist/grid/chrome/grid-row-props.d.ts +143 -0
  226. package/dist/grid/chrome/grid-row-props.js +1 -0
  227. package/dist/grid/chrome/grid-row-window.d.ts +61 -0
  228. package/dist/grid/chrome/grid-row-window.js +212 -0
  229. package/dist/grid/chrome/grid-scroll-owner.d.ts +38 -0
  230. package/dist/grid/chrome/grid-scroll-owner.js +75 -0
  231. package/dist/grid/chrome/grid-styles.d.ts +40 -0
  232. package/dist/grid/chrome/grid-styles.js +9 -0
  233. package/dist/grid/chrome/grid-table-props.d.ts +172 -0
  234. package/dist/grid/chrome/grid-table-props.js +1 -0
  235. package/dist/grid/chrome/useGridBatchApi.d.ts +34 -0
  236. package/dist/grid/chrome/useGridBatchApi.js +35 -0
  237. package/dist/grid/chrome/useGridColumnLayout.d.ts +30 -0
  238. package/dist/grid/chrome/useGridColumnLayout.js +206 -0
  239. package/dist/grid/chrome/useGridFocus.d.ts +45 -0
  240. package/dist/grid/chrome/useGridFocus.js +122 -0
  241. package/dist/grid/chrome/useGridHeaderDrag.d.ts +20 -0
  242. package/dist/grid/chrome/useGridHeaderDrag.js +37 -0
  243. package/dist/grid/chrome/useGridKeyboard.d.ts +64 -0
  244. package/dist/grid/chrome/useGridKeyboard.js +450 -0
  245. package/dist/grid/chrome/useGridPendingReconciliation.d.ts +12 -0
  246. package/dist/grid/chrome/useGridPendingReconciliation.js +32 -0
  247. package/dist/grid/chrome/useGridRailReveal.d.ts +57 -0
  248. package/dist/grid/chrome/useGridRailReveal.js +67 -0
  249. package/dist/grid/chrome/useGridRangeActions.d.ts +51 -0
  250. package/dist/grid/chrome/useGridRangeActions.js +195 -0
  251. package/dist/grid/chrome/useGridRangeGestures.d.ts +32 -0
  252. package/dist/grid/chrome/useGridRangeGestures.js +237 -0
  253. package/dist/grid/chrome/useGridRowContextMenu.d.ts +37 -0
  254. package/dist/grid/chrome/useGridRowContextMenu.js +153 -0
  255. package/dist/grid/chrome/useGridScaleStyles.d.ts +3 -0
  256. package/dist/grid/chrome/useGridScaleStyles.js +28 -0
  257. package/dist/grid/chrome/useGridScrollArea.d.ts +21 -0
  258. package/dist/grid/chrome/useGridScrollArea.js +65 -0
  259. package/dist/grid/chrome/useGridTableInteractionModel.d.ts +78 -0
  260. package/dist/grid/chrome/useGridTableInteractionModel.js +249 -0
  261. package/dist/grid/chrome/useGridTableSelection.d.ts +29 -0
  262. package/dist/grid/chrome/useGridTableSelection.js +55 -0
  263. package/dist/grid/chrome/useHeaderDragReorder.d.ts +21 -0
  264. package/dist/grid/chrome/useHeaderDragReorder.js +216 -0
  265. package/dist/grid/core/clipboard-model.d.ts +83 -0
  266. package/dist/grid/core/clipboard-model.js +291 -0
  267. package/dist/grid/core/column-values.d.ts +27 -0
  268. package/dist/grid/core/column-values.js +76 -0
  269. package/dist/grid/core/commit-model.d.ts +41 -0
  270. package/dist/grid/core/commit-model.js +3 -0
  271. package/dist/grid/core/coordinates.d.ts +48 -0
  272. package/dist/grid/core/coordinates.js +27 -0
  273. package/dist/grid/core/edge-scroll.d.ts +21 -0
  274. package/dist/grid/core/edge-scroll.js +23 -0
  275. package/dist/grid/core/edit-values.d.ts +9 -0
  276. package/dist/grid/core/edit-values.js +1 -0
  277. package/dist/grid/core/editing-controller.d.ts +60 -0
  278. package/dist/grid/core/editing-controller.js +266 -0
  279. package/dist/grid/core/editing-model.d.ts +87 -0
  280. package/dist/grid/core/editing-model.js +148 -0
  281. package/dist/grid/core/flat-rows.d.ts +35 -0
  282. package/dist/grid/core/flat-rows.js +20 -0
  283. package/dist/grid/core/grid-aria.d.ts +27 -0
  284. package/dist/grid/core/grid-aria.js +39 -0
  285. package/dist/grid/core/grid-focus.d.ts +54 -0
  286. package/dist/grid/core/grid-focus.js +148 -0
  287. package/dist/grid/core/grid-scale.d.ts +14 -0
  288. package/dist/grid/core/grid-scale.js +8 -0
  289. package/dist/grid/core/nav.d.ts +94 -0
  290. package/dist/grid/core/nav.js +92 -0
  291. package/dist/grid/core/pending-reconciliation.d.ts +53 -0
  292. package/dist/grid/core/pending-reconciliation.js +51 -0
  293. package/dist/grid/core/range-model.d.ts +25 -0
  294. package/dist/grid/core/range-model.js +59 -0
  295. package/dist/grid/core/row-window.d.ts +40 -0
  296. package/dist/grid/core/row-window.js +43 -0
  297. package/dist/grid/core/spreadsheet-operations.d.ts +101 -0
  298. package/dist/grid/core/spreadsheet-operations.js +280 -0
  299. package/dist/grid/core/useGridEditing.d.ts +46 -0
  300. package/dist/grid/core/useGridEditing.js +93 -0
  301. package/dist/grid/core/useGridRange.d.ts +20 -0
  302. package/dist/grid/core/useGridRange.js +24 -0
  303. package/dist/grid/core/value-equality.d.ts +54 -0
  304. package/dist/grid/core/value-equality.js +80 -0
  305. package/dist/grid/index.d.ts +18 -0
  306. package/dist/grid/index.js +5 -0
  307. package/dist/grid/useGridTablePrefs.d.ts +49 -0
  308. package/dist/grid/useGridTablePrefs.js +99 -0
  309. package/dist/index.d.ts +1 -1
  310. package/dist/index.js +1 -1
  311. package/dist/internal/viewport.d.ts +3 -0
  312. package/dist/internal/viewport.js +15 -0
  313. package/dist/model/column-capabilities.d.ts +3 -2
  314. package/dist/model/column-capabilities.js +28 -8
  315. package/dist/model/column-from.js +3 -0
  316. package/dist/model/column-inspect.d.ts +10 -2
  317. package/dist/model/column-inspect.js +9 -0
  318. package/dist/model/column-schema.d.ts +6 -1
  319. package/dist/model/column-state.d.ts +1 -1
  320. package/dist/model/column-types.d.ts +3 -1
  321. package/dist/model/column-types.js +1 -1
  322. package/dist/model/density.js +3 -3
  323. package/dist/model/filter-capabilities.d.ts +1 -1
  324. package/dist/model/filter-capabilities.js +1 -1
  325. package/dist/model/index.d.ts +4 -6
  326. package/dist/model/index.js +0 -1
  327. package/dist/model/preferences.d.ts +7 -7
  328. package/dist/model/preferences.js +0 -1
  329. package/dist/model/prefs-buckets.d.ts +0 -1
  330. package/dist/model/prefs-buckets.js +0 -3
  331. package/dist/model/render-count.d.ts +6 -0
  332. package/dist/model/render-count.js +11 -0
  333. package/dist/provider/ViewsProvider.d.ts +6 -2
  334. package/dist/provider/ViewsProvider.js +12 -2
  335. package/dist/provider/components.d.ts +35 -9
  336. package/dist/provider/components.js +4 -2
  337. package/dist/provider/context.d.ts +8 -4
  338. package/dist/provider/desktop.d.ts +9 -0
  339. package/dist/provider/desktop.js +22 -0
  340. package/dist/provider/menu-groups.d.ts +8 -0
  341. package/dist/provider/menu-groups.js +38 -0
  342. package/dist/provider/plain-input.d.ts +8 -0
  343. package/dist/provider/plain-input.js +5 -0
  344. package/dist/provider/ports.d.ts +22 -0
  345. package/dist/provider/ports.js +1 -0
  346. package/dist/react.d.ts +3 -2
  347. package/dist/react.js +1 -0
  348. package/dist/selection/SelectCheckbox.d.ts +3 -1
  349. package/dist/selection/SelectCheckbox.js +2 -2
  350. package/dist/selection/useCheckDragSelect.js +6 -5
  351. package/docs/contract.md +202 -72
  352. package/docs/getting-started.md +250 -0
  353. package/docs/guides/atoms.md +245 -0
  354. package/docs/guides/cells.md +302 -0
  355. package/docs/guides/columns.md +413 -0
  356. package/docs/guides/display.md +204 -0
  357. package/docs/guides/editors.md +462 -0
  358. package/docs/guides/ports.md +246 -0
  359. package/docs/guides/selection.md +270 -0
  360. package/docs/guides/the-grid.md +696 -0
  361. package/docs/guides/the-provider.md +448 -0
  362. package/docs/index.md +52 -0
  363. package/docs/install.md +9 -47
  364. package/docs/reference/cells.md +28 -0
  365. package/docs/reference/display.md +44 -0
  366. package/docs/reference/editors-chips.md +6 -0
  367. package/docs/reference/editors-date.md +6 -0
  368. package/docs/reference/editors-location.md +10 -0
  369. package/docs/reference/editors-name.md +6 -0
  370. package/docs/reference/editors-number.md +11 -0
  371. package/docs/reference/editors-open-values.md +10 -0
  372. package/docs/reference/editors-panel.md +12 -0
  373. package/docs/reference/editors-range.md +6 -0
  374. package/docs/reference/editors-relation.md +12 -0
  375. package/docs/reference/editors-select.md +9 -0
  376. package/docs/reference/editors-session.md +11 -0
  377. package/docs/reference/editors-text.md +9 -0
  378. package/docs/reference/editors-value-list.md +6 -0
  379. package/docs/reference/editors.md +5 -0
  380. package/docs/reference/field-row.md +16 -0
  381. package/docs/reference/grid.md +39 -0
  382. package/docs/reference/react.md +89 -0
  383. package/docs/reference/selection.md +33 -0
  384. package/docs/reference/views.md +622 -0
  385. package/package.json +27 -4
  386. package/skills/views/SKILL.md +20 -5
  387. package/dist/filters/types.d.ts +0 -27
  388. package/dist/filters/types.js +0 -1
  389. package/dist/model/filter-pushdown.d.ts +0 -106
  390. package/dist/model/filter-pushdown.js +0 -147
@@ -0,0 +1,33 @@
1
+ import { type FieldConventions, type FieldProvenance } from "@viewkitjs/fields";
2
+ import type { EntityWriteReceipt } from "../fields/write-target.js";
3
+ /**
4
+ * The field row's REQUESTED state: a write landed in the record
5
+ * but the provider that owns the value has not accepted it yet. The row draws
6
+ * it as a visible pending state — `data-settlement="requested"` with the
7
+ * reason on hover — never as a toast.
8
+ *
9
+ * LIFETIME mirrors the grid's overlay reconciliation. The mark is taken from
10
+ * the receipt and holds while the row prop IS that receipt's row (the panel
11
+ * publishes it as the confirmed row); the next row object to arrive — the
12
+ * refetch the write session kicks off — clears it, the same moment the grid
13
+ * drops a `requested` overlay whose value the refetched row carries. A row the
14
+ * mark has not yet been drawn against leaves it alone, so the order in which
15
+ * React flushes the publish and the completion cannot clear it unseen.
16
+ *
17
+ * The mark adjusts itself DURING render (React's own pattern for state derived
18
+ * from a prop's previous value) rather than in an effect: the row must never
19
+ * paint one frame with a stale mark, and there is no external system to sync.
20
+ */
21
+ export declare function useRowSettlement<Row>(row: Row): {
22
+ requested: boolean;
23
+ settle: (receipt: EntityWriteReceipt<Row>) => void;
24
+ };
25
+ /** The attributes a `requested` value's box carries — absent when it is not. Its title is worded
26
+ * by the host's conventions. */
27
+ export declare function settlementAttributes(requested: boolean, provenance: FieldProvenance | undefined, conventions: FieldConventions): {
28
+ "data-settlement": "requested";
29
+ title: string;
30
+ } | {
31
+ "data-settlement"?: undefined;
32
+ title?: undefined;
33
+ };
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import { useCallback, useState } from "react";
3
+ import { requestedSettlementTitle, } from "@viewkitjs/fields";
4
+ export function useRowSettlement(row) {
5
+ const [mark, setMark] = useState(null);
6
+ if (mark && row === mark.row && !mark.seen)
7
+ setMark({ row, seen: true });
8
+ else if (mark && row !== mark.row && mark.seen)
9
+ setMark(null);
10
+ const settle = useCallback((receipt) => {
11
+ setMark(receipt.settlement === "requested" ? { row: receipt.row, seen: false } : null);
12
+ }, []);
13
+ const requested = !!mark && (row === mark.row || !mark.seen);
14
+ return { requested, settle };
15
+ }
16
+ export function settlementAttributes(requested, provenance, conventions) {
17
+ return requested
18
+ ? {
19
+ "data-settlement": "requested",
20
+ title: requestedSettlementTitle(provenance, conventions),
21
+ }
22
+ : {};
23
+ }
@@ -1,7 +1,7 @@
1
1
  import { type FieldDef, type FieldPatch } from "@viewkitjs/fields";
2
- import type { RelationSource } from "./relation-source-types.js";
2
+ import type { RelationCellCreate, RelationSource } from "./relation-source-types.js";
3
3
  /**
4
- * How a field reads and writes on ONE entity's row (spec §3.5) — the three
4
+ * How a field reads and writes on ONE entity's row (docs/guides/columns.md) — the three
5
5
  * identities kept apart: the field's `key` (semantic), the binding (this row),
6
6
  * the storage column (the PATCH body's business). Declared once per entity in
7
7
  * the module's `bindings.ts`; every surface — grid column, drawer row, board
@@ -54,8 +54,13 @@ export type FieldBinding<Row, D extends FieldDef = FieldDef> = {
54
54
  /** A per-row money field: the row's currency and the registry's set — the
55
55
  * number core's unit chip is a picker only with this. */
56
56
  unit?: FieldUnit<Row>;
57
+ /** The record's country, where a phone typed without its country code is read; absent, the conventions' region
58
+ * reads it. */
59
+ region?: (row: Row) => string | null | undefined;
57
60
  /** A writable relation's candidates — static (preloaded) or remote (a search). */
58
61
  relation?: RelationSource;
62
+ /** A relation's create row: the app's form for a record not in the list, linked when it saves. */
63
+ create?: RelationCellCreate;
59
64
  /** The app's own icon name for this field, drawn by the app's AppIcon; the type's glyph when absent. */
60
65
  icon?: string;
61
66
  /** This row keeps only the values of a `multiple` field (a plain list column): its editor offers no label box.
@@ -1,4 +1,4 @@
1
- import { editedThroughField, isMultipleType, renamedName, storesRelationRef, valueTypeOf } from "@viewkitjs/fields";
1
+ import { editedThroughField, isMultipleType, renamedName, valueTypeOf, } from "@viewkitjs/fields";
2
2
  export function fieldHistory(adapter) {
3
3
  return adapter;
4
4
  }
@@ -33,16 +33,20 @@ export function checkBinding(binding) {
33
33
  }
34
34
  if (field.type === "formula" && field.ratio && !binding.ratio)
35
35
  fail("a ratio formula binds ratio — the two readers the footer sums");
36
- if (binding.labels !== undefined && !(isMultipleType(field.type) && "multiple" in field && field.multiple))
36
+ if (binding.labels !== undefined &&
37
+ !(isMultipleType(field.type) && "multiple" in field && field.multiple))
37
38
  fail("only a field holding several values keeps or drops labels");
38
39
  if (binding.ratio && !(field.type === "formula" && field.ratio))
39
40
  fail("only a ratio formula carries ratio readers");
40
41
  if (binding.write && field.type === "relation" && !binding.relation) {
41
42
  fail("a writable relation needs candidates");
42
43
  }
43
- if (binding.write && field.type === "relation" && storesRelationRef(field)) {
44
- fail("a relation that stores its kind with the id is not editable here yet — its editors commit a bare id");
45
- }
44
+ if (binding.create && field.type === "user")
45
+ fail("a member is invited, not created");
46
+ if (binding.create && field.type !== "relation")
47
+ fail("only a relation field takes a create row");
48
+ if (binding.create && !binding.write)
49
+ fail("a create row links what it creates: bind a write");
46
50
  }
47
51
  export function bindField(field, spec) {
48
52
  const binding = Object.freeze({ ...spec, field });
@@ -81,7 +85,10 @@ export function bindFields(registry, specs) {
81
85
  write: (row, commit) => {
82
86
  const value = storedRead(row);
83
87
  const shown = name.read(row);
84
- const same = empty(value) && typeof commit === "string" && !empty(shown) && commit.trim() === String(shown).trim();
88
+ const same = empty(value) &&
89
+ typeof commit === "string" &&
90
+ !empty(shown) &&
91
+ commit.trim() === String(shown).trim();
85
92
  return storedWrite(row, same ? value : commit);
86
93
  },
87
94
  }
@@ -80,13 +80,3 @@ export declare function isDisplayCurrency(value: unknown): value is DisplayCurre
80
80
  /** Narrows a stored `string` to the set — for a row read back through an
81
81
  * untyped schema client, where the column's domain is the guarantee. */
82
82
  export declare function isSupportedCurrency(code: string | null | undefined): code is SupportedCurrency;
83
- /**
84
- * An amount rendered in its OWN currency, with the right symbol and placement.
85
- *
86
- * Replaces four hand-rolled copies of `currency === "EUR" ? "€" : "$"`, which
87
- * printed every RON amount as dollars — so a €53 Vodafone bill charged as 280
88
- * RON rendered "$280.00" in the drawer, the hero and the history tab. Intl knows
89
- * both the symbol and where it goes; the catch covers a code it doesn't accept,
90
- * so a row with junk in the column still renders its number instead of throwing.
91
- */
92
- export declare function formatMoney(amount: number | null | undefined, currency: string | null | undefined, decimals?: number): string;
@@ -39,17 +39,3 @@ export function isDisplayCurrency(value) {
39
39
  export function isSupportedCurrency(code) {
40
40
  return code != null && SUPPORTED_CURRENCIES.includes(code);
41
41
  }
42
- export function formatMoney(amount, currency, decimals = 2) {
43
- const code = (currency || "EUR").toUpperCase();
44
- try {
45
- return new Intl.NumberFormat("en-US", {
46
- style: "currency",
47
- currency: code,
48
- minimumFractionDigits: decimals,
49
- maximumFractionDigits: decimals,
50
- }).format(amount ?? 0);
51
- }
52
- catch {
53
- return `${code} ${(amount ?? 0).toFixed(decimals)}`;
54
- }
55
- }
@@ -1,9 +1,9 @@
1
1
  import type { FieldType } from "@viewkitjs/fields";
2
2
  /**
3
- * WHICH TYPES OPEN AN EDITOR PANEL — the fact, without the editors.
3
+ * WHICH TYPES HAVE AN EDITOR OF THEIR OWN — the fact, without the editors.
4
4
  *
5
5
  * `EDIT_CORES` (edit-cores.ts) binds a React component to each type, so asking
6
- * it a yes/no question costs importing all five editors. The list MODEL asks
6
+ * it a yes/no question costs importing every editor. The list MODEL asks
7
7
  * exactly that question (`column-warnings.ts`) and must stay view-neutral: with
8
8
  * the question answered from `EDIT_CORES`, every module that read a column
9
9
  * capability loaded the date picker. `edit-cores.ts` proves at compile time
@@ -20,21 +20,21 @@ export declare const EDIT_CORE_TYPES: {
20
20
  readonly number: true;
21
21
  readonly percent: true;
22
22
  readonly currency: true;
23
- readonly text: false;
24
- readonly url: false;
25
- readonly domain: false;
26
- readonly email: false;
27
- readonly phone: false;
23
+ readonly text: true;
24
+ readonly url: true;
25
+ readonly domain: true;
26
+ readonly email: true;
27
+ readonly phone: true;
28
28
  readonly boolean: false;
29
29
  readonly location: true;
30
30
  readonly name: true;
31
31
  readonly actor: false;
32
- readonly rich_text: false;
32
+ readonly rich_text: true;
33
33
  readonly range: true;
34
34
  readonly lookup: false;
35
35
  readonly rollup: false;
36
36
  readonly formula: false;
37
37
  };
38
- /** Whether this type opens a panel at all — the question a host asks before it
38
+ /** Whether this type has an editor of its own — the question a host asks before it
39
39
  * wires an editor it may not need. */
40
40
  export declare function hasEditCore(type: FieldType): boolean;
@@ -9,16 +9,16 @@ export const EDIT_CORE_TYPES = {
9
9
  number: true,
10
10
  percent: true,
11
11
  currency: true,
12
- text: false,
13
- url: false,
14
- domain: false,
15
- email: false,
16
- phone: false,
12
+ text: true,
13
+ url: true,
14
+ domain: true,
15
+ email: true,
16
+ phone: true,
17
17
  boolean: false,
18
18
  location: true,
19
19
  name: true,
20
20
  actor: false,
21
- rich_text: false,
21
+ rich_text: true,
22
22
  range: true,
23
23
  lookup: false,
24
24
  rollup: false,
@@ -24,6 +24,7 @@ export type MoneyColumn<Row> = DenominatedColumn<Row> & {
24
24
  reading?: MoneyReading;
25
25
  accessor?: ((row: Row) => unknown) | null;
26
26
  aggAccessor?: (row: Row) => number | null;
27
+ editAccessor?: ((row: Row) => unknown) | null;
27
28
  };
28
29
  export declare function isMoneyOpensOn(value: unknown): value is MoneyOpensOn;
29
30
  /** The reading a declaration opens on, for this reader. */
@@ -53,6 +54,11 @@ export declare function readMoneyColumns<Row, C extends MoneyColumn<Row>>(column
53
54
  /** The reading in force on a money column; `undefined` for a column that
54
55
  * carries no money declaration. */
55
56
  export declare function moneyReadingOf<Row>(column: MoneyColumn<Row>): MoneyReading | undefined;
57
+ /** The currency a row's figure was converted FROM, when the column shows it converted: the row's own code, for a
58
+ * money column read in a currency other than Original, over a row that draws a figure (it has rates) and stores
59
+ * another currency than the reading's. Null otherwise. What every surface marks with ≈, and what a money editor
60
+ * names under the record's own amount it opens on. */
61
+ export declare function convertedFromOf<Row>(column: MoneyColumn<Row>, row: Row): string | null;
56
62
  /** The code the CELL draws for this row — a converted column's one code, a
57
63
  * per-row column's row code, `undefined` for a column with no denomination.
58
64
  * Never the `COLUMN_WIDE_CODE` sentinel. */
@@ -25,6 +25,7 @@ export function readMoneyColumn(column, reading) {
25
25
  return column;
26
26
  const next = { ...column, reading };
27
27
  const format = { ...(column.format ?? {}) };
28
+ next.editAccessor = column.editAccessor ?? money.amount;
28
29
  if (reading === ORIGINAL_READING) {
29
30
  delete format.currency;
30
31
  next.accessor = money.amount;
@@ -67,6 +68,16 @@ export function moneyReadingOf(column) {
67
68
  return undefined;
68
69
  return column.money.opensOn === "default" ? undefined : column.money.opensOn;
69
70
  }
71
+ export function convertedFromOf(column, row) {
72
+ const money = column.money;
73
+ const reading = money ? moneyReadingOf(column) : undefined;
74
+ if (!money || !reading || reading === ORIGINAL_READING)
75
+ return null;
76
+ if (typeof column.accessor?.(row) !== "number")
77
+ return null;
78
+ const code = money.code(row);
79
+ return code && code !== reading ? code : null;
80
+ }
70
81
  export function shownCodeOf(column, row) {
71
82
  if (!column.field || valueTypeOf(column.field) !== "currency")
72
83
  return undefined;
@@ -7,5 +7,11 @@ import { type DurationUnit, type FieldDef } from "@viewkitjs/fields";
7
7
  * money and plain numbers two.
8
8
  */
9
9
  export declare function numberEditDecimals(field: FieldDef): number;
10
+ /**
11
+ * The code a money field's amount is typed in when the field fixes one (`code: { fixed }`), which
12
+ * its editor draws beside the amount; `undefined` for any other field, a money field whose
13
+ * currency is per record included: its chip shows the record's own.
14
+ */
15
+ export declare function numberEditCode(field: FieldDef): string | undefined;
10
16
  /** The unit a duration field STORES (spec §8.4) — `undefined` for anything else. */
11
17
  export declare function durationUnitOf(field: FieldDef): DurationUnit | undefined;
@@ -9,6 +9,10 @@ export function numberEditDecimals(field) {
9
9
  return declared;
10
10
  return valueTypeOf(field) === "percent" ? 0 : 2;
11
11
  }
12
+ export function numberEditCode(field) {
13
+ const def = presentedDef(field);
14
+ return def.type === "currency" && "fixed" in def.code ? def.code.fixed : undefined;
15
+ }
12
16
  export function durationUnitOf(field) {
13
17
  const def = presentedDef(field);
14
18
  return def.type === "number" && def.format?.style === "duration"
@@ -17,10 +17,15 @@ export function prepareFieldWrite(binding, row, commit, surface = {}) {
17
17
  return { ok: false, reason: refused };
18
18
  const cv = surface.conventions ?? DEFAULT_CONVENTIONS;
19
19
  const message = cv.messages;
20
- const stored = binding.field.type === "phone" ? (binding.editRead ?? binding.read)(row) : undefined;
20
+ const keeps = binding.field.type === "phone" ||
21
+ binding.field.type === "url" ||
22
+ binding.field.type === "multiselect" ||
23
+ binding.field.type === "relation";
24
+ const stored = keeps ? (binding.editRead ?? binding.read)(row) : undefined;
21
25
  const accepted = acceptFieldCommit(binding.field, commit, {
22
26
  unitOptions: binding.unit?.options,
23
27
  conventions: cv,
28
+ region: binding.region?.(row),
24
29
  stored,
25
30
  });
26
31
  if (!accepted.ok)
@@ -52,3 +52,15 @@ export type RelationSource = {
52
52
  * early or asks one pointless question at the end of it. */
53
53
  pageSize?: number;
54
54
  };
55
+ /**
56
+ * A create row an app hands a relation, for "it isn't in the list yet": the row's words, and what it does. A click
57
+ * closes the picker and calls `onCreate` with the trimmed query; the app opens its own form with it, and when the
58
+ * form saves, calls `link` with the new record's id (and its kind, on a field of several kinds). The surface then
59
+ * links it to the value it was created from, as a change of its own.
60
+ */
61
+ export type RelationCellCreate = {
62
+ /** The row's words; receives the trimmed query. */
63
+ label: (query: string) => string;
64
+ /** Opens the app's form with the trimmed query; `link` links the record it saves. */
65
+ onCreate: (query: string, link: (id: string, kind?: string) => void) => void;
66
+ };
@@ -0,0 +1,50 @@
1
+ import type { FieldSettlement } from "@viewkitjs/fields";
2
+ /** A sentence that explains a value, and optionally the source it rests on. */
3
+ export type FieldNote = {
4
+ text: string;
5
+ quote?: string | null;
6
+ };
7
+ /** The authoritative result of one acknowledged entity write. A warning may
8
+ * describe a secondary/remote outcome without withdrawing the confirmed row;
9
+ * `settlement: "requested"` says the row holds the value but the provider that
10
+ * owns it has not accepted it yet — the row draws that, not a toast. */
11
+ export type EntityWriteReceipt<Row> = {
12
+ row: Row;
13
+ warning?: string;
14
+ settlement?: FieldSettlement;
15
+ };
16
+ type FieldWriteReconciliationOutcome = "saved-unconfirmed" | "uncertain";
17
+ /**
18
+ * The mutation may have reached durable storage, but no authoritative row is
19
+ * available yet. Callers must not turn that into a fabricated receipt or a
20
+ * generic "nothing saved" error; the current record has to be reconciled
21
+ * before another affected write is admitted.
22
+ */
23
+ export declare class FieldWriteReconciliationRequired extends Error {
24
+ readonly outcome: FieldWriteReconciliationOutcome;
25
+ readonly warning: string;
26
+ constructor(outcome: FieldWriteReconciliationOutcome, warning: string);
27
+ }
28
+ /** Where a commit goes. Success is explicit and carries the canonical row; a
29
+ * fulfilled `void` can never be mistaken for confirmed data. `refresh` is the
30
+ * HOST's, not the target's — a drawer invalidates its query, a page revalidates
31
+ * the router. */
32
+ export type EntityWriteTarget<Row> = {
33
+ save: (rowId: string, body: Record<string, unknown>) => Promise<EntityWriteReceipt<Row>>;
34
+ /** Singular noun for toasts ("deal"). */
35
+ noun: string;
36
+ };
37
+ /** Synchronous admission is separate from asynchronous save settlement. */
38
+ export type FieldWriteAdmission<Row> = {
39
+ accepted: false;
40
+ reason: string;
41
+ } | {
42
+ accepted: true;
43
+ completion: Promise<EntityWriteReceipt<Row>>;
44
+ };
45
+ /** A field key → the reason it is locked on this surface, or null. A host's column locks
46
+ * arrive this way, so the row never reads the list's configuration. */
47
+ export type LockedResolver = (fieldKey: string) => string | null;
48
+ /** A lifecycle-owned admission boundary independent of field permissions. */
49
+ export type FieldWriteAdmissionGuard = () => string | null;
50
+ export {};
@@ -0,0 +1,10 @@
1
+ export class FieldWriteReconciliationRequired extends Error {
2
+ outcome;
3
+ warning;
4
+ constructor(outcome, warning) {
5
+ super(warning);
6
+ this.outcome = outcome;
7
+ this.warning = warning;
8
+ this.name = "FieldWriteReconciliationRequired";
9
+ }
10
+ }
@@ -25,7 +25,6 @@ export type FilterConfigBase = {
25
25
  /** Drives the default row icon via the shared kind-to-icon map. */
26
26
  kind?: FilterKind;
27
27
  countsAsFilter?: boolean;
28
- renderAs?: "filter" | "timeScope";
29
28
  /**
30
29
  * The dimension is LISTED but not openable — it has no editor on this
31
30
  * surface yet. Used by the column-derived filter list so a table's full set
@@ -80,22 +80,14 @@ export type GridFilterEntry = {
80
80
  };
81
81
  /** Keyed by GRID column id, never by database column. */
82
82
  export type ListFilterRegistry = Record<string, GridFilterEntry>;
83
- /** One explicit answer per column for hosts that opt into complete filtering
84
- * coverage. Legacy hosts omit the map and keep the existing local/source split. */
83
+ /** A column's answer in the Filter panel (`buildColumnFilters`): the column shows greyed with
84
+ * its reason (a saved view's column with no field behind it), so a stale rule can be cleared.
85
+ * A column with no entry filters as any column does. */
85
86
  export type ListFilterCapability = {
86
- mode: "server";
87
- } | {
88
- mode: "local";
89
- } | {
90
87
  mode: "unavailable";
91
88
  reason: string;
92
89
  };
93
90
  export type ListFilterCapabilities = Record<string, ListFilterCapability>;
94
- export declare class ListFilterCapabilityError extends Error {
95
- constructor(message: string);
96
- }
97
- /** Complete coverage and exact agreement with the source registry. */
98
- export declare function validateFilterCapabilities(columnIds: readonly string[], capabilities: ListFilterCapabilities, serverFilters?: ListFilterRegistry): ListFilterCapabilities;
99
91
  /** The shorthand a list actually writes: a bare string when the grid's column id
100
92
  * and the database column differ only in name, an object when they don't. */
101
93
  export type GridFilterRegistryInput = Record<string, string | GridFilterEntry>;
@@ -109,28 +101,3 @@ export declare const RESOLVED_AT_SOURCE: GridFilterEntry;
109
101
  * the source".
110
102
  */
111
103
  export declare function defineGridFilters(input: GridFilterRegistryInput): ListFilterRegistry;
112
- /** The column ids this list can filter at the source — what the client needs in
113
- * order to split its rules, and all it needs. It never sees the mapping. */
114
- export declare function gridFilterSupport(registry: ListFilterRegistry): string[];
115
- /**
116
- * The drift check, for a one-line test per list.
117
- *
118
- * Two failures it exists to catch, both silent in production:
119
- * - a registry naming a column id that no longer exists (renamed, removed) —
120
- * the rule then never pushes down and the page quietly under-fills again;
121
- * - a NEW column landing client-side because nobody decided either way.
122
- *
123
- * The second is why `expectedLocal` is required rather than optional: a list
124
- * states which of its columns are deliberately browser-only, so adding a column
125
- * forces a decision instead of defaulting to one.
126
- */
127
- export declare function auditGridFilters({ columnIds, registry, expectedLocal, }: {
128
- columnIds: readonly string[];
129
- registry: ListFilterRegistry;
130
- /** Column ids that filter in the browser ON PURPOSE — a derived value, a
131
- * joined label, anything the query can't reach. */
132
- expectedLocal: readonly string[];
133
- }): {
134
- unknown: string[];
135
- undecided: string[];
136
- };
@@ -1,29 +1,3 @@
1
- export class ListFilterCapabilityError extends Error {
2
- constructor(message) {
3
- super(message);
4
- this.name = "ListFilterCapabilityError";
5
- }
6
- }
7
- export function validateFilterCapabilities(columnIds, capabilities, serverFilters) {
8
- const columns = new Set(columnIds);
9
- const unknown = Object.keys(capabilities).filter((id) => !columns.has(id));
10
- const missing = columnIds.filter((id) => !capabilities[id]);
11
- if (unknown.length || missing.length) {
12
- throw new ListFilterCapabilityError(`filter capability coverage mismatch (missing: ${missing.join(", ") || "none"}; unknown: ${unknown.join(", ") || "none"})`);
13
- }
14
- const registryIds = new Set(Object.keys(serverFilters ?? {}));
15
- const missingSource = columnIds.filter((id) => capabilities[id]?.mode === "server" && !registryIds.has(id));
16
- const unexpectedSource = [...registryIds].filter((id) => !columns.has(id) || capabilities[id]?.mode !== "server");
17
- if (missingSource.length || unexpectedSource.length) {
18
- throw new ListFilterCapabilityError(`server filter registry mismatch (missing: ${missingSource.join(", ") || "none"}; unexpected: ${unexpectedSource.join(", ") || "none"})`);
19
- }
20
- for (const [id, capability] of Object.entries(capabilities)) {
21
- if (capability.mode === "unavailable" && !capability.reason.trim()) {
22
- throw new ListFilterCapabilityError(`unavailable filter capability "${id}" needs a reason`);
23
- }
24
- }
25
- return capabilities;
26
- }
27
1
  export const RESOLVED_AT_SOURCE = { resolved: true };
28
2
  export function defineGridFilters(input) {
29
3
  const out = {};
@@ -32,15 +6,3 @@ export function defineGridFilters(input) {
32
6
  }
33
7
  return out;
34
8
  }
35
- export function gridFilterSupport(registry) {
36
- return Object.keys(registry);
37
- }
38
- export function auditGridFilters({ columnIds, registry, expectedLocal, }) {
39
- const known = new Set(columnIds);
40
- const declared = new Set(Object.keys(registry));
41
- const intended = new Set(expectedLocal);
42
- return {
43
- unknown: Object.keys(registry).filter((id) => !known.has(id)),
44
- undecided: columnIds.filter((id) => !declared.has(id) && !intended.has(id)),
45
- };
46
- }
@@ -0,0 +1,11 @@
1
+ import type { ListColumnsConfig } from "../../model/column-state.js";
2
+ /**
3
+ * "+ ADD COLUMN" ON EVERY GRID: the header row's last cell, for anyone who reads the list. It lists the columns
4
+ * this view hides and can show, and shows the one picked: a choice about the reader's own view, never a change
5
+ * to a field, so it needs no admin and no server. Where a host mounts its own field editor, the header draws
6
+ * the host's instead (a relation's ›, Create new field), in the same look. Hiding is a column's own menu, the
7
+ * order is dragging the header, and the whole list is the host's column list.
8
+ */
9
+ export declare function GridAddColumn({ columns }: {
10
+ columns: ListColumnsConfig;
11
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useCallback, useState } from "react";
4
+ import { useViews } from "../../provider/context.js";
5
+ import { cx } from "../../internal/cx.js";
6
+ export function GridAddColumn({ columns }) {
7
+ const [open, setOpen] = useState(false);
8
+ const [query, setQuery] = useState("");
9
+ const [anchor, setAnchor] = useState(null);
10
+ const { atoms, components, icons, messages } = useViews();
11
+ const { Popover, Command } = components;
12
+ const { List, RowContent } = atoms;
13
+ const Add = icons.add;
14
+ const wanted = query.trim().toLowerCase();
15
+ const rows = columns.items.filter((item) => item.hidden && !item.fixed && item.label.toLowerCase().includes(wanted));
16
+ const close = (reason = "none") => {
17
+ setOpen(false);
18
+ setQuery("");
19
+ if (reason !== "outside-press" && reason !== "focus-out")
20
+ anchor?.focus({ preventScroll: true });
21
+ };
22
+ const focusSearch = useCallback((el) => el?.focus({ preventScroll: true }), []);
23
+ return (_jsxs(_Fragment, { children: [_jsxs("button", { ref: setAnchor, type: "button", tabIndex: -1, "aria-haspopup": "dialog", "aria-expanded": open, onClick: () => (open ? close() : setOpen(true)), className: cx("flex h-full w-(--vk-tail-w) min-w-0 max-w-full flex-none items-center gap-1.5 px-(--vk-px) text-(length:--vk-head-text) hover:bg-(color:--vk-hovered)", open ? "bg-(color:--vk-pressed) text-(color:--vk-fg)" : "text-(color:--vk-fg-subtle)"), children: [_jsx(Add, { className: "h-(--vk-head-glyph) w-(--vk-head-glyph) shrink-0 opacity-70" }), _jsx("span", { className: "truncate", children: messages({ key: "views.grid.add-column" }) })] }), _jsx(Popover, { open: open, onOpenChange: (next, details) => (next ? setOpen(true) : close(details?.reason)), anchor: anchor, side: "bottom", align: "end", sideOffset: 4, chrome: "menu", initialFocus: false, className: "flex w-60 flex-col", onOutsidePress: (event) => (anchor?.contains(event.target) ? false : undefined), children: _jsxs(Command.Root, { shouldFilter: false, loop: true, label: messages({ key: "views.menus.add-column-search" }), children: [_jsx("div", { className: "flex h-10 shrink-0 items-center border-b border-(color:--vk-border)", children: _jsx(Command.Input, { chrome: "bare", value: query, onValueChange: setQuery, placeholder: messages({ key: "views.menus.add-column-search" }), ref: focusSearch, className: "h-full min-w-0 flex-1 bg-transparent px-3.5 text-base text-(color:--vk-fg) outline-hidden placeholder:text-(color:--vk-fg-subtlest) md:text-sm" }) }), _jsx(Command.List, { className: "max-h-80 min-h-0 overflow-y-auto overscroll-contain", children: _jsx(Command.Group, { className: "p-0", children: _jsxs(List, { children: [rows.map((item) => (_jsx(Command.Item, { value: item.id, onSelect: () => {
24
+ columns.onToggleHidden(item.id, false);
25
+ close("item-press");
26
+ }, children: _jsx(RowContent, { label: item.label, leading: _jsx("span", { className: "flex size-4 shrink-0 items-center justify-center text-(color:--vk-fg-subtle)", children: item.icon }) }) }, item.id))), rows.length === 0 && (_jsx("p", { className: "px-2 py-2 text-sm text-(color:--vk-fg-subtle)", children: wanted
27
+ ? messages({ key: "views.menus.add-column-no-match", values: { query: query.trim() } })
28
+ : messages({ key: "views.menus.add-column-all-shown" }) }))] }) }) })] }) })] }));
29
+ }
@@ -0,0 +1,31 @@
1
+ import { type MouseEvent as ReactMouseEvent, type ReactElement, type Ref } from "react";
2
+ import type { ListAggregateKind, ListColumn } from "../../model/column-schema.js";
3
+ /** What the menu sets on the footer cell it opens from. */
4
+ type TriggerProps = {
5
+ ref?: Ref<HTMLElement>;
6
+ onClick?: (event: ReactMouseEvent<HTMLElement>) => void;
7
+ role?: "button" | "gridcell";
8
+ "aria-haspopup"?: "dialog";
9
+ "aria-expanded"?: boolean;
10
+ };
11
+ /**
12
+ * The footer cell's Calculate popover — pick the aggregate function for one
13
+ * column (numeric columns get sum/avg/min/max/count; everything else
14
+ * count/filled/unique; a source list's footer offers what the database answers,
15
+ * handed in as `options`). The trigger is the WHOLE footer cell, passed as the
16
+ * child: the map's popover anchors on it, in its slot; selection commits
17
+ * through the host's persisted `gridAggregates` pref.
18
+ */
19
+ export declare function GridAggregateMenu<Row>({ column, options, current, onChange, align, children, }: {
20
+ column: ListColumn<Row>;
21
+ /** The picks to offer — a source list's footer offers what the database
22
+ * answers (`aggregateOptions(column, sourced)`). Default: the column's own. */
23
+ options?: ListAggregateKind[];
24
+ current: ListAggregateKind;
25
+ onChange: (kind: ListAggregateKind) => void;
26
+ /** Match the column's alignment so the popover hugs the value. */
27
+ align: "start" | "center" | "end";
28
+ /** The footer cell. The menu sets its `ref`, so it must carry none of its own. */
29
+ children: ReactElement<TriggerProps>;
30
+ }): import("react/jsx-runtime").JSX.Element;
31
+ export {};
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { cloneElement, useState, } from "react";
4
+ import { aggregateLabel, aggregateOptions } from "../../model/aggregates.js";
5
+ import { useViews } from "../../provider/context.js";
6
+ import { gridMenuArrows, useGridMenuFocus } from "./grid-menu-focus.js";
7
+ export function GridAggregateMenu({ column, options, current, onChange, align, children, }) {
8
+ const [open, setOpen] = useState(false);
9
+ const [anchor, setAnchor] = useState(null);
10
+ useGridMenuFocus(open, anchor);
11
+ const { atoms, components, messages } = useViews();
12
+ const { Popover } = components;
13
+ const { List, Row } = atoms;
14
+ const trigger = cloneElement(children, {
15
+ ref: setAnchor,
16
+ onClick: (event) => {
17
+ children.props.onClick?.(event);
18
+ setOpen((was) => !was);
19
+ },
20
+ role: children.props.role ?? "button",
21
+ "aria-haspopup": "dialog",
22
+ "aria-expanded": open,
23
+ });
24
+ return (_jsxs(_Fragment, { children: [trigger, _jsx(Popover, { open: open, onOpenChange: setOpen, anchor: anchor, side: "bottom", align: align, sideOffset: 4, chrome: "menu", panelData: { "data-slot": "vk-grid-aggregate-menu" }, className: "w-40", onOutsidePress: (event) => (anchor?.contains(event.target) ? false : undefined), children: _jsx("div", { onKeyDown: gridMenuArrows, children: _jsx(List, { children: (options ?? aggregateOptions(column)).map((kind) => (_jsx(Row, { chosen: kind === current, label: aggregateLabel(kind, messages), onClick: () => {
25
+ setOpen(false);
26
+ if (kind !== current)
27
+ onChange(kind);
28
+ } }, kind))) }) }) })] }));
29
+ }