viewkitjs 0.38.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 +134 -0
- package/MIGRATION.md +32 -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/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/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 +9 -7
- 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 +3 -3
- package/postgres/docs/reference/postgres.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 +38 -9
- package/views/dist/contract.js +64 -6
- 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/field/looks.d.ts +1 -1
- package/views/dist/controls/field/looks.js +7 -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 +33 -0
- 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 +15 -2
- package/views/dist/controls/filter-editor/filter-editor.js +49 -16
- package/views/dist/controls/filter-editor/how.d.ts +11 -1
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +4 -2
- package/views/dist/controls/filter-editor/map-filter-body.js +21 -11
- package/views/dist/controls/filter-editor/map-rules.d.ts +6 -4
- package/views/dist/controls/filter-editor/map-rules.js +7 -4
- 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/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/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/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/popover/map-popover.d.ts +1 -1
- package/views/dist/controls/popover/map-popover.js +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/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.css +22 -0
- package/views/dist/controls/tokens.js +0 -6
- package/views/dist/controls/toolbar/toolbar.js +2 -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/editors/EditorPanel.js +1 -1
- package/views/dist/field-row/FieldRow.js +38 -16
- 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 +28 -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 +9 -6
- package/views/dist/field-row/field-row-button.js +3 -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/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/GridAggregateMenu.d.ts +12 -11
- package/views/dist/grid/chrome/GridAggregateMenu.js +4 -3
- 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/GridResizeHandle.d.ts +7 -3
- package/views/dist/grid/chrome/GridResizeHandle.js +2 -3
- package/views/dist/grid/chrome/GridTable.js +1 -1
- package/views/dist/grid/chrome/GridTableSurface.js +1 -1
- package/views/dist/grid/chrome/grid-body-place.d.ts +2 -4
- package/views/dist/grid/chrome/grid-body-place.js +4 -5
- package/views/dist/grid/chrome/grid-figure-value.js +10 -4
- package/views/dist/grid/chrome/grid-table-props.d.ts +15 -4
- 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 +8 -4
- 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/internal/over-cell.d.ts +8 -0
- package/views/dist/internal/over-cell.js +5 -0
- package/views/dist/list/bar-keys.d.ts +8 -0
- package/views/dist/list/bar-keys.js +3 -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 +19 -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 +21 -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 +97 -0
- package/views/dist/list/buttons/shared.js +137 -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 +38 -0
- package/views/dist/list/editor-menus.d.ts +13 -0
- package/views/dist/list/editor-menus.js +13 -0
- package/views/dist/list/edits.d.ts +3 -1
- package/views/dist/list/index.d.ts +41 -0
- package/views/dist/list/index.js +19 -0
- package/views/dist/list/layer.d.ts +13 -3
- package/views/dist/list/layer.js +13 -3
- package/views/dist/list/line.d.ts +58 -0
- package/views/dist/list/line.js +229 -0
- package/views/dist/list/list.d.ts +7 -1
- package/views/dist/list/list.js +2 -2
- 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 +73 -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 +26 -0
- package/views/dist/list/panels/shared.js +36 -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 +19 -1
- package/views/dist/list/root-base.js +13 -3
- package/views/dist/list/root.d.ts +1 -1
- package/views/dist/list/root.js +2 -2
- package/views/dist/list/store.d.ts +29 -0
- package/views/dist/list/store.js +48 -2
- package/views/dist/list/toolbar-model.d.ts +99 -0
- package/views/dist/list/toolbar-model.js +195 -0
- package/views/dist/list/toolbar.js +142 -329
- package/views/dist/list/views-axis.js +15 -4
- 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/aggregates.d.ts +18 -8
- package/views/dist/model/aggregates.js +16 -22
- 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/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 +7 -3
- 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 +84 -0
- 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/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/context.d.ts +4 -0
- package/views/dist/panels/react/toolbar/context.js +1 -0
- 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 +10 -3
- 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 +12 -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 +47 -4
- package/views/dist/react.d.ts +1 -1
- package/views/dist/styles.css +116 -257
- package/views/dist/styles.unlayered.css +116 -257
- package/views/docs/contract.md +28 -18
- package/views/docs/controls/field.md +2 -1
- package/views/docs/controls/filter-editor.md +1 -1
- package/views/docs/controls/menu.md +1 -1
- package/views/docs/controls/sort-editor.md +1 -1
- package/views/docs/guides/atoms.md +1 -0
- package/views/docs/guides/looks.md +1 -1
- package/views/docs/guides/the-grid.md +6 -4
- package/views/docs/guides/toolbar-parts.md +337 -0
- package/views/docs/index.md +4 -0
- package/views/docs/reference/controls.md +6 -44
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +8 -7
- package/views/docs/reference/list.md +184 -11
- package/views/docs/reference/looks.md +13 -16
- package/views/docs/reference/panels-react.md +7 -7
- package/views/docs/reference/panels.md +1 -1
- package/views/docs/reference/react.md +14 -11
- package/views/docs/reference/views.md +9 -7
- package/views/skills/views/SKILL.md +2 -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
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,140 @@ Until 0.19.0 ViewKit shipped as three packages; their changes are in [fields/CHA
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [0.40.0] — 2026-12-05
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `viewkitjs/views`: `menus.sortEditor` now reaches the filter bar's sort pills (`ListFilterBar sorts="yes"`): each pill's × is handed as `delete` with `{ menu: "row", field, index, place: "bar" }` (`ViewsSortEditorItemsContext` gains `place`), so a function that drops `delete` takes the × off the pill as it does in the editor, and an item of your own draws as one more part of the pill.
|
|
13
|
+
- `viewkitjs/views/list`: `personSettings` on `List` and `ListRoot`, `{ bar?: boolean; words?: boolean }`, each off by default: where you turn one on, a person picks it in their own Customize, kept in their layer and never in the shared view. `bar` adds Layout's **Filter bar** row (`choice:bar`: Once added or Always, on a computer), standing over the toolbar's `bar` and a placed `ListFilterBar`'s `shows` (a bar written `shows="button"` keeps its button, and the row is left out while one is placed). `words` adds Layout's **Button words** row (`choice:words`: Icon and word, Icon or Word, on a computer and a phone), standing over every toolbar button's own words under the root. Customize's Reset empties both with the rest of the person's layer. With neither turned on, nothing changes.
|
|
14
|
+
- `viewkitjs/fields/query`: `ListPersonalLayer.toolbar`, `{ bar?: "added" | "always"; words?: "both" | "icon" | "word" }`, and `listPersonalLayerSchema` takes it, refusing any other key or value in it.
|
|
15
|
+
- `viewkitjs/views/list`: the root's `panels.personBar` and `panels.personWords`, what `personSettings` turns on.
|
|
16
|
+
- Message keys: `views.panels.person-bar` ("Filter bar"), `views.panels.person-bar-added` ("Once added"), `views.panels.person-bar-always` ("Always"), `views.panels.person-words` ("Button words"), `views.panels.person-words-both` ("Icon and word"), `views.panels.person-words-icon` ("Icon"), `views.panels.person-words-word` ("Word").
|
|
17
|
+
- `viewkitjs/views`: a guide to the toolbar's parts, "The toolbar's parts" (`views/docs/guides/toolbar-parts.md`): every button and panel of a list's toolbar with its settings, default first; `ListLine`, `ListGap`, `ListSlot` and `ListFill`; what `personSettings` lets a person pick; how the ready toolbar's props (`sortFilter`, `bar`, `toolbarParts`, `customizeIn`, `hosts`, `menus`…) map onto the parts; and six layouts to copy: the default, filters in a side column, views in the app's sidebar, all in the page header, no popovers, and search in the app bar.
|
|
18
|
+
- `viewkitjs/views/grid`: the message `views.grid.paste-two-values`, "A record shown twice can't take two different values".
|
|
19
|
+
- `viewkitjs/fields/query`: `numberRuleLabel` takes the unit a duration rule is kept in as its fifth argument (the kit's, its fourth), and then writes each bound as the duration box writes it: `> 1m 30s`.
|
|
20
|
+
- `viewkitjs/views`: `ViewsFilterBodyField.duration`, `"ms"` or `"s"` on a number field kept as a duration, in that unit. An app's own `FilterBody` can read and write its box as a duration (`1m 30s`, a bare number in seconds) and keep the rule's bound in that unit. A body that ignores it draws as before.
|
|
21
|
+
- `viewkitjs/fields`: `isMixedCurrency(field)` says whether a money field keeps amounts in several currencies: its currency is each row's own (`code: { field }`) and no `convert` reads it in one.
|
|
22
|
+
- `viewkitjs/fields/query`: `refusesNumberRule(field, operator, oneCurrency?)` and `comparesNumber(operator)`. A number rule that compares (every number operator but Is empty and Is not empty) over money in several currencies is refused: one number can't compare 1000 RON with 1000 EUR.
|
|
23
|
+
- `viewkitjs/fields/query`: `ViewFieldReader.oneCurrency(key)`, for a reader that reads a money field in one currency for every row (it converted the amounts, or the list shows one currency): a number rule over that field compares again.
|
|
24
|
+
- `viewkitjs/fields`: the message key `filter.mixed-currency`, "Not applied: amounts in several currencies", a refused rule's summary and the note under its box.
|
|
25
|
+
- `viewkitjs/views`: `FilterConfigNumber.refused`, the words a number row shows when a rule that compares would be refused; `ViewsFilterBodyProps.ruleWords` hands them as `refused`, and `CONTROLS.FilterBody` draws them under the rule (`data-slot="vk-filter-refused"`).
|
|
26
|
+
- `viewkitjs/postgres`: several values kept as rows of their own may name each row's label, `several: { kept: "rows", …, label }` (a column or your expression, read as text), and the definitions' rows form takes `label` beside `main`: `{ rows: { kind, record, value, main, label } }`.
|
|
27
|
+
- `viewkitjs/views/grid`: `gridSave` also returns `cellValues`, the function that turns a cell's change into the values
|
|
28
|
+
saved, and `GridTable` takes it as `cellValues` (spreading what `gridSave` returns hands it over). Every column a
|
|
29
|
+
cell's save writes beside its own (an amount's direction or currency) now shows its new value as the save is sent,
|
|
30
|
+
and rolls back with the edit when the save is refused; an undo or a redo shows them back as it is pressed. `<List>`
|
|
31
|
+
does this for a binding that writes several fields. `GridCellValuesFn` types it.
|
|
32
|
+
- Message key `views.grid.changed-since`: "Changed by someone since".
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
|
|
36
|
+
- `viewkitjs/views/list`: on a phone, the toolbar parts you place anywhere keep today's phone form: every placed button (`ListSort`, `ListFilter`, `ListCustomize`, `ListQuickFilters`, `ListViews`) opens its panel in your map's Sheet; `ListNew` is the round + at the list's foot; `ListClearSave` draws nothing, Clear and Save waiting in Customize's foot; a `ListLine` takes the phone's form; and a placed panel (`ListFilterPanel`, `ListSortPanel`, `ListCustomizePanel`, `ListQuickFiltersPanel`, `ListViewsPanel`) folds behind its button while one of the same stands under the root, opening as the button's sheet, and keeps standing where none does. Before, inside a `ListRoot` these opened popovers and stood as on a computer. `ListToolbar` and `List` on a phone are unchanged.
|
|
37
|
+
- `viewkitjs/views`: a function handed to `menus.sortEditor` that drops `delete` without checking `ctx.menu` now also takes the × off the filter bar's sort pills; one that adds a row without checking it adds a part to every pill. Check `ctx.menu` (and `place`).
|
|
38
|
+
- `viewkitjs/fields/query`: a person's layer may now hold `toolbar`. A reader on an older release refuses such a layer whole, as its schema is strict (a server checking a stored layer, the browser's views store), so the person's widths and folds would be dropped with it there: take this release everywhere a stored layer is read before turning `personSettings` on.
|
|
39
|
+
- An app that keeps the person's layer in its own storage, key by key, adds `toolbar` to the keys it keeps before turning `personSettings` on; otherwise a pick shows until the page reloads and is then gone.
|
|
40
|
+
- The tarball's unpacked size budget is raised from 11670 kB to 11690 kB for this guide: the package now measures about 11681 kB unpacked.
|
|
41
|
+
- `viewkitjs/views`: the default look is ViewKit's own, at the values it ships today: nothing an app draws moves, and the stylesheet's values are byte for byte what they were (two of its comments are reworded). From now on a visible change to the default look (a row's height, the focus ring, the selection's colours, any visible default) is released as breaking, a minor while 0.x, with the old and the new side by side under Changed. The looks' docs call each default ViewKit's own.
|
|
42
|
+
- The tarball's unpacked size budget is raised from 11690 kB to 11710 kB: the paste's label reading, the new refusal and their docs bring the package to about 11693 kB unpacked.
|
|
43
|
+
- A number rule that compares amounts in several currencies now filters nothing, everywhere: the in-memory evaluator, the grid's column rules and `viewkitjs/postgres`, which leaves it out as it leaves out a rule on a field it doesn't know, so a saved view that carries one still lists its rows. Where the rule is made and on the filter bar, the list says why. Its operators stay offered, and Is empty and Is not empty filter as before. A field kept in one currency (`code: { fixed }`), one that converts (`convert`), and a grid column read in a display currency filter as before. A reader of your own that converts amounts inside `read` adds `oneCurrency: (key) => key === "<field>"` to keep filtering them; a field map that converts in its own expression declares its money in one currency (`code: { fixed }`).
|
|
44
|
+
- The tarball's unpacked size budget is raised from 11690 kB to 11710 kB for the refusal of a number rule over amounts in several currencies and the summary of a duration rule, their docs and their release notes: the package now measures about 11698 kB unpacked.
|
|
45
|
+
- `viewkitjs/postgres`: several values kept as rows whose map names a `main` or a `label` read as the items every several-values cell takes, `{ value, label, main }`, the main one first and the rest by their key, so a list shows the same main email or phone, and the same labels, as the record. Before, they read as bare values in key order, whatever row was marked main. A map naming neither reads as before.
|
|
46
|
+
- The tarball's unpacked size budget is raised from 11710 kB to 11740 kB for the grid's save and undo changes and
|
|
47
|
+
their guide: the package now measures about 11725 kB unpacked.
|
|
48
|
+
- `viewkitjs/views/grid`: ⌘Z and ⇧⌘Z no longer overwrite a value someone else wrote since the person's edit. Where the
|
|
49
|
+
rows the grid holds show a value in the cell that is neither the edit nor what it replaced, the undo or redo leaves
|
|
50
|
+
that cell as the rows show it, sends no write for it and says so through the toast's `warning`; the edit's other
|
|
51
|
+
cells are undone as before, and the next ⌘Z reaches the edit before it. A cell whose own write is still out, or whose
|
|
52
|
+
rows haven't caught up with it, is undone as before.
|
|
53
|
+
|
|
54
|
+
### Fixed
|
|
55
|
+
|
|
56
|
+
- `viewkitjs/views`: a page holding the toolbar (the ready one or the controls' `Toolbar`) moves on React's view transitions. When the toolbar's line was resized, a menu in it closed or an attribute above it changed while a move was being prepared, its fit check flushed at once and React skipped the move, so the page swapped with a cut. While a view transition is active the toolbar now finds its fit with a plain update, once the move's commit is done; at any other time it still finds it before the paint.
|
|
57
|
+
- `viewkitjs/views/field-row`: on a computer, under the Field's Long (`row-long: line`), a long text's editor now takes the row box's own corners (`--vk-field-row-box-r` under the Field's Box, `--vk-radius-md` without it), so the row's pressed ground no longer shows past the popover's rounder top corners. Its words stand where they did. Under the Field's Box, the popover's mark reads `data-field-row-long-editor="box"`, so your own `Popover` can take the same corner.
|
|
58
|
+
- `viewkitjs/views/list`: a `ListLine` takes no room while none of its parts draws anything. A `ListLine kind="bar"` holding a `ListFilterBar`, a `ListGap` and `ListClearSave` no longer stands as an empty band under your row while nothing is filtered, sorted or changed; it stands as soon as a rule, a held rule, the sort pill or Clear and Save shows, as the ready toolbar's bar does. Your own node or text written in a line keeps it standing.
|
|
59
|
+
- `viewkitjs/views/grid`: a paste, a fill or a cut that reaches one record through two of its drawn copies (a grid grouped by a column of several values) and gives it two different values for one column writes nothing to that cell and says why, as `views.grid.paste-two-values`, counted with the paste's or the fill's other refusals. The same value reaching it twice is written once. Before, the value on the last copy was saved and the other lost.
|
|
60
|
+
- `viewkitjs/views`: a duration rule's summary, on the filter bar and in the Filter panel's rows, reads as its box writes it (`> 1m 30s`), no longer the stored milliseconds with an "s" after them (`> 90000 s`).
|
|
61
|
+
- `viewkitjs/views/controls`: the kit's filter editor (`CONTROLS.FilterBody`, in the Filter panel and Customize's Filter page) and the filter bar's value part (`CONTROLS.FilterPartBody`) read a duration rule's bound as a duration (`1m 30s`), no longer the stored milliseconds (`90,000`). A bound typed there, `90` or `1m 30s`, is kept as 90 seconds in the column's unit, no longer 90 milliseconds.
|
|
62
|
+
- `viewkitjs/views`: a Sheet opened over a sheet or dialog the app draws itself on Base UI (a Drawer or a Dialog) now knows it stands over it, as it does over another Sheet of ViewKit's: it dims the one below with `--vk-backdrop-stacked`, and a choice that finishes the job closes the app's one too. The app changes nothing. Over ViewKit's own Sheet, and alone, nothing changes.
|
|
63
|
+
- `viewkitjs/views/grid`: an option copied in the grid and pasted into another column lands by its label, never on an option there that only shares its key; a copied list of options lands its keys only where this column's options with those keys carry the copied labels. Copy and paste within one column stays exact.
|
|
64
|
+
- `viewkitjs/views/grid`: a list of labels pasted from outside into a column of options lands a label that holds a comma ("Sales, EMEA") whole where the column offers it: the text is read whole first, then by the column's labels, longest first, then split on commas. A column whose options name none of it still splits on commas.
|
|
65
|
+
|
|
66
|
+
### Removed
|
|
67
|
+
|
|
68
|
+
- `viewkitjs/views/controls`: breaking. The setting row, the switch row and the tag field are gone, since none of ViewKit's own pieces draws them: `SettingRow`, `SettingRows`, `SettingIcon`, `SettingChevron`, `SwitchRow`, `SwitchRows`, `TagField`, `useSettingRowWorn`, `useSettingRowsRow`, `settingRowWornOf`, `SETTING_ROW_ATTRS` and their types (`SettingRowProps`, `SettingRowsProps`, `SettingAction`, `SettingState`, `SwitchRowProps`, `TagFieldProps`). An app that drew them draws its own settings rows and tag field instead: before, `import { SettingRow, SettingRows } from "viewkitjs/views/controls"`; now, the app's own component in their place, built on ViewKit's `Switch`, `Select`, `Button`, `Field` and `Tag`, which stay.
|
|
69
|
+
- `viewkitjs/views/controls/setting-row.css`, `switch-row.css` and `tag-field.css` are gone, and the ready stylesheet no longer carries them or declares their `--vk-` names. An app's own rows bring their own stylesheet.
|
|
70
|
+
- `viewkitjs/views/looks`: `SETTING_ROW_LOOKS`, `SettingRowOptionId` and `SettingRowPicks` are gone with the setting row, and `LOOKS` no longer lists it.
|
|
71
|
+
- `viewkitjs/views/controls`: a `Field` no longer draws as a setting row inside a computer's `SettingRows`, and a `RadioGroup` no longer turns into a Select at such a row's end; both only ever did inside the setting row. Alone and in `FieldRows` they draw as before.
|
|
72
|
+
|
|
73
|
+
## [0.39.0] — 2026-12-05
|
|
74
|
+
|
|
75
|
+
### Added
|
|
76
|
+
|
|
77
|
+
- `viewkitjs/views`: `menus.sortEditor` and `menus.filterEditor` reshape the buttons at a rule's end (`ctx.menu: "row"`: hide ×, ⋮ or ⋯, add your own beside them) and at the editors' feet (`foot`: drop Add sort, Add filter, Clear or Delete group, add your own), in every form; your buttons draw as `vk-sort-row-action`, `vk-sort-foot-action`, `vk-filter-row-action` and `vk-filter-foot-action`, with `data-key`. An app that hands nothing draws as before.
|
|
78
|
+
- `viewkitjs/views/field-row`: the Field's Open (`row-open`: `below`, `over`; `data-field-row-open="over"` on any frame round the rows). Under `over`, on a computer, every popover editor a record's field 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) with its words exactly where the value's words were, at least as wide as the box and covering it, nothing under it moving, and no jump as it opens. Your `Popover` is handed a negative `sideOffset`, an `alignOffset` and a `style.minWidth`, so your own Popover places it the same way. A phone keeps its sheets. With nothing set, every editor opens under its value as before.
|
|
79
|
+
- `viewkitjs/views/field-row`: the Field's Long (`row-long`: `full`, `line`; `data-field-row-long="line"` on any frame round the rows). Under `line`, a record's field row outside a card draws a writable long text or rich text as one line at rest, its end fading (a mask, never "…"), so one description no longer makes a record uneven, and a writable text that would wrap keeps to one line ending in "…", so it keeps its height as it is typed in. On a computer, a press on the long text opens its editor on top of the row's box: a textarea in your `Popover`, placed as the Field's Open places a body (whatever `row-open` says), its first line exactly where the words were, growing down over the rows below up to `--vk-editor-max-h`, then scrolling; nothing under it moves and it doesn't jump as it opens. Its keys are a long text's: Enter is a new line, ⌘/Ctrl+Enter and a press outside save, Escape throws the edit away. The row keeps its value under the popover, as a picker's does. A phone keeps its box in place. A read-only long text still reads in full. With nothing set, a long text reads in full and edits in place as before.
|
|
80
|
+
- `viewkitjs/views/field-row`: the Field's Link (`row-link`: `beside`, `words`; `data-field-row-link="words"` on any frame round the rows). Under `words`, a record's writable field row holding one url, email, phone or domain draws its words as the link itself: a press on them opens a url in a new page, an email in a mail and a phone in a call, and a press on the rest of its box edits it in place, its words where they were under the Field's Box. The open action beside the box isn't drawn. The box (the row's button, named by the field alone) is one Tab stop, its Enter edits, and the link is the next. Under the Field's Action (`row-action: icon`) its icon is ✎ (`edit`), shown, with the box's hover, whether the pointer is on the words or past them (on the words, the hover ViewKit's own Button draws; an app's own Button shows its hover past them). A phone's Field rows card keeps its rows as they were. A server-rendered row draws `beside` until it is alive. With nothing set, a link's words edit and its action beside opens it, as before.
|
|
81
|
+
- `viewkitjs/views/looks`: the Field's look `attio`, Attio's record rows in one pick: no type icon (`row-icon: off`), one box for a row's hover, its press, its in-place input and the place a picker opens from (`row-box: box`), the icon of what a click does at the box's end (`row-action: icon`), every picker on top of the box (`row-open: over`), a long text one fading line at rest (`row-long: line`) and a link's words opening it (`row-link: words`), the card's own picks unchanged. Wear it with one call on the frame round a record's rows, so every record drawer and record page changes together: `<section {...lookAttrs(FIELD_LOOKS, lookPicks(FIELD_LOOKS, "attio"))}>`. A phone keeps its Field rows card and its sheets. Nothing changes for an app that doesn't wear it.
|
|
82
|
+
- `viewkitjs/views/list`: the ready toolbar's buttons as parts you place anywhere: `ListViews`, `ListSearch`, `ListSort`, `ListFilter`, `ListQuickFilters`, `ListCustomize`, `ListSortFilter`, `ListClearSave` and `ListNew` (each with its `…Props`). Written under a `ListRoot`, or through a `ListFill` in your page header, each reads and changes the list with nothing wired, as the ready toolbar's own button does; each panel is its own in the root's radio (`list-sort`, `list-filter`, `list-customize`, `list-quick`). With nothing placed, `<List />` and `ListToolbar` draw exactly as before.
|
|
83
|
+
- `viewkitjs/views/list`: what a placed button opens, `opens` (`ListOpens`): `popover` (the default), `pane` (your map's Pane in the root's new `ListPaneBox`), `sheet`, or a function of your own, called with the button; on `ListSort` and `ListFilter` also `bar`, a picked rule standing on the filter bar `ListToolbar` draws. `empty` on `ListSort` and `ListFilter`: `fields` (the default) or `editor`, the editor saying nothing sorts or filters yet, with Add. `words` (`ListWords`: `both`, `icon`, `word`) on every worded button, each default as today; `ListSearch` `shows="input"` stands as a field; `ListViews` `shows="button"` is one button naming the open view.
|
|
84
|
+
- `viewkitjs/views/list`: `ListPaneBox` (`ListPaneBoxProps`), the box round your grid where a placed button's Pane stands.
|
|
85
|
+
- `viewkitjs/views/list`: `ListState`'s `panels.placed` (what stands under the root, counted) and `panels.barOpen` (the filter bar asked open by Sort and filter), with `place(key)` and `setBarOpen(open)`.
|
|
86
|
+
- `viewkitjs/views`: the filter and sort editors' computer forms take `empty` (`"fields"`, the default, or `"editor"`: with nothing set, they say so over Add filter or Add sort, and stay open as the last rule goes); so do `ViewsFilterBodyProps` and `ViewsSortBodyProps` (a body of your own that ignores it draws as before), `ToolbarFilterAdd` and `ToolbarSortPill`, which also takes `fieldsOnly`.
|
|
87
|
+
- `viewkitjs/views`: `ViewsToolbarButtonProps` takes `expanded` (`aria-expanded`, for a button that shows and hides a part of the page rather than opening a popup) and the part `sort-filter`.
|
|
88
|
+
- A new message key, `views.panels.sort-filter`: "Sort and filter".
|
|
89
|
+
- `viewkitjs/views/list`: the ready toolbar's panels as parts you stand anywhere under a `ListRoot` (or through a `ListFill`): `ListViewsPanel`, `ListFilterPanel`, `ListSortPanel`, `ListQuickFiltersPanel`, `ListCustomizePanel` and `ListFilterBar` (each with its `…Props`). Each stands open where you write it, reading and changing the list as its button's popover does, with `shows` (`ListPanelShows`): `always`, `filled` (once it holds something) or `button` (while its button shows it, with a ✕).
|
|
90
|
+
- `viewkitjs/views/list`: a placed button whose panel is placed under the same root shows that panel, points to it (the focus) or hides it, and opens no popover; `ListViews` so with `shows="button"`.
|
|
91
|
+
- `viewkitjs/views/list`: `ListFilterBar` takes `sorts`: `no` (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, Add sort with none and no sort editor. `shows="button"` stands while `ListSortFilter` holds it open. Placed, `ListToolbar` leaves its bar's sort and filters to it.
|
|
92
|
+
- `viewkitjs/views/list`: `ListState`'s `panels.shown` and `panels.standing`, with `setShown(key, shown)` and `stand(key, stands)`.
|
|
93
|
+
- `viewkitjs/views/list`: `opens="bar"` on `ListSort` and `ListFilter` asks a bar standing by its button open as it opens, and says it has no bar to stand on at its press, not as it mounts.
|
|
94
|
+
- `viewkitjs/views/panels/react`: `ViewPicker` and `ToolbarViews` take `press` (`{ onPress, expanded, lit? }`): the chip calls it and opens no list, for a views list standing elsewhere.
|
|
95
|
+
- `viewkitjs/fields/query`: three figure kinds, `empty`, `percentEmpty` and `percentFilled` (`FigureKind`, `FIGURE_KINDS`): how many of a column's values are empty, and the empty and the filled each as a whole percent of the rows. `figureFor` reads them from a group's rows and `filled`, and answers none of them from an answer that carries no `filled`; `figureOfValues` works them out over the rows in hand. A saved view may store them as a column's `figure`.
|
|
96
|
+
- `viewkitjs/views`: `aggregateWord(kind, messages?)`, a figure's word after its value in the footer, and `AggregatePlace`, `{ first }`, the place `aggregateOptions` and `resolveAggregateKind` now take as their last argument.
|
|
97
|
+
- A new message key, `views.grid.figure-word` (`{ kind }`): the word after a footer figure's value: "count", "empty", "filled", "sum", "average", "min", "max", "unique", "ratio"; a percent's "empty" or "filled"; none for `none`.
|
|
98
|
+
- `viewkitjs/views/list`: `ListLine` and `ListGap` (with `ListLineProps` and `ListGapProps`), lines of your own written with the toolbar's parts. A line stands its parts in the order you write them, the first gap splitting its start from its end, and folds them as the ready toolbar's line folds as it narrows: words to icons, then the views' tabs into "+N", then the filter bar's filters into "+N filters", then into ⋯. `kind="bar"` is a filter bar's line. Every placed part folds in a line as it does in the ready toolbar's row, and `ListFilterBar` written in one stands its pieces as the line's items.
|
|
99
|
+
- `ListViews` takes `menu` (a view's menu as data) and `moreViews` (the views' "+N" as you draw it), as the ready toolbar's `menus.view` and `moreViews`.
|
|
100
|
+
- `ListCustomize` takes `menu`: Customize's rows as data, as the ready toolbar's `menus.customize`.
|
|
101
|
+
- `ListLine` takes `more` (⋯'s rows as data) and `overflow` (⋯ as you draw it), as the ready toolbar's `menus.more` and `overflow`; ⋯ stays one element, open, as the parts in a line change.
|
|
102
|
+
- `ListEditorMenus`: the sort, filter and group editors' menus as data for every part under it.
|
|
103
|
+
- `viewkitjs/views`: the components map's `Popover` is handed `finalFocus`, the twin of `initialFocus`: false moves no focus as the popup closes, because what opened it hands the focus back itself. A field row's editor hands it false. A `Popover` of your own should forward it to its popup's return of focus; one that doesn't keeps working as before.
|
|
104
|
+
- `viewkitjs/views/grid`: `GridMenus.figure`, `(items, { column, group, current }) => items`: a footer cell's calculation picker as data, reshaped by your function (`menu.drop`, `menu.rename`, `menu.add`, `menu.move`), its rows keyed by their figure.
|
|
105
|
+
- `viewkitjs/views`: every row ViewKit's own Menu draws carries its item's key as `data-key`, also where the menu names no slot (it then draws no `data-slot`). The calculation picker is `data-slot="vk-grid-figure-menu"`, each of its rows named by that and `-row`, `data-key` its figure.
|
|
106
|
+
- `viewkitjs/views`: three atoms draw a grid header cell's chrome your own way: `HeaderGlyph` (the column's type glyph before its name, handed the column's `columnId`, `type` and `fieldKey`, ViewKit's own glyph as `fallback` and the `className` it draws with), `HeaderSortMark` (a sorted column's mark after its name where the grid's `sortMark` is on, handed `dir`) and `HeaderResizeHandle` (what the resize handle shows, handed `active` while the column is resized). The cell, its menu, its drag to reorder and the handle's grab zone stay ViewKit's, so sorting from a header, dragging it and resizing it work with yours; a handle of your own that reaches past the zone still resizes from a press anywhere on it. Their props are `ViewsHeaderGlyphProps`, `ViewsHeaderSortMarkProps` and `ViewsHeaderResizeHandleProps`, from `viewkitjs/views/react`. Handed none, the header draws exactly as before.
|
|
107
|
+
|
|
108
|
+
### Changed
|
|
109
|
+
|
|
110
|
+
- `viewkitjs/views`: `menus.sortEditor` and `menus.filterEditor` are now also called with `ctx.menu` `row` and `foot`. A function that drops `delete` (or `more`, `add`, `clear`) without checking `ctx.menu` now also hides the sort's ×, a filter group's Delete or the foot's buttons, making rules unremovable; 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 ×; a `switch (ctx.menu)` that lists every case gains two. Check `ctx.menu`.
|
|
111
|
+
- `viewkitjs/views/field-row`: each row editor's body now stands in a `display: contents` span inside its popover or sheet, at every width and with or without the Field's Open. It changes no layout; a selector that reads the panel's direct child sees the span.
|
|
112
|
+
- `viewkitjs/views/grid`: the footer's cells are right-aligned on every column, whatever the column's alignment, in every look.
|
|
113
|
+
- `viewkitjs/views/grid`: under Figures Value first, the empty cell's offer ("+ Add calculation") is drawn at the rows' text size in the subtlest colour, and a result reads its value then its word ("13 count"), both at the rows' size. Word first keeps its small capitals before the value.
|
|
114
|
+
- `viewkitjs/views/grid`: the offer stays shown while its cell's picker is open, and a narrow column cuts it at its right edge ("+ Add calc") instead of wrapping.
|
|
115
|
+
- `viewkitjs/views/grid`: the footer draws a line under itself in every look, not only with `verticalBorders`, and a pinned footer draws a line along its top while rows pass under it (at rest the last row's own line stands above it).
|
|
116
|
+
- `viewkitjs/views/grid`: `pinFooter` on a computer sticks the footer to the area's foot but never pushes it below its last row: under a table shorter than the area it now stands right after the last row, where it used to stand at the area's foot. A phone's pinned footer still stands at the foot. A grouped grid's footers behave as before.
|
|
117
|
+
- `viewkitjs/views`: what a footer column offers. Before: a number Sum, Avg, Min, Max and Count; any other column Count, Filled and Unique. Now: the first column Count alone; every other column Count empty, Count filled, Percent empty and Percent filled; a number and money also Sum, Average, Min and Max; a percent never sums and keeps its Ratio where it declares one. On a source list the four counts are offered on a column bound to a field (a pick asks your service for that key's figures, which carry `filled`).
|
|
118
|
+
- `viewkitjs/views`: a pick a column no longer offers reads None and stays stored: a Count saved on any column but the first, a Unique, and on whichever column is now first (a reader hid or moved the name) any pick but Count. A column's declared `defaultAggregate` or `footerKinds` naming those reads the same: a declared Count off the first column or a declared Unique shows None, and a column whose `footerKinds` leaves nothing but None draws no picker. A Filled saved off the first column keeps showing, now worded "Count filled".
|
|
119
|
+
- `views.grid.figure`'s English: "Avg" is "Average" and "Filled" is "Count filled"; the three new kinds read "Count empty", "Percent empty" and "Percent filled". The footer's label now reads `views.grid.figure-word`, so under Word first a figure reads "AVERAGE", "EMPTY" where it read "AVG", "FILLED". `views.grid.figure-pick` reads "Add calculation" (was "Calculate").
|
|
120
|
+
- A `Record<FigureKind, …>` of yours (your catalog's words, say) needs the three new keys.
|
|
121
|
+
- The tarball: its unpacked size budget rises from 11560 kB to 11600 kB, for the footer's figures, words and docs on top of this release's other growth.
|
|
122
|
+
- `viewkitjs/views/grid`: the footer's calculation picker opens above its cell with its right edge on the cell's, on every column, where it used to follow the column's alignment.
|
|
123
|
+
- `viewkitjs/views/list`: every part placed under one root reads one model of the list, built once for each change of what it reads, and `ListToolbar` builds its own model only when something it reads changes; a filter tree works out each field's values once.
|
|
124
|
+
- The tarball's unpacked budget is 11620 kB (from 11560): the lines and their reference add about 19 kB unpacked, beside what the release's other changes add.
|
|
125
|
+
- `ListToolbar` and `<List />` are put together from the parts you can place yourself, in lines of their own, and draw as before: a fix to a part reaches the default toolbar.
|
|
126
|
+
- A rule held for the filter bar until whole (from a Filter with `opens="bar"`) while a bar standing by its button is hidden opens that bar.
|
|
127
|
+
- `viewkitjs/views/panels/react`'s size budget is raised to 175 kB and the tarball's to 11640 kB: `ReadyToolbar` now draws the list's parts.
|
|
128
|
+
- `viewkitjs/views`: a filter rule on a related record's field names it in its `data-key` as the relation and the field joined by a dot, `company.industry`, where it held the two joined by a NUL character, which no stylesheet could select. A selector or test that named the old value names the new one: `[data-key="company.industry"]`. `FilterField` (`viewkitjs/views/controls`) takes an optional `key`, the `data-key` a rule on it draws; absent, its `value`, as before.
|
|
129
|
+
- The size budget for the tarball is raised from 11640 to 11670 kB unpacked: the release fold adds each version's notes to the shipped `CHANGELOG.md` after `main` has measured it, and 0.39.0's notes (about 20 kB) took the release past 11640 kB.
|
|
130
|
+
- `viewkitjs/views/controls`: `PartSlot`'s `slot` is optional (`slot?: string`), and `menuEntries` keys every entry (`slot: { key }`) whether or not it is handed a `rowSlot`. A renderer of yours that reads `entry.slot.slot` now reads `string | undefined`: draw `data-slot` only when it holds one.
|
|
131
|
+
|
|
132
|
+
### Fixed
|
|
133
|
+
|
|
134
|
+
- `viewkitjs/views/field-row`: under the Field's Action (`row-action: icon`), a long text typed in place keeps the icon's room at its box's end, so its lines break where they did at rest.
|
|
135
|
+
- `viewkitjs/views/field-row`: a long value in a writable row asked for one line (`wrap: false`) no longer runs under the row's own action or past its box (VK-981). What the app's Button wraps the words in now shrinks with the box, and the value ends in its "…" before the action beside a link, before ✎ under the Field's Link, and at the box's end otherwise (a long text, a name). A long link that wraps wraps before its action. Rows whose value fits draw as before, and a select's tag keeps its own cut.
|
|
136
|
+
- `viewkitjs/views/field-row`: on a computer, while a record's field row has a picker open (a select, a status, a person or a record, a date, several values), the value it keeps in its place stands in the row's own button's box: its words no longer drop 2-3px and move 1px left, and the row no longer grows 4-6px, so the rows below it stay put. A popover opening under the value now opens 8px under the row's box, where it opened up to 14px under it. Under the Field's Open (`row-open: over`) the editor's first line lands where the value's words were and nothing under it moves, with or without the Field's Box. The edge is read off your `Button` as the editor opens, so a ghost Button with no border and one with a 1px border both keep their place.
|
|
137
|
+
- `viewkitjs/views/field-row`: on a computer, under the Field's Long (`row-long: line`) without the Field's Box, a long text's editor now covers the row's box whole when your `Button` draws a border: its edge no longer shows 1px of the value under it along the editor's left and top. The editor's text box stands as far in from the popover's edge as your Button's border, so its words still land where the value's words were, and it still stops at `--vk-editor-max-h`; a ghost Button with no border is placed as before.
|
|
138
|
+
- `viewkitjs/views`: a field row's editor closed by Escape gives the focus back to its row. Before, the focus could land on something pressed earlier, such as another row whose editor a press elsewhere had closed.
|
|
139
|
+
- `viewkitjs/views/controls`: in a Field rows card on a phone, a row asked for one line (`opts.wrap: false`) cuts a long value with "…" before its ›. Before, the value ran under the › and past the card's edge.
|
|
140
|
+
- `viewkitjs/views/controls`: `CONTROLS.Sheet` stands where what opened it stands, as the Select's and the Menu's sheets do: inside a phone's screen a page draws (`PhoneHost`), else inside the popup host round it. Before, a field row's editor opened from a row in such a screen rose over the whole window.
|
|
141
|
+
|
|
8
142
|
## [0.38.0] — 2026-12-04
|
|
9
143
|
|
|
10
144
|
### Added
|
package/MIGRATION.md
CHANGED
|
@@ -803,6 +803,37 @@ The panels: quick filters, set-aside rules, dragging:
|
|
|
803
803
|
| `views.panels.filter-fieldless` | Not a field of this list; a view cannot filter on it. |
|
|
804
804
|
| `views.panels.toolbar-row` | List tools |
|
|
805
805
|
| `views.panels.toolbar-bar` | Sort and filters |
|
|
806
|
+
| `views.panels.sort-filter` | Sort and filter |
|
|
807
|
+
|
|
808
|
+
The person's own toolbar rows in Customize's Layout, where the app turns them on (`personSettings`):
|
|
809
|
+
|
|
810
|
+
| Key | English |
|
|
811
|
+
| --- | --- |
|
|
812
|
+
| `views.panels.person-bar` | Filter bar |
|
|
813
|
+
| `views.panels.person-bar-added` | Once added |
|
|
814
|
+
| `views.panels.person-bar-always` | Always |
|
|
815
|
+
| `views.panels.person-words` | Button words |
|
|
816
|
+
| `views.panels.person-words-both` | Icon and word |
|
|
817
|
+
| `views.panels.person-words-icon` | Icon |
|
|
818
|
+
| `views.panels.person-words-word` | Word |
|
|
819
|
+
|
|
820
|
+
The grid's footer:
|
|
821
|
+
|
|
822
|
+
| Key | English |
|
|
823
|
+
| --- | --- |
|
|
824
|
+
| `views.grid.figure-word` | The word after a footer figure's value, by `{ kind }`: count, empty, filled, sum, average, min, max, unique, ratio |
|
|
825
|
+
|
|
826
|
+
A paste, a fill or a cut that gives one record, drawn under two groups, two different values for one column:
|
|
827
|
+
|
|
828
|
+
| Key | English |
|
|
829
|
+
| --- | --- |
|
|
830
|
+
| `views.grid.paste-two-values` | A record shown twice can't take two different values |
|
|
831
|
+
|
|
832
|
+
The grid's undo and redo, over a value someone wrote since the edit:
|
|
833
|
+
|
|
834
|
+
| Key | English |
|
|
835
|
+
| --- | --- |
|
|
836
|
+
| `views.grid.changed-since` | Changed by someone since |
|
|
806
837
|
|
|
807
838
|
The field row in a Field rows card, holding nothing:
|
|
808
839
|
|
|
@@ -832,6 +863,7 @@ The field row in a Field rows card, holding nothing:
|
|
|
832
863
|
| `date.no-such-day` | {month} has no {day, as an ordinal}. Write a day and a month: 12/11 |
|
|
833
864
|
| `field.must-tick` | This box must be ticked |
|
|
834
865
|
| `field.label` | A field a lookup's or a rollup's note names, by `{ entity, field, label }`: its label |
|
|
866
|
+
| `filter.mixed-currency` | Not applied: amounts in several currencies |
|
|
835
867
|
|
|
836
868
|
### Check you're done with this part
|
|
837
869
|
|
package/fields/dist/derived.d.ts
CHANGED
|
@@ -46,6 +46,13 @@ export declare function lockReason(field: FieldDef, cv?: FieldConventions): stri
|
|
|
46
46
|
* narrowing `CurrencyCode` itself, so the shape is read in exactly one place.
|
|
47
47
|
*/
|
|
48
48
|
export declare function isPerCodeCurrency(field: FieldDef): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Does this money field keep amounts in several currencies? A currency
|
|
51
|
+
* whose code is each row's own (`code: { field }`) and that no `convert` reads
|
|
52
|
+
* in one: 1000 RON beside 1000 EUR, so one number can't compare them. Read off
|
|
53
|
+
* the presented def, like `isPerCodeCurrency`, and it never throws.
|
|
54
|
+
*/
|
|
55
|
+
export declare function isMixedCurrency(field: FieldDef): boolean;
|
|
49
56
|
/**
|
|
50
57
|
* A money field's conversion: the `convert` of a currency whose code
|
|
51
58
|
* is a sibling field, read off the presented def; null for anything else. Asked
|
package/fields/dist/derived.js
CHANGED
|
@@ -81,6 +81,10 @@ export function isPerCodeCurrency(field) {
|
|
|
81
81
|
const def = presentedDef(field);
|
|
82
82
|
return def.type === "currency" && !!def.code && "perCode" in def.code;
|
|
83
83
|
}
|
|
84
|
+
export function isMixedCurrency(field) {
|
|
85
|
+
const def = presentedDef(field);
|
|
86
|
+
return def.type === "currency" && !!def.code && "field" in def.code && !def.convert;
|
|
87
|
+
}
|
|
84
88
|
export function conversionOf(field) {
|
|
85
89
|
const def = presentedDef(field);
|
|
86
90
|
if (def.type !== "currency" || !def.code || !("field" in def.code))
|
package/fields/dist/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export { cleanDomain, isCleanDomain } from "./domain.js";
|
|
|
22
22
|
export { isEmptyName, isNameValue, NAME_PARTS, namePart, nameText, sameName, tidyName, withNamePart, type NamePart, } from "./name.js";
|
|
23
23
|
export { bandTone } from "./bands.js";
|
|
24
24
|
export { checkFilterTree, listFieldsOf, checkIndex, defineIndex, drawsUnderName, entityDef, avatarKey, editedThroughField, renamedName, subtitleField, subtitleKeys, subtitleThrough, withLine, type EntityContribution, type EntityDef, type EntityIndex, } from "./entities.js";
|
|
25
|
-
export { conversionOf, derivedReason, isBreakdown, isDerived, isGroupedRollup, isLookup, isIntegerField, isPerCodeCurrency, lockReason, looksAhead, presentedDef, scalarOf, storesDecimalText, valueTypeOf, type DerivedDef, type ValueType, } from "./derived.js";
|
|
25
|
+
export { conversionOf, derivedReason, isBreakdown, isDerived, isGroupedRollup, isLookup, isIntegerField, isMixedCurrency, isPerCodeCurrency, lockReason, looksAhead, presentedDef, scalarOf, storesDecimalText, valueTypeOf, type DerivedDef, type ValueType, } from "./derived.js";
|
|
26
26
|
export { isOpenVocabulary, optionFor, optionValues, optionsOf, statusOptionOrder } from "./options.js";
|
|
27
27
|
export { sameListValue, sameStoredValue } from "./equality.js";
|
|
28
28
|
export { optimisticDisplay, sameFieldValue } from "./optimistic.js";
|
package/fields/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ export { cleanDomain, isCleanDomain } from "./domain.js";
|
|
|
19
19
|
export { isEmptyName, isNameValue, NAME_PARTS, namePart, nameText, sameName, tidyName, withNamePart, } from "./name.js";
|
|
20
20
|
export { bandTone } from "./bands.js";
|
|
21
21
|
export { checkFilterTree, listFieldsOf, checkIndex, defineIndex, drawsUnderName, entityDef, avatarKey, editedThroughField, renamedName, subtitleField, subtitleKeys, subtitleThrough, withLine, } from "./entities.js";
|
|
22
|
-
export { conversionOf, derivedReason, isBreakdown, isDerived, isGroupedRollup, isLookup, isIntegerField, isPerCodeCurrency, lockReason, looksAhead, presentedDef, scalarOf, storesDecimalText, valueTypeOf, } from "./derived.js";
|
|
22
|
+
export { conversionOf, derivedReason, isBreakdown, isDerived, isGroupedRollup, isLookup, isIntegerField, isMixedCurrency, isPerCodeCurrency, lockReason, looksAhead, presentedDef, scalarOf, storesDecimalText, valueTypeOf, } from "./derived.js";
|
|
23
23
|
export { isOpenVocabulary, optionFor, optionValues, optionsOf, statusOptionOrder } from "./options.js";
|
|
24
24
|
export { sameListValue, sameStoredValue } from "./equality.js";
|
|
25
25
|
export { optimisticDisplay, sameFieldValue } from "./optimistic.js";
|
|
@@ -350,6 +350,10 @@ export type FieldMessage = {
|
|
|
350
350
|
| {
|
|
351
351
|
key: "filter.any";
|
|
352
352
|
}
|
|
353
|
+
/** Why a number rule over amounts in several currencies filters nothing: its summary, and the note under its box. */
|
|
354
|
+
| {
|
|
355
|
+
key: "filter.mixed-currency";
|
|
356
|
+
}
|
|
353
357
|
/** A filter operator's name: "Contains", "Is before", "Greater than". */
|
|
354
358
|
| {
|
|
355
359
|
key: "filter.operator";
|
|
@@ -437,6 +441,6 @@ export type FieldMessage = {
|
|
|
437
441
|
export type FieldMessageKey = FieldMessage["key"];
|
|
438
442
|
export type FieldMessageResolver = (message: FieldMessage) => string;
|
|
439
443
|
/** Every key a host words, once: a host tests that its catalog holds each (`VIEWS_MESSAGE_KEYS` is the views part's). */
|
|
440
|
-
export declare const FIELD_MESSAGE_KEYS: readonly ["lock.system", "lock.provider", "lock.create", "lock.never", "derived.formula", "derived.lookup", "derived.count", "derived.rollup", "derived.exists", "derived.none", "field.label", "settlement.requested", "provider.name", "type.label", "setting.label", "setting.word", "field.cannot-empty", "field.must-tick", "field.cannot-edit", "field.cannot-save", "field.retry-save", "field.stored-value-required", "field.history-unavailable", "field.restore-refused", "field.already-saving", "field.unavailable", "field.derived", "editor.search", "editor.searching", "editor.search-failed", "editor.loading-more", "editor.nothing-matches", "editor.use-value", "relation.none", "relation.lead", "relation.make-lead", "date.placeholder", "date.label", "date.today", "date.tomorrow", "date.next-monday", "date.in-a-week", "date.clear", "time.placeholder", "time.label", "date.type", "date.none", "date.add-time", "date.last-month", "date.next-month", "date.day", "date.month", "date.year", "date.months", "date.years", "time.hour", "time.minute", "date.not-a-date", "date.no-such-day", "chips.add-placeholder", "chips.everything-picked", "chips.add", "validation.invalid", "validation.text", "validation.number", "validation.integer", "validation.date", "validation.datetime", "validation.boolean", "validation.option", "validation.options-list", "validation.values-list", "validation.relation", "validation.url", "validation.domain", "validation.email", "validation.email-list", "validation.unit", "validation.phone", "validation.phone-country", "validation.phone-short", "validation.phone-long", "validation.phone-whole", "validation.user", "validation.location", "validation.country-code", "validation.region-code", "validation.name", "validation.actor", "actor.type", "validation.range-order", "range.up-to", "range.and-up", "validation.pattern", "validation.tag-empty", "validation.max-length", "validation.min-length", "validation.min", "validation.max", "validation.greater-than", "validation.less-than", "validation.decimals", "validation.max-items", "validation.max-addresses", "validation.one-main", "validation.duplicate-value", "save.failed", "save.refresh-failed", "filter.any", "filter.operator", "filter.text-summary", "filter.date-summary", "filter.relative", "filter.relative-direction", "filter.relative-unit", "group.none", "group.relative", "group.due", "group.week-of", "time.never", "time.future", "time.ago", "platform.website"];
|
|
444
|
+
export declare const FIELD_MESSAGE_KEYS: readonly ["lock.system", "lock.provider", "lock.create", "lock.never", "derived.formula", "derived.lookup", "derived.count", "derived.rollup", "derived.exists", "derived.none", "field.label", "settlement.requested", "provider.name", "type.label", "setting.label", "setting.word", "field.cannot-empty", "field.must-tick", "field.cannot-edit", "field.cannot-save", "field.retry-save", "field.stored-value-required", "field.history-unavailable", "field.restore-refused", "field.already-saving", "field.unavailable", "field.derived", "editor.search", "editor.searching", "editor.search-failed", "editor.loading-more", "editor.nothing-matches", "editor.use-value", "relation.none", "relation.lead", "relation.make-lead", "date.placeholder", "date.label", "date.today", "date.tomorrow", "date.next-monday", "date.in-a-week", "date.clear", "time.placeholder", "time.label", "date.type", "date.none", "date.add-time", "date.last-month", "date.next-month", "date.day", "date.month", "date.year", "date.months", "date.years", "time.hour", "time.minute", "date.not-a-date", "date.no-such-day", "chips.add-placeholder", "chips.everything-picked", "chips.add", "validation.invalid", "validation.text", "validation.number", "validation.integer", "validation.date", "validation.datetime", "validation.boolean", "validation.option", "validation.options-list", "validation.values-list", "validation.relation", "validation.url", "validation.domain", "validation.email", "validation.email-list", "validation.unit", "validation.phone", "validation.phone-country", "validation.phone-short", "validation.phone-long", "validation.phone-whole", "validation.user", "validation.location", "validation.country-code", "validation.region-code", "validation.name", "validation.actor", "actor.type", "validation.range-order", "range.up-to", "range.and-up", "validation.pattern", "validation.tag-empty", "validation.max-length", "validation.min-length", "validation.min", "validation.max", "validation.greater-than", "validation.less-than", "validation.decimals", "validation.max-items", "validation.max-addresses", "validation.one-main", "validation.duplicate-value", "save.failed", "save.refresh-failed", "filter.any", "filter.mixed-currency", "filter.operator", "filter.text-summary", "filter.date-summary", "filter.relative", "filter.relative-direction", "filter.relative-unit", "group.none", "group.relative", "group.due", "group.week-of", "time.never", "time.future", "time.ago", "platform.website"];
|
|
441
445
|
/** Neutral English fallback for hosts that do not provide localization. */
|
|
442
446
|
export declare const resolveFieldMessage: FieldMessageResolver;
|
package/fields/dist/messages.js
CHANGED
|
@@ -108,6 +108,7 @@ export const FIELD_MESSAGE_KEYS = [
|
|
|
108
108
|
"save.failed",
|
|
109
109
|
"save.refresh-failed",
|
|
110
110
|
"filter.any",
|
|
111
|
+
"filter.mixed-currency",
|
|
111
112
|
"filter.operator",
|
|
112
113
|
"filter.text-summary",
|
|
113
114
|
"filter.date-summary",
|
|
@@ -511,6 +512,8 @@ export const resolveFieldMessage = (message) => {
|
|
|
511
512
|
return `${message.values.noun} saved, but refresh failed`;
|
|
512
513
|
case "filter.any":
|
|
513
514
|
return "Any";
|
|
515
|
+
case "filter.mixed-currency":
|
|
516
|
+
return "Not applied: amounts in several currencies";
|
|
514
517
|
case "filter.operator":
|
|
515
518
|
return OPERATOR_LABELS[message.values.operator] ?? message.values.operator;
|
|
516
519
|
case "filter.text-summary": {
|
|
@@ -43,6 +43,10 @@ export type ViewFieldReader<Row> = {
|
|
|
43
43
|
* so the order flips with the direction; `undefined` (or no hook) sorts by
|
|
44
44
|
* what `read` returns, clustered by code as `codeOf` says. */
|
|
45
45
|
sortAmountOf?: (row: Row, key: string) => number | null | undefined;
|
|
46
|
+
/** Whether this reader reads money field `key` in one currency for every row: it converted the amounts, or the list
|
|
47
|
+
* shows them in one currency. A number rule over a field whose currency is each row's own compares only then;
|
|
48
|
+
* otherwise it is refused and filters nothing (`refusesNumberRule`). Absent: each row's own currency. */
|
|
49
|
+
oneCurrency?: (key: string) => boolean;
|
|
46
50
|
/** The records a row's relation holds, each read as a record of its own (`recordReaderFor` over the far rows and
|
|
47
51
|
* their reader), so a rule across the relation ("any / none / every of its records where …") is answered in
|
|
48
52
|
* memory. Absent, or `undefined` for a row, the rule has no opinion and the row stays. */
|
|
@@ -57,7 +61,9 @@ export declare function countMatching<Row>(rows: readonly Row[], filter: FilterT
|
|
|
57
61
|
}): number;
|
|
58
62
|
/** `answersRelations`: the reader hands in related records (`ViewFieldReader.related`), so a rule across a relation
|
|
59
63
|
* the reader knows filters too; without them it has no opinion. */
|
|
60
|
-
export declare function hasActiveRules(filter: FilterTree, fieldOf: (key: string) => FieldDef | undefined, answersRelations?: boolean
|
|
64
|
+
export declare function hasActiveRules(filter: FilterTree, fieldOf: (key: string) => FieldDef | undefined, answersRelations?: boolean,
|
|
65
|
+
/** The reader's `oneCurrency`: a number rule over money it reads in one currency is whole. */
|
|
66
|
+
oneCurrency?: (key: string) => boolean): boolean;
|
|
61
67
|
export declare function evaluateView<Row>(rows: readonly Row[], query: ViewQuery, reader: ViewFieldReader<Row>, opts?: {
|
|
62
68
|
now?: Date;
|
|
63
69
|
rowId?: (row: Row) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isPerCodeCurrency, knownField, scalarOf, valueTypeOf } from "../derived.js";
|
|
2
2
|
import { ruleReaderOf } from "./read-rule.js";
|
|
3
|
-
import { isRelationRule, matchesTree, ruleIsActive, whereWaits, } from "./filter.js";
|
|
3
|
+
import { isRelationRule, matchesTree, refusesNumberRule, ruleIsActive, whereWaits, } from "./filter.js";
|
|
4
4
|
import { compareBy } from "./sort.js";
|
|
5
5
|
import { bucketRows } from "./buckets.js";
|
|
6
6
|
import { figuresOf } from "./figures.js";
|
|
@@ -26,19 +26,22 @@ export function countMatching(rows, filter, reader, opts = {}) {
|
|
|
26
26
|
n += 1;
|
|
27
27
|
return n;
|
|
28
28
|
}
|
|
29
|
-
export function hasActiveRules(filter, fieldOf, answersRelations = false) {
|
|
29
|
+
export function hasActiveRules(filter, fieldOf, answersRelations = false, oneCurrency) {
|
|
30
30
|
return filter.items.some((item) => {
|
|
31
31
|
if ("items" in item)
|
|
32
|
-
return hasActiveRules({ op: "and", items: item.items }, fieldOf, answersRelations);
|
|
32
|
+
return hasActiveRules({ op: "and", items: item.items }, fieldOf, answersRelations, oneCurrency);
|
|
33
33
|
if (isRelationRule(item))
|
|
34
34
|
return (answersRelations && !item.setAside && !whereWaits(item.where) && knownField(fieldOf(item.fieldKey))?.type === "relation");
|
|
35
35
|
const field = knownField(fieldOf(item.fieldKey));
|
|
36
|
-
return !!field &&
|
|
36
|
+
return (!!field &&
|
|
37
|
+
!isPerCodeCurrency(field) &&
|
|
38
|
+
!refusesNumberRule(field, item.operator, oneCurrency?.(item.fieldKey)) &&
|
|
39
|
+
ruleIsActive(valueTypeOf(field), item));
|
|
37
40
|
});
|
|
38
41
|
}
|
|
39
42
|
export function evaluateView(rows, query, reader, opts = {}) {
|
|
40
43
|
const filter = withHold(query.filter, query.hold, reader.fieldOf);
|
|
41
|
-
const filters = hasActiveRules(filter, reader.fieldOf, !!reader.related);
|
|
44
|
+
const filters = hasActiveRules(filter, reader.fieldOf, !!reader.related, reader.oneCurrency);
|
|
42
45
|
const search = hasSearch(query.search) ? query.search : null;
|
|
43
46
|
const filtered = filters || search
|
|
44
47
|
? rows.filter((row) => (!filters || matchesTree(filter, recordReaderFor(row, reader), opts)) &&
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** The footer picks, as `model/column-schema.ts` names them (`ListAggregateKind`). */
|
|
2
|
-
export type FigureKind = "none" | "sum" | "avg" | "min" | "max" | "count" | "filled" | "unique" | "ratio";
|
|
2
|
+
export type FigureKind = "none" | "sum" | "avg" | "min" | "max" | "count" | "filled" | "empty" | "percentEmpty" | "percentFilled" | "unique" | "ratio";
|
|
3
3
|
/** The figures a column may ask for: every kind but none. */
|
|
4
|
-
export declare const FIGURE_KINDS: readonly ["sum", "avg", "min", "max", "count", "filled", "unique", "ratio"];
|
|
4
|
+
export declare const FIGURE_KINDS: readonly ["sum", "avg", "min", "max", "count", "filled", "empty", "percentEmpty", "percentFilled", "unique", "ratio"];
|
|
5
5
|
/** A figure after the list's first: the total under one column, named by its id. */
|
|
6
6
|
export type ListGroupFigurePart = `total:${string}`;
|
|
7
7
|
/** The figures a group header can carry: its count, and its totals. `total` is the list's FIRST figure, named after
|
|
@@ -26,8 +26,9 @@ export declare function figureOf(values: readonly (number | null | undefined)[])
|
|
|
26
26
|
/**
|
|
27
27
|
* The number a figure shows, read from a group's figures, or null for nothing to show. It agrees with
|
|
28
28
|
* `figureOfValues` over the same rows: over no values, sum, avg, min and max are null; Count is the group's rows;
|
|
29
|
-
* Filled is the values present (`filled`, or the numbers present for an answer that doesn't carry it)
|
|
30
|
-
*
|
|
29
|
+
* Filled is the values present (`filled`, or the numbers present for an answer that doesn't carry it); Empty and the
|
|
30
|
+
* two percents read `filled` against the rows, and answer nothing where the answer carries no `filled` (counted
|
|
31
|
+
* numbers say nothing of a text's empty values). Unique and Ratio are not the database's to answer.
|
|
31
32
|
*/
|
|
32
33
|
export declare function figureFor(kind: FigureKind, figures: GroupFigures, key: string): number | null;
|
|
33
34
|
/**
|
|
@@ -57,7 +58,8 @@ export declare function figureNumber(value: unknown, field?: FieldDef): number |
|
|
|
57
58
|
* having one and unique as the set of their keys; a place, a name and a phone by their text (a list of them value by
|
|
58
59
|
* value); a range with neither end set as blank, and unique by its two ends; a person, a related record or an actor
|
|
59
60
|
* unique by its key, as an option's count keys it; anything else as it is, a blank not filled. Sum, average, smallest and largest read the numbers, a blank
|
|
60
|
-
* not a zero.
|
|
61
|
+
* not a zero. Empty is how many values aren't filled, and Percent empty and Percent filled each count over all of them,
|
|
62
|
+
* whole, none over no values. None and Ratio answer null here: a ratio reads two columns (`ratioOf`).
|
|
61
63
|
*/
|
|
62
64
|
export declare function figureOfValues(kind: FigureKind, values: readonly unknown[], reading: FigureReading): number | null;
|
|
63
65
|
/** Sum over sum, as a whole percent (0–100, rounded): each pair a row's numerator and denominator, a blank counted
|
|
@@ -30,6 +30,15 @@ export function figureOf(values) {
|
|
|
30
30
|
}
|
|
31
31
|
return figure;
|
|
32
32
|
}
|
|
33
|
+
const isEmptyOrPercent = (kind) => kind === "empty" || kind === "percentEmpty" || kind === "percentFilled";
|
|
34
|
+
function emptyOrPercent(kind, rows, filled) {
|
|
35
|
+
const empty = Math.max(0, rows - filled);
|
|
36
|
+
if (kind === "empty")
|
|
37
|
+
return empty;
|
|
38
|
+
if (rows === 0)
|
|
39
|
+
return null;
|
|
40
|
+
return Math.round(((kind === "percentEmpty" ? empty : filled) / rows) * 100);
|
|
41
|
+
}
|
|
33
42
|
export function figureFor(kind, figures, key) {
|
|
34
43
|
if (kind === "none" || kind === "unique" || kind === "ratio")
|
|
35
44
|
return null;
|
|
@@ -40,6 +49,8 @@ export function figureFor(kind, figures, key) {
|
|
|
40
49
|
return null;
|
|
41
50
|
if (kind === "filled")
|
|
42
51
|
return figure.filled ?? figure.count;
|
|
52
|
+
if (isEmptyOrPercent(kind))
|
|
53
|
+
return figure.filled === undefined ? null : emptyOrPercent(kind, figures.rows, figure.filled);
|
|
43
54
|
if (figure.count === 0)
|
|
44
55
|
return null;
|
|
45
56
|
if (kind === "sum")
|
|
@@ -115,6 +126,8 @@ export function figureOfValues(kind, values, reading) {
|
|
|
115
126
|
return null;
|
|
116
127
|
if (kind === "count")
|
|
117
128
|
return values.length;
|
|
129
|
+
if (isEmptyOrPercent(kind))
|
|
130
|
+
return emptyOrPercent(kind, values.length, figureOfValues("filled", values, reading) ?? 0);
|
|
118
131
|
if (kind === "filled" || kind === "unique") {
|
|
119
132
|
const type = reading.type;
|
|
120
133
|
if (reading.multiple && isMultipleType(type)) {
|
|
@@ -78,6 +78,13 @@ export declare function operatorsFor(type: FieldType, part?: string): readonly F
|
|
|
78
78
|
* compare shows nothing to filter on rather than an operator that would compare
|
|
79
79
|
* the wrong thing. */
|
|
80
80
|
export declare function operatorsForField(field: FieldDef, part?: string): readonly FilterOperator[];
|
|
81
|
+
/** Whether an operator compares a number: every number operator but Is empty and Is not empty. */
|
|
82
|
+
export declare function comparesNumber(operator: FilterOperator): boolean;
|
|
83
|
+
/** Whether a rule with `operator` on `field` is refused: it compares a number, and the field's amounts are in
|
|
84
|
+
* several currencies (`isMixedCurrency`), which one number can't compare. `oneCurrency`: the list reads the field in
|
|
85
|
+
* one currency (its amounts converted, or one currency shown for all), so the number compares again. A refused rule
|
|
86
|
+
* filters nothing anywhere, and the list says why (`filter.mixed-currency`); its operators stay offered. */
|
|
87
|
+
export declare function refusesNumberRule(field: FieldDef, operator: FilterOperator, oneCurrency?: boolean): boolean;
|
|
81
88
|
export declare function defaultOperator(type: FieldType, part?: string): FilterOperator;
|
|
82
89
|
export declare function isFilterGroup(node: FilterNode): node is FilterGroup;
|
|
83
90
|
export declare function isRelationRule(node: FilterNode): node is FilterRelationRule;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { DEFAULT_CONVENTIONS } from "../conventions.js";
|
|
3
|
-
import { isPerCodeCurrency, valueTypeOf } from "../derived.js";
|
|
3
|
+
import { isMixedCurrency, isPerCodeCurrency, valueTypeOf } from "../derived.js";
|
|
4
4
|
import { actorKey } from "../actor.js";
|
|
5
5
|
import { relationIdOf, relationKey } from "../relation.js";
|
|
6
6
|
import { phoneFilterOperand, phoneMatchText, readPhone } from "../phone.js";
|
|
@@ -141,6 +141,12 @@ export function operatorsForField(field, part) {
|
|
|
141
141
|
return [];
|
|
142
142
|
return operatorsFor(valueTypeOf(field), part);
|
|
143
143
|
}
|
|
144
|
+
export function comparesNumber(operator) {
|
|
145
|
+
return operator !== "is_empty" && operator !== "is_not_empty";
|
|
146
|
+
}
|
|
147
|
+
export function refusesNumberRule(field, operator, oneCurrency = false) {
|
|
148
|
+
return !oneCurrency && comparesNumber(operator) && isMixedCurrency(field);
|
|
149
|
+
}
|
|
144
150
|
export function defaultOperator(type, part) {
|
|
145
151
|
return operatorsFor(type, part)[0];
|
|
146
152
|
}
|
|
@@ -6,7 +6,7 @@ import type { FilterTree } from "./filter.js";
|
|
|
6
6
|
import { type ViewBucket } from "./buckets.js";
|
|
7
7
|
import type { GroupFigures } from "./figures.js";
|
|
8
8
|
import type { GroupSpec } from "./group.js";
|
|
9
|
-
import { type NumberFilterRule } from "./number.js";
|
|
9
|
+
import { type DurationUnit, type NumberFilterRule } from "./number.js";
|
|
10
10
|
import type { ListHold } from "./hold.js";
|
|
11
11
|
import { type ViewSearch } from "./search.js";
|
|
12
12
|
import { type SortSpec } from "./sort.js";
|
|
@@ -49,7 +49,8 @@ export type QueryKit = {
|
|
|
49
49
|
compareBy<Row>(sorts: readonly SortSpec[], reader: ViewFieldReader<Row>): (a: Row, b: Row) => number;
|
|
50
50
|
dateRuleLabel(rule: DateFilterRule | null | undefined): string;
|
|
51
51
|
textRuleLabel(rule: TextFilterRule | null | undefined): string;
|
|
52
|
-
|
|
52
|
+
/** `duration`: the unit a duration rule is kept in, its bounds then written as the duration box writes them. */
|
|
53
|
+
numberRuleLabel(rule: NumberFilterRule | null | undefined, decimals?: number, unit?: string, duration?: DurationUnit): string;
|
|
53
54
|
parseNumber(raw: string): number | null;
|
|
54
55
|
/** A new kit over `conventions.with(overrides)`. */
|
|
55
56
|
with(overrides: ConventionsInput): QueryKit;
|
package/fields/dist/query/kit.js
CHANGED
|
@@ -21,7 +21,7 @@ export function createQueryKit(conventions = DEFAULT_CONVENTIONS) {
|
|
|
21
21
|
compareBy: (sorts, reader) => compareBy(sorts, reader, cv),
|
|
22
22
|
dateRuleLabel: (rule) => dateRuleLabel(rule, cv),
|
|
23
23
|
textRuleLabel: (rule) => textRuleLabel(rule, cv),
|
|
24
|
-
numberRuleLabel: (rule, decimals, unit) => numberRuleLabel(rule, decimals, unit, cv),
|
|
24
|
+
numberRuleLabel: (rule, decimals, unit, duration) => numberRuleLabel(rule, decimals, unit, cv, duration),
|
|
25
25
|
parseNumber: (raw) => parseNumber(raw, cv),
|
|
26
26
|
with: (overrides) => createQueryKit(cv.with(overrides)),
|
|
27
27
|
};
|
|
@@ -10,6 +10,12 @@ export type ListPersonalLayer = {
|
|
|
10
10
|
phoneLayout?: ListLayout;
|
|
11
11
|
/** Their look over the view's; a key they left out is the view's. */
|
|
12
12
|
look?: ListLook;
|
|
13
|
+
/** Their toolbar, where the app lets them set it: when the filter bar stands (`added`, once something is added;
|
|
14
|
+
* `always`) and the buttons' words (`both`, icon and word; `icon`; `word`). Where its parts sit is the app's alone. */
|
|
15
|
+
toolbar?: {
|
|
16
|
+
bar?: "added" | "always";
|
|
17
|
+
words?: "both" | "icon" | "word";
|
|
18
|
+
};
|
|
13
19
|
};
|
|
14
20
|
/** The settings a person sees, with what they apply to that the settings don't hold. */
|
|
15
21
|
export type ListSettingsSeen = {
|
|
@@ -24,6 +24,9 @@ export const listPersonalLayerSchema = z.strictObject({
|
|
|
24
24
|
.optional(),
|
|
25
25
|
phoneLayout: z.enum(["table", "list", "board", "calendar"]).optional(),
|
|
26
26
|
look: listLookSchema.optional(),
|
|
27
|
+
toolbar: z
|
|
28
|
+
.strictObject({ bar: z.enum(["added", "always"]).optional(), words: z.enum(["both", "icon", "word"]).optional() })
|
|
29
|
+
.optional(),
|
|
27
30
|
});
|
|
28
31
|
function columnId(column) {
|
|
29
32
|
return column.part === undefined ? column.key : partKey(column.key, column.part);
|
|
@@ -69,8 +69,9 @@ export declare function durationUnitToMs(value: number, unit?: DurationUnit): nu
|
|
|
69
69
|
export declare function formatDurationInput(ms: number, cv?: FieldConventions): string;
|
|
70
70
|
/** Is the rule complete enough to filter? A half-typed range must not. */
|
|
71
71
|
export declare function isNumberRuleActive(rule: NumberFilterRule | null | undefined): boolean;
|
|
72
|
-
/** The row's right-hand summary: `> 100`, `100 – 500`, `Is empty`, `Any`.
|
|
73
|
-
|
|
72
|
+
/** The row's right-hand summary: `> 100`, `100 – 500`, `Is empty`, `Any`. `duration`: the unit a duration rule is kept
|
|
73
|
+
* in; each bound is then written as the duration box writes it (`> 1m 30s`), never the stored number. */
|
|
74
|
+
export declare function numberRuleLabel(rule: NumberFilterRule | null | undefined, decimals?: number, unit?: string, cv?: FieldConventions, duration?: DurationUnit): string;
|
|
74
75
|
/**
|
|
75
76
|
* The decimals a number rule's `eq` and `neq` round both sides to on `field`, as the grid works them out for the field's
|
|
76
77
|
* column: none for a whole number, percent, currency or range; else the decimals the field states (a rollup, a formula or
|