@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
@@ -0,0 +1,61 @@
1
+ "use client";
2
+ import { useCallback, useMemo } from "react";
3
+ import { normalizeGroupSummary, settingsChange, } from "@viewkitjs/fields/query";
4
+ import { withPartColumns } from "../model/part-columns.js";
5
+ import { LIST_VIEW_PREF_DEFAULTS } from "../model/preferences.js";
6
+ import { aggregatesOf, columnsChangeOf, columnStateOf, figuresChangeOf, } from "../model/settings-columns.js";
7
+ import { seenLook } from "../model/settings-look.js";
8
+ import { GRID_SCALE_MULTIPLIER } from "./core/grid-scale.js";
9
+ import { useGridFormatProps } from "./grid-format-props.js";
10
+ export function useGridTableSettings({ settings, layer, columns, parts = false, onChange, onLayerChange, defaults, formats, setFormats, }) {
11
+ const formatProps = useGridFormatProps(formats, setFormats, columns);
12
+ const drawn = useMemo(() => (parts ? withPartColumns(columns) : columns), [parts, columns]);
13
+ const look = useMemo(() => seenLook(settings, layer, defaults), [settings, layer, defaults]);
14
+ const columnState = useMemo(() => columnStateOf(settings, layer, drawn), [settings, layer, drawn]);
15
+ const aggregates = useMemo(() => aggregatesOf(settings, drawn), [settings, drawn]);
16
+ const groupSummary = useMemo(() => settings.groupFigures
17
+ ? normalizeGroupSummary(settings.groupFigures)
18
+ : normalizeGroupSummary(LIST_VIEW_PREF_DEFAULTS.groupSummary), [settings.groupFigures]);
19
+ const write = useCallback((change) => {
20
+ if (Object.keys(change).length > 0)
21
+ onChange(change);
22
+ }, [onChange]);
23
+ const onColumnStateChange = useCallback((next) => {
24
+ const { change, layer: widths } = columnsChangeOf(settings, layer, next, drawn);
25
+ write(change);
26
+ if (widths)
27
+ onLayerChange(widths);
28
+ }, [settings, layer, drawn, write, onLayerChange]);
29
+ const onGroupSummaryChange = useCallback((part, on) => {
30
+ const groupFigures = on
31
+ ? Array.from(new Set([...groupSummary, part]))
32
+ : groupSummary.filter((held) => held !== part);
33
+ write(settingsChange(settings, { ...settings, groupFigures }));
34
+ }, [groupSummary, settings, write]);
35
+ const onAggregateChange = useCallback((columnId, kind) => write(figuresChangeOf(settings, { ...aggregates, [columnId]: kind }, drawn)), [settings, aggregates, drawn, write]);
36
+ const gridProps = useMemo(() => ({
37
+ verticalBorders: look.verticalBorders,
38
+ showRowIcon: look.rowIcon,
39
+ freezeIdentity: look.freezeIdentity,
40
+ alwaysCheckboxes: look.alwaysCheckboxes,
41
+ scale: GRID_SCALE_MULTIPLIER[look.density],
42
+ ...formatProps,
43
+ columnState,
44
+ onColumnStateChange,
45
+ groupSummary,
46
+ onGroupSummaryChange,
47
+ aggregates,
48
+ onAggregateChange,
49
+ viewBacked: true,
50
+ }), [
51
+ look,
52
+ formatProps,
53
+ columnState,
54
+ onColumnStateChange,
55
+ groupSummary,
56
+ onGroupSummaryChange,
57
+ aggregates,
58
+ onAggregateChange,
59
+ ]);
60
+ return { gridProps };
61
+ }
@@ -1,13 +1,12 @@
1
- /** `manual`: the reader's own order, by stored positions (POR-498). Only the
2
- * source list orders by it; `sortGroupEntries` below treats it as `name`. */
3
- export type OrderMode = "lifecycle" | "count" | "name" | "manual";
4
- export type OrderDir = "asc" | "desc";
1
+ import type { BucketOrderMode, SortDirection } from "@viewkitjs/fields/query";
2
+ /** How a grouping orders its sections, and which way. `manual`: the reader's own order, by stored positions
3
+ * (POR-498); only the source list orders by it, and `sortGroupEntries` below treats it as `name`. */
5
4
  export type OrderChoice = {
6
- mode: OrderMode;
7
- dir: OrderDir;
5
+ mode: BucketOrderMode;
6
+ dir: SortDirection;
8
7
  };
9
8
  /** The natural direction for a mode. Used to seed dir when a user picks a new mode. */
10
- export declare function defaultDirFor(mode: OrderMode): OrderDir;
9
+ export declare function defaultDirFor(mode: BucketOrderMode): SortDirection;
11
10
  type Entry<K extends string> = [key: K, items: unknown[]];
12
11
  export declare function sortGroupEntries<K extends string>(entries: Entry<K>[], opts: {
13
12
  order: OrderChoice;
@@ -0,0 +1,3 @@
1
+ import type { FieldConventions } from "@viewkitjs/fields";
2
+ /** A count as the reader's locale writes it (VK-507): "12.345" in Romanian, "12,345" in English. Internal. */
3
+ export declare function formatCount(count: number, cv: Pick<FieldConventions, "locale">): string;
@@ -0,0 +1,3 @@
1
+ export function formatCount(count, cv) {
2
+ return new Intl.NumberFormat(cv.locale).format(count);
3
+ }
@@ -3,9 +3,6 @@ import { type DisplayCurrency } from "../fields/currency.js";
3
3
  import type { ListAggregateKind, ListColumn } from "./column-schema.js";
4
4
  /** A figure's name, as the app words it: `views.grid.figure`. */
5
5
  export declare function aggregateLabel(kind: ListAggregateKind, messages?: ViewsMessageResolver): string;
6
- /** The figures' names in the package's English. A grid reads `aggregateLabel` with the provider's `messages`. */
7
- export declare const LIST_AGGREGATE_LABELS: Record<Exclude<ListAggregateKind, "none">, string>;
8
- export declare function gridColumnIsNumericAgg<Row>(col: ListColumn<Row>): boolean;
9
6
  /** A source list's footer (POR-470, POR-472): the keys whose figures the
10
7
  * database answered, and the reader's default currency — the key a money
11
8
  * column read in Original is totalled under. */
@@ -27,6 +24,9 @@ export declare function figureKeyOf<Row>(col: ListColumn<Row>, defaultCurrency:
27
24
  */
28
25
  export declare function aggregateOptions<Row>(col: ListColumn<Row>, sourced?: SourcedAggregates): ListAggregateKind[];
29
26
  export declare function resolveAggregateKind<Row>(col: ListColumn<Row>, prefs?: Readonly<Record<string, ListAggregateKind>>, sourced?: SourcedAggregates): ListAggregateKind;
27
+ /** A column's figure over some rows, worked out by `@viewkitjs/fields` (`figureOfValues`, `ratioOf`) from what the
28
+ * column reads: its cells for a count, the filled and the different ones; the figure it says to total
29
+ * (`aggAccessor`, else the cell) for the numbers; its two readers for a ratio. */
30
30
  export declare function computeAggregate<Row>(kind: ListAggregateKind, col: ListColumn<Row>, rows: readonly Row[]): number | null;
31
31
  /** One figure, and the currency it is in. */
32
32
  export type MoneyTotal = {
@@ -1,5 +1,5 @@
1
- import { isMultipleType, locationText, nameText, presentedDef, scalarOf, valueItems, valueKey, } from "@viewkitjs/fields";
2
- import { phoneMatchText } from "@viewkitjs/fields/phone";
1
+ import { presentedDef } from "@viewkitjs/fields";
2
+ import { figureNumber, figureOfNumbers, figureOfValues, ratioOf } from "@viewkitjs/fields/query";
3
3
  import { resolveViewsMessage } from "../contract.js";
4
4
  import { COLUMN_WIDE_CODE } from "../fields/denomination.js";
5
5
  import { convertMoney } from "../fields/money.js";
@@ -9,18 +9,8 @@ import { fieldKeyOf } from "./view-rules.js";
9
9
  export function aggregateLabel(kind, messages = resolveViewsMessage) {
10
10
  return messages({ key: "views.grid.figure", values: { kind } });
11
11
  }
12
- export const LIST_AGGREGATE_LABELS = {
13
- sum: aggregateLabel("sum"),
14
- avg: aggregateLabel("avg"),
15
- min: aggregateLabel("min"),
16
- max: aggregateLabel("max"),
17
- count: aggregateLabel("count"),
18
- filled: aggregateLabel("filled"),
19
- unique: aggregateLabel("unique"),
20
- ratio: aggregateLabel("ratio"),
21
- };
22
12
  const NUMERIC = new Set(["number", "percent", "currency"]);
23
- export function gridColumnIsNumericAgg(col) {
13
+ function gridColumnIsNumericAgg(col) {
24
14
  return !!col.aggAccessor || NUMERIC.has(fieldTypeOf(col));
25
15
  }
26
16
  export function figureKeyOf(col, defaultCurrency) {
@@ -85,74 +75,30 @@ export function resolveAggregateKind(col, prefs, sourced) {
85
75
  export function computeAggregate(kind, col, rows) {
86
76
  if (kind === "none")
87
77
  return null;
88
- if (kind === "count")
89
- return rows.length;
90
- if (kind === "filled" || kind === "unique") {
91
- const type = fieldTypeOf(col);
92
- if (col.multiple && isMultipleType(type)) {
93
- const lists = rows
94
- .map((row) => {
95
- const value = col.accessor?.(row);
96
- const one = Array.isArray(value) ? valueItems(value) : valueItems([value]);
97
- return one.map((item) => valueKey(item.value, type));
98
- })
99
- .filter((keys) => keys.length > 0);
100
- if (kind === "filled")
101
- return lists.length;
102
- return new Set(lists.map((keys) => [...keys].sort().join("|"))).size;
103
- }
104
- const asText = type === "location" ? locationText : type === "name" ? nameText : type === "phone" ? phoneMatchText : undefined;
105
- const written = (value) => !asText ? value : Array.isArray(value) ? value.map((item) => asText(item)).filter(Boolean) : asText(value);
106
- const values = rows
107
- .map((row) => written(col.accessor?.(row)))
108
- .filter((value) => value != null && value !== "" && !(Array.isArray(value) && value.length === 0));
109
- if (kind === "filled")
110
- return values.length;
111
- return new Set(values.map((value) => Array.isArray(value) ? value.map(String).sort().join("|") : String(value))).size;
112
- }
113
78
  if (kind === "ratio") {
114
- if (!col.ratio)
115
- return null;
116
- let num = 0;
117
- let den = 0;
118
- for (const row of rows) {
119
- num += col.ratio.numerator(row) ?? 0;
120
- den += col.ratio.denominator(row) ?? 0;
121
- }
122
- return den > 0 ? Math.round((num / den) * 100) : null;
79
+ const ratio = col.ratio;
80
+ return ratio ? ratioOf(rows.map((row) => [ratio.numerator(row), ratio.denominator(row)])) : null;
123
81
  }
124
- return reduceNumbers(kind, totalledNumbers(col, rows));
82
+ const reading = { type: fieldTypeOf(col), multiple: col.multiple, field: col.field };
83
+ if (NUMERIC_AGGREGATES.has(kind))
84
+ return figureOfValues(kind, totalledValues(col, rows), reading);
85
+ if (kind === "count")
86
+ return rows.length;
87
+ return figureOfValues(kind, rows.map((row) => col.accessor?.(row)), reading);
125
88
  }
126
89
  const NUMERIC_AGGREGATES = new Set(["sum", "avg", "min", "max"]);
127
- function totalledNumber(col, row) {
128
- const read = col.aggAccessor ? col.aggAccessor(row) : col.accessor?.(row);
129
- const value = col.field ? scalarOf(col.field, read) : read;
130
- const number = typeof value === "number" ? value : value == null || value === "" ? NaN : Number(value);
131
- return Number.isNaN(number) ? null : number;
90
+ function totalledValues(col, rows) {
91
+ return rows.map((row) => (col.aggAccessor ? col.aggAccessor(row) : col.accessor?.(row)));
132
92
  }
133
93
  function totalledNumbers(col, rows) {
134
94
  const numbers = [];
135
- for (const row of rows) {
136
- const number = totalledNumber(col, row);
95
+ for (const value of totalledValues(col, rows)) {
96
+ const number = figureNumber(value, col.field);
137
97
  if (number != null)
138
98
  numbers.push(number);
139
99
  }
140
100
  return numbers;
141
101
  }
142
- function reduceNumbers(kind, numbers) {
143
- if (numbers.length === 0)
144
- return null;
145
- switch (kind) {
146
- case "sum":
147
- return numbers.reduce((sum, value) => sum + value, 0);
148
- case "avg":
149
- return numbers.reduce((sum, value) => sum + value, 0) / numbers.length;
150
- case "min":
151
- return Math.min(...numbers);
152
- default:
153
- return Math.max(...numbers);
154
- }
155
- }
156
102
  export function moneyTotal(kind, col, rows, defaultCurrency) {
157
103
  if (!NUMERIC_AGGREGATES.has(kind) || fieldTypeOf(col) !== "currency")
158
104
  return undefined;
@@ -165,12 +111,12 @@ export function moneyTotal(kind, col, rows, defaultCurrency) {
165
111
  if (converted != null)
166
112
  numbers.push(converted);
167
113
  }
168
- const amount = reduceNumbers(kind, numbers);
114
+ const amount = figureOfNumbers(kind, numbers);
169
115
  return amount == null ? null : { amount, code: defaultCurrency };
170
116
  }
171
117
  if (col.currencyAccessor && !money)
172
118
  return null;
173
- const amount = reduceNumbers(kind, totalledNumbers(col, rows));
119
+ const amount = figureOfNumbers(kind, totalledNumbers(col, rows));
174
120
  if (amount == null)
175
121
  return null;
176
122
  const code = col.format?.currency;
@@ -0,0 +1,16 @@
1
+ /** Who sets the width and padding of the popover around a whole body your app hands: ViewKit (`views`, the default) or
2
+ * your `Popover` (`popover`). */
3
+ export type ViewsBodyFrame = "views" | "popover";
4
+ /** Which of the app's whole bodies an editor opens: its `Picker`, its `PartsBody` or its `ValuesBody`. */
5
+ export type ViewsBodyKind = "picker" | "parts" | "values";
6
+ /**
7
+ * The class and the data a host hands its popover. `body` is the app's body the editor opens, or null when it draws
8
+ * ViewKit's own; `viewkit` is ViewKit's width and padding, `kept` what isn't look (the layer, a screen cap). At
9
+ * `popover` with a body, only `kept` and the mark `data-vk-body`; otherwise today's classes and no mark.
10
+ */
11
+ export declare function bodyPanel(frame: ViewsBodyFrame | undefined, body: ViewsBodyKind | null, viewkit: string, kept: string): {
12
+ className: string;
13
+ data: {
14
+ "data-vk-body"?: ViewsBodyKind;
15
+ };
16
+ };
@@ -0,0 +1,5 @@
1
+ export function bodyPanel(frame, body, viewkit, kept) {
2
+ if (frame === "popover" && body)
3
+ return { className: kept, data: { "data-vk-body": body } };
4
+ return { className: `${viewkit} ${kept}`, data: {} };
5
+ }
@@ -1,9 +1,12 @@
1
1
  import { type FieldConventions } from "@viewkitjs/fields";
2
2
  import { type ViewsMessageResolver } from "../contract.js";
3
+ import { type ViewsOneValueEditors } from "./one-value.js";
3
4
  import type { ListColumn } from "./column-schema.js";
4
5
  import { type GridEditorId } from "./column-types.js";
5
6
  export type { GridEditorId };
6
- export declare function gridEditorKind<Row>(col: ListColumn<Row>): GridEditorId | null;
7
+ /** The editor a column opens. `oneValue` is the provider's rule for a single email or domain (`ViewsProvider`'s
8
+ * `oneValue`): where it says `list`, the value list holding one value. */
9
+ export declare function gridEditorKind<Row>(col: ListColumn<Row>, oneValue?: ViewsOneValueEditors): GridEditorId | null;
7
10
  export declare function gridColumnHasEditor<Row>(col: ListColumn<Row>): boolean;
8
11
  /**
9
12
  * The grid's WRITE policy — what a column accepts, and in what shape.
@@ -1,15 +1,18 @@
1
1
  import { acceptFieldCommit, isMultipleType, lockReason, relationIdOf, valueTypeOf, } from "@viewkitjs/fields";
2
2
  import { resolveViewsMessage } from "../contract.js";
3
+ import { opensAsList } from "./one-value.js";
3
4
  import { prettifyOptionValue, resolveColumnOrder } from "./column-state.js";
4
5
  import { typeRule } from "./column-types.js";
5
6
  import { fieldKeyOf } from "./view-rules.js";
6
- export function gridEditorKind(col) {
7
+ export function gridEditorKind(col, oneValue) {
7
8
  if (!col.editable || !col.type)
8
9
  return null;
9
10
  if (col.partOf?.part === "countryCode")
10
11
  return "select";
11
12
  if (col.multiple)
12
13
  return col.field && col.type && isMultipleType(col.type) ? "values" : null;
14
+ if (col.field && opensAsList(col.field.type, false, oneValue))
15
+ return "values";
13
16
  if (col.type === "title" && col.field && valueTypeOf(col.field) === "name")
14
17
  return "name";
15
18
  if (col.type === "location")
@@ -1,6 +1,6 @@
1
1
  import type { ReactNode } from "react";
2
2
  import { type FieldConventions } from "@viewkitjs/fields";
3
- import type { ViewsMessageResolver } from "../contract.js";
3
+ import { type ViewsMessageResolver } from "../contract.js";
4
4
  import type { FilterConfig } from "../filters/filter-model.js";
5
5
  import type { ListColumn, ListRelationValue } from "./column-schema.js";
6
6
  import { type ListFilterEditor } from "./column-types.js";
@@ -25,7 +25,8 @@ import type { ListFilterCapabilities } from "./filter-capabilities.js";
25
25
  * type in `column-types.ts`, beside that type's editor and paste rules. */
26
26
  export type { ListFilterEditor };
27
27
  export declare function filterEditor<Row>(col: ListColumn<Row>): ListFilterEditor | null;
28
- /** Section label for filters whose column is currently hidden from the table. */
28
+ /** Section label for filters whose column is currently hidden from the table, in the package's English: the builder
29
+ * words it through `views.panels.hidden-columns`, so an app's `messages` name it in its own words (VK-505). */
29
30
  export declare const HIDDEN_COLUMN_SECTION = "Hidden columns";
30
31
  /** The decimals the cell is showing: the workspace's per-FIELD override wins
31
32
  * over the column's declared default, so equality rounds to what is on
@@ -39,7 +40,9 @@ export declare function numberDecimals<Row>(col: ListColumn<Row>, overrides?: Re
39
40
  * you translate between the two. `format.booleanDisplay` already decides how
40
41
  * the cell reads, so it decides how the filter reads.
41
42
  */
42
- export declare function booleanFilterOptions<Row>(col: ListColumn<Row>): {
43
+ export declare function booleanFilterOptions<Row>(col: ListColumn<Row>,
44
+ /** The app's words for the choices (VK-507); the package's English by default. */
45
+ messages?: ViewsMessageResolver): {
43
46
  value: string;
44
47
  label: string;
45
48
  }[];
@@ -98,7 +101,7 @@ export declare function buildColumnFilters<Row>({ columns, order, declared, icon
98
101
  parts?: boolean;
99
102
  /** Words for part rows; the package's English by default. */
100
103
  messages?: ViewsMessageResolver;
101
- /** The locale a country's name is read in (`conventions.locale`); English by default. */
104
+ /** The language a country's name is read in (`conventions.language`); English by default. */
102
105
  conventions?: FieldConventions;
103
106
  }): FilterConfig<string>[];
104
107
  export declare function rowMatchesRules<Row>(row: Row, rules: ListFilterRuleState, columns: ListColumn<Row>[],
@@ -1,8 +1,10 @@
1
1
  import { actorKey, COUNTRY_CODES, countryName, isIntegerField, isMultipleType, isOpenVocabulary, presentedDef, relationKey, scalarOf, valueItems, valueTypeOf, } from "@viewkitjs/fields";
2
2
  import { matchesRule, operatorsFor } from "@viewkitjs/fields/query";
3
+ import { resolveViewsMessage } from "../contract.js";
3
4
  import { rangeUnit } from "../fields/range-unit.js";
4
5
  import { rangeEndFormat } from "./part-columns.js";
5
6
  import { FILTER_PART_ROWS, parsePartKey, partKey, partLabel } from "./part-rows.js";
7
+ import { keptParts } from "./place-parts.js";
6
8
  import { phoneFilterOperand, phoneMatchText, readPhone } from "@viewkitjs/fields/phone";
7
9
  import { isTextRuleActive, matchesTextRule } from "../filters/text-filter.js";
8
10
  import { matchesNameRule } from "@viewkitjs/fields/query";
@@ -19,7 +21,7 @@ export function filterEditor(col) {
19
21
  }
20
22
  const WIRED_EDITORS = new Set(["text", "options", "boolean", "number", "date", "range"]);
21
23
  const NAMED_VALUE_TYPES = new Set(["relation", "user", "actor"]);
22
- function relationOptions(known, names, onScreen) {
24
+ function relationOptions(known, names, onScreen, locale) {
23
25
  const byId = new Map();
24
26
  for (const id of known ?? []) {
25
27
  const name = names?.[id];
@@ -31,7 +33,7 @@ function relationOptions(known, names, onScreen) {
31
33
  byId.set(value.id, value.label);
32
34
  return [...byId]
33
35
  .map(([value, label]) => ({ value, label }))
34
- .sort((a, b) => a.label.localeCompare(b.label));
36
+ .sort((a, b) => a.label.localeCompare(b.label, locale));
35
37
  }
36
38
  export const HIDDEN_COLUMN_SECTION = "Hidden columns";
37
39
  export function numberDecimals(col, overrides) {
@@ -53,28 +55,29 @@ function numberUnit(col) {
53
55
  function rangeEndDecimals(field, key, overrides) {
54
56
  return overrides?.[key] ?? rangeEndFormat(field).decimals ?? 2;
55
57
  }
56
- export function booleanFilterOptions(col) {
58
+ export function booleanFilterOptions(col, messages = resolveViewsMessage) {
57
59
  const display = col.format?.booleanDisplay ?? "checkbox";
58
60
  if (display === "marker") {
59
61
  const label = col.marker?.label ?? columnLabel(col).toLowerCase();
60
62
  return [
61
63
  { value: "true", label: label.charAt(0).toUpperCase() + label.slice(1) },
62
- { value: "false", label: `Not ${label}` },
64
+ { value: "false", label: messages({ key: "views.panels.boolean-not", values: { label } }) },
63
65
  ];
64
66
  }
65
67
  if (display === "text") {
66
- const labelFor = (value, fallback) => col.options?.find((o) => o.value === value)?.label ?? fallback;
68
+ const labelFor = (value) => col.options?.find((o) => o.value === value)?.label ?? messages({ key: "views.display.boolean", values: { value } });
67
69
  return [
68
- { value: "true", label: labelFor("true", "True") },
69
- { value: "false", label: labelFor("false", "False") },
70
+ { value: "true", label: labelFor("true") },
71
+ { value: "false", label: labelFor("false") },
70
72
  ];
71
73
  }
72
74
  return [
73
- { value: "true", label: "Checked" },
74
- { value: "false", label: "Unchecked" },
75
+ { value: "true", label: messages({ key: "views.panels.boolean-checked" }) },
76
+ { value: "false", label: messages({ key: "views.panels.boolean-unchecked" }) },
75
77
  ];
76
78
  }
77
79
  export function buildColumnFilters({ columns, order, declared = [], icon, rules = {}, onRuleChange, selectValues = {}, relationValues = {}, decimals, columnState, viewId, capabilities, knownValues = {}, knownLabels = {}, onValuesWanted, parts = false, messages, conventions, }) {
80
+ const word = messages ?? resolveViewsMessage;
78
81
  const declaredByKey = new Map(declared.map((f) => [f.key, f]));
79
82
  const claimed = new Set();
80
83
  const buildOne = (col) => {
@@ -135,7 +138,7 @@ export function buildColumnFilters({ columns, order, declared = [], icon, rules
135
138
  icon: icon?.(col),
136
139
  editor: "range",
137
140
  value: rule ? { operator: rule.operator, value: rule.value, value2: rule.value2 } : null,
138
- unit: range?.of === "percent" ? "%" : range?.of === "currency" ? range.code?.fixed : undefined,
141
+ unit: range ? rangeUnit(range) : undefined,
139
142
  presets: range?.presets,
140
143
  onChange: (next) => onRuleChange?.(col.id, next ? { editor: "range", ...next } : null),
141
144
  };
@@ -167,10 +170,10 @@ export function buildColumnFilters({ columns, order, declared = [], icon, rules
167
170
  const values = open ? [...new Set([...(knownValues[col.id] ?? []), ...onScreen])] : onScreen;
168
171
  const named = !!col.field && NAMED_VALUE_TYPES.has(col.field.type);
169
172
  const options = editor === "boolean"
170
- ? booleanFilterOptions(col)
173
+ ? booleanFilterOptions(col, word)
171
174
  :
172
175
  col.type === "relation" || col.type === "user" || col.type === "actor"
173
- ? relationOptions(knownValues[col.id], knownLabels[col.id], relationValues[col.id])
176
+ ? relationOptions(knownValues[col.id], knownLabels[col.id], relationValues[col.id], conventions?.locale)
174
177
  : values.map((value) => ({
175
178
  value,
176
179
  label: col.options?.find((o) => o.value === value)?.label ??
@@ -185,7 +188,7 @@ export function buildColumnFilters({ columns, order, declared = [], icon, rules
185
188
  value: stored?.editor === "options" ? stored.values : [],
186
189
  options,
187
190
  onChange: (next) => onRuleChange?.(col.id, next.length ? { editor: "options", values: next } : null),
188
- emptyLabel: `All ${columnLabel(col).toLowerCase()}`,
191
+ emptyLabel: word({ key: "views.panels.filter-all-of", values: { field: columnLabel(col) } }),
189
192
  };
190
193
  }
191
194
  return {
@@ -197,7 +200,12 @@ export function buildColumnFilters({ columns, order, declared = [], icon, rules
197
200
  options: [],
198
201
  onChange: () => { },
199
202
  disabled: !wired,
200
- ...(wired ? {} : { valueLabel: "—" }),
203
+ ...(wired
204
+ ? {}
205
+ : {
206
+ valueLabel: "—",
207
+ disabledReason: word({ key: "views.panels.filter-not-offered" }),
208
+ }),
201
209
  };
202
210
  };
203
211
  const buildPartRows = (col) => {
@@ -207,13 +215,13 @@ export function buildColumnFilters({ columns, order, declared = [], icon, rules
207
215
  return [];
208
216
  const field = col.field;
209
217
  const type = valueTypeOf(field);
210
- return (FILTER_PART_ROWS[type] ?? []).map((part) => {
218
+ return keptParts(field, FILTER_PART_ROWS[type] ?? []).map((part) => {
211
219
  const key = partKey(col.id, part);
212
220
  const label = partLabel(columnLabel(col), type, part, messages);
213
221
  const stored = rules[key];
214
222
  if (operatorsFor(type, part)[0] === "is_any_of") {
215
223
  const offered = [...new Set([...(knownValues[key] ?? []), ...(selectValues[key] ?? [])])];
216
- const locale = conventions?.locale;
224
+ const locale = conventions?.language;
217
225
  return {
218
226
  key,
219
227
  label,
@@ -255,7 +263,7 @@ export function buildColumnFilters({ columns, order, declared = [], icon, rules
255
263
  const partRows = buildPartRows(col);
256
264
  const own = partRows.length && col.field && valueTypeOf(col.field) === "location" ? [] : [buildOne(col)];
257
265
  const hidden = isColumnHidden(col, columnState, viewId);
258
- return [...own, ...partRows].map((built) => built.section || !hidden ? built : { ...built, section: HIDDEN_COLUMN_SECTION });
266
+ return [...own, ...partRows].map((built) => built.section || !hidden ? built : { ...built, section: word({ key: "views.panels.hidden-columns" }) });
259
267
  });
260
268
  return [...derived, ...declared.filter((f) => !claimed.has(f.key))];
261
269
  }
@@ -287,7 +295,7 @@ function partRuleMatches(row, key, rule, columns, decimals, conventions) {
287
295
  if (!col?.field || !col.accessor)
288
296
  return true;
289
297
  const type = valueTypeOf(col.field);
290
- if (!FILTER_PART_ROWS[type]?.includes(part))
298
+ if (!keptParts(col.field, FILTER_PART_ROWS[type] ?? []).includes(part))
291
299
  return true;
292
300
  const filterRule = fromListFilterRule(fieldKeyOf(col), type, rule, part);
293
301
  const shown = type === "range" ? { decimals: rangeEndDecimals(col.field, key, decimals) } : {};
@@ -23,5 +23,6 @@ export declare function gridColumnInspectable<Row>(col: ListColumn<Row>): boolea
23
23
  * measure (`gridCellCutOff`). */
24
24
  export declare function isWholeTextColumn<Row>(col: ListColumn<Row>): boolean;
25
25
  /** Whether an open text cell is drawn in the panel over the cell rather than in the cell: a
26
- * paragraph always, a line when it opened `whole` (cut off when it was opened). */
27
- export declare function gridTextOpensBox<Row>(col: ListColumn<Row>, whole: boolean): boolean;
26
+ * paragraph always, a line when it opened `whole` (cut off when it was opened). `inCell`: an app's text body is
27
+ * handed and the cell is writable: the body stands in the cell, so nothing opens the panel. */
28
+ export declare function gridTextOpensBox<Row>(col: ListColumn<Row>, whole: boolean, inCell?: boolean): boolean;
@@ -10,6 +10,8 @@ export function isWholeTextColumn(col) {
10
10
  return !col.format?.long;
11
11
  return col.type === "title" && !(col.field && valueTypeOf(col.field) === "name");
12
12
  }
13
- export function gridTextOpensBox(col, whole) {
13
+ export function gridTextOpensBox(col, whole, inCell = false) {
14
+ if (inCell)
15
+ return false;
14
16
  return isLongTextColumn(col) || (whole && isWholeTextColumn(col));
15
17
  }
@@ -1,5 +1,5 @@
1
1
  import { type FieldDef } from "@viewkitjs/fields";
2
- import type { OrderDir } from "../grouping/sort-groups.js";
2
+ import { type SortDirection } from "@viewkitjs/fields/query";
3
3
  import type { ListColumn } from "./column-schema.js";
4
4
  /** Whether a column offers Group by on a saved view: it presents a field of a type that splits a list, and the
5
5
  * list has not taken it out (`bucketable: false`). */
@@ -33,4 +33,4 @@ export declare function groupableOrders<Row>(columns: readonly ListColumn<Row>[]
33
33
  }): GroupableEntry<Row>[];
34
34
  /** The direction a sort by `field` opens in: a date newest first, a number or a yes/no largest first, text and
35
35
  * options A to Z; a date that looks ahead (a due date) soonest first. */
36
- export declare function sortDirFor(field: FieldDef): OrderDir;
36
+ export declare function sortDirFor(field: FieldDef): SortDirection;
@@ -7,6 +7,7 @@ import type { CategoryColor } from "@viewkitjs/fields/design/category-colors";
7
7
  import type { StageMark } from "@viewkitjs/fields/design/stage-marks";
8
8
  import type { StatusSlot } from "@viewkitjs/fields/design/status-slots";
9
9
  import type { FieldDef, RelationValue, ValueType } from "@viewkitjs/fields";
10
+ import type { FigureKind } from "@viewkitjs/fields/query";
10
11
  import type { ListColumnFormat } from "./column-format.js";
11
12
  /** The grid's column vocabulary: a column presents a VALUE, so its type is
12
13
  * the field's value type (a rollup or formula column is its result's type;
@@ -14,9 +15,6 @@ import type { ListColumnFormat } from "./column-format.js";
14
15
  * field-less legacy column still names one of these; `legacyFieldFromColumn`
15
16
  * is the bridge that reads it as a def. */
16
17
  export type ListColumnType = ValueType | "title";
17
- /** The list's name for the design system's slot — one union, aliased like
18
- * `ListDurationStyle` below, so the two cannot drift. */
19
- export type ListStatusSlot = StatusSlot;
20
18
  /**
21
19
  * Where a field lands on a CARD. The board's own type→zone table decides this
22
20
  * for almost every column; this union is declared here, in the model, so a
@@ -33,7 +31,7 @@ export type ListSelectColor = CategoryColor;
33
31
  export type ListColumnOption = {
34
32
  value: string;
35
33
  label?: string;
36
- slot?: ListStatusSlot;
34
+ slot?: StatusSlot;
37
35
  color?: ListSelectColor;
38
36
  /**
39
37
  * The value's stage mark — set when this option is a POSITION ON A LADDER,
@@ -76,14 +74,15 @@ export type ListRelationValue = RelationValue & {
76
74
  };
77
75
  export type { ListColumnFormat, ListDateStyle, ListDateStyleOverrides, ListDurationStyle, ListDurationStyleOverrides, ListNumberFormatOverrides, ListNumberFormatState, ListPercentDisplayOverrides, ListShowTimeOverrides, } from "./column-format.js";
78
76
  export type ListOptionColorOverrides = Record<string, Record<string, ListSelectColor>>;
79
- /** `ratio` is sum-over-sum as a percent, offered only by a column carrying `ratio`. */
80
- export type ListAggregateKind = "none" | "sum" | "avg" | "min" | "max" | "count" | "filled" | "unique" | "ratio";
77
+ /** A column's footer pick: fields' figure kinds. `ratio` is sum-over-sum as a percent, offered only by a column
78
+ * carrying `ratio`. */
79
+ export type ListAggregateKind = FigureKind;
81
80
  export type ListCellAction<Row> = {
82
81
  id: string;
83
82
  icon: (row: Row) => ReactNode;
84
83
  label?: (row: Row) => string;
85
84
  onClick?: (row: Row, event?: ReactMouseEvent<HTMLButtonElement>) => void;
86
- status?: (row: Row) => ListStatusSlot | null;
85
+ status?: (row: Row) => StatusSlot | null;
87
86
  };
88
87
  /**
89
88
  * Declarative column schema. A typed `accessor` uses standard chrome; `render`
@@ -15,3 +15,14 @@ import type { ListColumn } from "./column-schema.js";
15
15
  * nothing to compare.
16
16
  */
17
17
  export declare function effectiveSortKey<Row>(col: ListColumn<Row>, viewBacked: boolean): string | undefined;
18
+ /**
19
+ * THE PARTS A PLACE COLUMN SORTS BY, from its header and the Sort panel.
20
+ *
21
+ * A place has no whole sort (`effectiveSortKey`), but it sorts by one of its parts: the sort's value is the part
22
+ * key `partKey(field.key, part)`, which a host reads back with `parsePartKey`. Offered on the same terms as a
23
+ * field's own sort (a saved view, a display read, no declared `sortKey`, not `sortable: false`), and narrowed to the
24
+ * parts the field states it holds.
25
+ */
26
+ export declare function columnSortParts<Row>(col: ListColumn<Row>, viewBacked: boolean): readonly string[];
27
+ /** The part a place column sorts by while `value` (a list's sort value) is one of its part keys; else undefined. */
28
+ export declare function sortPartOf(value: string, fieldKey: string, parts: readonly string[]): string | undefined;
@@ -1,4 +1,6 @@
1
1
  import { valueTypeOf } from "@viewkitjs/fields";
2
+ import { SORT_PART_ROWS, parsePartKey } from "./part-rows.js";
3
+ import { keptParts } from "./place-parts.js";
2
4
  export function effectiveSortKey(col, viewBacked) {
3
5
  if (col.sortable === false)
4
6
  return undefined;
@@ -9,3 +11,15 @@ export function effectiveSortKey(col, viewBacked) {
9
11
  const type = valueTypeOf(col.field);
10
12
  return type === "location" || type === "rich_text" ? undefined : col.field.key;
11
13
  }
14
+ export function columnSortParts(col, viewBacked) {
15
+ if (col.sortable === false || col.sortKey || !viewBacked || !col.field || !col.accessor)
16
+ return [];
17
+ const field = col.field;
18
+ if (valueTypeOf(field) !== "location")
19
+ return [];
20
+ return keptParts(field, SORT_PART_ROWS.location ?? []);
21
+ }
22
+ export function sortPartOf(value, fieldKey, parts) {
23
+ const { id, part } = parsePartKey(value);
24
+ return id === fieldKey && part !== undefined && parts.includes(part) ? part : undefined;
25
+ }