@viewkitjs/views 0.4.0 → 0.5.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 +148 -0
- package/README.md +3 -3
- package/dist/atoms/DrillRows.d.ts +3 -0
- package/dist/atoms/DrillRows.js +25 -0
- package/dist/atoms/PanelRows.d.ts +5 -0
- package/dist/atoms/PanelRows.js +40 -0
- package/dist/atoms/PanelSearch.d.ts +2 -0
- package/dist/atoms/PanelSearch.js +21 -0
- package/dist/atoms/SelectionSheet.d.ts +3 -0
- package/dist/atoms/SelectionSheet.js +30 -0
- package/dist/atoms/defaults.js +12 -0
- package/dist/atoms/types.d.ts +117 -1
- package/dist/contract.d.ts +170 -9
- package/dist/contract.js +179 -2
- package/dist/figures.d.ts +5 -48
- package/dist/figures.js +1 -63
- package/dist/grid/chrome/GridColumnMenu.d.ts +3 -3
- package/dist/grid/chrome/GridColumnSortSection.d.ts +3 -3
- package/dist/grid/chrome/GridGroupMenu.d.ts +2 -2
- package/dist/grid/chrome/GridTable.js +1 -1
- package/dist/grid/useGridTablePrefs.d.ts +1 -1
- package/dist/grouping/sort-groups.d.ts +6 -7
- package/dist/model/aggregates.d.ts +3 -3
- package/dist/model/aggregates.js +17 -71
- package/dist/model/column-order.d.ts +2 -2
- package/dist/model/column-schema.d.ts +6 -7
- package/dist/model/column-state.d.ts +3 -20
- package/dist/model/column-state.js +1 -4
- package/dist/model/column-types.d.ts +1 -15
- package/dist/model/column-types.js +1 -1
- package/dist/model/part-columns.d.ts +1 -6
- package/dist/model/part-columns.js +1 -1
- package/dist/model/part-rows.d.ts +2 -9
- package/dist/model/part-rows.js +1 -10
- package/dist/model/preferences.d.ts +3 -23
- package/dist/model/preferences.js +1 -17
- package/dist/model/prefs-buckets.d.ts +0 -27
- package/dist/model/prefs-buckets.js +1 -1
- package/dist/model/relation-filters.d.ts +0 -1
- package/dist/model/relation-filters.js +1 -1
- package/dist/model/row-icon.d.ts +5 -9
- package/dist/model/view-rules.d.ts +32 -6
- package/dist/model/view-rules.js +94 -22
- package/dist/provider/ViewsProvider.d.ts +6 -2
- package/dist/provider/ViewsProvider.js +3 -2
- package/dist/provider/components.d.ts +16 -0
- package/dist/provider/context.d.ts +3 -1
- package/dist/provider/desktop.d.ts +3 -0
- package/dist/provider/desktop.js +7 -4
- package/dist/react.d.ts +2 -2
- package/dist/selection/SelectionBar.d.ts +18 -0
- package/dist/selection/SelectionBar.js +92 -0
- package/dist/selection/SelectionBarPhone.d.ts +3 -0
- package/dist/selection/SelectionBarPhone.js +14 -0
- package/dist/selection/bar-overflow.d.ts +12 -0
- package/dist/selection/bar-overflow.js +42 -0
- package/dist/selection/bar-parts.d.ts +15 -0
- package/dist/selection/bar-parts.js +17 -0
- package/dist/selection/index.d.ts +2 -0
- package/dist/selection/index.js +1 -0
- package/dist/selection/types.d.ts +3 -2
- package/dist/selection/verbs.d.ts +34 -0
- package/dist/selection/verbs.js +1 -0
- package/docs/contract.md +62 -8
- package/docs/getting-started.md +1 -1
- package/docs/guides/atoms.md +2 -1
- package/docs/guides/selection.md +32 -20
- package/docs/guides/the-grid.md +3 -2
- package/docs/guides/the-provider.md +4 -2
- package/docs/index.md +2 -0
- package/docs/install.md +4 -1
- package/docs/reference/grid.md +2 -2
- package/docs/reference/react.md +13 -3
- package/docs/reference/selection.md +10 -2
- package/docs/reference/views.md +25 -27
- package/package.json +22 -3
- package/skills/views/SKILL.md +1 -1
package/docs/reference/views.md
CHANGED
|
@@ -28,19 +28,21 @@ Guide: [the provider](../guides/the-provider.md).
|
|
|
28
28
|
- `ComponentName` — one member of `COMPONENT_NAMES`.
|
|
29
29
|
- `OPTIONAL_COMPONENT_NAMES` — the primitives your app may leave out: `Input` (a plain default), `Command` (reached without one, it throws an error naming it), `Picker` (without one, the lists draw from `Command`), `Calendar` (reached without one, it throws an error naming it) and `DateBody` (without one, the date editor draws its own around `Calendar`) ([the components map](../contract.md#the-components-map)).
|
|
30
30
|
- `OptionalComponentName` — one member of `OPTIONAL_COMPONENT_NAMES`.
|
|
31
|
-
- `ATOM_NAMES` — the pieces the rendering is built from, and the pieces of your app's own it cannot draw itself (a command cell's verb menu, the row's right-click menu, where a relation goes, a wait, how a list asks for more). Each ships as a default, and your app swaps any of them through the provider's `atoms` ([the atoms](../contract.md#the-atoms)).
|
|
31
|
+
- `ATOM_NAMES` — the pieces the rendering is built from, and the pieces of your app's own it cannot draw itself (a command cell's verb menu, the row's right-click menu, where a relation goes, a wait, how a list asks for more), and the panels' rows. Each ships as a default, and your app swaps any of them through the provider's `atoms` ([the atoms](../contract.md#the-atoms)).
|
|
32
32
|
- `AtomName` — one member of `ATOM_NAMES`.
|
|
33
33
|
- `ATOM_SLOTS` — the `data-slot` values the default atoms mark themselves with, prefixed like the grid's (`vk-row`, `vk-tick`, `vk-status`, `vk-row-menu` …) ([the atoms](../contract.md#the-atoms)).
|
|
34
34
|
- `AtomSlot` — one member of `ATOM_SLOTS`.
|
|
35
35
|
- `EDITOR_SLOTS` — the `data-slot` values the editor panel marks its parts with, prefixed like the grid's (`vk-editor-panel`, `vk-editor-bar`, `vk-editor-refusal`) ([the editor panel](../contract.md#the-editor-panel)).
|
|
36
36
|
- `EditorSlot` — one member of `EDITOR_SLOTS`.
|
|
37
|
+
- `SELECTION_SLOTS` — the `data-slot` values the selection bar marks its parts with, prefixed like the grid's (`vk-selection-bar`, `vk-selection-pill`, `vk-selection-chip`) ([slots](../contract.md#slots)).
|
|
38
|
+
- `SelectionSlot` — one member of `SELECTION_SLOTS`.
|
|
37
39
|
- `ATOM_STATES` — the default atoms' states: `chosen`, `disabled`, `muted`, `checked` and `open` are flags present when true, `status` carries the status slot's name and `platform` a link's platform key ([the atoms](../contract.md#the-atoms)).
|
|
38
40
|
- `AtomState` — one member of `ATOM_STATES`.
|
|
39
41
|
- `PORT_NAMES` — the runtime services your app hands in through the provider: `toast`, `haptics`, `clipboard`, `viewPrefs` and `confirm` ([Ports](../contract.md#ports)).
|
|
40
42
|
- `PortName` — one member of `PORT_NAMES`.
|
|
41
|
-
- `ICON_NAMES` — the glyphs the rendering asks your app for, by what they mean, never by a library's name: the field types, who did it, the actions, navigation and order, the figures
|
|
43
|
+
- `ICON_NAMES` — the glyphs the rendering asks your app for, by what they mean, never by a library's name: the field types, who did it, the actions, navigation and order, the figures, the grid's menus and the panels' (`search`, `reset`). Your app maps each to its own icon component ([Icons](../contract.md#icons)).
|
|
42
44
|
- `ViewsIconName` — one member of `ICON_NAMES`.
|
|
43
|
-
- `MESSAGE_NAMESPACES` — the
|
|
45
|
+
- `MESSAGE_NAMESPACES` — the six namespaces every visible string the package owns is keyed under: `views.grid`, `views.editors`, `views.menus`, `views.display`, `views.selection` and `views.panels`.
|
|
44
46
|
- `ViewsMessageNamespace` — one member of `MESSAGE_NAMESPACES`.
|
|
45
47
|
- `ViewsMessage` — a message the package emits: its `key` and, where it has any, the `values` a resolver may interpolate (`{ key: "views.editors.tag-remove", values: { label } }`), never a sentence. The union is closed, so a new key is a compile error in every exhaustive resolver that has not worded it. A string `@viewkitjs/fields` already keys stays a fields message. The keys and their values are listed in [the contract](../contract.md#message-keys).
|
|
46
48
|
- `ViewsMessageKey` — the key of a `ViewsMessage`: the union of every message key.
|
|
@@ -74,7 +76,6 @@ A column is plain data: what a list shows in one place for every row, how it rea
|
|
|
74
76
|
- `RenderedValue` — what the grid hands a custom `render` beside the row: `value`, the column's figure as its `accessor` reads it, and `code`, the currency that figure is in. A custom money cell draws that reading and converts nothing.
|
|
75
77
|
- `ListColumnOption` — one option of a select, status or multiselect column: its `value`, and optionally its `label`, its status `slot`, its category `color`, its stage `mark` (when the option is a position on a ladder, drawn in place of the plain dot) and `archived` (out of every picker, still drawn on a row that holds it).
|
|
76
78
|
- `ListSelectColor` — an option's category colour: one of the design palette's category hues.
|
|
77
|
-
- `ListStatusSlot` — a status slot from the design palette, as an option or a cell action names it.
|
|
78
79
|
- `ListRelationValue` — one relation value, already resolved by your host: the contract's `RelationValue` (`id` compared and committed but never shown, `label` shown, sorted and copied, `entity` handed back when the chip is opened, `avatarUrl`) plus an optional per-value `icon`, for a column whose rows point at different kinds. The grid never turns an id into a label itself.
|
|
79
80
|
- `ListCellAction` — a button drawn in a cell: its `id`, an `icon` for the row, and optionally a `label`, an `onClick` handed the row and the click, and a `status` slot that tints it.
|
|
80
81
|
- `ListCardZone` — where a column lands on a card: `title`, `chips`, `figures`, `footer` or `body`. The board's type defaults decide it for almost every column; `card.zone` overrides it. `body` is prose, never a default, and draws only on a card laid out roomy enough for a sentence.
|
|
@@ -115,7 +116,6 @@ What the machinery may do with each column type, declared once per type so a new
|
|
|
115
116
|
- `GridPasteKind` — how a pasted clipboard cell becomes a commit: `text`, `option` (the pasted text matched against an offered option's label or key, exact before ignoring case, an in-grid copy landing on the exact option it copied, a label two options share refused), `number`, `date`, `boolean`, `relation` (the pasted label matched against the candidates, committing the id), `list` (the text split into several values, each read as an `option` is on a column of options), `range` (an in-grid pair, or text read as a range is written: "11–50", "10,001+", "up to 50"), or `none` (the type refuses paste).
|
|
116
117
|
- `GridValueKind` — what a written value must look like for a type: `any`, `email`, `url`, `boolean`, `relation` or `list`. `gridNormalizeWrite` holds a value to it.
|
|
117
118
|
- `gridPasteKind` — how a paste becomes this column's value. A `multiple` column pastes as a `list` when it presents a field of a type that keeps several values, and takes no paste otherwise; any other column answers with its type's rule. Returns `null` for a column with no type.
|
|
118
|
-
- `resolveGridRelation` — reads a raw relation value as a `ListRelationValue`, filling in the column's default kind (`relation.entity`) where the value names none; a value's own `entity` wins. Returns `null` for a value that is not a relation.
|
|
119
119
|
- `gridRelationSource` — the candidates the relation picker offers for a column: its `relation.source`, or a static list of its `relation.options`. Given an `entityIcon` resolver, each candidate without an icon of its own wears its kind's glyph, both in a static list and in each page a remote search returns; without one, the candidates come back untouched.
|
|
120
120
|
|
|
121
121
|
## What may be done to a column
|
|
@@ -163,9 +163,7 @@ What a person changes about the columns (which are shown, in what order, at what
|
|
|
163
163
|
- `resolveColumnOrder` — the declared columns in a stored order: the ids the order names first (an unknown id dropped), and each column the order leaves out placed after its nearest declared neighbour that is placed. An empty order returns the declaration.
|
|
164
164
|
- `resolveVisibleColumns` — the columns a view draws: in the state's order, without the hidden ones, and never none (the first column stays when every column is hidden).
|
|
165
165
|
- `resolveColumnWidths` — each visible column's width by id: its stored width, held to its bounds, or its declared `width`.
|
|
166
|
-
- `clampColumnWidth` — a width held between a column's `grid.minWidth` (
|
|
167
|
-
- `LIST_DEFAULT_MIN_WIDTH` — the narrowest a column can be dragged when it states no `grid.minWidth`: 60 pixels.
|
|
168
|
-
- `computeMinWidth` — the width a set of columns needs: their widths summed, plus the gutter you pass.
|
|
166
|
+
- `clampColumnWidth` — a width held between a column's `grid.minWidth` (60 pixels when it states none) and its `grid.maxWidth`, rounded to a whole pixel.
|
|
169
167
|
- `ListDensity` — the density every view shares: `compact`, `default` or `spacious`. Each view spends it its own way; the grid scales its pixels, the rows views widen their padding.
|
|
170
168
|
- `prettifyOptionValue` — a stored code made readable: underscores and hyphens become spaces and each word starts with a capital (`on_hold` reads `On Hold`).
|
|
171
169
|
|
|
@@ -212,8 +210,7 @@ Mistakes a column declaration can make that nothing else catches, returned as li
|
|
|
212
210
|
## The row icon
|
|
213
211
|
|
|
214
212
|
- `ListRowIconAccessor` — what a list declares as `rowIcon` for the leading glyph in each row's title cell: a function from a row to an icon name for the neutral default, a `ListRowIcon` to tint it, or `null` to draw none for that row.
|
|
215
|
-
- `ListRowIcon` — a row icon as a descriptor: `icon`, your app's own name for the glyph, which your `AppIcon` draws, and an optional `tone
|
|
216
|
-
- `ListRowIconTone` — a row icon's tint: a status slot, asked for by name, because a coloured row icon says something about state. Without one the glyph draws in the secondary text colour.
|
|
213
|
+
- `ListRowIcon` — a row icon as a descriptor: `icon`, your app's own name for the glyph, which your `AppIcon` draws, and an optional `tone`, a status slot asked for by name, because a coloured row icon says something about state. Without one the glyph draws in the secondary text colour. The grid owns its size and colour.
|
|
217
214
|
- `normalizeRowIcon` — reads either answer a `ListRowIconAccessor` gives as a `ListRowIcon`: a bare name becomes `{ icon }`, a descriptor stays as it is, and `null` stays `null`.
|
|
218
215
|
|
|
219
216
|
## Render counting
|
|
@@ -474,7 +471,6 @@ One Filter panel row per relation the list's source can look across, under the s
|
|
|
474
471
|
- `FarValues` — the far values a host hands as `farValues`, keyed by `farPathOf`: `values`, each path's values; optionally `labels`, each path's values to their names; and `onWanted(path)`, called when a named far field's row opens, so the host can fetch its values.
|
|
475
472
|
- `farPathOf` — a far field's path, as the host keys its values: the relation's key (itself a two-hop path, `a.b`, for a rollup's second hop), `FAR_PATH_SEPARATOR` and the far field's key, such as `deals.owner`.
|
|
476
473
|
- `FAR_PATH_SEPARATOR` — `.`, what separates a far path's hops and its far field; a field key never holds one.
|
|
477
|
-
- `RELATED_RECORDS_SECTION` — `"Related records"`, the section every relation row sits under.
|
|
478
474
|
- `relationFilterKey` — a Related records row's key, from the relation's field key: the key with `relation:` before it.
|
|
479
475
|
- `relationFieldKeyOf` — the relation's field key, back from a Related records row's key; a key without the prefix comes back as it is.
|
|
480
476
|
|
|
@@ -521,9 +517,8 @@ A list keeps its preferences in separate buckets, by what each follows. The layo
|
|
|
521
517
|
- `StoredViewLayout` — what is stored for one view: only the keys someone set. A key that is absent follows the reader's default, so a key is written only where the view means to differ.
|
|
522
518
|
- `ListLayoutBucket` — a list's layouts, `{ views }`, the stored layout of each view by view id.
|
|
523
519
|
- `EMPTY_LAYOUT_BUCKET` — a layout bucket with no views.
|
|
524
|
-
- `LIST_LAYOUT_DEFAULTS` — the shipped layout: no column state, the default density, the row icon on and every other switch off.
|
|
525
520
|
- `layoutKey` — the key a list's layout bucket is stored under: `list:<listKey>:layout`.
|
|
526
|
-
- `readViewLayout` — resolves one view's layout from the bucket, key by key: a stored value wins (a stored `false` included), vertical borders fall to the reader's defaults, the rest to
|
|
521
|
+
- `readViewLayout` — resolves one view's layout from the bucket, key by key: a stored value wins (a stored `false` included), vertical borders fall to the reader's defaults, the rest to the shipped layout: no column state, the default density, the row icon on and every other switch off. The calendar's and the board's keys appear only when stored.
|
|
527
522
|
- `writeViewLayout` — patches one view's stored layout and returns a new bucket, every other view untouched. The patch lands on what is stored, never on the resolved layout; vertical borders set to the reader's default and any key set to `undefined` are dropped, so the view follows the default again.
|
|
528
523
|
- `ListDefaults` — the reader's own defaults, which every view without an answer of its own follows: whether a table draws rules between its columns (`verticalBorders`).
|
|
529
524
|
- `LIST_DEFAULTS_KEY` — the key the reader's defaults are stored under, `list:defaults`, one per person across devices.
|
|
@@ -531,20 +526,28 @@ A list keeps its preferences in separate buckets, by what each follows. The layo
|
|
|
531
526
|
- `ListMoneyBucket` — the reader's money readings for one list, `{ gridCurrencies }`, by field key: one per list, so a pick in a money column's header means the same on every view.
|
|
532
527
|
- `EMPTY_MONEY_BUCKET` — a money bucket with no readings, frozen.
|
|
533
528
|
- `moneyKey` — the key a list's money bucket is stored under: `list:<listKey>:money`.
|
|
534
|
-
- `ListFieldFormatPrefs` — how one field reads, the host's shared answer for every view and every member: decimals, currency, date style, duration style, whether a date shows its time, option colours and percent display. The flat maps of `ListViewPrefs` are this shape spread out by field key.
|
|
535
529
|
- `hoistLegacyPrefs` — reads a flat preferences blob into a layout bucket, `{ layout }`: the columns, density and five switches it carries go to the `table` view (a key it lacks stays unset), and the `list` view starts empty. Filters, sort, grouping and formats are left where they are. It is pure, so a host may run it on every read and store the bucket only once the person changes something.
|
|
536
530
|
|
|
537
531
|
## The view rules
|
|
538
532
|
|
|
539
533
|
A saved view's filter is a tree of rules keyed by field key; the Filter panel edits its root level as `ListFilterRule`s keyed by column id. These convert between the two and read a list's rows the way a view names them. With `parts: true`, a rule on one part of a value is edited by its own row, under its part key (`partKey`).
|
|
540
534
|
|
|
535
|
+
`filterPanelFromTree` and `treeFromFilterPanel` are the one conversion between a panel and a tree, and the quick values read and write through the same one. A root rule is drawn on a row only when writing the row's rule back gives the same rule; everything else stays in the state's `rest`, whole, so a round trip loses no rule. A between with an end still empty keeps it empty (`null`), so it filters nothing until both ends are in.
|
|
536
|
+
|
|
537
|
+
- `FilterPanelState` — a filter tree as a panel edits it: the root's `op`, one rule per row in `rules` (a column's whole value under its id, a part row's under its part key), and every root item no row draws in `rest`, in its order: and/or/not groups, relation rules, a second rule on a row already drawn, and a rule no row can show.
|
|
538
|
+
- `filterPanelFromTree` — reads a tree into a `FilterPanelState` over a list's columns, part rows included with `parts: true`.
|
|
539
|
+
- `treeFromFilterPanel` — the tree a `FilterPanelState` says: the rows' rules in column order, then the rest. A rule that asks nothing (none ticked, yes and no both ticked) writes nothing, nor does a key no row names. Reading the tree it writes gives the same state.
|
|
540
|
+
- `QuickValues` — a quick-filter panel's picks by field key: an option's codes, a yes/no field's `"true"` or `"false"`.
|
|
541
|
+
- `QuickValueField` — a field a quick-filter panel offers: its key, and the type its value is read as, one whose rule picks options.
|
|
542
|
+
- `quickValuesFromTree` — the picks a quick-filter panel draws: each offered field's root rule that picks options, as its values.
|
|
543
|
+
- `withQuickValues` — the tree with the offered fields' picks written as ordinary root rules, a field with none picked left with none; every other item kept, a rule on an offered field the panel can't show (an `is_none_of`) among them.
|
|
544
|
+
|
|
541
545
|
- `fieldKeyOf` — the key a column is known by off the grid: its field's key, or its own id when it has no field.
|
|
542
|
-
- `fromListFilterRule` — converts a panel rule into a view's rule for one field key and field type, the part it reads when given one. Returns `null` for a rule that asks nothing: options with none ticked, or a yes/no field with both ticked.
|
|
546
|
+
- `fromListFilterRule` — converts a panel rule into a view's rule for one field key and field type, the part it reads when given one. Returns `null` for a rule that asks nothing: options with none ticked, or a yes/no field with both ticked. A between's end still empty stays `null`, and an operator that takes no value (is empty, is not empty) stores `null`.
|
|
543
547
|
- `toListFilterRule` — converts a view's rule into the panel rule that edits it, or `null` when no editor can show it: a place, a derived field's raw type, an operator its editor does not offer. A rule on one part of a value maps only with `parts: true`, to a checklist for a part that opens on `is_any_of` (a place's country) and to text otherwise.
|
|
544
|
-
- `rootRulesByColumn` — the root rules the panel can edit, by column id (and part key, with `parts`). Groups, relation rules and rules on a field no column carries are left out.
|
|
545
|
-
- `
|
|
546
|
-
- `
|
|
547
|
-
- `rootRelationRules` — the root relation rules, by relation field key: what the panel's related-records rows edit.
|
|
548
|
+
- `rootRulesByColumn` — the root rules the panel can edit, by column id (and part key, with `parts`). Groups, relation rules, set-aside rules and rules on a field no column carries are left out.
|
|
549
|
+
- `withRootRule` — the tree with one column's root rule, or its rule on one part, replaced, or dropped when handed `null`; groups, relation rules, set-aside rules and rules the row never showed stay.
|
|
550
|
+
- `rootRelationRules` — the root relation rules, by relation field key: what the panel's related-records rows edit. A set-aside one is left out, and `withRootRelationRules` keeps it.
|
|
548
551
|
- `withRootRelationRules` — the tree with its root relation rules replaced by the ones given, every other rule and group untouched.
|
|
549
552
|
- `viewReaderFrom` — builds the `ViewFieldReader` a view reads a list's rows through, from its columns and the decimals map (by field key). It reads what the cell draws, so a filter, a sort and a group agree with the column on screen; a column that draws itself is read through its edit accessor. Decimals come from the map or the column's format, and a number's currency from the column.
|
|
550
553
|
|
|
@@ -552,8 +555,7 @@ A saved view's filter is a tree of rules keyed by field key; the Filter panel ed
|
|
|
552
555
|
|
|
553
556
|
One part of a value can have a row of its own in the Filter, Sort and Group menus: "Location · Country", "Name · Given name". A host turns these rows on with `parts: true`; the tables say which parts of which types get one.
|
|
554
557
|
|
|
555
|
-
- `
|
|
556
|
-
- `partKey` — a part row's key: a column id (Filter) or a field key (Sort, Group), the separator, then the part.
|
|
558
|
+
- `partKey` — a part row's key: a column id (Filter) or a field key (Sort, Group), `::`, then the part.
|
|
557
559
|
- `parsePartKey` — splits a key at its last separator: `{ id }` for a whole value, `{ id, part }` for a part.
|
|
558
560
|
- `FILTER_PART_ROWS` — the parts each type offers a Filter row for, in their order: a place's country, region, city and postal code; a name's given and family name; a range's low and high end, each a number row.
|
|
559
561
|
- `SORT_PART_ROWS` — the orders each type offers beyond sorting by the whole value: a place by city, region, country or postal code; a name by family or given name; a range by its low or its high end.
|
|
@@ -572,8 +574,6 @@ Guide: [the grid](../guides/the-grid.md).
|
|
|
572
574
|
A column's footer shows one figure, the pick the reader made from the ones the column offers. A list whose rows come a page at a time (a source list) has its figures counted by the database instead; `SourcedAggregates` tells these functions which ones it answered.
|
|
573
575
|
|
|
574
576
|
- `aggregateLabel` — a pick's name, through `views.grid.figure`. Messages default to `resolveViewsMessage`.
|
|
575
|
-
- `LIST_AGGREGATE_LABELS` — every pick's name but `none`, in the package's English. A grid words them through `aggregateLabel` with the host's messages.
|
|
576
|
-
- `gridColumnIsNumericAgg` — says whether a column totals as numbers: it declares a figure to total (`aggAccessor`) or holds a number, a percent or money.
|
|
577
577
|
- `aggregateOptions` — the picks a column offers, `none` first. A numeric column offers sum, average, min, max and count; a percent never sums, and offers ratio only when the column carries its two parts; any other column offers count, filled and unique. On a source list it offers what the database can answer: count everywhere, and the numeric picks where it can total the column. A column that names its picks (`footerKinds`) offers only those.
|
|
578
578
|
- `resolveAggregateKind` — the pick a column's footer shows: the reader's, when the column offers it; else ratio for a ratio column; else the column's declared default, when offered (on a source list, only when the database totalled it); else `none`.
|
|
579
579
|
- `computeAggregate` — a pick's figure over the rows in hand, or `null` for nothing to show. Count is the rows; filled and unique read a place, a name and a phone by their text, and several values as a set; ratio is sum over sum as a whole percent, `null` on an empty denominator; the numeric picks skip blanks and are `null` over no values.
|
|
@@ -601,7 +601,7 @@ A board or calendar card is laid out in zones: the title, a row of chips, a stri
|
|
|
601
601
|
|
|
602
602
|
## A group's figures
|
|
603
603
|
|
|
604
|
-
A source list holds a page, not the list, so its footer and its group headers read figures the database counted over the whole group. Four numbers per totalled key, the sum, the count of values present, the smallest and the largest, answer every pick the database can and combine exactly when parts fold into one group. These names
|
|
604
|
+
A source list holds a page, not the list, so its footer and its group headers read figures the database counted over the whole group. Four numbers per totalled key, the sum, the count of values present, the smallest and the largest, answer every pick the database can and combine exactly when parts fold into one group. These names are `@viewkitjs/fields/query`'s own, free of React, so a server may use them.
|
|
605
605
|
|
|
606
606
|
- `FigureKind` — the footer picks, as `ListAggregateKind` names them.
|
|
607
607
|
- `ColumnFigure` — one key's four numbers: `sum`, `count`, `min` and `max`, a `null` meaning no value.
|
|
@@ -618,9 +618,7 @@ A source list holds a page, not the list, so its footer and its group headers re
|
|
|
618
618
|
Guide: [the grid](../guides/the-grid.md).
|
|
619
619
|
|
|
620
620
|
- `ListGroup` — one group of rows, already filtered, sorted and grouped by the host: its `key`, its `label` (`null` for none), its `items` and, when the database counted them, its `figures` over the whole group.
|
|
621
|
-
- `
|
|
622
|
-
- `OrderDir` — `asc` or `desc`.
|
|
623
|
-
- `OrderChoice` — a mode and a direction, `{ mode, dir }`.
|
|
621
|
+
- `OrderChoice` — a mode and a direction, `{ mode, dir }`: fields' `BucketOrderMode` (`lifecycle`, the order the host states; `count`, most rows first; `name`; or `manual`, the reader's stored positions, which only a source list orders by and `sortGroupEntries` treats as `name`) and `SortDirection` (`asc` or `desc`).
|
|
624
622
|
- `defaultDirFor` — a mode's natural direction, for seeding a new pick: `desc` for `count`, `asc` for the others.
|
|
625
623
|
- `sortGroupEntries` — sorts `[key, rows]` entries by an `OrderChoice` and returns a new array. It takes the lifecycle positions (a key without one sorts after), a label for each key and the key of the uncategorised group, which always sorts last; ties fall back to the label.
|
|
626
624
|
|
package/package.json
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viewkitjs/views",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "ViewKit views — the grid, board, calendar and list over typed fields: a headless engine and a default rendering written to skin discipline. By Sheaf.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": false,
|
|
8
8
|
"files": [
|
|
9
9
|
"dist",
|
|
10
|
+
"!dist/panels",
|
|
10
11
|
"skills",
|
|
11
12
|
"docs",
|
|
13
|
+
"!docs/reference/panels.md",
|
|
12
14
|
"README.md",
|
|
13
15
|
"CHANGELOG.md",
|
|
14
16
|
"LICENSE.md"
|
|
@@ -108,12 +110,29 @@
|
|
|
108
110
|
"access": "public"
|
|
109
111
|
},
|
|
110
112
|
"peerDependencies": {
|
|
111
|
-
"@
|
|
113
|
+
"@dnd-kit/core": "^6.3.1",
|
|
114
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
115
|
+
"@dnd-kit/utilities": "^3.2.2",
|
|
116
|
+
"@viewkitjs/fields": "^0.12.0",
|
|
112
117
|
"react": "^19.0.0",
|
|
113
118
|
"react-dom": "^19.0.0",
|
|
114
119
|
"zod": "^4.1.12"
|
|
115
120
|
},
|
|
121
|
+
"peerDependenciesMeta": {
|
|
122
|
+
"@dnd-kit/core": {
|
|
123
|
+
"optional": true
|
|
124
|
+
},
|
|
125
|
+
"@dnd-kit/sortable": {
|
|
126
|
+
"optional": true
|
|
127
|
+
},
|
|
128
|
+
"@dnd-kit/utilities": {
|
|
129
|
+
"optional": true
|
|
130
|
+
}
|
|
131
|
+
},
|
|
116
132
|
"devDependencies": {
|
|
133
|
+
"@dnd-kit/core": "^6.3.1",
|
|
134
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
135
|
+
"@dnd-kit/utilities": "^3.2.2",
|
|
117
136
|
"@tailwindcss/postcss": "^4.3.3",
|
|
118
137
|
"@testing-library/react": "^16.3.2",
|
|
119
138
|
"@types/node": "^20",
|
|
@@ -128,7 +147,7 @@
|
|
|
128
147
|
"typescript": "^5",
|
|
129
148
|
"vitest": "^4.1.5",
|
|
130
149
|
"zod": "^4.1.12",
|
|
131
|
-
"@viewkitjs/fields": "0.
|
|
150
|
+
"@viewkitjs/fields": "0.12.0"
|
|
132
151
|
},
|
|
133
152
|
"scripts": {
|
|
134
153
|
"typecheck": "tsc -p tsconfig.json",
|
package/skills/views/SKILL.md
CHANGED
|
@@ -69,7 +69,7 @@ toast, haptics, clipboard and a per-device store.
|
|
|
69
69
|
## Bind the messages and swap the atoms
|
|
70
70
|
|
|
71
71
|
The package words only its own strings — a closed list of `{ key, values }` messages under
|
|
72
|
-
`views.editors.*`, `views.display.*`, `views.menus.*` and `views.
|
|
72
|
+
`views.editors.*`, `views.display.*`, `views.menus.*`, `views.grid.*`, `views.selection.*` and `views.panels.*`; a string `@viewkitjs/fields` already keys
|
|
73
73
|
stays a fields message. `messages` defaults to `resolveViewsMessage`, the package's English. With
|
|
74
74
|
next-intl, scope the translator to the namespace (`useTranslations("views")`; a root translator over a
|
|
75
75
|
typed catalog can overflow TypeScript) and read each key without its `views.` prefix:
|