@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,45 @@
1
+ import { type ReactNode } from "react";
2
+ import type { RelationDraftLink } from "@viewkitjs/fields";
3
+ import { type RelationSetItem } from "../../editors/RelationEditor.js";
4
+ import type { RelationCellCreate, RelationSource } from "../../fields/relation-source-types.js";
5
+ export declare function GridRelationEditor({ title, candidates, current, clearable, seed, create, refuse, onCommit, onLink, onCancel, }: {
6
+ /** The field's name: the sheet's title on a phone. */
7
+ title: ReactNode;
8
+ candidates: RelationSource;
9
+ /** The linked id, or null when the cell is empty. */
10
+ current: string | null;
11
+ /** Offer "None" — only when the column says the link is optional. */
12
+ clearable: boolean;
13
+ /** The letter typed on the cell that opened the picker: its search starts from it. */
14
+ seed?: string;
15
+ /** The app's create row, from the column. */
16
+ create?: RelationCellCreate;
17
+ /** The pick, with its kind where the candidate named one. */
18
+ onCommit: (id: string | null, kind?: string) => void;
19
+ /** The record the app's form created, to link to the cell once the editor is gone. */
20
+ onLink?: (id: string, kind?: string) => void;
21
+ onCancel: () => void;
22
+ /** The grid's judgement of a value before it is written: its reason when it would refuse it.
23
+ * A refused value keeps the editor open with that reason. */
24
+ refuse?: (value: string | null, kind?: string) => string | null;
25
+ }): import("react/jsx-runtime").JSX.Element;
26
+ /**
27
+ * The grid's host for a relation holding several records: the set is edited with the list open and
28
+ * leaves as one change, as pick many does — Tab and Shift-Tab save it and move on.
29
+ */
30
+ export declare function GridRelationSetEditor({ title, candidates, current, lead, seed, create, refuse, onCommit, onLink, onCancel, onTab, }: {
31
+ title: ReactNode;
32
+ candidates: RelationSource;
33
+ /** The linked records, in their stored order, with what each row shows. */
34
+ current: readonly RelationSetItem[];
35
+ /** The field leads by a flag. */
36
+ lead: boolean;
37
+ seed?: string;
38
+ create?: RelationCellCreate;
39
+ onCommit: (links: RelationDraftLink[]) => void;
40
+ /** The record the app's form created, added to the set saved at close (or the set as it opened). */
41
+ onLink?: (base: RelationDraftLink[], added: RelationDraftLink) => void;
42
+ onCancel: () => void;
43
+ onTab?: (backwards: boolean) => void;
44
+ refuse?: (links: RelationDraftLink[]) => string | null;
45
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,92 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useMemo, useRef } from "react";
4
+ import { RelationEditor, RelationSetEditor, } from "../../editors/RelationEditor.js";
5
+ import { EditorPanel } from "../../editors/EditorPanel.js";
6
+ import { useGridEditSession } from "./grid-edit-session.js";
7
+ function useKnownKinds(candidates) {
8
+ const seen = useRef(new Map());
9
+ const source = useMemo(() => candidates.kind === "static"
10
+ ? candidates
11
+ : {
12
+ ...candidates,
13
+ search: async (query, signal, offset) => {
14
+ const items = await candidates.search(query, signal, offset);
15
+ for (const item of items)
16
+ if (item.kind !== undefined)
17
+ seen.current.set(item.id, item.kind);
18
+ return items;
19
+ },
20
+ }, [candidates]);
21
+ const kindOf = (id) => candidates.kind === "static"
22
+ ? candidates.items.find((item) => item.id === id)?.kind
23
+ : seen.current.get(id);
24
+ return [source, kindOf];
25
+ }
26
+ export function GridRelationEditor({ title, candidates, current, clearable, seed, create, refuse, onCommit, onLink, onCancel, }) {
27
+ const editorRef = useRef(null);
28
+ const anchorRef = useRef(null);
29
+ const [source, kindOf] = useKnownKinds(candidates);
30
+ const { session, close, sheet } = useGridEditSession({
31
+ editorRef,
32
+ refuse: refuse &&
33
+ ((value) => refuse(value, value == null ? undefined : kindOf(value))),
34
+ onCommit: (id) => onCommit(id, id == null ? undefined : kindOf(id)),
35
+ onCancel,
36
+ });
37
+ const creates = create && onLink
38
+ ? [
39
+ {
40
+ label: create.label,
41
+ onCreate: (query) => create.onCreate(query, (id, kind) => onLink(id, kind)),
42
+ },
43
+ ]
44
+ : undefined;
45
+ return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, "aria-hidden": true, className: "pointer-events-none absolute inset-0" }), _jsx(EditorPanel, { session: session, title: title, anchor: anchorRef, align: "start", sideOffset: 4, initialFocus: false, onPanelClick: (e) => e.stopPropagation(), panelData: { "data-slot": "vk-grid-editor" }, chrome: "menu", className: "w-64 z-90", children: _jsx(RelationEditor, { ref: editorRef, candidates: source, initial: current, clearable: clearable, seed: seed, focusSearch: !sheet, creates: creates, onRequestClose: close }) })] }));
46
+ }
47
+ export function GridRelationSetEditor({ title, candidates, current, lead, seed, create, refuse, onCommit, onLink, onCancel, onTab, }) {
48
+ const editorRef = useRef(null);
49
+ const anchorRef = useRef(null);
50
+ const savedRef = useRef(null);
51
+ const heldRef = useRef([]);
52
+ const linkOnTop = (added) => {
53
+ const base = savedRef.current;
54
+ savedRef.current = [...base, added];
55
+ onLink(base, added);
56
+ };
57
+ const settle = (links) => {
58
+ savedRef.current = links;
59
+ const held = heldRef.current;
60
+ heldRef.current = [];
61
+ for (const added of held)
62
+ linkOnTop(added);
63
+ };
64
+ const { session, close, sheet } = useGridEditSession({
65
+ editorRef,
66
+ refuse: refuse && ((value) => refuse(value)),
67
+ onCommit: (links) => {
68
+ onCommit(links);
69
+ settle(links);
70
+ },
71
+ onCancel: () => {
72
+ onCancel();
73
+ settle(current.map(({ label: _label, icon: _icon, ...link }) => link));
74
+ },
75
+ onTab,
76
+ });
77
+ const creates = create && onLink
78
+ ? [
79
+ {
80
+ label: create.label,
81
+ onCreate: (query) => create.onCreate(query, (id, kind) => {
82
+ const added = { id, ...(kind !== undefined ? { kind } : {}) };
83
+ if (savedRef.current)
84
+ linkOnTop(added);
85
+ else
86
+ heldRef.current.push(added);
87
+ }),
88
+ },
89
+ ]
90
+ : undefined;
91
+ return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, "aria-hidden": true, className: "pointer-events-none absolute inset-0" }), _jsx(EditorPanel, { session: session, title: title, anchor: anchorRef, align: "start", sideOffset: 4, initialFocus: false, onPanelClick: (e) => e.stopPropagation(), panelData: { "data-slot": "vk-grid-editor" }, chrome: "menu", className: "w-64 z-90", children: _jsx(RelationSetEditor, { ref: editorRef, candidates: candidates, initial: current, lead: lead, seed: seed, focusSearch: !sheet, creates: creates, onRequestClose: close }) })] }));
92
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The column-resize grab zone on a header cell's right edge. The header cell is
3
+ * (usually) a Radix PopoverTrigger — every pointer/click event here stops
4
+ * propagation so a resize drag (or its post-drag compatibility click) never
5
+ * opens the header menu, and a plain click on the edge does nothing.
6
+ *
7
+ * The drag itself lives in GridTable (pointer capture on this element retargets
8
+ * move/up here, so the passed handlers see the whole gesture without any
9
+ * document listeners). Double-click clears the column's width override — but
10
+ * only for true double-clicks; GridTable ignores it after a real drag.
11
+ */
12
+ export declare function GridResizeHandle({ active, onResizeStart, onResizeMove, onResizeEnd, onReset, }: {
13
+ /** True while THIS column is being dragged — pins the hairline visible. */
14
+ active: boolean;
15
+ onResizeStart: (e: React.PointerEvent<HTMLElement>) => void;
16
+ onResizeMove: (e: React.PointerEvent<HTMLElement>) => void;
17
+ onResizeEnd: (e: React.PointerEvent<HTMLElement>) => void;
18
+ onReset: () => void;
19
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { cx } from "../../internal/cx.js";
4
+ export function GridResizeHandle({ active, onResizeStart, onResizeMove, onResizeEnd, onReset, }) {
5
+ return (_jsx("div", { "data-slot": "vk-grid-resize-handle", "data-no-nav": true, className: "group/gridresize absolute inset-y-0 right-0 z-10 w-[7px] cursor-col-resize touch-none", onPointerDown: (e) => {
6
+ if (e.button !== 0)
7
+ return;
8
+ e.stopPropagation();
9
+ e.preventDefault();
10
+ e.currentTarget.setPointerCapture(e.pointerId);
11
+ onResizeStart(e);
12
+ }, onPointerMove: onResizeMove, onPointerUp: (e) => {
13
+ e.stopPropagation();
14
+ onResizeEnd(e);
15
+ }, onPointerCancel: onResizeEnd, onClick: (e) => e.stopPropagation(), onDoubleClick: (e) => {
16
+ e.stopPropagation();
17
+ onReset();
18
+ }, children: _jsx("div", { className: cx("absolute inset-y-0 right-0 w-[3px] rounded-full bg-(color:--vk-brand)", active ? "opacity-100" : "opacity-0 group-hover/gridresize:opacity-100") }) }));
19
+ }
@@ -0,0 +1,31 @@
1
+ import type { GridRowProps } from "./grid-row-props.js";
2
+ /**
3
+ * Whether a pointerdown is about to open the row — the same test the click
4
+ * handler applies, one event earlier, so the drawer's data is on its way
5
+ * before the click lands. Only the `[data-cell-open]` hotspot (the title text)
6
+ * opens the row, so the columns play no part in the answer.
7
+ */
8
+ export declare function shouldPrefetchGridRow(target: HTMLElement): boolean;
9
+ /**
10
+ * One spreadsheet row: a strip of bordered cells on the shared template
11
+ * (gutter track first). No kebab — actions live on right-click
12
+ * (the row's menu, `RowMenu`) and in the entity drawer.
13
+ *
14
+ * Click contract (Sheets model, Tier 3):
15
+ * real controls win (a cell's own email, phone or link is no control: a
16
+ * ⌘- or Ctrl-click follows it, and any other click is the cell's, the link
17
+ * not followed) → cmd/shift cell-range select → selection-mode toggle →
18
+ * title-TEXT click opens the drawer (`[data-cell-open]` hotspot — the text
19
+ * only, never the cell's padding) →
20
+ * otherwise the click SELECTS the cell, the title cell included; a second
21
+ * click on the selected cell (or dblclick / Enter) starts editing when the
22
+ * column has an editor.
23
+ * On a phone (below the provider's `desktopQuery`, asked at the tap): real
24
+ * controls and selection mode as above, then a tap anywhere on the name's
25
+ * cell opens the drawer, and one tap on any other cell opens its editor
26
+ * (the sheet) or, when it opens nothing, selects it and says why.
27
+ * Middle-click still opens `rowHref` in a new tab.
28
+ */
29
+ declare function GridRowInner<Row>(props: GridRowProps<Row>): import("react/jsx-runtime").JSX.Element;
30
+ export declare const GridRow: typeof GridRowInner;
31
+ export {};
@@ -0,0 +1,179 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { memo } from "react";
4
+ import { cx } from "../../internal/cx.js";
5
+ import { GridRowCheck, GridRailSpacer } from "./checks.js";
6
+ import { GRID_TAIL_BUTTON_BASE } from "./grid-styles.js";
7
+ import { gridRowClassName } from "./grid-cell-classes.js";
8
+ import { preventShiftTextSelect, ROW_INTERACTIVE_SELECTOR } from "../../selection/row-click.js";
9
+ import { useRestIntent } from "../../selection/useRestIntent.js";
10
+ import { gridColumnHasEditor } from "./editors.js";
11
+ import { gridColumnInspectable, isWholeTextColumn } from "../../model/column-inspect.js";
12
+ import { gridCellCutOff } from "./cell-cut-off.js";
13
+ import { countRowRender } from "../../model/render-count.js";
14
+ import { useGridRowContextMenu } from "./useGridRowContextMenu.js";
15
+ import { GridRowCells } from "./GridRowCells.js";
16
+ import { gridCellLinkAt, gridControlAt } from "./grid-cell-link.js";
17
+ import { useGridRowHoverHandlers } from "./grid-hover.js";
18
+ import { useViews } from "../../provider/context.js";
19
+ import { isDesktopNow } from "../../provider/desktop.js";
20
+ import { gridFocusOnPress } from "./useGridFocus.js";
21
+ export function shouldPrefetchGridRow(target) {
22
+ if (target.closest(ROW_INTERACTIVE_SELECTOR))
23
+ return false;
24
+ return target.closest("[data-cell-open]") != null;
25
+ }
26
+ function GridRowInner(props) {
27
+ countRowRender();
28
+ const { icons, messages, atoms, desktopQuery } = useViews();
29
+ const More = icons.more;
30
+ const RowMenu = atoms.RowMenu;
31
+ const { row, id, columns, selectable, selected, selectedAbove, selecting, toggle, toggleRange, contextMenu, rowClassName, rowHref, onOpenRow, onPrefetchRow, onRowDelete, deleteLabel, editingEnabled, focusedColId, editingColId, pendingByCol, selectValues, rowRange, onFocusCell, rowKey, onStartEdit, onRefuseEdit, onExtendCell, onAddCell, onCommitCell, inActiveRange, rangeCanClear, onRangeCopy, onRangeCut, onRangePaste, onRangeClear, onPasteAtCell, ariaRowIndex, ariaLevel, ariaPosInSet, ariaSetSize, ariaTailIndex, } = props;
32
+ const href = rowHref?.(row);
33
+ const canEdit = (col) => editingEnabled && gridColumnHasEditor(col);
34
+ const whole = (col, cell) => isWholeTextColumn(col) && gridCellCutOff(cell);
35
+ const opensPanel = (col, cell) => canEdit(col) || gridColumnInspectable(col) || whole(col, cell);
36
+ const { contextItems, handleContextMenu } = useGridRowContextMenu({
37
+ row,
38
+ id,
39
+ columns,
40
+ rowActions: props.rowActions,
41
+ selecting,
42
+ selectable,
43
+ selected,
44
+ toggle,
45
+ editingEnabled,
46
+ pendingByCol,
47
+ selectValues,
48
+ rowRange,
49
+ contextMenu,
50
+ inActiveRange,
51
+ rangeCanClear,
52
+ onRangeCopy,
53
+ onRangeCut,
54
+ onRangePaste,
55
+ onRangeClear,
56
+ onPasteAtCell,
57
+ onCommitCell,
58
+ onFocusCell,
59
+ rowKey,
60
+ });
61
+ const findCol = (target) => {
62
+ const colId = target.closest("[data-col-id]")?.getAttribute("data-col-id");
63
+ return colId ? columns.find((c) => c.id === colId) : undefined;
64
+ };
65
+ const handleClick = (e) => {
66
+ const target = e.target;
67
+ if (gridControlAt(target))
68
+ return;
69
+ const link = gridCellLinkAt(target);
70
+ if (link) {
71
+ if (e.metaKey || e.ctrlKey || !link.closest("[data-col-id]"))
72
+ return;
73
+ e.preventDefault();
74
+ }
75
+ if (selecting) {
76
+ toggle(id);
77
+ return;
78
+ }
79
+ if (!isDesktopNow(desktopQuery)) {
80
+ const cell = target.closest("[data-col-id]");
81
+ if (cell?.querySelector("[data-cell-open]")) {
82
+ onOpenRow(row);
83
+ return;
84
+ }
85
+ const col = findCol(target);
86
+ if (!col || editingColId === col.id)
87
+ return;
88
+ if (opensPanel(col, cell))
89
+ onStartEdit(rowKey, col.id, null, whole(col, cell));
90
+ else {
91
+ onFocusCell(rowKey, col.id);
92
+ onRefuseEdit?.(col.id);
93
+ }
94
+ return;
95
+ }
96
+ if (e.shiftKey || e.metaKey || e.ctrlKey) {
97
+ const col = findCol(target);
98
+ if (col)
99
+ (e.shiftKey ? onExtendCell : onAddCell)(rowKey, col.id);
100
+ return;
101
+ }
102
+ const col = findCol(target);
103
+ if (target.closest("[data-cell-open]")) {
104
+ onOpenRow(row);
105
+ return;
106
+ }
107
+ if (!col)
108
+ return;
109
+ if (focusedColId === col.id) {
110
+ const cell = target.closest("[data-col-id]");
111
+ if (!opensPanel(col, cell))
112
+ onRefuseEdit?.(col.id);
113
+ else if (editingColId !== col.id)
114
+ onStartEdit(rowKey, col.id, null, whole(col, cell));
115
+ return;
116
+ }
117
+ onFocusCell(rowKey, col.id);
118
+ };
119
+ const handleDoubleClick = (e) => {
120
+ const target = e.target;
121
+ if (gridControlAt(target))
122
+ return;
123
+ if (selecting || target.closest("[data-cell-open]"))
124
+ return;
125
+ if (!isDesktopNow(desktopQuery))
126
+ return;
127
+ const col = findCol(target);
128
+ if (!col)
129
+ return;
130
+ const cell = target.closest("[data-col-id]");
131
+ if (!opensPanel(col, cell))
132
+ onRefuseEdit?.(col.id);
133
+ else if (editingColId !== col.id)
134
+ onStartEdit(rowKey, col.id, null, whole(col, cell));
135
+ };
136
+ const handlePointerDown = (e) => {
137
+ if (e.button !== 0)
138
+ return;
139
+ gridFocusOnPress(e, '[data-slot="vk-grid-cell"]');
140
+ const target = e.target;
141
+ const opensOnPhone = !isDesktopNow(desktopQuery) &&
142
+ !target.closest(ROW_INTERACTIVE_SELECTOR) &&
143
+ target.closest("[data-col-id]")?.querySelector("[data-cell-open]") != null;
144
+ if (shouldPrefetchGridRow(target) || opensOnPhone)
145
+ onPrefetchRow?.(row);
146
+ };
147
+ const rest = useRestIntent(onPrefetchRow ? () => onPrefetchRow(row) : undefined, (target) => shouldPrefetchGridRow(target));
148
+ const hover = useGridRowHoverHandlers(rowKey);
149
+ const handleMouseDown = (e) => {
150
+ if (e.button === 1) {
151
+ const target = e.target;
152
+ if (href && !target.closest(ROW_INTERACTIVE_SELECTOR)) {
153
+ e.preventDefault();
154
+ window.open(href, "_blank", "noopener,noreferrer");
155
+ return;
156
+ }
157
+ }
158
+ if (selectable)
159
+ preventShiftTextSelect(e);
160
+ };
161
+ const body = (_jsxs("div", { "data-slot": "vk-grid-row", "data-row-id": rowKey, role: "row", "aria-rowindex": ariaRowIndex, "aria-level": ariaLevel, "aria-posinset": ariaPosInSet, "aria-setsize": ariaSetSize, "aria-selected": selectable ? selected : undefined, onPointerDown: handlePointerDown, onPointerOver: (e) => {
162
+ rest.onPointerOver(e);
163
+ hover.onPointerOver(e);
164
+ }, onPointerLeave: (e) => {
165
+ rest.onPointerLeave();
166
+ hover.onPointerLeave(e);
167
+ }, onMouseDown: handleMouseDown, onClick: handleClick, onDoubleClick: handleDoubleClick, onContextMenu: handleContextMenu, className: gridRowClassName({ selected, selectable, hostClass: rowClassName?.(row) }), children: [selected && !selectedAbove && (_jsx("span", { "aria-hidden": true, className: "pointer-events-none absolute inset-x-0 top-0 z-11 h-px bg-(color:--vk-brand)" })), selected && (_jsx("span", { "aria-hidden": true, className: "pointer-events-none absolute inset-x-0 bottom-0 z-11 h-px bg-(color:--vk-brand)" })), selectable ? (_jsx(GridRowCheck, { selecting: selecting, checked: selected, revealed: selected, onChange: (next, shift) => (shift ? toggleRange(id) : toggle(id, next)), "aria-label": messages({ key: "views.grid.select-row" }) })) : (_jsx(GridRailSpacer, { selecting: false, bordered: true })), _jsx(GridRowCells, { props: props }), _jsx("div", { "data-slot": "vk-grid-tail", role: "gridcell", "aria-colindex": ariaTailIndex, className: "flex h-(--vk-row-h) items-center border-b border-(color:--vk-border-subtle) pl-(--vk-tail-pl,var(--vk-px))", children: _jsx("button", { type: "button", tabIndex: -1, "data-slot": "vk-grid-row-more", "aria-label": messages({ key: "views.grid.row-menu" }), title: messages({ key: "views.grid.row-menu" }), onClick: (e) => {
168
+ e.stopPropagation();
169
+ const rect = e.currentTarget.getBoundingClientRect();
170
+ e.currentTarget.dispatchEvent(new MouseEvent("contextmenu", {
171
+ bubbles: true,
172
+ cancelable: true,
173
+ clientX: rect.left,
174
+ clientY: rect.bottom + 6,
175
+ }));
176
+ }, className: cx(GRID_TAIL_BUTTON_BASE, "md:opacity-0 md:group-hover/gridrow:opacity-100", selected ? "hover:bg-(color:--vk-brand-subtlest)" : "hover:bg-(color:--vk-hovered)"), children: _jsx(More, { className: "h-4 w-4" }) }) })] }));
177
+ return (_jsx(RowMenu, { rowId: id, items: contextItems, openHref: href, onDelete: onRowDelete, deleteLabel: deleteLabel, onToggleSelect: selectable ? () => toggle(id, !selected) : undefined, children: body }));
178
+ }
179
+ export const GridRow = memo(GridRowInner);
@@ -0,0 +1,32 @@
1
+ import type { MouseEvent as ReactMouseEvent, ReactNode } from "react";
2
+ import type { ListCellAction } from "../../model/column-schema.js";
3
+ /**
4
+ * Small icon-button affordances inside a grid row, and the lane that hosts them.
5
+ *
6
+ * Two surfaces, one button primitive:
7
+ * - `bare` — an action COLUMN's cell. The icon owns its own cell, so it
8
+ * needs no box of its own.
9
+ * - `outlined` — the title cell's trailing lane. Several buttons sit
10
+ * shoulder-to-shoulder ON TOP of row content, so each needs a
11
+ * filled, bordered box to read as a discrete target.
12
+ *
13
+ * Adding an action is declaring one `ListCellAction` — the same shape action
14
+ * columns already use. No new component per action, no bespoke button markup.
15
+ */
16
+ type GridActionVariant = "bare" | "outlined";
17
+ export declare function GridActionButton({ variant, label, onClick, tabIndex, className, children, }: {
18
+ variant?: GridActionVariant;
19
+ label?: string;
20
+ onClick?: (e: ReactMouseEvent<HTMLButtonElement>) => void;
21
+ /** -1 for hover-revealed lanes — tabbing to an invisible button is a trap. */
22
+ tabIndex?: number;
23
+ className?: string;
24
+ children: ReactNode;
25
+ }): import("react/jsx-runtime").JSX.Element;
26
+ export declare function GridRowActions<Row>({ row, actions, selected, }: {
27
+ row: Row;
28
+ actions: ListCellAction<Row>[];
29
+ /** This row is selected — the backing carries its tint. */
30
+ selected?: boolean;
31
+ }): import("react/jsx-runtime").JSX.Element | null;
32
+ export {};
@@ -0,0 +1,25 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { cx } from "../../internal/cx.js";
4
+ import { gridFrozenBg } from "./GridCellOutline.js";
5
+ const VARIANT = {
6
+ bare: "h-6 w-6 rounded-md hover:bg-(color:--vk-hovered)",
7
+ outlined: "h-6 w-6 rounded-md [corner-shape:squircle] border border-(color:--vk-border) bg-(color:--vk-ground) shadow-xs hover:bg-(color:--vk-hovered)",
8
+ };
9
+ export function GridActionButton({ variant = "bare", label, onClick, tabIndex, className, children, }) {
10
+ return (_jsx("button", { type: "button", tabIndex: tabIndex, "aria-label": label, title: label, onClick: (e) => {
11
+ e.stopPropagation();
12
+ onClick?.(e);
13
+ }, className: cx("flex shrink-0 items-center justify-center text-(color:--vk-fg-subtle) hover:text-(color:--vk-fg)", VARIANT[variant], className), children: children }));
14
+ }
15
+ const LANE_RAMP = "linear-gradient(to right, transparent 0, rgb(0 0 0) 2rem)";
16
+ export function GridRowActions({ row, actions, selected = false, }) {
17
+ if (actions.length === 0)
18
+ return null;
19
+ return (_jsxs("span", { className: "pointer-events-none absolute inset-y-0 right-0 hidden md:flex items-center gap-1 pl-8 pr-(--vk-px)", children: [_jsx("span", { "aria-hidden": true, className: cx("absolute inset-0", gridFrozenBg(selected)), style: { maskImage: LANE_RAMP, WebkitMaskImage: LANE_RAMP } }), actions.map((a) => {
20
+ const glyph = a.icon(row);
21
+ if (!glyph)
22
+ return null;
23
+ return (_jsx(GridActionButton, { variant: "outlined", tabIndex: -1, className: "pointer-events-auto relative", label: a.label?.(row), onClick: a.onClick ? (e) => a.onClick?.(row, e) : undefined, children: glyph }, a.id));
24
+ })] }));
25
+ }
@@ -0,0 +1,4 @@
1
+ import type { GridRowProps } from "./grid-row-props.js";
2
+ export declare function GridRowCells<Row>({ props }: {
3
+ props: GridRowProps<Row>;
4
+ }): import("react/jsx-runtime").JSX.Element[];
@@ -0,0 +1,128 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { cx } from "../../internal/cx.js";
4
+ import { useViews } from "../../provider/context.js";
5
+ import { shownCodeOf } from "../../fields/money.js";
6
+ import { cellEditBaseline } from "./cell-clipboard.js";
7
+ import { renderActionCell, renderTypedCell } from "./cells.js";
8
+ import { gridColumnHasEditor, gridEditorKind } from "./editors.js";
9
+ import { GridCellAnchoredEditor, GridCellInlineEditor, } from "./GridCellEditors.js";
10
+ import { GridCellOutline } from "./GridCellOutline.js";
11
+ import { GridValueUnderEditor } from "./grid-edit-session.js";
12
+ import { GRID_RANGE_TINT_CLASS, gridCellClassName } from "./grid-cell-classes.js";
13
+ import { gridBooleanMode, columnEffectiveWritable } from "../../model/column-capabilities.js";
14
+ import { gridColumnInspectable, gridTextOpensBox, isWholeTextColumn } from "../../model/column-inspect.js";
15
+ import { fieldKeyOf } from "../../model/view-rules.js";
16
+ import { GridPickerCaret, GridRowHoverActions } from "./grid-hover.js";
17
+ import { GridRowGlyph } from "./GridRowGlyph.js";
18
+ import { requestedSettlementTitle } from "@viewkitjs/fields";
19
+ function FillDot({ enabled }) {
20
+ return (_jsx("span", { "data-fill-dot": enabled ? "" : undefined, className: cx("absolute bottom-[-7px] right-[-7px] z-10 hidden h-3 w-3 rounded-full border-2 border-(color:--vk-ground) bg-(color:--vk-brand)", "[@media(hover:hover)_and_(pointer:fine)]:block", enabled ? "cursor-crosshair" : "pointer-events-none") }));
21
+ }
22
+ export function GridRowCells({ props }) {
23
+ const { conventions, icons, messages } = useViews();
24
+ const { row, id, rowKey, columns, selected, rowActions, rowIcon, verticalBorders = true, optionColors, dateStyles, durationStyles, numberFormats, showTimeOverrides, percentDisplays, editingEnabled, focusedColId, editingColId, pendingByCol, settlementByCol, selectValues, rowRange, frozenCount = 0, frozenLeft, listConfig, onStartEdit, onEditorTab, onEditorEnter, editSeed, editWhole = false, onCommitCell, onCancelEdit, onOpenRelation: onOpenRelationValue, entityIcon, commands, ariaColOffset = 0, } = props;
25
+ const canEdit = (column) => editingEnabled && gridColumnHasEditor(column) && columnEffectiveWritable(column, listConfig);
26
+ const editBaseline = (column) => cellEditBaseline(column, row, pendingByCol);
27
+ return columns.map((col, i) => {
28
+ const editing = editingColId === col.id;
29
+ const focused = focusedColId === col.id;
30
+ const span = rowRange?.find((s) => i >= s.startCol && i <= s.endCol);
31
+ const spanLeft = !!span && i === span.startCol;
32
+ const spanRight = !!span && i === span.endCol;
33
+ const writable = canEdit(col);
34
+ const whole = editing && editWhole;
35
+ const editorKind = writable
36
+ ? gridEditorKind(col)
37
+ : gridColumnInspectable(col) || (whole && isWholeTextColumn(col))
38
+ ? "text"
39
+ : null;
40
+ const fieldKey = fieldKeyOf(col);
41
+ const numberFormat = numberFormats?.[fieldKey];
42
+ const showTime = showTimeOverrides?.[fieldKey] ?? col.format?.withTime ?? false;
43
+ const onResolve = editingEnabled &&
44
+ columnEffectiveWritable(col, listConfig) &&
45
+ gridBooleanMode(col) === "marker"
46
+ ? () => onCommitCell(row, id, col.id, true, false)
47
+ : undefined;
48
+ const onToggle = editingEnabled &&
49
+ columnEffectiveWritable(col, listConfig) &&
50
+ gridBooleanMode(col) === "toggle"
51
+ ? (next) => onCommitCell(row, id, col.id, editBaseline(col) === true, next)
52
+ : undefined;
53
+ const onOpenRelation = onOpenRelationValue && (col.type === "relation" || col.type === "user")
54
+ ?
55
+ (value) => onOpenRelationValue(value, col.id, row)
56
+ : undefined;
57
+ const commandItems = col.command ? commands?.[fieldKeyOf(col)]?.(row) : undefined;
58
+ const typedCell = () => renderTypedCell(col, row, {
59
+ optionColors: optionColors?.[fieldKey],
60
+ dateStyle: dateStyles?.[fieldKey],
61
+ durationStyle: durationStyles?.[fieldKey],
62
+ decimals: numberFormat?.decimals,
63
+ withTime: showTime,
64
+ percentDisplay: percentDisplays?.[fieldKey],
65
+ valueOverride: pendingByCol?.[col.id],
66
+ markerReason: col.marker?.reason?.(row),
67
+ onResolve,
68
+ onToggle,
69
+ onOpenRelation,
70
+ entityIcon,
71
+ commandItems,
72
+ hostOwnsPlainClick: true,
73
+ });
74
+ const cellValue = () => col.actions
75
+ ? renderActionCell(col, row)
76
+ : col.render
77
+ ? col.render(row, { value: col.accessor?.(row), code: shownCodeOf(col, row) })
78
+ : typedCell();
79
+ const tabTo = (backwards) => onEditorTab(rowKey, col.id, backwards);
80
+ const enterAdvance = () => onEditorEnter(rowKey, col.id);
81
+ const frozen = i < frozenCount;
82
+ const settlement = settlementByCol?.[col.id];
83
+ const editorCtx = {
84
+ row,
85
+ rowId: id,
86
+ col,
87
+ editorKind,
88
+ readOnly: !writable,
89
+ baseline: editBaseline(col),
90
+ editSeed,
91
+ whole,
92
+ decimals: numberFormat?.decimals,
93
+ selectValues: selectValues?.[col.id],
94
+ optionColors: optionColors?.[fieldKey],
95
+ entityIcon,
96
+ listConfig,
97
+ onCommitCell,
98
+ onCancel: () => onCancelEdit(rowKey, col.id),
99
+ onTab: tabTo,
100
+ onEnter: enterAdvance,
101
+ };
102
+ return (_jsxs("div", { "data-slot": "vk-grid-cell", "data-col-id": col.id, tabIndex: -1, role: "gridcell", "aria-colindex": ariaColOffset + i + 1, "aria-readonly": writable ? undefined : true, "aria-selected": span ? true : undefined, "data-settlement": settlement, title: settlement ? requestedSettlementTitle(col.field?.provenance, conventions) : undefined, style: frozen && frozenLeft ? { left: frozenLeft(i) } : undefined, className: gridCellClassName({
103
+ align: col.align,
104
+ isTitle: col.type === "title",
105
+ frozen,
106
+ focused,
107
+ editing,
108
+ inRange: !!span,
109
+ selected,
110
+ lastColumn: i === columns.length - 1,
111
+ verticalBorders,
112
+ settlement,
113
+ }), children: [span && (_jsx("span", { "aria-hidden": true, className: GRID_RANGE_TINT_CLASS })), span?.top && (_jsx("span", { "aria-hidden": true, "data-slot": "vk-grid-outline", className: "pointer-events-none absolute z-6 bg-(color:--vk-brand)", style: { top: -2, height: 1, left: spanLeft ? -2 : 0, right: -2 } })), span?.bottom && (_jsx("span", { "aria-hidden": true, "data-slot": "vk-grid-outline", className: "pointer-events-none absolute z-6 bg-(color:--vk-brand)", style: { bottom: -2, height: 1, left: spanLeft ? -2 : 0, right: -2 } })), spanLeft && span && (_jsx("span", { "aria-hidden": true, "data-slot": "vk-grid-outline", className: "pointer-events-none absolute z-6 bg-(color:--vk-brand)", style: { left: -2, width: 1, top: span.top ? -2 : 0, bottom: -2 } })), spanRight && span && (_jsx("span", { "aria-hidden": true, "data-slot": "vk-grid-outline", className: "pointer-events-none absolute z-6 bg-(color:--vk-brand)", style: { right: -2, width: 1, top: span.top ? -2 : 0, bottom: -2 } })), span && span.dotCol === i && !editing && (_jsx(FillDot, { enabled: editingEnabled })), (focused || editing) && (_jsx(GridCellOutline, { editing: editing })), focused && !editing && !span && (_jsx(FillDot, { enabled: editingEnabled })), col.type === "title" && rowIcon && !editing && (_jsx("span", { className: "mr-2.5 flex shrink-0 items-center", children: _jsx(GridRowGlyph, { row: row, rowIcon: rowIcon }) })), editing ? _jsx(GridCellInlineEditor, { ctx: editorCtx }) : null, editing &&
114
+ (editorKind === "number" || editorKind === "range" || (editorKind === "text" && !gridTextOpensBox(col, whole))) ? (_jsx(GridValueUnderEditor, { children: cellValue() })) : (cellValue()), editing ? _jsx(GridCellAnchoredEditor, { ctx: editorCtx }) : null, col.type === "title" && !editing && (_jsx(GridRowHoverActions, { rowKey: rowKey, row: row, selected: selected, actions: [
115
+ ...(rowActions ?? []),
116
+ ...(canEdit(col)
117
+ ? [
118
+ {
119
+ id: "edit",
120
+ icon: () => _jsx(icons.edit, { className: "h-3.5 w-3.5" }),
121
+ label: () => messages({ key: "views.menus.edit" }),
122
+ onClick: () => onStartEdit(rowKey, col.id),
123
+ },
124
+ ]
125
+ : []),
126
+ ] })), (editorKind === "select" || editorKind === "relation" || editorKind === "chips") && (_jsx(GridPickerCaret, { rowKey: rowKey, colId: col.id, editing: editing, onOpen: () => onStartEdit(rowKey, col.id) }))] }, col.id));
127
+ });
128
+ }
@@ -0,0 +1,12 @@
1
+ import { type ListRowIconAccessor } from "../../model/row-icon.js";
2
+ /**
3
+ * The one place a grid row's leading glyph gets its LOOK — size from the row's
4
+ * own scale variable, color neutral unless the list named a semantic tone.
5
+ *
6
+ * Both facts live here rather than at each call site so a list can only choose
7
+ * WHICH icon and (rarely) what state it means, never how big or how loud.
8
+ */
9
+ export declare function GridRowGlyph<Row>({ row, rowIcon, }: {
10
+ row: Row;
11
+ rowIcon: ListRowIconAccessor<Row>;
12
+ }): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { STATUS_SLOT_CLASSES } from "@viewkitjs/fields/design/status-slots";
4
+ import { cx } from "../../internal/cx.js";
5
+ import { normalizeRowIcon } from "../../model/row-icon.js";
6
+ import { useViews } from "../../provider/context.js";
7
+ export function GridRowGlyph({ row, rowIcon, }) {
8
+ const { AppIcon } = useViews().components;
9
+ const resolved = normalizeRowIcon(rowIcon(row));
10
+ if (!resolved)
11
+ return null;
12
+ return (_jsx(AppIcon, { name: resolved.icon, className: cx("h-(--vk-glyph,0.875rem) w-(--vk-glyph,0.875rem)", resolved.tone ? STATUS_SLOT_CLASSES[resolved.tone].glyph : "text-(color:--vk-fg-subtle)") }));
13
+ }
@@ -0,0 +1,33 @@
1
+ import { type ReactNode } from "react";
2
+ import type { ListColumn, ListSelectColor } from "../../model/column-schema.js";
3
+ /**
4
+ * The GRID's host around the shared `SelectEditor` (`@viewkitjs/views/editors/select`) —
5
+ * the option panel is one component across every surface. The edit session owns the
6
+ * one-answer guard and the exit gap; the editor panel opens the popover on a desktop
7
+ * and the sheet on a phone. This host owns only the grid's part: the anchor on the
8
+ * cell rect, the options it offers, and the write.
9
+ *
10
+ * The write waits for the exit gap: notifying at once would unmount the popover (or
11
+ * the sheet) mid-animation. Side effect, and a wanted one: clicks during the exit see
12
+ * the cell still editing and no-op, which is the click-open / click-close toggle.
13
+ */
14
+ export declare function GridSelectEditor<Row>({ column, title, values, current, clearable, seed, optionColors, refuse, onCommit, onCancel, }: {
15
+ column: ListColumn<Row>;
16
+ /** The field's name: the sheet's title on a phone. */
17
+ title: ReactNode;
18
+ /** Option values in display order (declared first, then data-discovered). */
19
+ values: string[];
20
+ /** The cell's current value ("" when unset). */
21
+ current: string;
22
+ /** The column may be emptied: the list opens with None first, and picking it commits "" (Delete clears too). */
23
+ clearable?: boolean;
24
+ /** The letter typed on the cell that opened it: starts the list's search when it has one. */
25
+ seed?: string;
26
+ /** This column's per-user color overrides (select columns). */
27
+ optionColors?: Record<string, ListSelectColor>;
28
+ onCommit: (value: string) => void;
29
+ onCancel: () => void;
30
+ /** The grid's judgement of a value before it is written: its reason when it would refuse it.
31
+ * A refused value keeps the editor open with that reason. */
32
+ refuse?: (value: string) => string | null;
33
+ }): import("react/jsx-runtime").JSX.Element;