viewkitjs 0.28.0 → 0.29.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 (305) hide show
  1. package/CHANGELOG.md +107 -0
  2. package/MIGRATION.md +85 -4
  3. package/fields/dist/derived.d.ts +2 -1
  4. package/fields/dist/derived.js +9 -3
  5. package/fields/dist/entities.js +41 -3
  6. package/fields/dist/index.d.ts +1 -1
  7. package/fields/dist/index.js +1 -1
  8. package/fields/dist/messages.d.ts +8 -2
  9. package/fields/dist/messages.js +3 -0
  10. package/fields/dist/range.d.ts +6 -0
  11. package/fields/dist/range.js +8 -0
  12. package/fields/dist/registry.js +11 -1
  13. package/fields/dist/spec-changes.js +1 -0
  14. package/fields/dist/types.d.ts +23 -1
  15. package/fields/docs/guides/derived-fields.md +7 -5
  16. package/fields/docs/guides/field-types.md +2 -2
  17. package/fields/docs/guides/the-index.md +1 -1
  18. package/fields/docs/reference/fields.md +3 -1
  19. package/fields/docs/reference/types.md +3 -1
  20. package/fields/skills/viewkit/SKILL.md +1 -1
  21. package/package.json +2 -1
  22. package/postgres/dist/definitions/build.js +29 -5
  23. package/postgres/dist/definitions/label.d.ts +7 -0
  24. package/postgres/dist/definitions/label.js +9 -1
  25. package/postgres/dist/definitions/lookup.js +6 -2
  26. package/postgres/dist/definitions/place.d.ts +6 -3
  27. package/postgres/dist/definitions/rollup.js +5 -1
  28. package/postgres/dist/definitions/storage.d.ts +15 -0
  29. package/postgres/dist/definitions/storage.js +52 -1
  30. package/postgres/dist/definitions/stored.js +21 -0
  31. package/postgres/dist/phone.d.ts +13 -1
  32. package/postgres/dist/phone.js +23 -3
  33. package/postgres/dist/search-indexes.d.ts +6 -1
  34. package/postgres/dist/search-indexes.js +71 -25
  35. package/postgres/dist/search.js +3 -3
  36. package/postgres/docs/guides/definitions.md +22 -5
  37. package/postgres/docs/guides/field-map.md +5 -4
  38. package/postgres/docs/reference/definitions.md +3 -3
  39. package/postgres/docs/reference/postgres.md +1 -1
  40. package/views/dist/cells/cell-format.js +2 -2
  41. package/views/dist/cells/cell-values.js +9 -10
  42. package/views/dist/contract.d.ts +149 -3
  43. package/views/dist/contract.js +157 -1
  44. package/views/dist/controls/bulk-bar/bulk-bar-of.d.ts +66 -0
  45. package/views/dist/controls/bulk-bar/bulk-bar-of.js +22 -0
  46. package/views/dist/controls/bulk-bar/bulk-bar.d.ts +40 -0
  47. package/views/dist/controls/bulk-bar/bulk-bar.js +278 -0
  48. package/views/dist/controls/bulk-bar/looks.d.ts +10 -0
  49. package/views/dist/controls/bulk-bar/looks.js +14 -0
  50. package/views/dist/controls/bulk-bar/map-selection-bar.d.ts +19 -0
  51. package/views/dist/controls/bulk-bar/map-selection-bar.js +57 -0
  52. package/views/dist/controls/bulk-bar/tokens.d.ts +136 -0
  53. package/views/dist/controls/bulk-bar/tokens.js +36 -0
  54. package/views/dist/controls/bulk-bar/words.d.ts +50 -0
  55. package/views/dist/controls/bulk-bar/words.js +19 -0
  56. package/views/dist/controls/bulk-bar.css +96 -0
  57. package/views/dist/controls/button/button.js +3 -1
  58. package/views/dist/controls/button.css +5 -4
  59. package/views/dist/controls/checkbox/checkbox.js +3 -1
  60. package/views/dist/controls/checkbox.css +1 -1
  61. package/views/dist/controls/choice/tokens.d.ts +79 -0
  62. package/views/dist/controls/choice/tokens.js +22 -0
  63. package/views/dist/controls/choice.css +31 -0
  64. package/views/dist/controls/compound-editor/looks.js +1 -1
  65. package/views/dist/controls/controls.d.ts +10 -0
  66. package/views/dist/controls/controls.js +8 -0
  67. package/views/dist/controls/customize/customize.d.ts +125 -0
  68. package/views/dist/controls/customize/customize.js +243 -0
  69. package/views/dist/controls/customize/glide.d.ts +10 -0
  70. package/views/dist/controls/customize/glide.js +55 -0
  71. package/views/dist/controls/customize/looks.d.ts +13 -0
  72. package/views/dist/controls/customize/looks.js +11 -0
  73. package/views/dist/controls/customize/map-customize-body.d.ts +18 -0
  74. package/views/dist/controls/customize/map-customize-body.js +160 -0
  75. package/views/dist/controls/customize/rules.d.ts +23 -0
  76. package/views/dist/controls/customize/rules.js +19 -0
  77. package/views/dist/controls/customize/tokens.d.ts +40 -0
  78. package/views/dist/controls/customize/tokens.js +12 -0
  79. package/views/dist/controls/customize/words.d.ts +58 -0
  80. package/views/dist/controls/customize/words.js +37 -0
  81. package/views/dist/controls/customize.css +54 -0
  82. package/views/dist/controls/date-editor/looks.js +1 -1
  83. package/views/dist/controls/filter-editor/block.d.ts +31 -0
  84. package/views/dist/controls/filter-editor/block.js +27 -0
  85. package/views/dist/controls/filter-editor/filter-editor.d.ts +2 -0
  86. package/views/dist/controls/filter-editor/filter-editor.js +85 -43
  87. package/views/dist/controls/filter-editor/how.d.ts +1 -1
  88. package/views/dist/controls/filter-editor/how.js +1 -0
  89. package/views/dist/controls/filter-editor/map-filter-body.d.ts +16 -1
  90. package/views/dist/controls/filter-editor/map-filter-body.js +39 -13
  91. package/views/dist/controls/filter-editor/map-rules.d.ts +27 -11
  92. package/views/dist/controls/filter-editor/map-rules.js +73 -42
  93. package/views/dist/controls/filter-editor/rules.d.ts +43 -5
  94. package/views/dist/controls/filter-editor/rules.js +55 -2
  95. package/views/dist/controls/filter-editor/words.d.ts +15 -0
  96. package/views/dist/controls/filter-editor/words.js +6 -0
  97. package/views/dist/controls/filter-editor.css +18 -0
  98. package/views/dist/controls/index.d.ts +26 -2
  99. package/views/dist/controls/index.js +25 -2
  100. package/views/dist/controls/inline-input/looks.js +1 -1
  101. package/views/dist/controls/input/input.js +10 -4
  102. package/views/dist/controls/internal/phone.d.ts +5 -4
  103. package/views/dist/controls/internal/phone.js +7 -7
  104. package/views/dist/controls/internal/scroll.js +5 -1
  105. package/views/dist/controls/internal/typed-run.d.ts +2 -0
  106. package/views/dist/controls/internal/typed-run.js +5 -0
  107. package/views/dist/controls/menu/map-menu.js +2 -2
  108. package/views/dist/controls/number-editor/looks.js +1 -1
  109. package/views/dist/controls/option/option.js +3 -1
  110. package/views/dist/controls/option.css +1 -1
  111. package/views/dist/controls/pane/pane.d.ts +4 -0
  112. package/views/dist/controls/pane/pane.js +2 -1
  113. package/views/dist/controls/picker/looks.js +1 -1
  114. package/views/dist/controls/picker/map-picker.d.ts +6 -2
  115. package/views/dist/controls/picker/map-picker.js +4 -2
  116. package/views/dist/controls/picker/picker.d.ts +7 -0
  117. package/views/dist/controls/picker/picker.js +57 -8
  118. package/views/dist/controls/popover/map-popover.d.ts +1 -1
  119. package/views/dist/controls/popover/map-popover.js +2 -2
  120. package/views/dist/controls/popover/popover.js +2 -1
  121. package/views/dist/controls/popover.css +3 -0
  122. package/views/dist/controls/ports-host/map-ports-host.d.ts +7 -0
  123. package/views/dist/controls/ports-host/map-ports-host.js +43 -0
  124. package/views/dist/controls/press/tokens.d.ts +8 -0
  125. package/views/dist/controls/press/tokens.js +4 -0
  126. package/views/dist/controls/press.css +44 -0
  127. package/views/dist/controls/quick-filters/looks.d.ts +11 -0
  128. package/views/dist/controls/quick-filters/looks.js +9 -0
  129. package/views/dist/controls/quick-filters/map-quick-filters-body.d.ts +31 -0
  130. package/views/dist/controls/quick-filters/map-quick-filters-body.js +56 -0
  131. package/views/dist/controls/quick-filters/quick-filters.d.ts +37 -0
  132. package/views/dist/controls/quick-filters/quick-filters.js +89 -0
  133. package/views/dist/controls/quick-filters/reminder.d.ts +18 -0
  134. package/views/dist/controls/quick-filters/reminder.js +41 -0
  135. package/views/dist/controls/quick-filters/rules.d.ts +89 -0
  136. package/views/dist/controls/quick-filters/rules.js +52 -0
  137. package/views/dist/controls/quick-filters/tokens.d.ts +112 -0
  138. package/views/dist/controls/quick-filters/tokens.js +30 -0
  139. package/views/dist/controls/quick-filters/words.d.ts +25 -0
  140. package/views/dist/controls/quick-filters/words.js +13 -0
  141. package/views/dist/controls/quick-filters.css +118 -0
  142. package/views/dist/controls/sheet/bottom-sheet.d.ts +9 -4
  143. package/views/dist/controls/sheet/bottom-sheet.js +4 -4
  144. package/views/dist/controls/sheet/map-sheet.d.ts +4 -1
  145. package/views/dist/controls/sheet/map-sheet.js +19 -6
  146. package/views/dist/controls/sheet/sheet-parts.d.ts +10 -0
  147. package/views/dist/controls/sheet/sheet-parts.js +2 -0
  148. package/views/dist/controls/switch-row/switch-row.d.ts +15 -0
  149. package/views/dist/controls/switch-row/switch-row.js +9 -0
  150. package/views/dist/controls/switch-row/tokens.d.ts +51 -0
  151. package/views/dist/controls/switch-row/tokens.js +15 -0
  152. package/views/dist/controls/switch-row.css +39 -0
  153. package/views/dist/controls/switch.css +1 -1
  154. package/views/dist/controls/tag/tag.js +3 -1
  155. package/views/dist/controls/tag-field/tag-field.d.ts +20 -0
  156. package/views/dist/controls/tag-field/tag-field.js +19 -0
  157. package/views/dist/controls/tag-field/tokens.d.ts +7 -0
  158. package/views/dist/controls/tag-field/tokens.js +4 -0
  159. package/views/dist/controls/tag-field.css +13 -0
  160. package/views/dist/controls/text-editor/looks.js +1 -1
  161. package/views/dist/controls/text-editor/text-editor.js +1 -5
  162. package/views/dist/controls/toast/toast.d.ts +5 -1
  163. package/views/dist/controls/toast/toast.js +5 -3
  164. package/views/dist/controls/tokens.js +18 -0
  165. package/views/dist/controls/toolbar/keys.d.ts +3 -0
  166. package/views/dist/controls/toolbar/keys.js +11 -0
  167. package/views/dist/controls/toolbar/looks.d.ts +10 -0
  168. package/views/dist/controls/toolbar/looks.js +40 -0
  169. package/views/dist/controls/toolbar/tokens.d.ts +28 -0
  170. package/views/dist/controls/toolbar/tokens.js +9 -0
  171. package/views/dist/controls/toolbar/toolbar.d.ts +111 -0
  172. package/views/dist/controls/toolbar/toolbar.js +370 -0
  173. package/views/dist/controls/toolbar/words.d.ts +28 -0
  174. package/views/dist/controls/toolbar/words.js +17 -0
  175. package/views/dist/controls/toolbar-button/looks.d.ts +4 -0
  176. package/views/dist/controls/toolbar-button/looks.js +21 -0
  177. package/views/dist/controls/toolbar-button/tokens.d.ts +103 -0
  178. package/views/dist/controls/toolbar-button/tokens.js +28 -0
  179. package/views/dist/controls/toolbar-button/toolbar-button.d.ts +66 -0
  180. package/views/dist/controls/toolbar-button/toolbar-button.js +51 -0
  181. package/views/dist/controls/toolbar-button.css +75 -0
  182. package/views/dist/controls/toolbar.css +65 -0
  183. package/views/dist/controls/tooltip/map-tooltip.d.ts +1 -1
  184. package/views/dist/controls/tooltip/map-tooltip.js +2 -2
  185. package/views/dist/controls/tooltip/tooltip.d.ts +3 -1
  186. package/views/dist/controls/tooltip/tooltip.js +2 -2
  187. package/views/dist/controls/values-editor/looks.js +1 -1
  188. package/views/dist/controls/views-list/map-views-list-body.d.ts +4 -1
  189. package/views/dist/controls/views-list/map-views-list-body.js +128 -4
  190. package/views/dist/controls/views-list/rules.d.ts +26 -0
  191. package/views/dist/controls/views-list/rules.js +63 -0
  192. package/views/dist/controls/views-list/view-menu.d.ts +84 -0
  193. package/views/dist/controls/views-list/view-menu.js +201 -0
  194. package/views/dist/controls/views-list/views-list.d.ts +8 -1
  195. package/views/dist/controls/views-list/views-list.js +18 -3
  196. package/views/dist/controls/views-list/words.d.ts +54 -0
  197. package/views/dist/controls/views-list/words.js +10 -1
  198. package/views/dist/controls/views-list.css +5 -1
  199. package/views/dist/display/date.js +3 -3
  200. package/views/dist/display/format.d.ts +6 -0
  201. package/views/dist/display/format.js +3 -0
  202. package/views/dist/display/index.d.ts +1 -1
  203. package/views/dist/display/index.js +1 -1
  204. package/views/dist/display/range.d.ts +2 -1
  205. package/views/dist/display/range.js +4 -1
  206. package/views/dist/grid/chrome/GridHeader.js +2 -1
  207. package/views/dist/grid/chrome/GridNumberEditor.js +2 -2
  208. package/views/dist/grid/chrome/GridRowCells.js +2 -1
  209. package/views/dist/grid/chrome/GridTextEditor.js +2 -2
  210. package/views/dist/grid/chrome/grid-editor-layer.d.ts +5 -1
  211. package/views/dist/grid/chrome/grid-editor-layer.js +1 -0
  212. package/views/dist/grid/chrome/grid-fitted-box.d.ts +7 -1
  213. package/views/dist/grid/chrome/grid-fitted-box.js +4 -4
  214. package/views/dist/grid/core/clipboard-model.js +9 -4
  215. package/views/dist/grid/grid.css +240 -0
  216. package/views/dist/grid/looks.d.ts +5 -1
  217. package/views/dist/grid/looks.js +20 -12
  218. package/views/dist/grid-tokens.d.ts +109 -0
  219. package/views/dist/grid-tokens.js +29 -0
  220. package/views/dist/looks/index.d.ts +5 -0
  221. package/views/dist/looks/index.js +5 -0
  222. package/views/dist/looks/pieces.js +10 -0
  223. package/views/dist/model/column-capabilities.d.ts +2 -0
  224. package/views/dist/model/column-filters.d.ts +2 -1
  225. package/views/dist/model/column-from.js +2 -2
  226. package/views/dist/model/relation-filters.d.ts +2 -0
  227. package/views/dist/panels/index.d.ts +2 -2
  228. package/views/dist/panels/index.js +2 -2
  229. package/views/dist/panels/labels.d.ts +4 -0
  230. package/views/dist/panels/labels.js +8 -0
  231. package/views/dist/panels/model.d.ts +10 -2
  232. package/views/dist/panels/quick/model.d.ts +4 -0
  233. package/views/dist/panels/react/customize-body.d.ts +9 -4
  234. package/views/dist/panels/react/customize-body.js +39 -11
  235. package/views/dist/panels/react/customize.d.ts +8 -1
  236. package/views/dist/panels/react/customize.js +9 -6
  237. package/views/dist/panels/react/filter/FilterEditor.js +4 -4
  238. package/views/dist/panels/react/filter/FilterFieldList.js +10 -2
  239. package/views/dist/panels/react/filter/PhoneFilterEditor.js +3 -3
  240. package/views/dist/panels/react/filter/filter-body.js +5 -2
  241. package/views/dist/panels/react/panel-step.d.ts +3 -0
  242. package/views/dist/panels/react/panel-step.js +2 -1
  243. package/views/dist/panels/react/quick/QuickFiltersPanel.js +1 -0
  244. package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +13 -3
  245. package/views/dist/panels/react/toolbar/ReadyToolbar.js +10 -3
  246. package/views/dist/panels/react/toolbar/Toolbar.js +1 -1
  247. package/views/dist/panels/react/toolbar/ToolbarAsideFilter.js +2 -2
  248. package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +13 -3
  249. package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +2 -1
  250. package/views/dist/panels/react/toolbar/ToolbarFilters.js +3 -3
  251. package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +12 -4
  252. package/views/dist/panels/react/toolbar/ToolbarOptions.js +6 -2
  253. package/views/dist/panels/react/view-footer.d.ts +1 -1
  254. package/views/dist/panels/react/views-row/ViewPicker.js +25 -4
  255. package/views/dist/panels/settings/filter-groups.d.ts +3 -0
  256. package/views/dist/panels/settings/filter-groups.js +40 -9
  257. package/views/dist/panels/settings/filters.d.ts +5 -0
  258. package/views/dist/panels/settings/filters.js +12 -6
  259. package/views/dist/panels/views-row/model.d.ts +10 -1
  260. package/views/dist/provider/ViewsProvider.js +29 -5
  261. package/views/dist/provider/components.d.ts +149 -8
  262. package/views/dist/provider/context.d.ts +6 -0
  263. package/views/dist/provider/ports.d.ts +18 -6
  264. package/views/dist/provider/ports.js +2 -1
  265. package/views/dist/react.d.ts +2 -2
  266. package/views/dist/react.js +1 -1
  267. package/views/dist/selection/SelectionBar.d.ts +2 -16
  268. package/views/dist/selection/SelectionBar.js +4 -1
  269. package/views/dist/selection/bar-props.d.ts +26 -0
  270. package/views/dist/selection/bar-props.js +1 -0
  271. package/views/dist/selection/index.d.ts +1 -1
  272. package/views/dist/selection/verbs.d.ts +32 -5
  273. package/views/dist/styles.css +656 -25
  274. package/views/dist/styles.unlayered.css +653 -22
  275. package/views/docs/contract.md +44 -17
  276. package/views/docs/controls/bulk-bar.md +41 -0
  277. package/views/docs/controls/choice.md +25 -0
  278. package/views/docs/controls/customize.md +17 -0
  279. package/views/docs/controls/popover.md +2 -0
  280. package/views/docs/controls/press.md +9 -0
  281. package/views/docs/controls/quick-filters.md +35 -0
  282. package/views/docs/controls/radio.md +1 -1
  283. package/views/docs/controls/switch-row.md +18 -0
  284. package/views/docs/controls/tag-field.md +7 -0
  285. package/views/docs/controls/toolbar-button.md +31 -0
  286. package/views/docs/controls/toolbar.md +14 -0
  287. package/views/docs/guides/atoms.md +2 -2
  288. package/views/docs/guides/cells.md +2 -2
  289. package/views/docs/guides/display.md +2 -2
  290. package/views/docs/guides/looks.md +8 -2
  291. package/views/docs/guides/ports.md +6 -6
  292. package/views/docs/guides/selection.md +5 -1
  293. package/views/docs/guides/the-grid.md +1 -1
  294. package/views/docs/guides/the-provider.md +2 -2
  295. package/views/docs/install.md +4 -1
  296. package/views/docs/reference/cells.md +1 -1
  297. package/views/docs/reference/controls.md +194 -13
  298. package/views/docs/reference/display.md +1 -0
  299. package/views/docs/reference/looks.md +25 -11
  300. package/views/docs/reference/panels-react.md +7 -7
  301. package/views/docs/reference/panels.md +8 -6
  302. package/views/docs/reference/react.md +13 -6
  303. package/views/docs/reference/selection.md +4 -2
  304. package/views/docs/reference/views.md +7 -6
  305. package/views/skills/views/SKILL.md +2 -2
@@ -35,6 +35,8 @@ type FarRow = Record<string, unknown>;
35
35
  export type FarValues = {
36
36
  values: Readonly<Record<string, readonly string[]>>;
37
37
  labels?: Readonly<Record<string, Readonly<Record<string, string>>>>;
38
+ /** A far field's values are wanted, by its path: its row opened, or a filter on the bar holds a value of it the host
39
+ * hasn't named (asked once, VK-883); the names go in `labels`. */
38
40
  onWanted: (path: string) => void;
39
41
  };
40
42
  /** What a relation's far fields are as the filter builder reads them (VK-531): each far field as a column (greyed, with
@@ -4,14 +4,14 @@ export type { CollectionExportCsv, CollectionViewState } from "./view-state.js";
4
4
  export { getViewOptionAvailability, resolvePersonalSection } from "./availability.js";
5
5
  export { groupSortChoices, groupSortValue, offersManualOrder } from "./group-sort.js";
6
6
  export { useFilterOpened } from "./use-filter-opened.js";
7
- export { GROUP_BY_SEARCH_AFTER, activeGroupDimension, dateRangeValueLabel, filterRowValueLabel, filterValueLabel, groupDateByLabel, groupSortLabel, groupValueLabel, layoutValueLabel, matchGroupDimensions, matchSortOptions, relationSentence, sortValueLabel, timeScopeRowValueLabel, } from "./labels.js";
7
+ export { GROUP_BY_SEARCH_AFTER, activeGroupDimension, dateRangeValueLabel, drawsUnnamedValue, filterRowValueLabel, filterValueLabel, groupDateByLabel, groupSortLabel, groupValueLabel, layoutValueLabel, matchGroupDimensions, matchSortOptions, relationSentence, sortValueLabel, timeScopeRowValueLabel, } from "./labels.js";
8
8
  export type { CollectionChildAxis, CollectionViewsConfig, CollectionViewsInput, PillOption, ViewTabOption, ViewsLayout, } from "./views-row/model.js";
9
9
  export { splitViewAxes, toViewAxes } from "./views-row/model.js";
10
10
  export { settingsPanels } from "./settings/settings-panels.js";
11
11
  export type { SettingsPanels } from "./settings/settings-panels.js";
12
12
  export type { PanelGroupHead, SettingsGroupDimension, SettingsPanelsInput, } from "./settings/input.js";
13
13
  export { filterWriter, settingsFilters, type FilterWriter } from "./settings/filters.js";
14
- export { emptyValueFor, filterEditorFields, filterWaysOf, heldUntilWhole, newRelationRuleFor, newRuleFor, setAsideFits, settingsFilterTree, takesValue, withField, withOperator, } from "./settings/filter-groups.js";
14
+ export { emptyValueFor, filterEditorFields, filterWaysOf, heldUntilWhole, listedFieldsOf, newRelationRuleFor, newRuleFor, setAsideFits, settingsFilterTree, takesValue, withField, withOperator, } from "./settings/filter-groups.js";
15
15
  export { addAt, addOnBar, advancedFiltersOf, barAddRefusal, barItemsOf, canExcludeAt, canGroupAt, clearedTree, editIn, editWhole, editView, followAdvancedKeys, followBarKeys, groupAt, itemsAt, joinAt, nodeAt, orLevelWrapped, putBackAt, removeAt, replaceAt, setExcludedAt, setJoinAt, settled, shownRuleCount, type AdvancedFilter, type BarItem, type FilterPath, } from "../filters/filter-tree.js";
16
16
  export { groupDimensionFor, settingsGroup, settingsGroupBy, settingsSort, } from "./settings/order.js";
17
17
  export { addSortRule, canAddSortRule, isSortRulesActive, openSortPlaces, settingsSorts, sortFieldOf, sortRulesLabel, sortedField, sortedValues, withFirstRule, } from "./settings/sorts.js";
@@ -2,11 +2,11 @@ export { clearViewOptions, countActiveFilters, countActiveViewOptions, groupOrde
2
2
  export { getViewOptionAvailability, resolvePersonalSection } from "./availability.js";
3
3
  export { groupSortChoices, groupSortValue, offersManualOrder } from "./group-sort.js";
4
4
  export { useFilterOpened } from "./use-filter-opened.js";
5
- export { GROUP_BY_SEARCH_AFTER, activeGroupDimension, dateRangeValueLabel, filterRowValueLabel, filterValueLabel, groupDateByLabel, groupSortLabel, groupValueLabel, layoutValueLabel, matchGroupDimensions, matchSortOptions, relationSentence, sortValueLabel, timeScopeRowValueLabel, } from "./labels.js";
5
+ export { GROUP_BY_SEARCH_AFTER, activeGroupDimension, dateRangeValueLabel, drawsUnnamedValue, filterRowValueLabel, filterValueLabel, groupDateByLabel, groupSortLabel, groupValueLabel, layoutValueLabel, matchGroupDimensions, matchSortOptions, relationSentence, sortValueLabel, timeScopeRowValueLabel, } from "./labels.js";
6
6
  export { splitViewAxes, toViewAxes } from "./views-row/model.js";
7
7
  export { settingsPanels } from "./settings/settings-panels.js";
8
8
  export { filterWriter, settingsFilters } from "./settings/filters.js";
9
- export { emptyValueFor, filterEditorFields, filterWaysOf, heldUntilWhole, newRelationRuleFor, newRuleFor, setAsideFits, settingsFilterTree, takesValue, withField, withOperator, } from "./settings/filter-groups.js";
9
+ export { emptyValueFor, filterEditorFields, filterWaysOf, heldUntilWhole, listedFieldsOf, newRelationRuleFor, newRuleFor, setAsideFits, settingsFilterTree, takesValue, withField, withOperator, } from "./settings/filter-groups.js";
10
10
  export { addAt, addOnBar, advancedFiltersOf, barAddRefusal, barItemsOf, canExcludeAt, canGroupAt, clearedTree, editIn, editWhole, editView, followAdvancedKeys, followBarKeys, groupAt, itemsAt, joinAt, nodeAt, orLevelWrapped, putBackAt, removeAt, replaceAt, setExcludedAt, setJoinAt, settled, shownRuleCount, } from "../filters/filter-tree.js";
11
11
  export { groupDimensionFor, settingsGroup, settingsGroupBy, settingsSort, } from "./settings/order.js";
12
12
  export { addSortRule, canAddSortRule, isSortRulesActive, openSortPlaces, settingsSorts, sortFieldOf, sortRulesLabel, sortedField, sortedValues, withFirstRule, } from "./settings/sorts.js";
@@ -2,6 +2,10 @@ import { type DateRangeConfig, type GroupConfig, type LayoutConfig, type SortCon
2
2
  import { type FilterConfig, type FilterConfigRelation } from "../filters/filter-model.js";
3
3
  import { type FieldConventions } from "viewkitjs/fields";
4
4
  import { type ViewsMessageResolver } from "../contract.js";
5
+ /** Whether `filterValueLabel` draws this filter's value by its stored key, no option naming it (VK-883): a choice whose one
6
+ * picked value its options don't list, as a person's id after a reload before the app named it. Two or more are drawn as a
7
+ * count, and a body with words of its own (`valueLabel`, a text, a number, a date) never draws a key. */
8
+ export declare function drawsUnnamedValue<T extends string>(filter: FilterConfig<T> | null): boolean;
5
9
  /**
6
10
  * What a relation's filter keeps, in one sentence (POR-704): "Clients with at least one campaign where
7
11
  * status is Active." Read beside the quantifier rows, so a reader never has to work out what "None" with a
@@ -19,6 +19,14 @@ function condition(w, cv, messages) {
19
19
  values: { field: w.label, value: filterValueLabel(w, cv, messages) },
20
20
  });
21
21
  }
22
+ export function drawsUnnamedValue(filter) {
23
+ if (!filter || filter.editor !== undefined || filter.valueLabel !== undefined || !("options" in filter))
24
+ return false;
25
+ const named = (value) => filter.options.some((option) => option.value === value);
26
+ if (filter.multi)
27
+ return filter.value.length === 1 && !named(filter.value[0]);
28
+ return filter.value !== (filter.allValue ?? "all") && !named(filter.value);
29
+ }
22
30
  export function relationSentence(filter, cv, messages = resolveViewsMessage) {
23
31
  const { subject, noun } = filter;
24
32
  const rule = filter.value;
@@ -79,6 +79,9 @@ export type FilterEditorField = {
79
79
  far?: readonly FilterEditorField[];
80
80
  /** How its field is marked, as the grid's header marks its column (`columnMark`); a relation has none. */
81
81
  mark?: FieldMark;
82
+ /** Why no rule can be made on it, in the app's words (an unavailable capability's reason, else
83
+ * `views.panels.filter-not-offered`); absent, it can. Only in `FilterTreeConfig.listed`: a field list draws it greyed. */
84
+ disabled?: string;
82
85
  };
83
86
  /** A field the list no longer shows (an archived one, say), by its key, with its label and its options' labels: a
84
87
  * set-aside filter on it is named by them, never by its key and stored value. Nothing is stored in the rule. */
@@ -96,7 +99,11 @@ export type FilterGoneField = {
96
99
  /** A list's filter as a tree the filter editor changes (`settingsPanels(…).filterTree`, with `filterGroups`). */
97
100
  export type FilterTreeConfig = {
98
101
  tree: FilterTree;
102
+ /** The fields a rule may name. */
99
103
  fields: readonly FilterEditorField[];
104
+ /** What a field list shows, in the person's column order: `fields`, and in their places the columns the list can't
105
+ * filter, greyed (`disabled`), never picked. Absent: `fields` (`listedFieldsOf`). */
106
+ listed?: readonly FilterEditorField[];
100
107
  /** The fields the list no longer shows, so a set-aside filter on one is named as a person knows it. */
101
108
  gone?: readonly FilterGoneField[];
102
109
  /** Each change, as it is made: the whole tree. */
@@ -105,8 +112,9 @@ export type FilterTreeConfig = {
105
112
  * read from `rule` and each change handed to `write` as the rule with its new value; null for a rule no body
106
113
  * edits (a set-aside rule, an operator taking no value). `relation`: the relation's field key, for a far rule. */
107
114
  valueOf: (rule: FilterRule, write: (next: FilterRule) => void, relation?: string) => FilterConfig<string> | null;
108
- /** A choice field's values as the Picker draws them, where they are known as the list opens; undefined where they are read on
109
- * demand or the field is no choice. `relation`: the relation's field key, for a far field. */
115
+ /** A choice field's values as the Picker draws them, or a place's country's names (`part` `countryCode`), where they are known as
116
+ * the list opens; undefined where they are read on demand or the field is no choice. `relation`: the relation's field key, for a
117
+ * far field. */
110
118
  optionsOf?: (fieldKey: string, part?: string, relation?: string) => readonly ViewsPickerItem[] | undefined;
111
119
  label?: string;
112
120
  };
@@ -1,4 +1,5 @@
1
1
  import { type ListHold } from "viewkitjs/fields/query";
2
+ import type { ViewsPickerItem } from "../../provider/components.js";
2
3
  /** A field's values past this many show a search over them. */
3
4
  export declare const QUICK_SEARCH_AFTER = 8;
4
5
  /** A value a field offers: its key as the hold keeps it (an option, an id, "true" or "false", "" for none) and its
@@ -20,6 +21,9 @@ export type QuickFilterField = {
20
21
  counts?: Readonly<Record<string, number>> | null;
21
22
  /** What its search says; absent, "Search {label}". */
22
23
  searchPlaceholder?: string;
24
+ /** How its values draw: a choice field's every option as the Picker draws it (a status's step, a person's or a
25
+ * company's face), where the app holds them. A value's mark is its option's; absent, no marks. */
26
+ options?: readonly ViewsPickerItem[];
23
27
  };
24
28
  /** The words of a field the hold holds, for what the fields offered don't list: a field the strip doesn't offer and a
25
29
  * value no option lists any more (a deleted record, a retired option). */
@@ -1,5 +1,6 @@
1
- import type { ReactNode } from "react";
2
- import type { ViewsBodyStep } from "../../provider/components.js";
1
+ import { type ReactNode } from "react";
2
+ import type { ViewsBodyStep, ViewsCustomizeBodyProps } from "../../provider/components.js";
3
+ import { useViews } from "../../provider/context.js";
3
4
  import type { GroupConfig } from "../model.js";
4
5
  import type { ViewOptionsPanelContentProps } from "./customize.js";
5
6
  /** The app's `GroupBody` over a group: inside Customize, whose head holds the ✕, it gets no `actions`; its `onDone`
@@ -10,8 +11,12 @@ export declare function AppGroupBody({ group, form, onDone, onStepChange, }: {
10
11
  onDone: () => void;
11
12
  onStepChange?: (step: ViewsBodyStep | null) => void;
12
13
  }): ReactNode;
13
- /** The app's `CustomizeBody` over Customize's own props: the view's settings as data, the page mapped onto the body's,
14
- * the ✕ on a phone only where the sheet's head doesn't draw it. Null without the slot. */
14
+ /** Customize's own props as a body is handed them: the view's settings as data, the page mapped onto the body's, the ✕ on a
15
+ * phone only where the sheet's head doesn't draw it. */
16
+ export declare function customizeBodyPropsOf(props: ViewOptionsPanelContentProps & {
17
+ form: "computer" | "phone";
18
+ }, { components, icons, messages }: Pick<ReturnType<typeof useViews>, "components" | "icons" | "messages">): ViewsCustomizeBodyProps;
19
+ /** The app's `CustomizeBody` over Customize's own props (customizeBodyPropsOf). Null without the slot. */
15
20
  export declare function AppCustomizeBody(props: ViewOptionsPanelContentProps & {
16
21
  form: "computer" | "phone";
17
22
  }): ReactNode;
@@ -1,10 +1,12 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { FILTER_TREE_MAX_UI_DEPTH } from "viewkitjs/fields/query";
4
+ import { useContext } from "react";
4
5
  import { useViews } from "../../provider/context.js";
5
6
  import { activePanelOf, customizeColumnsOf, customizeLayoutOf, customizePageOf, customizeSortOf, customizeToggleOf, groupBodyProps, } from "../customize-body.js";
6
- import { filterBodyChangeFits, takesValue } from "../settings/filter-groups.js";
7
+ import { filterBodyChangeFits, listedFieldsOf, takesValue } from "../settings/filter-groups.js";
7
8
  import { sortBodyOptions } from "../sort-body-options.js";
9
+ import { PanelStepHold } from "./panel-step.js";
8
10
  import { filterBodyFields } from "./filter/filter-body.js";
9
11
  import { FilterValueBody } from "./filter/FilterValueBody.js";
10
12
  export function AppGroupBody({ group, form, onDone, onStepChange, }) {
@@ -19,7 +21,7 @@ function customizeFilterOf(filterTree, messages) {
19
21
  const levels = FILTER_TREE_MAX_UI_DEPTH;
20
22
  return {
21
23
  label: filterTree.label ?? messages({ key: "views.panels.filter" }),
22
- fields: filterBodyFields(filterTree.fields, filterTree.optionsOf),
24
+ fields: filterBodyFields(listedFieldsOf(filterTree), filterTree.optionsOf),
23
25
  filter: level,
24
26
  levels,
25
27
  excludable: false,
@@ -36,19 +38,25 @@ function customizeFilterOf(filterTree, messages) {
36
38
  },
37
39
  };
38
40
  }
39
- export function AppCustomizeBody(props) {
40
- const { components, icons, messages } = useViews();
41
- const CustomizeBody = components.CustomizeBody;
42
- if (!CustomizeBody)
43
- return null;
44
- const { layout, filterTree, group, toggles, activePanel, onOpenPanel, anyActive, clearAll, onClose, closeButton = true, view, viewFoot, footClear, fieldEditor, form, } = props;
41
+ export function customizeBodyPropsOf(props, { components, icons, messages }) {
42
+ const { layout, filterTree, group, toggles, activePanel, onOpenPanel, anyActive, clearAll, onClose, closeButton = true, view, viewFoot, footClear, fieldEditor, form, viewName, onRenameView, onCopyLink, onExport, exportCount, } = props;
45
43
  const columns = layout ? customizeColumnsOf(layout, fieldEditor, messages) : undefined;
46
44
  const unmarked = customizeSortOf(props, messages);
47
45
  const sort = unmarked && {
48
46
  ...unmarked,
49
47
  options: sortBodyOptions(unmarked.options, { icons, AppIcon: components.AppIcon }),
50
48
  };
51
- return (_jsx(CustomizeBody, { label: messages({ key: "views.panels.customize-title" }), page: customizePageOf(activePanel), onPageChange: (page) => onOpenPanel(activePanelOf(page)), ...(layout && { layout: customizeLayoutOf(layout, messages) }), ...(columns && { columns }), ...(filterTree && { filter: customizeFilterOf(filterTree, messages) }), ...(sort && { sort }), ...(group && { group: groupBodyProps(group, messages) }), toggles: (toggles ?? []).map(customizeToggleOf), ...(view && {
49
+ return {
50
+ label: messages({ key: "views.panels.customize-title" }),
51
+ page: customizePageOf(activePanel),
52
+ onPageChange: (page) => onOpenPanel(activePanelOf(page)),
53
+ ...(layout && { layout: customizeLayoutOf(layout, messages) }),
54
+ ...(columns && { columns }),
55
+ ...(filterTree && { filter: customizeFilterOf(filterTree, messages) }),
56
+ ...(sort && { sort }),
57
+ ...(group && { group: groupBodyProps(group, messages) }),
58
+ toggles: (toggles ?? []).map(customizeToggleOf),
59
+ ...(view && {
52
60
  view: {
53
61
  changes: view.changes,
54
62
  stale: view.stale,
@@ -57,7 +65,27 @@ export function AppCustomizeBody(props) {
57
65
  onReset: view.onReset,
58
66
  onPublish: view.onPublish,
59
67
  },
60
- }), ...(viewFoot && { foot: viewFoot }), ...(!view && footClear && { onClear: footClear }), ...(!view && anyActive && { clearAll }), form: form, onDone: onClose ?? (() => undefined), ...(form === "phone" &&
68
+ }),
69
+ ...(viewFoot && { foot: viewFoot }),
70
+ ...(!view && footClear && { onClear: footClear }),
71
+ ...(!view && anyActive && { clearAll }),
72
+ form,
73
+ onDone: onClose ?? (() => undefined),
74
+ ...(form === "phone" &&
61
75
  closeButton &&
62
- onClose && { actions: { close: { label: messages({ key: "views.panels.close" }), onPress: onClose } } }) }));
76
+ onClose && { actions: { close: { label: messages({ key: "views.panels.close" }), onPress: onClose } } }),
77
+ ...(viewName !== undefined && { name: viewName }),
78
+ ...(onRenameView && { onRename: onRenameView }),
79
+ ...(onCopyLink && { onCopyLink }),
80
+ ...(onExport && { onExport }),
81
+ ...(exportCount !== undefined && { exportCount }),
82
+ };
83
+ }
84
+ export function AppCustomizeBody(props) {
85
+ const views = useViews();
86
+ const step = useContext(PanelStepHold);
87
+ const CustomizeBody = views.components.CustomizeBody;
88
+ if (!CustomizeBody)
89
+ return null;
90
+ return _jsx(CustomizeBody, { ...customizeBodyPropsOf(props, views), ...(props.form === "phone" && step && { onStepChange: step.onStepChange }) });
63
91
  }
@@ -11,7 +11,7 @@ export type ViewOptionsPanelContentProps<S extends string = string, G extends st
11
11
  * everyone and the header's "Clear all" steps aside: the footer owns reset. See `CollectionViewState`. */
12
12
  view?: CollectionViewState;
13
13
  /** The foot's words: `kit` for Clear and Save, `none` for no foot (they stand elsewhere, on a toolbar's bar);
14
- * absent, Reset and Set default for everyone. */
14
+ * absent, Reset and Save for everyone. */
15
15
  viewFoot?: "kit" | "none";
16
16
  /** With no shared view, the foot's Clear, taking the list back to its default; absent, no foot. */
17
17
  footClear?: () => void;
@@ -29,5 +29,12 @@ export type ViewOptionsPanelContentProps<S extends string = string, G extends st
29
29
  fill?: boolean;
30
30
  /** The list's field editor (Add field, Edit field), handed to the Columns list and a column's settings. */
31
31
  fieldEditor?: PanelFieldEditor | null;
32
+ /** What an app hands Customize through the toolbar, each drawn by a `CustomizeBody` only where handed: the view's name with
33
+ * its rename, Copy link, and Export CSV with its count. ViewKit's own Customize draws none of them. */
34
+ viewName?: string;
35
+ onRenameView?: (name: string) => void;
36
+ onCopyLink?: () => void;
37
+ onExport?: () => void;
38
+ exportCount?: string;
32
39
  };
33
40
  export declare function ViewOptionsPanelContent<S extends string = string, G extends string = string, T extends string = string>(props: ViewOptionsPanelContentProps<S, G, T>): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useCallback, useState } from "react";
3
+ import { useCallback, useContext, useState } from "react";
4
4
  import { isRelationFilter } from "../../filters/filter-model.js";
5
5
  import { cx } from "../../internal/cx.js";
6
6
  import { useViews } from "../../provider/context.js";
@@ -10,12 +10,12 @@ import { CompactTimeScopeDetail } from "../filter/TimeScopeDetail.js";
10
10
  import { customizePageOf, perFieldFiltersOnly } from "../customize-body.js";
11
11
  import { drawPanelButton } from "../panel-button.js";
12
12
  import { PANEL_LIST_CLASS } from "./chrome.js";
13
- import { AppCustomizeBody, AppGroupBody } from "./customize-body.js";
13
+ import { AppCustomizeBody, AppGroupBody, customizeBodyPropsOf } from "./customize-body.js";
14
14
  import { CompactLayoutDetail } from "./layout-detail.js";
15
15
  import { LayoutColumnsList } from "./LayoutColumnsList.js";
16
16
  import { PanelHeader } from "./panel-header.js";
17
17
  import { useSheetPanels } from "./panel-sheet.js";
18
- import { usePanelStep } from "./panel-step.js";
18
+ import { PanelStepHold, usePanelStep } from "./panel-step.js";
19
19
  import { CompactGroupByDetail, CompactGroupDateByDetail, CompactGroupDetail, CompactGroupSortDetail, CompactSortDetail, } from "./order-details.js";
20
20
  import { PopoverColumnDetail } from "./PopoverColumnDetail.js";
21
21
  import { PopoverRootList } from "./root-list.js";
@@ -25,7 +25,8 @@ export function ViewOptionsPanelContent(props) {
25
25
  const views = useViews();
26
26
  const { messages } = views;
27
27
  const sheet = useSheetPanels();
28
- const groupStep = usePanelStep();
28
+ const ownStep = usePanelStep();
29
+ const groupStep = useContext(PanelStepHold) ?? ownStep;
29
30
  const [backHandler, setBackHandlerRaw] = useState(null);
30
31
  const setBackHandler = useCallback((fn) => {
31
32
  setBackHandlerRaw(fn ? { fn } : null);
@@ -100,8 +101,10 @@ export function ViewOptionsPanelContent(props) {
100
101
  : activePanel?.type === "column"
101
102
  ? `column-${activePanel.key}`
102
103
  : (activePanel?.type ?? "root");
103
- if (views.components.CustomizeBody && !perFieldFiltersOnly(props))
104
- return _jsx(AppCustomizeBody, { ...props, form: sheet ? "phone" : "computer" });
104
+ const appBody = views.components.CustomizeBody;
105
+ const bodyProps = props;
106
+ if (appBody && !perFieldFiltersOnly(props) && !appBody.stepsAside?.(customizeBodyPropsOf({ ...bodyProps, form: sheet ? "phone" : "computer" }, views)))
107
+ return _jsx(AppCustomizeBody, { ...bodyProps, form: sheet ? "phone" : "computer" });
105
108
  return (_jsxs("div", { className: cx("flex flex-col", fill && "h-full min-h-0"), children: [_jsx(PanelHeader, { title: activePanel ? (groupStep.title ?? panelTitle) : messages({ key: "views.panels.customize-title" }), onBack: activePanel ? (groupStep.back ?? onBackClick) : undefined, onClose: closeButton ? onClose : undefined, trailing: !activePanel &&
106
109
  !view &&
107
110
  anyActive && (drawPanelButton(views, {
@@ -6,7 +6,7 @@ import { DisabledReason } from "../../../atoms/DisabledReason.js";
6
6
  import { canExcludeAt, canGroupAt, groupAt, nodeAt, putBackAt, setExcludedAt, setJoinAt, } from "../../../filters/filter-tree.js";
7
7
  import { cx } from "../../../internal/cx.js";
8
8
  import { useViews } from "../../../provider/context.js";
9
- import { filterWaysOf, setAsideFits, takesValue } from "../../settings/filter-groups.js";
9
+ import { filterWaysOf, listedFieldsOf, setAsideFits, takesValue } from "../../settings/filter-groups.js";
10
10
  import { asideFilterWords, ruleValueWords } from "../../toolbar/filter-words.js";
11
11
  import { abs, fieldOfRule, keyOf, relationOf, samePath, useEditorCtx, } from "./editor-ctx.js";
12
12
  import { addPicked, addState, everyBlocked, pickField, pickQuantifier, pickWay, writeRule, } from "./rule-writes.js";
@@ -225,7 +225,7 @@ function RuleRow({ ctx, rule, rel, relation, inPending, }) {
225
225
  turn();
226
226
  else
227
227
  setOpens(opens === "field" ? null : "field");
228
- }, children: [_jsx("span", { className: "truncate", children: asideName }), _jsx(Down, { className: "h-3.5 w-3.5 shrink-0" })] }), _jsx("span", { id: whyNote, hidden: true, children: words.why })] }) }), ctx.form === "computer" && !orphan && (_jsx(Popover, { open: opens === "field", onOpenChange: (next) => setOpens(next ? "field" : null), anchor: fieldBox, align: "start", sideOffset: 4, chrome: "menu", children: _jsx(FilterFieldList, { fields: relation?.far ?? ctx.filterTree.fields, relations: false, onPick: (picked) => {
228
+ }, children: [_jsx("span", { className: "truncate", children: asideName }), _jsx(Down, { className: "h-3.5 w-3.5 shrink-0" })] }), _jsx("span", { id: whyNote, hidden: true, children: words.why })] }) }), ctx.form === "computer" && !orphan && (_jsx(Popover, { open: opens === "field", onOpenChange: (next) => setOpens(next ? "field" : null), anchor: fieldBox, align: "start", sideOffset: 4, chrome: "menu", children: _jsx(FilterFieldList, { fields: relation?.far ?? listedFieldsOf(ctx.filterTree), relations: false, onPick: (picked) => {
229
229
  setOpens(null);
230
230
  pickField(ctx, ruleAtHere, rule, undefined, picked);
231
231
  }, onDone: () => setOpens(null) }) })), _jsx(DisabledReason, { reason: words.why, className: "inline-flex min-w-0", children: _jsx(Button, { variant: "outline", size: size, ...OFF_BOX, className: cx("min-w-0 justify-start", OFF_LOOK), children: _jsx("span", { className: "truncate", children: words.way }) }) }), words.value !== null && (_jsx(DisabledReason, { reason: words.why, className: "inline-flex min-w-0", children: _jsx(Button, { variant: "outline", size: size, ...OFF_BOX, className: cx("min-w-0 justify-start", OFF_LOOK), children: _jsx("span", { className: "truncate", children: words.value }) }) }))] }), _jsx(RuleMenu, { ctx: ctx, rel: rel, name: asideName, anchor: moreBox, open: opens === "more", setOpen: (o) => setOpens(o ? "more" : null), grouping: false, why: words.why, putBack: fits && rel
@@ -241,7 +241,7 @@ function RuleRow({ ctx, rule, rel, relation, inPending, }) {
241
241
  const ways = filterWaysOf(field, conventions);
242
242
  const wayWords = ways.find((way) => way.value === rule.operator)?.label ?? rule.operator;
243
243
  const box = (open) => ({ "aria-expanded": open, className: "min-w-0 justify-between" });
244
- const fields = relation?.far ?? ctx.filterTree.fields;
244
+ const fields = relation?.far ?? listedFieldsOf(ctx.filterTree);
245
245
  const grouping = !!rel && canGroupAt(ctx.view, abs(ctx.base, rel));
246
246
  if (ctx.form === "phone") {
247
247
  const turn = (to) => ctx.openPage?.({
@@ -320,7 +320,7 @@ function AddFilter({ ctx, rel, relation, onAdded, }) {
320
320
  const anchor = useRef(null);
321
321
  const [open, setOpen] = useState(false);
322
322
  const { full: tooMany, relations, gone } = addState(ctx, rel, relation);
323
- const fields = relation?.far ?? ctx.filterTree.fields;
323
+ const fields = relation?.far ?? listedFieldsOf(ctx.filterTree);
324
324
  const full = tooMany || gone;
325
325
  const reason = gone
326
326
  ? messages({ key: "views.panels.filter-relation-gone" })
@@ -24,6 +24,7 @@ export function FilterFieldList({ fields, own, relations = true, onPick, onDone,
24
24
  label: field.label,
25
25
  ...(field.mark ? { type: field.mark.type, glyph: markGlyph(glyphs, field.mark) } : {}),
26
26
  ...(field.part !== undefined ? { part: field.part } : {}),
27
+ ...(field.disabled !== undefined ? { disabled: field.disabled } : {}),
27
28
  });
28
29
  return (_jsx(FieldsBody, { purpose: "filter", label: messages({ key: "views.panels.filter" }), search: messages({ key: "views.panels.filter-search" }), fields: [
29
30
  ...listOwn.map(asData),
@@ -31,7 +32,7 @@ export function FilterFieldList({ fields, own, relations = true, onPick, onDone,
31
32
  ], ...(own !== undefined ? { own } : {}), form: form, onPick: (key, farKey) => {
32
33
  if (farKey === undefined) {
33
34
  const picked = listOwn.find((field) => field.key === key);
34
- if (picked)
35
+ if (picked && picked.disabled === undefined)
35
36
  onPick(picked);
36
37
  return;
37
38
  }
@@ -50,7 +51,14 @@ export function FilterFieldList({ fields, own, relations = true, onPick, onDone,
50
51
  return (_jsxs("div", { "data-slot": "vk-filter-fields", "data-vs-detail": true, className: cx("max-h-72", PANEL_LIST_CLASS), children: [opened && (_jsx(PanelHeader, { title: opened.label, onBack: () => {
51
52
  setOpened(null);
52
53
  setQuery("");
53
- } })), searchable && (_jsx("div", { "data-vs-inset": true, className: FIELD_PADDING, children: _jsx(PanelSearch, { value: query, onChange: setQuery, placeholder: messages({ key: "views.panels.filter-search" }), autoFocus: true }) })), shown.filter(matches).map((field) => (_jsx(RadioRow, { mark: "box", selected: !opened && field.key === own, label: field.label, onClick: () => (opened ? onPick(opened, field) : onPick(field)) }, field.key))), related.filter(matches).length > 0 && (_jsxs(_Fragment, { children: [_jsx(FilterSectionHeading, { children: messages({ key: "views.panels.related-records" }) }), related.filter(matches).map((relation) => (_jsx(MenuRow, { icon: _jsx(Relation, { className: "h-3.5 w-3.5" }), label: relation.label, value: "", active: false, onClick: () => {
54
+ } })), searchable && (_jsx("div", { "data-vs-inset": true, className: FIELD_PADDING, children: _jsx(PanelSearch, { value: query, onChange: setQuery, placeholder: messages({ key: "views.panels.filter-search" }), autoFocus: true }) })), shown.filter(matches).map((field) => (_jsx(RadioRow, { mark: "box", selected: !opened && field.key === own, label: field.label, ...(field.disabled !== undefined ? { disabled: true, disabledReason: field.disabled } : {}), onClick: () => {
55
+ if (field.disabled !== undefined)
56
+ return;
57
+ if (opened)
58
+ onPick(opened, field);
59
+ else
60
+ onPick(field);
61
+ } }, field.key))), related.filter(matches).length > 0 && (_jsxs(_Fragment, { children: [_jsx(FilterSectionHeading, { children: messages({ key: "views.panels.related-records" }) }), related.filter(matches).map((relation) => (_jsx(MenuRow, { icon: _jsx(Relation, { className: "h-3.5 w-3.5" }), label: relation.label, value: "", active: false, onClick: () => {
54
62
  setOpened(relation);
55
63
  setQuery("");
56
64
  } }, relation.key)))] }))] }));
@@ -4,7 +4,7 @@ import { useLayoutEffect, useRef, useState } from "react";
4
4
  import { DisabledReason } from "../../../atoms/DisabledReason.js";
5
5
  import { useViews } from "../../../provider/context.js";
6
6
  import { itemsAt, shownRuleCount } from "../../../filters/filter-tree.js";
7
- import { filterWaysOf, takesValue } from "../../settings/filter-groups.js";
7
+ import { filterWaysOf, listedFieldsOf, takesValue } from "../../settings/filter-groups.js";
8
8
  import { PanelHeader } from "../panel-header.js";
9
9
  import { fieldOfRule, relationOf, useEditorCtx, } from "./editor-ctx.js";
10
10
  import { AppFilterBody } from "./filter-body.js";
@@ -93,7 +93,7 @@ function Turned({ ctx, page, setPage, back, }) {
93
93
  if (page.to === "add") {
94
94
  const relation = relationOf(ctx, page.relation);
95
95
  const { relations } = addState(ctx, page.rel, relation);
96
- return (_jsxs(_Fragment, { children: [_jsx(PanelHeader, { title: messages({ key: "views.panels.filter-add" }), onBack: back }), _jsx("div", { className: scroll, children: _jsx(FilterFieldList, { fields: relation?.far ?? ctx.filterTree.fields, relations: relations, form: "phone", onPick: (picked, far) => {
96
+ return (_jsxs(_Fragment, { children: [_jsx(PanelHeader, { title: messages({ key: "views.panels.filter-add" }), onBack: back }), _jsx("div", { className: scroll, children: _jsx(FilterFieldList, { fields: relation?.far ?? listedFieldsOf(ctx.filterTree), relations: relations, form: "phone", onPick: (picked, far) => {
97
97
  const added = addPicked(ctx, page.rel, picked, far, relation);
98
98
  setPage(added ? { to: "value", rule: added } : { to: "rules" });
99
99
  }, onDone: back }) })] }));
@@ -130,7 +130,7 @@ function Turned({ ctx, page, setPage, back, }) {
130
130
  return null;
131
131
  const { rule, at } = found;
132
132
  if (page.to === "field")
133
- return (_jsxs(_Fragment, { children: [_jsx(PanelHeader, { title: messages({ key: "views.panels.filter-field" }), onBack: back }), _jsx("div", { className: scroll, children: _jsx(FilterFieldList, { fields: at.relation?.far ?? ctx.filterTree.fields, own: field?.key, relations: false, form: "phone", onPick: (picked) => {
133
+ return (_jsxs(_Fragment, { children: [_jsx(PanelHeader, { title: messages({ key: "views.panels.filter-field" }), onBack: back }), _jsx("div", { className: scroll, children: _jsx(FilterFieldList, { fields: at.relation?.far ?? listedFieldsOf(ctx.filterTree), own: field?.key, relations: false, form: "phone", onPick: (picked) => {
134
134
  pickField(ctx, at, rule, field, picked);
135
135
  back();
136
136
  }, onDone: back }) })] }));
@@ -4,7 +4,7 @@ import { useMemo } from "react";
4
4
  import { FILTER_TREE_MAX_UI_DEPTH, isRelationRule, } from "viewkitjs/fields/query";
5
5
  import { nodeAt, replaceAt, shownRuleCount } from "../../../filters/filter-tree.js";
6
6
  import { useViews } from "../../../provider/context.js";
7
- import { filterBodyChangeFits, takesValue } from "../../settings/filter-groups.js";
7
+ import { filterBodyChangeFits, listedFieldsOf, takesValue } from "../../settings/filter-groups.js";
8
8
  import { asideFilterWords, barFilterWords } from "../../toolbar/filter-words.js";
9
9
  import { relationOf } from "./editor-ctx.js";
10
10
  import { FilterValueBody } from "./FilterValueBody.js";
@@ -27,6 +27,8 @@ export function filterBodyFields(fields, optionsOf, relation) {
27
27
  return fields.map(({ mark: _mark, far, ...field }) => {
28
28
  if (far)
29
29
  return { ...field, far: filterBodyFields(far, optionsOf, field.fieldKey) };
30
+ if (field.disabled !== undefined)
31
+ return field;
30
32
  const options = optionsOf?.(field.fieldKey, field.part, relation);
31
33
  return options ? { ...field, options } : field;
32
34
  });
@@ -34,7 +36,8 @@ export function filterBodyFields(fields, optionsOf, relation) {
34
36
  export function AppFilterBody({ ctx, level, relation, excludable, label, onDone, actions, onStepChange, }) {
35
37
  const { components, conventions, messages } = useViews();
36
38
  const FilterBody = components.FilterBody;
37
- const fields = useMemo(() => filterBodyFields(ctx.filterTree.fields, ctx.filterTree.optionsOf), [ctx.filterTree.fields, ctx.filterTree.optionsOf]);
39
+ const { listed, fields: named, optionsOf } = ctx.filterTree;
40
+ const fields = useMemo(() => filterBodyFields(listedFieldsOf({ listed, fields: named }), optionsOf), [listed, named, optionsOf]);
38
41
  if (!FilterBody)
39
42
  return null;
40
43
  const far = relation ? relationOf(ctx, relation.fieldKey) : undefined;
@@ -10,3 +10,6 @@ export type PanelStep = {
10
10
  escapeBack: () => boolean;
11
11
  };
12
12
  export declare function usePanelStep(): PanelStep;
13
+ /** The step a toolbar panel's sheet holds (`ToolbarOptions`), handed to what stands in it so a body's level of its own is told
14
+ * there and the sheet's Escape goes back a level; null where nothing holds one, and the panel holds its own. */
15
+ export declare const PanelStepHold: import("react").Context<PanelStep | null>;
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { useCallback, useMemo, useRef, useState } from "react";
2
+ import { createContext, useCallback, useMemo, useRef, useState } from "react";
3
3
  export function usePanelStep() {
4
4
  const [step, setStep] = useState(null);
5
5
  const held = useRef(null);
@@ -24,3 +24,4 @@ export function usePanelStep() {
24
24
  }, []);
25
25
  return useMemo(() => ({ onStepChange, title: step?.title, back: step ? goBack : undefined, escapeBack }), [onStepChange, step, goBack, escapeBack]);
26
26
  }
27
+ export const PanelStepHold = createContext(null);
@@ -24,6 +24,7 @@ export function QuickFiltersPanel({ quickFilters, form, onDone, closeButton = tr
24
24
  key: field.key,
25
25
  label: field.label,
26
26
  searchPlaceholder: searchWords(field, messages),
27
+ ...(field.options ? { options: field.options } : {}),
27
28
  values: quickValuesShown(field, quickFilters.hold, showCounts, emptyLabel, quickFilters.heldLabels?.[field.key]?.values),
28
29
  })), hold: quickFilters.hold, several: several, showCounts: showCounts, form: form, onHoldChange: (next) => {
29
30
  if (quickHoldFits(quickFilters, next))
@@ -61,10 +61,20 @@ export type ReadyToolbarProps<Row> = SettingsPanelsInput<Row> & {
61
61
  * filters": on the row's right, Sort and Filter adding from the fields and the bar holding what is set (Mihai's look,
62
62
  * the default), or on the bar, the bar's own empty Sort and Filter adding. */
63
63
  sortFilter?: "right" | "bar";
64
- /** When the kit arrangement's filter bar shows on a computer: once something is set (a sort, a filter, a rule held
65
- * until whole, a change to save, a bar part open: the default), or always. Means nothing while `sortFilter` is
66
- * "bar", which always shows it. */
64
+ /** When the kit arrangement's filter bar shows on a computer: while a filter stands or is held until whole, or a second
65
+ * axis of views stands there (the default: the bar is the filters' line, and a sort, a change to save or a panel open
66
+ * never bring it), or always.
67
+ * Means nothing while `sortFilter` is "bar", which always shows it. */
67
68
  bar?: "added" | "always";
69
+ /** The view's name, drawn in Customize's head (where its head is the view's name) and renamed in place where
70
+ * `onRenameView` is handed too. */
71
+ viewName?: string;
72
+ onRenameView?: (name: string) => void;
73
+ /** Copy link to view, in Customize's foot, where handed. */
74
+ onCopyLink?: () => void;
75
+ /** Export CSV, in Customize's foot, where handed, with what it takes in words (`exportCount`, "12 deals"). */
76
+ onExport?: () => void;
77
+ exportCount?: string;
68
78
  className?: string;
69
79
  };
70
80
  export declare function ReadyToolbar<Row>(props: ReadyToolbarProps<Row>): ReactNode;
@@ -27,7 +27,14 @@ import { ToolbarSortPill } from "./ToolbarSortPill.js";
27
27
  import { ToolbarAdvancedFilters } from "./ToolbarAdvancedFilters.js";
28
28
  import { ToolbarViews } from "./ToolbarViews.js";
29
29
  export function ReadyToolbar(props) {
30
- const { settings, onChange, views, viewsLayout, onAdd, addItems, addLabel, view, fieldEditor, searchPlaceholder, searching, hosts, narrow, className, } = props;
30
+ const { settings, onChange, views, viewsLayout, onAdd, addItems, addLabel, view, fieldEditor, searchPlaceholder, searching, hosts, narrow, className, viewName, onRenameView, onCopyLink, onExport, exportCount, } = props;
31
+ const customizeOwn = {
32
+ ...(viewName !== undefined && { viewName }),
33
+ ...(onRenameView && { onRenameView }),
34
+ ...(onCopyLink && { onCopyLink }),
35
+ ...(onExport && { onExport }),
36
+ ...(exportCount !== undefined && { exportCount }),
37
+ };
31
38
  const { icons, messages, conventions } = useViews();
32
39
  const desktop = useDesktop();
33
40
  const phone = props.phone ?? !desktop;
@@ -157,7 +164,7 @@ export function ReadyToolbar(props) {
157
164
  icon: _jsx(Edit, { className: "h-4 w-4" }),
158
165
  onSelect: () => options.onOpenChange(true),
159
166
  },
160
- node: (_jsx(ToolbarOptions, { ...inputs, view: view, viewFoot: footHere ? "kit" : "none", footClear: footHere && clearable ? clear("options") : undefined, fieldEditor: fieldEditor, onClear: view ? view.onReset : clear("options"), open: options.open, onOpenChange: options.onOpenChange, page: options.page, onPageChange: options.onPageChange, host: hosts?.options })),
167
+ node: (_jsx(ToolbarOptions, { ...inputs, view: view, viewFoot: !footHere ? "none" : view ? undefined : "kit", footClear: footHere && clearable ? clear("options") : undefined, fieldEditor: fieldEditor, onClear: view ? view.onReset : clear("options"), open: options.open, onOpenChange: options.onOpenChange, page: options.page, onPageChange: options.onPageChange, host: hosts?.options, ...customizeOwn })),
161
168
  },
162
169
  ...(quickNode
163
170
  ? [
@@ -314,7 +321,7 @@ export function ReadyToolbar(props) {
314
321
  {
315
322
  key: "options",
316
323
  side: "end",
317
- node: (_jsx(ToolbarOptions, { ...inputs, view: view, fieldEditor: fieldEditor, onClear: view ? view.onReset : clear("options"), open: options.open, onOpenChange: options.onOpenChange, page: options.page, onPageChange: options.onPageChange, host: hosts?.options })),
324
+ node: (_jsx(ToolbarOptions, { ...inputs, view: view, fieldEditor: fieldEditor, onClear: view ? view.onReset : clear("options"), open: options.open, onOpenChange: options.onOpenChange, page: options.page, onPageChange: options.onPageChange, host: hosts?.options, ...customizeOwn })),
318
325
  },
319
326
  { key: "new", side: "end", node: _jsx(ToolbarNew, { onAdd: onAdd, items: addItems, label: addLabel }) },
320
327
  ];
@@ -22,7 +22,7 @@ export function Toolbar({ parts, phone, narrow, narrowBelow = TOOLBAR_NARROW_BEL
22
22
  const nodes = new Map(parts.map((part) => [part.key, part.node]));
23
23
  if (fold) {
24
24
  const menus = new Map(parts.flatMap((part) => (part.menu ? [[part.key, part.menu]] : [])));
25
- return (_jsx(ToolbarRadioContext.Provider, { value: radio, children: _jsx("div", { ref: box, "data-slot": "vk-toolbar", "data-form": form, "data-fold": "", className: cx("flex w-full flex-col", className), children: lines.map((line) => (_jsx(FoldLine, { line: line, form: form, nodes: nodes, menus: menus, search: { open: searchOpen, onOpenChange: setSearchOpen } }, line.kind))) }) }));
25
+ return (_jsx(ToolbarRadioContext.Provider, { value: radio, children: _jsx("div", { ref: box, "data-slot": "vk-toolbar", "data-form": form, "data-fold": "", className: cx("@container flex w-full flex-col", className), children: lines.map((line) => (_jsx(FoldLine, { line: line, form: form, nodes: nodes, menus: menus, search: { open: searchOpen, onOpenChange: setSearchOpen } }, line.kind))) }) }));
26
26
  }
27
27
  return (_jsx(ToolbarRadioContext.Provider, { value: radio, children: _jsx("div", { ref: box, "data-slot": "vk-toolbar", "data-form": form, className: cx("flex w-full flex-col", form === "row" ? "gap-1" : "gap-2", className), children: lines.map((line) => (_jsx(Line, { line: line, form: form, nodes: nodes }, line.kind))) }) }));
28
28
  }
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useRef } from "react";
4
4
  import { putBackAt } from "../../../filters/filter-tree.js";
5
5
  import { useViews } from "../../../provider/context.js";
6
- import { setAsideFits } from "../../settings/filter-groups.js";
6
+ import { listedFieldsOf, setAsideFits } from "../../settings/filter-groups.js";
7
7
  import { asideFilterWords } from "../../toolbar/filter-words.js";
8
8
  import { FilterFieldList } from "../filter/FilterFieldList.js";
9
9
  import { repointBarFilter } from "./bar-writes.js";
@@ -45,7 +45,7 @@ export function ToolbarAsideFilter({ ctx, path, node, open, onOpenChange, folded
45
45
  if (details?.reason !== "outside-press" && details?.reason !== "focus-out")
46
46
  anchorOf(part).current?.focus({ preventScroll: true });
47
47
  };
48
- return (_jsxs("span", { ref: placeBox, "data-slot": "vk-toolbar-filter-aside", "data-aside": "", role: "group", "aria-label": words.sentence, "data-open": open ? "" : undefined, hidden: foldedAt ? true : undefined, className: "relative inline-flex min-w-0 shrink-0 items-center", children: [_jsx(Tooltip, { content: words.why, side: "bottom", children: _jsx("span", { className: "inline-flex min-w-0", children: _jsx(ToolbarButton, { ref: fieldBox, icon: null, label: messages({ key: "views.panels.filter-field" }), joined: "start", aside: true, popup: "dialog", open: open === "field", ...press("field"), children: words.field }) }) }), _jsx(Popover, { open: open === "field", onOpenChange: closed("field"), anchor: anchorOf("field"), align: "start", sideOffset: 8, chrome: "menu", children: _jsx(FilterFieldList, { fields: ctx.filterTree.fields, relations: true, onPick: (picked, far) => {
48
+ return (_jsxs("span", { ref: placeBox, "data-slot": "vk-toolbar-filter-aside", "data-aside": "", role: "group", "aria-label": words.sentence, "data-open": open ? "" : undefined, hidden: foldedAt ? true : undefined, className: "relative inline-flex min-w-0 shrink-0 items-center", children: [_jsx(Tooltip, { content: words.why, side: "bottom", children: _jsx("span", { className: "inline-flex min-w-0", children: _jsx(ToolbarButton, { ref: fieldBox, icon: null, label: messages({ key: "views.panels.filter-field" }), joined: "start", aside: true, popup: "dialog", open: open === "field", ...press("field"), children: words.field }) }) }), _jsx(Popover, { open: open === "field", onOpenChange: closed("field"), anchor: anchorOf("field"), align: "start", sideOffset: 8, chrome: "menu", children: _jsx(FilterFieldList, { fields: listedFieldsOf(ctx.filterTree), relations: true, onPick: (picked, far) => {
49
49
  onOpenChange(null);
50
50
  const result = repointBarFilter(ctx, path, node, picked, far);
51
51
  if (result)
@@ -1,9 +1,10 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useRef } from "react";
3
+ import { useEffect, useRef } from "react";
4
4
  import { canGroupAt, nodeAt } from "../../../filters/filter-tree.js";
5
5
  import { useViews } from "../../../provider/context.js";
6
- import { filterWaysOf, takesValue, withOperator } from "../../settings/filter-groups.js";
6
+ import { drawsUnnamedValue } from "../../labels.js";
7
+ import { filterWaysOf, listedFieldsOf, takesValue, withOperator } from "../../settings/filter-groups.js";
7
8
  import { barFilterWords } from "../../toolbar/filter-words.js";
8
9
  import { fieldOfRule } from "../filter/editor-ctx.js";
9
10
  import { FilterFieldList } from "../filter/FilterFieldList.js";
@@ -47,6 +48,15 @@ export function ToolbarBarFilter({ ctx, at, rule, open, onOpenChange, foldedAt,
47
48
  const config = takesValue(rule.operator)
48
49
  ? ctx.filterTree.valueOf(rule, write, relation?.fieldKey)
49
50
  : null;
51
+ const asked = useRef(new Set());
52
+ const ask = config && drawsUnnamedValue(config) && "onOpen" in config ? config.onOpen : undefined;
53
+ const askKey = config?.key;
54
+ useEffect(() => {
55
+ if (!ask || askKey === undefined || asked.current.has(askKey))
56
+ return;
57
+ asked.current.add(askKey);
58
+ ask();
59
+ });
50
60
  const ways = field ? filterWaysOf(field, conventions) : [];
51
61
  const actions = messages({ key: "views.panels.filter-rule-actions", values: { label: words.field } });
52
62
  const More = icons.more;
@@ -73,7 +83,7 @@ export function ToolbarBarFilter({ ctx, at, rule, open, onOpenChange, foldedAt,
73
83
  onOpenChange(null);
74
84
  anchorOf(part).current?.focus({ preventScroll: true });
75
85
  };
76
- return (_jsxs("span", { ref: placeBox, "data-slot": "vk-toolbar-filter-rule", role: "group", "aria-label": words.sentence, "data-open": open ? "" : undefined, hidden: foldedAt ? true : undefined, className: "relative inline-flex min-w-0 shrink-0 items-center", children: [_jsx(ToolbarButton, { ref: fieldBox, icon: null, label: messages({ key: "views.panels.filter-field" }), joined: "start", popup: "dialog", open: open === "field", ...press("field"), children: words.field }), _jsx(Popover, { open: open === "field", onOpenChange: closed("field"), anchor: anchorOf("field"), align: "start", sideOffset: 8, chrome: "menu", children: _jsx(FilterFieldList, { fields: ctx.filterTree.fields, own: field?.key, relations: true, onPick: (picked, far) => {
86
+ return (_jsxs("span", { ref: placeBox, "data-slot": "vk-toolbar-filter-rule", role: "group", "aria-label": words.sentence, "data-open": open ? "" : undefined, hidden: foldedAt ? true : undefined, className: "relative inline-flex min-w-0 shrink-0 items-center", children: [_jsx(ToolbarButton, { ref: fieldBox, icon: null, label: messages({ key: "views.panels.filter-field" }), joined: "start", popup: "dialog", open: open === "field", ...press("field"), children: words.field }), _jsx(Popover, { open: open === "field", onOpenChange: closed("field"), anchor: anchorOf("field"), align: "start", sideOffset: 8, chrome: "menu", children: _jsx(FilterFieldList, { fields: listedFieldsOf(ctx.filterTree), own: field?.key, relations: true, onPick: (picked, far) => {
77
87
  done("field");
78
88
  pickBarField(ctx, at, rule, picked, far);
79
89
  }, onDone: () => done("field") }) }), _jsx(ToolbarButton, { ref: wayBox, icon: null, label: messages({ key: "views.panels.filter-way" }), joined: "middle", popup: partBody ? "dialog" : "menu", open: open === "way", ...press("way"), children: words.way }), partBody && field ? (_jsx(Popover, { open: open === "way", onOpenChange: closed("way"), anchor: anchorOf("way"), align: "start", sideOffset: 8, chrome: "menu", children: _jsx(AppFilterPart, { part: "way", rule: rule, field: field, options: ctx.filterTree.optionsOf?.(rule.fieldKey, rule.part, relation?.fieldKey), own: null, form: "computer", onWay: (operator) => {