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
|
@@ -13,7 +13,7 @@ import { ToolbarButton } from "../toolbar/ToolbarButton.js";
|
|
|
13
13
|
import { useViewsRowInFrame } from "./in-frame.js";
|
|
14
14
|
import { ViewCreatePill } from "./ViewCreatePill.js";
|
|
15
15
|
import { useNewView } from "./new-view.js";
|
|
16
|
-
export function ViewPicker({ axis, className }) {
|
|
16
|
+
export function ViewPicker({ axis, className, press, }) {
|
|
17
17
|
const context = useViews();
|
|
18
18
|
const { components, conventions, icons, messages } = context;
|
|
19
19
|
const { AppIcon, Popover, ViewsListBody } = components;
|
|
@@ -65,22 +65,27 @@ export function ViewPicker({ axis, className }) {
|
|
|
65
65
|
}) }));
|
|
66
66
|
const words = (_jsxs(_Fragment, { children: [_jsx("span", { className: "truncate", children: active?.label ?? messages({ key: "views.panels.view-fallback" }) }), active && !axis.hideCounts && typeof active.count === "number" && (_jsxs("span", { className: "font-medium opacity-70 tabular-nums", children: ["\u00B7 ", formatCount(active.count, conventions)] }))] }));
|
|
67
67
|
const onChipClick = (event) => {
|
|
68
|
-
|
|
68
|
+
if (press)
|
|
69
|
+
press.onPress();
|
|
70
|
+
else
|
|
71
|
+
toggle.triggerProps.onClick(event);
|
|
69
72
|
};
|
|
70
|
-
|
|
73
|
+
const expanded = press ? press.expanded : toggle.open;
|
|
74
|
+
const lit = press ? !!press.lit : toggle.open;
|
|
75
|
+
return (_jsxs(_Fragment, { children: [inFrame ? (_jsx(ToolbarButton, { ref: anchor, icon: active?.icon ? _jsx(AppIcon, { name: active.icon, className: "h-3.5 w-3.5 shrink-0" }) : null, label: messages({ key: "views.panels.view-change" }), part: "views-chip", ...(press ? { expanded } : { popup: "dialog" }), open: lit, onPointerDown: toggle.triggerProps.onPointerDown, onClick: onChipClick, children: words })) : (_jsx(PanelButton, { views: context, draw: {
|
|
71
76
|
frame: cx("h-8 max-w-full gap-1.5 px-2.5", className),
|
|
72
77
|
variant: "secondary",
|
|
73
78
|
size: "sm",
|
|
74
79
|
ref: anchor,
|
|
75
80
|
"aria-label": messages({ key: "views.panels.view-change" }),
|
|
76
|
-
"aria-haspopup": "dialog",
|
|
77
|
-
"aria-expanded":
|
|
81
|
+
...(!press && { "aria-haspopup": "dialog" }),
|
|
82
|
+
"aria-expanded": expanded,
|
|
78
83
|
"data-slot": "vk-views-chip",
|
|
79
|
-
"data-state":
|
|
84
|
+
"data-state": lit ? "open" : "closed",
|
|
80
85
|
onPointerDown: toggle.triggerProps.onPointerDown,
|
|
81
86
|
onClick: onChipClick,
|
|
82
87
|
children: (_jsxs(_Fragment, { children: [active?.icon && _jsx(AppIcon, { name: active.icon, className: "h-3.5 w-3.5 shrink-0" }), words, _jsx(Chevron, { className: "h-3.5 w-3.5 shrink-0 opacity-60" })] })),
|
|
83
|
-
} })), sheet ? (_jsx(PanelSheet, { open: toggle.open, onOpenChange: (next) => {
|
|
88
|
+
} })), press ? null : sheet ? (_jsx(PanelSheet, { open: toggle.open, onOpenChange: (next) => {
|
|
84
89
|
toggle.setOpen(next);
|
|
85
90
|
}, title: messages({ key: "views.panels.views-list" }), snap: "auto", ...(step.title !== undefined && { sheetTitle: step.title || listLabel, headed: !sheetDrawsClose }), ...(step.back &&
|
|
86
91
|
sheetDrawsClose && {
|
|
@@ -112,6 +112,9 @@ function markOf(column) {
|
|
|
112
112
|
function wholeOf(column, part) {
|
|
113
113
|
return part === undefined && column.field && isIntegerField(column.field) ? { integer: true } : {};
|
|
114
114
|
}
|
|
115
|
+
function durationOf(column, part) {
|
|
116
|
+
return part === undefined && column.format?.style === "duration" ? { duration: column.format.unit ?? "ms" } : {};
|
|
117
|
+
}
|
|
115
118
|
function spokenOf(input) {
|
|
116
119
|
const messages = input.filterData?.messages ?? input.resolve;
|
|
117
120
|
const conventions = input.filterData?.conventions ?? input.conventions;
|
|
@@ -167,6 +170,7 @@ function editorFields(input) {
|
|
|
167
170
|
type: valueTypeOf(column.field),
|
|
168
171
|
...markOf(column),
|
|
169
172
|
...wholeOf(column, part),
|
|
173
|
+
...durationOf(column, part),
|
|
170
174
|
},
|
|
171
175
|
];
|
|
172
176
|
});
|
|
@@ -180,6 +184,7 @@ function editorFields(input) {
|
|
|
180
184
|
type: valueTypeOf(column.field),
|
|
181
185
|
...markOf(column),
|
|
182
186
|
...wholeOf(column),
|
|
187
|
+
...durationOf(column),
|
|
183
188
|
}));
|
|
184
189
|
return {
|
|
185
190
|
key: relationFilterKey(key),
|
|
@@ -260,7 +265,14 @@ export function settingsFilterTree(input, write) {
|
|
|
260
265
|
});
|
|
261
266
|
return built.find((config) => config.key === key) ?? null;
|
|
262
267
|
};
|
|
268
|
+
const answered = new Map();
|
|
263
269
|
const optionsOf = (fieldKey, part, relation) => {
|
|
270
|
+
const key = `${fieldKey}\u0000${part ?? ""}\u0000${relation ?? ""}`;
|
|
271
|
+
if (!answered.has(key))
|
|
272
|
+
answered.set(key, optionsAnswer(fieldKey, part, relation));
|
|
273
|
+
return answered.get(key);
|
|
274
|
+
};
|
|
275
|
+
const optionsAnswer = (fieldKey, part, relation) => {
|
|
264
276
|
const target = relation !== undefined ? relationFilters?.targets[relation] : undefined;
|
|
265
277
|
if (relation !== undefined && !target)
|
|
266
278
|
return undefined;
|
|
@@ -34,6 +34,17 @@ export type SettingsPanelsInput<Row> = {
|
|
|
34
34
|
onChange: (change: ListSettingsChange) => void;
|
|
35
35
|
/** Each change to the person's layer: only the keys it names. */
|
|
36
36
|
onLayerChange: (patch: ListPersonalLayer) => void;
|
|
37
|
+
/** What the app lets the person set in their own Customize: Layout's Filter bar row (on a computer, where no bar
|
|
38
|
+
* standing by its button is placed) and its Button words row, each written to their layer alone. */
|
|
39
|
+
person?: {
|
|
40
|
+
bar?: boolean;
|
|
41
|
+
words?: boolean;
|
|
42
|
+
};
|
|
43
|
+
/** The settings stand on a phone: Layout leaves out the Filter bar row, as a phone draws no filter bar. */
|
|
44
|
+
phone?: boolean;
|
|
45
|
+
/** When the filter bar stands while the person picked none: a placed bar's own `shows` (`button`, its button
|
|
46
|
+
* shows it: no Filter bar row), else the toolbar's `bar`. Default `added`. */
|
|
47
|
+
barDefault?: "added" | "always" | "button";
|
|
37
48
|
/** The reader's own list defaults (vertical borders). */
|
|
38
49
|
defaults?: ListDefaults;
|
|
39
50
|
/** The app's words; the package's English when absent. */
|
|
@@ -194,6 +194,32 @@ export function settingsLayout(input) {
|
|
|
194
194
|
if (value !== layer.phoneLayout)
|
|
195
195
|
onLayerChange({ phoneLayout: value });
|
|
196
196
|
};
|
|
197
|
+
const toolbar = layer.toolbar ?? {};
|
|
198
|
+
const barDefault = input.barDefault ?? "added";
|
|
199
|
+
if (input.person?.bar && !input.phone && barDefault !== "button") {
|
|
200
|
+
choices.push({
|
|
201
|
+
key: "bar",
|
|
202
|
+
label: word("views.panels.person-bar"),
|
|
203
|
+
value: toolbar.bar ?? barDefault,
|
|
204
|
+
options: ["added", "always"].map((value) => ({ value, label: word(`views.panels.person-bar-${value}`) })),
|
|
205
|
+
onChange: (value) => {
|
|
206
|
+
if (value !== (toolbar.bar ?? barDefault))
|
|
207
|
+
onLayerChange({ toolbar: { ...toolbar, bar: value } });
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
if (input.person?.words) {
|
|
212
|
+
choices.push({
|
|
213
|
+
key: "words",
|
|
214
|
+
label: word("views.panels.person-words"),
|
|
215
|
+
value: toolbar.words ?? "both",
|
|
216
|
+
options: ["both", "icon", "word"].map((value) => ({ value, label: word(`views.panels.person-words-${value}`) })),
|
|
217
|
+
onChange: (value) => {
|
|
218
|
+
if (value !== (toolbar.words ?? "both"))
|
|
219
|
+
onLayerChange({ toolbar: { ...toolbar, words: value } });
|
|
220
|
+
},
|
|
221
|
+
});
|
|
222
|
+
}
|
|
197
223
|
return {
|
|
198
224
|
label: word("views.panels.layout"),
|
|
199
225
|
value: settings.layout,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ListPersonalLayer } from "viewkitjs/fields/query";
|
|
2
|
+
/** What the app lets the person set in their own Customize: when the filter bar stands, the buttons' words. */
|
|
3
|
+
export type ListPersonSwitch = {
|
|
4
|
+
bar?: boolean;
|
|
5
|
+
words?: boolean;
|
|
6
|
+
};
|
|
7
|
+
/** The toolbar keys of their layer that count: the bar where the app lets them set it and on a computer, the words where the
|
|
8
|
+
* app lets them set them. */
|
|
9
|
+
export declare function toolbarCounts(layer: ListPersonalLayer, { phone, person }?: {
|
|
10
|
+
phone?: boolean;
|
|
11
|
+
person?: ListPersonSwitch;
|
|
12
|
+
}): {
|
|
13
|
+
bar: boolean;
|
|
14
|
+
words: boolean;
|
|
15
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { applySettingsChange, settingsChange, } from "viewkitjs/fields/query";
|
|
2
2
|
import { columnsReset } from "../../model/settings-columns.js";
|
|
3
|
+
import { toolbarCounts } from "../settings/person.js";
|
|
3
4
|
import { settingsCleared } from "./clear.js";
|
|
4
5
|
const KEYS = {
|
|
5
6
|
layout: ["layout", "look", "board", "calendar"],
|
|
@@ -9,10 +10,20 @@ const KEYS = {
|
|
|
9
10
|
group: ["group"],
|
|
10
11
|
};
|
|
11
12
|
const PAGES = Object.keys(KEYS);
|
|
12
|
-
function layerPart(page, layer, phone) {
|
|
13
|
+
function layerPart(page, layer, phone, person) {
|
|
13
14
|
if (page === "layout") {
|
|
14
15
|
const look = Object.keys(layer.look ?? {}).length > 0, phoneLayout = phone && layer.phoneLayout !== undefined;
|
|
15
|
-
|
|
16
|
+
const counts = toolbarCounts(layer, { phone, ...(person && { person }) });
|
|
17
|
+
const toolbar = counts.bar || counts.words;
|
|
18
|
+
if (!look && !phoneLayout && !toolbar)
|
|
19
|
+
return null;
|
|
20
|
+
return {
|
|
21
|
+
look: {},
|
|
22
|
+
...(phone && { phoneLayout: undefined }),
|
|
23
|
+
...(toolbar && {
|
|
24
|
+
toolbar: { ...layer.toolbar, ...(counts.bar && { bar: undefined }), ...(counts.words && { words: undefined }) },
|
|
25
|
+
}),
|
|
26
|
+
};
|
|
16
27
|
}
|
|
17
28
|
if (page === "columns")
|
|
18
29
|
return Object.keys(layer.widths ?? {}).length > 0 ? { widths: {} } : null;
|
|
@@ -54,7 +65,7 @@ export function pageResets(input, saved, { cleared = false, phone = false } = {}
|
|
|
54
65
|
const change = page === "columns"
|
|
55
66
|
? columnsBack(settings.columns, cleared ? applySettingsChange(settings, columnsReset(settings, input.columns)).columns : baseline.columns)
|
|
56
67
|
: only(towards, KEYS[page]);
|
|
57
|
-
const part = layerPart(page, layer, phone);
|
|
68
|
+
const part = layerPart(page, layer, phone, input.person);
|
|
58
69
|
if (change || part)
|
|
59
70
|
out[page] = { change, layer: part };
|
|
60
71
|
}
|
|
@@ -71,6 +71,10 @@ export type ViewsPopoverProps = {
|
|
|
71
71
|
* its own input); that editor focuses its input with `preventScroll`, so the
|
|
72
72
|
* page stays where it is however the popup places itself. Default true. */
|
|
73
73
|
initialFocus?: boolean;
|
|
74
|
+
/** False moves no focus as the popup closes: what opened it hands the focus back itself (a field row's editor, to its
|
|
75
|
+
* row). Forward it to your popup's return of focus (Base UI's `finalFocus`), as `initialFocus` to its first focus.
|
|
76
|
+
* Default true: focus goes back to what opened it. */
|
|
77
|
+
finalFocus?: boolean;
|
|
74
78
|
/** Called on a press outside the popup before it closes; return false to keep it open.
|
|
75
79
|
* `event` is the pointer press, with its `target` where the press landed, also when the
|
|
76
80
|
* focus that press moves is what would close the popup: a vetoed press holds against its
|
|
@@ -724,7 +728,9 @@ export type ViewsBodyStep = {
|
|
|
724
728
|
};
|
|
725
729
|
/** Which of the sort editor's menus a function is handed (VK-1063): a rule's ⋯ (a phone's and the narrow form's: a computer's rule
|
|
726
730
|
* has × and no ⋯), its `field` the sort's key (`rules[].value`), `index` its place; or a set-aside rule's ⋯, its `field` the
|
|
727
|
-
* rule's stored `fieldKey`.
|
|
731
|
+
* rule's stored `fieldKey`. Or (VK-1065) `row`, the buttons at a rule's end (× `delete` on a computer, ⋯ `more` elsewhere and on a
|
|
732
|
+
* set-aside rule, `aside: true`); `foot`, Add sort and Clear (`add`, `clear`). A rule's `row` with `place: "bar"` (VK-1107) is its pill on
|
|
733
|
+
* the filter bar (`ListFilterBar sorts="yes"`): its × `delete`, its field and direction staying the pill's. */
|
|
728
734
|
export type ViewsSortEditorItemsContext = ({
|
|
729
735
|
menu: "rule";
|
|
730
736
|
field: string;
|
|
@@ -732,21 +738,44 @@ export type ViewsSortEditorItemsContext = ({
|
|
|
732
738
|
} | {
|
|
733
739
|
menu: "aside";
|
|
734
740
|
field: string;
|
|
741
|
+
} | {
|
|
742
|
+
menu: "row";
|
|
743
|
+
field: string;
|
|
744
|
+
index: number;
|
|
745
|
+
place?: "bar";
|
|
746
|
+
} | {
|
|
747
|
+
menu: "row";
|
|
748
|
+
field: string;
|
|
749
|
+
aside: true;
|
|
750
|
+
} | {
|
|
751
|
+
menu: "foot";
|
|
735
752
|
}) & {
|
|
736
753
|
form: "computer" | "phone";
|
|
737
754
|
};
|
|
738
755
|
/** Which of the filter editor's menus (VK-1063): a rule's ⋮ or a set-aside rule's, named by its field (`field`, the rule's
|
|
739
756
|
* `fieldKey`; its `part`; the `relation` it stands under), or a group's actions; each by its `path` in the filter the body is handed
|
|
740
|
-
* (`ViewsFilterBodyProps.filter`): its indices through `items` and a relation rule's `where.items`, the whole filter `[]`.
|
|
757
|
+
* (`ViewsFilterBodyProps.filter`): its indices through `items` and a relation rule's `where.items`, the whole filter `[]`. Or (VK-1065)
|
|
758
|
+
* `row`, a rule's ⋮ (`more`), named as `rule` is, `aside: true` on a set-aside rule; `foot`, a foot's buttons by its group's `path`
|
|
759
|
+
* (`[]` the filter's own): `add`, `clear`, `delete`, `more`. */
|
|
741
760
|
export type ViewsFilterEditorItemsContext = ({
|
|
742
761
|
menu: "rule" | "aside";
|
|
743
762
|
field: string;
|
|
744
763
|
part?: string;
|
|
745
764
|
relation?: string;
|
|
746
765
|
path: number[];
|
|
766
|
+
} | {
|
|
767
|
+
menu: "row";
|
|
768
|
+
field: string;
|
|
769
|
+
part?: string;
|
|
770
|
+
relation?: string;
|
|
771
|
+
path: number[];
|
|
772
|
+
aside?: true;
|
|
747
773
|
} | {
|
|
748
774
|
menu: "group";
|
|
749
775
|
path: number[];
|
|
776
|
+
} | {
|
|
777
|
+
menu: "foot";
|
|
778
|
+
path: number[];
|
|
750
779
|
}) & {
|
|
751
780
|
form: "computer" | "phone";
|
|
752
781
|
};
|
|
@@ -812,6 +841,10 @@ export type ViewsSortBodyProps = {
|
|
|
812
841
|
onRulesChange: (rules: ViewsSortBodyProps["rules"][number][], setAside?: ViewsSortBodyProps["setAside"]) => void;
|
|
813
842
|
/** The job is done and what holds it closes. */
|
|
814
843
|
onDone: () => void;
|
|
844
|
+
/** What a computer's body shows with no rule and none set aside (VK-1091): nothing of its own, what opened it showing the
|
|
845
|
+
* fields instead (absent or `fields`), or that nothing sorts yet, with Add sort (`editor`). A body that ignores it draws as
|
|
846
|
+
* before. */
|
|
847
|
+
empty?: "fields" | "editor";
|
|
815
848
|
/** On a phone where the sheet's head doesn't draw them (`sheetActions: "bar"`): its ✕ (taking the rules and the
|
|
816
849
|
* set-aside sorts back to what they were as it opened) and ✓, for your body's own head. Absent on a computer, and
|
|
817
850
|
* under `head`, where the sheet holds them. */
|
|
@@ -890,6 +923,9 @@ export type ViewsFilterBodyField = {
|
|
|
890
923
|
far?: readonly ViewsFilterBodyField[];
|
|
891
924
|
/** A number field that holds whole numbers only (`isIntegerField`): your body's box takes whole numbers. Absent, any. */
|
|
892
925
|
integer?: true;
|
|
926
|
+
/** A number kept as a duration, in this unit (milliseconds unless the field says seconds): your body's box reads and writes
|
|
927
|
+
* a duration (`1m 30s`, a bare number in seconds), and a rule keeps its bound in this unit. Absent, a plain number. */
|
|
928
|
+
duration?: "ms" | "s";
|
|
893
929
|
/** A choice field's values (a status's, a select's, a person's, a record's), or a place's country's names (its `countryCode`
|
|
894
930
|
* part, VK-735), each as the Picker draws it, where ViewKit holds
|
|
895
931
|
* them as the list opens: your body may list them in the rule's value box. Absent where its values are read on demand, or the
|
|
@@ -921,6 +957,9 @@ export type ViewsFilterBodyProps = {
|
|
|
921
957
|
levels: number;
|
|
922
958
|
/** Whether the level may exclude its matches (`op: "not"`): an advanced filter's own group, not a top or a where. */
|
|
923
959
|
excludable: boolean;
|
|
960
|
+
/** What a computer's top level shows with nothing filtered (VK-1091): the fields, a pick adding its rule (absent or
|
|
961
|
+
* `fields`), or that nothing filters yet, with Add filter (`editor`). A body that ignores it draws as before. */
|
|
962
|
+
empty?: "fields" | "editor";
|
|
924
963
|
/** Where the level is a relation rule's where, edited in place (wrapping it in a group would pass 3 levels): the
|
|
925
964
|
* relation's field key, its words and its quantifier. Its rules name its far fields, and a quantifier handed back with
|
|
926
965
|
* the level is written to it. `gone`, present only where the list no longer lists the relation, is why, in words
|
|
@@ -947,13 +986,17 @@ export type ViewsFilterBodyProps = {
|
|
|
947
986
|
* it was as the sheet opened) and ✓, for your body's own head. Absent on a computer, and under `head`, where the
|
|
948
987
|
* sheet holds them. */
|
|
949
988
|
actions?: ViewsSheetActions;
|
|
950
|
-
/** ViewKit's own words for a rule, as the filter bar words it: its field, its way and its value (null with none yet)
|
|
951
|
-
*
|
|
989
|
+
/** ViewKit's own words for a rule, as the filter bar words it: its field, its way and its value (null with none yet), and
|
|
990
|
+
* why it filters nothing where ViewKit refuses it (`refused`). For a rule your body has no words of its own for (set
|
|
991
|
+
* aside, a way you don't draw), and for every rule's `refused`. `relation`: the relation's field key, for a
|
|
952
992
|
* far rule. */
|
|
953
993
|
ruleWords?: (rule: FilterRule, relation?: string) => {
|
|
954
994
|
field: string;
|
|
955
995
|
way: string;
|
|
956
996
|
value: string | null;
|
|
997
|
+
/** Why the rule filters nothing though whole, in words, for under its value (a number compared across several
|
|
998
|
+
* currencies). Absent for most rules. */
|
|
999
|
+
refused?: string;
|
|
957
1000
|
};
|
|
958
1001
|
/** On a phone: tell the sheet you stand on a step of your own (a box's list, Add filter's fields), and hand null once you
|
|
959
1002
|
* are back. The sheet's head shows the step's title, Back in ✕'s place and ✓; Escape calls onBack; a swipe still closes
|
package/views/dist/react.d.ts
CHANGED
|
@@ -11,5 +11,5 @@ export type { ViewsIconProps, ViewsIcons } from "./provider/icons.js";
|
|
|
11
11
|
export { NOOP_PORTS, NOOP_TOAST } from "./provider/ports.js";
|
|
12
12
|
export type { ViewsClipboardPort, ViewsConfirmPort, ViewsConfirmRequest, ViewsHapticsPort, ViewsPorts, ViewsPrefsPort, ViewsResolvedPorts, ViewsToastPort, } from "./provider/ports.js";
|
|
13
13
|
export { DEFAULT_VIEWS_ATOMS } from "./atoms/defaults.js";
|
|
14
|
-
export type { ViewsAtoms, ViewsAvatarProps, ViewsCommandMenuProps, ViewsRowMenuItem, ViewsRowMenuProps, ViewsListProps, ViewsRelationLinkProps, ViewsRelationRolesProps, ViewsRelationChipProps, ViewsRelationChipLinkProps, ViewsCellMoreProps, ViewsLoadingProps, ViewsLoadMoreProps, ViewsPlatformMarkProps, ViewsRowContentProps, ViewsRowProps, ViewsSelectionSheetProps, ViewsStatusBadgeProps, ViewsStatusOption, ViewsStatusPlace, ViewsStatusMarkerProps, ViewsTagProps, ViewsTickBoxProps, ViewsChoiceRowProps, ViewsCheckRowProps, ViewsRadioRowProps, ViewsDirectionButtonProps, ViewsMenuRowProps, ViewsToggleRowProps, ViewsPanelSearchProps, ViewsPillProps, ViewsRangeCalendarProps, ViewsToolbarButtonProps, ViewsToolbarButtonPart, ViewsFramePart, } from "./atoms/types.js";
|
|
14
|
+
export type { ViewsAtoms, ViewsAvatarProps, ViewsCommandMenuProps, ViewsRowMenuItem, ViewsRowMenuProps, ViewsListProps, ViewsRelationLinkProps, ViewsRelationRolesProps, ViewsRelationChipProps, ViewsRelationChipLinkProps, ViewsCellMoreProps, ViewsHeaderGlyphProps, ViewsHeaderResizeHandleProps, ViewsHeaderSortMarkProps, ViewsLoadingProps, ViewsLoadMoreProps, ViewsPlatformMarkProps, ViewsRowContentProps, ViewsRowProps, ViewsSelectionSheetProps, ViewsStatusBadgeProps, ViewsStatusOption, ViewsStatusPlace, ViewsStatusMarkerProps, ViewsTagProps, ViewsTickBoxProps, ViewsChoiceRowProps, ViewsCheckRowProps, ViewsRadioRowProps, ViewsDirectionButtonProps, ViewsMenuRowProps, ViewsToggleRowProps, ViewsPanelSearchProps, ViewsPillProps, ViewsRangeCalendarProps, ViewsToolbarButtonProps, ViewsToolbarButtonPart, ViewsFramePart, } from "./atoms/types.js";
|
|
15
15
|
export type { ComponentName, PortName, ViewsIconName, ViewsMessage, ViewsMessageResolver } from "./contract.js";
|