@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,212 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { createContext, useCallback, useContext, useLayoutEffect, useRef, useState, useSyncExternalStore, } from "react";
4
+ import { flushSync } from "react-dom";
5
+ import { GRID_WINDOW_FALLBACK_ROWS, gridGroupRange, gridRowSegments, } from "../core/row-window.js";
6
+ import { findGridScrollOwner, gridVisibleBox } from "./grid-scroll-owner.js";
7
+ const sameRange = (a, b) => a === b || (a != null && b != null && a.start === b.start && a.end === b.end);
8
+ export function createGridRowWindowStore() {
9
+ const snapshots = new Map();
10
+ const listeners = new Map();
11
+ let revealed = null;
12
+ const notify = (groupKey) => {
13
+ for (const listener of listeners.get(groupKey) ?? [])
14
+ listener();
15
+ };
16
+ const get = (groupKey) => {
17
+ let snapshot = snapshots.get(groupKey);
18
+ if (!snapshot) {
19
+ snapshot = { range: undefined, revealed: revealed?.groupKey === groupKey ? revealed.index : null };
20
+ snapshots.set(groupKey, snapshot);
21
+ }
22
+ return snapshot;
23
+ };
24
+ const put = (groupKey, next) => {
25
+ const current = get(groupKey);
26
+ if (sameRange(current.range, next.range) && current.revealed === next.revealed)
27
+ return;
28
+ snapshots.set(groupKey, next);
29
+ notify(groupKey);
30
+ };
31
+ return {
32
+ get,
33
+ setRanges(ranges) {
34
+ for (const [groupKey, range] of ranges) {
35
+ let kept = get(groupKey).revealed;
36
+ if (kept != null && range && kept >= range.start && kept < range.end) {
37
+ kept = null;
38
+ revealed = null;
39
+ }
40
+ put(groupKey, { range, revealed: kept });
41
+ }
42
+ },
43
+ reveal(place) {
44
+ const last = revealed;
45
+ if (place)
46
+ get(place.groupKey);
47
+ revealed = place;
48
+ if (last && last.groupKey !== place?.groupKey)
49
+ put(last.groupKey, { ...get(last.groupKey), revealed: null });
50
+ if (place)
51
+ put(place.groupKey, { ...get(place.groupKey), revealed: place.index });
52
+ },
53
+ subscribe(groupKey, listener) {
54
+ let set = listeners.get(groupKey);
55
+ if (!set)
56
+ listeners.set(groupKey, (set = new Set()));
57
+ set.add(listener);
58
+ return () => {
59
+ set.delete(listener);
60
+ };
61
+ },
62
+ };
63
+ }
64
+ export const GridRowWindowContext = createContext(null);
65
+ const EVERY_ROW = { range: { start: 0, end: Number.MAX_SAFE_INTEGER }, revealed: null };
66
+ const NO_STORE = () => () => { };
67
+ export function useGridGroupWindow(groupKey) {
68
+ const store = useContext(GridRowWindowContext);
69
+ const subscribe = useCallback((listener) => (store ? store.subscribe(groupKey, listener) : NO_STORE()), [store, groupKey]);
70
+ const read = () => (store ? store.get(groupKey) : EVERY_ROW);
71
+ return useSyncExternalStore(subscribe, read, read);
72
+ }
73
+ export function fallbackRange(count, collapsed) {
74
+ if (collapsed || count === 0)
75
+ return null;
76
+ return { start: 0, end: Math.min(count, GRID_WINDOW_FALLBACK_ROWS) };
77
+ }
78
+ const ROWS_SELECTOR = '[data-slot="vk-grid-rows"]';
79
+ export function useGridRowWindow({ rootRef, flat, rowHeight, }) {
80
+ const flatRef = useRef(flat);
81
+ useLayoutEffect(() => {
82
+ flatRef.current = flat;
83
+ }, [flat]);
84
+ const [store] = useState(createGridRowWindowStore);
85
+ const regionsRef = useRef(null);
86
+ const measuredRowRef = useRef(null);
87
+ const content = useCallback(() => {
88
+ const area = rootRef.current?.querySelector('[data-slot="vk-grid-scroll"]');
89
+ return area?.firstElementChild ?? null;
90
+ }, [rootRef]);
91
+ const ranges = useCallback(() => {
92
+ const out = new Map();
93
+ const regions = regionsRef.current;
94
+ const root = rootRef.current;
95
+ const box = content();
96
+ if (!regions || !root || !box) {
97
+ for (const s of flatRef.current.sections)
98
+ out.set(s.groupKey, fallbackRange(s.items.length, s.collapsed));
99
+ return out;
100
+ }
101
+ const top = box.getBoundingClientRect().top;
102
+ const visible = gridVisibleBox(root, findGridScrollOwner(box));
103
+ const view = { top: visible.top - top, bottom: visible.bottom - top };
104
+ if (!Number.isFinite(view.top) || !Number.isFinite(view.bottom)) {
105
+ for (const s of flatRef.current.sections)
106
+ out.set(s.groupKey, fallbackRange(s.items.length, s.collapsed));
107
+ return out;
108
+ }
109
+ const height = measuredRowRef.current ?? rowHeight;
110
+ for (const s of flatRef.current.sections) {
111
+ const region = regions.get(s.groupKey);
112
+ out.set(s.groupKey, region ? gridGroupRange({ view, region, rowHeight: height, count: s.items.length }) : null);
113
+ }
114
+ return out;
115
+ }, [content, rootRef, rowHeight]);
116
+ const measure = useCallback(() => {
117
+ const box = content();
118
+ if (!box)
119
+ return;
120
+ const outer = box.getBoundingClientRect();
121
+ if (outer.height <= 0) {
122
+ regionsRef.current = null;
123
+ return;
124
+ }
125
+ const regions = new Map();
126
+ for (const el of box.querySelectorAll(ROWS_SELECTOR)) {
127
+ const key = el.getAttribute("data-group-key");
128
+ if (key == null)
129
+ continue;
130
+ const rect = el.getBoundingClientRect();
131
+ const group = el.closest('[data-slot="vk-grid-group"]')?.getBoundingClientRect();
132
+ const region = {
133
+ top: rect.top - outer.top,
134
+ bottom: Math.min(rect.bottom, group?.bottom ?? rect.bottom) - outer.top,
135
+ };
136
+ if (!Number.isFinite(region.top) || !Number.isFinite(region.bottom)) {
137
+ regionsRef.current = null;
138
+ return;
139
+ }
140
+ regions.set(key, region);
141
+ }
142
+ regionsRef.current = regions;
143
+ const row = box.querySelector('[data-slot="vk-grid-row"]')?.getBoundingClientRect().height;
144
+ measuredRowRef.current = row != null && row > 0 ? row : null;
145
+ }, [content]);
146
+ useLayoutEffect(() => {
147
+ measure();
148
+ store.setRanges(ranges());
149
+ }, [flat, measure, ranges, store]);
150
+ useLayoutEffect(() => {
151
+ const area = rootRef.current?.querySelector('[data-slot="vk-grid-scroll"]');
152
+ const box = content();
153
+ if (!area || !box)
154
+ return;
155
+ const redraw = () => {
156
+ const next = ranges();
157
+ for (const [groupKey, range] of next) {
158
+ if (!sameRange(store.get(groupKey).range, range)) {
159
+ flushSync(() => store.setRanges(next));
160
+ return;
161
+ }
162
+ }
163
+ };
164
+ const onScroll = () => redraw();
165
+ document.addEventListener("scroll", onScroll, { capture: true, passive: true });
166
+ window.addEventListener("resize", onScroll, { passive: true });
167
+ let observer = null;
168
+ if (typeof ResizeObserver !== "undefined") {
169
+ observer = new ResizeObserver(() => {
170
+ measure();
171
+ redraw();
172
+ });
173
+ observer.observe(area);
174
+ observer.observe(box);
175
+ }
176
+ return () => {
177
+ document.removeEventListener("scroll", onScroll, { capture: true });
178
+ window.removeEventListener("resize", onScroll);
179
+ observer?.disconnect();
180
+ };
181
+ }, [content, measure, ranges, rootRef, store]);
182
+ const revealRow = useCallback((rowKey, columnId) => {
183
+ const place = flatRef.current.place.get(rowKey);
184
+ if (!place)
185
+ return;
186
+ flushSync(() => store.reveal(place));
187
+ const row = rootRef.current?.querySelector(`[data-row-id="${CSS.escape(rowKey)}"]`);
188
+ if (!row)
189
+ return;
190
+ const cell = columnId ? (row.querySelector(`[data-col-id="${CSS.escape(columnId)}"]`) ?? row) : row;
191
+ cell.scrollIntoView({ block: "nearest", inline: "nearest" });
192
+ }, [rootRef, store]);
193
+ return { store, revealRow };
194
+ }
195
+ export const GRID_GAP_LINES = "repeating-linear-gradient(to bottom, transparent 0 calc(var(--vk-row-h) - 1px), var(--vk-border-subtle) calc(var(--vk-row-h) - 1px) var(--vk-row-h))";
196
+ export function GridWindowRows({ groupKey, items, collapsed, kept, renderRow, }) {
197
+ const snapshot = useGridGroupWindow(groupKey);
198
+ const range = snapshot.range === undefined ? fallbackRange(items.length, collapsed) : snapshot.range;
199
+ const { revealed } = snapshot;
200
+ const segments = gridRowSegments(items.length, range, revealed == null ? kept : [...kept, revealed]);
201
+ const children = [];
202
+ for (const segment of segments) {
203
+ if (segment.kind === "gap") {
204
+ children.push(_jsx("div", { "data-slot": "vk-grid-gap", "aria-hidden": true, style: { height: `calc(var(--vk-row-h) * ${segment.end - segment.start})`, background: GRID_GAP_LINES } }, `gap-${segment.end}`));
205
+ continue;
206
+ }
207
+ for (let index = segment.start; index < segment.end; index++) {
208
+ children.push(renderRow(items[index], index, items, groupKey));
209
+ }
210
+ }
211
+ return (_jsx("div", { "data-slot": "vk-grid-rows", "data-group-key": groupKey, children: children }));
212
+ }
@@ -0,0 +1,38 @@
1
+ import type { GridCellPos } from "../core/coordinates.js";
2
+ import { type GridBox } from "../core/edge-scroll.js";
3
+ /**
4
+ * The element that scrolls the grid vertically where `from` sits: the nearest ancestor whose `overflow-y` scrolls
5
+ * and whose content is taller than its box, else the page's scrolling element. That is the grid's own area
6
+ * (`data-slot="vk-grid-scroll"`), or the page where an app gives the grid no height. An ancestor that only scrolls
7
+ * sideways (`overflow-y: clip`) is skipped.
8
+ */
9
+ export declare function findGridScrollOwner(from: Element): HTMLElement;
10
+ /**
11
+ * The box the grid is visible in: the grid's own rect, inside its scroll owner's (the window for the page), inside the
12
+ * window. A drag's hit-test is clamped into it, and its edges are where a drag scrolls.
13
+ */
14
+ export declare function gridVisibleBox(root: HTMLElement, owner: HTMLElement): GridBox;
15
+ /**
16
+ * How far a drag at `y` scrolls `owner` this frame: `gridEdgeScrollStep` against the box the grid is visible in, and
17
+ * nothing towards an edge the grid already shows its end at. Where the owner is the grid's own area (inside the
18
+ * frame), the frame ends where the area does, so the grid's end is how far the area can still scroll. Where it is the
19
+ * page (a grid given no height), it is where the frame's box stops, so a drag over the last row doesn't scroll the
20
+ * page on past the grid.
21
+ */
22
+ export declare function gridDragScrollStep(root: HTMLElement, owner: HTMLElement, y: number): number;
23
+ /**
24
+ * The cell of `root` at the point clamped into `box`: its row KEY and, where the point is on a cell, its column.
25
+ * A point on something that isn't a row (the header stuck to the top, a group's header) steps toward the box's middle
26
+ * until it reaches a row, so a drag held past an edge always has the row at that edge. Null when the grid shows none.
27
+ */
28
+ export declare function gridHitAtPoint(root: HTMLElement, x: number, y: number, box: GridBox): {
29
+ rowId: string;
30
+ columnId: string | null;
31
+ } | null;
32
+ /**
33
+ * THE one reveal: every path that brings a cell into view (the keyboard, an undo or a redo, a paste's selection)
34
+ * comes through here. A row the page holds scrolls its cell into view; a row it doesn't (only the rows on screen are
35
+ * drawn) goes to `revealRow` with its row KEY and the column, the table's row window (`grid-row-window.tsx`), which
36
+ * draws the row in its place and scrolls its cell into view.
37
+ */
38
+ export declare function revealGridCell(root: HTMLElement | null, pos: GridCellPos, behavior: ScrollBehavior, revealRow?: (rowKey: string, columnId?: string) => void): void;
@@ -0,0 +1,75 @@
1
+ "use client";
2
+ import { clampIntoBox, gridEdgeScrollStep, intersectBoxes } from "../core/edge-scroll.js";
3
+ const HIT_STEP_PX = 8;
4
+ const SCROLLS_Y = new Set(["auto", "scroll", "overlay"]);
5
+ export function findGridScrollOwner(from) {
6
+ for (let el = from.parentElement; el; el = el.parentElement) {
7
+ if (el === document.body || el === document.documentElement)
8
+ break;
9
+ if (SCROLLS_Y.has(getComputedStyle(el).overflowY) && el.scrollHeight > el.clientHeight)
10
+ return el;
11
+ }
12
+ return (document.scrollingElement ?? document.documentElement);
13
+ }
14
+ function windowBox() {
15
+ return { top: 0, left: 0, bottom: window.innerHeight, right: window.innerWidth };
16
+ }
17
+ function rectBox(el) {
18
+ const rect = el.getBoundingClientRect();
19
+ return { top: rect.top, bottom: rect.bottom, left: rect.left, right: rect.right };
20
+ }
21
+ function ownerBox(owner) {
22
+ const page = owner === document.scrollingElement || owner === document.documentElement;
23
+ return page ? windowBox() : intersectBoxes(rectBox(owner), windowBox());
24
+ }
25
+ export function gridVisibleBox(root, owner) {
26
+ return intersectBoxes(rectBox(root), ownerBox(owner));
27
+ }
28
+ export function gridDragScrollStep(root, owner, y) {
29
+ const step = gridEdgeScrollStep(y, gridVisibleBox(root, owner));
30
+ if (step === 0)
31
+ return 0;
32
+ if (root.contains(owner)) {
33
+ if (step < 0 && owner.scrollTop <= 0)
34
+ return 0;
35
+ if (step > 0 && owner.scrollTop >= owner.scrollHeight - owner.clientHeight)
36
+ return 0;
37
+ return step;
38
+ }
39
+ const grid = rectBox(root);
40
+ const box = ownerBox(owner);
41
+ if (step < 0 && grid.top >= box.top)
42
+ return 0;
43
+ if (step > 0 && grid.bottom <= box.bottom)
44
+ return 0;
45
+ return step;
46
+ }
47
+ export function gridHitAtPoint(root, x, y, box) {
48
+ if (box.bottom <= box.top || box.right <= box.left)
49
+ return null;
50
+ const point = clampIntoBox(x, y, box);
51
+ const middle = (box.top + box.bottom) / 2;
52
+ const step = point.y <= middle ? HIT_STEP_PX : -HIT_STEP_PX;
53
+ const reach = (box.bottom - box.top) / 2;
54
+ for (let moved = 0; moved <= reach; moved += HIT_STEP_PX) {
55
+ const element = document.elementFromPoint?.(point.x, point.y + Math.sign(step) * moved);
56
+ const row = element?.closest?.("[data-row-id]");
57
+ if (row && root.contains(row)) {
58
+ const cell = element?.closest?.("[data-col-id]");
59
+ return {
60
+ rowId: row.getAttribute("data-row-id"),
61
+ columnId: cell && row.contains(cell) ? cell.getAttribute("data-col-id") : null,
62
+ };
63
+ }
64
+ }
65
+ return null;
66
+ }
67
+ export function revealGridCell(root, pos, behavior, revealRow) {
68
+ const row = root?.querySelector(`[data-row-id="${CSS.escape(pos.rowId)}"]`);
69
+ if (!row) {
70
+ revealRow?.(pos.rowId, pos.columnId);
71
+ return;
72
+ }
73
+ const cell = row.querySelector(`[data-col-id="${CSS.escape(pos.columnId)}"]`) ?? row;
74
+ cell.scrollIntoView({ block: "nearest", inline: "nearest", behavior });
75
+ }
@@ -0,0 +1,40 @@
1
+ export declare const GRID_BLEED = "-mx-(--vk-gutter,0px)";
2
+ export declare const GRID_ROW_PAD = "px-(--vk-gutter,0px)";
3
+ export declare const GRID_CONTENT_PAD = "pl-[calc(var(--vk-gutter,0px)+var(--vk-indent,0px))] pr-(--vk-gutter,0px)";
4
+ /** A part that paints the ground it sits on — the editing cell, a frozen footer cell, the rail's
5
+ * checkboxes, an outlined row action, the header's drag ghost. The page's ground, without
6
+ * re-declaring its states: every host the grid mounts in carries the page's own. */
7
+ export declare const GRID_GROUND = "bg-(color:--vk-ground)";
8
+ /** The keyboard's mark on a part that isn't a data cell (a column name, a footer cell, a bar's name): the cells'
9
+ * brand ring, inset, only for focus a key put there, so a click draws nothing new. */
10
+ export declare const GRID_CHROME_FOCUS = "outline-none focus-visible:shadow-[inset_0_0_0_2px_var(--vk-brand)]";
11
+ /** THE endFill-tail ⋯ button look: each row's menu button. Its hover is the caller's: neutral, or
12
+ * brand on a selected row. */
13
+ export declare const GRID_TAIL_BUTTON_BASE = "inline-flex h-8 w-9 items-center justify-center rounded-sm text-(color:--vk-fg-subtle) hover:text-(color:--vk-fg)";
14
+ export declare const GRID_HEADER_BG = "bg-[linear-gradient(to_bottom,var(--vk-ground)_calc(100%-2px),transparent_calc(100%-2px))]";
15
+ /**
16
+ * A FROZEN header cell's OWN paint — the same band, alpha-gated on
17
+ * `--vk-scrolled` (0/1, from the scroll area), like the frozen z-tier and the
18
+ * head fade. It needs to be opaque only while cells pass underneath it; at rest
19
+ * the strip's own GRID_HEADER_BG already covers the band.
20
+ *
21
+ * Load-bearing, not tidiness: painting it unconditionally fills GRID_HEADER_BG's
22
+ * deliberate 2px transparent sliver — the ONLY place the FIRST row's selection
23
+ * ring can draw its top edge (no row above it, and the band outranks every
24
+ * cell). Symptom: pin the identity columns, edit the first row's title, and the
25
+ * ring's top edge is missing.
26
+ */
27
+ export declare const GRID_HEADER_BG_FROZEN = "bg-[linear-gradient(to_bottom,color-mix(in_oklab,_var(--vk-ground)_calc(var(--vk-scrolled,0)*100%),_transparent)_calc(100%-2px),transparent_calc(100%-2px))]";
28
+ /**
29
+ * The frozen cell's hover tint. GRID_HEADER_BG is a background-IMAGE and images
30
+ * paint over the background-COLOR — so the plain `hover:bg-(color:--vk-hovered)` the other
31
+ * header cells use is completely hidden underneath it, except in the 2px
32
+ * transparent sliver.
33
+ *
34
+ * So the hover tint has to be an image too, stacked ABOVE the same base — first
35
+ * layer wins in a background-image list. Non-frozen cells keep the simple
36
+ * colour version; only frozen cells need this. The base layer carries the same
37
+ * `--vk-scrolled` gate as GRID_HEADER_BG_FROZEN, so hovering a header at rest
38
+ * can't reintroduce the opacity the sliver depends on.
39
+ */
40
+ export declare const GRID_HEADER_BG_FROZEN_HOVER = "hover:bg-[linear-gradient(var(--vk-hovered),var(--vk-hovered)),linear-gradient(to_bottom,color-mix(in_oklab,_var(--vk-ground)_calc(var(--vk-scrolled,0)*100%),_transparent)_calc(100%-2px),transparent_calc(100%-2px))]";
@@ -0,0 +1,9 @@
1
+ export const GRID_BLEED = "-mx-(--vk-gutter,0px)";
2
+ export const GRID_ROW_PAD = "px-(--vk-gutter,0px)";
3
+ export const GRID_CONTENT_PAD = "pl-[calc(var(--vk-gutter,0px)+var(--vk-indent,0px))] pr-(--vk-gutter,0px)";
4
+ export const GRID_GROUND = "bg-(color:--vk-ground)";
5
+ export const GRID_CHROME_FOCUS = "outline-none focus-visible:shadow-[inset_0_0_0_2px_var(--vk-brand)]";
6
+ export const GRID_TAIL_BUTTON_BASE = "inline-flex h-8 w-9 items-center justify-center rounded-sm text-(color:--vk-fg-subtle) hover:text-(color:--vk-fg)";
7
+ export const GRID_HEADER_BG = "bg-[linear-gradient(to_bottom,var(--vk-ground)_calc(100%-2px),transparent_calc(100%-2px))]";
8
+ export const GRID_HEADER_BG_FROZEN = "bg-[linear-gradient(to_bottom,color-mix(in_oklab,_var(--vk-ground)_calc(var(--vk-scrolled,0)*100%),_transparent)_calc(100%-2px),transparent_calc(100%-2px))]";
9
+ export const GRID_HEADER_BG_FROZEN_HOVER = "hover:bg-[linear-gradient(var(--vk-hovered),var(--vk-hovered)),linear-gradient(to_bottom,color-mix(in_oklab,_var(--vk-ground)_calc(var(--vk-scrolled,0)*100%),_transparent)_calc(100%-2px),transparent_calc(100%-2px))]";
@@ -0,0 +1,172 @@
1
+ import type { ReactNode } from "react";
2
+ import type { DisplayCurrency } from "../../fields/currency.js";
3
+ import type { ViewsRowMenuItem } from "../../atoms/types.js";
4
+ import type { FieldMenus } from "../../fields/menus.js";
5
+ import type { ListGroup } from "../../grouping/types.js";
6
+ import type { ListSelectionConfig } from "../../selection/types.js";
7
+ import type { ListSettingsConfig } from "../../model/column-capabilities.js";
8
+ import type { ListAggregateKind, ListCellAction, ListColumn, ListOptionColorOverrides, ListRelationValue, ListSelectColor } from "../../model/column-schema.js";
9
+ import type { ListDateStyle, ListDateStyleOverrides, ListDurationStyle, ListDurationStyleOverrides, ListNumberFormatOverrides, ListPercentDisplayOverrides, ListShowTimeOverrides } from "../../model/column-format.js";
10
+ import type { ListColumnState, ListColumnsConfig } from "../../model/column-state.js";
11
+ import type { PercentDisplay } from "@viewkitjs/fields";
12
+ import type { ListGroupSummaryPart } from "../../model/preferences.js";
13
+ import type { ListRowIconAccessor } from "../../model/row-icon.js";
14
+ import type { GridCellCommitFn, GridCellsCommitFn } from "../core/commit-model.js";
15
+ import type { GridGroupByState, GridSortState } from "./GridColumnMenu.js";
16
+ import type { GridGroupSortOption } from "./GridGroupMenu.js";
17
+ /** A group count's noun, singular and plural ("company", "companies"): "2 companies". None: a bare
18
+ * count. */
19
+ export type GroupCountNoun = {
20
+ one: string;
21
+ other: string;
22
+ };
23
+ /** One figure a group header can show: the part that turns it on, its column's header (what the menu and
24
+ * the header call it), and how it draws for a group. */
25
+ export type GridGroupFigure<Row> = {
26
+ part: ListGroupSummaryPart;
27
+ label: ReactNode;
28
+ render: (group: ListGroup<Row>) => ReactNode;
29
+ };
30
+ /** A view's identity: when it changes, the whole body is replaced, and the grid shows its wait for
31
+ * one commit first. */
32
+ type GridTransitionKey = string | number | boolean | null | undefined;
33
+ export type GridTableProps<Row> = {
34
+ /** View/filter identity that replaces the whole collection body. */
35
+ transitionKey?: GridTransitionKey;
36
+ transitionPending?: boolean;
37
+ transitionLabel?: string;
38
+ groups: ListGroup<Row>[];
39
+ grouped: boolean;
40
+ getRowId: (row: Row) => string;
41
+ columns: ListColumn<Row>[];
42
+ isCollapsed?: (key: string) => boolean;
43
+ onToggleGroup?: (key: string) => void;
44
+ renderGroupLabel?: (group: ListGroup<Row>) => ReactNode;
45
+ /** Hide a group in the view, from its band's menu. Absent where a
46
+ * list cannot hide one. */
47
+ onHideGroup?: (key: string) => void;
48
+ /** Source-paged group continuation, rendered after this group's loaded rows. */
49
+ renderGroupFooter?: (group: ListGroup<Row>) => ReactNode;
50
+ renderAggregate?: (columnId: string, group: ListGroup<Row>) => ReactNode;
51
+ countOf?: (group: ListGroup<Row>) => number;
52
+ onOpenRow: (row: Row) => void;
53
+ /** Warm the row detail only from an actual primary pointer intent. */
54
+ onPrefetchRow?: (row: Row) => void;
55
+ /**
56
+ * Open the entity a `relation` cell points at.
57
+ *
58
+ * ONE handler for the whole grid, mirroring `onOpenRow`, rather than a
59
+ * callback per column: column definitions stay declarative (a builder that
60
+ * needs a bag of callbacks is telling you those cells want to be real typed
61
+ * columns), and a stable array memoizes properly.
62
+ *
63
+ * The host gets the resolved value back, so `value.entity` is what tells it
64
+ * WHICH drawer to open — the grid deliberately knows nothing about routes or
65
+ * drawers. Omit it and relation cells render inert.
66
+ */
67
+ onOpenRelation?: (value: ListRelationValue, columnId: string, row: Row) => void;
68
+ /**
69
+ * This app's glyph for an entity KIND, used by every `relation` cell that
70
+ * doesn't carry its own. Kept as a resolver so the grid never learns one
71
+ * application's vocabulary — see `GridCellOptions.entityIcon`.
72
+ */
73
+ entityIcon?: (kind: string | undefined) => ReactNode;
74
+ /**
75
+ * The verbs a `command` column's cell opens, by field key (spec §5: "every
76
+ * surface opens the verb menu, the host supplies the verbs"). The SAME map a
77
+ * host hands the drawer's `FieldPanel`, so Mark won / Mark lost / Reopen are
78
+ * declared once and reached from the panel, the grid and the card alike.
79
+ * Omit it and a command column is a read-only badge.
80
+ */
81
+ commands?: FieldMenus<Row>;
82
+ rowHref?: (row: Row) => string | undefined;
83
+ /** The row's action items. Named to match `ListViewProps.rowMenu` so a
84
+ * dual-renderer page passes ONE builder to both mounts. The grid has no
85
+ * kebab — these surface on right-click and in the row's ⋯ tail button — but
86
+ * the source of the items is the same, and a page that filled ListView's
87
+ * `rowMenu` and forgot the grid's used to silently lose every row action in
88
+ * the grid look. */
89
+ rowMenu?: (row: Row) => ViewsRowMenuItem[];
90
+ /** Override when the context menu must differ from `rowMenu`. Defaults to it. */
91
+ contextMenu?: (row: Row) => ViewsRowMenuItem[];
92
+ rowClassName?: (row: Row) => string | undefined;
93
+ onRowDelete?: (id: string) => Promise<void>;
94
+ deleteLabel?: string;
95
+ /** The name's actions: buttons on the title cell of the row under the pointer, and rows of each row's menu (after
96
+ * Select) for those that apply to it, so a key reaches them. */
97
+ rowActions?: ListCellAction<Row>[];
98
+ /** The leading glyph in the title cell, as a DESCRIPTOR — the grid decides
99
+ * size and color from it. See `ListRowIconAccessor`. */
100
+ rowIcon?: ListRowIconAccessor<Row>;
101
+ showRowIcon?: boolean;
102
+ selection?: ListSelectionConfig;
103
+ loadMore?: {
104
+ hasMore: boolean;
105
+ onReveal: () => void;
106
+ label?: string;
107
+ };
108
+ emptyState?: ReactNode;
109
+ /** The reader's default currency: a money column read in Original totals in it. The host's
110
+ * answer (the portal: the reader's preference); default `DEFAULT_DISPLAY_CURRENCY`. */
111
+ defaultCurrency?: DisplayCurrency;
112
+ verticalBorders?: boolean;
113
+ sort?: GridSortState;
114
+ /** The view's group, for the header menu's Group by / Ungroup — present on
115
+ * view-backed lists only, the way `sort` is. */
116
+ groupBy?: GridGroupByState;
117
+ sortOptions?: GridGroupSortOption[];
118
+ /** Which figures ride beside a group name — a set, not a choice. */
119
+ groupSummary?: ListGroupSummaryPart[];
120
+ aggregates?: Record<string, ListAggregateKind>;
121
+ onAggregateChange?: (columnId: string, kind: ListAggregateKind) => void;
122
+ /** A saved view can change aggregate choices only for field-backed columns. */
123
+ viewBacked?: boolean;
124
+ onGroupSummaryChange?: (part: ListGroupSummaryPart, next: boolean) => void;
125
+ /** The figures a group header can show, in the list's order: each part, its column's header and its drawing. */
126
+ groupFigures?: GridGroupFigure<Row>[];
127
+ /** The group count's noun: "2 companies". None: a bare count. */
128
+ countNoun?: GroupCountNoun;
129
+ optionColors?: ListOptionColorOverrides;
130
+ onOptionColorChange?: (key: string, value: string, color: ListSelectColor | null) => void;
131
+ dateStyles?: ListDateStyleOverrides;
132
+ onDateStyleChange?: (key: string, style: ListDateStyle) => void;
133
+ durationStyles?: ListDurationStyleOverrides;
134
+ onDurationStyleChange?: (key: string, style: ListDurationStyle) => void;
135
+ numberFormats?: ListNumberFormatOverrides;
136
+ /** `decimals: null` = the field's own (Automatic). */
137
+ onNumberFormatChange?: (key: string, patch: {
138
+ decimals?: number | null;
139
+ currency?: string;
140
+ }) => void;
141
+ showTimeOverrides?: ListShowTimeOverrides;
142
+ onShowTimeChange?: (key: string, show: boolean) => void;
143
+ percentDisplays?: ListPercentDisplayOverrides;
144
+ onPercentDisplayChange?: (key: string, display: PercentDisplay) => void;
145
+ /** Whether a format knob can be stored (decimals, a date's style, a percent's display, an option's colour):
146
+ * false hides them from the column menu, where there is nothing to store them against. A reader's own
147
+ * currency reading stays. Default true. */
148
+ formatsWritable?: boolean;
149
+ /** The host's own "+ Add column", the header row's last cell (a field editor's, for an admin). Nothing, or a
150
+ * falsy answer, draws the grid's own: the columns the view hides. */
151
+ renderAddColumn?: (columns: ListColumnsConfig) => ReactNode;
152
+ /** The host's rows in a column's menu for the column's field, above Hide (a field editor's Edit field and
153
+ * Archive field); `close` shuts the menu. Null for a field the host adds nothing to. */
154
+ renderColumnMenuRows?: (fieldKey: string, close: () => void) => ReactNode;
155
+ columnState?: ListColumnState;
156
+ onColumnStateChange?: (next: ListColumnState) => void;
157
+ scale?: number;
158
+ onCellCommit?: GridCellCommitFn<Row>;
159
+ onCellsCommit?: GridCellsCommitFn<Row>;
160
+ /** Per-user "Freeze identity columns" toggle: pins every column through the
161
+ * title to the left edge while the rest scrolls under them. */
162
+ freezeIdentity?: boolean;
163
+ /** Per-user "Show checkboxes always" toggle: holds the checkbox rail open
164
+ * instead of revealing it on hover. Same state a live selection forces. */
165
+ alwaysCheckboxes?: boolean;
166
+ /** Workspace-settings capability config for THIS list (table read-only / per-column
167
+ * locks), inherited by every user. The CONFIG layer of
168
+ * `declaration → config → prefs` — it may only SUBTRACT from what the
169
+ * columns declare. UI constraint only; the host's API guards its own writes. */
170
+ listConfig?: ListSettingsConfig;
171
+ };
172
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,34 @@
1
+ import type { ListBatchApi } from "../../selection/types.js";
2
+ import type { GridEditCell } from "../core/useGridEditing.js";
3
+ import type { ListSettingsConfig } from "../../model/column-capabilities.js";
4
+ import type { ListColumn } from "../../model/column-schema.js";
5
+ /**
6
+ * The batch bar's route into the grid's own write machinery.
7
+ *
8
+ * A verb like "set status on 12 rows" is not a different kind of write from
9
+ * editing one status cell — it is the same write, twelve times. Sending it
10
+ * through `commitBatchChecked` therefore buys everything the cell editors
11
+ * already have: the optimistic overlay (rows repaint on the click rather than
12
+ * when the server round-trip returns), ONE history entry so ⌘Z reverts the
13
+ * whole batch in a single step, and rollback if the write fails.
14
+ *
15
+ * Its own module rather than more lines in GridTable: that file sits under an
16
+ * oversized-debt ceiling whose policy says split the responsibility rather than
17
+ * raise the number.
18
+ */
19
+ export declare function useGridBatchApi<Row>({ enabled, columns, listConfig, rows, getRowId, pendingByRow, commitBatch, }: {
20
+ /** The grid can write at all (the host passed a commit handler). */
21
+ enabled: boolean;
22
+ /** Visible columns — the id resolves against what the user can actually see. */
23
+ columns: ListColumn<Row>[];
24
+ listConfig: ListSettingsConfig | undefined;
25
+ /** Every loaded row, for resolving selected ids to row objects. */
26
+ rows: Row[];
27
+ getRowId: (row: Row) => string;
28
+ /** Optimistic values already in flight — the undo baseline reads through them
29
+ * so a second batch over the same cells doesn't record a stale `prev`. */
30
+ pendingByRow: ReadonlyMap<string, Record<string, unknown>>;
31
+ commitBatch: (edits: (GridEditCell<Row> & {
32
+ row: Row;
33
+ })[]) => Promise<boolean>;
34
+ }): ListBatchApi | undefined;
@@ -0,0 +1,35 @@
1
+ "use client";
2
+ import { useMemo } from "react";
3
+ import { cellEditBaseline, cellPrevPayload } from "./cell-clipboard.js";
4
+ import { columnEffectiveWritable } from "../../model/column-capabilities.js";
5
+ export function useGridBatchApi({ enabled, columns, listConfig, rows, getRowId, pendingByRow, commitBatch, }) {
6
+ return useMemo(() => {
7
+ if (!enabled)
8
+ return undefined;
9
+ return {
10
+ setColumnValue: (rowIds, columnId, value) => {
11
+ const col = columns.find((c) => c.id === columnId);
12
+ if (!col || !columnEffectiveWritable(col, listConfig))
13
+ return Promise.resolve(false);
14
+ const byId = new Map(rows.map((r) => [getRowId(r), r]));
15
+ const overlay = col.type !== "number" && col.type !== "date";
16
+ const edits = [];
17
+ for (const rowId of rowIds) {
18
+ const row = byId.get(rowId);
19
+ if (row == null)
20
+ continue;
21
+ edits.push({
22
+ row,
23
+ rowId,
24
+ columnId,
25
+ prev: cellPrevPayload(col, cellEditBaseline(col, row, pendingByRow.get(rowId)), col.editUnit?.value(row)),
26
+ next: value,
27
+ overlay,
28
+ rowSnapshot: row,
29
+ });
30
+ }
31
+ return commitBatch(edits);
32
+ },
33
+ };
34
+ }, [enabled, columns, listConfig, rows, getRowId, pendingByRow, commitBatch]);
35
+ }
@@ -0,0 +1,30 @@
1
+ import { type PointerEvent as ReactPointerEvent, type RefObject } from "react";
2
+ import type { ListColumnsConfig } from "../../model/column-state.js";
3
+ import type { ListColumn } from "../../model/column-schema.js";
4
+ import { type ListColumnState } from "../../model/column-state.js";
5
+ export declare function useGridColumnLayout<Row>({ rootRef, columns, columnState, onColumnStateChange, scale, freezeIdentity, viewBacked, }: {
6
+ rootRef: RefObject<HTMLDivElement | null>;
7
+ columns: ListColumn<Row>[];
8
+ columnState?: ListColumnState;
9
+ onColumnStateChange?: (state: ListColumnState) => void;
10
+ scale: number;
11
+ /** Pin the identity columns (everything through the title) to the left edge. */
12
+ freezeIdentity?: boolean;
13
+ /** Saved views persist layout only for field-backed columns. */
14
+ viewBacked?: boolean;
15
+ }): {
16
+ visibleColumns: ListColumn<Row>[];
17
+ widthVarsStyle: import("react").CSSProperties;
18
+ frozenCount: number;
19
+ frozenLeft: (i: number) => string;
20
+ columnManager: ListColumnsConfig | null;
21
+ gridTemplate: string;
22
+ minWidth: string;
23
+ resizingId: string | null;
24
+ startResize: (col: ListColumn<Row>, event: ReactPointerEvent<HTMLElement>) => void;
25
+ moveResize: (event: ReactPointerEvent<HTMLElement>) => void;
26
+ endResize: () => void;
27
+ resetColumnWidth: (col: ListColumn<Row>) => void;
28
+ hideColumn: (col: ListColumn<Row>) => void;
29
+ moveColumn: (col: ListColumn<Row>, direction: -1 | 1) => void;
30
+ };