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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_CONVENTIONS, conventionsOr } from "../conventions.js";
|
|
2
2
|
import { isIntegerField, presentedDef } from "../derived.js";
|
|
3
|
+
import { formatDurationMs } from "../format/time.js";
|
|
3
4
|
import { compareDecimalText, decimalTextOf, isDecimalText, parseNumber, roundDecimalText } from "../parse-number.js";
|
|
4
5
|
export { parseNumber } from "../parse-number.js";
|
|
5
6
|
export const NUMBER_FILTER_OPERATORS = [
|
|
@@ -94,12 +95,13 @@ function formatDot(value, decimals) {
|
|
|
94
95
|
return String(Math.round(value));
|
|
95
96
|
return value.toFixed(decimals).replace(/\.?0+$/, "") || "0";
|
|
96
97
|
}
|
|
97
|
-
export function numberRuleLabel(rule, decimals = 2, unit, cv = DEFAULT_CONVENTIONS) {
|
|
98
|
+
export function numberRuleLabel(rule, decimals = 2, unit, cv = DEFAULT_CONVENTIONS, duration) {
|
|
98
99
|
cv = conventionsOr(cv);
|
|
99
100
|
if (!isNumberRuleActive(rule))
|
|
100
101
|
return cv.messages({ key: "filter.any" });
|
|
101
102
|
const suffix = unit ? ` ${unit}` : "";
|
|
102
|
-
const
|
|
103
|
+
const bound = (v) => (duration ? formatDurationMs(durationUnitToMs(v, duration)) : format(v, decimals, cv));
|
|
104
|
+
const shown = (v) => (duration ? bound(v) : `${bound(v)}${suffix}`);
|
|
103
105
|
switch (rule.operator) {
|
|
104
106
|
case "eq":
|
|
105
107
|
return shown(rule.value);
|
|
@@ -114,7 +116,7 @@ export function numberRuleLabel(rule, decimals = 2, unit, cv = DEFAULT_CONVENTIO
|
|
|
114
116
|
case "lte":
|
|
115
117
|
return `≤ ${shown(rule.value)}`;
|
|
116
118
|
case "between":
|
|
117
|
-
return `${
|
|
119
|
+
return `${bound(rule.value)} – ${shown(rule.value2)}`;
|
|
118
120
|
case "is_empty":
|
|
119
121
|
case "is_not_empty":
|
|
120
122
|
return numberFilterOperatorLabel(rule.operator, cv);
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { isPerCodeCurrency, knownField, scalarOf, storesDecimalText, valueTypeOf } from "../derived.js";
|
|
2
|
+
import { refusesNumberRule } from "./filter.js";
|
|
2
3
|
export function ruleReaderOf(row, reader) {
|
|
3
4
|
return (rule) => {
|
|
4
5
|
const field = knownField(reader.fieldOf(rule.fieldKey));
|
|
5
6
|
if (!field || isPerCodeCurrency(field))
|
|
6
7
|
return undefined;
|
|
8
|
+
if (refusesNumberRule(field, rule.operator, reader.oneCurrency?.(rule.fieldKey)))
|
|
9
|
+
return undefined;
|
|
7
10
|
return {
|
|
8
11
|
type: valueTypeOf(field),
|
|
9
12
|
value: scalarOf(field, reader.read(row, rule.fieldKey)),
|
|
@@ -186,7 +186,7 @@ A `FilterRule` is one field, one operator and one value. A `FilterGroup` combine
|
|
|
186
186
|
Every negative way (`is_not`, `neq`, `is_none_of`, `not_contains`) keeps a row whose value is empty, for every type: "Amount is not 0" and "Stage is not Won" both keep the row that has neither. `is_empty` asks for those rows alone.
|
|
187
187
|
|
|
188
188
|
```ts
|
|
189
|
-
const
|
|
189
|
+
const openOrUndated: FilterTree = {
|
|
190
190
|
op: "and",
|
|
191
191
|
items: [
|
|
192
192
|
{ fieldKey: "stage", operator: "is_none_of", value: ["lost"] },
|
|
@@ -194,13 +194,13 @@ const openOrBig: FilterTree = {
|
|
|
194
194
|
op: "or",
|
|
195
195
|
items: [
|
|
196
196
|
{ fieldKey: "currency", operator: "is_any_of", value: ["EUR"] },
|
|
197
|
-
{ fieldKey: "
|
|
197
|
+
{ fieldKey: "closeOn", operator: "is_empty", value: null },
|
|
198
198
|
],
|
|
199
199
|
},
|
|
200
200
|
],
|
|
201
201
|
};
|
|
202
|
-
// d1 is in euros, d4
|
|
203
|
-
assert.equal(countMatching(DEALS,
|
|
202
|
+
// d1 is in euros, d4 has no close date, d6 is in euros; d3 is lost.
|
|
203
|
+
assert.equal(countMatching(DEALS, openOrUndated, deals), 3);
|
|
204
204
|
```
|
|
205
205
|
|
|
206
206
|
`treeDepth` counts a tree's levels. A panel caps how deep a person can nest at `FILTER_TREE_MAX_UI_DEPTH`; the evaluator reads a tree of any depth.
|
|
@@ -208,7 +208,7 @@ assert.equal(countMatching(DEALS, openOrBig, deals), 3);
|
|
|
208
208
|
```ts
|
|
209
209
|
import { FILTER_TREE_MAX_UI_DEPTH, treeDepth } from "viewkitjs/fields/query";
|
|
210
210
|
|
|
211
|
-
assert.equal(treeDepth(
|
|
211
|
+
assert.equal(treeDepth(openOrUndated), 2);
|
|
212
212
|
assert.equal(FILTER_TREE_MAX_UI_DEPTH, 3);
|
|
213
213
|
```
|
|
214
214
|
|
|
@@ -235,7 +235,7 @@ const stillTyping: FilterTree = {
|
|
|
235
235
|
};
|
|
236
236
|
assert.equal(countMatching(DEALS, stillTyping, deals), DEALS.length);
|
|
237
237
|
assert.equal(hasActiveRules(stillTyping, deals.fieldOf), false);
|
|
238
|
-
assert.equal(hasActiveRules(
|
|
238
|
+
assert.equal(hasActiveRules(openOrUndated, deals.fieldOf), true);
|
|
239
239
|
```
|
|
240
240
|
|
|
241
241
|
A `FilterRelationRule` reads across a relation: any, none or every of the far records where its own tree holds. The far records are not among the rows in memory, so unless the reader hands them in the evaluator has no opinion on it and every row stays. A database adapter answers it.
|
|
@@ -347,7 +347,7 @@ The evaluator forgives: a rule it cannot read keeps the row. A saved view deserv
|
|
|
347
347
|
const DEAL = entityDef(DEAL_FIELDS);
|
|
348
348
|
const INDEX = defineIndex([DEAL, entityDef(COMPANY_FIELDS), entityDef(PERSON_FIELDS)]);
|
|
349
349
|
|
|
350
|
-
checkFilterTree(
|
|
350
|
+
checkFilterTree(openOrUndated, DEAL, INDEX, "deals view");
|
|
351
351
|
checkFilterTree(atBigCompanies, DEAL, INDEX, "deals view");
|
|
352
352
|
|
|
353
353
|
assert.throws(
|
|
@@ -392,19 +392,29 @@ assert.deepEqual(FILTER_OPERATORS.name, FILTER_OPERATORS.text);
|
|
|
392
392
|
|
|
393
393
|
A number rule compares the number the cell draws. Equality rounds both sides to the column's decimals, two unless the reader's `decimalsOf` says otherwise, so `= 100` finds an amount that reads `100.00` after a conversion. The decimals the grid rounds a field to are `ruleDecimalsOf(field)`'s; a reader of your own, or a server that translates rules, hands those. The comparisons need no rounding. `between` takes its two bounds in either order. Zero is a value: only an absent number is empty. `neq` keeps the rows with no number, as every "not" rule keeps an empty value.
|
|
394
394
|
|
|
395
|
+
A money field whose currency is each row's own (`code: { field }`) keeps 12000 EUR beside 5000 RON, and one number can't compare them: a rule that compares a number over it is refused (`refusesNumberRule`), filters nothing, and the list says why (`filter.mixed-currency`). Is empty and Is not empty compare no number and filter as ever. The deals' `value` is such a field, so read as kept it can't be narrowed by an amount. A reader that converts its amounts into one currency says so with `oneCurrency`, and the number compares again; so does a field that converts (`convert`), or one kept in one currency (`code: { fixed }`).
|
|
396
|
+
|
|
395
397
|
```ts
|
|
396
|
-
assert.deepEqual(kept(DEALS, deals, { fieldKey: "value", operator: "
|
|
397
|
-
|
|
398
|
+
assert.deepEqual(kept(DEALS, deals, { fieldKey: "value", operator: "gt", value: 500 }), ["d1", "d2", "d3", "d4", "d5", "d6"]);
|
|
399
|
+
assert.deepEqual(kept(DEALS, deals, { fieldKey: "value", operator: "is_empty", value: null }), ["d6"]);
|
|
400
|
+
|
|
401
|
+
const TO_EUR: Record<string, number> = { EUR: 1, RON: 0.2 };
|
|
402
|
+
const inEuros: ViewFieldReader<Deal> = {
|
|
403
|
+
...deals,
|
|
404
|
+
read: (row, key) =>
|
|
405
|
+
key === "value" && row.value !== null ? row.value * (TO_EUR[row.currency ?? ""] ?? 1) : deals.read(row, key),
|
|
406
|
+
codeOf: (_row, key) => (key === "value" ? "EUR" : undefined),
|
|
407
|
+
oneCurrency: (key) => key === "value",
|
|
408
|
+
};
|
|
409
|
+
assert.deepEqual(kept(DEALS, inEuros, { fieldKey: "value", operator: "eq", value: 100 }), ["d5"]);
|
|
410
|
+
const threeDecimals: ViewFieldReader<Deal> = { ...inEuros, decimalsOf: (key) => (key === "value" ? 3 : undefined) };
|
|
398
411
|
assert.equal(countMatching(DEALS, treeOf({ fieldKey: "value", operator: "eq", value: 100 }), threeDecimals), 0);
|
|
399
412
|
|
|
400
|
-
assert.deepEqual(kept(DEALS,
|
|
401
|
-
assert.deepEqual(kept(DEALS,
|
|
402
|
-
assert.
|
|
403
|
-
assert.ok(kept(DEALS, deals, { fieldKey: "value", operator: "neq", value: 100 }).includes("d6"));
|
|
413
|
+
assert.deepEqual(kept(DEALS, inEuros, { fieldKey: "value", operator: "between", value: [20000, 1000] }), ["d1", "d2", "d4"]);
|
|
414
|
+
assert.deepEqual(kept(DEALS, inEuros, { fieldKey: "value", operator: "lt", value: 1000 }), ["d3", "d5"]);
|
|
415
|
+
assert.ok(kept(DEALS, inEuros, { fieldKey: "value", operator: "neq", value: 100 }).includes("d6"));
|
|
404
416
|
```
|
|
405
417
|
|
|
406
|
-
A rule over a currency column compares the number alone: `lt 1000` above keeps 900 EUR and the 99.996 whose code nobody states alike. A reader that converts its amounts into one currency makes the number comparable, and says so through `codeOf` (see [A currency column of mixed codes](#a-currency-column-of-mixed-codes)).
|
|
407
|
-
|
|
408
418
|
## Date rules
|
|
409
419
|
|
|
410
420
|
A date rule compares calendar days, never instants. `is_relative` stores its intent, a direction and a unit, and resolves it against `now` each time, so "past week" still means the past week tomorrow. `this` is the calendar period around today, the week running Monday to Sunday. `past` and `next` reach one unit back or forward from today, both ends included. The other operators take day keys, `YYYY-MM-DD`; `is_between` takes a pair in either order, and filters nothing until both days are picked: an end left empty, `""` or null, leaves the rule unfinished and every row stays. `is_not` keeps every row but that day's, the rows with no date included, as every "not" rule keeps an empty value.
|
|
@@ -548,16 +558,10 @@ assert.deepEqual(sortedBy(DEALS, [{ fieldKey: "value", direction: "asc" }], deal
|
|
|
548
558
|
assert.deepEqual(sortedBy(DEALS, [{ fieldKey: "value", direction: "desc" }], deals), ["d1", "d3", "d4", "d2", "d5", "d6"]);
|
|
549
559
|
```
|
|
550
560
|
|
|
551
|
-
The library converts nothing. A reader that converts inside `read` knows the one currency its numbers came out in, and says so with `codeOf
|
|
561
|
+
The library converts nothing. A reader that converts inside `read` knows the one currency its numbers came out in, and says so with `codeOf` (and with `oneCurrency`, for its number rules); the column then sorts as the plain numbers it draws.
|
|
552
562
|
|
|
553
563
|
```ts
|
|
554
|
-
|
|
555
|
-
const inEuros: ViewFieldReader<Deal> = {
|
|
556
|
-
...deals,
|
|
557
|
-
read: (row, key) =>
|
|
558
|
-
key === "value" && row.value !== null ? row.value * (TO_EUR[row.currency ?? ""] ?? 1) : deals.read(row, key),
|
|
559
|
-
codeOf: (_row, key) => (key === "value" ? "EUR" : undefined),
|
|
560
|
-
};
|
|
564
|
+
// `inEuros`, from Number rules: every amount converted into euros.
|
|
561
565
|
assert.deepEqual(sortedBy(DEALS, [{ fieldKey: "value", direction: "asc" }], inEuros), ["d5", "d3", "d2", "d4", "d1", "d6"]);
|
|
562
566
|
```
|
|
563
567
|
|
|
@@ -847,7 +851,7 @@ assert.equal(kit.conventions.timeZone, "Europe/Bucharest");
|
|
|
847
851
|
assert.equal(kit.parseNumber("1.234,5"), 1234.5);
|
|
848
852
|
assert.equal(kit.textRuleLabel({ operator: "contains", query: "acme" }), 'contains "acme"');
|
|
849
853
|
assert.equal(kit.numberRuleLabel({ operator: "between", value: 100, value2: 500 }), "100 – 500");
|
|
850
|
-
assert.equal(kit.countMatching(DEALS,
|
|
854
|
+
assert.equal(kit.countMatching(DEALS, openOrUndated, deals), 3);
|
|
851
855
|
|
|
852
856
|
const romanian = kit.with({ locale: "ro" });
|
|
853
857
|
assert.equal(romanian.conventions.timeZone, "Europe/Bucharest");
|
|
@@ -137,6 +137,7 @@ Guide: [derived fields](../guides/derived-fields.md).
|
|
|
137
137
|
- `scalarOf` — the one value a field's value is sorted, filtered and totalled by: a breakdown's headline, and any other value itself.
|
|
138
138
|
- `valueTypeOf` — the type a consumer dispatches on: a rollup's or formula's result type, a lookup's far field's type (text while unresolved), or the field's own type.
|
|
139
139
|
- `presentedDef` — a derived field as the plain field its consumers can read: the result's shape under the field's own key and label, never editable, frozen. A rollup's or a formula's keeps its provenance; a lookup's takes the far field's shape without its provenance. It writes no sentence; `lockReason` on the original field does.
|
|
140
|
+
- `isMixedCurrency` — 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.
|
|
140
141
|
- `isPerCodeCurrency` — says whether a rollup's or formula's currency result is one amount per currency code rather than one number.
|
|
141
142
|
- `conversionOf` — a money field's conversion, when its currency code is a sibling field that declares one; null for anything else, and it never throws.
|
|
142
143
|
- `looksAhead` — says whether a date or instant field looks ahead, read off the presented definition so a lookup of one answers too; false for anything else.
|
|
@@ -21,6 +21,8 @@ Guide: [queries](../guides/queries.md), for every section on this page.
|
|
|
21
21
|
- `filterPartsFor` — the parts of a type's value a rule may name.
|
|
22
22
|
- `operatorsFor` — the operators a type offers, for a part when one is named: text-like types open on contains, a place offers operators only on one of its parts, and a range's end takes number's operators.
|
|
23
23
|
- `operatorsForField` — the operators a field offers, read off its result for a derived field; none for a result that is one amount per currency code.
|
|
24
|
+
- `comparesNumber` — whether an operator compares a number: every number operator but Is empty and Is not empty.
|
|
25
|
+
- `refusesNumberRule` — whether a rule with this operator on this field is refused: it compares a number over money whose currency is each row's own and that nothing reads in one currency, so it filters nothing and the list says why (`filter.mixed-currency`). Its third argument says the reader reads the field in one currency.
|
|
24
26
|
- `defaultOperator` — the operator a new rule on a type, or on one of its parts, opens on.
|
|
25
27
|
- `filterValueSchema` — the Zod schema of the value a type and operator store: what a route validates and an editor emits. A value still being typed is accepted, a wrong one is not: a number between, or a range's end between, with an end still empty holds `null` there.
|
|
26
28
|
- `ruleIsActive` — says whether a rule filters at all: a half-typed rule, a set-aside one, or one naming a part the type does not have, filters nothing.
|
|
@@ -61,7 +63,7 @@ Guide: [queries](../guides/queries.md), for every section on this page.
|
|
|
61
63
|
- `numberFilterInputs` — how many boxes a number operator needs: none, one or two.
|
|
62
64
|
- `numberFilterOperatorLabel` — a number operator's name in the host's words.
|
|
63
65
|
- `isNumberRuleActive` — says whether a number rule is complete enough to filter; a half-typed between is not.
|
|
64
|
-
- `numberRuleLabel` — a number rule's summary, such as `> 100` or `100 – 500`, at the column's decimals and with its unit.
|
|
66
|
+
- `numberRuleLabel` — a number rule's summary, such as `> 100` or `100 – 500`, at the column's decimals and with its unit; given the unit a duration is kept in, its bounds as the duration box writes them (`> 1m 30s`).
|
|
65
67
|
- `matchesNumberRule` — judges a value against a number rule: equality rounds both sides to the column's displayed decimals, zero is a value, never empty, and `neq` keeps an empty value. Text is read as the number it spells; with `exact`, for a field that keeps decimal text, its canonical text is compared exactly, as digits.
|
|
66
68
|
- `ruleDecimalsOf` — the decimals a number rule's `eq` and `neq` round to on a field, as the grid works them out for its column: none for a whole number, percent, currency or range, else the decimals the field states (a rollup, formula or lookup read as the field it shows), else 0 for a percent and 2 for any other; on a range, either end's, as its cell draws it: none when whole, else the decimals it states, else 0 for a percent range and 2 for any other. Hand it as `matchesRule`'s `decimals` (or a reader's `decimalsOf`), and round at it in a query that translates rules, so a list filtered there keeps the rows the grid keeps.
|
|
67
69
|
- `parseDurationInput` — reads a typed duration (`500ms`, `90s`, `2m 30s`, `1h30m`) into milliseconds; a bare number is seconds, and anything it cannot read whole is null.
|
|
@@ -257,8 +259,8 @@ What a list asks its server for, and what comes back, checked the same way in th
|
|
|
257
259
|
- `listSettingsChangeSchema` — the change's schema, built part by part from the settings' own, so each part is checked as the settings check it. Refuses an unknown part and `null` on a part every list holds (the layout, the filter, the sorts, the columns, the look).
|
|
258
260
|
- `settingsChange` — what an edited value changes over a view: only the parts that differ, an optional part it drops as `null`. Equal values in another key order are no change, and a part set to `undefined` reads as absent.
|
|
259
261
|
- `applySettingsChange` — the view with a change applied. The values handed in are left as they are.
|
|
260
|
-
- `ListPersonalLayer` — a person's own layer over a shared view: their column widths by column id (a key, or `partKey(key, part)`), the groups they folded by bucket key, the layout they read the list in on a phone and their
|
|
261
|
-
- `listPersonalLayerSchema` — the layer's schema. Refuses any other key, a filter, a sort or a group among them, a width that isn't a whole number from 24 to 2,000, more than 200 widths, more than 500 folded groups and a group folded twice.
|
|
262
|
+
- `ListPersonalLayer` — a person's own layer over a shared view: their column widths by column id (a key, or `partKey(key, part)`), the groups they folded by bucket key, the layout they read the list in on a phone, their look, and their toolbar where the app lets them set it (`toolbar`: `bar`, `added` or `always`; `words`, `both`, `icon` or `word`; VK-1095). Nothing in it changes what the view shows, and Show counts is the view's alone.
|
|
263
|
+
- `listPersonalLayerSchema` — the layer's schema. Refuses any other key, a filter, a sort or a group among them, any key in `toolbar` but `bar` and `words` and any value of theirs not listed, a width that isn't a whole number from 24 to 2,000, more than 200 widths, more than 500 folded groups and a group folded twice.
|
|
262
264
|
- `ListSettingsSeen` — the settings a person sees (`settings`), every width they see by column id (`widths`, columns the settings don't list included) and the groups they folded (`folded`).
|
|
263
265
|
- `applyPersonalLayer` — the settings with a person's layer over them: their look over the view's key by key, their width on each listed column, and with `{ phone: true }` their phone layout when they chose one. The values handed in are left as they are.
|
|
264
266
|
- `seenListSettings` — a saved view, then what changed, then a person's layer: the settings that person sees, the same in every app.
|
|
@@ -306,7 +308,7 @@ What a list asks its server for, and what comes back, checked the same way in th
|
|
|
306
308
|
- `ListDensity` — the density every view shares: `compact`, `default` or `spacious`. Each view spends it its own way.
|
|
307
309
|
- `partKey` — an id and one part joined: a column id (a column state, a Filter row) or a field key (Sort, Group), `::`, then the part.
|
|
308
310
|
- `parsePartKey` — splits a key at its last separator: `{ id }` for a whole value, `{ id, part }` for a part.
|
|
309
|
-
- `FigureKind` — the footer picks: `none`, `sum`, `avg`, `min`, `max`, `count`, `filled`, `unique` or `ratio`.
|
|
311
|
+
- `FigureKind` — the footer picks: `none`, `sum`, `avg`, `min`, `max`, `count`, `filled`, `empty`, `percentEmpty`, `percentFilled`, `unique` or `ratio`.
|
|
310
312
|
- `FIGURE_KINDS` — the figures a column may ask for: every kind but none.
|
|
311
313
|
- `ListGroupFigurePart` — a figure after the list's first in a group header: `total:` and a column id.
|
|
312
314
|
- `ListGroupSummaryPart` — one figure a group header can carry: `count`, `total` (the list's first figure) or a `ListGroupFigurePart` for each figure after it.
|
|
@@ -331,7 +333,7 @@ What a list asks its server for, and what comes back, checked the same way in th
|
|
|
331
333
|
|
|
332
334
|
- `NumberFigureKind` — the four figures that add numbers: sum, average, smallest and largest.
|
|
333
335
|
- `FigureReading` — what a column's values are, for its figure: their type, whether each holds several values, and the field they belong to, so a breakdown totals by its headline.
|
|
334
|
-
- `figureOfValues` — one column's figure over one set of rows' values, as a grid shows it: the count of values, the filled and the different ones read as a person reads them (several values by their keys, a place, a name or a phone by its text, a range by its two ends and one with neither end set as blank, a person, a related record or an actor by its key), and the sum, average, smallest and largest of the numbers, a blank not a zero. Null for none, for a ratio, and for numbers over no values.
|
|
336
|
+
- `figureOfValues` — one column's figure over one set of rows' values, as a grid shows it: the count of values, the filled and the different ones read as a person reads them (several values by their keys, a place, a name or a phone by its text, a range by its two ends and one with neither end set as blank, a person, a related record or an actor by its key), how many aren't filled and each as a whole percent of the values (none over no values), and the sum, average, smallest and largest of the numbers, a blank not a zero. Null for none, for a ratio, and for numbers over no values.
|
|
335
337
|
- `figureOfNumbers` — the sum, average, smallest or largest of some numbers; null over none.
|
|
336
338
|
- `figureNumber` — a value read as a number for a figure: a finite number, or text that reads as one, a breakdown by its headline; null for anything else (a list, a yes/no, blank text), never a zero.
|
|
337
339
|
- `ratioOf` — sum over sum as a whole percent, from each row's numerator and denominator, a blank counted as nothing; null when the denominators add up to nothing.
|
|
@@ -341,14 +343,14 @@ What a list asks its server for, and what comes back, checked the same way in th
|
|
|
341
343
|
- `combineFigure` — two parts' figures as the figure of both, exactly, a missing value never a zero; `filled` adds each side's own, or its count where it carries none.
|
|
342
344
|
- `figureOf` — the figure of some numbers, a blank not counted.
|
|
343
345
|
- `figuresOf` — each key's figure over some rows, read through the reader, in the shape a database answers, its `filled` counted as `figureOfValues` counts Filled; a key the reader does not know answers the empty figure.
|
|
344
|
-
- `figureFor` — the number a figure shows, read from a group's figures, agreeing with `figureOfValues` over the same rows (Filled reading `filled`, else the count); null where there is nothing to show, and for unique and ratio, which a database does not answer this way.
|
|
346
|
+
- `figureFor` — the number a figure shows, read from a group's figures, agreeing with `figureOfValues` over the same rows (Filled reading `filled`, else the count; Empty the rows less `filled`, and Percent empty and Percent filled that count over the rows, whole, none of the three from an answer that carries no `filled`); null where there is nothing to show, and for unique and ratio, which a database does not answer this way.
|
|
345
347
|
- `ratioFigure` — a ratio from its two parts' figures: sum over sum as a whole percent, divided once; null when either part was not totalled or the denominator is empty.
|
|
346
348
|
- `isGroupFigures` — says whether a value has the shape of `GroupFigures`.
|
|
347
349
|
|
|
348
350
|
## `evaluateView` and the query kit
|
|
349
351
|
|
|
350
352
|
- `ViewQuery` — a view's query as data: its filter tree, its search, a quick-filter hold on top of the filter, its sorts, its grouping, and whether rows are ordered by the sorts or by hand, with the hand-placed positions.
|
|
351
|
-
- `ViewFieldReader` — how the evaluator reads rows: the field for a key, the display value of a field on a row, optionally the displayed decimals, optionally the currency a read amount is in, and optionally the records a row's relation holds, so a rule across it is answered in memory.
|
|
353
|
+
- `ViewFieldReader` — how the evaluator reads rows: the field for a key, the display value of a field on a row, optionally the displayed decimals, optionally the currency a read amount is in, optionally whether it reads a money field in one currency (`oneCurrency`, so a number rule over it compares), and optionally the records a row's relation holds, so a rule across it is answered in memory.
|
|
352
354
|
- `recordReaderFor` — one row as a filter tree reads it, through a view's reader: what a reader's `related` hands back for each far row.
|
|
353
355
|
- `evaluateView` — runs a view over the rows in memory: filters them under the filter and the hold (`withHold`) when they have active rules and narrows them by the search when it has words (a pasted id finding its record when the host names each row's id), sorts them by the sorts or by hand, and splits them into buckets when the view is grouped by a group not set aside. It returns the rows and the buckets, or no buckets. Asked for the figures of some keys, it also answers them for the kept rows and for each bucket.
|
|
354
356
|
- `countMatching` — counts the rows a filter tree keeps.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "viewkitjs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.0",
|
|
4
4
|
"description": "ViewKit — typed fields, the grid and its editors, and a list's SQL for record lists, in one package: viewkitjs/fields, viewkitjs/views and viewkitjs/postgres. By Sheaf.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -288,8 +288,6 @@
|
|
|
288
288
|
"bench:chip": "node views/bench/chip-check.ts",
|
|
289
289
|
"bench:views-row": "node views/bench/views-row-check.ts",
|
|
290
290
|
"bench:shift": "node views/bench/shift-check.ts",
|
|
291
|
-
"bench:title-click": "node views/bench/title-click-check.ts"
|
|
292
|
-
"styles:defaults": "node views/styles/defaults.ts",
|
|
293
|
-
"bench:stylesheet": "node views/bench/stylesheet-check.ts"
|
|
291
|
+
"bench:title-click": "node views/bench/title-click-check.ts"
|
|
294
292
|
}
|
|
295
293
|
}
|
package/postgres/dist/check.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineConventions, isMultipleType } from "viewkitjs/fields";
|
|
2
|
-
import { filterPartsFor, filterValueSchema, operatorsForField, ruleIsActive, whereWaits, } from "viewkitjs/fields/query";
|
|
2
|
+
import { filterPartsFor, filterValueSchema, operatorsForField, refusesNumberRule, ruleIsActive, whereWaits, } from "viewkitjs/fields/query";
|
|
3
3
|
import { fieldsOf, isOneRelation } from "./map.js";
|
|
4
4
|
import { readableField } from "./readable.js";
|
|
5
5
|
import { REFUSALS } from "./refusals.js";
|
|
@@ -267,6 +267,8 @@ function groupChecker(reader, context, ownWhere) {
|
|
|
267
267
|
};
|
|
268
268
|
if (!ruleIsActive(type, rule))
|
|
269
269
|
return null;
|
|
270
|
+
if (refusesNumberRule(def, operator))
|
|
271
|
+
return null;
|
|
270
272
|
if (ownWhere && type === "phone")
|
|
271
273
|
throw REFUSALS.notYet(key, "a phone rule in a relation's own where", path);
|
|
272
274
|
if (ownWhere && (type === "date" || type === "datetime") && operator !== "is_empty" && operator !== "is_not_empty")
|
|
@@ -50,13 +50,15 @@ string
|
|
|
50
50
|
readonly path: readonly string[];
|
|
51
51
|
}
|
|
52
52
|
/** Several values as rows of a kind of their own: the column holding the record's key, the column holding a value,
|
|
53
|
-
*
|
|
53
|
+
* the boolean column marking a record's main one (`main`), which a sort by the field reads, and the column holding each
|
|
54
|
+
* row's label (`label`). Naming either, a read gives each row as `{ value, label, main }`, the main first. */
|
|
54
55
|
| {
|
|
55
56
|
readonly rows: {
|
|
56
57
|
readonly kind: string;
|
|
57
58
|
readonly record: string;
|
|
58
59
|
readonly value: string;
|
|
59
60
|
readonly main?: string;
|
|
61
|
+
readonly label?: string;
|
|
60
62
|
};
|
|
61
63
|
}
|
|
62
64
|
/** Several records through a link kind: its column holding this record's key, its column holding the other's. */
|
|
@@ -359,12 +359,14 @@ function checkForm(path, kind, def, form, kinds) {
|
|
|
359
359
|
const rows = form.rows;
|
|
360
360
|
if (!isRecord(rows))
|
|
361
361
|
throw new StorageError(path, NO_FORM);
|
|
362
|
-
onlyKeys(path, rows, ["kind", "record", "value", "main"]);
|
|
362
|
+
onlyKeys(path, rows, ["kind", "record", "value", "main", "label"]);
|
|
363
363
|
isKind(path, rows.kind);
|
|
364
364
|
name(path, rows.record);
|
|
365
365
|
name(path, rows.value);
|
|
366
366
|
if (rows.main !== undefined)
|
|
367
367
|
name(path, rows.main);
|
|
368
|
+
if (rows.label !== undefined)
|
|
369
|
+
name(path, rows.label);
|
|
368
370
|
return;
|
|
369
371
|
}
|
|
370
372
|
if ("through" in form) {
|
|
@@ -36,11 +36,22 @@ export function placeStored(at) {
|
|
|
36
36
|
}
|
|
37
37
|
if (isForm(form, "rows")) {
|
|
38
38
|
const rowsTable = at.farTable(form.rows.kind);
|
|
39
|
-
const { record, value, main } = form.rows;
|
|
40
|
-
return placed({
|
|
39
|
+
const { record, value, main, label } = form.rows;
|
|
40
|
+
return placed({
|
|
41
|
+
stored: "text",
|
|
42
|
+
several: {
|
|
43
|
+
kept: "rows",
|
|
44
|
+
table: rowsTable,
|
|
45
|
+
record,
|
|
46
|
+
value,
|
|
47
|
+
...(main === undefined ? {} : { main }),
|
|
48
|
+
...(label === undefined ? {} : { label }),
|
|
49
|
+
},
|
|
50
|
+
}, [
|
|
41
51
|
{ table: rowsTable, column: record },
|
|
42
52
|
{ table: rowsTable, column: value },
|
|
43
53
|
...(main === undefined ? [] : [{ table: rowsTable, column: main }]),
|
|
54
|
+
...(label === undefined ? [] : [{ table: rowsTable, column: label }]),
|
|
44
55
|
]);
|
|
45
56
|
}
|
|
46
57
|
}
|
package/postgres/dist/map.d.ts
CHANGED
|
@@ -99,7 +99,9 @@ export type RelationMap = {
|
|
|
99
99
|
};
|
|
100
100
|
/**
|
|
101
101
|
* How a field of several values keeps them: an array column, a json array, or rows of their own. Rows of their own may
|
|
102
|
-
* name their main mark (`main`): a boolean column, or your condition over the row, which a sort by the field reads
|
|
102
|
+
* name their main mark (`main`): a boolean column, or your condition over the row, which a sort by the field reads; and
|
|
103
|
+
* each row's label (`label`), a column or your expression read as text. Naming either, a read gives each row as an item
|
|
104
|
+
* `{ value, label, main }`, the main first, then by the row's key.
|
|
103
105
|
*/
|
|
104
106
|
export type Several = {
|
|
105
107
|
readonly kept: "array";
|
|
@@ -111,6 +113,8 @@ export type Several = {
|
|
|
111
113
|
readonly record: string;
|
|
112
114
|
readonly value: string;
|
|
113
115
|
readonly main?: Read;
|
|
116
|
+
/** Each row's label, a column or your expression, read as text; NULL is no label. */
|
|
117
|
+
readonly label?: Read;
|
|
114
118
|
/** At most one row per record holds the main mark, as a unique index on the record where main keeps it: a sort by
|
|
115
119
|
* the field reads the main row through one join. Your write path keeps that. */
|
|
116
120
|
readonly oneMain?: true;
|
package/postgres/dist/map.js
CHANGED
|
@@ -402,6 +402,7 @@ export function defineFieldMap(input) {
|
|
|
402
402
|
name(`${path}.several.record`, several.record);
|
|
403
403
|
name(`${path}.several.value`, several.value);
|
|
404
404
|
read(`${path}.several.main`, several.main);
|
|
405
|
+
read(`${path}.several.label`, several.label);
|
|
405
406
|
const oneMain = Reflect.get(several, "oneMain");
|
|
406
407
|
if (oneMain !== undefined && oneMain !== true)
|
|
407
408
|
throw new FieldMapError(`${path}.several.oneMain`, "give true, or leave it out");
|
|
@@ -415,6 +416,9 @@ export function defineFieldMap(input) {
|
|
|
415
416
|
else if (several !== undefined && Reflect.get(several, "pick") !== undefined) {
|
|
416
417
|
throw new FieldMapError(`${path}.several.pick`, "only rows of their own are picked out of a shared table");
|
|
417
418
|
}
|
|
419
|
+
else if (several !== undefined && Reflect.get(several, "label") !== undefined) {
|
|
420
|
+
throw new FieldMapError(`${path}.several.label`, "only rows of their own name a label: a list's items carry their own");
|
|
421
|
+
}
|
|
418
422
|
else if (several !== undefined && (Reflect.get(several, "main") !== undefined || Reflect.get(several, "oneMain") !== undefined)) {
|
|
419
423
|
throw new FieldMapError(`${path}.several.${Reflect.get(several, "main") !== undefined ? "main" : "oneMain"}`, "only rows of their own name a main mark: a list's main is its item marked main, else its first value");
|
|
420
424
|
}
|
package/postgres/dist/records.js
CHANGED
|
@@ -89,7 +89,12 @@ export function valueJson(scope, main, key, field) {
|
|
|
89
89
|
const found = elementsOn(scope, main, key);
|
|
90
90
|
const rows = found.row;
|
|
91
91
|
const element = type === "phone" && mapping.parts !== undefined ? phoneJson(rows, field, key, found.element) : found.element;
|
|
92
|
-
|
|
92
|
+
if (several.label === undefined && several.main === undefined)
|
|
93
|
+
return sql `COALESCE((SELECT json_agg(${element} ORDER BY ${rows.row.key}) FROM ${found.from} WHERE ${found.ties}), '[]'::json)`;
|
|
94
|
+
const marked = several.main === undefined ? sql `false` : sql `COALESCE((${readSql(rows, several.main, key)}), false)`;
|
|
95
|
+
const label = several.label === undefined ? sql `NULL::text` : sql `(${readSql(rows, several.label, key)})::text`;
|
|
96
|
+
const item = sql `json_build_object('value', ${element}, 'label', ${label}, 'main', ${marked})`;
|
|
97
|
+
return sql `COALESCE((SELECT json_agg(${item} ORDER BY ${marked} DESC, ${rows.row.key}) FROM ${found.from} WHERE ${found.ties}), '[]'::json)`;
|
|
93
98
|
}
|
|
94
99
|
if (several?.kept === "json") {
|
|
95
100
|
const items = elementsOf(scope, paren(listSql(scope, main, key)), "json");
|
|
@@ -15,7 +15,7 @@ An `AppStorage` names each kind of record you keep, by the name your index gives
|
|
|
15
15
|
- `{ column, from: { kind, value } }`: a select, a status or a text of one value kept as another kind's record, a status kept as a code table's row id for instance: `column` holds that record's key, and the field's value is its `value` column, read as text. The kind is declared like a link kind (its table, key and soft-delete column, no definitions), read as `far:<kind>` under the condition you hand for it, through one join: an empty id, one no record holds, and one whose record is hidden or in the trash read as no value. It filters, sorts, groups and counts by that value;
|
|
16
16
|
- `{ parts }`: a name, a place, a range or a phone, each part's column;
|
|
17
17
|
- `{ json, path }`: a member of a `jsonb` column by its path of keys (`[]` is the column itself, a list for a field of several values);
|
|
18
|
-
- `{ rows: { kind, record, value, main? } }`: several values as rows of a kind of their own; `main`, the boolean column marking a record's main one, which a sort by the field reads;
|
|
18
|
+
- `{ rows: { kind, record, value, main?, label? } }`: several values as rows of a kind of their own; `main`, the boolean column marking a record's main one, which a sort by the field reads; `label`, the column holding each row's label; naming either, a read gives each row as `{ value, label, main }`, the main first;
|
|
19
19
|
- `{ through: { kind, from, to } }`: several records through a link kind.
|
|
20
20
|
- **`notKept`**: fields the table keeps nothing for.
|
|
21
21
|
- **`notNull`**: fields whose value is never NULL on a row of this kind (a number, a percent, a date, an instant or a yes-or-no), which sort by their direction alone, so one index serves them both ways (the field-map guide, *Ordering a page*). A field with a hand-written entry says it in its own mapping instead. Only the list's own kind carries it: a field read on a far record never does, as that record may be missing. A field kept in a `jsonb` member reads a member of another type as empty, so a `NOT NULL` column doesn't keep the promise for it unless every member holds the field's type. A built map names no `textSort` yet, so its text sorts in your database's own order.
|
|
@@ -46,7 +46,7 @@ assert.throws(
|
|
|
46
46
|
- **Relations.** A one relation (`column`: this table's column holds the other's key, or your expression over the row returns it, such as an id kept in a `jsonb` member), a many relation whose rows point back (`back`), or one through a link table (`through`). A relation field always reads its relation, so the record it points at is held to that table's own condition.
|
|
47
47
|
- **A relation's lead row.** A relation through a link table that names its `lead` (a boolean column of the link row, such as `is_main`, or your condition over it) reaches one record: the far record its lead row points at, a person's main company among all its companies. The lead is written inside the link's own reading, beside its pick, soft delete and condition. A sort, a group and a lookup through it join the lead row onto the record once, then its far record; a read by id probes the lead row by record, the page's keys first, then joins its far record; a rule and a search word probe the lead row by record, never through that join. A search over a lead link and another field (an `or`) is probed by record on a page, each lead row's far record by its key, so the page stops when it is full ("ana" over a name and a person's company, a million people: 363 ms → 4.4 ms); a word no record holds then reads every reachable record's lead row in turn (0.68 s → 3.4–5.0 s for a reader who sees the million). A total, capped or exact, reads the matching links once, as Postgres plans it. A record with no lead row, or one whose lead points at a record the reader may not see, has none. A second relation over the same link table, with no `lead`, reaches every link, for a rule across all of them.
|
|
48
48
|
- **A user read through its users' table.** A user field may read a relation of one record kept in a column of its row (`value: { relation: "owner" }`), to the table its users are kept in, which names a `label`. It is read as a user the builder builds is: its value is its id only while the reader may see that user, it sorts and is searched by that table's label through one join, and a read by id gives it as `{ id, label }`. It takes no `sort` or `search` of its own.
|
|
49
|
-
- **Parts, several values, sort and search.** A name, a place and a range are read from their `parts`, and a phone may be; a field of several values says how they are kept (`several`): an array column, a `jsonb` list, or rows of their own in one of the map's tables (`table`, the column holding the record's key, the column holding the value). `sort` and `search` name what a sort and a search read.
|
|
49
|
+
- **Parts, several values, sort and search.** A name, a place and a range are read from their `parts`, and a phone may be; a field of several values says how they are kept (`several`): an array column, a `jsonb` list, or rows of their own in one of the map's tables (`table`, the column holding the record's key, the column holding the value, and, when the rows keep them, each row's `label` and its `main` mark). `sort` and `search` name what a sort and a search read.
|
|
50
50
|
|
|
51
51
|
### Tables many kinds, fields or relations share
|
|
52
52
|
|
|
@@ -588,7 +588,7 @@ void answered(opened, async () => [
|
|
|
588
588
|
```
|
|
589
589
|
|
|
590
590
|
- **Which records.** Each record the reader may see comes back once, in the order you named it. A key your condition or the soft delete hides, one that can't be a key of the table, and one named twice after its first are left out; a key is matched as the database spells it (a uuid in any case). A filter and a search in the request narrow the records further: the selected rows a view still keeps. It reads 1,000 keys a statement (`VALUES_PAGE`), one step after another, with no cap, and needs the table's `keyStored`.
|
|
591
|
-
- **Each value, as ViewKit draws it.** A column or your expression as kept; an actor by its key (text that is no actor's key reads `null`); a value read from its parts as an object of the parts your map gives, a name with all three of `full`, `given` and `family`, one your map doesn't place `null`, and `null` when ViewKit reads it as empty (a name or a place whose parts are all null or blank, a range with neither end); a phone as a filter reads it: in international form (an E.164 number, an extension of digits or none) as `{ number, extension }`, `extension` null when your map places none, otherwise as its text as typed, its number, or, when that is blank, its plain value, and `null` when it has neither; several values as a list, an empty one for none (an array column holding NULL reads as none; a `jsonb` column holding one value reads as a list of one, JSON null or `""` as none; rows of their own in their key order, read under their own condition); a relation of one record as `{ id, label }`, its far record read under its own condition, and `null` when that record is hidden or deleted; a relation of several records as a list of them, in the order its links (or its far keys) come. A label is text, `""` when the far table names none or the record has none.
|
|
591
|
+
- **Each value, as ViewKit draws it.** A column or your expression as kept; an actor by its key (text that is no actor's key reads `null`); a value read from its parts as an object of the parts your map gives, a name with all three of `full`, `given` and `family`, one your map doesn't place `null`, and `null` when ViewKit reads it as empty (a name or a place whose parts are all null or blank, a range with neither end); a phone as a filter reads it: in international form (an E.164 number, an extension of digits or none) as `{ number, extension }`, `extension` null when your map places none, otherwise as its text as typed, its number, or, when that is blank, its plain value, and `null` when it has neither; several values as a list, an empty one for none (an array column holding NULL reads as none; a `jsonb` column holding one value reads as a list of one, JSON null or `""` as none; rows of their own in their key order, read under their own condition, or, when their map names a `label` or a `main`, as items `{ value, label, main }`, the cells' own shape: the rows `main` marks first, then the rest, each in key order, `label` read as text (NULL is none) and `main` false where the mark is NULL or unnamed); a relation of one record as `{ id, label }`, its far record read under its own condition, and `null` when that record is hidden or deleted; a relation of several records as a list of them, in the order its links (or its far keys) come. A label is text, `""` when the far table names none or the record has none.
|
|
592
592
|
- **What crosses the wire.** One JSON column a row, so every driver hands back the same thing: numbers and days come as Postgres writes JSON, read back as JavaScript reads JSON. An instant, kept as `timestamp` or `timestamptz`, comes as Postgres writes a `timestamptz` under UTC (`"2026-03-07T09:00:00.123456+00:00"`, the fraction's trailing zeros trimmed), whatever the connection's `TimeZone` or `DateStyle`: a timestamp without a zone holds UTC. One held as `infinity` or `-infinity`, or outside the years 1 to 9999, reads as `null`. A value kept as a double (`float8`) is written with 17 significant digits, so it reads back as the same double on any connection, whatever `extra_float_digits` it, its role or its database sets; NaN and the infinities come as the strings `"NaN"`, `"Infinity"` and `"-Infinity"`. The translator goes by the `stored` your map gives: an expression you declare `numeric` that hands back a double is written as Postgres writes it. Every value is worked out in the statement's projection, after your condition kept the row, so none is ever read on a row the reader may not see. A field your map doesn't hold is refused as `unknown-field`, and more than 10,000 fields in one request throw a `RangeError`.
|
|
593
593
|
|
|
594
594
|
## Counting and grouping
|
|
@@ -656,7 +656,7 @@ A value is grouped as it is kept and turned into text only once grouped, so noth
|
|
|
656
656
|
|
|
657
657
|
## Figures
|
|
658
658
|
|
|
659
|
-
**`figuresQuery`** works out what a list shows under its columns, over the rows its filter and search keep, as fields' `figuresOf` does: the rows it counted, and per field in `keys`, of any type, the sum, the count of numbers present, the smallest and the largest (a number field's; null, 0, null and null for any other), and `filled`, its values present as fields' Filled counts them. An average
|
|
659
|
+
**`figuresQuery`** works out what a list shows under its columns, over the rows its filter and search keep, as fields' `figuresOf` does: the rows it counted, and per field in `keys`, of any type, the sum, the count of numbers present, the smallest and the largest (a number field's; null, 0, null and null for any other), and `filled`, its values present as fields' Filled counts them. An average, a filled count, an empty count and the two percents follow from those with fields' `figureFor`; unique and ratio are not the database's to answer.
|
|
660
660
|
|
|
661
661
|
```ts
|
|
662
662
|
import { figuresQuery } from "viewkitjs/postgres";
|
|
@@ -25,7 +25,7 @@ The one door. Guide: [the field map and the permission condition](../guides/fiel
|
|
|
25
25
|
- `Read` — a column of the row, or your own SQL over it. An expression is your own SQL, written as you wrote it: build it with sql from your own code, never from text a person typed; one that reads another table answers for access itself, and one that reads another field answers for that field's readers.
|
|
26
26
|
- `RelationMap` — a relation between two of the map's tables: one (`column`, a column or your expression over the row it starts from, returning the far key), many pointing back (`back`), or many through a link table (`through`), which may name the columns that pick one relation's links out of a table many relations share (`pick`), and its lead row (`lead`, a boolean column of the link row or your condition over it), which makes it reach one record.
|
|
27
27
|
- `Row` — a row the translator opened: `alias` is the plain name it was opened under (`vk_r0`), `column(name)` quotes a column under it, `key` is its key column.
|
|
28
|
-
- `Several` — how a field of several values keeps them: an array, a json array, or rows of their own, which may name their main mark (`main`, a boolean column or your condition over the row) for a sort by the main one, whether at most one row per record holds that mark (`oneMain: true`, your write path's promise), which reads the main rows through one join, and the columns that pick one field's rows out of a table many fields share (`pick`).
|
|
28
|
+
- `Several` — how a field of several values keeps them: an array, a json array, or rows of their own, which may name their main mark (`main`, a boolean column or your condition over the row) for a sort by the main one, and each row's `label` (a column or your expression, read as text); naming either, a read gives each row as `{ value, label, main }`, the main first, whether at most one row per record holds that mark (`oneMain: true`, your write path's promise), which reads the main rows through one join, and the columns that pick one field's rows out of a table many fields share (`pick`).
|
|
29
29
|
- `Stored` — the SQL type a value is kept as. A select or a status is kept as `text` or `uuid`.
|
|
30
30
|
- `REQUEST_LIMITS` — the most a list request compiles: 500 rules and groups in a filter, the root among them (`rules`); 32 levels deep, the root 1 and each group and each relation rule's `where` one deeper than the group holding it, a rule no level (`depth`); 50 search words (`searchWords`); 30,000 values a statement (`parameters`); 100,000 ids an `ids` request answers (`ids`). The filter counted is the one compiled, the quick-filter hold on top. An app lowers any on its map, never past these.
|
|
31
31
|
- `RequestLimits` — the caps a map holds (`FieldMap.limits`): ViewKit's, or lower where the app lowered them.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ViewsHeaderGlyphProps, ViewsHeaderResizeHandleProps, ViewsHeaderSortMarkProps } from "./types.js";
|
|
2
|
+
/** ViewKit's own glyph for the column, as it is. */
|
|
3
|
+
export declare function DefaultHeaderGlyph({ fallback }: ViewsHeaderGlyphProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
/** The provider's sort arrow, the way the list sorts by the column. */
|
|
5
|
+
export declare function DefaultHeaderSortMark({ dir, className }: ViewsHeaderSortMarkProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
/** A hairline in the brand's colour on the cell's edge, shown under the pointer and while the column is resized. */
|
|
7
|
+
export declare function DefaultHeaderResizeHandle({ active }: ViewsHeaderResizeHandleProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cx } from "../internal/cx.js";
|
|
4
|
+
import { useViews } from "../provider/context.js";
|
|
5
|
+
export function DefaultHeaderGlyph({ fallback }) {
|
|
6
|
+
return _jsx(_Fragment, { children: fallback });
|
|
7
|
+
}
|
|
8
|
+
export function DefaultHeaderSortMark({ dir, className }) {
|
|
9
|
+
const { icons } = useViews();
|
|
10
|
+
const Mark = dir === "asc" ? icons.sortAsc : icons.sortDesc;
|
|
11
|
+
return _jsx(Mark, { className: className });
|
|
12
|
+
}
|
|
13
|
+
export function DefaultHeaderResizeHandle({ active }) {
|
|
14
|
+
return (_jsx("div", { className: cx("absolute inset-y-0 right-0 w-[3px] rounded-full bg-(color:--vk-brand)", active ? "opacity-100" : "opacity-0 group-hover/gridresize:opacity-100") }));
|
|
15
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ViewsToolbarButtonProps } from "./types.js";
|
|
2
|
-
export declare function DefaultToolbarButton({ icon, label, word, count, onClear, dot, open, changed, edge, disabled, disabledReason, children, more, empty, iconAlone, aside, foot, joined, waits, size, popup, current, part, className, onContextMenu, onClick, onPointerDown, ref, }: ViewsToolbarButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function DefaultToolbarButton({ icon, label, word, count, onClear, dot, open, changed, edge, disabled, disabledReason, children, more, empty, iconAlone, aside, foot, joined, waits, size, popup, expanded, current, part, className, onContextMenu, onClick, onPointerDown, ref, }: ViewsToolbarButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,7 +6,7 @@ import { ELEMENT_RESET } from "../internal/reset.js";
|
|
|
6
6
|
import { useViews } from "../provider/context.js";
|
|
7
7
|
import { isFramePart } from "./frame-parts.js";
|
|
8
8
|
const flag = (on) => (on ? "" : undefined);
|
|
9
|
-
export function DefaultToolbarButton({ icon, label, word, count, onClear, dot, open, changed, edge, disabled, disabledReason, children, more, empty, iconAlone, aside, foot, joined, waits, size, popup, current, part, className, onContextMenu, onClick, onPointerDown, ref, }) {
|
|
9
|
+
export function DefaultToolbarButton({ icon, label, word, count, onClear, dot, open, changed, edge, disabled, disabledReason, children, more, empty, iconAlone, aside, foot, joined, waits, size, popup, expanded, current, part, className, onContextMenu, onClick, onPointerDown, ref, }) {
|
|
10
10
|
const { messages, icons } = useViews();
|
|
11
11
|
const Chevron = icons.chevronDown;
|
|
12
12
|
const chevron = part === "views-chip" || part === "views-more";
|
|
@@ -14,7 +14,7 @@ export function DefaultToolbarButton({ icon, label, word, count, onClear, dot, o
|
|
|
14
14
|
const reasoned = !!disabled && !!disabledReason;
|
|
15
15
|
const worded = children != null && !iconAlone;
|
|
16
16
|
const shownMore = iconAlone ? undefined : more;
|
|
17
|
-
const button = (describedBy) => (_jsxs("span", { className: cx("relative inline-flex shrink-0", worded && "min-w-0 max-w-full"), children: [_jsxs("button", { ref: ref, type: "button", "aria-describedby": describedBy, "aria-label": worded ? undefined : label, "aria-haspopup": popup, "aria-expanded": popup ? Boolean(open) :
|
|
17
|
+
const button = (describedBy) => (_jsxs("span", { className: cx("relative inline-flex shrink-0", worded && "min-w-0 max-w-full"), children: [_jsxs("button", { ref: ref, type: "button", "aria-describedby": describedBy, "aria-label": worded ? undefined : label, "aria-haspopup": popup, "aria-expanded": popup ? Boolean(open) : expanded, "aria-disabled": reasoned ? true : undefined, disabled: disabled && !reasoned, "aria-current": current ? "true" : undefined, "data-slot": isFramePart(part) ? PART_SLOT[part] : "vk-toolbar-button", "data-tab": current !== undefined ? "" : undefined, "data-current": flag(current), "data-open": flag(open), "data-changed": flag(changed), "data-edge": flag(edge), "data-disabled": flag(disabled), "data-empty": flag(empty), "data-icon-alone": flag(iconAlone), "data-aside": flag(aside), "data-foot": flag(foot), "data-joined": joined, "data-waits": flag(waits), onClick: reasoned ? (event) => event.preventDefault() : onClick, onPointerDown: reasoned ? undefined : onPointerDown, onContextMenu: reasoned ? undefined : onContextMenu, className: cx(ELEMENT_RESET, "inline-flex shrink-0 items-center justify-center transition-colors duration-150", joined ? JOINED_CLASS[joined] : "rounded-full", worded && "min-w-0 max-w-full", foot
|
|
18
18
|
? "h-11 w-11"
|
|
19
19
|
: worded || shownMore
|
|
20
20
|
? cx("gap-1.5 px-3", size === "sm" ? "h-8" : "h-9")
|
|
@@ -5,6 +5,7 @@ import { DefaultCheckRow, DefaultChoiceRow, DefaultDirectionButton, DefaultRadio
|
|
|
5
5
|
import { DefaultPanelSearch } from "./PanelSearch.js";
|
|
6
6
|
import { DefaultPill } from "./Pill.js";
|
|
7
7
|
import { DefaultList } from "./List.js";
|
|
8
|
+
import { DefaultHeaderGlyph, DefaultHeaderResizeHandle, DefaultHeaderSortMark } from "./HeaderChrome.js";
|
|
8
9
|
import { DefaultLoading } from "./Loading.js";
|
|
9
10
|
import { DefaultLoadMore } from "./LoadMore.js";
|
|
10
11
|
import { DefaultPlatformMark } from "./PlatformMark.js";
|
|
@@ -50,4 +51,7 @@ export const DEFAULT_VIEWS_ATOMS = {
|
|
|
50
51
|
Pill: DefaultPill,
|
|
51
52
|
RangeCalendar: DefaultRangeCalendar,
|
|
52
53
|
ToolbarButton: DefaultToolbarButton,
|
|
54
|
+
HeaderGlyph: DefaultHeaderGlyph,
|
|
55
|
+
HeaderSortMark: DefaultHeaderSortMark,
|
|
56
|
+
HeaderResizeHandle: DefaultHeaderResizeHandle,
|
|
53
57
|
};
|