viewkitjs 0.39.0 → 0.40.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 +65 -0
- package/MIGRATION.md +25 -0
- package/fields/dist/derived.d.ts +7 -0
- package/fields/dist/derived.js +4 -0
- package/fields/dist/index.d.ts +1 -1
- package/fields/dist/index.js +1 -1
- package/fields/dist/messages.d.ts +5 -1
- package/fields/dist/messages.js +3 -0
- package/fields/dist/query/evaluate.d.ts +7 -1
- package/fields/dist/query/evaluate.js +8 -5
- package/fields/dist/query/filter.d.ts +7 -0
- package/fields/dist/query/filter.js +7 -1
- package/fields/dist/query/kit.d.ts +3 -2
- package/fields/dist/query/kit.js +1 -1
- package/fields/dist/query/layer.d.ts +6 -0
- package/fields/dist/query/layer.js +3 -0
- package/fields/dist/query/number.d.ts +3 -2
- package/fields/dist/query/number.js +5 -3
- package/fields/dist/query/read-rule.d.ts +1 -1
- package/fields/dist/query/read-rule.js +3 -0
- package/fields/docs/guides/queries.md +28 -24
- package/fields/docs/reference/fields.md +1 -0
- package/fields/docs/reference/query.md +6 -4
- package/package.json +2 -4
- package/postgres/dist/check.js +3 -1
- package/postgres/dist/definitions/storage.d.ts +3 -1
- package/postgres/dist/definitions/storage.js +3 -1
- package/postgres/dist/definitions/stored.js +13 -2
- package/postgres/dist/map.d.ts +5 -1
- package/postgres/dist/map.js +4 -0
- package/postgres/dist/records.js +6 -1
- package/postgres/docs/guides/definitions.md +1 -1
- package/postgres/docs/guides/field-map.md +2 -2
- package/postgres/docs/reference/postgres.md +1 -1
- package/views/dist/contract.d.ts +20 -2
- package/views/dist/contract.js +27 -0
- package/views/dist/controls/avatar.css +1 -1
- package/views/dist/controls/customize/map-customize-body.js +1 -1
- package/views/dist/controls/field/field.d.ts +2 -14
- package/views/dist/controls/field/field.js +4 -9
- package/views/dist/controls/filter-editor/filter-editor.d.ts +2 -0
- package/views/dist/controls/filter-editor/filter-editor.js +5 -2
- package/views/dist/controls/filter-editor/how.d.ts +8 -0
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +4 -2
- package/views/dist/controls/filter-editor/map-filter-body.js +17 -8
- package/views/dist/controls/filter-editor/map-rules.d.ts +4 -3
- package/views/dist/controls/filter-editor/map-rules.js +5 -2
- package/views/dist/controls/filter-editor/parts.d.ts +14 -1
- package/views/dist/controls/filter-editor/parts.js +14 -0
- package/views/dist/controls/filter-editor.css +4 -1
- package/views/dist/controls/index.d.ts +0 -3
- package/views/dist/controls/index.js +0 -3
- package/views/dist/controls/input.css +1 -1
- package/views/dist/controls/menu-list.css +1 -1
- package/views/dist/controls/picker/looks.d.ts +1 -1
- package/views/dist/controls/picker.css +2 -2
- package/views/dist/controls/press.css +0 -1
- package/views/dist/controls/radio/radio.d.ts +1 -1
- package/views/dist/controls/radio/radio.js +1 -16
- package/views/dist/controls/sheet/bottom-sheet.d.ts +2 -2
- package/views/dist/controls/sheet/bottom-sheet.js +31 -24
- package/views/dist/controls/text-editor.css +5 -3
- package/views/dist/controls/tokens.js +0 -6
- package/views/dist/controls/toolbar/toolbar.js +2 -2
- package/views/dist/field-row/editors/RowTextEditor.js +4 -1
- package/views/dist/filters/duration-bound.d.ts +7 -0
- package/views/dist/filters/duration-bound.js +9 -0
- package/views/dist/filters/filter-model.d.ts +4 -0
- package/views/dist/filters/number-refused.d.ts +8 -0
- package/views/dist/filters/number-refused.js +4 -0
- package/views/dist/grid/chrome/grid-table-props.d.ts +4 -1
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +12 -2
- package/views/dist/grid/core/clipboard-model.js +42 -8
- package/views/dist/grid/core/commit-model.d.ts +3 -0
- package/views/dist/grid/core/editing-controller.d.ts +29 -1
- package/views/dist/grid/core/editing-controller.js +142 -12
- package/views/dist/grid/core/pending-reconciliation.d.ts +14 -0
- package/views/dist/grid/core/pending-reconciliation.js +20 -8
- package/views/dist/grid/core/save-path.d.ts +4 -2
- package/views/dist/grid/core/save-path.js +1 -1
- package/views/dist/grid/core/spreadsheet-operations.js +43 -5
- package/views/dist/grid/core/useGridEditing.d.ts +5 -1
- package/views/dist/grid/core/useGridEditing.js +4 -4
- package/views/dist/grid/core/written-alongside.d.ts +16 -0
- package/views/dist/grid/core/written-alongside.js +30 -0
- package/views/dist/grid/grid.css +1 -1
- package/views/dist/grid/index.d.ts +1 -1
- package/views/dist/grid/looks.d.ts +2 -2
- package/views/dist/internal/before-paint.d.ts +5 -0
- package/views/dist/internal/before-paint.js +17 -0
- package/views/dist/internal/field-rows.d.ts +0 -8
- package/views/dist/internal/field-rows.js +1 -3
- package/views/dist/list/bar-keys.d.ts +3 -0
- package/views/dist/list/bar-keys.js +1 -0
- package/views/dist/list/buttons/clear-save.js +6 -2
- package/views/dist/list/buttons/new.d.ts +1 -1
- package/views/dist/list/buttons/new.js +14 -2
- package/views/dist/list/buttons/shared.d.ts +7 -1
- package/views/dist/list/buttons/shared.js +8 -2
- package/views/dist/list/buttons/views.js +6 -4
- package/views/dist/list/edits.d.ts +3 -1
- package/views/dist/list/layer.d.ts +13 -3
- package/views/dist/list/layer.js +13 -3
- package/views/dist/list/line.d.ts +5 -2
- package/views/dist/list/line.js +11 -3
- package/views/dist/list/list.d.ts +7 -1
- package/views/dist/list/list.js +2 -2
- package/views/dist/list/panels/filter-bar.d.ts +1 -1
- package/views/dist/list/panels/filter-bar.js +9 -3
- package/views/dist/list/panels/shared.d.ts +3 -2
- package/views/dist/list/panels/shared.js +5 -2
- package/views/dist/list/root-base.d.ts +2 -1
- package/views/dist/list/root-base.js +5 -3
- package/views/dist/list/root.d.ts +1 -1
- package/views/dist/list/store.d.ts +10 -0
- package/views/dist/list/store.js +8 -1
- package/views/dist/list/toolbar-model.d.ts +4 -0
- package/views/dist/list/toolbar-model.js +19 -1
- package/views/dist/list/toolbar.js +2 -1
- package/views/dist/list/views.d.ts +1 -1
- package/views/dist/list/views.js +4 -1
- package/views/dist/looks/index.d.ts +0 -1
- package/views/dist/looks/index.js +0 -1
- package/views/dist/looks/looks.d.ts +1 -1
- package/views/dist/looks/pieces.js +0 -2
- package/views/dist/model/column-filters.js +10 -3
- package/views/dist/model/view-rules.js +1 -0
- package/views/dist/panels/filter/NumberFilterBody.js +6 -8
- package/views/dist/panels/labels.js +7 -2
- package/views/dist/panels/model.d.ts +3 -0
- package/views/dist/panels/react/filter/filter-body.js +5 -1
- package/views/dist/panels/react/toolbar/ToolbarBarSorts.js +28 -1
- package/views/dist/panels/react/toolbar/ToolbarButton.d.ts +1 -1
- package/views/dist/panels/react/toolbar/ToolbarButton.js +5 -3
- package/views/dist/panels/react/toolbar/context.d.ts +4 -0
- package/views/dist/panels/react/toolbar/context.js +1 -0
- package/views/dist/panels/react/toolbar/use-give-way.js +2 -2
- package/views/dist/panels/settings/filter-groups.js +5 -0
- package/views/dist/panels/settings/input.d.ts +11 -0
- package/views/dist/panels/settings/layout.js +26 -0
- package/views/dist/panels/settings/person.d.ts +15 -0
- package/views/dist/panels/settings/person.js +6 -0
- package/views/dist/panels/toolbar/page-resets.js +14 -3
- package/views/dist/provider/components.d.ts +12 -3
- package/views/dist/styles.css +16 -260
- package/views/dist/styles.unlayered.css +16 -260
- package/views/docs/contract.md +9 -7
- package/views/docs/controls/field.md +1 -1
- package/views/docs/guides/looks.md +1 -1
- package/views/docs/guides/the-grid.md +4 -2
- package/views/docs/guides/toolbar-parts.md +337 -0
- package/views/docs/index.md +4 -0
- package/views/docs/reference/controls.md +3 -41
- package/views/docs/reference/grid.md +4 -3
- package/views/docs/reference/list.md +24 -13
- package/views/docs/reference/looks.md +12 -15
- package/views/docs/reference/panels.md +1 -1
- package/views/docs/reference/react.md +3 -3
- package/views/docs/reference/views.md +1 -1
- package/views/dist/controls/setting-row/looks.d.ts +0 -10
- package/views/dist/controls/setting-row/looks.js +0 -22
- package/views/dist/controls/setting-row/setting-row.d.ts +0 -102
- package/views/dist/controls/setting-row/setting-row.js +0 -135
- package/views/dist/controls/setting-row/tokens.d.ts +0 -156
- package/views/dist/controls/setting-row/tokens.js +0 -41
- package/views/dist/controls/setting-row.css +0 -216
- package/views/dist/controls/switch-row/switch-row.d.ts +0 -1
- package/views/dist/controls/switch-row/switch-row.js +0 -1
- package/views/dist/controls/switch-row/tokens.d.ts +0 -39
- package/views/dist/controls/switch-row/tokens.js +0 -12
- package/views/dist/controls/switch-row.css +0 -35
- package/views/dist/controls/tag-field/tag-field.d.ts +0 -24
- package/views/dist/controls/tag-field/tag-field.js +0 -25
- package/views/dist/controls/tag-field/tokens.d.ts +0 -23
- package/views/dist/controls/tag-field/tokens.js +0 -8
- package/views/dist/controls/tag-field.css +0 -32
- package/views/docs/controls/setting-row.md +0 -44
- package/views/docs/controls/switch-row.md +0 -15
- package/views/docs/controls/tag-field.md +0 -11
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
# The toolbar's parts
|
|
2
|
+
|
|
3
|
+
`<List />` draws a list's toolbar as it always has. That toolbar is built from parts you can place yourself: its buttons, its panels, `ListLine` and `ListGap`. Write any of them under a `ListRoot`, or in a `ListSlot` elsewhere on the page through a `ListFill`, and it reads and changes the list with nothing wired. A part has no side or line setting: where you write it is where it stands, and a `ListGap` pushes what comes after it to the end of its line.
|
|
4
|
+
|
|
5
|
+
This page names every part, its settings with the default first (the default is always what `<List />` does), the switch that lets a person pick two things in their own Customize, and how the ready toolbar's props map onto the parts. It ends with six layouts, each one a page in ViewKit's test app (`/layouts/<name>`) whose code is the code shown here. Each part's full entry is in [`viewkitjs/views/list`](../reference/list.md): [buttons](../reference/list.md#a-lists-buttons-placed-anywhere), [panels](../reference/list.md#a-lists-panels-placed-anywhere) and [lines](../reference/list.md#a-lists-lines).
|
|
6
|
+
|
|
7
|
+
## The parts
|
|
8
|
+
|
|
9
|
+
Buttons, each opening its panel:
|
|
10
|
+
|
|
11
|
+
| Part | What it is | Its settings, default first |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| `ListViews` | the saved views | `shows`: `tabs` · `button`; `layouts`, `menu`, `moreViews` |
|
|
14
|
+
| `ListSearch` | the search | `shows`: `button` · `input`; `words`: `icon` · `both` · `word`; `placeholder` |
|
|
15
|
+
| `ListSort` | the sort | `opens`; `empty`: `fields` · `editor`; `words` |
|
|
16
|
+
| `ListFilter` | the filter | `opens`; `empty`: `fields` · `editor`; `words` |
|
|
17
|
+
| `ListQuickFilters` | the quick filters the root was handed | `opens`; `words`: `icon` · `both` · `word` |
|
|
18
|
+
| `ListCustomize` | Customize | `opens`; `words`; `menu` |
|
|
19
|
+
| `ListSortFilter` | Sort and filter: shows and hides a `ListFilterBar shows="button"` | `words` |
|
|
20
|
+
| `ListClearSave` | Clear and Save, while the list differs from its view | none |
|
|
21
|
+
| `ListNew` | New | `onAdd` or `items`; `label`; `words` |
|
|
22
|
+
|
|
23
|
+
- `opens` (`ListOpens`): `popover`, at the button · `pane`, in your `Pane` beside the grid in a `ListPaneBox` · `sheet` · `bar` (`ListSort` and `ListFilter` only: the picked rule stands on the filter bar) · a function of yours, called with the button on a press while ViewKit opens nothing.
|
|
24
|
+
- `empty`: what Sort and Filter open with nothing set. `fields` is the field list. `editor` is the editor saying "No sorting set up yet" or "No filtering set up yet", with Add sort or Add filter.
|
|
25
|
+
- `words` (`ListWords`): `both` (icon and word) · `icon` · `word`. Search and Quick filters default to `icon`, every other button to `both`.
|
|
26
|
+
|
|
27
|
+
Panels, each standing open where you write it:
|
|
28
|
+
|
|
29
|
+
| Part | What it is | Its settings, default first |
|
|
30
|
+
|---|---|---|
|
|
31
|
+
| `ListFilterBar` | the filter bar: the standing rules, edited in place, and its + | `shows`: `filled` · `always` · `button`; `sorts`: `no` · `yes` |
|
|
32
|
+
| `ListFilterPanel` | every filter rule, with Add filter | `shows`: `always` · `filled` · `button` |
|
|
33
|
+
| `ListSortPanel` | every sort rule, with Add sort | `shows`: `always` · `filled` · `button` |
|
|
34
|
+
| `ListViewsPanel` | the views as a standing list, for a sidebar | `shows`: `always` · `button` |
|
|
35
|
+
| `ListQuickFiltersPanel` | the quick filters, standing | `shows`: `always` · `button` |
|
|
36
|
+
| `ListCustomizePanel` | Customize, standing | `shows`: `always` · `button` |
|
|
37
|
+
|
|
38
|
+
- `shows` (`ListPanelShows`): `always`, standing open · `filled`, once it holds something (the filter bar's default) · `button`, while its button shows it.
|
|
39
|
+
- `sorts`: `no` shows the sort as one pill while it differs from the view. `yes` stands each sort rule on the bar, where it is added and edited, and opens no sort editor.
|
|
40
|
+
|
|
41
|
+
Placing them:
|
|
42
|
+
|
|
43
|
+
| Part | What it is | Its settings, default first |
|
|
44
|
+
|---|---|---|
|
|
45
|
+
| `ListLine` | a toolbar line: its parts in your order, folding as the ready toolbar's line folds, taking no room while none of them draws anything | `kind`: `row` · `bar`; `more`, `overflow` |
|
|
46
|
+
| `ListGap` | empty room, pushing what follows it to the end of its line | none |
|
|
47
|
+
| `ListSlot` · `ListFill` | a place outside the root's tree (your header, your sidebar), and the parts you put in it from inside the root | `name` |
|
|
48
|
+
| `ListPaneBox` | the box round your grid where `opens="pane"` stands | `className` |
|
|
49
|
+
| `ListEditorMenus` | the sort, filter and group editors' menus as data, for every part under it | `sortEditor`, `filterEditor`, `groupEditor` |
|
|
50
|
+
|
|
51
|
+
Place each part once per root. Sort, Filter and Customize need a root that holds the list's `fields`.
|
|
52
|
+
|
|
53
|
+
## A button and its panel
|
|
54
|
+
|
|
55
|
+
When a panel is placed under the same root as its button, the button opens no popover. It shows the panel if the panel isn't standing, moves the focus to it if it stands on its own, and hides it if it stands only because the button showed it. `ListViews` does this only with `shows="button"`. On a phone, a placed panel folds behind its button, which opens it as a sheet.
|
|
56
|
+
|
|
57
|
+
Atlas's three asks are three settings:
|
|
58
|
+
|
|
59
|
+
- `<ListFilter empty="editor" />` opens the filter editor straight away, even with nothing set.
|
|
60
|
+
- `<ListFilterBar shows="button" />` with `<ListSortFilter />`: one button brings the bar.
|
|
61
|
+
- `<ListFilterBar sorts="yes" />`: sorts are added and edited on the bar, with no popover.
|
|
62
|
+
|
|
63
|
+
## What the person picks
|
|
64
|
+
|
|
65
|
+
`personSettings={{ bar, words }}` on `List` or `ListRoot` adds two rows to Layout in the person's own Customize. Both are off by default. `bar` lets them pick when the filter bar stands (Once added or Always). `words` lets them pick how the buttons show their words (Icon and word, Icon or Word). Each pick is kept in their own layer and never changes the shared view. Where the parts stand stays yours: [The person's own toolbar](../reference/list.md#the-persons-own-toolbar).
|
|
66
|
+
|
|
67
|
+
## From the ready toolbar's props to the parts
|
|
68
|
+
|
|
69
|
+
Every prop still works on `List`, `ListToolbar` and `ReadyToolbar`. To move a list to the parts, write `ListRoot` with the same data props (`fields`, `rows` or `source`, `views`, `quickFilters`, `save`), and then:
|
|
70
|
+
|
|
71
|
+
- `sortFilter: "right"` (the default): `ListSort` and `ListFilter` in the row. `sortFilter: "bar"`: neither in the row, and the sort and the filters on a `ListFilterBar` in a `ListLine kind="bar"`.
|
|
72
|
+
- `bar: "added"` or `"always"`: `ListFilterBar shows="filled"` or `shows="always"`.
|
|
73
|
+
- `toolbarParts`: the order is the order you write; `line` and `side` become the `ListLine` you write a part in, before or after its `ListGap`; `words` becomes the part's `words`; `node` becomes your own element written in the line. `className`, `button` and `panel` have no part form yet: they stay `toolbarParts`'.
|
|
74
|
+
- `customizeIn: "pane"`: `<ListCustomize opens="pane" />`, with a `ListPaneBox` round your `ListGrid`.
|
|
75
|
+
- `hosts`: no part form one to one. A placed button's `opens` takes your function: ViewKit draws the button, and what opens is yours.
|
|
76
|
+
- `onAdd`, `addItems`, `addLabel`: `ListNew`'s `onAdd`, `items`, `label`. `quickFilters`: the root's `quickFilters`, and `ListQuickFilters` where you want its button.
|
|
77
|
+
- `searchPlaceholder`, `searching`: `ListSearch`'s `placeholder`, `searching`. `viewName`, `onRenameView`, `onCopyLink`, `onExport`, `exportCount`, `fieldEditor`: `ListCustomize`'s, the same names.
|
|
78
|
+
- `menus.view` and `moreViews`: `ListViews`' `menu` and `moreViews`. `menus.customize`: `ListCustomize`'s `menu`. `menus.more` and `overflow`: `ListLine`'s `more` and `overflow`. `menus.sortEditor`, `filterEditor`, `groupEditor`: a `ListEditorMenus` around the parts. `menus.add` has no part form: hand `ListNew` its `items` already shaped.
|
|
79
|
+
- `arrangement: "row"`: no part form. Write the lines you want.
|
|
80
|
+
- `phone` and `narrow`: nothing to write. A placed part follows the phone on its own, and a `ListLine` folds as it narrows.
|
|
81
|
+
|
|
82
|
+
## Six layouts
|
|
83
|
+
|
|
84
|
+
Each layout below is one component that takes the list's data. `YourApp` stands in for your own app: a top bar, a sidebar and a page header, each holding a `ListSlot` that a layout fills from inside its root. In the test app each layout runs as a page with a browser test.
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
import type { ReactNode } from "react";
|
|
88
|
+
import type { ListRow } from "viewkitjs/fields/query";
|
|
89
|
+
import {
|
|
90
|
+
List,
|
|
91
|
+
ListClearSave,
|
|
92
|
+
ListCustomize,
|
|
93
|
+
ListFill,
|
|
94
|
+
ListFilter,
|
|
95
|
+
ListFilterBar,
|
|
96
|
+
ListFilterPanel,
|
|
97
|
+
ListGap,
|
|
98
|
+
ListGrid,
|
|
99
|
+
ListLine,
|
|
100
|
+
ListNew,
|
|
101
|
+
ListQuickFilters,
|
|
102
|
+
ListRoot,
|
|
103
|
+
ListSearch,
|
|
104
|
+
ListSlot,
|
|
105
|
+
ListSort,
|
|
106
|
+
ListSortFilter,
|
|
107
|
+
ListSortPanel,
|
|
108
|
+
ListViews,
|
|
109
|
+
ListViewsPanel,
|
|
110
|
+
type ListFieldsRegistry,
|
|
111
|
+
type ViewSeed,
|
|
112
|
+
} from "viewkitjs/views/list";
|
|
113
|
+
import type { QuickFiltersConfig } from "viewkitjs/views/panels";
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
export type DealsProps = {
|
|
118
|
+
fields: ListFieldsRegistry;
|
|
119
|
+
rows: readonly ListRow[];
|
|
120
|
+
views: ViewSeed[];
|
|
121
|
+
quickFilters: QuickFiltersConfig;
|
|
122
|
+
onAdd: () => void;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// Your app: its top bar, its sidebar, the page's header. Each holds a slot a list's parts can fill, from inside its root.
|
|
126
|
+
export function YourApp({ children }: { children: ReactNode }) {
|
|
127
|
+
return (
|
|
128
|
+
<div className="your-app">
|
|
129
|
+
<header className="your-app-bar" data-zone="app-bar">
|
|
130
|
+
<strong>Acme CRM</strong>
|
|
131
|
+
<ListSlot name="app-bar" className="your-slot" />
|
|
132
|
+
</header>
|
|
133
|
+
<div className="your-app-body">
|
|
134
|
+
<nav className="your-sidebar" data-zone="sidebar">
|
|
135
|
+
<ListSlot name="app-sidebar" />
|
|
136
|
+
</nav>
|
|
137
|
+
<main className="your-page">
|
|
138
|
+
<header className="your-page-header" data-zone="page-header">
|
|
139
|
+
<h1>Deals</h1>
|
|
140
|
+
<ListSlot name="page-header" className="your-slot" />
|
|
141
|
+
</header>
|
|
142
|
+
{children}
|
|
143
|
+
</main>
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**The default** (`/layouts/default`): `<List />` alone draws today's toolbar, and your app's places stay empty.
|
|
151
|
+
|
|
152
|
+
```tsx
|
|
153
|
+
// The default: <List /> alone draws today's toolbar. The row: Views, Customize, then Sort, Filter, Quick filters, Search and New
|
|
154
|
+
// at its end; under it the filter bar once something is added, with Clear and Save at its end.
|
|
155
|
+
export function DefaultLayout({ fields, rows, views, quickFilters, onAdd }: DealsProps) {
|
|
156
|
+
return (
|
|
157
|
+
<YourApp>
|
|
158
|
+
<List
|
|
159
|
+
id="deals"
|
|
160
|
+
fields={fields}
|
|
161
|
+
rows={rows}
|
|
162
|
+
views={{ seed: views, records: "deals" }}
|
|
163
|
+
quickFilters={quickFilters}
|
|
164
|
+
onAdd={onAdd}
|
|
165
|
+
link={false}
|
|
166
|
+
/>
|
|
167
|
+
</YourApp>
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Filters in a side column** (`/layouts/side-column`): the sort and filter panels stand beside the table.
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
// Filters in a side column: the sort and filter panels stand open beside the table, so the row holds no Sort or Filter.
|
|
176
|
+
export function SideColumnLayout({ fields, rows, views, quickFilters, onAdd }: DealsProps) {
|
|
177
|
+
return (
|
|
178
|
+
<YourApp>
|
|
179
|
+
<ListRoot id="deals" fields={fields} rows={rows} views={{ seed: views, records: "deals" }} quickFilters={quickFilters}>
|
|
180
|
+
<ListLine>
|
|
181
|
+
<ListViews />
|
|
182
|
+
<ListGap />
|
|
183
|
+
<ListSearch />
|
|
184
|
+
<ListCustomize />
|
|
185
|
+
<ListNew onAdd={onAdd} />
|
|
186
|
+
</ListLine>
|
|
187
|
+
<ListLine kind="bar">
|
|
188
|
+
<ListFilterBar />
|
|
189
|
+
<ListGap />
|
|
190
|
+
<ListClearSave />
|
|
191
|
+
</ListLine>
|
|
192
|
+
<div className="your-list-row">
|
|
193
|
+
<ListGrid />
|
|
194
|
+
<aside className="your-side-column" data-side-column>
|
|
195
|
+
<ListSortPanel />
|
|
196
|
+
<ListFilterPanel />
|
|
197
|
+
</aside>
|
|
198
|
+
</div>
|
|
199
|
+
</ListRoot>
|
|
200
|
+
</YourApp>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**Views in the app's sidebar** (`/layouts/sidebar-views`): the views as your sidebar's list, and the search and New in the page header.
|
|
206
|
+
|
|
207
|
+
```tsx
|
|
208
|
+
// Views in the app's sidebar: the views as a standing list in your sidebar, the search standing as a field and New in the page's
|
|
209
|
+
// header, both through a ListFill; the row keeps Sort, Filter, Quick filters and Customize.
|
|
210
|
+
export function SidebarViewsLayout({ fields, rows, views, quickFilters, onAdd }: DealsProps) {
|
|
211
|
+
return (
|
|
212
|
+
<YourApp>
|
|
213
|
+
<ListRoot id="deals" fields={fields} rows={rows} views={{ seed: views, records: "deals" }} quickFilters={quickFilters}>
|
|
214
|
+
<ListFill name="app-sidebar">
|
|
215
|
+
<ListViewsPanel />
|
|
216
|
+
</ListFill>
|
|
217
|
+
<ListFill name="page-header">
|
|
218
|
+
<ListLine>
|
|
219
|
+
<ListGap />
|
|
220
|
+
<ListSearch shows="input" />
|
|
221
|
+
<ListNew onAdd={onAdd} />
|
|
222
|
+
</ListLine>
|
|
223
|
+
</ListFill>
|
|
224
|
+
<ListLine>
|
|
225
|
+
<ListSort />
|
|
226
|
+
<ListFilter />
|
|
227
|
+
<ListQuickFilters />
|
|
228
|
+
<ListGap />
|
|
229
|
+
<ListCustomize />
|
|
230
|
+
</ListLine>
|
|
231
|
+
<ListLine kind="bar">
|
|
232
|
+
<ListFilterBar />
|
|
233
|
+
<ListGap />
|
|
234
|
+
<ListClearSave />
|
|
235
|
+
</ListLine>
|
|
236
|
+
<ListGrid />
|
|
237
|
+
</ListRoot>
|
|
238
|
+
</YourApp>
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
**All in the page header** (`/layouts/page-header`): one line in the page header holds everything, and no row stands under it.
|
|
244
|
+
|
|
245
|
+
```tsx
|
|
246
|
+
// All in the page header: the views' tabs and every button in the page's own header, through a ListFill, Sort, Filter and
|
|
247
|
+
// Customize as their icon alone; no row stands under it, only the filter bar once something is added.
|
|
248
|
+
export function PageHeaderLayout({ fields, rows, views, quickFilters, onAdd }: DealsProps) {
|
|
249
|
+
return (
|
|
250
|
+
<YourApp>
|
|
251
|
+
<ListRoot id="deals" fields={fields} rows={rows} views={{ seed: views, records: "deals" }} quickFilters={quickFilters}>
|
|
252
|
+
<ListFill name="page-header">
|
|
253
|
+
<ListLine>
|
|
254
|
+
<ListViews />
|
|
255
|
+
<ListGap />
|
|
256
|
+
<ListSearch />
|
|
257
|
+
<ListSort words="icon" />
|
|
258
|
+
<ListFilter words="icon" />
|
|
259
|
+
<ListCustomize words="icon" />
|
|
260
|
+
<ListNew onAdd={onAdd} />
|
|
261
|
+
</ListLine>
|
|
262
|
+
</ListFill>
|
|
263
|
+
<ListLine kind="bar">
|
|
264
|
+
<ListFilterBar />
|
|
265
|
+
<ListGap />
|
|
266
|
+
<ListClearSave />
|
|
267
|
+
</ListLine>
|
|
268
|
+
<ListGrid />
|
|
269
|
+
</ListRoot>
|
|
270
|
+
</YourApp>
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
**No popovers** (`/layouts/no-popovers`): Atlas's ask. One button brings the bar, and sorts and filters are edited on it.
|
|
276
|
+
|
|
277
|
+
```tsx
|
|
278
|
+
// No popovers: one button, Sort and filter, brings the filter bar, and every sort and filter is added and edited right on it.
|
|
279
|
+
export function NoPopoversLayout({ fields, rows, views, quickFilters, onAdd }: DealsProps) {
|
|
280
|
+
return (
|
|
281
|
+
<YourApp>
|
|
282
|
+
<ListRoot id="deals" fields={fields} rows={rows} views={{ seed: views, records: "deals" }} quickFilters={quickFilters}>
|
|
283
|
+
<ListLine>
|
|
284
|
+
<ListViews />
|
|
285
|
+
<ListCustomize />
|
|
286
|
+
<ListGap />
|
|
287
|
+
<ListSortFilter />
|
|
288
|
+
<ListSearch />
|
|
289
|
+
<ListNew onAdd={onAdd} />
|
|
290
|
+
</ListLine>
|
|
291
|
+
<ListLine kind="bar">
|
|
292
|
+
<ListFilterBar shows="button" sorts="yes" />
|
|
293
|
+
<ListGap />
|
|
294
|
+
<ListClearSave />
|
|
295
|
+
</ListLine>
|
|
296
|
+
<ListGrid />
|
|
297
|
+
</ListRoot>
|
|
298
|
+
</YourApp>
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
**Search in the app bar** (`/layouts/app-bar-search`): the search stands as a field in your app's top bar.
|
|
304
|
+
|
|
305
|
+
```tsx
|
|
306
|
+
// Search in the app bar: the search stands as a field at the end of your app's top bar, through a ListFill; the row holds the
|
|
307
|
+
// rest, as the default's.
|
|
308
|
+
export function AppBarSearchLayout({ fields, rows, views, quickFilters, onAdd }: DealsProps) {
|
|
309
|
+
return (
|
|
310
|
+
<YourApp>
|
|
311
|
+
<ListRoot id="deals" fields={fields} rows={rows} views={{ seed: views, records: "deals" }} quickFilters={quickFilters}>
|
|
312
|
+
<ListFill name="app-bar">
|
|
313
|
+
<ListLine>
|
|
314
|
+
<ListGap />
|
|
315
|
+
<ListSearch shows="input" />
|
|
316
|
+
</ListLine>
|
|
317
|
+
</ListFill>
|
|
318
|
+
<ListLine>
|
|
319
|
+
<ListViews />
|
|
320
|
+
<ListCustomize />
|
|
321
|
+
<ListGap />
|
|
322
|
+
<ListSort />
|
|
323
|
+
<ListFilter />
|
|
324
|
+
<ListQuickFilters />
|
|
325
|
+
<ListNew onAdd={onAdd} />
|
|
326
|
+
</ListLine>
|
|
327
|
+
<ListLine kind="bar">
|
|
328
|
+
<ListFilterBar />
|
|
329
|
+
<ListGap />
|
|
330
|
+
<ListClearSave />
|
|
331
|
+
</ListLine>
|
|
332
|
+
<ListGrid />
|
|
333
|
+
</ListRoot>
|
|
334
|
+
</YourApp>
|
|
335
|
+
);
|
|
336
|
+
}
|
|
337
|
+
```
|
package/views/docs/index.md
CHANGED
|
@@ -30,6 +30,10 @@ The grid:
|
|
|
30
30
|
- [The grid](guides/the-grid.md): grouping, sorting, writes, preferences, figures and the editing rules
|
|
31
31
|
- [Looks](guides/looks.md): a piece's options and looks, and picking the grid's by name
|
|
32
32
|
|
|
33
|
+
A list:
|
|
34
|
+
|
|
35
|
+
- [The toolbar's parts](guides/toolbar-parts.md): every part of a list's toolbar and its settings, placed anywhere, with six layouts to copy
|
|
36
|
+
|
|
33
37
|
Reference material:
|
|
34
38
|
|
|
35
39
|
- [The rendering contract](contract.md): every public name (slots, states, tokens, the components map, atoms, ports, icons, message keys) and what each door holds
|
|
@@ -95,7 +95,7 @@ A Button's own look (`ButtonOwnLook`, `buttonOwnOptions`, `buttonOwnAttrs`) is r
|
|
|
95
95
|
- `SheetStep` — one step of a sheet, which a row opens in its place.
|
|
96
96
|
- `SheetButton` — a button in its head: the Glass button under Glass, a quiet Button under Flat.
|
|
97
97
|
- `SheetClose` — a close that is a button of its own (a head's Cancel).
|
|
98
|
-
- `useSheetCloseAll` — closes every sheet open under this one and this one: a choice that finishes the job.
|
|
98
|
+
- `useSheetCloseAll` — closes every sheet open under this one and this one, an app's own sheet or dialog on Base UI under it included: a choice that finishes the job.
|
|
99
99
|
|
|
100
100
|
<!-- The boxes: the Input, the inline input, the Field, the Toggle, the number field, the Checkbox -->
|
|
101
101
|
|
|
@@ -377,7 +377,7 @@ Its name here is `ToolbarButtonControl`: `viewkitjs/views/panels/react` already
|
|
|
377
377
|
|
|
378
378
|
One of a few choices, all of them in sight, on Base UI's radio group: the arrow keys move the choice, a hidden input carries it in a form, and the label round a ring presses it. Its stylesheet is `viewkitjs/views/controls/radio.css`; the words beside a choice and a card's edge and ground (`o-choice-*`) are drawn by `choice.css`, as the Checkbox's are, and its ring's pressing area by `press.css`. Its group marks a phone from the device (`data-vk-phone`), where marked cards stand one under another and tiles on one card. The Links editor draws a link's lead with it.
|
|
379
379
|
|
|
380
|
-
- `RadioGroup` — its choices, one under another: its `label` (the group a FieldSet, its name the legend; without one, give it an `aria-label`), `row` for two to four side by side, `tiles` for marked cards three across, and Base UI's group props (`value`, `defaultValue`, `onValueChange`, `disabled`).
|
|
380
|
+
- `RadioGroup` — its choices, one under another: its `label` (the group a FieldSet, its name the legend; without one, give it an `aria-label`), `row` for two to four side by side, `tiles` for marked cards three across, and Base UI's group props (`value`, `defaultValue`, `onValueChange`, `disabled`).
|
|
381
381
|
- `RadioGroupProps` — its props.
|
|
382
382
|
- `Radio` — one choice: its `value`, its `label` and `note` beside it, `card` drawn as a card, `mark` a mark in place of the ring on a marked card.
|
|
383
383
|
- `RadioProps` — its props.
|
|
@@ -980,7 +980,7 @@ The grip's `moved` and `dragAt`, the list a shell is handed (`handedList`) and t
|
|
|
980
980
|
- `LinksEditorWords` — those words, and its roles list's own (`picker`).
|
|
981
981
|
- `linksWords` — the words handed, over the English.
|
|
982
982
|
|
|
983
|
-
<!-- The press and the choice: press.css, choice.css
|
|
983
|
+
<!-- The press and the choice: press.css, choice.css -->
|
|
984
984
|
|
|
985
985
|
## The pressing area
|
|
986
986
|
|
|
@@ -990,44 +990,6 @@ On a phone a small target keeps the size it draws and takes taps from an invisib
|
|
|
990
990
|
|
|
991
991
|
The label beside a Checkbox, a Radio or a Switch in a settings row (`o-choice-label`, the small text in the text colour), the line under it (`o-choice-note`, the extra-small text in the subtle colour), and a choice drawn as a card (`o-choice-card`: an edge round it, the hovered ground under the pointer, the selected edge and ground when chosen, a softer edge when off, a red edge in error). Its stylesheet is `viewkitjs/views/controls/choice.css`, in the ready stylesheet. Its names are on [its page](../controls/choice.md).
|
|
992
992
|
|
|
993
|
-
## The TagField
|
|
994
|
-
|
|
995
|
-
Tags inside the Input's field, before the caret, in a Field with its label, its note and its error: typing and Enter (or a comma) adds one, a tag already there is not added again, Backspace in an empty box takes the last one off, and each tag has its remove button; disabled, nothing is typed in and the tags have none. The field is an InputGroup, so every state and option of the Input draws it, and on a phone it takes the phone's 44. Its stylesheet is `viewkitjs/views/controls/tag-field.css`, in the ready stylesheet; it stands on the Field's, the Input's and the Tag's. Its names are on [its page](../controls/tag-field.md).
|
|
996
|
-
|
|
997
|
-
- `TagField` — the field. Placed in `FieldRows` (or a phone's `SettingRows`) it is the card's row, as iOS draws a To field: its tags tokens in the card (30 tall, a pill on `--vk-neutral`, no edge, no icon), wrapping, the caret after the last and the placeholder only while it holds none; its label names the box out of sight, for its place to title the group (`o-tag-field-row`); its note and error under the card. Its words are its props: `placeholder` says "Add a tag" when none is handed, and each tag's remove button "Remove <tag>", as the Tag's does.
|
|
998
|
-
- `TagFieldProps` — `label`, `note`, `error`, `disabled`, `defaultValue`, `onValueChange`, `placeholder`, `className`.
|
|
999
|
-
|
|
1000
|
-
## The setting row
|
|
1001
|
-
|
|
1002
|
-
One setting as a row (`SettingRow`): its name and a line under it on the left (the words beside a choice), its control at its end, a mark or an icon at its start. Its kind is the prop it is given:
|
|
1003
|
-
|
|
1004
|
-
- A switch, `switch` — the Switch's props: only the Switch switches it, its words, line and mark pressing nothing, as iOS's Settings; the Switch is named by the row's name (`aria-labelledby`) and described by its line (`aria-describedby`).
|
|
1005
|
-
- A select, `select` — a Select with its own list (its props but `label` and `size`): 36 tall, 220 wide.
|
|
1006
|
-
- A button, `action` — a button (`SettingAction`: `label`, `icon`, `onClick`, `disabled`, `kind`): the Button's outline kind, 32 tall; in a danger card its danger kind; `kind` (`outline` or `danger`) says it, an undoable one outline in the danger zone (Leave).
|
|
1007
|
-
- › to its page, `onOpen` — the whole row a button, its `value` before ›.
|
|
1008
|
-
|
|
1009
|
-
A button's `value` stands before it on a computer, as the open kind's (an email before Change); `iconOnly` draws its `icon` alone, its `label` naming it.
|
|
1010
|
-
|
|
1011
|
-
`state` (`SettingState`: `label`, `colour`) is a word of state before its control on a computer, the Option in its colour (Connected, green), before the reason; on a phone the grey value before ›, the row then the press of its action. `locked` (the reason) shuts its control, which stands greyed after the reason; a switch keeps the Switch's own locked state, a lock in its thumb. `alone` stands a lone row bare, with no card; on a phone a card of its own, the row the press, its name in the link colour. `SettingRows` holds the rows in a card, a line between each, its corners smooth where the browser can draw them; `danger` is the danger zone's, a red edge (`o-setting-rows-danger`). On a phone (a PhoneHost screen, below the app's line, or `form="phone"`) the card and its rows are Field rows' (`field.css`): drawn as iOS's Settings draws them: the name on the left; the value in the quietest grey, cut with …, before iOS's ›; a select's row opens its list in the full Sheet; a button's words stand in the link colour at the row's end, a press of their own; in a danger card each row is the press, its action's `icon` first, its name and icon red; a locked row fades by `--vk-opacity-off` but for its line, where its reason stands. A `Field` placed in its card on a phone is one of its rows, as in `FieldRows`, its note and error in a foot after the card; what a `SettingRow` holds is no row of it. Its `icon` is a line icon (the Icon option's Line, nothing picked) or a white glyph on a tile (Tile), the tile on `colour`, a label colour (`OptionColour`), grey when none; `SettingIcon` draws the same icon beside a list's name outside a row. `SettingChevron` draws its phone ›, 9 × 15, at the end of a list's row outside a row, so one › stands on every settings page. One card, one way: where any of its rows has a start (an icon, or a mark), every row keeps the start's room, so their words stand in one line, and each row's rule starts at the words; each row says what starts it (`data-setting-row-start`: `icon` or `mark`). Its ›, 9 × 15, is `--vk-icon-disclosure`. On a computer it reads its options off the frame round it (its card's, or its own when it stands alone), kept up to date as they change (`useSettingRowWorn`). Under the End option's Words an action is its words (`o-setting-row-act`, red with `data-kind="danger"`), a state a dot in its colour and its words (`o-setting-row-said`), and a locked row's reason stands in its control's place, its words greyed. Under the Card option's Edged the card stands on its ground with a firm edge, its danger zone's plain, a lone row a card of its own and an icon on a grey tile; under the Rows option's Inset the rows stand 60 tall at least, the line between them inset at both ends. Under the Fields option's At the end a `Field` placed in a computer's card is one of its rows (`o-setting-row-field`): its label and note on the left, its error in the note's place, its control at the row's end (an Input 256 wide); a `RadioGroup` standing there draws as a Select of its Radios, named by the row's label, unless its Radios are swatches; and every select at a row's end is as wide as its value. `useSettingRowsRow()` tells a part of an app's own placed in such a card that it stands as one of its rows. Under the Fields option's Boxes (nothing picked) a Field in a computer's card stays a box, the rows' room round it. Its options, the card, the rows, the end and the fields (a computer's) and the icon (a phone's), are on [`viewkitjs/views/looks`](looks.md). Its stylesheet is `viewkitjs/views/controls/setting-row.css`, in the ready stylesheet; it stands on `choice.css`, the Switch's, the Select's, the Button's, the Option's and the Field's. Its names are on [its page](../controls/setting-row.md).
|
|
1012
|
-
|
|
1013
|
-
`SwitchRow` and `SwitchRows` are its switch kind, with the props and the classes they always had (`o-switch-row`, `o-switch-rows`), so `switch-row.css` (its names on [its page](../controls/switch-row.md)) still draws them for an app that hasn't moved to `setting-row.css`. `SwitchRows` keeps its computer form on a phone.
|
|
1014
|
-
|
|
1015
|
-
- `SettingRow` — one row.
|
|
1016
|
-
- `SettingRowProps` — its props: `label`, `note`, `icon`, `colour`, `mark`, `state`, `locked`, `alone`, `className`, and its kind.
|
|
1017
|
-
- `SettingIcon` — a row's icon on its own (`colour`, its glyph as children), for a list that draws its names itself.
|
|
1018
|
-
- `SettingChevron` — the phone row's ›, 9 × 15, on its own, at the end of a list's row that stands beside setting rows.
|
|
1019
|
-
- `SettingRows` — the card.
|
|
1020
|
-
- `useSettingRowWorn` — the setting row's options as the frame round an element picks them, kept up to date.
|
|
1021
|
-
- `useSettingRowsRow` — true for a part placed in a computer's card under At the end, which stands as one of its rows.
|
|
1022
|
-
- `SettingRowsProps` — the card's props: `danger`, `form`, `className`.
|
|
1023
|
-
- `SettingAction` — a row's button: `label`, `icon`, `onClick`, `disabled`, `kind`, `iconOnly`.
|
|
1024
|
-
- `SettingState` — a row's word of state.
|
|
1025
|
-
- `SwitchRow` — the switch kind.
|
|
1026
|
-
- `SwitchRowProps` — its props: every prop of the Switch, and its `label` and `note`.
|
|
1027
|
-
- `SwitchRows` — the card round switch rows.
|
|
1028
|
-
- `settingRowWornOf` — the options worn round an element.
|
|
1029
|
-
- `SETTING_ROW_ATTRS` — the attributes they are set by.
|
|
1030
|
-
|
|
1031
993
|
## The stylesheets
|
|
1032
994
|
|
|
1033
995
|
The ready stylesheet (`viewkitjs/views/styles.css`) carries the controls, every token they read declared at the Outright look's value ([the controls' tokens](../contract.md#the-controls-tokens)). An app on the Outright tokens imports them one by one instead, and declares each token as its own: `viewkitjs/views/controls/smooth.css` first (the smooth corner every control's outline stands on), then each control's own, `viewkitjs/views/controls/<piece>.css` (the Button's `button.css`, the Spinner's `spinner.css`), with `press.css` and `choice.css` for the pressing area and the words beside a choice; each control's names are on its page under `docs/controls/`. Their options and looks are on [`viewkitjs/views/looks`](looks.md).
|
|
@@ -4,14 +4,14 @@ The spreadsheet. The door carries no client directive; every rendering file behi
|
|
|
4
4
|
|
|
5
5
|
## The grid
|
|
6
6
|
|
|
7
|
-
- `GridTable` — draws the spreadsheet: rows in their groups under a header whose column menus sort, group, format and hide, a checkbox rail and a ⋯ tail on each row (its ⋯ drawn only where the grid was handed something it opens: `selection`, `contextMenu`, `rowMenu`, `menus.row`, `rowHref`, `onRowDelete` or a name action), editors opened over cells, a selected range with copy, paste and undo, and a footer of figures per column. An edit shows in its cell at once and goes to `onCellCommit` (a batch to `onCellsCommit`); a failed write rolls the cell back. An undo or a redo shows its value, and takes the focus to its cell, as it is pressed; it is sent once the edit it takes back has answered, or at once when the page closes (`pagehide`), an editor still open writing its draft first. Back from the back-forward cache, an undo sent at the close may have reached the server before the edit it takes back: the cell then ends on the edit's stored value while redo still offers the undo. While `transitionPending` is true, or for one commit after `transitionKey` changes, it draws your app's loading atom instead of the rows, or, handed the components map's `RowsWait` and already showing rows, keeps them, inert, as that slot's children, its column names and footer standing outside the slot, as they are. It takes a `GridTableProps`.
|
|
7
|
+
- `GridTable` — draws the spreadsheet: rows in their groups under a header whose column menus sort, group, format and hide, a checkbox rail and a ⋯ tail on each row (its ⋯ drawn only where the grid was handed something it opens: `selection`, `contextMenu`, `rowMenu`, `menus.row`, `rowHref`, `onRowDelete` or a name action), editors opened over cells, a selected range with copy, paste and undo, and a footer of figures per column. An edit shows in its cell at once and goes to `onCellCommit` (a batch to `onCellsCommit`); a failed write rolls the cell back. An undo or a redo shows its value, and takes the focus to its cell, as it is pressed; one over a cell the rows now show holding a value that is neither side of the edit (someone wrote it since) leaves that cell as it is, sends nothing for it and says "Changed by someone since" (`views.grid.changed-since`), the rest of its cells undone as usual, and a cell whose own write or overlay is still out, or one written with no overlay (a relation, a name, a place, a range), is undone as before; it is sent once the edit it takes back has answered, or at once when the page closes (`pagehide`), an editor still open writing its draft first. Back from the back-forward cache, an undo sent at the close may have reached the server before the edit it takes back: the cell then ends on the edit's stored value while redo still offers the undo. While `transitionPending` is true, or for one commit after `transitionKey` changes, it draws your app's loading atom instead of the rows, or, handed the components map's `RowsWait` and already showing rows, keeps them, inert, as that slot's children, its column names and footer standing outside the slot, as they are. It takes a `GridTableProps`.
|
|
8
8
|
- `GridTableProps` — what `GridTable` takes, flat, typed over your row. Five are required: `groups` (the rows, as the model's `ListGroup`s), `grouped` (whether they draw as group bands), `getRowId`, `columns` (the model's `ListColumn`s) and `onOpenRow` (what opening a row does: the title's text opens it; it receives the row and a `GridRowOpenedFrom`, which brings the focus back to the row's cell once what it opened closes). The rest are optional:
|
|
9
9
|
- Rows and groups: `rowHref`, `onPrefetchRow` (warm a row's detail on a pointer's intent), `rowClassName`, `rowIcon` and `showRowIcon` (the title cell's glyph, as a descriptor the grid sizes and colours, or the row's picture through your `Avatar` atom when the descriptor hands an `avatar`), `onOpenRelation` and `entityIcon` (opening the record a relation cell points at, and the glyph for a kind; without `onOpenRelation`, relation cells are inert), `isCollapsed` and `onToggleGroup` (your group collapse), `oneHeader` (a grouped grid draws one row of column names, pinned at the top over every group, in place of each group's own; each group's bar pins under it, and the row's checkbox picks every row; off by default, when each group draws its own with the box that picks its rows), `pinFooter` (the footer pins at the foot of the grid's scroll area, `--vk-scroll-inset-bottom` above its edge and, while rows are selected, a step above the bar `renderBar` draws, on a phone the rows then ending at the footer's bottom (measured where it stands; on the foot when it draws none), the rows passing under it, painted the ground and `data-stuck` only while they do; on a computer never pushed below its last row, so under a short table it stands right after it; on a phone an ungrouped grid's stands at the foot even when its rows don't fill the area, in pages just above the pager; a grouped grid's each pin while their group's rows run past the foot and close their group otherwise; a line along its top while rows pass under it; off by default, when the footer stands after the last row), `renderGroupLabel`, `renderGroupFooter` (a group's paged continuation after its loaded rows), `onHideGroup`, `countOf`, `loadMore` (`hasMore`, `onReveal` and a `label`), `pages` (`GridPages`: `page` from 1, `size`, `total`, the view's count, `exact`, false for a capped count, `sizes`, the page-size pick's choices, default 25, 50 and 100, and `onPage` and `onSize`: an ungrouped grid draws the page you hand and the pager part `vk-grid-pager` under it, `loadMore` is then not drawn, picks clear on a page or size change, and the footer shows only the figures a group carries in `figures`; a grouped grid draws no pager; absent by default), `emptyState`, and `transitionKey`, `transitionPending` and `transitionLabel` (a view change: the wait paints before the new rows mount).
|
|
10
10
|
- Row actions and menus: `rowMenu` (a row's items, on right-click and in its ⋯ tail; the same builder a list takes), `contextMenu` (a right-click menu that differs from it), `rowActions` (buttons in the title cell's action lane, before the grid's own Edit), `onRowDelete` and `deleteLabel` (a delete row in the row's menu), `menus` (`GridMenus`: each of the grid's menus as data, reshaped by your function; `menus.row` is asked as a row's menu opens and may answer a promise, the menu waiting on one greyed row until it does, and holds Open page and Delete as `row-open` and `row-delete`, so a row's Delete is offered per row; the ready `<List>` (VK-742) hands the same `menus.row` through), `commands` (the verbs a `command` column's cell opens, by field key; without it a command column is a read-only badge) and `selection` (the list's selection; its optional `renderBar` draws the bar it opens, `SelectionBar` with your verbs, and without one the rows still tick and no bar is drawn).
|
|
11
11
|
- Sort, group and figures: `sort` (`GridSortState`), `sortMark` (a sorted column's header wears `icons.sortAsc` or `icons.sortDesc` after its name, or your `HeaderSortMark` atom; off by default, `aria-sort` saying it either way), `groupBy` (`GridGroupByState`: handed, a column's menu offers Group by and Ungroup, saved view or not), `sortOptions` (the group band menu's sort, as `GridGroupSortOption`s), `groupMenu` (the parts a group band's ⋯ holds, as `GridGroupMenuPart`s: `"select"` (Select all in group, on a grid with a `selection`), `"sort"`, `"figures"`, `"hide"`), `groupSummary` and `onGroupSummaryChange` (which figures ride beside a group's name), `groupFigures` (`GridGroupFigure`s), `countNoun` (`GroupCountNoun`), `aggregates`, `onAggregateChange` and `renderAggregate` (the footer's figure per column), `viewBacked` (a saved view: Sort on every bound column, and figures only for field-backed columns; it doesn't decide Group by) and `defaultCurrency` (the reader's currency, which a money column read as it was entered totals in).
|
|
12
12
|
- Format overrides and their handlers, every map keyed by field key: `optionColors`, `dateStyles`, `durationStyles`, `numberFormats` (decimals null is the field's own), `showTimeOverrides` and `percentDisplays`, each with its `on…Change` handler taking the field key first, and `formatsWritable` (false hides the stored format knobs from the column menu; default true).
|
|
13
13
|
- Columns and preferences: `columnState` and `onColumnStateChange` (order, widths, and which columns show), `renderAddColumn` (your own add-column cell at the header's end, or in the title column's header under `addColumnAt`; without it, or answering `undefined`, `false` or `""`, the grid's own lists the hidden columns; answering `null`, none is drawn and no room is kept for it), `addColumnOnPhone` ("+ Add column" on a phone too, its list in your `Menu`; off by default), `addColumnAt` (`"title"` stands "+ Add column" as a lone + at the right edge of the title column's header, in reach while the columns scroll, and the tail keeps no room for it; `"end"`, the default, the header row's last cell; with no title column shown it stands at the end), `phonePicking` (a phone picks rows by a long press, the boxes inside the name column before the picture, and always shown on a grouped grid, its titles row's box in the name column's head; needs `selection`; off by default), `parts` (a column per part of a name, a place or a range, offered under its field in "+ Add column"; off by default), `columnMenuItems` (your rows in a column's menu, as data, above Hide: the old route, which adds rows only; `menus.column` reshapes the whole menu), and the per-user toggles `freezeIdentity` (the identity columns, everything through the title, pinned at the left edge; on by default, on the bare prop, in `LIST_VIEW_PREF_DEFAULTS` (`gridFreezeIdentity`), in a view's look and in the grid's look alike; hand `false`, or start your prefs with `gridFreezeIdentity: false`, to open it unpinned), `alwaysCheckboxes`, `verticalBorders` (the lines between the columns, the last column's closing the table, in the rows and the footer; the footer draws a line under itself either way) and `scale`; and `headerVerticalBorders` (the header's columns ruled as the rows' are under `verticalBorders`, the last column's included; off by default); and `fillWidth` (the columns share the grid's whole width, each in proportion to its own width and never below it, a column the person resized or one with a `grid.maxWidth` keeping its width; a table wider than the grid scrolls sideways as without it; off by default).
|
|
14
|
-
- Writes: `onCellCommit` (`GridCellCommitFn`) and `onCellsCommit` (`GridCellsCommitFn`).
|
|
14
|
+
- Writes: `onCellCommit` (`GridCellCommitFn`) and `onCellsCommit` (`GridCellsCommitFn`); `cellValues` (`GridCellValuesFn`, as `gridSave` hands it), so every column a cell's save writes beside its own shows the new value as the save is sent and rolls back with it.
|
|
15
15
|
- `rowHighlight`: which row the grid tints. `"hover"`, the default, the row under the pointer, as always; `"active"`, the active row alone, `data-active`: the row a person last pressed, anywhere on it, or the picked cell's row, so the keyboard moves it too, kept through a press outside the grid and Escape until another is pressed or picked; no row tints under the pointer then, nor a `hoveredRow`, while the hover's box, ⋯ and the name's actions still show.
|
|
16
16
|
- States held from outside, each off when left out, as a page that shows the grid's states side by side needs them: `hoveredRow` (a row, by its id, drawn as under the pointer: its tint, its rail's box, its ⋯ and the name's actions, and `data-hovered`, while a real pointer still hovers any row beside it; drawn, as a hover is, only on a screen whose pointer hovers) and `onHoveredRowChange` (the row a person's pointer moves onto, or null off it); `cellPick` (a `GridCellPick` drawn as picked, placed each time its value changes without taking the page's focus; while it is given, null included, a press outside the grid lets go of nothing, and a person's click, drag, keys and Escape move it as always) and `onCellPickChange` (each change a person makes, or null); `openColumnMenu` (the column, by its id, whose menu stands open on the first row of column names, its header cell `data-open`; while it is given, null included, the menus open and close only as it says) and `onOpenColumnMenuChange` (the column a person's press opens, or null when a press, a row of the menu or a press outside closes it, for you to answer).
|
|
17
17
|
- List config: `listConfig` (the settings layer every user of the list inherits, which may only take away from what the columns declare: the table read-only, per-column locks; a constraint on the screen, while your API guards its own writes). The grid only reads it: a surface of your own changes it.
|
|
@@ -38,11 +38,12 @@ The spreadsheet. The door carries no client directive; every rendering file behi
|
|
|
38
38
|
|
|
39
39
|
## Writes
|
|
40
40
|
|
|
41
|
-
- `gridSave` — the two commit functions over the one save your app gives: `gridSave(save, { getRowId, values?, read? })` returns `{ onCellCommit, onCellsCommit }` to spread on `GridTable
|
|
41
|
+
- `gridSave` — the two commit functions over the one save your app gives: `gridSave(save, { getRowId, values?, read? })` returns `{ onCellCommit, onCellsCommit, cellValues }` to spread on `GridTable`: `cellValues` is the `values` below, which the grid reads every other column over, so a save that writes more than its cell's field (an amount and its direction) shows each column it changes as it is sent, and rolls them back with it. Make it once per grid (at module scope, in a `useState` initializer, or a `useMemo` on a stable `save`): the queues live in what one call returns, so one made in a render starts each render with empty queues. Every write (an edit, a paste, a fill, an undo, a redo) is one `save` call per record, its cells' values merged, records in the order their first cell came. A record has one call in flight at a time; the next waits for it to settle, whatever it answered. When the page goes (`pagehide`), every change still waiting is sent at once, inside the event, with `closing: true`, and a change made while the page goes (an open editor's draft) is sent at once too, after what its record still had waiting; a call already out is not sent again, and may be dropped with the page. `values(row, columnId, value, context)` turns one cell's change into the values sent (default `{ [columnId]: value }`, fields bound by their key; two cells writing one key send the later one's); a throw there or in `getRowId` refuses that cell alone, its message said in the grid's toast, and the rest of its record still saves. A save that resolves `{ stored }` shows, in each cell one of whose keys it holds, what `read({ ...row, ...values, ...stored }, columnId)` reads (default `row[columnId]`; a `read` that throws leaves the cell as sent); a save that rejects, or throws, rolls back its record's cells with its error, the other records' cells standing. Neither function rejects.
|
|
42
42
|
- `GridSaveOptions` — what `gridSave` takes beside the save, typed over your row: `getRowId` (the record's id, sent as `ListChange`'s `id`), `values` (one cell's change as the values sent, `(row, columnId, value, context)`; throw to refuse that cell; default `{ [columnId]: value }`) and `read` (a column's value off a row, to read what `stored` kept; default `row[columnId]`).
|
|
43
43
|
- `ListChange` — one record's change, as `save` receives it: `{ id, row, values, closing? }`; `closing`: the page is going, so send it to outlive the page (`fetch(…, { keepalive: true })`, or a beacon), its request started before `save` awaits anything. Without `keepalive`, a request still waiting for a connection when the page has gone is dropped, and it often waits: the page usually goes while earlier saves still hold the browser's six connections to your server, and an undo of a fill is several saves sent at once. Two saves of one record may then be out together, the earlier one still running: a server that applies a record's writes in the order they arrive keeps the later one, the undo, last.
|
|
44
44
|
- `ListSave` — the save your app gives `gridSave`: `(change) => Promise<void | { stored?: Partial<Row> }>`.
|
|
45
45
|
- `GridCellCommitFn` — writes one cell: `(row, columnId, value, context?)`, returning a promise of nothing or a `GridCommitOutcome`. Nothing counts as confirmed; a rejection rolls the cell back. `context` is present on an undo or a redo, and on any write while the page closes.
|
|
46
|
+
- `GridCellValuesFn` — one cell's change as the values its record's save sends, `(row, columnId, value, context)`: what `gridSave` hands back as `cellValues`, and `GridTable` takes as `cellValues`. The grid reads each other column (its `editAccessor`, else its `accessor`) over the row with those values, and shows, with the edit, each column whose field key they hold or whose read they change.
|
|
46
47
|
- `GridCellsCommitFn` — writes several cells at once (a paste, a fill, an undo of several): `(edits)`, each `{ row, columnId, value, context? }`, returning a promise of nothing or one outcome per edit, in order. A failed edit rolls its own cell back. Without it, or for a single cell, the grid calls `GridCellCommitFn` for each.
|
|
47
48
|
- `GridCommitContext` — what a write is: `{ kind: "commit" }`, with `reload: false` when the caller reloads once after a second write, or `{ kind: "restore", expected }`, an undo or a redo writing a value back, `expected` the value the cell is held to before it. Either carries `closing: true` when it is sent while the page goes (`pagehide`): send it so it outlives the page (`fetch(…, { keepalive: true })`), as `ListChange` says. An `onCellsCommit` call whose edits carry it starts every one's request inside the call, before it awaits anything: a fan-out that sends some rows only after others answer, or one row's cells one after another, sends the rest after the page has gone, where nothing carries them.
|
|
48
49
|
- `GridCommitOutcome` — how a write ended. `confirmed`, with an optional `history` (false keeps it out of undo, or `{ prev, next }` are the values undo and redo write instead), `settlement` (`requested`: the row holds the value but its provider has not accepted it yet, and the cell says so) and `stored` (what was kept, when it isn't what the cell sent, as the row reads it in this column: the cell shows it in place of what was typed, undo and redo restore from it, and no "changed elsewhere" follows; on an undo or a redo the cell shows it until the rows carry it, and the history is left as it was); `unconfirmed`, never in the undo history; or `failed`, with an optional `error`, which rolls the cell back.
|