@viewkitjs/views 0.4.0 → 0.6.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 (447) hide show
  1. package/CHANGELOG.md +768 -0
  2. package/README.md +5 -3
  3. package/dist/atoms/Avatar.d.ts +2 -0
  4. package/dist/atoms/Avatar.js +13 -0
  5. package/dist/atoms/CellMore.d.ts +2 -0
  6. package/dist/atoms/CellMore.js +4 -0
  7. package/dist/atoms/DisabledReason.d.ts +11 -0
  8. package/dist/atoms/DisabledReason.js +10 -0
  9. package/dist/atoms/DrillRows.d.ts +3 -0
  10. package/dist/atoms/DrillRows.js +27 -0
  11. package/dist/atoms/Loading.d.ts +6 -0
  12. package/dist/atoms/Loading.js +4 -1
  13. package/dist/atoms/PanelRows.d.ts +5 -0
  14. package/dist/atoms/PanelRows.js +38 -0
  15. package/dist/atoms/PanelSearch.d.ts +2 -0
  16. package/dist/atoms/PanelSearch.js +21 -0
  17. package/dist/atoms/Pill.d.ts +2 -0
  18. package/dist/atoms/Pill.js +25 -0
  19. package/dist/atoms/RangeCalendar.d.ts +8 -0
  20. package/dist/atoms/RangeCalendar.js +30 -0
  21. package/dist/atoms/RelationRoles.js +2 -2
  22. package/dist/atoms/SelectionSheet.d.ts +3 -0
  23. package/dist/atoms/SelectionSheet.js +31 -0
  24. package/dist/atoms/ToolbarButton.d.ts +2 -0
  25. package/dist/atoms/ToolbarButton.js +18 -0
  26. package/dist/atoms/defaults.js +22 -0
  27. package/dist/atoms/types.d.ts +257 -1
  28. package/dist/cells/cell-format.d.ts +10 -1
  29. package/dist/cells/cell-title.d.ts +5 -1
  30. package/dist/cells/cell-title.js +2 -2
  31. package/dist/cells/cell-values.js +22 -7
  32. package/dist/cells/relation-wrap.js +1 -1
  33. package/dist/contract.d.ts +515 -18
  34. package/dist/contract.js +660 -5
  35. package/dist/display/actor.js +1 -1
  36. package/dist/display/boolean.js +5 -0
  37. package/dist/display/entity-chip.d.ts +12 -9
  38. package/dist/display/entity-chip.js +4 -5
  39. package/dist/display/fit-values.d.ts +34 -0
  40. package/dist/display/fit-values.js +45 -0
  41. package/dist/display/location.js +1 -1
  42. package/dist/display/multi-value.js +72 -8
  43. package/dist/display/options.d.ts +9 -1
  44. package/dist/display/relation.js +1 -1
  45. package/dist/display/rich-text.js +17 -6
  46. package/dist/display/select.js +6 -4
  47. package/dist/display/status-steps.d.ts +8 -0
  48. package/dist/display/status-steps.js +18 -0
  49. package/dist/display/viewer.js +1 -0
  50. package/dist/editors/BodyFrame.d.ts +29 -0
  51. package/dist/editors/BodyFrame.js +80 -0
  52. package/dist/editors/DateEditor.js +13 -17
  53. package/dist/editors/LocationEditor.d.ts +2 -0
  54. package/dist/editors/LocationEditor.js +29 -5
  55. package/dist/editors/NameEditor.d.ts +2 -0
  56. package/dist/editors/NameEditor.js +27 -7
  57. package/dist/editors/NumberEditor.d.ts +18 -0
  58. package/dist/editors/NumberEditor.js +29 -2
  59. package/dist/editors/RangeEditor.d.ts +2 -0
  60. package/dist/editors/RangeEditor.js +29 -4
  61. package/dist/editors/SelectEditor.d.ts +5 -0
  62. package/dist/editors/SelectEditor.js +3 -2
  63. package/dist/editors/TextEditor.d.ts +11 -1
  64. package/dist/editors/TextEditor.js +25 -8
  65. package/dist/editors/ValueListEditor.d.ts +7 -0
  66. package/dist/editors/ValueListEditor.js +60 -48
  67. package/dist/editors/body-panel.d.ts +7 -0
  68. package/dist/editors/body-panel.js +8 -0
  69. package/dist/editors/edit-session.d.ts +20 -3
  70. package/dist/editors/edit-session.js +43 -3
  71. package/dist/editors/leave-scope.d.ts +23 -0
  72. package/dist/editors/leave-scope.js +28 -0
  73. package/dist/editors/number-body.d.ts +29 -0
  74. package/dist/editors/number-body.js +37 -0
  75. package/dist/editors/parts-body.d.ts +66 -0
  76. package/dist/editors/parts-body.js +114 -0
  77. package/dist/editors/tab-ends.d.ts +5 -0
  78. package/dist/editors/tab-ends.js +7 -0
  79. package/dist/editors/text-body.d.ts +16 -0
  80. package/dist/editors/text-body.js +30 -0
  81. package/dist/editors/values-body.d.ts +47 -0
  82. package/dist/editors/values-body.js +140 -0
  83. package/dist/field-row/FieldRow.d.ts +7 -0
  84. package/dist/field-row/FieldRow.js +44 -24
  85. package/dist/field-row/FieldRowLane.js +12 -4
  86. package/dist/field-row/editors/RowChipsEditor.js +3 -1
  87. package/dist/field-row/editors/RowEditor.js +2 -1
  88. package/dist/field-row/editors/RowNameEditor.d.ts +5 -2
  89. package/dist/field-row/editors/RowNameEditor.js +12 -5
  90. package/dist/field-row/editors/RowNumberEditor.js +18 -2
  91. package/dist/field-row/editors/RowPlaceEditor.js +4 -2
  92. package/dist/field-row/editors/RowRangeEditor.d.ts +5 -2
  93. package/dist/field-row/editors/RowRangeEditor.js +13 -6
  94. package/dist/field-row/editors/RowRelationEditor.js +5 -2
  95. package/dist/field-row/editors/RowSelectEditor.js +4 -1
  96. package/dist/field-row/editors/RowTextEditor.d.ts +1 -1
  97. package/dist/field-row/editors/RowTextEditor.js +12 -3
  98. package/dist/field-row/editors/RowValueListEditor.d.ts +2 -1
  99. package/dist/field-row/editors/RowValueListEditor.js +17 -4
  100. package/dist/field-row/editors/host.d.ts +3 -0
  101. package/dist/field-row/editors/row-session.d.ts +12 -1
  102. package/dist/field-row/editors/row-session.js +52 -2
  103. package/dist/field-row/field-row-button.d.ts +40 -0
  104. package/dist/field-row/field-row-button.js +18 -0
  105. package/dist/field-row/field-row-checkbox.d.ts +9 -0
  106. package/dist/field-row/field-row-checkbox.js +7 -0
  107. package/dist/figures.d.ts +5 -48
  108. package/dist/figures.js +1 -63
  109. package/dist/filters/filter-model.d.ts +2 -0
  110. package/dist/grid/chrome/GridAddColumn.js +17 -3
  111. package/dist/grid/chrome/GridAggregateMenu.d.ts +2 -0
  112. package/dist/grid/chrome/GridAggregateMenu.js +2 -0
  113. package/dist/grid/chrome/GridCellEditors.js +16 -6
  114. package/dist/grid/chrome/GridCellOutline.d.ts +7 -4
  115. package/dist/grid/chrome/GridCellOutline.js +4 -2
  116. package/dist/grid/chrome/GridChipsEditor.js +3 -1
  117. package/dist/grid/chrome/GridColumnMenu.d.ts +7 -4
  118. package/dist/grid/chrome/GridColumnMenu.js +5 -3
  119. package/dist/grid/chrome/GridColumnSortSection.d.ts +23 -3
  120. package/dist/grid/chrome/GridColumnSortSection.js +18 -1
  121. package/dist/grid/chrome/GridFooter.d.ts +4 -1
  122. package/dist/grid/chrome/GridFooter.js +6 -4
  123. package/dist/grid/chrome/GridGroupMenu.d.ts +7 -3
  124. package/dist/grid/chrome/GridGroupMenu.js +30 -8
  125. package/dist/grid/chrome/GridHeader.d.ts +5 -1
  126. package/dist/grid/chrome/GridHeader.js +9 -5
  127. package/dist/grid/chrome/GridLongTextEditor.js +15 -11
  128. package/dist/grid/chrome/GridNameEditor.js +4 -2
  129. package/dist/grid/chrome/GridNumberEditor.d.ts +8 -1
  130. package/dist/grid/chrome/GridNumberEditor.js +15 -3
  131. package/dist/grid/chrome/GridPager.d.ts +7 -0
  132. package/dist/grid/chrome/GridPager.js +34 -0
  133. package/dist/grid/chrome/GridPlaceEditor.js +4 -2
  134. package/dist/grid/chrome/GridRangeEditor.js +12 -4
  135. package/dist/grid/chrome/GridRelationEditor.js +5 -2
  136. package/dist/grid/chrome/GridRow.js +18 -6
  137. package/dist/grid/chrome/GridRowActions.d.ts +8 -3
  138. package/dist/grid/chrome/GridRowActions.js +16 -6
  139. package/dist/grid/chrome/GridRowCells.js +23 -7
  140. package/dist/grid/chrome/GridRowGlyph.d.ts +3 -1
  141. package/dist/grid/chrome/GridRowGlyph.js +7 -2
  142. package/dist/grid/chrome/GridSelectEditor.js +6 -3
  143. package/dist/grid/chrome/GridStructure.d.ts +6 -1
  144. package/dist/grid/chrome/GridStructure.js +32 -8
  145. package/dist/grid/chrome/GridTable.js +36 -24
  146. package/dist/grid/chrome/GridTableSurface.d.ts +5 -1
  147. package/dist/grid/chrome/GridTableSurface.js +5 -2
  148. package/dist/grid/chrome/GridTextEditor.d.ts +5 -1
  149. package/dist/grid/chrome/GridTextEditor.js +13 -3
  150. package/dist/grid/chrome/GridValueListEditor.d.ts +12 -4
  151. package/dist/grid/chrome/GridValueListEditor.js +11 -3
  152. package/dist/grid/chrome/StuckMarker.d.ts +3 -1
  153. package/dist/grid/chrome/StuckMarker.js +6 -2
  154. package/dist/grid/chrome/cells.d.ts +4 -2
  155. package/dist/grid/chrome/cells.js +2 -2
  156. package/dist/grid/chrome/grid-add-column-items.d.ts +1 -1
  157. package/dist/grid/chrome/grid-add-column-items.js +8 -1
  158. package/dist/grid/chrome/grid-button.d.ts +32 -0
  159. package/dist/grid/chrome/grid-button.js +12 -0
  160. package/dist/grid/chrome/grid-cell-classes.d.ts +38 -0
  161. package/dist/grid/chrome/grid-cell-classes.js +30 -0
  162. package/dist/grid/chrome/grid-column-menu-items.d.ts +3 -0
  163. package/dist/grid/chrome/grid-column-menu-items.js +32 -3
  164. package/dist/grid/chrome/grid-columns-template.d.ts +27 -0
  165. package/dist/grid/chrome/grid-columns-template.js +13 -0
  166. package/dist/grid/chrome/grid-edit-session.d.ts +4 -1
  167. package/dist/grid/chrome/grid-edit-session.js +11 -1
  168. package/dist/grid/chrome/grid-group-menu-items.d.ts +8 -1
  169. package/dist/grid/chrome/grid-group-menu-items.js +17 -0
  170. package/dist/grid/chrome/grid-group-menu-parts.d.ts +10 -6
  171. package/dist/grid/chrome/grid-group-menu-parts.js +4 -2
  172. package/dist/grid/chrome/grid-hover.d.ts +4 -1
  173. package/dist/grid/chrome/grid-hover.js +16 -6
  174. package/dist/grid/chrome/grid-pages.d.ts +15 -0
  175. package/dist/grid/chrome/grid-pages.js +9 -0
  176. package/dist/grid/chrome/grid-row-menu-items.js +18 -10
  177. package/dist/grid/chrome/grid-row-props.d.ts +6 -2
  178. package/dist/grid/chrome/grid-row-window.d.ts +7 -0
  179. package/dist/grid/chrome/grid-row-window.js +35 -1
  180. package/dist/grid/chrome/grid-table-props.d.ts +38 -4
  181. package/dist/grid/chrome/useGridColumnLayout.d.ts +3 -1
  182. package/dist/grid/chrome/useGridColumnLayout.js +29 -9
  183. package/dist/grid/chrome/useGridPartColumns.js +1 -1
  184. package/dist/grid/chrome/useGridScrollArea.js +2 -0
  185. package/dist/grid/chrome/useGridTableInteractionModel.d.ts +1 -0
  186. package/dist/grid/chrome/useGridTableInteractionModel.js +5 -3
  187. package/dist/grid/chrome/useGridTableSelection.d.ts +3 -1
  188. package/dist/grid/chrome/useGridTableSelection.js +2 -2
  189. package/dist/grid/chrome/useHeaderDragReorder.js +2 -0
  190. package/dist/grid/core/editing-controller.d.ts +36 -11
  191. package/dist/grid/core/editing-controller.js +92 -25
  192. package/dist/grid/core/grid-aria.d.ts +4 -0
  193. package/dist/grid/core/grid-aria.js +6 -4
  194. package/dist/grid/core/grid-focus.d.ts +6 -0
  195. package/dist/grid/core/grid-focus.js +28 -5
  196. package/dist/grid/core/useGridEditing.d.ts +11 -2
  197. package/dist/grid/core/useGridEditing.js +9 -5
  198. package/dist/grid/core/write-states.d.ts +20 -0
  199. package/dist/grid/core/write-states.js +21 -0
  200. package/dist/grid/grid-format-props.d.ts +26 -0
  201. package/dist/grid/grid-format-props.js +65 -0
  202. package/dist/grid/index.d.ts +3 -1
  203. package/dist/grid/index.js +1 -0
  204. package/dist/grid/useGridTablePrefs.d.ts +20 -21
  205. package/dist/grid/useGridTablePrefs.js +6 -58
  206. package/dist/grid/useGridTableSettings.d.ts +60 -0
  207. package/dist/grid/useGridTableSettings.js +61 -0
  208. package/dist/grouping/sort-groups.d.ts +6 -7
  209. package/dist/internal/count.d.ts +3 -0
  210. package/dist/internal/count.js +3 -0
  211. package/dist/model/aggregates.d.ts +3 -3
  212. package/dist/model/aggregates.js +17 -71
  213. package/dist/model/body-frame.d.ts +16 -0
  214. package/dist/model/body-frame.js +5 -0
  215. package/dist/model/column-capabilities.d.ts +4 -1
  216. package/dist/model/column-capabilities.js +4 -1
  217. package/dist/model/column-filters.d.ts +7 -4
  218. package/dist/model/column-filters.js +26 -18
  219. package/dist/model/column-inspect.d.ts +3 -2
  220. package/dist/model/column-inspect.js +3 -1
  221. package/dist/model/column-order.d.ts +2 -2
  222. package/dist/model/column-schema.d.ts +6 -7
  223. package/dist/model/column-sort.d.ts +11 -0
  224. package/dist/model/column-sort.js +14 -0
  225. package/dist/model/column-state.d.ts +3 -20
  226. package/dist/model/column-state.js +1 -4
  227. package/dist/model/column-types.d.ts +1 -15
  228. package/dist/model/column-types.js +1 -1
  229. package/dist/model/one-value.d.ts +6 -0
  230. package/dist/model/one-value.js +5 -0
  231. package/dist/model/part-columns.d.ts +1 -6
  232. package/dist/model/part-columns.js +1 -1
  233. package/dist/model/part-rows.d.ts +2 -9
  234. package/dist/model/part-rows.js +1 -10
  235. package/dist/model/part-write.js +1 -1
  236. package/dist/model/place-parts.d.ts +6 -0
  237. package/dist/model/place-parts.js +14 -0
  238. package/dist/model/preferences.d.ts +3 -23
  239. package/dist/model/preferences.js +1 -17
  240. package/dist/model/prefs-buckets.d.ts +0 -27
  241. package/dist/model/prefs-buckets.js +1 -1
  242. package/dist/model/relation-filters.d.ts +13 -3
  243. package/dist/model/relation-filters.js +9 -4
  244. package/dist/model/row-icon.d.ts +17 -11
  245. package/dist/model/settings-columns.d.ts +34 -0
  246. package/dist/model/settings-columns.js +146 -0
  247. package/dist/model/settings-look.d.ts +17 -0
  248. package/dist/model/settings-look.js +23 -0
  249. package/dist/model/view-rules.d.ts +32 -6
  250. package/dist/model/view-rules.js +99 -23
  251. package/dist/panels/availability.d.ts +26 -0
  252. package/dist/panels/availability.js +28 -0
  253. package/dist/panels/filter/DateFilterBody.d.ts +42 -0
  254. package/dist/panels/filter/DateFilterBody.js +64 -0
  255. package/dist/panels/filter/DateFilterCalendar.d.ts +19 -0
  256. package/dist/panels/filter/DateFilterCalendar.js +37 -0
  257. package/dist/panels/filter/DateFilterInput.d.ts +16 -0
  258. package/dist/panels/filter/DateFilterInput.js +37 -0
  259. package/dist/panels/filter/FilterIcon.d.ts +7 -0
  260. package/dist/panels/filter/FilterIcon.js +15 -0
  261. package/dist/panels/filter/MenuSelect.d.ts +12 -0
  262. package/dist/panels/filter/MenuSelect.js +34 -0
  263. package/dist/panels/filter/NumberFilterBody.d.ts +21 -0
  264. package/dist/panels/filter/NumberFilterBody.js +76 -0
  265. package/dist/panels/filter/RangeFilterBody.d.ts +19 -0
  266. package/dist/panels/filter/RangeFilterBody.js +71 -0
  267. package/dist/panels/filter/RelationFilterBody.d.ts +17 -0
  268. package/dist/panels/filter/RelationFilterBody.js +20 -0
  269. package/dist/panels/filter/TextFilterBody.d.ts +31 -0
  270. package/dist/panels/filter/TextFilterBody.js +44 -0
  271. package/dist/panels/filter/TimeScopeDetail.d.ts +6 -0
  272. package/dist/panels/filter/TimeScopeDetail.js +47 -0
  273. package/dist/panels/filter/details.d.ts +17 -0
  274. package/dist/panels/filter/details.js +73 -0
  275. package/dist/panels/filter/filter-list.d.ts +23 -0
  276. package/dist/panels/filter/filter-list.js +38 -0
  277. package/dist/panels/group-sort.d.ts +24 -0
  278. package/dist/panels/group-sort.js +58 -0
  279. package/dist/panels/index.d.ts +24 -0
  280. package/dist/panels/index.js +17 -0
  281. package/dist/panels/labels.d.ts +37 -0
  282. package/dist/panels/labels.js +166 -0
  283. package/dist/panels/model.d.ts +343 -0
  284. package/dist/panels/model.js +77 -0
  285. package/dist/panels/react/GroupBucketsList.d.ts +16 -0
  286. package/dist/panels/react/GroupBucketsList.js +38 -0
  287. package/dist/panels/react/LayoutColumnsList.d.ts +24 -0
  288. package/dist/panels/react/LayoutColumnsList.js +71 -0
  289. package/dist/panels/react/PopoverColumnDetail.d.ts +11 -0
  290. package/dist/panels/react/PopoverColumnDetail.js +24 -0
  291. package/dist/panels/react/chrome.d.ts +17 -0
  292. package/dist/panels/react/chrome.js +8 -0
  293. package/dist/panels/react/column-refusals.d.ts +7 -0
  294. package/dist/panels/react/column-refusals.js +14 -0
  295. package/dist/panels/react/customize.d.ts +26 -0
  296. package/dist/panels/react/customize.js +98 -0
  297. package/dist/panels/react/drag.d.ts +2 -0
  298. package/dist/panels/react/drag.js +6 -0
  299. package/dist/panels/react/field-editor.d.ts +10 -0
  300. package/dist/panels/react/field-editor.js +1 -0
  301. package/dist/panels/react/filter-panel.d.ts +15 -0
  302. package/dist/panels/react/filter-panel.js +48 -0
  303. package/dist/panels/react/layout-detail.d.ts +4 -0
  304. package/dist/panels/react/layout-detail.js +21 -0
  305. package/dist/panels/react/order-details.d.ts +32 -0
  306. package/dist/panels/react/order-details.js +81 -0
  307. package/dist/panels/react/panel-header.d.ts +10 -0
  308. package/dist/panels/react/panel-header.js +12 -0
  309. package/dist/panels/react/panel-sheet.d.ts +19 -0
  310. package/dist/panels/react/panel-sheet.js +22 -0
  311. package/dist/panels/react/popover.d.ts +71 -0
  312. package/dist/panels/react/popover.js +47 -0
  313. package/dist/panels/react/root-list.d.ts +6 -0
  314. package/dist/panels/react/root-list.js +31 -0
  315. package/dist/panels/react/toolbar/ReadyToolbar.d.ts +42 -0
  316. package/dist/panels/react/toolbar/ReadyToolbar.js +92 -0
  317. package/dist/panels/react/toolbar/Toolbar.d.ts +16 -0
  318. package/dist/panels/react/toolbar/Toolbar.js +34 -0
  319. package/dist/panels/react/toolbar/ToolbarButton.d.ts +5 -0
  320. package/dist/panels/react/toolbar/ToolbarButton.js +9 -0
  321. package/dist/panels/react/toolbar/ToolbarFilter.d.ts +19 -0
  322. package/dist/panels/react/toolbar/ToolbarFilter.js +32 -0
  323. package/dist/panels/react/toolbar/ToolbarNew.d.ts +12 -0
  324. package/dist/panels/react/toolbar/ToolbarNew.js +21 -0
  325. package/dist/panels/react/toolbar/ToolbarOptions.d.ts +25 -0
  326. package/dist/panels/react/toolbar/ToolbarOptions.js +33 -0
  327. package/dist/panels/react/toolbar/ToolbarSearch.d.ts +9 -0
  328. package/dist/panels/react/toolbar/ToolbarSearch.js +41 -0
  329. package/dist/panels/react/toolbar/ToolbarSort.d.ts +12 -0
  330. package/dist/panels/react/toolbar/ToolbarSort.js +16 -0
  331. package/dist/panels/react/toolbar/ToolbarViews.d.ts +13 -0
  332. package/dist/panels/react/toolbar/ToolbarViews.js +24 -0
  333. package/dist/panels/react/toolbar/context.d.ts +29 -0
  334. package/dist/panels/react/toolbar/context.js +49 -0
  335. package/dist/panels/react/toolbar/panel-part.d.ts +37 -0
  336. package/dist/panels/react/toolbar/panel-part.js +37 -0
  337. package/dist/panels/react/toolbar/panel-state.d.ts +9 -0
  338. package/dist/panels/react/toolbar/panel-state.js +12 -0
  339. package/dist/panels/react/toolbar/use-box-narrow.d.ts +2 -0
  340. package/dist/panels/react/toolbar/use-box-narrow.js +18 -0
  341. package/dist/panels/react/toolbar/use-list-settings-state.d.ts +10 -0
  342. package/dist/panels/react/toolbar/use-list-settings-state.js +10 -0
  343. package/dist/panels/react/view-actions.d.ts +4 -0
  344. package/dist/panels/react/view-actions.js +37 -0
  345. package/dist/panels/react/view-footer.d.ts +16 -0
  346. package/dist/panels/react/view-footer.js +11 -0
  347. package/dist/panels/react/views-row/FoldingViewRow.d.ts +4 -0
  348. package/dist/panels/react/views-row/FoldingViewRow.js +105 -0
  349. package/dist/panels/react/views-row/HScrollRow.d.ts +7 -0
  350. package/dist/panels/react/views-row/HScrollRow.js +42 -0
  351. package/dist/panels/react/views-row/PillGroup.d.ts +30 -0
  352. package/dist/panels/react/views-row/PillGroup.js +86 -0
  353. package/dist/panels/react/views-row/ViewAxes.d.ts +6 -0
  354. package/dist/panels/react/views-row/ViewAxes.js +16 -0
  355. package/dist/panels/react/views-row/ViewCreatePill.d.ts +7 -0
  356. package/dist/panels/react/views-row/ViewCreatePill.js +11 -0
  357. package/dist/panels/react/views-row/ViewPicker.d.ts +5 -0
  358. package/dist/panels/react/views-row/ViewPicker.js +65 -0
  359. package/dist/panels/react/views-row/ViewPickerRow.d.ts +7 -0
  360. package/dist/panels/react/views-row/ViewPickerRow.js +18 -0
  361. package/dist/panels/react/views-row/ViewTabs.d.ts +31 -0
  362. package/dist/panels/react/views-row/ViewTabs.js +29 -0
  363. package/dist/panels/react/views-row/menu-classes.d.ts +6 -0
  364. package/dist/panels/react/views-row/menu-classes.js +3 -0
  365. package/dist/panels/react/views-row/use-anchored-toggle.d.ts +19 -0
  366. package/dist/panels/react/views-row/use-anchored-toggle.js +31 -0
  367. package/dist/panels/react.d.ts +51 -0
  368. package/dist/panels/react.js +43 -0
  369. package/dist/panels/settings/axes.d.ts +28 -0
  370. package/dist/panels/settings/axes.js +71 -0
  371. package/dist/panels/settings/filters.d.ts +5 -0
  372. package/dist/panels/settings/filters.js +62 -0
  373. package/dist/panels/settings/group-buckets.d.ts +23 -0
  374. package/dist/panels/settings/group-buckets.js +73 -0
  375. package/dist/panels/settings/input.d.ts +69 -0
  376. package/dist/panels/settings/input.js +1 -0
  377. package/dist/panels/settings/layout.d.ts +5 -0
  378. package/dist/panels/settings/layout.js +244 -0
  379. package/dist/panels/settings/order.d.ts +19 -0
  380. package/dist/panels/settings/order.js +271 -0
  381. package/dist/panels/settings/settings-panels.d.ts +17 -0
  382. package/dist/panels/settings/settings-panels.js +28 -0
  383. package/dist/panels/toolbar/clear.d.ts +9 -0
  384. package/dist/panels/toolbar/clear.js +26 -0
  385. package/dist/panels/toolbar/counts.d.ts +15 -0
  386. package/dist/panels/toolbar/counts.js +21 -0
  387. package/dist/panels/toolbar/edit-view.d.ts +5 -0
  388. package/dist/panels/toolbar/edit-view.js +18 -0
  389. package/dist/panels/toolbar/model.d.ts +34 -0
  390. package/dist/panels/toolbar/model.js +52 -0
  391. package/dist/panels/use-filter-opened.d.ts +8 -0
  392. package/dist/panels/use-filter-opened.js +11 -0
  393. package/dist/panels/view-state.d.ts +38 -0
  394. package/dist/panels/view-state.js +1 -0
  395. package/dist/panels/views-row/model.d.ts +131 -0
  396. package/dist/panels/views-row/model.js +14 -0
  397. package/dist/provider/ViewsProvider.d.ts +50 -6
  398. package/dist/provider/ViewsProvider.js +33 -2
  399. package/dist/provider/components.d.ts +274 -11
  400. package/dist/provider/context.d.ts +23 -2
  401. package/dist/provider/desktop.d.ts +3 -0
  402. package/dist/provider/desktop.js +7 -4
  403. package/dist/react.d.ts +5 -2
  404. package/dist/selection/SelectionBar.d.ts +18 -0
  405. package/dist/selection/SelectionBar.js +98 -0
  406. package/dist/selection/SelectionBarPhone.d.ts +3 -0
  407. package/dist/selection/SelectionBarPhone.js +14 -0
  408. package/dist/selection/bar-overflow.d.ts +12 -0
  409. package/dist/selection/bar-overflow.js +55 -0
  410. package/dist/selection/bar-parts.d.ts +17 -0
  411. package/dist/selection/bar-parts.js +19 -0
  412. package/dist/selection/index.d.ts +2 -0
  413. package/dist/selection/index.js +1 -0
  414. package/dist/selection/types.d.ts +3 -2
  415. package/dist/selection/useListSelectionShortcuts.d.ts +3 -2
  416. package/dist/selection/useListSelectionShortcuts.js +1 -1
  417. package/dist/selection/verbs.d.ts +41 -0
  418. package/dist/selection/verbs.js +1 -0
  419. package/docs/contract.md +355 -35
  420. package/docs/getting-started.md +1 -1
  421. package/docs/guides/atoms.md +39 -6
  422. package/docs/guides/columns.md +1 -1
  423. package/docs/guides/display.md +3 -2
  424. package/docs/guides/editors.md +4 -3
  425. package/docs/guides/selection.md +35 -21
  426. package/docs/guides/the-grid.md +24 -13
  427. package/docs/guides/the-provider.md +24 -6
  428. package/docs/index.md +2 -0
  429. package/docs/install.md +3 -1
  430. package/docs/reference/cells.md +1 -1
  431. package/docs/reference/display.md +5 -4
  432. package/docs/reference/editors-location.md +3 -1
  433. package/docs/reference/editors-name.md +3 -1
  434. package/docs/reference/editors-number.md +1 -0
  435. package/docs/reference/editors-range.md +3 -1
  436. package/docs/reference/editors-session.md +1 -0
  437. package/docs/reference/editors-text.md +2 -2
  438. package/docs/reference/editors-value-list.md +1 -1
  439. package/docs/reference/field-row.md +2 -2
  440. package/docs/reference/grid.md +10 -7
  441. package/docs/reference/panels-react.md +101 -0
  442. package/docs/reference/panels.md +123 -0
  443. package/docs/reference/react.md +45 -12
  444. package/docs/reference/selection.md +11 -3
  445. package/docs/reference/views.md +41 -38
  446. package/package.json +33 -4
  447. package/skills/views/SKILL.md +5 -4
@@ -1,5 +1,8 @@
1
1
  import type { ReactNode } from "react";
2
+ import type { ListColumnState } from "@viewkitjs/fields/query";
2
3
  import type { ListColumn } from "./column-schema.js";
4
+ /** A list's column state and its density are fields' own, so a server reads them without React. */
5
+ export type { ListColumnState, ListDensity } from "@viewkitjs/fields/query";
3
6
  /** One column of a view, as a list that shows and hides columns reads it. */
4
7
  export type ListColumnItem = {
5
8
  id: string;
@@ -28,23 +31,6 @@ export type ListColumnsConfig = {
28
31
  onReset?: () => void;
29
32
  dirty?: boolean;
30
33
  };
31
- export type ListColumnState = {
32
- widths?: Record<string, number>;
33
- hidden?: string[];
34
- visible?: string[];
35
- order?: string[];
36
- /** Board only: ids that START a new line on the card. Absent = the board's
37
- * default line-building (dates on their own line); present — even empty —
38
- * is the user's explicit layout. The grid ignores it. */
39
- breaks?: string[];
40
- };
41
- export declare const LIST_DEFAULT_MIN_WIDTH = 60;
42
- /**
43
- * The density vocabulary, shared by every view. How a view SPENDS it differs —
44
- * the grid multiplies its pixel scale, the rows views widen their padding — so
45
- * only the names live here; see `grid/core/grid-scale.ts`.
46
- */
47
- export type ListDensity = "compact" | "default" | "spacious";
48
34
  /**
49
35
  * The decimal places a number column can be shown at, offered by BOTH doors onto
50
36
  * the setting — the grid's header menu and the Layout drill-in's Columns panel.
@@ -78,6 +64,3 @@ export declare function resolveColumnOrder<Row>(declared: ListColumn<Row>[], ord
78
64
  export declare function resolveVisibleColumns<Row>(declared: ListColumn<Row>[], state?: ListColumnState, viewId?: string): ListColumn<Row>[];
79
65
  export declare function resolveColumnWidths<Row>(visible: ListColumn<Row>[], widths?: Record<string, number>): Record<string, number>;
80
66
  export declare function prettifyOptionValue(value: string): string;
81
- export declare function computeMinWidth(columns: ListColumn<never>[] | {
82
- width: number;
83
- }[], gutterPx: number): number;
@@ -1,4 +1,4 @@
1
- export const LIST_DEFAULT_MIN_WIDTH = 60;
1
+ const LIST_DEFAULT_MIN_WIDTH = 60;
2
2
  export const LIST_DECIMALS_CHOICES = [0, 1, 2, 3, 4];
3
3
  export function columnHideable(col) {
4
4
  return col.type !== "title";
@@ -90,6 +90,3 @@ export function resolveColumnWidths(visible, widths) {
90
90
  export function prettifyOptionValue(value) {
91
91
  return value.replace(/[_-]+/g, " ").replace(/\b\w/g, (character) => character.toUpperCase());
92
92
  }
93
- export function computeMinWidth(columns, gutterPx) {
94
- return columns.reduce((sum, column) => sum + column.width, gutterPx);
95
- }
@@ -1,6 +1,6 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { RelationSource } from "../fields/relation-source-types.js";
3
- import type { ListColumn, ListColumnType, ListRelationValue } from "./column-schema.js";
3
+ import type { ListColumn, ListColumnType } from "./column-schema.js";
4
4
  /**
5
5
  * ONE declaration per column type — what the machinery may do with it.
6
6
  *
@@ -75,20 +75,6 @@ export declare function typeRule(type: ListColumnType | undefined): GridTypeRule
75
75
  * no list, or that presents no field to read its values, takes no paste, as it mounts no editor (`gridEditorKind`).
76
76
  */
77
77
  export declare function gridPasteKind<Row>(col: ListColumn<Row>): GridPasteKind | null;
78
- /**
79
- * A relation value with the column's default KIND filled in.
80
- *
81
- * The rule itself is the contract's (`resolveRelationValue`), because a display
82
- * core has to answer it without a column to look at. What the list adds is the
83
- * one thing the contract has no word for: where the default kind comes from —
84
- * `col.relation.entity`, the monomorphic column's single answer. The value's
85
- * own `entity` still wins, which is the polymorphic case.
86
- *
87
- * The result is typed as `ListRelationValue` because the list's value is the
88
- * contract's plus an optional per-value `icon`, so a resolved value that
89
- * carried one still has it.
90
- */
91
- export declare function resolveGridRelation<Row>(col: ListColumn<Row>, raw: unknown): ListRelationValue | null;
92
78
  /**
93
79
  * The column's candidates, each wearing the glyph its KIND wears everywhere
94
80
  * else in the app — what the picker offers.
@@ -31,7 +31,7 @@ export function gridPasteKind(col) {
31
31
  return col.field && col.type && isMultipleType(col.type) ? "list" : null;
32
32
  return typeRule(col.type)?.paste ?? null;
33
33
  }
34
- export function resolveGridRelation(col, raw) {
34
+ function resolveGridRelation(col, raw) {
35
35
  return resolveRelationValue(raw, col.relation?.entity);
36
36
  }
37
37
  export function gridRelationSource(col, entityIcon) {
@@ -0,0 +1,6 @@
1
+ import type { FieldType } from "@viewkitjs/fields";
2
+ /** Whether a field holding one email or one domain opens the text box in its cell (`text`, the default) or the value list
3
+ * holding one value (`list`). */
4
+ export type ViewsOneValueEditors = Partial<Record<"email" | "domain", "text" | "list">>;
5
+ /** A single (not `multiple`) email or domain field the provider's rule opens as a list of one. */
6
+ export declare function opensAsList(type: FieldType | undefined, multiple: boolean | undefined, rules: ViewsOneValueEditors | undefined): boolean;
@@ -0,0 +1,5 @@
1
+ export function opensAsList(type, multiple, rules) {
2
+ if (multiple || !rules)
3
+ return false;
4
+ return (type === "email" || type === "domain") && rules[type] === "list";
5
+ }
@@ -1,12 +1,7 @@
1
- import { type FieldDef, type FieldType } from "@viewkitjs/fields";
1
+ import { type FieldDef } from "@viewkitjs/fields";
2
2
  import { type ViewsMessageResolver } from "../contract.js";
3
3
  import type { ListColumnFormat } from "./column-format.js";
4
4
  import type { ListColumn } from "./column-schema.js";
5
- /** The parts each stored type offers a column for, in the order "+ Add column" lists them. A place's street has none:
6
- * ViewKit's part tables don't list it, and Attio offers none. */
7
- export declare const GRID_PART_COLUMNS: {
8
- readonly [K in FieldType]?: readonly string[];
9
- };
10
5
  type PartColumnOptions = {
11
6
  messages?: ViewsMessageResolver;
12
7
  locale?: string;
@@ -3,7 +3,7 @@ import { LOCATION_FILTER_PARTS, sortOrdersFor } from "@viewkitjs/fields/query";
3
3
  import { resolveViewsMessage } from "../contract.js";
4
4
  import { rangePeriodShort, rangeUnit } from "../fields/range-unit.js";
5
5
  import { partKey, partLabel } from "./part-rows.js";
6
- export const GRID_PART_COLUMNS = {
6
+ const GRID_PART_COLUMNS = {
7
7
  location: LOCATION_FILTER_PARTS,
8
8
  name: ["given", "family"],
9
9
  range: RANGE_PARTS,
@@ -1,14 +1,7 @@
1
1
  import { type FieldType } from "@viewkitjs/fields";
2
2
  import { type ViewsMessageResolver } from "../contract.js";
3
- /** Joins a row's id and its part. A part never holds it, so a key splits at its last one. */
4
- export declare const PART_KEY_SEPARATOR = "::";
5
- /** A row's key for one part: a column id (Filter) or a field key (Sort, Group), then the part. */
6
- export declare function partKey(id: string, part: string): string;
7
- /** `{ id }` for a whole-value key, `{ id, part }` for a part key; split at the LAST separator. */
8
- export declare function parsePartKey(key: string): {
9
- id: string;
10
- part?: string;
11
- };
3
+ /** The part-key grammar is fields' own: a list's column state names a part column by it. */
4
+ export { partKey, parsePartKey } from "@viewkitjs/fields/query";
12
5
  /** The parts each type offers a Filter row for, in the order the rows are listed. A name's full name has none: the
13
6
  * name's own row already reads it. */
14
7
  export declare const FILTER_PART_ROWS: {
@@ -1,16 +1,7 @@
1
1
  import { RANGE_PARTS } from "@viewkitjs/fields";
2
2
  import { LOCATION_FILTER_PARTS, LOCATION_ORDERS } from "@viewkitjs/fields/query";
3
3
  import { resolveViewsMessage } from "../contract.js";
4
- export const PART_KEY_SEPARATOR = "::";
5
- export function partKey(id, part) {
6
- return `${id}${PART_KEY_SEPARATOR}${part}`;
7
- }
8
- export function parsePartKey(key) {
9
- const at = key.lastIndexOf(PART_KEY_SEPARATOR);
10
- if (at < 0)
11
- return { id: key };
12
- return { id: key.slice(0, at), part: key.slice(at + PART_KEY_SEPARATOR.length) };
13
- }
4
+ export { partKey, parsePartKey } from "@viewkitjs/fields/query";
14
5
  export const FILTER_PART_ROWS = {
15
6
  location: LOCATION_FILTER_PARTS,
16
7
  name: ["given", "family"],
@@ -35,7 +35,7 @@ export function gridPartWrite(part, wholeStored, next, conventions, options = {}
35
35
  }
36
36
  else if (type === "location") {
37
37
  if (of.part === "countryCode" && typeof value === "string")
38
- value = countryCodeOf(value, [conventions.locale, "en"]) ?? value.trim();
38
+ value = countryCodeOf(value, [conventions.language, conventions.locale, "en"]) ?? value.trim();
39
39
  whole = withLocationPart(wholeStored, of.part, value == null ? null : String(value));
40
40
  }
41
41
  else if (type === "range") {
@@ -0,0 +1,6 @@
1
+ import { type FieldDef } from "@viewkitjs/fields";
2
+ /** The field a lookup reaches at the end of its chain (`target` after `target`); any other field, itself. */
3
+ export declare function farField(field: FieldDef): FieldDef;
4
+ /** `offered` narrowed to the parts the column's place keeps: its own field's `parts`, or, for a lookup, its far
5
+ * field's. A field that is no place, or a place that names no parts, keeps `offered` as it is. */
6
+ export declare function keptParts(field: FieldDef, offered: readonly string[]): readonly string[];
@@ -0,0 +1,14 @@
1
+ import { valueTypeOf } from "@viewkitjs/fields";
2
+ export function farField(field) {
3
+ let at = field;
4
+ while (at.type === "lookup" && at.target)
5
+ at = at.target;
6
+ return at;
7
+ }
8
+ export function keptParts(field, offered) {
9
+ if (valueTypeOf(field) !== "location")
10
+ return offered;
11
+ const place = farField(field);
12
+ const held = place.type === "location" ? place.parts : undefined;
13
+ return held ? offered.filter((part) => held.includes(part)) : offered;
14
+ }
@@ -1,12 +1,14 @@
1
1
  import type { ListAggregateKind, ListDateStyle, ListDateStyleOverrides, ListDurationStyle, ListDurationStyleOverrides, ListOptionColorOverrides, ListPercentDisplayOverrides, ListSelectColor, ListShowTimeOverrides } from "./column-schema.js";
2
2
  import type { PercentDisplay } from "@viewkitjs/fields";
3
- import type { BoardLaneSpec, FilterRelationRule } from "@viewkitjs/fields/query";
3
+ import type { BoardLaneSpec, FilterRelationRule, ListGroupSummaryPart } from "@viewkitjs/fields/query";
4
4
  import type { MoneyReading } from "../fields/currency.js";
5
5
  import type { ListColumnState, ListDensity } from "./column-state.js";
6
6
  import type { TextFilterRule } from "../filters/text-filter.js";
7
7
  import type { NumberFilterRule } from "../filters/number-filter.js";
8
8
  import type { DateFilterRule } from "../filters/date-filter.js";
9
9
  import type { RangeFilterRule } from "../filters/range-filter.js";
10
+ /** A group header's figures are fields' own, so a server reads a stored view without React. */
11
+ export { groupFigurePart, isGroupSummaryPart, normalizeGroupSummary, type ListGroupFigurePart, type ListGroupSummaryPart, } from "@viewkitjs/fields/query";
10
12
  /**
11
13
  * One column's filter rule. Tagged with its editor so the persisted blob stays
12
14
  * readable as number / date / boolean rules land beside these — a stored rule
@@ -112,28 +114,6 @@ export type ListViewPrefs = {
112
114
  * time. Empty = a bare group name, which is a legitimate choice. */
113
115
  groupSummary: ListGroupSummaryPart[];
114
116
  };
115
- /** A figure after the list's first: the total under one column, named by its id (POR-1393). */
116
- export type ListGroupFigurePart = `total:${string}`;
117
- /** The figures a group header can carry: its count, and its totals. `total` is the list's FIRST figure, named after
118
- * its own column in the menu; each later one is `total:<columnId>`. The first stays a position, not a column, so
119
- * every view stored before the header offered more than one figure keeps the one it showed. */
120
- export type ListGroupSummaryPart = "count" | "total" | ListGroupFigurePart;
121
- /** The part that shows one figure: `total` for the list's first, `total:<columnId>` for every other. */
122
- export declare function groupFigurePart(columnId: string, first: boolean): ListGroupSummaryPart;
123
- /** Whether a stored value is a part a group header knows: `count`, `total`, or `total:` and a column id of 1–120
124
- * characters. */
125
- export declare function isGroupSummaryPart(value: unknown): value is ListGroupSummaryPart;
126
- /**
127
- * Reads a stored `groupSummary` back as a set.
128
- *
129
- * It was a single `"count" | "total"` before, so every persisted blob out there
130
- * still holds a bare string — parsed here rather than migrated, because a view
131
- * pref is not worth a migration. Keeps the parts it recognises and drops the
132
- * rest, so a value it cannot read comes back as `[]`, a bare group name, never
133
- * the default: a caller with no stored value applies
134
- * `LIST_VIEW_PREF_DEFAULTS.groupSummary` itself before calling.
135
- */
136
- export declare function normalizeGroupSummary(value: unknown): ListGroupSummaryPart[];
137
117
  export declare const LIST_VIEW_PREF_DEFAULTS: ListViewPrefs;
138
118
  /** Set or drop one column's rule, keeping the map sparse (null = no rule). */
139
119
  export declare function setFilterRule(current: ListFilterRuleState, columnId: string, rule: ListFilterRule | null): ListFilterRuleState;
@@ -1,20 +1,4 @@
1
- const FIGURE_PREFIX = "total:";
2
- const FIGURE_KEY_MAX = 120;
3
- export function groupFigurePart(columnId, first) {
4
- return first ? "total" : `${FIGURE_PREFIX}${columnId}`;
5
- }
6
- export function isGroupSummaryPart(value) {
7
- if (value === "count" || value === "total")
8
- return true;
9
- if (typeof value !== "string" || !value.startsWith(FIGURE_PREFIX))
10
- return false;
11
- const key = value.length - FIGURE_PREFIX.length;
12
- return key >= 1 && key <= FIGURE_KEY_MAX;
13
- }
14
- export function normalizeGroupSummary(value) {
15
- const parts = Array.isArray(value) ? value : typeof value === "string" ? [value] : [];
16
- return Array.from(new Set(parts.filter(isGroupSummaryPart)));
17
- }
1
+ export { groupFigurePart, isGroupSummaryPart, normalizeGroupSummary, } from "@viewkitjs/fields/query";
18
2
  export const LIST_VIEW_PREF_DEFAULTS = {
19
3
  viewStyle: "grid",
20
4
  viewStyleMobile: "rows",
@@ -1,6 +1,4 @@
1
1
  import type { ListColumnState, ListDensity } from "./column-state.js";
2
- import type { ListDateStyle, ListDurationStyle, ListSelectColor } from "./column-schema.js";
3
- import type { PercentDisplay } from "@viewkitjs/fields";
4
2
  import type { BoardLaneSpec } from "@viewkitjs/fields/query";
5
3
  import type { MoneyReading } from "../fields/currency.js";
6
4
  /**
@@ -97,31 +95,6 @@ export type ListMoneyBucket = {
97
95
  };
98
96
  export declare const EMPTY_MONEY_BUCKET: ListMoneyBucket;
99
97
  export declare function moneyKey(listKey: string): string;
100
- /**
101
- * How a FIELD reads — the workspace's shared answer (system.field_settings),
102
- * identical in every view and on every surface. The flat maps in
103
- * `ListViewPrefs` are this shape spread per key, keyed by FIELD KEY.
104
- */
105
- export type ListFieldFormatPrefs = {
106
- decimals?: number;
107
- currency?: string;
108
- dateStyle?: ListDateStyle;
109
- durationStyle?: ListDurationStyle;
110
- withTime?: boolean;
111
- optionColors?: Record<string, ListSelectColor>;
112
- percentDisplay?: PercentDisplay;
113
- };
114
- /**
115
- * One view's layout, fully resolved — every key this bucket can carry has a
116
- * value here.
117
- *
118
- * Completeness is load-bearing, not tidiness. `layoutToFlat` emits all seven
119
- * keys unconditionally and spreads them over the surface blob, so a key absent
120
- * here arrived as `undefined` and silently beat the flat default it was meant
121
- * to inherit. Two partial sources made the effective default depend on which
122
- * view id a list had written under and whether the legacy hoist had run.
123
- */
124
- export declare const LIST_LAYOUT_DEFAULTS: ListViewLayout;
125
98
  /** What vertical borders resolve to for a view that has no answer of its own:
126
99
  * the reader's default, or the shipped one when they never set it. */
127
100
  export declare function verticalBordersDefault(defaults?: ListDefaults): boolean;
@@ -5,7 +5,7 @@ export const EMPTY_MONEY_BUCKET = Object.freeze({
5
5
  export function moneyKey(listKey) {
6
6
  return `list:${listKey}:money`;
7
7
  }
8
- export const LIST_LAYOUT_DEFAULTS = {
8
+ const LIST_LAYOUT_DEFAULTS = {
9
9
  columns: {},
10
10
  density: "default",
11
11
  verticalBorders: false,
@@ -1,6 +1,7 @@
1
1
  import type { ReactNode } from "react";
2
- import { type FieldDef } from "@viewkitjs/fields";
2
+ import { type FieldConventions, type FieldDef } from "@viewkitjs/fields";
3
3
  import type { FilterRelationRule } from "@viewkitjs/fields/query";
4
+ import { type ViewsMessageResolver } from "../contract.js";
4
5
  import type { FilterConfigRelation } from "../filters/filter-model.js";
5
6
  import type { ListColumn } from "./column-schema.js";
6
7
  export type RelationFilterTarget = {
@@ -13,13 +14,18 @@ export type RelationFilterTarget = {
13
14
  /** The far fields whose values the list's route answers by name (POR-1548): a far relation, user or actor the
14
15
  * builder can name. A far field left out stays greyed. */
15
16
  named?: readonly string[];
17
+ /** The far record's noun in the app's words, one and many: "campaign", "campaigns" (VK-507). Absent, it is the
18
+ * kind with its hyphens as spaces, and the label lower-cased in the conventions' locale. */
19
+ noun?: {
20
+ one: string;
21
+ many: string;
22
+ };
16
23
  };
17
24
  /** What separates a far path's hops and its far field (POR-1548): `executions.campaign`. A field key never holds one. */
18
25
  export declare const FAR_PATH_SEPARATOR = ".";
19
26
  /** A far field's path, as the list's route answers its values: the relation's key (itself a two-hop path, `a.b`, for
20
27
  * a rollup's second hop) and the far field's. */
21
28
  export declare function farPathOf(relationKey: string, farKey: string): string;
22
- export declare const RELATED_RECORDS_SECTION = "Related records";
23
29
  /** A Related records row's key, from the relation's field key. */
24
30
  export declare function relationFilterKey(fieldKey: string): string;
25
31
  /** The relation's field key, back from a Related records row's key. */
@@ -31,7 +37,7 @@ export type FarValues = {
31
37
  labels?: Readonly<Record<string, Readonly<Record<string, string>>>>;
32
38
  onWanted: (path: string) => void;
33
39
  };
34
- export declare function buildRelationFilters({ targets, rules, onRuleChange, subject, icon, fieldIcon, farValues, }: {
40
+ export declare function buildRelationFilters({ targets, rules, onRuleChange, subject, icon, fieldIcon, farValues, messages, conventions, }: {
35
41
  targets: Readonly<Record<string, RelationFilterTarget>>;
36
42
  rules: Readonly<Record<string, FilterRelationRule>>;
37
43
  onRuleChange: (fieldKey: string, rule: FilterRelationRule | null) => void;
@@ -41,5 +47,9 @@ export declare function buildRelationFilters({ targets, rules, onRuleChange, sub
41
47
  fieldIcon?: (col: ListColumn<FarRow>) => ReactNode;
42
48
  /** The far values the host answers by path (POR-1548). Absent: every far relation, user or actor stays greyed. */
43
49
  farValues?: FarValues;
50
+ /** The app's words, for the section and the Where rows; the package's English by default. */
51
+ messages?: ViewsMessageResolver;
52
+ /** The reader's conventions, for the Where rows (a far place's country names); English by default. */
53
+ conventions?: FieldConventions;
44
54
  }): FilterConfigRelation[];
45
55
  export {};
@@ -1,11 +1,11 @@
1
1
  import { presentedDef, valueTypeOf } from "@viewkitjs/fields";
2
+ import { resolveViewsMessage } from "../contract.js";
2
3
  import { canChooseEvery, whereRulesOf, withWhereRule } from "../filters/relation-filter.js";
3
4
  import { buildColumnFilters } from "./column-filters.js";
4
5
  export const FAR_PATH_SEPARATOR = ".";
5
6
  export function farPathOf(relationKey, farKey) {
6
7
  return `${relationKey}${FAR_PATH_SEPARATOR}${farKey}`;
7
8
  }
8
- export const RELATED_RECORDS_SECTION = "Related records";
9
9
  const RELATION_KEY_PREFIX = "relation:";
10
10
  export function relationFilterKey(fieldKey) {
11
11
  return `${RELATION_KEY_PREFIX}${fieldKey}`;
@@ -32,7 +32,7 @@ function farColumn(key, def, named) {
32
32
  ...(greyed ? {} : { accessor: (row) => row[def.key] }),
33
33
  };
34
34
  }
35
- export function buildRelationFilters({ targets, rules, onRuleChange, subject, icon, fieldIcon, farValues, }) {
35
+ export function buildRelationFilters({ targets, rules, onRuleChange, subject, icon, fieldIcon, farValues, messages, conventions, }) {
36
36
  return Object.entries(targets).map(([key, target]) => {
37
37
  const rule = rules[key] ?? null;
38
38
  const named = new Set(farValues ? (target.named ?? []) : []);
@@ -50,6 +50,8 @@ export function buildRelationFilters({ targets, rules, onRuleChange, subject, ic
50
50
  rules: whereRulesOf(rule, target.fields),
51
51
  onRuleChange: (farKey, listRule) => onRuleChange(key, withWhereRule(key, rule, target.fields[farKey], listRule, target.fields)),
52
52
  icon: fieldIcon,
53
+ ...(messages ? { messages } : {}),
54
+ ...(conventions ? { conventions } : {}),
53
55
  ...(farValues && named.size
54
56
  ? {
55
57
  knownValues: byFarKey((path) => farValues.values[path]),
@@ -65,11 +67,14 @@ export function buildRelationFilters({ targets, rules, onRuleChange, subject, ic
65
67
  key: relationFilterKey(key),
66
68
  label: target.label,
67
69
  icon,
68
- section: RELATED_RECORDS_SECTION,
70
+ section: (messages ?? resolveViewsMessage)({ key: "views.panels.related-records" }),
69
71
  editor: "relation",
70
72
  value: rule,
71
73
  onChange: (next) => onRuleChange(key, next),
72
- noun: { one: target.kind.replaceAll("-", " "), many: target.label.toLowerCase() },
74
+ noun: target.noun ?? {
75
+ one: target.kind.replaceAll("-", " "),
76
+ many: target.label.toLocaleLowerCase(conventions?.locale),
77
+ },
73
78
  subject,
74
79
  where,
75
80
  canEvery: canChooseEvery(rule, target.fields),
@@ -1,20 +1,26 @@
1
1
  import type { StatusSlot } from "@viewkitjs/fields/design/status-slots";
2
- /**
3
- * The glyph's tint. Semantic slots only — a row icon that carries color is
4
- * saying something about STATE, which is the one thing worth spending color on
5
- * here. Omit it (the overwhelmingly common case) and the chassis draws the
6
- * glyph in its secondary text colour.
7
- */
8
- export type ListRowIconTone = StatusSlot;
9
- /** A bare glyph, optionally tinted. Bare on purpose: the row is ~37px, which an
10
- * avatar component dwarfs. */
2
+ /** A row's own picture before its name: whose it is, its url and its kind, handed to the app's `Avatar` atom
3
+ * at the glyph's size. A record's logo, a person's photo, or initials when the app's Avatar draws them. */
4
+ export type ListRowAvatar = {
5
+ label: string;
6
+ avatarUrl?: string | null;
7
+ kind?: string;
8
+ };
9
+ /** A glyph, optionally tinted, optionally the row's picture. `tone` takes
10
+ * semantic slots only — a row icon that carries color is saying something
11
+ * about STATE, which is the one thing worth spending color on here. Omit it
12
+ * (the overwhelmingly common case) and the chassis draws the glyph in its
13
+ * secondary text colour. With `avatar`, the app's `Avatar` draws the row's
14
+ * picture, sized by `--vk-glyph`, and the glyph is what it draws without one. */
11
15
  export type ListRowIcon = {
12
16
  icon: string;
13
- tone?: ListRowIconTone;
17
+ tone?: StatusSlot;
18
+ avatar?: ListRowAvatar;
14
19
  };
15
20
  /**
16
21
  * What a list declares. Return the icon alone for the neutral default, or the
17
- * descriptor object to tint it. `null` skips the glyph for that row.
22
+ * descriptor object to tint it or to draw the row's picture. `null` skips the
23
+ * glyph for that row.
18
24
  */
19
25
  export type ListRowIconAccessor<Row> = (row: Row) => string | ListRowIcon | null;
20
26
  /** Collapses both accepted return shapes into the descriptor form. A bare glyph
@@ -0,0 +1,34 @@
1
+ import { type ListColumnState, type ListPersonalLayer, type ListSettings, type ListSettingsChange } from "@viewkitjs/fields/query";
2
+ import type { ListAggregateKind, ListColumn } from "./column-schema.js";
3
+ /** Which settings column a grid column is: its field's key and, for a part column, the part. */
4
+ export type SettingsColumnRef = {
5
+ key: string;
6
+ part?: string;
7
+ };
8
+ /** Which settings column a grid column is. A column with no field is named by its id (a computed column's). */
9
+ export declare function columnRefOf<Row>(column: ListColumn<Row>): SettingsColumnRef;
10
+ /** A settings column's id, as a person's layer keys its width: its key, or its key and part (`partKey`). */
11
+ export declare function settingsColumnId(ref: SettingsColumnRef): string;
12
+ /** Whether the settings may place a grid column: a field's column, a part of one, or a computed column. */
13
+ export declare function isSettingsColumn<Row>(column: ListColumn<Row> | undefined): column is ListColumn<Row>;
14
+ /** The settings' columns as the grid's column state: the order the settings place them in, which are hidden (and
15
+ * which hidden-by-default ones are shown), the line breaks, and every width, the person's over the view's. Keyed by
16
+ * the grid's column ids; a settings column no grid column draws is left out. */
17
+ export declare function columnStateOf<Row>(settings: ListSettings, layer: ListPersonalLayer, columns: readonly ListColumn<Row>[]): ListColumnState;
18
+ /** A column state the grid or the Columns panel hands back, as what it changes in the settings and in the person's
19
+ * layer. The settings' columns follow the state's order, visibility and line breaks, keeping each column's default
20
+ * width and figure; a field placed for the first time takes its column's own figure. A width that differs from what
21
+ * the person sees goes to their layer, merged over the widths it holds; nothing else does. */
22
+ export declare function columnsChangeOf<Row>(settings: ListSettings, layer: ListPersonalLayer, state: ListColumnState, columns: readonly ListColumn<Row>[]): {
23
+ change: ListSettingsChange;
24
+ layer: ListPersonalLayer | null;
25
+ };
26
+ /** Each placed column's figure by grid column id; `none` where the view keeps none for a column that declares a
27
+ * default, since the absence of a figure is the view's answer there. */
28
+ export declare function aggregatesOf<Row>(settings: ListSettings, columns: readonly ListColumn<Row>[]): Record<string, ListAggregateKind>;
29
+ /** The figures picked per grid column id, as a change to the settings' columns. A computed column is never totalled;
30
+ * `none` and `ratio` keep no figure. */
31
+ export declare function figuresChangeOf<Row>(settings: ListSettings, aggregates: Readonly<Record<string, ListAggregateKind>>, columns: readonly ListColumn<Row>[]): ListSettingsChange;
32
+ /** The Columns panel's reset, as a change: every column the settings place shown unless hidden by default, no line
33
+ * breaks, the order, widths and figures kept. Empty when the settings already are that. */
34
+ export declare function columnsReset<Row>(settings: ListSettings, columns: readonly ListColumn<Row>[]): ListSettingsChange;
@@ -0,0 +1,146 @@
1
+ import { partKey, settingsChange, } from "@viewkitjs/fields/query";
2
+ import { resolveViewColumnOrder } from "./column-capabilities.js";
3
+ import { columnDefaultHidden } from "./column-state.js";
4
+ import { fieldKeyOf } from "./view-rules.js";
5
+ export function columnRefOf(column) {
6
+ return column.partOf
7
+ ? { key: column.partOf.field.key, part: column.partOf.part }
8
+ : { key: fieldKeyOf(column) };
9
+ }
10
+ export function settingsColumnId(ref) {
11
+ return ref.part === undefined ? ref.key : partKey(ref.key, ref.part);
12
+ }
13
+ export function isSettingsColumn(column) {
14
+ return !!column && (!!column.field || !!column.custom || !!column.partOf);
15
+ }
16
+ function columnsBySettingsId(columns) {
17
+ return new Map(columns.map((column) => [settingsColumnId(columnRefOf(column)), column]));
18
+ }
19
+ function figureOf(kind) {
20
+ return kind && kind !== "none" && kind !== "ratio" ? kind : null;
21
+ }
22
+ export function columnStateOf(settings, layer, columns) {
23
+ const byId = columnsBySettingsId(columns);
24
+ const order = [];
25
+ const hidden = [];
26
+ const visible = [];
27
+ const breaks = [];
28
+ const widths = {};
29
+ for (const placed of settings.columns) {
30
+ const column = byId.get(settingsColumnId(placed));
31
+ if (!column)
32
+ continue;
33
+ order.push(column.id);
34
+ if (!placed.visible)
35
+ hidden.push(column.id);
36
+ else if (columnDefaultHidden(column, settings.layout))
37
+ visible.push(column.id);
38
+ if (placed.lineBreak)
39
+ breaks.push(column.id);
40
+ if (placed.width !== undefined)
41
+ widths[column.id] = placed.width;
42
+ }
43
+ for (const [id, width] of Object.entries(layer.widths ?? {})) {
44
+ const column = byId.get(id);
45
+ if (column)
46
+ widths[column.id] = width;
47
+ }
48
+ return { order, hidden, visible, widths, breaks };
49
+ }
50
+ export function columnsChangeOf(settings, layer, state, columns) {
51
+ const byGridId = new Map(columns.map((column) => [column.id, column]));
52
+ const bySettingsId = columnsBySettingsId(columns);
53
+ const placedById = new Map(settings.columns.map((placed) => [settingsColumnId(placed), placed]));
54
+ const hidden = state.hidden ?? [];
55
+ const shown = state.visible ?? [];
56
+ const breaks = state.breaks ?? [];
57
+ const named = state.order?.length
58
+ ? state.order
59
+ : settings.columns.map((placed) => bySettingsId.get(settingsColumnId(placed))?.id ?? placed.key);
60
+ const unnamed = [...hidden, ...shown, ...breaks].some((id) => isSettingsColumn(byGridId.get(id)) && !named.includes(id));
61
+ const order = unnamed ? resolveViewColumnOrder([...columns], named) : named;
62
+ const placed = [];
63
+ for (const id of order) {
64
+ const column = byGridId.get(id);
65
+ if (!isSettingsColumn(column))
66
+ continue;
67
+ const ref = columnRefOf(column);
68
+ const previous = placedById.get(settingsColumnId(ref));
69
+ const figure = previous
70
+ ? previous.figure
71
+ : column.field
72
+ ? figureOf(column.defaultAggregate)
73
+ : null;
74
+ placed.push({
75
+ key: ref.key,
76
+ ...(ref.part !== undefined ? { part: ref.part } : {}),
77
+ visible: !hidden.includes(id) &&
78
+ (!columnDefaultHidden(column, settings.layout) || shown.includes(id)),
79
+ ...(previous?.width !== undefined ? { width: previous.width } : {}),
80
+ ...(figure ? { figure } : {}),
81
+ ...(breaks.includes(id) ? { lineBreak: true } : {}),
82
+ });
83
+ }
84
+ const placedIds = new Set(placed.map(settingsColumnId));
85
+ let cursor = 0;
86
+ for (const kept of settings.columns) {
87
+ const id = settingsColumnId(kept);
88
+ if (placedIds.has(id)) {
89
+ cursor = placed.findIndex((column) => settingsColumnId(column) === id) + 1;
90
+ continue;
91
+ }
92
+ placed.splice(cursor, 0, kept);
93
+ cursor += 1;
94
+ }
95
+ const change = settingsChange(settings, { ...settings, columns: placed });
96
+ if (Object.keys(state).length === 0)
97
+ return { change, layer: null };
98
+ const next = state.widths ?? {};
99
+ const seen = columnStateOf(settings, layer, columns).widths ?? {};
100
+ const widths = { ...layer.widths };
101
+ let changed = false;
102
+ for (const [id, width] of Object.entries(next)) {
103
+ if (seen[id] === width)
104
+ continue;
105
+ const column = byGridId.get(id);
106
+ widths[column ? settingsColumnId(columnRefOf(column)) : id] = width;
107
+ changed = true;
108
+ }
109
+ for (const column of columns) {
110
+ const key = settingsColumnId(columnRefOf(column));
111
+ if (layer.widths?.[key] === undefined || next[column.id] !== undefined)
112
+ continue;
113
+ delete widths[key];
114
+ changed = true;
115
+ }
116
+ return { change, layer: changed ? { widths } : null };
117
+ }
118
+ export function aggregatesOf(settings, columns) {
119
+ const byId = columnsBySettingsId(columns);
120
+ const aggregates = {};
121
+ for (const placed of settings.columns) {
122
+ const column = byId.get(settingsColumnId(placed));
123
+ if (!column)
124
+ continue;
125
+ if (placed.figure)
126
+ aggregates[column.id] = placed.figure;
127
+ else if (column.defaultAggregate)
128
+ aggregates[column.id] = "none";
129
+ }
130
+ return aggregates;
131
+ }
132
+ export function figuresChangeOf(settings, aggregates, columns) {
133
+ const byId = columnsBySettingsId(columns);
134
+ const next = settings.columns.map((placed) => {
135
+ const column = byId.get(settingsColumnId(placed));
136
+ if (!column)
137
+ return placed;
138
+ const figure = column.field ? figureOf(aggregates[column.id]) : null;
139
+ const { figure: _held, ...rest } = placed;
140
+ return figure ? { ...rest, figure } : rest;
141
+ });
142
+ return settingsChange(settings, { ...settings, columns: next });
143
+ }
144
+ export function columnsReset(settings, columns) {
145
+ return columnsChangeOf(settings, {}, {}, columns).change;
146
+ }