viewkitjs 0.37.0 → 0.39.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.
- package/CHANGELOG.md +95 -0
- package/MIGRATION.md +7 -0
- package/fields/dist/query/figure-kinds.d.ts +2 -2
- package/fields/dist/query/figure-kinds.js +3 -0
- package/fields/dist/query/figures.d.ts +5 -3
- package/fields/dist/query/figures.js +13 -0
- package/fields/docs/reference/query.md +3 -3
- package/package.json +1 -1
- package/postgres/docs/guides/field-map.md +1 -1
- package/views/dist/atoms/HeaderChrome.d.ts +7 -0
- package/views/dist/atoms/HeaderChrome.js +15 -0
- package/views/dist/atoms/ToolbarButton.d.ts +1 -1
- package/views/dist/atoms/ToolbarButton.js +2 -2
- package/views/dist/atoms/defaults.js +4 -0
- package/views/dist/atoms/types.d.ts +39 -2
- package/views/dist/contract.d.ts +25 -11
- package/views/dist/contract.js +41 -6
- package/views/dist/controls/field/looks.d.ts +1 -1
- package/views/dist/controls/field/looks.js +9 -3
- package/views/dist/controls/field/tokens.d.ts +4 -0
- package/views/dist/controls/field/tokens.js +1 -0
- package/views/dist/controls/field.css +93 -1
- package/views/dist/controls/filter-editor/block.d.ts +3 -1
- package/views/dist/controls/filter-editor/block.js +4 -3
- package/views/dist/controls/filter-editor/filter-editor.d.ts +13 -2
- package/views/dist/controls/filter-editor/filter-editor.js +45 -15
- package/views/dist/controls/filter-editor/how.d.ts +3 -1
- package/views/dist/controls/filter-editor/map-filter-body.js +5 -4
- package/views/dist/controls/filter-editor/map-rules.d.ts +2 -1
- package/views/dist/controls/filter-editor/map-rules.js +3 -3
- package/views/dist/controls/glyphs/glyphs.js +2 -0
- package/views/dist/controls/inline-input.css +3 -2
- package/views/dist/controls/internal/menu-items.d.ts +2 -0
- package/views/dist/controls/internal/menu-items.js +1 -1
- package/views/dist/controls/internal/part-slot.d.ts +1 -1
- package/views/dist/controls/internal/part-slot.js +1 -1
- package/views/dist/controls/internal/read-token.d.ts +2 -1
- package/views/dist/controls/internal/read-token.js +2 -1
- package/views/dist/controls/internal/row-actions.d.ts +33 -0
- package/views/dist/controls/internal/row-actions.js +28 -0
- package/views/dist/controls/menu/map-menu.js +1 -1
- package/views/dist/controls/number-editor/tokens.d.ts +8 -0
- package/views/dist/controls/number-editor/tokens.js +2 -0
- package/views/dist/controls/number-editor.css +20 -0
- package/views/dist/controls/popover/map-popover.d.ts +1 -1
- package/views/dist/controls/popover/map-popover.js +2 -2
- package/views/dist/controls/sheet/map-sheet.js +9 -6
- package/views/dist/controls/sort-editor/map-sort-body.js +1 -0
- package/views/dist/controls/sort-editor/sort-editor.d.ts +5 -1
- package/views/dist/controls/sort-editor/sort-editor.js +41 -13
- package/views/dist/controls/text-editor/tokens.d.ts +8 -0
- package/views/dist/controls/text-editor/tokens.js +2 -0
- package/views/dist/controls/text-editor.css +44 -2
- package/views/dist/controls/toolbar-button/atom-toolbar-button.d.ts +1 -1
- package/views/dist/controls/toolbar-button/atom-toolbar-button.js +2 -2
- package/views/dist/controls/tooltip/tooltip.js +2 -1
- package/views/dist/editors/EditorPanel.js +1 -1
- package/views/dist/field-row/FieldRow.js +46 -15
- package/views/dist/field-row/editors/RowChipsEditor.js +3 -1
- package/views/dist/field-row/editors/RowDateEditor.js +3 -1
- package/views/dist/field-row/editors/RowNameEditor.js +3 -1
- package/views/dist/field-row/editors/RowPlaceEditor.js +4 -2
- package/views/dist/field-row/editors/RowRangeEditor.js +3 -1
- package/views/dist/field-row/editors/RowRelationEditor.js +5 -2
- package/views/dist/field-row/editors/RowSelectEditor.js +3 -1
- package/views/dist/field-row/editors/RowTextEditor.d.ts +7 -1
- package/views/dist/field-row/editors/RowTextEditor.js +25 -4
- package/views/dist/field-row/editors/RowValueListEditor.js +4 -4
- package/views/dist/field-row/editors/row-place.d.ts +33 -0
- package/views/dist/field-row/editors/row-place.js +141 -0
- package/views/dist/field-row/field-row-button.d.ts +21 -6
- package/views/dist/field-row/field-row-button.js +8 -3
- package/views/dist/field-row/row-target.d.ts +4 -1
- package/views/dist/field-row/row-target.js +1 -1
- package/views/dist/fields/binding.d.ts +4 -0
- package/views/dist/grid/chrome/GridAggregateMenu.d.ts +12 -11
- package/views/dist/grid/chrome/GridAggregateMenu.js +4 -3
- package/views/dist/grid/chrome/GridCellEditors.d.ts +1 -1
- package/views/dist/grid/chrome/GridCellOutline.d.ts +13 -1
- package/views/dist/grid/chrome/GridCellOutline.js +17 -0
- package/views/dist/grid/chrome/GridFooter.d.ts +12 -4
- package/views/dist/grid/chrome/GridFooter.js +11 -9
- package/views/dist/grid/chrome/GridHeader.js +4 -3
- package/views/dist/grid/chrome/GridNumberEditor.js +2 -1
- package/views/dist/grid/chrome/GridResizeHandle.d.ts +7 -3
- package/views/dist/grid/chrome/GridResizeHandle.js +2 -3
- package/views/dist/grid/chrome/GridRowCells.js +1 -1
- package/views/dist/grid/chrome/GridStructure.js +3 -3
- package/views/dist/grid/chrome/GridTable.js +1 -1
- package/views/dist/grid/chrome/GridTableSurface.js +1 -1
- package/views/dist/grid/chrome/GridTextEditor.js +3 -1
- package/views/dist/grid/chrome/grid-body-place.d.ts +2 -4
- package/views/dist/grid/chrome/grid-body-place.js +4 -4
- package/views/dist/grid/chrome/grid-edit-session.d.ts +7 -3
- package/views/dist/grid/chrome/grid-edit-session.js +12 -3
- package/views/dist/grid/chrome/grid-editor-layer.d.ts +5 -4
- package/views/dist/grid/chrome/grid-figure-value.js +10 -4
- package/views/dist/grid/chrome/grid-row-props.d.ts +1 -1
- package/views/dist/grid/chrome/grid-table-props.d.ts +11 -3
- package/views/dist/grid/chrome/useGridKeyboard.d.ts +5 -1
- package/views/dist/grid/chrome/useGridKeyboard.js +9 -5
- package/views/dist/grid/chrome/useGridTableInteractionModel.d.ts +1 -1
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +8 -3
- package/views/dist/grid/grid.css +7 -3
- package/views/dist/internal/length.d.ts +2 -0
- package/views/dist/internal/length.js +16 -0
- package/views/dist/internal/over-cell.d.ts +8 -0
- package/views/dist/internal/over-cell.js +5 -0
- package/views/dist/list/bar-keys.d.ts +5 -0
- package/views/dist/list/bar-keys.js +2 -0
- package/views/dist/list/bar-parts.d.ts +27 -0
- package/views/dist/list/bar-parts.js +38 -0
- package/views/dist/list/buttons/clear-save.d.ts +7 -0
- package/views/dist/list/buttons/clear-save.js +15 -0
- package/views/dist/list/buttons/customize.d.ts +28 -0
- package/views/dist/list/buttons/customize.js +31 -0
- package/views/dist/list/buttons/filter.d.ts +32 -0
- package/views/dist/list/buttons/filter.js +60 -0
- package/views/dist/list/buttons/new.d.ts +18 -0
- package/views/dist/list/buttons/new.js +9 -0
- package/views/dist/list/buttons/quick.d.ts +15 -0
- package/views/dist/list/buttons/quick.js +24 -0
- package/views/dist/list/buttons/search.d.ts +18 -0
- package/views/dist/list/buttons/search.js +17 -0
- package/views/dist/list/buttons/shared.d.ts +91 -0
- package/views/dist/list/buttons/shared.js +131 -0
- package/views/dist/list/buttons/sort-filter.d.ts +6 -0
- package/views/dist/list/buttons/sort-filter.js +16 -0
- package/views/dist/list/buttons/sort.d.ts +17 -0
- package/views/dist/list/buttons/sort.js +34 -0
- package/views/dist/list/buttons/views.d.ts +21 -0
- package/views/dist/list/buttons/views.js +36 -0
- package/views/dist/list/editor-menus.d.ts +13 -0
- package/views/dist/list/editor-menus.js +13 -0
- package/views/dist/list/index.d.ts +41 -0
- package/views/dist/list/index.js +19 -0
- package/views/dist/list/line.d.ts +55 -0
- package/views/dist/list/line.js +221 -0
- package/views/dist/list/pane-box.d.ts +6 -0
- package/views/dist/list/pane-box.js +15 -0
- package/views/dist/list/panels/customize.d.ts +8 -0
- package/views/dist/list/panels/customize.js +23 -0
- package/views/dist/list/panels/filter-bar.d.ts +12 -0
- package/views/dist/list/panels/filter-bar.js +67 -0
- package/views/dist/list/panels/filter.d.ts +8 -0
- package/views/dist/list/panels/filter.js +23 -0
- package/views/dist/list/panels/quick.d.ts +7 -0
- package/views/dist/list/panels/quick.js +16 -0
- package/views/dist/list/panels/shared.d.ts +25 -0
- package/views/dist/list/panels/shared.js +33 -0
- package/views/dist/list/panels/sort.d.ts +8 -0
- package/views/dist/list/panels/sort.js +19 -0
- package/views/dist/list/panels/views.d.ts +13 -0
- package/views/dist/list/panels/views.js +27 -0
- package/views/dist/list/ready.d.ts +35 -0
- package/views/dist/list/ready.js +7 -0
- package/views/dist/list/root-base.d.ts +17 -0
- package/views/dist/list/root-base.js +9 -1
- package/views/dist/list/root.js +2 -2
- package/views/dist/list/store.d.ts +19 -0
- package/views/dist/list/store.js +40 -1
- package/views/dist/list/toolbar-model.d.ts +95 -0
- package/views/dist/list/toolbar-model.js +177 -0
- package/views/dist/list/toolbar.js +140 -328
- package/views/dist/list/views-axis.js +15 -4
- package/views/dist/model/aggregates.d.ts +18 -8
- package/views/dist/model/aggregates.js +16 -22
- package/views/dist/panels/react/filter/FilterEditor.d.ts +3 -1
- package/views/dist/panels/react/filter/FilterEditor.js +2 -2
- package/views/dist/panels/react/filter/filter-body.d.ts +3 -1
- package/views/dist/panels/react/filter/filter-body.js +2 -2
- package/views/dist/panels/react/sort/SortEditor.d.ts +3 -1
- package/views/dist/panels/react/sort/SortEditor.js +4 -4
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +80 -3
- package/views/dist/panels/react/toolbar/Toolbar.js +85 -52
- package/views/dist/panels/react/toolbar/ToolbarBarSorts.d.ts +9 -0
- package/views/dist/panels/react/toolbar/ToolbarBarSorts.js +57 -0
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.d.ts +4 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +30 -0
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +6 -1
- package/views/dist/panels/react/toolbar/ToolbarSortPill.d.ts +5 -0
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +6 -4
- package/views/dist/panels/react/toolbar/ToolbarViews.d.ts +7 -1
- package/views/dist/panels/react/toolbar/ToolbarViews.js +4 -4
- package/views/dist/panels/react/toolbar/sheet-host.d.ts +3 -0
- package/views/dist/panels/react/toolbar/sheet-host.js +6 -0
- package/views/dist/panels/react/toolbar/use-give-way.d.ts +6 -0
- package/views/dist/panels/react/toolbar/use-give-way.js +8 -1
- package/views/dist/panels/react/views-row/ViewPicker.d.ts +8 -1
- package/views/dist/panels/react/views-row/ViewPicker.js +12 -7
- package/views/dist/panels/settings/filter-groups.js +7 -0
- package/views/dist/provider/components.d.ts +38 -3
- package/views/dist/react.d.ts +1 -1
- package/views/dist/selection/bar-overflow.d.ts +2 -0
- package/views/dist/selection/bar-overflow.js +2 -1
- package/views/dist/selection/bar-props.d.ts +1 -1
- package/views/dist/selection/verbs.d.ts +2 -2
- package/views/dist/styles.css +268 -5
- package/views/dist/styles.unlayered.css +268 -5
- package/views/docs/contract.md +29 -15
- package/views/docs/controls/field.md +1 -0
- package/views/docs/controls/filter-editor.md +1 -1
- package/views/docs/controls/menu.md +1 -1
- package/views/docs/controls/number-editor.md +2 -0
- package/views/docs/controls/sort-editor.md +1 -1
- package/views/docs/controls/text-editor.md +2 -0
- package/views/docs/guides/atoms.md +1 -0
- package/views/docs/guides/selection.md +1 -1
- package/views/docs/guides/the-grid.md +3 -3
- package/views/docs/reference/controls.md +3 -3
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +4 -4
- package/views/docs/reference/list.md +168 -6
- package/views/docs/reference/looks.md +1 -1
- package/views/docs/reference/panels-react.md +7 -7
- package/views/docs/reference/react.md +13 -10
- package/views/docs/reference/selection.md +1 -1
- package/views/docs/reference/views.md +9 -7
- package/views/skills/views/SKILL.md +2 -1
|
@@ -89,7 +89,7 @@ export function OrdersFromAnAction() {
|
|
|
89
89
|
- `views`: a `ViewsStore`, or `{ seed }` (your own views, read-only), `{ records }` (what the delete question calls the rows), `{ store }`.
|
|
90
90
|
- `defaults`: what a list with no saved view shows; by default the fields' columns over `LIST_SETTINGS_DEFAULTS`.
|
|
91
91
|
- `sortFilter` and `bar`: the toolbar's form on a computer, as `ListRoot` takes them.
|
|
92
|
-
- `menus`: every menu as data ([Menus as data](#menus-as-data)): `column`, `row`, `group` and `
|
|
92
|
+
- `menus`: every menu as data ([Menus as data](#menus-as-data)): `column`, `row`, `group`, `addColumn` and `figure` reach the grid, `view`, `add`, `more`, `customize`, `sortEditor`, `filterEditor` and `groupEditor` the toolbar.
|
|
93
93
|
- `toolbarParts`: where each of the toolbar's parts stands ([Parts as data](#parts-as-data)).
|
|
94
94
|
- `customizeIn`: where Customize opens on a computer (VK-1026). `"popover"`, the default, at its button. `"pane"`: in your map's `Pane` (`CONTROLS.Pane`), at the list's right edge under the toolbar and as tall as the grid, over its edge, the grid scrolling and taking presses beside it; the grid then stands in a box of its own, `data-slot="vk-list-box"` (positioned, a flex column that fills the list: give the list its height as a flex column), the Pane's. On a phone Customize keeps its Sheet. An app on `ListRoot` hands its own box to `ListToolbar` as `paneBox`.
|
|
95
95
|
- `link`: default `true`. The address carries the open view and what changed over it (`view`, `q`, `change`), written in place as it changes, your other parameters and history state kept; an opened link wins over the person's draft; back and forward open what the address says. A link it can't read is said through the toast. Two lists on one page share those parameters: hand the second `link={false}`.
|
|
@@ -149,7 +149,7 @@ export function DealsList({ children }: { children: ReactNode }) {
|
|
|
149
149
|
- `ListState` — one list's state, as a part selects it:
|
|
150
150
|
- `id`: the root's.
|
|
151
151
|
- `view`: `settings` (the view as the person edits it), `layer` (their own layer over it) and `shared` (the shared view, or `null`; kept by ViewKit, the open view, the person's own included).
|
|
152
|
-
- `panels`: `open` (the one open panel's key, or `null`), `pages` (each panel's page by its key), `held` (the filter rule held until whole), `barShown` (the filter bar shows), `footHere` (Clear and Save stand in Customize's foot: on a phone, and in Mihai's look beside the bar's own), `sortFilter` and `bar
|
|
152
|
+
- `panels`: `open` (the one open panel's key, or `null`), `pages` (each panel's page by its key), `held` (the filter rule held until whole), `barShown` (the filter bar shows), `footHere` (Clear and Save stand in Customize's foot: on a phone, and in Mihai's look beside the bar's own), `sortFilter` and `bar`, `placed` (what stands under the root, by key, counted: `ListToolbar` and `ListFilterBar` place `bar` while they draw a filter bar on a computer, `ListFilterBar` its own `list-filter-bar` too, and each placed panel its button's key), `barOpen` (the filter bar asked open by `ListSortFilter`: what `ListFilterBar shows="button"` reads), `shown` (a placed panel asked to stand by its button, by its key; apart from `open`, so a popover opening elsewhere leaves it standing) and `standing` (each placed panel standing now, by its key: `alone`, or `shown`, only because its button showed it). `ListToolbar` says `barShown` and `footHere` as it draws.
|
|
153
153
|
- `views`: the list's saved views where the root keeps them (a `ListViewsState`); `null` in memory mode.
|
|
154
154
|
- `columns`: the list's columns from its `fields`; `null` with none.
|
|
155
155
|
- `answer`: the rows the list shows (a `ListAnswerState`); `null` with no `fields`, or with neither `rows` nor a `source`.
|
|
@@ -158,13 +158,170 @@ export function DealsList({ children }: { children: ReactNode }) {
|
|
|
158
158
|
- `setSettings(change)` and `setLayer(patch)`: hand a change to the root's `onChange` and `onLayerChange`.
|
|
159
159
|
- `openPanel(key, page?)`: opens a panel and closes any other, on `page` where handed, else on the page it holds. `closePanel(key)`: closes it if it is the one open, forgetting its page. `setPage(key, page)`: a panel's page; set on a panel that isn't open, it waits for it, until another opens.
|
|
160
160
|
- `hold(rule)`: holds a filter rule until whole, or `null`.
|
|
161
|
+
- `place(key)`: counts one more of `key` as placed, and hands back the function that takes that one back, once. `setBarOpen(open)`: asks the filter bar open, or lets it go (`ListSortFilter`'s). `setShown(key, shown)`: asks a placed panel to stand, or lets it go (its button's). `stand(key, stands)`: a placed panel says whether it stands, `alone`, `shown` or `null` (the panels call it themselves).
|
|
161
162
|
- `select(ids)`: picks these rows; `select("all")` picks every matching row (from a source, it asks for their `ids` first, `all` and the total's `count` while they come); `select([])` picks none.
|
|
162
163
|
- `saveView()` and `resetView()`: the shared view's Save for everyone and Reset (kept by ViewKit, the open view's Save and Reset); nothing without one.
|
|
163
164
|
- `undo()` and `redo()`: take back the list's last edit, and put back the last one taken back, as ⌘Z and ⌘⇧Z do; nothing until there is one.
|
|
164
165
|
- `loadMore()` and `loadGroup(key)`: from a source, the next page, and a group's; nothing in memory, or while a newer request is out.
|
|
165
|
-
- `ListToolbar` — the ready toolbar's parts in their arrangements, reading the root around it: every `ReadyToolbar` prop but those the root holds. `ReadyToolbar` is a `ListRoot` holding no data around it. Place one per root: two would draw the same panels. Handed no `views` in a root that keeps its views, it draws the views row from them, its menu included; a new view takes one of its `layouts` (a table where none are handed).
|
|
166
|
+
- `ListToolbar` — the ready toolbar's parts in their arrangements, reading the root around it: every `ReadyToolbar` prop but those the root holds. `ReadyToolbar` is a `ListRoot` holding no data around it. Place one per root: two would draw the same panels. Handed no `views` in a root that keeps its views, it draws the views row from them, its menu included; a new view takes one of its `layouts` (a table where none are handed). It is put together from the parts below (`ListViews`, `ListCustomize`, `ListSort`, `ListFilter`, `ListQuickFilters`, `ListSearch`, `ListNew`, `ListFilterBar`'s pieces, `ListClearSave`): in the kit's arrangement each in a `ListLine`, a `ListGap` between each line's start and end; the row arrangement keeps its own frame. It draws as it always has, so a fix to a part reaches it; where it draws a part otherwise (its phone's and its bar form's Sort, Customize's foot, the quick filters' word, its hosts and its own panel keys) it says so to the part itself, never through your props. A part inside your own `toolbarParts` node is a placed part, keyed as one.
|
|
166
167
|
- `ListToolbarProps` — what `ListToolbar` takes: `ReadyToolbarProps` without `settings`, `layer`, `onChange`, `onLayerChange`, `view`, `sortFilter` and `bar`; `toolbarParts` among them ([Parts as data](#parts-as-data)). In a root that holds a list's `fields` and its `rows` or `source`, `columns`, `groupHeads` and `filterData` default to the root's; handed, yours win. With `customizeIn: "pane"`, hand `paneBox`, your box round the grid (positioned, never scrolling itself: a `div` your `ref` callback keeps in state), and Customize opens there in the Pane on a computer (VK-1026).
|
|
167
168
|
|
|
169
|
+
## A list's buttons, placed anywhere
|
|
170
|
+
|
|
171
|
+
```tsx
|
|
172
|
+
// With the imports above.
|
|
173
|
+
import type { ListRow } from "viewkitjs/fields/query";
|
|
174
|
+
import { ListCustomize, ListFill, ListFilter, ListGrid, ListNew, ListSearch, ListSlot, ListSort, ListViews, type ListFieldsRegistry } from "viewkitjs/views/list";
|
|
175
|
+
|
|
176
|
+
// Your page's header, outside the list's tree, and a line of your own inside it: each button reads the list around it.
|
|
177
|
+
export function DealsPage({ dealFields, deals, addDeal }: { dealFields: ListFieldsRegistry; deals: readonly ListRow[]; addDeal: () => void }) {
|
|
178
|
+
return (
|
|
179
|
+
<>
|
|
180
|
+
<header>
|
|
181
|
+
<h1>Deals</h1>
|
|
182
|
+
<ListSlot name="deals-header" />
|
|
183
|
+
</header>
|
|
184
|
+
<ListRoot id="deals" fields={dealFields} rows={deals}>
|
|
185
|
+
<ListFill name="deals-header">
|
|
186
|
+
<ListViews />
|
|
187
|
+
<ListSearch shows="input" />
|
|
188
|
+
<ListNew onAdd={addDeal} />
|
|
189
|
+
</ListFill>
|
|
190
|
+
<div className="my-line">
|
|
191
|
+
<ListSort />
|
|
192
|
+
<ListFilter empty="editor" />
|
|
193
|
+
<ListCustomize words="word" />
|
|
194
|
+
</div>
|
|
195
|
+
<ListGrid />
|
|
196
|
+
</ListRoot>
|
|
197
|
+
</>
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
The ready toolbar's buttons, each a part of its own: written anywhere under a `ListRoot`, or through a `ListFill` outside its tree, it reads and changes the list with nothing wired, as `ListToolbar`'s own button does. A part has no side and no line: it stands where you write it. Place each one once per root. Sort, Filter and Customize need a root holding the list's `fields`; without them they draw nothing.
|
|
203
|
+
|
|
204
|
+
- Each panel a button opens is its own in the root's radio (one panel open per root), under a key of its own, apart from `ListToolbar`'s, so a button placed beside the ready toolbar never opens with its twin: `list-sort`, `list-filter`, `list-customize` and `list-quick`, for your `openPanel(key)`.
|
|
205
|
+
- What a placed button doesn't take from `ListToolbar`: `hosts`; the Pane's box comes from `ListPaneBox`. The editors' menus as data come from a `ListEditorMenus` around it ([Menus as data](#menus-as-data)), a view's menu and the views' "+N" from `ListViews`' `menu` and `moreViews`, Customize's rows from `ListCustomize`'s `menu`. On a phone each draws as its piece does today (Filter opening its sheet); a phone's arrangement of placed parts is still to come.
|
|
206
|
+
- `ListViews` — the root's saved views (or `views`, your own), Show counts the view's. `shows`: `tabs` (the default), each view a tab, or `button`, one button naming the open view and opening the rest (one axis; several still draw as tabs). `layouts`: what a new view takes one of. `menu`: a view's menu as data, as the ready toolbar's `menus.view`. `moreViews`: the views' "+N" as you draw it (`ToolbarMoreViews`), as the ready toolbar's `moreViews`. No "Edit view…" row, unlike the ready toolbar's.
|
|
207
|
+
- `ListViewsProps` — what `ListViews` takes: `views`, `layouts`, `shows`, `menu` and `moreViews`.
|
|
208
|
+
- `ListSearch` — the root's search. `shows`: `button` (the default), its glass opening a field, or `input`, standing as a field. `words` (its glass alone by default), `placeholder`, `searching`.
|
|
209
|
+
- `ListSearchProps` — what `ListSearch` takes.
|
|
210
|
+
- `ListSort` — the root's sort, as the ready toolbar's row Sort: lit while the sort differs, opening the sort editor while a rule stands and the fields while none does; a list with one sort rule, the one-rule Sort (lit while it differs too, which the ready toolbar's one-rule Sort isn't). `opens` (below), `empty`: `fields` (the default) or `editor`, the sort editor saying "No sorting set up yet" (`views.panels.sort-empty`) with Add sort, which stays open as its last rule goes. `words`.
|
|
211
|
+
- `ListSortProps` — what `ListSort` takes: `opens`, `empty` and `words`.
|
|
212
|
+
- `ListFilter` — the root's filter, as the ready toolbar's row Filter: lit while the filter differs, opening the view's filters, editable, Add filter under them, and the fields while none stands. `opens`, `empty` (`editor`: "No filtering set up yet", `views.panels.filter-empty`, with Add filter, staying open as its last rule goes), `words`. On a phone, Filter and its sheet.
|
|
213
|
+
- `ListFilterProps` — what `ListFilter` takes: `opens`, `empty` and `words`.
|
|
214
|
+
- `ListQuickFilters` — the quick filters the root was handed (`quickFilters`), their counts following Show counts; nothing without them. Its icon alone by default. `opens`, `words`.
|
|
215
|
+
- `ListQuickFiltersProps` — what `ListQuickFilters` takes: `opens` and `words`.
|
|
216
|
+
- `ListCustomize` — the root's Customize, its pages over the settings and the person's layer, its foot Reset and Save for everyone on a shared view, else the kit's Clear while the list differs. `opens`, `words`, and `viewName`, `onRenameView`, `onCopyLink`, `onExport`, `exportCount` and `fieldEditor`, as `ReadyToolbar` hands them. `menu`: Customize's rows as data (`ViewsCustomizeItems`), as the ready toolbar's `menus.customize`.
|
|
217
|
+
- `ListCustomizeProps` — what `ListCustomize` takes.
|
|
218
|
+
- `ListSortFilter` — Sort and filter (`views.panels.sort-filter`): one button showing and hiding the filter bar, lit and `aria-expanded` while the root's `panels.barOpen` holds it open; a press flips it (`setBarOpen`). `ListFilterBar shows="button"` stands while it does; with no such bar it changes nothing in the list. Not `sortFilter`, which says where the ready toolbar stands its sort and Filter (`right` or `bar`). `words`.
|
|
219
|
+
- `ListSortFilterProps` — what `ListSortFilter` takes: `words`.
|
|
220
|
+
- `ListClearSave` — Clear and Save while the list differs from its view: Clear back to the view as saved (or the list's default, the person's layer emptied), Save where the view can be saved; nothing while it doesn't differ.
|
|
221
|
+
- `ListClearSaveProps` — what `ListClearSave` takes: nothing.
|
|
222
|
+
- `ListNew` — New: `onAdd` (one way to add) or `items` (several, as a menu), `label`, `words`. Hand it one or the other: alone it draws a button that does nothing.
|
|
223
|
+
- `ListNewProps` — what `ListNew` takes.
|
|
224
|
+
- `ListOpens` — where a button's panel opens: `popover` (the default, at its button), `pane` (your map's `Pane`, at the right edge of the root's `ListPaneBox`, the grid in use beside it; with no box or no `Pane`, the popover), `sheet` (your map's `Sheet`, on a computer too), or a function, your own: ViewKit draws the button alone and calls it with the button on a press, opening nothing. `ListSort` and `ListFilter` also take `bar`: the fields every time, a picked rule standing on the filter bar placed under the root (`ListToolbar`'s, while it draws one: `panels.placed.bar`), which opens its value; with no bar placed, the popover, said once in development at its press. With a `ListFilterBar shows="button"` placed, a press asks that bar open too (`setBarOpen`); with only `ListToolbar`'s bar, Sort and filter stays as it is. An app that leaves the bar's filters out of `ListToolbar`'s `toolbarParts` still counts its bar as placed.
|
|
225
|
+
- `ListWords` — a button's words: `both` (its icon and its word), `icon` (its icon alone) or `word` (its word alone). Each part's default is today's: Search and Quick filters their icon alone, the rest both.
|
|
226
|
+
- `ListPaneBox` — the box where a placed button's Pane stands: put it round your grid under the root. It draws a `div` (`data-slot="vk-list-box"`, positioned, its own stack, a flex column filling its place), the ready `List`'s own box with `customizeIn="pane"`; your `className` joins it. Place one per root: a second would take the Pane from the first. Outside a `ListRoot`, it throws.
|
|
227
|
+
- `ListPaneBoxProps` — what `ListPaneBox` takes: `className` and `children`.
|
|
228
|
+
- A button whose panel is placed under the root (below) opens no popover: it shows the panel, points to it, or hides it.
|
|
229
|
+
|
|
230
|
+
## A list's panels, placed anywhere
|
|
231
|
+
|
|
232
|
+
```tsx
|
|
233
|
+
// With the imports above.
|
|
234
|
+
import { ListFilterBar, ListFilterPanel, ListSortFilter, ListViewsPanel } from "viewkitjs/views/list";
|
|
235
|
+
|
|
236
|
+
// The views in your app's sidebar, the filter panel in a column beside the table, the filter bar behind Sort and filter, its
|
|
237
|
+
// sorts edited right on it: each panel stands where you write it.
|
|
238
|
+
export function DealsWithPanels({ dealFields, deals }: { dealFields: ListFieldsRegistry; deals: readonly ListRow[] }) {
|
|
239
|
+
return (
|
|
240
|
+
<div className="my-app">
|
|
241
|
+
<nav className="my-sidebar">
|
|
242
|
+
<ListSlot name="deals-nav" />
|
|
243
|
+
</nav>
|
|
244
|
+
<ListRoot id="deals" fields={dealFields} rows={deals}>
|
|
245
|
+
<ListFill name="deals-nav">
|
|
246
|
+
<ListViewsPanel />
|
|
247
|
+
</ListFill>
|
|
248
|
+
<div className="my-line">
|
|
249
|
+
<ListViews shows="button" />
|
|
250
|
+
<ListFilter />
|
|
251
|
+
<ListSortFilter />
|
|
252
|
+
</div>
|
|
253
|
+
<ListFilterBar shows="button" sorts="yes" />
|
|
254
|
+
<div className="my-row">
|
|
255
|
+
<ListGrid />
|
|
256
|
+
<aside className="my-column">
|
|
257
|
+
<ListFilterPanel />
|
|
258
|
+
</aside>
|
|
259
|
+
</div>
|
|
260
|
+
</ListRoot>
|
|
261
|
+
</div>
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
The ready toolbar's panels, each a part of its own: written anywhere under a `ListRoot`, or through a `ListFill`, it stands open there, reading and changing the list as its button's popover does. Each stands in a region of its own (`role="region"`, named, `data-slot="vk-list-panel"`); your layout gives it its room. Place each one once per root: a panel says whether it stands by its key, one per key.
|
|
267
|
+
|
|
268
|
+
- When a panel stands, its `shows` (`ListPanelShows`): `always`, standing open (every panel's default but the filter bar's); `filled`, once it holds something (the filter bar's default, the ready toolbar's "once added"; the filter bar, the filter panel and the sort panel take it); `button`, while its button shows it, with a ✕ that lets it go. A panel shown by its button stays as a popover opens elsewhere: one popover is open per root, but a standing panel is part of the page. Gone from the page, its button's ask to show it goes too.
|
|
269
|
+
- Its button, placed under the same root, shows that panel instead of opening a popover: a press shows it (a panel that doesn't stand), points to it (the focus moves into it and it scrolls into view, for a panel standing on its own), or hides it (a panel standing only because the button showed it); `aria-expanded` while it stands. `ListViews` does so only with `shows="button"`: its tabs open nothing. `ListToolbar`'s own buttons don't see placed panels yet.
|
|
270
|
+
- A panel that can't draw (a root with no `fields`, no quick filters, no saved views, no and/or groups) draws nothing and places nothing, so its button opens its popover as before.
|
|
271
|
+
- On a phone a placed panel draws as on a computer, and a placed `ListViews shows="button"` still opens its own list: folding a standing panel behind its button on a phone is still to come. `ListFilterBar` draws nothing on a phone, as the bar's filters don't (Filter's sheet edits there).
|
|
272
|
+
- `ListViewsPanel` — the views as a standing list, as a sidebar's nav: your map's `ViewsListBody` (the one the view picker opens), a pick opening the view, New view, reordering and a view's verbs as the views hand them. `views` (your own, else the root's saved views), `layouts`, `shows` (`always` or `button`), `className`.
|
|
273
|
+
- `ListViewsPanelProps` — what `ListViewsPanel` takes.
|
|
274
|
+
- `ListFilterPanel` — the filter standing: every rule editable, Add filter under them, "No filtering set up yet" with nothing set. `shows` (`filled`: once a filter stands or a rule is held), `className`. Placed, `ListFilter` shows or points to it.
|
|
275
|
+
- `ListFilterPanelProps` — what `ListFilterPanel` takes.
|
|
276
|
+
- `ListSortPanel` — the sort standing: every rule editable, Add sort under them, "No sorting set up yet" with nothing set. `shows` (`filled`: once a rule stands), `className`. Placed, `ListSort` shows or points to it. Nothing without several sorts.
|
|
277
|
+
- `ListSortPanelProps` — what `ListSortPanel` takes.
|
|
278
|
+
- `ListQuickFiltersPanel` — the quick filters the root was handed, standing, their counts following Show counts, under their own head. `shows` (`always` or `button`), `className`. Placed, `ListQuickFilters` shows or points to it.
|
|
279
|
+
- `ListQuickFiltersPanelProps` — what `ListQuickFiltersPanel` takes.
|
|
280
|
+
- `ListCustomizePanel` — Customize standing, its own head, its pages and foot as `ListCustomize`'s. `shows` (`always` or `button`), `className`, and `viewName`, `onRenameView`, `onCopyLink`, `onExport`, `exportCount` and `fieldEditor`, as `ListCustomize` takes them. Placed, `ListCustomize` shows or points to it.
|
|
281
|
+
- `ListCustomizePanelProps` — what `ListCustomizePanel` takes.
|
|
282
|
+
- `ListFilterBar` — the filter bar: the standing rules, each edited right where it stands, and its +, as the ready toolbar's bar draws them (the sort on the bar, a separator, the filters), in a wrapping line of its own (`role="region"` named "Sort and filter", `data-slot="vk-list-filter-bar"`). `shows`: `filled` (the default: a filter standing beyond the saved view's own, a rule held, or its sort drawn; a saved filter taken away, or a second axis of views, doesn't bring it: `ListClearSave` and `ListViews` are their own parts), `always` (its empty Filter with nothing set) or `button` (while `ListSortFilter` holds it open). `sorts`: `no` (the default, the sort pill while the sort differs) or `yes`, each sort rule standing on the bar as its field, its direction and ×, edited in place, and + (Add sort, with its word, while none stands): the field and + open the fields, on the menu's surface, and no sort editor opens; a list without several sorts keeps `no`'s one-rule sort. It places `bar` (a button's `opens="bar"` adds its rule here) and `list-filter-bar`: while it is placed, `ListToolbar` leaves the filters to it, so one bar edits per root. In the ready toolbar's default form its bar keeps only its stacked views and Clear and Save, and stands only for those; with `sortFilter="bar"` its line keeps its Sort and Filter alone. A rule held for the bar until whole (a yes/no, a related record's field, picked from a Filter with `opens="bar"` or the bar's +) stands on this bar, which with `shows="button"` opens for it while it is hidden; a Filter with its own panel holds the rule in its editor. Written in a `ListLine`, its pieces stand as the line's items (no region), its filters folding into "+N filters" as the line narrows; outside one they wrap and never fold, and `className` goes on the region. Nothing without the root's fields or and/or groups.
|
|
283
|
+
- `ListFilterBarProps` — what `ListFilterBar` takes: `shows`, `sorts` and `className`.
|
|
284
|
+
- `ListPanelShows` — when a placed panel stands: `always`, `filled` or `button`.
|
|
285
|
+
|
|
286
|
+
## A list's lines
|
|
287
|
+
|
|
288
|
+
```tsx
|
|
289
|
+
// With the imports above.
|
|
290
|
+
import { ListClearSave, ListGap, ListLine } from "viewkitjs/views/list";
|
|
291
|
+
|
|
292
|
+
// Lines of your own from the toolbar's parts: each in the order you write it, a gap pushing what follows it to the line's end,
|
|
293
|
+
// folding as the ready toolbar's line folds as it narrows.
|
|
294
|
+
export function DealsWithLines({ dealFields, deals }: { dealFields: ListFieldsRegistry; deals: readonly ListRow[] }) {
|
|
295
|
+
return (
|
|
296
|
+
<ListRoot id="deals" fields={dealFields} rows={deals}>
|
|
297
|
+
<ListLine>
|
|
298
|
+
<ListSort />
|
|
299
|
+
<ListFilter />
|
|
300
|
+
<ListGap />
|
|
301
|
+
<ListCustomize />
|
|
302
|
+
<ListSearch />
|
|
303
|
+
<ListNew onAdd={() => {}} />
|
|
304
|
+
</ListLine>
|
|
305
|
+
<ListLine kind="bar">
|
|
306
|
+
<ListFilterBar />
|
|
307
|
+
<ListGap />
|
|
308
|
+
<ListClearSave />
|
|
309
|
+
</ListLine>
|
|
310
|
+
<ListGrid />
|
|
311
|
+
</ListRoot>
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
A line of your own, written with the toolbar's parts under a `ListRoot` (or through a `ListFill`): it stands them in the order you write them and folds them as the ready toolbar's line folds as it narrows. No part has a start or an end of its own: its place is its position, and a gap does the pushing.
|
|
317
|
+
|
|
318
|
+
- `ListLine` — a toolbar line (`role="toolbar"`, `data-slot="vk-toolbar-line"`). `kind`: `row` (the default: a toolbar row, its buttons full size, named "List tools") or `bar` (a filter bar's line, a step smaller, named "Sort and filters"); `className`. What stands before its first `ListGap` is its start, what follows it its end: what opens from the end hangs toward it. A line with no gap is all start, and a second gap is room too, nothing more. As it narrows it folds from its end, in today's order: each part that has words turns to its icon, then the views' tabs fold into "+N" (the open one never), then the filter bar's filters into "+N filters", then each part that may fold goes into ⋯, which stands after the last folded part and lists them in the line's order, each row doing what the part's press does. Your own nodes and the panels written in a line stand as written and never fold. ⋯ stays one element as the parts change, open while the part it stood after goes. On a phone a line keeps its computer form for now.
|
|
319
|
+
- `ListLineProps` — what `ListLine` takes: `kind`, `className`, `children`; `more`, ⋯'s rows as data (`ToolbarMore`: handed the folded parts' rows, each keyed by its part, and `{ line }`, `row` or `bar` as its `kind`, it hands back the rows ⋯ shows), as the ready toolbar's `menus.more`; `overflow`, ⋯ as you draw it (`ToolbarOverflow`), as the ready toolbar's `overflow`.
|
|
320
|
+
- `ListGap` — empty room: in a line it pushes what follows it to the line's end (the first one splitting the line's start from its end); anywhere else, the same room in a row of your own (a page header). As many as you like.
|
|
321
|
+
- `ListGapProps` — what `ListGap` takes: nothing.
|
|
322
|
+
- How each part folds in a line, keyed as the ready toolbar keys it (`data-toolbar-item`): `ListViews` (`views`, its tabs into "+N", one axis as tabs), `ListCustomize` (`options`), `ListSort` (`sort`), `ListFilter` (`filter-add`; `filter` on a phone or without and/or groups), `ListQuickFilters` (`quick`) and `ListSortFilter` (`sort-filter`) give up their words, then fold into ⋯; `ListNew` (`new`) gives up its words; `ListSearch` (`search`) is the line's search; `ListClearSave` (`save`) never folds; `ListFilterBar` stands its pieces (`sort-pill`, `sep`, `filters`).
|
|
323
|
+
- Every part placed under one root reads one model of the list, built once for each change of what it reads, whatever the number of parts.
|
|
324
|
+
|
|
168
325
|
## A list's saved views
|
|
169
326
|
|
|
170
327
|
```tsx
|
|
@@ -227,6 +384,9 @@ Your app's own store implements `ViewsStore` over its API, a server checking eac
|
|
|
227
384
|
|
|
228
385
|
Each of a list's menus below hands you its default items as data, and draws the items your function hands back: drop a row, rename it, move it, add your own, or draw a row's inside yourself.
|
|
229
386
|
|
|
387
|
+
- `ListEditorMenus` — the editors' menus as data for every part under it: `sortEditor`, `filterEditor` and `groupEditor`, as the ready toolbar's `menus` names them, reaching a placed Sort's, Filter's and Customize's editors and the placed panels' (the filter bar's own sort rules, `sorts="yes"`, not yet). Each it hands takes over that editor from an outer one; the rest stay the outer's. `ListToolbar` stands its own `menus` in one, over yours.
|
|
388
|
+
- `ListEditorMenusProps` — what `ListEditorMenus` takes: `sortEditor`, `filterEditor`, `groupEditor`, `children`.
|
|
389
|
+
|
|
230
390
|
```tsx
|
|
231
391
|
import { GridTable, type GridTableProps } from "viewkitjs/views/grid";
|
|
232
392
|
import { menu, type ListMenus } from "viewkitjs/views/list";
|
|
@@ -270,6 +430,7 @@ const filterEditor: ListMenus<Deal>["filterEditor"] = (items, ctx) =>
|
|
|
270
430
|
- `more(items, { line })`: ⋯, the folded parts' rows, each keyed by its part. Each line folds into its own ⋯, so it is handed which: `"row"` or `"bar"` (the filter bar). A press on any row closes ⋯ first.
|
|
271
431
|
- `customize(items, { page, form, layout })`: Customize's rows (VK-1062), each page's handed in turn: `page` is `"list"` (its sections, a list's per-field filters unless they fold behind Filter, where they aren't handed, and its toggles), `"layout"` (Layout's page: the layout's own settings, under the layout cards, which are your `layouts`) or `"columns"` (Columns' page: none of its own, as the columns are the view's, set by your columns' `hideable` and `fixed`; the rows you hand draw after the columns, before your field editor's rows). Its items are `ViewsCustomizeItem`s ([`/react`](./react.md)): a row keyed by one of Customize's own (below) is ViewKit's row, opening its page, its choices or its field as before, with your item's words, icon, value (`detail`), mark (`inForce`) and divider; its own `onSelect` and `checked` are set aside. A section's rows are always the item's `children`, so `menu.drop` and `menu.add` reach inside it; a section handed back with none draws nothing. Any other key is your row: `checked` with `onSelect` a check, `onSelect` an action (`destructive` drawn as danger), `children` a section of your own, and on the list `page` a page of your own, opened by its row, titled by its `label`, with Back (a function is handed Back, so the page can close itself); the page's place is told as `page:<key>` and held across a change of form. `disabled` draws a row that can't be used, saying `disabledReason`, else "Not available" (`views.panels.customize-unavailable`), and opens nothing. A page whose row you drop, disable or hand back as a section doesn't open, its layout button goes with Layout's row, and a screen whose row goes while it stands is the list again. `beside`, `keepOpen`, `href`, `render` and `shortcut` are set aside here. Layout's and Columns' rows are asked only while their page stands. An app's own `CustomizeBody` is handed the function as `items`; the older popover route (`ViewOptionsPopoverPanel`) hands none.
|
|
272
432
|
- `sortEditor(items, ctx)`, `filterEditor(items, ctx)`, `groupEditor(items, ctx)` (VK-1063): the editors' menus, wherever the toolbar draws them (its Sort and Filter panels, Customize's Sort, Filter and Group pages; the toolbar's Group has no panel of its own, so `groupEditor` reaches Customize's Group page). `ctx.menu` says which: the sort editor's `rule` (a rule's ⋯, on a phone and in the narrow form: a computer's rule has × and no ⋯) and `aside` (a set-aside rule's ⋯); the filter editor's `rule`, `aside` and `group` (a group's actions); the group editor's `settings` and `foot` (Remove grouping). The groups themselves (each group's row) are the list's values, not reshaped. `ctx` names a rule in your terms only, `field` across the three: the sort's key (on `aside`, the rule's stored `fieldKey`), or the filter's `fieldKey` with its `part` and `relation`, and a filter rule or group by its `path` in the filter (`[]` the whole filter, indices through `items` and a relation rule's `where.items`) (the `ViewsSortEditorItemsContext`, `ViewsFilterEditorItemsContext` and `ViewsGroupEditorItemsContext` of [`/react`](./react.md)). A row keyed by one of the menu's own (below) is ViewKit's row with your words and icon, its own `onSelect` set aside; `disabled` greys it, saying `disabledReason`. A default ViewKit doesn't offer this time (Put back while it doesn't fit) draws nothing. The filter's any/none/every is one item, `relation` (its label `views.panels.filter-relation-rows`, "Which related records"), its choices its `children` (`relation:any`, `relation:none`, `relation:every`; the choices' own `data-key` stays `any`, `none`, `every`): drop one, rename one, or hand back none to drop the choice. Any other key is your row: an action (`destructive` drawn as danger), a check (`checked` with `onSelect`) or a group of rows, drawn with the menu's own slot (`vk-sort-rule-action`, `vk-filter-rule-action`, `vk-filter-group-action`, the group editor's `vk-group-row`). No line stands first, last or twice in a row. `beside`, `keepOpen`, `href`, `render`, `shortcut` and `detail` are set aside here. An app with its own toolbar frame (`ToolbarSlotProvider`) can't hand these yet: draw a `SortBody` or `FilterBody` of your own that hands `CONTROLS`' its `items`.
|
|
433
|
+
- The sort and filter editors' rule ends and feet (VK-1065), through the same `sortEditor` and `filterEditor`: `ctx.menu` `row`, the buttons a rule ends in (the sort's × on a computer, its ⋯ on a phone, in the narrow form and on a set-aside rule; the filter's ⋮, or ⋯ on a phone), and `foot`, the buttons at a foot (Add sort and Clear; Add filter, Clear, a group's or a relation's Delete, and the ⋮ of a group or of a filter that may exclude). `ctx` names a sort rule by its `field` and `index` (`aside: true`, and no `index`, on a set-aside rule), a filter rule as `rule` does (with `aside: true` on a set-aside one), and a filter's foot by its group's `path` (`[]` the filter's own); the sort's foot is `{ menu: "foot" }`. A row keyed by one of the place's own (below) is ViewKit's button with your words (a text button's text, an icon button's name), your icon (on ×, Add sort and Add filter; ⋯, ⋮ and the words buttons keep their own) and your greying (`disabled`, saying `disabledReason`, else its own reason, else its words); its own `onSelect` is set aside, and one ViewKit greys this time (Add sort at the most, Add filter on a relation the list no longer lists) is handed to you already `disabled` with its reason. A default ViewKit doesn't offer this time (Clear with nothing to clear, Add sort where what holds the editor has its own +) draws nothing. Any other key is your button, quiet, at the place's size: with an `icon`, an icon button named by its `label`; without, its words; `disabled` greys it, saying why; drawn as `data-slot` `vk-sort-row-action`, `vk-sort-foot-action`, `vk-filter-row-action` or `vk-filter-foot-action`, with `data-key` its key. Only plain actions: `children`, `checked`, `beside`, `keepOpen`, `href`, `render`, `shortcut`, `detail`, `destructive` and `separatorBefore` are set aside here. A rule's boxes, its grip, Where and the joins are not data: rename them through the messages. The sort's × and its ⋯'s Delete share the key `delete`, so `menu.drop(items, "delete")` over every `ctx` makes a rule unremovable in the editor in every form; a function that drops `delete` (or `more`, `add`, `clear`) without checking `ctx.menu` reaches these buttons too, and one that adds or renames rows without checking it now adds a button at every rule's end and foot, or renames each rule's ×: check `ctx.menu`. The sort editor's foot on a computer, handed back nothing, isn't drawn; the filter editor's feet stand, empty. The filter bar's sort pills aren't reached yet.
|
|
273
434
|
- `List` takes `menus` whole and hands each part its own: `GridTable` (and `ListGrid`) takes `column`, `row`, `group` and `addColumn` as `menus` ([`/grid`](./grid.md)), and `ReadyToolbar` and `ListToolbar` take `view`, `add`, `more`, `customize`, `sortEditor`, `filterEditor` and `groupEditor` as `menus` ([`/panels/react`](./panels-react.md)).
|
|
274
435
|
- A menu ViewKit doesn't open stays closed: ⋯ stands only while a part has folded, whatever `more` adds, and New stays a button while `add` hands back its one `new` row. A menu ViewKit opens stays openable: a function that returns `[]` opens an empty menu, so drop what you don't want rather than everything.
|
|
275
436
|
- Each function is called as ViewKit draws (`view` on every toolbar render, the rest as their menus draw): keep it pure and cheap, and call no hooks in it. `row` alone may answer later, with a promise, asked once per opening.
|
|
@@ -285,17 +446,18 @@ const filterEditor: ListMenus<Deal>["filterEditor"] = (items, ctx) =>
|
|
|
285
446
|
|
|
286
447
|
### Default keys
|
|
287
448
|
|
|
288
|
-
Every default row's key is a public name: your function finds rows by it. A key that ends in a value is written here with that value as `<…>`.
|
|
449
|
+
Every default row's key is a public name: your function finds rows by it, and every row ViewKit's own `Menu` draws carries it as `data-key`, for a stylesheet. A key that ends in a value is written here with that value as `<…>`.
|
|
289
450
|
|
|
290
451
|
- A column's menu: `sort-asc`, `sort-desc`, and on a place column `sort-asc:<part>` and `sort-desc:<part>` under them; `sort-clear`; `group-by`, `ungroup`; `percent-display` and `percent-display:<display>`; `date-format` and `date-format:<style>`; `show-time`; `duration-format` and `duration-format:<style>`; `decimals` and `decimals:<decimals>` (`decimals:auto` the field's own); `currency` and `currency:<code>`; `colour:<value>`, under it `colour:<value>:auto` and `colour:<value>:<colour>`, and `colours-reset`; `move-left`, `move-right`; `hide-column`. Your `columnMenuItems` rows keep their keys.
|
|
291
452
|
- "+ Add column": `add:<id>` for each hidden column, `field:<id>` for a field with parts (its level, holding its own `add:<id>` rows), and `all-shown`, the one greyed row when nothing is hidden.
|
|
453
|
+
- A footer cell's calculation picker (`figure`, the grid's `menus`): its figures, `none`, `count` (the first column alone), `empty`, `filled`, `percentEmpty`, `percentFilled`, `sum`, `avg`, `min`, `max`, `ratio`, as the column offers them.
|
|
292
454
|
- A group band's ⋯: `group-select`; `group-sort` and `group-sort:<value>`; `group-show` and `group-show:<part>`; `group-hide`.
|
|
293
455
|
- A row's menu: `copy`, `cut`, `paste`, `clear`; `row-select`; `action:<id>` for each of a name column's actions. Your `contextMenu` rows keep their keys, or are keyed by their words. With `row`, also `row-open` (first) and `row-delete` (last), and `row-waiting`, the greyed row drawn while a promise from `row` waits (never handed to `row`).
|
|
294
456
|
- A view's menu, from the axis's verbs: `rename`, `edit`, `private`, `save`, `reset`, `save-new`, `copy-link`, `favorite`, `duplicate`, `delete`; on a phone `save`, `reset` and `save-new` are under `unsaved`, and `private` and `edit` under `this-view`. A view's own rows keep their keys, `edit-view` (Edit view…) at the head of the open view's.
|
|
295
457
|
- New: your `addItems`' keys, or `new`.
|
|
296
458
|
- Customize (`customize`): on its list `layout`, `columns`, `filter`, `sort`, `group`; a per-field filter `field:<key>` and a section of them `fields:<section>` (not handed while they fold behind Filter); a toggle `toggle:<key>` (`toggle:show_counts`; Show counts from the view, with no toggles handed, `toggle:counts`) and a section of toggles `toggles:<section>`. On Layout's page a pick-one setting `choice:<key>`, a toggle `toggle:<key>` and a section `toggles:<section>` (with no settings handed, a table's `toggle:freeze` and `toggle:wrap`, from the kit's own `Customize` alone). Columns' page has none. A section's key is its heading's words, so a translated heading is another key, and one heading names one section (a heading among the filter fields and again after Group shares one key: handed any function, the second goes). A `fields:` or `toggles:` key handed back with no rows draws nothing. Your rows draw as `data-slot="vk-customize-row"`, a page of yours as `vk-customize-page`, each with `data-key` its key; ViewKit's rows keep their own names (`vk-customize-section`, `-field`, `-toggle`, `-choice`).
|
|
297
|
-
- The sort editor (`sortEditor`): a rule's ⋯ `delete`; a set-aside rule's `why`, `put-back`, `delete`.
|
|
298
|
-
- The filter editor (`filterEditor`): a rule's ⋮ `convert`, `relation` (with `relation:any`, `relation:none`, `relation:every`), `delete`; a set-aside rule's `why`, `put-back`, `delete`; a group's `exclude
|
|
459
|
+
- The sort editor (`sortEditor`): a rule's ⋯ `delete`; a set-aside rule's `why`, `put-back`, `delete`; a rule's end (`row`) `delete` (×, a computer's) and `more` (⋯); its foot (`foot`) `add`, `clear`.
|
|
460
|
+
- The filter editor (`filterEditor`): a rule's ⋮ `convert`, `relation` (with `relation:any`, `relation:none`, `relation:every`), `delete`; a set-aside rule's `why`, `put-back`, `delete`; a group's `exclude`; a rule's end (`row`) `more` (⋮); a foot (`foot`) `add`, `clear`, `delete` (Delete group, or a relation's Delete condition), `more` (a group's ⋮, or the ⋮ of a filter that may exclude).
|
|
299
461
|
- The group editor (`groupEditor`): its settings `field`, `order`, `direction`, `step`, `empty`; its foot `remove`.
|
|
300
462
|
- ⋯: the folded parts' keys: `options`, `sort`, `filter`, `filters`, `filter-add`, `quick`.
|
|
301
463
|
|
|
@@ -70,7 +70,7 @@ on a frame round the controls as `data-<piece>-*`, which each control's styleshe
|
|
|
70
70
|
- `attioBox` — `attioBox(phone)`: the labelled box's own look, its computer form keeping its own size on a phone.
|
|
71
71
|
- `INLINE_INPUT_LOOKS` — the inline input's: 4 options (`edge`, `corners` from `none` to `full`, `ground`, `tint` from 10% to 100% under the tint ground) and three looks, `attio`, `mihais` (named Outright) and `tinted`. Nothing picked is the line, `md` corners, on a 20% tint, which no look matches.
|
|
72
72
|
- `InlineInputLookOptionId` — its option ids.
|
|
73
|
-
- `FIELD_LOOKS` — Field rows', the phone's: 5 options (`rows-cards`, `rows-edge`, `rows-height`, `rows-label`, `rows-lines`) and three looks, `card` (every option's default), `each` and `rows`; and a computer's field row's: `row-icon` (`on`, `off`), every look keeping it on: off (`data-field-row-icon="off"` on a section or any ancestor), each row draws its label, value and lane with no type icon, the label at the row's start.
|
|
73
|
+
- `FIELD_LOOKS` — Field rows', the phone's: 5 options (`rows-cards`, `rows-edge`, `rows-height`, `rows-label`, `rows-lines`) and three phone looks, `card` (every option's default), `each` and `rows`; one look worn on both, `attio`, below; and a computer's field row's: `row-icon` (`on`, `off`), every look keeping it on: off (`data-field-row-icon="off"` on a section or any ancestor), each row draws its label, value and lane with no type icon, the label at the row's start; and `row-box` (`target`, `box`), every look keeping today's `target`: box (`data-field-row-box="box"`), a computer's row draws one rectangle for its hover, its press, its in-place text and number input and the place a picker opens from, so its words never move and it keeps its height, no press scale; in a narrow window, outside a card, the stacked row takes the same box at rest, hovered and pressed, and its editor stays the phone's (`--vk-field-row-box-h`, `-x`, `-r`, docs/contract.md); and `row-action` (`none`, `icon`), every look keeping today's `none`: icon (`data-field-row-action="icon"`), a row outside a card shows one icon at its box's right end on the box's hover and keyboard focus, saying what a click does: `edit` where its editor opens in a popover (a select, a person, a date, several values), `expand` for a long text or a rich text, and none where the box is the input (a text, a number, one link); a binding's `action` says otherwise for its field. The icon is your `icons.edit` or `icons.expand`, 15 in a 24 square 4 in from the box's end, and the box keeps its room at its end, so a value ends there (cut with its "…" on one line) and the words never move. The lock, ⋯ and › stay in the row's lane. And `row-open` (`below`, `over`), every look keeping today's `below`: over (`data-field-row-open="over"`), on a computer every popover editor a row opens (a select, a status, a person or a record, a date, tags, a place, a name, a range, several values) stands on top of the row's box, its first line (the search, the typed date, the first value, the first box) where the value's words were, at least as wide as the box and covering it, nothing under it moving; a phone keeps its sheets (docs/contract.md, the Popover). And `row-long` (`full`, `line`), every look keeping today's `full`: line (`data-field-row-long="line"`), a row outside a card draws a writable long text or rich text as one line at rest, its end fading (never "…"), and a writable text that would wrap as one line ending in "…", so it keeps its height as it is typed in; on a computer a long text's editor opens on top of the row's box, a textarea in your `Popover` placed as `row-open: over` places a body whatever that option says, its first line where the words were, growing down over the rows below to `--vk-editor-max-h` (undeclared, 320), then scrolling, nothing under it moving; a phone keeps its box in place, and a read-only long text reads in full. And `row-link` (`beside`, `words`), every look keeping today's `beside`: words (`data-field-row-link="words"`), a writable row outside a Field rows card on a phone holding one url, email, phone or domain draws its words as the link itself (a url in a new page, an email a mail, a phone a call), and a press on the rest of its box edits it in place; the open action beside the box isn't drawn, the box (its edit button, named by the field alone) is one Tab stop and the link the next, and under `row-action: icon` its icon is `edit`; the pointer on the words keeps the box's hover and its icon (the hover ground ViewKit's own Button reads, `--button-ground`; an app's own Button shows its hover past the words). The row reads the option once it stands on the page, so a server-rendered row draws `beside` until it is alive. Under either, a long link wraps, or ends in its "…" on one line, before what stands at its box's end. And the look `attio` picks Attio's record rows whole: the card's own picks (`one`, `on`, `52`, `104`, `words`) and `row-icon: off`, `row-box: box`, `row-action: icon`, `row-open: over`, `row-long: line`, `row-link: words`. Every other look keeps today's row. An app wears it with one call on the frame round its rows, its Details section say, so every record drawer and record page changes together: `<section {...lookAttrs(FIELD_LOOKS, lookPicks(FIELD_LOOKS, "attio"))}>` (both from `viewkitjs/views/looks`). On a phone a Field rows card keeps its rows and every picker its sheet; outside a card the stacked row takes the box, the long text's one line and the link's words. Under `row-open: over` the row hands your `Popover` the offsets that put it on top of the box (a negative `sideOffset`, an `alignOffset`, and a `minWidth` in its `style`), so your own Popover passes them on to stand there.
|
|
74
74
|
- `FieldLookOptionId` — its option ids.
|
|
75
75
|
- `FieldRowsLook` — a card's own look, each option without its `rows-`.
|
|
76
76
|
- `fieldRowsAttrs` — `fieldRowsAttrs(look)`: a card's own look as its attributes.
|
|
@@ -32,7 +32,7 @@ The row of views over a list, and any row of pills: each pill is your `Pill` ato
|
|
|
32
32
|
- `ViewTabs` — one axis as plain pills on a scroll rail.
|
|
33
33
|
- `toPillOptions` — views turned into pill options: the label and count joined by `views.panels.view-count`, a slot's colours, the glyph by your `AppIcon`.
|
|
34
34
|
- `FoldingViewRow` — the saved-views row that folds what doesn't fit into a "+N" chip, never folding the active view, and closes with the + when the axis grows. Handed `folded`, as a folding toolbar line hands it, it folds that many tabs and measures nothing of its own. Where the axis hands `verbs` and your map draws `ViewMenu`, its pills and each folded view's `⋮` in the "+N" list open the view's whole menu through it (VK-947), and its + opens New view's Modal through it, in place of the axis's `onCreate` (VK-971).
|
|
35
|
-
- `ViewPicker` — the same axis as one chip naming the active view, opening your `ViewsListBody` (`CONTROLS.ViewsListBody` is ViewKit's own) in your `Popover` at the chip; on a phone (in a `Toolbar`, its phone form; elsewhere your provider's `desktopQuery`) in your `Sheet` (`snap: "auto"`, titled `views.panels.views-list`). The body is handed the views as data, a pick or an order is written once it fits the axis, its `onDone` closes the list, and on a phone it gets the ✕ (and Back on a step) as its `actions` only where your sheet's head doesn't draw it, and `onStepChange`, whose step's title and Back the sheet shows; the axis's `verbs`, where it hands them, reach it as they are ([the components map](../contract.md#the-components-map)). With no view yet it draws only the axis's +, which opens New view's Modal through your `ViewMenu` where the axis hands `verbs` and your map draws one, as the row's + does, and otherwise calls the axis's `onCreate`.
|
|
35
|
+
- `ViewPicker` — the same axis as one chip naming the active view, opening your `ViewsListBody` (`CONTROLS.ViewsListBody` is ViewKit's own) in your `Popover` at the chip; on a phone (in a `Toolbar`, its phone form; elsewhere your provider's `desktopQuery`) in your `Sheet` (`snap: "auto"`, titled `views.panels.views-list`). The body is handed the views as data, a pick or an order is written once it fits the axis, its `onDone` closes the list, and on a phone it gets the ✕ (and Back on a step) as its `actions` only where your sheet's head doesn't draw it, and `onStepChange`, whose step's title and Back the sheet shows; the axis's `verbs`, where it hands them, reach it as they are ([the components map](../contract.md#the-components-map)). With no view yet it draws only the axis's +, which opens New view's Modal through your `ViewMenu` where the axis hands `verbs` and your map draws one, as the row's + does, and otherwise calls the axis's `onCreate`. Handed `press` (`{ onPress, expanded, lit? }`: its list stands elsewhere, `ListViewsPanel`), the chip calls `onPress`, says `expanded` (`aria-expanded`, no `aria-haspopup`), lights only with `lit` and opens no list.
|
|
36
36
|
- `ViewPickerRow` — one view as a row of a list, with the active view's `⋮`; handed `viewMenu`, every row's `⋮` opens the view's whole menu through your `ViewMenu`.
|
|
37
37
|
- `ViewCreatePill` — the + that creates a view.
|
|
38
38
|
- `ViewAxes` — an axis or several on one row: one axis at the row's size folds, peer axes share one rail, each in its own track. `folded` is handed on to the one axis's `FoldingViewRow`. The axis that grows closes the row with its +, which, as every views + does (the row's, the picker's), opens New view through your `ViewMenu` where the axis hands `verbs`, else calls its `onCreate`.
|
|
@@ -67,7 +67,7 @@ The frame that holds a list's controls, and the parts that need no list settings
|
|
|
67
67
|
- `Toolbar` — the frame (one radio for its parts, or, inside a `ListRoot`, the root's). Takes `parts` (`ToolbarPart[]`), and optionally `phone`, `narrow`, `narrowBelow` (700 by default), `fold`, `more` (`ToolbarMore`, ⋯ as data: handed the folded parts' rows, each keyed by its part, and `{ line }`, `"row"` or `"bar"`, since each line folds into its own ⋯, it returns the rows ⋯ shows; a press on any of them closes ⋯ first), `overflow` (`ToolbarOverflow`, ⋯ as you draw it) and `className`. Each of its lines is a toolbar of its own (`role="toolbar"`): the filter bar (and the three forms' second line) named `views.panels.toolbar-bar` ("Sort and filters"), every other line `views.panels.toolbar-row` ("List tools"). With `fold` it draws the kit's arrangement (`/panels`' fold arrangement): the row and the filter bar under it, each a band with a line across under it (on a computer its padding, the room between its tools and the line are `--vk-toolbar-line-py`, `--vk-toolbar-line-gap` and `--vk-toolbar-line-w`, [Tokens](../contract.md)), or a phone's one line, with no narrow form; each line measures itself and gives way as it narrows (it contains its own inline size, so its width comes from where it stands and never from what its lines hold: in a holder sized from its content, a main beside a sidebar, it still gives way, with no wrapper of yours), a part's words turning to its icon (the `ToolbarButton` atom's `iconAlone`), the views folding tabs into "+N", a part's filters folding into "+N filters", then what may fold going behind ⋯ (`data-slot="vk-toolbar-overflow"`, your `Menu`, each row the folded part's `menu`). A folded part keeps its state, and what it opens hangs under ⋯; while ⋯'s menu, a folded part's panel, the views' "+N" list, a filter with a part open (`data-slot="vk-toolbar-filter-rule"` marked `data-open`), an open advanced filter (`data-slot="vk-toolbar-advanced-filter"` marked `data-open`) or "+N filters"' menu (the button in `data-slot="vk-toolbar-more-filters"`, `aria-expanded`) is open, the line holds still. The frame holds the search's open state: open, the line gives way around it, and on a phone the search takes the line beside the views.
|
|
68
68
|
- `ToolbarPart` — a part as your app hands it: a `ToolbarPlacement` (its `key`, `side`, `line`, `role`, in the fold arrangement `shed`, `tabs`, `filters` and `fold`, and `words` and `foot`), its `node`, and for a part that may fold its `menu`: `{ label, icon?, onSelect }`, its row in ⋯. `words`: `"icon"` stands a `ToolbarButton` drawn in it as its icon alone, its words given up (a button with no icon keeps them); `"both"` gives the search's button, and the quick filters' button handed `word={null}`, their word, as the look's words say; `"word"` stands one with a word as its word alone, no icon (handed `icon: null`, its word as its `children`), never turning to its icon as the line narrows (a button handed `word={null}`, a +, and New at a phone's foot keep their glyph); absent, each its own. `foot: false` keeps New on a phone's folding line instead of at the list's foot.
|
|
69
69
|
- `ToolbarSeparator` — the line between the sort and the filters on a filter bar (or Filter while there is none), placed with `role: "separator"`: drawn only while a part stands drawn on each side of it, and never on a phone's line.
|
|
70
|
-
- `ToolbarViews` — the views row: `views` (`CollectionViewsInput`) and `viewsLayout`. On the row and in the narrow panel it draws `ViewAxes`, or with `as="picker"` and one axis alone its `ViewPicker`; placed again with `stacked` on the second line, it draws the axes a stacked layout pushes beneath, small. On the phone it draws a `ViewPicker` per axis, every axis, and nothing for `stacked`. With `showCounts` the toolbar owns Show counts (`withCounts`). Place it only when the list has views: the phone's search fills the row when nothing is placed at the start.
|
|
70
|
+
- `ToolbarViews` — the views row: `views` (`CollectionViewsInput`) and `viewsLayout`. On the row and in the narrow panel it draws `ViewAxes`, or with `as="picker"` and one axis alone its `ViewPicker`; placed again with `stacked` on the second line, it draws the axes a stacked layout pushes beneath, small. On the phone it draws a `ViewPicker` per axis, every axis, and nothing for `stacked`. With `showCounts` the toolbar owns Show counts (`withCounts`). Place it only when the list has views: the phone's search fills the row when nothing is placed at the start. `press` goes to its picker (one axis as `as="picker"`, on a computer).
|
|
71
71
|
- `ToolbarSearch` — the search, placed with `role: "search"`: `value`, `onChange`, `placeholder` (`views.panels.search` by default) and `searching` (while true, a spinner, worded `views.panels.searching`, stands where its glass is, on the button and in the field, and the field, marked `aria-busy`, keeps its value and its typing; your app decides when it is true). On the row, and beside the phone's views, a button that opens an inline field; in the narrow panel, and on a phone with no views, a field that fills its line. A field that holds a value shows from the start. Escape and its ✕ clear it and close a field the button opened; a blur with nothing typed closes it. The field is your `Input`, or, handed `SearchField` in your components map, your whole search box: it stands in place of the glass, the field and the ✕, handed the value, the clear and its form, while the button, the open state, the caret on a press, Escape and a blur stay ViewKit's ([the components map](../contract.md#the-components-map)). Shut, its button is its glass alone, reading "Search" beside it only where its part is placed `words: "both"`, as the look's words say.
|
|
72
72
|
- `ToolbarNew` — the +: `onAdd` (one way to add, the button fires it) or `items` (several, opened through your `Menu`, one of the toolbar's panels), `label` (`views.panels.toolbar-new` by default) and `icon` (your `add` glyph by default); its word for a dress is its label. With neither, the row draws it disabled, so its place never moves; the narrow panel and the phone draw nothing. In a folding `Toolbar` on a phone it stands at the list's foot instead (`data-at="foot"`): a round + (the atom's `foot`) fixed at the screen's bottom-end corner, over the list, lifted by `--vk-toolbar-foot`, and drawn into the document's body so a page that scrolls inside a transformed box can't carry it away; with no verb, nothing there.
|
|
73
73
|
- `ToolbarButton` — the `ToolbarButton` atom at the size of the line it stands in, for a custom part's buttons.
|
|
@@ -133,9 +133,9 @@ Options, Sort and Filter each open their panel from their own button, and each t
|
|
|
133
133
|
|
|
134
134
|
- `ToolbarOptions` — Customize behind its own button, named and worded `views.panels.toolbar-options`: the builder's `filters`, `sort`, `group` and `layout` (and its `filterTree`, with and/or groups: its count and default Clear then read the advanced filters), your `toggles`, `timeScopeConfig` and `dateRangeConfigs` (a `ViewOptionInputs`), and optionally `view` (a shared view: the drift dot on the button instead of a count, and the panel's footer), `fieldEditor`, `foldFilters` (true by default), `onClear` (the ✕ and the panel's Clear all; by default each active option cleared through its own `onChange`, the builder's filter rows adding up so every filter clears, or Reset on a shared view; for one change, `settingsCleared(…, "options")`), `widthClassName` (`w-75` by default: 300 px, the Pane Customize was designed in), `host`, and what your `CustomizeBody` draws only where you hand it: `viewName` with `onRenameView` (the view's name, renamed in place), `onCopyLink`, and `onExport` with `exportCount` (what it takes, in words). On a phone, while your body stands on a level of its own inside a section (`onStepChange`), the sheet's Escape goes back a level instead of closing. Its button counts the active options (`countActiveViewOptions`) with a ✕ that clears them. Draws nothing when there is nothing to customize. A `CustomizeBody` in your components map opens in place of the panel, in the same popover, `host` or phone `Sheet`.
|
|
135
135
|
- `ToolbarSort` — the sort panel behind its own button, named `views.panels.sort`: the builder's `sort`, lit while the list sorts other than its default, or, handed `changed`, as that says (the ready toolbar hands it while the sort differs from the saved view). Draws nothing when nothing sorts. Handed `bar`, it is the one-rule sort on the filter bar, as a several-sorts list's pill reads there: "Sorted by **Name**" (`views.panels.sorted-by` and the sort's field), in the bar's sort place (`data-slot="vk-toolbar-sort-pill"`), opening the same panel. Handed the builder's `sorts` too (with `severalSorts`), it is Sort on the row's right as the kit draws it there: "Sort", counted once there are two rules, opening the fields (`SortFieldList`), a pick adding a rule at the end, ascending; at three it can't be used, saying why (`views.panels.sort-max`).
|
|
136
|
-
- `ToolbarSortPill` — the sort as up to 3 rules, the kit's sort on its filter bar, in `data-slot="vk-toolbar-sort-pill"`: takes the builder's `sorts`, and optionally `open` and `onOpenChange` (to hold its state yourself), `host` and `addAfter` (default true). On a computer, "Sorted by" its first rule's field, in weight, with the rest counted (+1), opening the sort editor in your `Popover`; after it a + (`data-slot="vk-toolbar-sort-add"`, named `views.panels.sort-add-one`) while there are fewer than three, opening the fields, a pick adding a rule; with no rule, an empty place, "Sort", opening the fields. Handed `addAfter={false}` (the kit's bar), it draws no +, and its editor, or your `SortBody` (handed `addSort`), has Add sort at its foot. Handed `row`, it is Sort on a toolbar row (`data-slot="vk-toolbar-sort-row"`, as `ReadyToolbar`'s default stands it): its word "Sort", lit while a rule stands (handed `changed`, lit by it instead, on the row and as a pill: the ready toolbar hands it while the sort differs from the saved view) and counted from two; however it opens (a press, or ⋯ when it folded) it shows the sort editor, Add sort at its foot, while a rule or a set-aside sort stands, else the fields; it draws no + and `addAfter` means nothing to it. The fields are your `FieldsBody`. × on the editor's last rule closes it
|
|
137
|
-
- `SortEditorHost` — the host of your sort body alone, for a holder of your own (a popover; ViewKit's own body is `SortEditor`, on `viewkitjs/views/controls`): `sorts`, `form` (`"computer"` or `"phone"`), and optionally `open`, `onDone
|
|
138
|
-
- `useSortEditorHost` — the sort editor's state for a sheet's holder (`SortEditorOptions`: `sorts`, `form`, `open`, `onDone`, `addSort`): `{ body, head, title, escapeBack }`. `body(closeButton)` draws your `SortBody`, on a phone handed `head` as its `actions` when `closeButton` is true (no head of your sheet draws them: your provider's `sheetActions` is `bar`, or a host of yours holds it); `head` is the ✕ (named `views.panels.close`) and ✓ (`views.panels.sort-done`) for your sheet's head, as its `actions`. ✕ takes the rules back, in one change, to what they were when `open` last turned true; the body's `onDone` calls the `onDone` you hand ([the components map](../contract.md#the-components-map)). On a phone the body is also handed `onStepChange`: while it stands on a step of its own, `title` is the step's (your sheet's title in place of the sort's), `head` gains `back` (Back, for `close`'s place), and `escapeBack()` goes back a step and says it did, so your sheet's Escape calls it first and closes only when it returns false.
|
|
136
|
+
- `ToolbarSortPill` — the sort as up to 3 rules, the kit's sort on its filter bar, in `data-slot="vk-toolbar-sort-pill"`: takes the builder's `sorts`, and optionally `open` and `onOpenChange` (to hold its state yourself), `host` and `addAfter` (default true). On a computer, "Sorted by" its first rule's field, in weight, with the rest counted (+1), opening the sort editor in your `Popover`; after it a + (`data-slot="vk-toolbar-sort-add"`, named `views.panels.sort-add-one`) while there are fewer than three, opening the fields, a pick adding a rule; with no rule, an empty place, "Sort", opening the fields. Handed `addAfter={false}` (the kit's bar), it draws no +, and its editor, or your `SortBody` (handed `addSort`), has Add sort at its foot. Handed `row`, it is Sort on a toolbar row (`data-slot="vk-toolbar-sort-row"`, as `ReadyToolbar`'s default stands it): its word "Sort", lit while a rule stands (handed `changed`, lit by it instead, on the row and as a pill: the ready toolbar hands it while the sort differs from the saved view) and counted from two; however it opens (a press, or ⋯ when it folded) it shows the sort editor, Add sort at its foot, while a rule or a set-aside sort stands, else the fields; it draws no + and `addAfter` means nothing to it. On the row, `empty="editor"` shows the sort editor with nothing set too, saying so with Add sort (your `SortBody` handed `empty`), staying open as its last rule goes; `fieldsOnly` opens the fields every time, a sort standing or not (a placed `ListSort`'s `opens="bar"`). The fields are your `FieldsBody`. × on the editor's last rule closes it, unless the row was handed `empty="editor"`. On a phone, "Sort" with its rules counted, opening the sort editor in your `Sheet`, its ✕ taking back what changed since it opened and its ✓ keeping it; a swipe, the dim or Escape close it and keep the changes; while your `SortBody` stands on a step of its own (`onStepChange`), Escape goes back a step instead, and under `sheetActions: "head"` your sheet's head shows the step's title. Its popovers, or its sheet, are one of the toolbar's panels.
|
|
137
|
+
- `SortEditorHost` — the host of your sort body alone, for a holder of your own (a popover; ViewKit's own body is `SortEditor`, on `viewkitjs/views/controls`): `sorts`, `form` (`"computer"` or `"phone"`), and optionally `open`, `onDone`, `addSort` (Add sort at a computer's body's foot, for a holder with no + of its own) and `empty` (`"editor"`: with no rule, your body says nothing sorts yet, VK-1091). It opens your `SortBody` (`CONTROLS.SortBody` is ViewKit's own), handed the rules as data, its whole list written once it fits the rules; every change goes out through `sorts.onChange` as it is made.
|
|
138
|
+
- `useSortEditorHost` — the sort editor's state for a sheet's holder (`SortEditorOptions`: `sorts`, `form`, `open`, `onDone`, `addSort`, `empty`): `{ body, head, title, escapeBack }`. `body(closeButton)` draws your `SortBody`, on a phone handed `head` as its `actions` when `closeButton` is true (no head of your sheet draws them: your provider's `sheetActions` is `bar`, or a host of yours holds it); `head` is the ✕ (named `views.panels.close`) and ✓ (`views.panels.sort-done`) for your sheet's head, as its `actions`. ✕ takes the rules back, in one change, to what they were when `open` last turned true; the body's `onDone` calls the `onDone` you hand ([the components map](../contract.md#the-components-map)). On a phone the body is also handed `onStepChange`: while it stands on a step of its own, `title` is the step's (your sheet's title in place of the sort's), `head` gains `back` (Back, for `close`'s place), and `escapeBack()` goes back a step and says it did, so your sheet's Escape calls it first and closes only when it returns false.
|
|
139
139
|
- `SortEditorOptions` — what `useSortEditorHost` takes.
|
|
140
140
|
- `ToolbarQuickFilters` — the quick filters' button (`data-slot="vk-toolbar-quick"`), named `views.panels.quick-filters` (or the config's `label`), lit (`changed`) while a value is held: takes `quickFilters` (a `QuickFiltersConfig`, [`/panels`](./panels.md#quick-filters)), and optionally `open` and `onOpenChange` (to hold its state yourself), `host`, `icon` (its glyph; the `filterCategory` icon when absent) and `word` (`null`: its icon alone, its name its label to a screen reader, as `ReadyToolbar`'s default draws it on a computer, unless its part is placed `words: "both"`). It opens your `QuickFiltersBody` (through `QuickFiltersPanel`) in your `Popover` (`data-slot="vk-toolbar-quick-panel"`), in `host` (on a computer under the panels' header, its name and ✕, since a host draws no head), or on a phone in your `Sheet`, and is one of the toolbar's panels. With no field to offer it draws nothing.
|
|
141
141
|
- `QuickFiltersPanel` — the quick filters' panel alone, for a holder of your own: `quickFilters`, `form` (`"computer"` or `"phone"`), and optionally `onDone`, `closeButton` (false where your sheet's head draws the ✕) and `inHost` (it stands in a host of yours that draws no head: on a computer, the panels' header over it, its name and its ✕). It opens your `QuickFiltersBody` (`CONTROLS.QuickFiltersBody` is ViewKit's own), handed the fields as the strip shows them (`quickFieldsShown`) with their values as they show (`quickValuesShown`, worded by the config's `heldLabels`), and writes its hold once `quickHoldFits` takes it; on a phone the body gets the ✕ as its `actions` when `closeButton` is true ([the components map](../contract.md#the-components-map)).
|
|
@@ -144,7 +144,7 @@ Options, Sort and Filter each open their panel from their own button, and each t
|
|
|
144
144
|
- `ToolbarAdvancedFilters` — the advanced filters' pills, with and/or groups (`data-slot="vk-toolbar-advanced-filter"`): takes the builder's `filterTree`, and optionally `host`. One pill for each advanced filter (each group at the filter's top, or the whole of a top joined by Or), "Advanced filter" with its rules counted (one whose rules are all set aside drawn set aside instead, the button's `aside` with no count, naming why in your `Tooltip`: `views.panels.advanced-filter-set-aside`), its words kept however tight the row, opening the filter editor on its own rules in your `Popover` (`data-slot="vk-toolbar-advanced-filter-panel"`) or in `host`. A pill whose filter empties leaves the row; the others keep their own state. Each is one of the toolbar's panels; in a folding line its place carries `data-open` while it is open, so the line holds still. On a phone it draws nothing.
|
|
145
145
|
- `ToolbarFilters` — each filter on a filter bar, as the kit's draws them (`data-slot="vk-toolbar-filters"`): takes the builder's `filterTree` (with `filterGroups`), and optionally `open` and `onOpenChange` (whether Filter and + list the fields: hold it to open them from ⋯), `held` and `onHeldChange` (the rule held until whole: hold it to count it as the bar folds), `host`, and `saved` (the saved view's filter: its own top-level items stand in Customize, not on the bar, an edited one standing as edited; every write is still the whole filter's). Every filter at the view's own level, in its order: a filter as four joined parts (`data-slot="vk-toolbar-filter-rule"`, named by its sentence), its field, how it compares in lower case, its value (capped at 240 and cut with "…", saying what it waits for until it is picked) and ⋯ (Convert to advanced filter, Delete filter), each opening its own list; a related record's field drawn as one ("Company › Industry"); an advanced filter as its pill (`ToolbarAdvancedFilters`'); then + (`data-slot="vk-toolbar-filter-add"`, `views.panels.filter-add-one`). Filter, + and a filter's field open your `FieldsBody`, its way and value your `FilterPartBody` ([the components map](../contract.md#the-components-map)); their lists show a column the list can't filter greyed with its reason, in its place, never picked (`filterTree.listed`). A filter whose one value is a key your app hasn't named (a person after a reload) asks that field's `onValuesWanted` once (a related record's field, `farValues.onWanted`), and draws the name once you hand the value in `knownValues` and its name in `knownLabels`. While nothing filters and nothing is held, Filter, an empty place (`data-slot="vk-toolbar-filter"`); handed `emptyPlace={false}`, where Filter stands on the row (`ToolbarFilterAdd`), nothing at all until a filter is set or held. Filter and + open the fields; a pick adds a filter at the end (`addOnBar`, wrapping a top joined by Or into one advanced filter first), a related record's field among them, waiting for its value, or, for a yes/no, the list's own or a related record's, holds it on the bar saying what it waits for, writing nothing until its value is picked; where nothing more can be added they are disabled with why (`barAddRefusal`). With no field a rule may name (every column one the list can't filter: `filterTree.fields` empty), neither Filter nor + stands: a set-aside filter still does. In a folding line its last filters fold into "+N filters" (`data-slot="vk-toolbar-more-filters"`, as its slot's `filtersFolded` says), which names each and opens what a pick opens under itself; a held rule, the filter it stands in place of and a filter with a part open never fold. Each filter and "+N filters"' menu is one of the toolbar's panels. Delete filter and Convert move the focus to what stands after the filter: the next filter, "+N filters", + or Filter, or, where Filter stands on the row's right and nothing is left on the bar, that Filter (`ToolbarFilterAdd`). An app placing it in a `Toolbar` of its own places it with `filters: foldableFilters(…)` and never with `shed` while a filter stands: its parts read the slot's `iconAlone`, and would draw no words. A held rule is compared with the tree as written, so your `filterTree.onChange` must hand the tree back unchanged (the same keys in the same order), or the held rule counts as dropped by a write from elsewhere. On a phone it draws nothing.
|
|
146
146
|
- `foldableFilters` — how many of the bar's filters may fold, for its placement's `filters`: `(tree, held, saved?)`, the tree's top-level items less the one a held rule stands in place of, and less the saved filter's own where `saved` is handed; a held rule no longer standing (`held`'s tree changed by a write from elsewhere) counts as gone.
|
|
147
|
-
- `ToolbarFilterAdd` — Filter on a toolbar row's right (`data-slot="vk-toolbar-filter-add-row"`, named `views.panels.filter`), as `ReadyToolbar` stands it by default: takes the builder's `filterTree`, and optionally `onHeldChange` (hand the toolbar's held rule's writer, the one you hand `ToolbarFilters`, so a yes/no it holds stands on the bar), `open` and `onOpenChange`, `host`, `changed` (lit: the ready toolbar hands it while the filter differs from the saved view), and `opens` (`"fields"`, the default, or `"filters"`: the whole filter editor, your `FilterBody` on every rule of the view, edited as Customize's Filter edits it, in a panel as wide as the editor; the ready toolbar hands `"filters"`). With the fields, it opens them as Filter on the bar does (your `FieldsBody`), and a pick adds a filter at the bar's end and opens nothing else, or holds a yes/no until its value is picked, which `ToolbarFilters` takes in as its own; where nothing more can be added it is disabled with why. It is one of the toolbar's panels. On a phone, or with no fields, it draws nothing.
|
|
147
|
+
- `ToolbarFilterAdd` — Filter on a toolbar row's right (`data-slot="vk-toolbar-filter-add-row"`, named `views.panels.filter`), as `ReadyToolbar` stands it by default: takes the builder's `filterTree`, and optionally `onHeldChange` (hand the toolbar's held rule's writer, the one you hand `ToolbarFilters`, so a yes/no it holds stands on the bar), `open` and `onOpenChange`, `host`, `changed` (lit: the ready toolbar hands it while the filter differs from the saved view), and `opens` (`"fields"`, the default, or `"filters"`: the whole filter editor, your `FilterBody` on every rule of the view, edited as Customize's Filter edits it, in a panel as wide as the editor; the ready toolbar hands `"filters"`), and with `"filters"`, `empty` (`"fields"`, the default, or `"editor"`: with nothing filtered, the editor saying so with Add filter, your `FilterBody` handed `empty`, staying open as its last rule goes). With the fields, it opens them as Filter on the bar does (your `FieldsBody`), and a pick adds a filter at the bar's end and opens nothing else, or holds a yes/no until its value is picked, which `ToolbarFilters` takes in as its own; where nothing more can be added it is disabled with why. It is one of the toolbar's panels. On a phone, or with no fields, it draws nothing.
|
|
148
148
|
- `Pending` — the rule held until whole, as `ToolbarFilters` hands it to `onHeldChange`: its `container`, its `node`, the filter it `replaces`, and what it was held `over`.
|
|
149
149
|
- `FilterEditorHost` — the host of your filter body on a computer (ViewKit's own body is `FilterEditor`, on `viewkitjs/views/controls`): `filterTree`, `at` (the advanced filter's path: a group's, or `[]` for a top joined by Or), and optionally `onDone` (its filter emptied) and `onRemoved` (a delete took a node away: the outermost that went). It opens your `FilterBody` (`CONTROLS.FilterBody` is ViewKit's own), handed the level it stands on as data, its whole level written once it fits the rules, its `onDone` calling the `onDone` you hand ([the components map](../contract.md#the-components-map)). The first edit in a top joined by Or wraps it into one advanced filter. At a top-level relation rule (`at` `[i]`) it edits the relation wrapped in a group of its own; where that would pass 3 levels, it edits the relation in place, the body handed the relation. Every change goes out through `filterTree.onChange` as it is made.
|
|
150
150
|
- `FilterFieldList` — the fields a rule names: `fields`, `onPick(field, far?)`, and optionally `own`, `relations` (false leaves a relation's far fields out), `onDone` (done with no pick) and `form`. It opens your `FieldsBody` (`CONTROLS.FieldsBody` is ViewKit's own), in every holder, handed the list's own fields and, where `relations`, each relation with its `far` fields, each marked as the grid's header marks its column; a pick of a key it didn't offer, or a column the list can't filter, writes nothing ([the components map](../contract.md#the-components-map)).
|
|
@@ -155,7 +155,7 @@ Options, Sort and Filter each open their panel from their own button, and each t
|
|
|
155
155
|
- `ToolbarPanelState` — what `useToolbarPanelState` returns.
|
|
156
156
|
- `FilterPanelContent` — the Filter panel standing alone, for a host of your own: the filter list at its root (titled `views.panels.filter`, no back arrow) and the pages it opens, with `filters`, `timeScopeConfig`, `dateRangeConfigs`, `page`, `onPageChange`, `onClose` and `fill`.
|
|
157
157
|
- `ToolbarSave` — Clear and Save, at the end of a filter bar while the list differs (`data-slot="vk-toolbar-save"`): takes `view` (a `CollectionViewState`: Clear is its `onReset`, Save its `onPublish`, shown only where `canPublish`, both waiting while `pending`, nothing while `changes` is 0 unless `layered`, the reader's own layer holding something, when Clear stands alone to empty it), or with no shared view `onClear`, Clear alone taking the list back to its default; nothing when neither has anything to do. Clear has no ground and Save wears the field's look, each your `Button`. `only` (`"clear"` or `"save"`) draws that one button alone, with no `vk-toolbar-save` box around it, as the ready toolbar draws each where an app places Clear and Save apart.
|
|
158
|
-
- `ReadyToolbar` — the toolbar for an app that doesn't arrange its own (`ReadyToolbarProps`): the builder's input (`settings`, `layer`, `columns`, `onChange`, `onLayerChange` and the rest of `SettingsPanelsInput`), and optionally `views`, `viewsLayout`, `onAdd` or `addItems` and `addLabel`, `view`, `toggles`, `fieldEditor`, `searchPlaceholder`, `searching` (handed to its search), `hosts` (`{ options, sort, filter, quick }`), `customizeIn` (`"popover"` by default; `"pane"`: on a computer Customize opens in your map's `Pane`, `CONTROLS.Pane`, at the right edge of `paneBox`, under the toolbar and as tall as the list, the list in use beside it; on a phone its Sheet either way; a map with no `Pane`, or your own `hosts.options`, keeps theirs) and `paneBox` (the list's box the Pane stands in: positioned, holding the grid under the toolbar, never scrolling itself; null until it is on the page; not handed, the popover), `quickFilters` (a `QuickFiltersConfig`: handed, the quick filters' button stands on the row's end before the search, in the row arrangement before Options, folding into ⋯ as the row narrows; its counts follow the toolbar's Show counts unless the config carries its own `showCounts`), `quickFiltersOpen` with `onQuickFiltersOpenChange` (the quick filters' panel open, held by you, so a `QuickFiltersReminder` at your list's foot can open it; absent, the toolbar holds it), `phone`, `narrow`, `severalSorts` (true by default: the sort holds up to 3 rules, the row's Sort opening the sort editor on them, or in the old form the sort pill on the bar; `false` keeps Sort's one rule, which opens its own list whether or not a sort stands), `addAfter` (true by default: the + after the sort pill; `false` draws none, and the pill's editor, or your `SortBody`, has Add sort at its foot, as `ToolbarSortPill`'s), `filterGroups` (true by default: and/or groups, each filter on the filter bar on a computer, in the row arrangement each advanced filter's pill after Filter and Convert to advanced filter on a filter's page, and on a phone Filter opening the filter editor on every rule; `false` keeps Filter, counting what is applied, in either arrangement), `arrangement` (`"kit"` by default, or `"row"`), `sortFilter` (`"right"` by default, or `"bar"`), `bar` (`"added"` by default, or `"always"`: with Sort and Filter on the row's right, the bar then always shows, its empty Sort and Filter included), `viewName`, `onRenameView`, `onCopyLink`, `onExport` and `exportCount` (handed on to Customize, as `ToolbarOptions` takes them), `menus` (`ToolbarMenus`: a view's menu, New's, ⋯, Customize's rows and the sort, filter and group editors' menus as data), `toolbarParts` (`ToolbarParts`: where each part stands, every form's parts handed as data and drawn as you hand them back, [`/list`'s Parts as data](./list.md#parts-as-data)), `overflow` (`ToolbarOverflow`: ⋯ as you draw it where the parts don't fit), `moreViews` (`ToolbarMoreViews`: the views row's "+N" as you draw it) and `className`. It calls the builder and draws its parts in the kit's arrangement (`Toolbar`'s `fold`
|
|
158
|
+
- `ReadyToolbar` — the toolbar for an app that doesn't arrange its own (`ReadyToolbarProps`): the builder's input (`settings`, `layer`, `columns`, `onChange`, `onLayerChange` and the rest of `SettingsPanelsInput`), and optionally `views`, `viewsLayout`, `onAdd` or `addItems` and `addLabel`, `view`, `toggles`, `fieldEditor`, `searchPlaceholder`, `searching` (handed to its search), `hosts` (`{ options, sort, filter, quick }`), `customizeIn` (`"popover"` by default; `"pane"`: on a computer Customize opens in your map's `Pane`, `CONTROLS.Pane`, at the right edge of `paneBox`, under the toolbar and as tall as the list, the list in use beside it; on a phone its Sheet either way; a map with no `Pane`, or your own `hosts.options`, keeps theirs) and `paneBox` (the list's box the Pane stands in: positioned, holding the grid under the toolbar, never scrolling itself; null until it is on the page; not handed, the popover), `quickFilters` (a `QuickFiltersConfig`: handed, the quick filters' button stands on the row's end before the search, in the row arrangement before Options, folding into ⋯ as the row narrows; its counts follow the toolbar's Show counts unless the config carries its own `showCounts`), `quickFiltersOpen` with `onQuickFiltersOpenChange` (the quick filters' panel open, held by you, so a `QuickFiltersReminder` at your list's foot can open it; absent, the toolbar holds it), `phone`, `narrow`, `severalSorts` (true by default: the sort holds up to 3 rules, the row's Sort opening the sort editor on them, or in the old form the sort pill on the bar; `false` keeps Sort's one rule, which opens its own list whether or not a sort stands), `addAfter` (true by default: the + after the sort pill; `false` draws none, and the pill's editor, or your `SortBody`, has Add sort at its foot, as `ToolbarSortPill`'s), `filterGroups` (true by default: and/or groups, each filter on the filter bar on a computer, in the row arrangement each advanced filter's pill after Filter and Convert to advanced filter on a filter's page, and on a phone Filter opening the filter editor on every rule; `false` keeps Filter, counting what is applied, in either arrangement), `arrangement` (`"kit"` by default, or `"row"`), `sortFilter` (`"right"` by default, or `"bar"`), `bar` (`"added"` by default, or `"always"`: with Sort and Filter on the row's right, the bar then always shows, its empty Sort and Filter included), `viewName`, `onRenameView`, `onCopyLink`, `onExport` and `exportCount` (handed on to Customize, as `ToolbarOptions` takes them), `menus` (`ToolbarMenus`: a view's menu, New's, ⋯, Customize's rows and the sort, filter and group editors' menus as data), `toolbarParts` (`ToolbarParts`: where each part stands, every form's parts handed as data and drawn as you hand them back, [`/list`'s Parts as data](./list.md#parts-as-data)), `overflow` (`ToolbarOverflow`: ⋯ as you draw it where the parts don't fit), `moreViews` (`ToolbarMoreViews`: the views row's "+N" as you draw it) and `className`. It calls the builder and draws its parts in the kit's arrangement: the list's own parts ([`/list`'s buttons](./list.md)) in `ListLine`s, folding as `Toolbar`'s `fold` does; `arrangement: "row"` keeps `Toolbar`'s own frame. By default, on a computer, one row at rest: the views with Customize beside them, then on its right Sort and Filter with their words, the quick filters' button and the search, each its icon alone, and New. The toolbar shows only what differs from the saved view (the open view's `saved`, or with no view the list's defaults; a view handed without `saved` keeps the older lighting, lit while a sort stands, the bar for every filter). Sort holds the sort (`ToolbarSortPill`'s `row`): lit while it differs, counted from two, it opens the sort editor to change or remove the rules, Add sort at its foot; with none, the fields. Filter (`ToolbarFilterAdd`, `opens="filters"`), lit while the filter differs, opens the view's filters, editable, with Add filter under them, as Sort opens its rules (with no filter, the editor's fields); the bar's + adds one filter to the bar. Under the row the filter bar, a step smaller, holds what changed: it comes while the sort or the filter differs, a filter is held (or one of its parts is open), or a second axis of views stands there, holding the changed sort ("Sorted by", a list with one sort's included: `ToolbarSort`'s `bar`), the filters that aren't the saved view's own (an edited one as edited; each as below, + after the last, no empty Filter) and Clear and Save at its end. Something taken away (a saved rule removed) brings Clear and Save alone. Customize's foot holds Reset and Save too while anything differs, the bar standing or not (on a shared view Customize also carries its dot), as on a phone. Each of the row's Sort and Filter is a panel of its own, apart from the bar's, so a press opens one list. `sortFilter: "bar"` with `bar: "always"` draws the kit arrangement's old form: the row, the views with Customize beside them and the search and New at its end, and under it the filter bar, always shown, a step smaller: the sort pill first, a separator, the filters (`ToolbarFilters`: each filter as its four joined parts, each advanced filter's pill, + after the last; while there is none, Filter, an empty place; the rule held until whole is held by the toolbar, so the bar counts it as it folds; with `filterGroups` false, Filter as before, with what is applied counted), and at its end Clear and Save (`ToolbarSave`) while the list differs: on a shared view (`view`) Clear takes it back and Save, where `canPublish`, keeps it for everyone; with no shared view, Clear alone takes the list back to its default (nothing filtered, the default sort, no group: so a list that starts grouped or filtered shows Clear at once); Customize's foot then draws neither. A row with no room folds as the kit's does (words to icons, the view tabs into "+N", the bar's last filters into "+N filters", then into ⋯: by default Customize and the row's Sort and Filter, whatever is set; in the old form Customize, and the sort and Filter while no filter stands), with no narrow form. On a phone one line in either form (the views, the sort, Filter, the quick filters' button when handed, Customize, then the search, which opens across the line), Clear and Save in Customize's foot (`views.panels.view-clear`, `views.panels.view-save`; with no shared view, Clear alone), and New a round + at the list's foot, lifted by `--vk-toolbar-foot`. `arrangement: "row"` draws the order of 12 Nov instead: the views on the left; search, sort, filter, options and new on the right, the narrow form under 700px, and Reset and Save for everyone in Customize's foot. Every change comes back as a `ListSettingsChange` or a layer patch: its search writes the settings' search, its ✕s clear in one change (`settingsCleared`), and the active view's menu gains "Edit view…" (`withEditView`), which opens Customize. It is a `ListRoot` around `ListToolbar` ([`/list`](./list.md)): its panels' state is held in that root, above its frame, so a change of form keeps a panel open on its page, in a sheet once the form is the phone's. Show counts is the view's: read from `settings.showCounts` for the views row and the quick filters, absent meaning on, it joins Customize's toggles where the views carry counts and is written back through `onChange`. Group steps aside on a board (`groupShown`).
|
|
159
159
|
- `ReadyToolbarProps` — what `ReadyToolbar` takes.
|
|
160
160
|
- `ToolbarParts` — `ReadyToolbar`'s and `ListToolbar`'s `toolbarParts`: `(parts: ToolbarPartPlace[], ctx: ToolbarPartsContext) => ToolbarPartPlace[]`, handed the form's parts in the order they are placed and handing back the parts drawn, in their order. The rules and an example are [`/list`'s Parts as data](./list.md#parts-as-data).
|
|
161
161
|
- `ToolbarPartPlace` — a part's place: `{ key, line, side, words, node?, className?, button?, panel? }`: its public key, its line (`"row"`, `"bar"`, or `"foot"`, New's place at a kit phone list's foot), its side (`"start"` or `"end"`), its words (`"both"`, `"icon"` or `"word"`, its word alone), `node` for a part of your own under a key of your own, and its look: `className`, put on every toolbar button the part draws, and `button`, your own button drawn for each of them in place of your `ToolbarButton`, handed the same props (`ref` included: put it on your button); and `panel` (`ToolbarPanelPlace`), where what it opens hangs at its button. [`/list`'s Parts as data](./list.md#parts-as-data) lists each place's buttons and what stays fixed.
|
|
@@ -32,7 +32,7 @@ The primitives your app hands in, modelled on Base UI's shapes: a controlled `op
|
|
|
32
32
|
- `ViewsResolvedComponents` — the map as `useViews()` hands it on: yours, with `Input` always there, your own or the plain one, and `Calendar` always there, yours or a stand-in that throws an error naming the slot when it is reached.
|
|
33
33
|
- `ViewsButtonProps` — a button: its `children`, `onClick`, `disabled`, a `variant` (`default`, `secondary`, `ghost`, `outline`, `destructive`; `secondary` only for the views picker's chip), a `size` (`default`, `sm`, `icon`), its `type`, a class, `aria-label` and `title`; and a `ref`, `tabIndex`, `aria-haspopup`, `aria-expanded`, `data-slot` and `data-open`, which the grid hands its own buttons: forward each to your element; and `aria-disabled`, which a field row's edit target is handed while its write is pending; and `aria-pressed`, `role`, `aria-selected`, `data-state` and `data-vs-row`, which the panels' own buttons are handed (the new-line mark, a view's row in the picker, the views row's chips and a view's ⋯, Export); and `data-key`, which one of a part that repeats, beside its `data-slot`, inside the sort and filter panels under `panelControls`. There a ViewKit part may hand it more props than these (a tooltip's handlers, a `data-*` the panel finds it by again): forward the rest to your element.
|
|
34
34
|
- `ViewsPopoverProps` — a popover opened at an `anchor`, controlled by `open` and `onOpenChange`, placed by `side`, `align`, `sideOffset` and `alignOffset`; its `label`, where ViewKit names it (a panel's popover under `panelControls`), is its name to a screen reader, your popup's `aria-label`.
|
|
35
|
-
- Focus: `initialFocus` false keeps focus where it was when the popup opens, for an editor that focuses its own input (with `preventScroll`). Default true.
|
|
35
|
+
- Focus: `initialFocus` false keeps focus where it was when the popup opens, for an editor that focuses its own input (with `preventScroll`). Default true. `finalFocus` false moves no focus as it closes, for what hands the focus back itself (a field row's editor, to its row): forward it to your popup's return of focus. Default true.
|
|
36
36
|
- Vetoes: `onOutsidePress` is handed the pointer press, its `target` where it landed, and returns `false` to keep the popup open, also against the focus that press moves; focus leaving by keyboard closes without asking. `onEscape` does the same for Escape.
|
|
37
37
|
- Look: `chrome` is `panel` (your card popover, the default) or `menu` (your menu panel's surface, for a popover that holds a list: no inset, no card width). `onPanelClick` takes a click inside the popup, `panelData` sets `data-*` attributes on it, and `style` carries what a class cannot say, such as a width that follows a cell.
|
|
38
38
|
- `ViewsPortsHostProps` — what the components map's `PortsHost` is told: `toast` and `confirm` (which ports the app left out) and `onReady` (hand it the ports once they stand).
|
|
@@ -58,11 +58,11 @@ The primitives your app hands in, modelled on Base UI's shapes: a controlled `op
|
|
|
58
58
|
- `ViewsLinkRole` — `{ value, label, archived? }`: a role a link may hold, as a links body offers it.
|
|
59
59
|
- `ViewsTextBodyProps` — a whole body for a field typed as one string your app draws: `label`, `kind` (`text`, `url`, `domain`, `email`, `phone` or `rich_text`), `paragraph`, `value` and `onValueChange` (the whole text, every change as it is made), `onDone` (closes as Enter does), `check` (a value's reason, or null), `region` (a phone's country), `typed`, `autoFocus`, `form` (`phone`: draw no ✕, ✓ or Cancel of your own) and `place` (`cell` in a grid cell, `row` in a field row, where it stands in the row's flow; absent, `cell`), and, in the phone's sheet, `onStepChange` (a `ViewsBodyStep` while it stands on a step of its own, `null` once back). The editor keeps the draft, Tab, Escape, ⌘ or Ctrl Enter, the close's tidy, the write check, the save and the phone's ✕ and ✓.
|
|
60
60
|
- `ViewsNumberBodyProps` — a whole body for a number, money or a percent your app draws: `label`, `kind` (`number`, `money` or `percent`), `value` (a number, `null` empty, `NaN` unreadable) and `onValueChange` (the number and, when it is one of `units`, the unit; every change as it is made), `unit` and `units`, `onDone` (closes as Enter does), `check` (a value's reason, or null), `decimals`, `min`, `max`, `locale`, `decimal`, `empty`, `align`, `typed`, `autoFocus`, `form` (`phone`: draw no ✕, ✓ or Cancel of your own) and, in the phone's sheet, `onStepChange` (a step of its own, money's currencies). The editor keeps the draft, the rounding, Tab, Escape, ⌘ or Ctrl Enter, the write check, the save and the phone's ✕ and ✓.
|
|
61
|
-
- `ViewsSortBodyProps` — the sort editor's whole body your app draws: `label`, `options` (the fields it sorts by, each its `value`, `label` and `defaultDir`, and, as the grid's header marks its column, its field's `type`, its `part` and the header's `glyph`), `rules` (in order, the first sorting first), `setAside` (the set-aside sorts, `[]` when none), `max`, `form`, `addSort` (on a computer, Add sort at its foot), `onStepChange` (on a phone: a step of your body's own, its title and Back, `null` once back), `onRulesChange` (the whole rules and, when handed, the set-aside sorts kept; every change as it is made; a list that breaks the rules writes nothing), `onDone` (what holds it closes) and, on a phone where the sheet's head doesn't draw them, `actions` (the ✕, taking the rules back to what they were as it opened, and ✓). ViewKit keeps the check, the latest rules between renders, the close on the last rule and what ✕ takes back to.
|
|
62
|
-
- Its `items` (`ViewsSortEditorItems`, from `menus.sortEditor`, VK-1063): its menus as data, `(items, ctx) => items`, `ctx` a `ViewsSortEditorItemsContext`: `{ menu: "rule", field, index }` (a rule's ⋯; `field` the sort's key) or `{ menu: "aside", field }` (a set-aside rule's ⋯; `field` its stored `fieldKey`), with `form`. `CONTROLS.SortBody` draws what it hands back; a body of your own may honour it.
|
|
61
|
+
- `ViewsSortBodyProps` — the sort editor's whole body your app draws: `label`, `options` (the fields it sorts by, each its `value`, `label` and `defaultDir`, and, as the grid's header marks its column, its field's `type`, its `part` and the header's `glyph`), `rules` (in order, the first sorting first), `setAside` (the set-aside sorts, `[]` when none), `max`, `form`, `addSort` (on a computer, Add sort at its foot), `onStepChange` (on a phone: a step of your body's own, its title and Back, `null` once back), `onRulesChange` (the whole rules and, when handed, the set-aside sorts kept; every change as it is made; a list that breaks the rules writes nothing), `onDone` (what holds it closes) and, on a phone where the sheet's head doesn't draw them, `actions` (the ✕, taking the rules back to what they were as it opened, and ✓). ViewKit keeps the check, the latest rules between renders, the close on the last rule (unless `empty="editor"`) and what ✕ takes back to. `empty` (VK-1091): `"editor"` where a placed Sort asks a computer's body with no rule to say nothing sorts yet over Add sort (`views.panels.sort-empty`), staying open as its last rule goes; absent, as before.
|
|
62
|
+
- Its `items` (`ViewsSortEditorItems`, from `menus.sortEditor`, VK-1063): its menus as data, `(items, ctx) => items`, `ctx` a `ViewsSortEditorItemsContext`: `{ menu: "rule", field, index }` (a rule's ⋯; `field` the sort's key) or `{ menu: "aside", field }` (a set-aside rule's ⋯; `field` its stored `fieldKey`); and (VK-1065) `{ menu: "row", field, index }` or `{ menu: "row", field, aside: true }` (the buttons at a rule's end: × `delete` on a computer, ⋯ `more`) or `{ menu: "foot" }` (Add sort and Clear: `add`, `clear`), with `form`. `CONTROLS.SortBody` draws what it hands back; a body of your own may honour it.
|
|
63
63
|
- `ViewsQuickFiltersBodyProps` — the quick filters' whole body your app draws: `label`, `fields` (each its `key`, `label`, `searchPlaceholder`, its `options` as the quick filter field hands them (each value's mark is its option's), and `values` in the order to show them, each value its key, its words, its `count` where counts show and whether it is `held`; a held value no count lists is among them, drawn from the hold and worded by the config's `heldLabels` else its key; after the fields offered, each other field holding a value, its held values alone), `hold` (each held field once, its values), `several`, `showCounts`, `form`, `onHoldChange` (the whole hold, every change as it is made; one that holds a field twice, more than one value where `several` is false, or a value added on a field the strip doesn't offer writes nothing), `onDone` (what holds it closes) and, on a phone where the sheet's head doesn't draw it, `actions` (the ✕, closing it).
|
|
64
|
-
- `ViewsFilterBodyProps` — the filter editor's whole body your app draws: `label`, `fields` (the fields a rule may name, `ViewsFilterBodyField`s, each column the list can't filter among them in its place, greyed by its `disabled`), `filter` (the level it is open on, a `FilterGroup`: an advanced filter's group on a computer, the whole filter on a phone), `levels` (how deep its rules may stand, its own the first), `excludable` (whether it may be `not`), `relation` (where the level is a relation's where edited in place: its field key, words and quantifier, and `gone`, why in words, where the list no longer lists the relation: there a level that adds or changes a rule writes nothing), `form`, `onFilterChange` (the whole level and, at a relation, its quantifier; every change as it is made; a level that breaks the rules writes nothing; an empty one on a computer takes its advanced filter away), `ruleValue` (a rule's value in ViewKit's own body for its type, each change handed back as the rule), `onDone` (what holds it closes) and, on a phone where the sheet's head doesn't draw them, `actions` (the ✕, taking the filter back to what it was as it opened, and ✓). ViewKit keeps the check, the Or top's wrap, the pills' keys and what ✕ takes back to.
|
|
65
|
-
- Its `items` (`ViewsFilterEditorItems`, from `menus.filterEditor`, VK-1063): its menus as data, `ctx` a `ViewsFilterEditorItemsContext`: `{ menu: "rule" | "aside", field, part?, relation?, path }` (a rule's ⋮ or a set-aside rule's: its `fieldKey`, its part, the relation it stands under) or `{ menu: "group", path }` (a group's actions), each with its `path` in the filter the body is handed (indices through `items` and a relation rule's `where.items`; the whole filter `[]`), with `form`.
|
|
64
|
+
- `ViewsFilterBodyProps` — the filter editor's whole body your app draws: `label`, `fields` (the fields a rule may name, `ViewsFilterBodyField`s, each column the list can't filter among them in its place, greyed by its `disabled`), `filter` (the level it is open on, a `FilterGroup`: an advanced filter's group on a computer, the whole filter on a phone), `levels` (how deep its rules may stand, its own the first), `empty` (VK-1091: `"editor"` where a placed Filter asks a computer's top level with nothing filtered to say so over Add filter, `views.panels.filter-empty`, staying open as its last rule goes; absent, the fields), `excludable` (whether it may be `not`), `relation` (where the level is a relation's where edited in place: its field key, words and quantifier, and `gone`, why in words, where the list no longer lists the relation: there a level that adds or changes a rule writes nothing), `form`, `onFilterChange` (the whole level and, at a relation, its quantifier; every change as it is made; a level that breaks the rules writes nothing; an empty one on a computer takes its advanced filter away), `ruleValue` (a rule's value in ViewKit's own body for its type, each change handed back as the rule), `onDone` (what holds it closes) and, on a phone where the sheet's head doesn't draw them, `actions` (the ✕, taking the filter back to what it was as it opened, and ✓). ViewKit keeps the check, the Or top's wrap, the pills' keys and what ✕ takes back to.
|
|
65
|
+
- Its `items` (`ViewsFilterEditorItems`, from `menus.filterEditor`, VK-1063): its menus as data, `ctx` a `ViewsFilterEditorItemsContext`: `{ menu: "rule" | "aside", field, part?, relation?, path }` (a rule's ⋮ or a set-aside rule's: its `fieldKey`, its part, the relation it stands under) or `{ menu: "group", path }` (a group's actions); and (VK-1065) `{ menu: "row", field, part?, relation?, path, aside? }` (a rule's ⋮, `more`) or `{ menu: "foot", path }` (a foot's buttons: `add`, `clear`, `delete`, `more`), each with its `path` in the filter the body is handed (indices through `items` and a relation rule's `where.items`; the whole filter `[]`), with `form`.
|
|
66
66
|
- `ViewsFilterBodyField` — a field a filter body's rule may name: `key`, `label`, `fieldKey`, `part`, `type` (its value type, which says its ways), `far` (a relation's fields one level in), `integer` (`true` on a number field that holds whole numbers only: its box takes whole numbers) and `disabled` (on a column the list can't filter, why in words: draw it greyed and never name it in a rule).
|
|
67
67
|
- `ViewsFieldsBodyProps` — the field list's whole body your app draws: `purpose` (`sort` or `filter`), `label`, `search` (its search's words), `fields` (each a `ViewsFieldsBodyField`), `own` (the field being changed; absent where a pick adds), `ownRelation` (for a rule on a related record's field, the relation `own` stands under, its key as `onPick` hands it back), `form`, `onPick` (the key picked, and a far field's key for a far field; a key not handed, or handed `disabled`, writes nothing) and `onDone` (what holds it closes, or on a phone the page turns back).
|
|
68
68
|
- `ViewsFieldsBodyField` — a field as the field list's body is handed it: `key`, `label`, `type` and `part` (its field's type and the part it reads, as the grid's header reads them), `glyph` (its column's glyph, drawn as the header draws it), `disabled` (why it can't be picked) and, for a filter's relation, `far` (its far fields, one level in).
|
|
@@ -79,9 +79,9 @@ The primitives your app hands in, modelled on Base UI's shapes: a controlled `op
|
|
|
79
79
|
- `ViewsGroupBodyProps` — the group editor's whole body your app draws: `label`, `dimensions` (each a `ViewsGroupDimension`), `group` (a `ViewsGroupValue`), `manualOrder` (your own order may be picked), `form`, `onGroupChange` (the whole group, every change as it is made; one write for each: a new Group by, order or date step alone, else Hide empty groups, else the groups; a new Group by keeps the order and step handed with it only where the new field offers them; a value that changes two at once, names a field the list doesn't offer, or names an order or step the field grouped by doesn't offer writes nothing), `onDone` (inside Customize, back to its list), `actions` (none inside Customize, whose head holds the ✕) and `onStepChange` (a level of the body's own, Group by's fields or an order's choices, whose name and Back Customize's head shows).
|
|
80
80
|
- Its `items` (`ViewsGroupEditorItems`, from `menus.groupEditor`, VK-1063): its rows as data, `ctx` a `ViewsGroupEditorItemsContext`: `{ menu: "settings", field? }` (Group by, Order, Direction, Date step, Hide empty groups; `field` the field grouped by) or `{ menu: "foot" }` (Remove grouping), with `form`.
|
|
81
81
|
- `ViewsSortEditorItems` — the sort editor's menus reshaped (`menus.sortEditor`, VK-1063): `(items: ViewsMenuItem[], ctx: ViewsSortEditorItemsContext) => ViewsMenuItem[]`.
|
|
82
|
-
- `ViewsSortEditorItemsContext` — which of the sort editor's menus: `{ menu: "rule", field, index }` or `{ menu: "aside", field }`, with `form`.
|
|
82
|
+
- `ViewsSortEditorItemsContext` — which of the sort editor's menus: `{ menu: "rule", field, index }` or `{ menu: "aside", field }`; or which of its rule ends and its foot (VK-1065): `{ menu: "row", field, index }`, `{ menu: "row", field, aside: true }` or `{ menu: "foot" }`; with `form`.
|
|
83
83
|
- `ViewsFilterEditorItems` — the filter editor's menus reshaped (`menus.filterEditor`): `(items, ctx: ViewsFilterEditorItemsContext) => items`.
|
|
84
|
-
- `ViewsFilterEditorItemsContext` — which of the filter editor's menus: `{ menu: "rule" | "aside", field, part?, relation?, path }` or `{ menu: "group", path }
|
|
84
|
+
- `ViewsFilterEditorItemsContext` — which of the filter editor's menus: `{ menu: "rule" | "aside", field, part?, relation?, path }` or `{ menu: "group", path }`; or which of its rule ends and feet (VK-1065): `{ menu: "row", field, part?, relation?, path, aside? }` or `{ menu: "foot", path }`; with `form`.
|
|
85
85
|
- `ViewsGroupEditorItems` — the group editor's rows reshaped (`menus.groupEditor`): `(items, ctx: ViewsGroupEditorItemsContext) => items`.
|
|
86
86
|
- `ViewsGroupEditorItemsContext` — which of the group editor's rows: `{ menu: "settings", field? }` or `{ menu: "foot" }`, with `form`.
|
|
87
87
|
- `ViewsGroupDimension` — a field a list can be grouped by: `value`, `label`, `orderOptions` (each its mode, words and `defaultDir`), `defaultOrder`, and a date's `granularities` with `defaultGranularity`.
|
|
@@ -148,7 +148,7 @@ Guide: [atoms](../guides/atoms.md).
|
|
|
148
148
|
The pieces the rendering is built from, and your app's own pieces it cannot draw itself. Each ships as a default, drawn from your app's colours and marked with its own `data-slot`; your app swaps any of them through the provider's `atoms`, and the rest stay the defaults. A swapped atom marks itself as your app does. The [contract](../contract.md) lists their slots and states.
|
|
149
149
|
|
|
150
150
|
- `DEFAULT_VIEWS_ATOMS` — the atoms every app starts with, one default per name of `ViewsAtoms`; the provider lays your `atoms` over it.
|
|
151
|
-
- `ViewsAtoms` — the full set, one component per atom: `List`, `Row`, `RowContent` (deprecated, drawn by nothing), `TickBox`, `Avatar`, `StatusBadge`, `StatusMarker`, `Tag`, `CommandMenu`, `RelationLink`, `RelationRoles`, `RelationChip`, `CellMore`, `Loading`, `LoadMore`, `PlatformMark`, `RowMenu`, and the rows ViewKit's own filter and sort bodies draw, `CheckRow`, `RadioRow`, `DirectionButton`, `MenuRow` and `PanelSearch` (the older panels, `severalSorts: false` or `filterGroups: false`, and the value body a filter rule falls back to), with `ChoiceRow` and `ToggleRow` (deprecated, drawn by nothing), the selection's `SelectionSheet`, the filter panel's month `RangeCalendar`, the views row's `Pill`,
|
|
151
|
+
- `ViewsAtoms` — the full set, one component per atom: `List`, `Row`, `RowContent` (deprecated, drawn by nothing), `TickBox`, `Avatar`, `StatusBadge`, `StatusMarker`, `Tag`, `CommandMenu`, `RelationLink`, `RelationRoles`, `RelationChip`, `CellMore`, `Loading`, `LoadMore`, `PlatformMark`, `RowMenu`, and the rows ViewKit's own filter and sort bodies draw, `CheckRow`, `RadioRow`, `DirectionButton`, `MenuRow` and `PanelSearch` (the older panels, `severalSorts: false` or `filterGroups: false`, and the value body a filter rule falls back to), with `ChoiceRow` and `ToggleRow` (deprecated, drawn by nothing), the selection's `SelectionSheet`, the filter panel's month `RangeCalendar`, the views row's `Pill`, the toolbar's `ToolbarButton`, and a grid header cell's `HeaderGlyph`, `HeaderSortMark` and `HeaderResizeHandle`. The provider's `atoms` takes any part of it.
|
|
152
152
|
- `ViewsChoiceRowProps` — deprecated with the `ChoiceRow` atom, which nothing draws; a panel's value row: `label`, a `description` under it, a right-hand `meta` (a sample, a count; a row with one draws no check), `leading`, `trailing`, `selected`, `onClick`, `onMouseDown`, `disabled`, `role` and `aria-selected`.
|
|
153
153
|
- `ViewsCheckRowProps` — toggles one of many, a tick box on the left: `checked`, `onClick`, its `children`, `leading`, `trailing`, `disabled`.
|
|
154
154
|
- `ViewsRadioRowProps` — picks one of a set: `selected`, `label`, `onClick`, `leading`, `trailing`, `mark` (`"check"` or `"box"`), `disabled` and the `disabledReason` your `Tooltip` shows, and class hooks for the check and the label.
|
|
@@ -157,8 +157,8 @@ The pieces the rendering is built from, and your app's own pieces it cannot draw
|
|
|
157
157
|
- `ViewsToggleRowProps` — deprecated with the `ToggleRow` atom, which nothing draws; a boolean flipped in place: `icon`, `label`, `active`, `disabled` and the `disabledReason` your `Tooltip` shows, `onClick`, and `reset` (`{ onReset }`), the way back to the reader's default.
|
|
158
158
|
- `ViewsPanelSearchProps` — a panel's text box: `value`, `onChange`, `onClear`, `placeholder`, `autoFocus`, `onKeyDown`, `onFocus`, `inputRef`, `leading` (`null` drops the magnifier), `suffix` and `inputMode`.
|
|
159
159
|
- `ViewsPillProps` — one option of a row of pills: `active`, `variant` (`solid` or `plain`), `size` (`default` or `sm`), `leading` and `leadingSlot`, your own `activeClassName` and `hoverClassName`, `onClick`, `onContextMenu`, `onPointerDown`, `menuOpen` (it opens a menu) and `ref`.
|
|
160
|
-
- `ViewsToolbarButtonProps` — a toolbar's button: its `icon`, its `label` (its name, and the word a dress shows unless `word` says another, or `null` for none), a `count` in its corner that becomes a ✕ badge clearing what it counts when handed `onClear`, a `dot` drawn instead of a count, `open`, `changed`, `edge` (the row's outermost button), `disabled`, `size` (`md` or `sm`), `popup` (`menu` or `dialog`, with `aria-expanded` from `open`), `joined` (`start`, `middle` or `end`: one of buttons joined as one, its outer corners alone rounded, `data-joined`), `waits` (its words say what it waits for, in the placeholder's colour, `data-waits`), `part` (which button it is, below), `className` (its toolbar place's class: put it on the button), `onClick`, `onPointerDown` and `ref`; its own words (`children`) keep to one line, cut with "…" where a holder caps its width.
|
|
161
|
-
- `ViewsToolbarButtonPart` — which of the toolbar's buttons a `ToolbarButton` stands for, handed as `part` by every button the toolbar draws: named after the `toolbarParts` place it stands in (`options`, `search`, `quick`, `new`, `sort`, `filter`, `filter-add`, `filters`, `advanced-filters`, `sort-pill`), a place's second kind of button by a name of its own (`sort-add`, Sort's +; `more-filters`, "+N filters"), ⋯ `more`, and the frame's parts (`ViewsFramePart`). Which place draws which is [`/list`'s Default keys](./list.md#default-keys). An atom that spreads its leftover props onto its element takes `part` out first.
|
|
160
|
+
- `ViewsToolbarButtonProps` — a toolbar's button: its `icon`, its `label` (its name, and the word a dress shows unless `word` says another, or `null` for none), a `count` in its corner that becomes a ✕ badge clearing what it counts when handed `onClear`, a `dot` drawn instead of a count, `open`, `changed`, `edge` (the row's outermost button), `disabled`, `size` (`md` or `sm`), `popup` (`menu` or `dialog`, with `aria-expanded` from `open`), `expanded` (VK-1091: it shows and hides a part of the page rather than opening a popup, Sort and filter: `aria-expanded` from it), `joined` (`start`, `middle` or `end`: one of buttons joined as one, its outer corners alone rounded, `data-joined`), `waits` (its words say what it waits for, in the placeholder's colour, `data-waits`), `part` (which button it is, below), `className` (its toolbar place's class: put it on the button), `onClick`, `onPointerDown` and `ref`; its own words (`children`) keep to one line, cut with "…" where a holder caps its width.
|
|
161
|
+
- `ViewsToolbarButtonPart` — which of the toolbar's buttons a `ToolbarButton` stands for, handed as `part` by every button the toolbar draws: named after the `toolbarParts` place it stands in (`options`, `search`, `quick`, `new`, `sort`, `filter`, `filter-add`, `filters`, `advanced-filters`, `sort-pill`), a place's second kind of button by a name of its own (`sort-add`, Sort's +; `more-filters`, "+N filters"), ⋯ `more`, a placed Sort and filter `sort-filter` (VK-1091), and the frame's parts (`ViewsFramePart`). Which place draws which is [`/list`'s Default keys](./list.md#default-keys). An atom that spreads its leftover props onto its element takes `part` and `expanded` out first.
|
|
162
162
|
- `ViewsFramePart` — the six a `ToolbarButton` is handed only where your own toolbar frame draws them: `views-chip`, `views-tab`, `views-more`, `views-add`, `clear` or `save`, with `current` (a view tab; `true`, the open one) and `onContextMenu` (a tab's verbs); draw each as its `data-slot` (`vk-views-chip`, `vk-views-tab`, `vk-views-more`, `vk-views-add`, `vk-toolbar-clear`, `vk-toolbar-save-button`). Dress by these, not by any `part`: `if (part && FRAME.has(part))`.
|
|
163
163
|
- `ViewsListProps` — the rows' container, the inset a run of rows sits in inside a panel or a command list's group: its `children` and a class.
|
|
164
164
|
- `ViewsRowContentProps` — a row's inside, what `ViewsRowProps` is built on (the `RowContent` atom that took it alone is deprecated).
|
|
@@ -181,6 +181,9 @@ The pieces the rendering is built from, and your app's own pieces it cannot draw
|
|
|
181
181
|
- `ViewsRelationRolesProps` — a link's roles, drawn inside its chip after the record's name, on a `many` relation that declares `links`: the `relation` value and its `roles` in order, each its stored `value` and its `label` (the field's, else the value). Handed only when the link holds one or more. The default draws the labels in the subtle colour after a middle dot, cut before the name in a narrow cell, and names the record and every role on hover.
|
|
182
182
|
- `ViewsRelationChipProps` — a mentioned record (VK-1053), drawn where the provider's `panelControls` names `RelationChip`: every relation ViewKit draws, in a table's cell (one and many, and the +N list), a field row's value, `renderFieldValue` (a highlight) and a user field's chip. ViewKit places a mentioned record and hands its data; your app draws it. It is handed `relation` (`id`, `label`, `entity`, `avatarUrl`), `roles` (each its `value` and `label`; none but on a `many` relation that declares `links`), `size` (`chip` in a cell or a highlight, `row` in a field row), `render`, the host's link where it has one, and `fallback`, ViewKit's own chip as it would draw it there. The default draws its `fallback`.
|
|
183
183
|
- `ViewsRelationChipLinkProps` — what a mentioned record hands the host's link it draws itself through (`render`): its own element's props, its words and mark as `children`, its class, its `data-*`, its ref. The host's link draws its own element with them: a cell whose host opens its relations a bare `<button data-slot="vk-relation-link" data-no-nav>` whose press opens the record, the app's `RelationLink` or a host's `relationWrap` around a `<span>` holding them.
|
|
184
|
+
- `ViewsHeaderGlyphProps` — a grid header cell's type glyph, the `HeaderGlyph` atom: `columnId`, `type` (its list type, where it has one), `fieldKey` (the field it draws, where it draws one), `fallback` (ViewKit's own glyph for the column, null where it has none; the default draws it) and `className` (what ViewKit's own draws with: its size, `--vk-head-glyph`, its colour and its opacity).
|
|
185
|
+
- `ViewsHeaderSortMarkProps` — a sorted column's mark in its header, the `HeaderSortMark` atom, drawn where the grid's `sortMark` is on inside ViewKit's `aria-hidden` box: `columnId`, `dir` (`asc` or `desc`) and `className`; the default draws `icons.sortAsc` or `icons.sortDesc`.
|
|
186
|
+
- `ViewsHeaderResizeHandleProps` — what a header cell's resize handle shows, the `HeaderResizeHandle` atom, inside ViewKit's grab zone (`vk-grid-resize-handle`), which keeps the press, the drag and the double-click's reset: `columnId` and `active`, true while the column is resized; the default is a hairline in `--vk-brand`.
|
|
184
187
|
- `ViewsCellMoreProps` — the count after a cell's shown values: `count`, how many are not shown, and `inert`, true where the host owns the click (the count is plain text, and nothing opens). Drawn inside `data-slot="vk-cell-more"`, a button that opens the whole list. The default, `DefaultCellMore`, draws "+" and the number, and ViewKit keeps its own frame on that element only for it; yours draws inside a bare button (or span), so a count tag of yours stands there alone.
|
|
185
188
|
- `ViewsLoadingProps` — a wait: `placement` `body` (the whole list reloading) or `footer` (more rows arriving), and the `label` read to assistive technology. The default is a plain ring, larger in the body.
|
|
186
189
|
- `ViewsLoadMoreProps` — how a list asks for its next page once its end comes near: `onReveal`, and an optional `label` drawn while it waits. The default watches a sentinel past the last row, calls `onReveal` as it comes within 600px of the end of what it scrolls in (the grid's own scroll area, else the viewport), and draws your `Loading` (or the label) meanwhile.
|
|
@@ -15,7 +15,7 @@ Guide: [selection](../guides/selection.md).
|
|
|
15
15
|
|
|
16
16
|
## The bar
|
|
17
17
|
|
|
18
|
-
- `SelectionBar` — the bar a selection opens, portalled to the body and placed by the provider's `selectionBar`. On a desktop, an island: the count chip (a press clears the selection; its tooltip names Escape; ViewKit's own, or your `Button` with `selectionBar`'s `chip: "button"`), the first four verbs
|
|
18
|
+
- `SelectionBar` — the bar a selection opens, portalled to the body and placed by the provider's `selectionBar`. On a desktop, an island: the count chip (a press clears the selection; its tooltip names Escape; ViewKit's own, or your `Button` with `selectionBar`'s `chip: "button"`), the first four verbs not marked `more`, the trash when `onDelete` is handed, a hairline and More, always drawn (when nothing spills into it, a Tab stop that opens nothing, `aria-disabled`, saying why in your `Tooltip`: `views.selection.more-none`), holding the verbs marked `more`, then the rest (a group or an options verb opening its rows beside it). On a phone, a pill reading the count, Actions and ✕; Actions opens the `SelectionSheet` atom. It draws nothing while `count` is zero. Handed a `SelectionBar` in the components map (`CONTROLS`: the Outright bulk bar), it draws that one in its place instead, in the box that holds it, at every count; `noun` and `deleteLine` are for that bar.
|
|
19
19
|
- `SelectionBarProps` — what `SelectionBar` takes: `count`, `onClear`, `verbs` (`SelectionVerb`s, in order), optional `busy` (disables every control), `onDelete` (the bar's own verb, the trailing trash; never a verb in `verbs`) and `deleteLabel` (the trash's name; default the `views.selection.delete` message).
|
|
20
20
|
- `SelectionVerb` — one verb, as data: `{ kind: "action" }` with a `SelectionVerbItem`'s fields; `{ kind: "group", label, icon?, disabled?, disabledReason?, items }`, a button opening a menu of `SelectionVerbItem`s, whose rows that give no reason carry the group's; or a `SelectionOptionsVerb`.
|
|
21
21
|
- `SelectionVerbItem` — an action: `label`, optional `icon` (your glyph), `onClick`, `destructive` (the danger colour), `disabled`, and `disabledReason`, why it is disabled: More's row, the bar's button and the phone's sheet carry it.
|