viewkitjs 0.35.0 → 0.37.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 +112 -0
- package/MIGRATION.md +7 -0
- package/package.json +1 -1
- package/views/dist/atoms/types.d.ts +32 -4
- package/views/dist/contract.d.ts +32 -9
- package/views/dist/contract.js +35 -1
- package/views/dist/controls/avatar/avatar.d.ts +3 -1
- package/views/dist/controls/avatar/avatar.js +2 -2
- package/views/dist/controls/button/own-look-moved.d.ts +11 -0
- package/views/dist/controls/button/own-look-moved.js +3 -0
- package/views/dist/controls/compound-editor/map-parts-body.js +2 -0
- package/views/dist/controls/compound-editor/name-parts.js +1 -1
- package/views/dist/controls/compound-editor/place-parts.js +1 -1
- package/views/dist/controls/compound-editor/range-parts.js +1 -1
- package/views/dist/controls/compound-editor/words.d.ts +3 -0
- package/views/dist/controls/compound-editor/words.js +2 -0
- package/views/dist/controls/customize/customize.d.ts +10 -3
- package/views/dist/controls/customize/customize.js +147 -63
- package/views/dist/controls/customize/items.d.ts +49 -0
- package/views/dist/controls/customize/items.js +104 -0
- package/views/dist/controls/customize/map-customize-body.js +7 -4
- package/views/dist/controls/customize/words.d.ts +2 -0
- package/views/dist/controls/customize/words.js +1 -0
- package/views/dist/controls/date-editor/date-behaviour.d.ts +80 -0
- package/views/dist/controls/date-editor/date-behaviour.js +187 -0
- package/views/dist/controls/date-editor/date-editor.d.ts +3 -2
- package/views/dist/controls/date-editor/date-editor.js +29 -166
- package/views/dist/controls/field/field.d.ts +3 -2
- package/views/dist/controls/field/field.js +7 -2
- package/views/dist/controls/field/looks.d.ts +1 -1
- package/views/dist/controls/field/looks.js +5 -4
- package/views/dist/controls/field.css +4 -0
- package/views/dist/controls/filter-editor/block.js +5 -2
- package/views/dist/controls/filter-editor/filter-editor.d.ts +14 -1
- package/views/dist/controls/filter-editor/filter-editor.js +21 -13
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +3 -2
- package/views/dist/controls/filter-editor/map-filter-body.js +16 -2
- package/views/dist/controls/filter-editor/map-rules.d.ts +9 -2
- package/views/dist/controls/filter-editor/map-rules.js +18 -13
- package/views/dist/controls/filter-editor/parts.d.ts +2 -0
- package/views/dist/controls/filter-editor/parts.js +13 -12
- package/views/dist/controls/filter-editor/rules.d.ts +4 -4
- package/views/dist/controls/filter-editor/rules.js +6 -3
- package/views/dist/controls/filter-editor/words.d.ts +2 -0
- package/views/dist/controls/filter-editor/words.js +1 -0
- package/views/dist/controls/group-editor/group-editor.d.ts +3 -0
- package/views/dist/controls/group-editor/group-editor.js +21 -15
- package/views/dist/controls/group-editor/map-group-body.js +1 -0
- package/views/dist/controls/index.d.ts +4 -2
- package/views/dist/controls/index.js +3 -1
- package/views/dist/controls/inline-input.css +9 -0
- package/views/dist/controls/internal/kit-words.d.ts +11 -0
- package/views/dist/controls/internal/kit-words.js +7 -0
- package/views/dist/controls/internal/map-panel-controls.d.ts +4 -1
- package/views/dist/controls/internal/map-panel-controls.js +14 -1
- package/views/dist/controls/internal/menu-items.d.ts +9 -0
- package/views/dist/controls/internal/menu-items.js +97 -0
- package/views/dist/controls/internal/panel-controls.js +1 -1
- package/views/dist/controls/internal/phone.d.ts +1 -1
- package/views/dist/controls/internal/phone.js +3 -2
- package/views/dist/controls/list/tokens.d.ts +1 -1
- package/views/dist/controls/list/tokens.js +1 -1
- package/views/dist/controls/list.css +5 -2
- package/views/dist/controls/menu/menu.d.ts +1 -1
- package/views/dist/controls/menu/menu.js +1 -1
- package/views/dist/controls/menu-list/menu-list.js +3 -2
- package/views/dist/controls/menu.css +4 -4
- package/views/dist/controls/number-editor/map-number-body.js +2 -0
- package/views/dist/controls/number-editor/number-editor.js +1 -1
- package/views/dist/controls/number-editor/words.d.ts +3 -0
- package/views/dist/controls/number-editor/words.js +2 -0
- package/views/dist/controls/pane.css +1 -1
- package/views/dist/controls/picker/fields-frame.d.ts +5 -0
- package/views/dist/controls/picker/fields-frame.js +30 -0
- package/views/dist/controls/picker/map-fields-body.js +3 -26
- package/views/dist/controls/picker/map-picker.d.ts +2 -1
- package/views/dist/controls/picker/map-picker.js +4 -2
- package/views/dist/controls/picker/picker.js +9 -2
- package/views/dist/controls/picker/rows.d.ts +3 -1
- package/views/dist/controls/picker.css +7 -3
- package/views/dist/controls/popover/looks.d.ts +1 -1
- package/views/dist/controls/popover/looks.js +5 -0
- package/views/dist/controls/popover/tokens.d.ts +13 -1
- package/views/dist/controls/popover/tokens.js +4 -1
- package/views/dist/controls/popover.css +59 -8
- package/views/dist/controls/select/map-select.d.ts +1 -1
- package/views/dist/controls/select/map-select.js +4 -1
- package/views/dist/controls/select/select.d.ts +2 -0
- package/views/dist/controls/select/select.js +4 -2
- package/views/dist/controls/sheet/bottom-sheet.d.ts +6 -1
- package/views/dist/controls/sheet/bottom-sheet.js +3 -3
- package/views/dist/controls/sort-editor/map-sort-body.js +1 -0
- package/views/dist/controls/sort-editor/sort-editor.d.ts +3 -1
- package/views/dist/controls/sort-editor/sort-editor.js +6 -4
- package/views/dist/controls/sort-editor.css +4 -2
- package/views/dist/controls/tag/tag.js +4 -2
- package/views/dist/controls/text-editor/map-text-body.js +4 -1
- package/views/dist/controls/text-editor/text-editor.js +2 -2
- package/views/dist/controls/text-editor/words.d.ts +3 -0
- package/views/dist/controls/text-editor/words.js +1 -1
- package/views/dist/controls/text-editor.css +6 -0
- package/views/dist/controls/toolbar/toolbar.d.ts +12 -4
- package/views/dist/controls/toolbar/toolbar.js +7 -2
- package/views/dist/controls/toolbar-button/atom-toolbar-button.js +1 -1
- package/views/dist/controls/toolbar.css +5 -0
- package/views/dist/controls/tooltip/tokens.d.ts +1 -1
- package/views/dist/controls/tooltip/tokens.js +1 -1
- package/views/dist/controls/tooltip.css +5 -3
- package/views/dist/controls/values-editor.css +20 -5
- package/views/dist/controls/views-list/map-views-list-body.js +9 -1
- package/views/dist/controls/views-list/rules.d.ts +1 -0
- package/views/dist/controls/views-list/rules.js +2 -2
- package/views/dist/controls/views-list/view-menu.js +2 -2
- package/views/dist/controls/views-list/words.d.ts +4 -0
- package/views/dist/controls/views-list/words.js +2 -1
- package/views/dist/display/entity-chip.d.ts +7 -1
- package/views/dist/display/entity-chip.js +2 -1
- package/views/dist/display/option-badges.d.ts +3 -2
- package/views/dist/display/option-badges.js +2 -2
- package/views/dist/field-row/FieldRow.js +12 -8
- package/views/dist/grid/chrome/GridAddColumn.d.ts +7 -2
- package/views/dist/grid/chrome/GridAddColumn.js +5 -4
- package/views/dist/grid/chrome/GridCellEditors.d.ts +4 -1
- package/views/dist/grid/chrome/GridCellEditors.js +3 -2
- package/views/dist/grid/chrome/GridCellOutline.d.ts +3 -5
- package/views/dist/grid/chrome/GridCellOutline.js +3 -5
- package/views/dist/grid/chrome/GridChipsEditor.js +1 -1
- package/views/dist/grid/chrome/GridDateEditor.d.ts +1 -1
- package/views/dist/grid/chrome/GridDateEditor.js +1 -1
- package/views/dist/grid/chrome/GridHeader.js +3 -1
- package/views/dist/grid/chrome/GridLongTextEditor.d.ts +1 -1
- package/views/dist/grid/chrome/GridLongTextEditor.js +8 -5
- package/views/dist/grid/chrome/GridNameEditor.d.ts +1 -1
- package/views/dist/grid/chrome/GridNameEditor.js +1 -1
- package/views/dist/grid/chrome/GridNumberEditor.d.ts +1 -1
- package/views/dist/grid/chrome/GridNumberEditor.js +2 -2
- package/views/dist/grid/chrome/GridPlaceEditor.d.ts +1 -1
- package/views/dist/grid/chrome/GridPlaceEditor.js +1 -1
- package/views/dist/grid/chrome/GridRangeEditor.d.ts +2 -2
- package/views/dist/grid/chrome/GridRangeEditor.js +1 -1
- package/views/dist/grid/chrome/GridRelationEditor.js +2 -2
- package/views/dist/grid/chrome/GridRow.js +7 -1
- package/views/dist/grid/chrome/GridRowCells.js +6 -5
- package/views/dist/grid/chrome/GridSelectEditor.js +1 -1
- package/views/dist/grid/chrome/GridTable.d.ts +2 -1
- package/views/dist/grid/chrome/GridTable.js +7 -2
- package/views/dist/grid/chrome/GridTableSurface.js +2 -1
- package/views/dist/grid/chrome/GridTextEditor.d.ts +1 -1
- package/views/dist/grid/chrome/GridTextEditor.js +2 -2
- package/views/dist/grid/chrome/GridValueListEditor.d.ts +1 -1
- package/views/dist/grid/chrome/GridValueListEditor.js +1 -1
- package/views/dist/grid/chrome/grid-body-place.d.ts +7 -2
- package/views/dist/grid/chrome/grid-body-place.js +8 -4
- package/views/dist/grid/chrome/grid-cell-classes.js +2 -2
- package/views/dist/grid/chrome/grid-edit-session.d.ts +4 -0
- package/views/dist/grid/chrome/grid-edit-session.js +10 -1
- package/views/dist/grid/chrome/grid-editor-layer.d.ts +10 -0
- package/views/dist/grid/chrome/grid-editor-layer.js +1 -0
- package/views/dist/grid/chrome/grid-fitted-box.d.ts +9 -6
- package/views/dist/grid/chrome/grid-fitted-box.js +15 -7
- package/views/dist/grid/chrome/grid-hover.d.ts +3 -3
- package/views/dist/grid/chrome/grid-hover.js +2 -3
- package/views/dist/grid/chrome/grid-row-props.d.ts +6 -2
- package/views/dist/grid/chrome/grid-styles.d.ts +1 -5
- package/views/dist/grid/chrome/grid-styles.js +0 -1
- package/views/dist/grid/chrome/grid-table-props.d.ts +6 -2
- package/views/dist/grid/chrome/useGridKeyboard.d.ts +0 -1
- package/views/dist/grid/chrome/useGridKeyboard.js +2 -10
- package/views/dist/grid/chrome/useGridScaleStyles.d.ts +9 -1
- package/views/dist/grid/chrome/useGridScaleStyles.js +1 -4
- package/views/dist/grid/chrome/useGridTableInteractionModel.d.ts +3 -1
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +24 -1
- package/views/dist/grid/core/useGridEditing.d.ts +3 -0
- package/views/dist/grid/core/useGridEditing.js +2 -0
- package/views/dist/grid/grid-format-props.d.ts +1 -1
- package/views/dist/grid/grid-format-props.js +18 -5
- package/views/dist/grid/grid.css +9 -20
- package/views/dist/grid/useGridTablePrefs.d.ts +1 -1
- package/views/dist/grid/useGridTableSettings.d.ts +1 -1
- package/views/dist/internal/screen-forms.d.ts +11 -0
- package/views/dist/internal/screen-forms.js +31 -0
- package/views/dist/list/list.js +4 -3
- package/views/dist/list/menu.d.ts +5 -4
- package/views/dist/list/parts.d.ts +8 -2
- package/views/dist/list/parts.js +31 -7
- package/views/dist/list/toolbar.js +11 -5
- package/views/dist/looks/index.d.ts +1 -0
- package/views/dist/looks/index.js +1 -0
- package/views/dist/panels/customize-body.d.ts +1 -1
- package/views/dist/panels/customize-body.js +8 -1
- package/views/dist/panels/model.d.ts +5 -0
- package/views/dist/panels/react/customize-body.js +11 -2
- package/views/dist/panels/react/customize.d.ts +3 -0
- package/views/dist/panels/react/filter/FilterFieldList.d.ts +3 -1
- package/views/dist/panels/react/filter/FilterFieldList.js +2 -2
- package/views/dist/panels/react/filter/filter-body.js +3 -1
- package/views/dist/panels/react/filter/filter-part-body.d.ts +3 -1
- package/views/dist/panels/react/filter/filter-part-body.js +2 -2
- package/views/dist/panels/react/popover.d.ts +3 -1
- package/views/dist/panels/react/popover.js +2 -2
- package/views/dist/panels/react/sort/SortEditor.js +3 -1
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +15 -4
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +12 -1
- package/views/dist/panels/react/toolbar/Toolbar.js +5 -1
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +5 -3
- package/views/dist/panels/react/toolbar/ToolbarButton.js +3 -2
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +1 -3
- package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +4 -1
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.d.ts +1 -1
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSave.d.ts +3 -1
- package/views/dist/panels/react/toolbar/ToolbarSave.js +28 -20
- package/views/dist/panels/react/toolbar/ToolbarSearch.js +1 -1
- package/views/dist/panels/react/toolbar/context.d.ts +3 -2
- package/views/dist/panels/react/toolbar/editor-menus.d.ts +8 -0
- package/views/dist/panels/react/toolbar/editor-menus.js +3 -0
- package/views/dist/panels/react/views-row/FoldingViewRow.js +26 -11
- package/views/dist/panels/react/views-row/HScrollRow.d.ts +4 -2
- package/views/dist/panels/react/views-row/HScrollRow.js +6 -2
- package/views/dist/panels/react/views-row/ViewAxes.js +6 -1
- package/views/dist/panels/react/views-row/ViewPicker.js +7 -10
- package/views/dist/panels/react/views-row/more-views.d.ts +2 -0
- package/views/dist/panels/react/views-row/more-views.js +3 -0
- package/views/dist/panels/react/views-row/new-view.d.ts +11 -0
- package/views/dist/panels/react/views-row/new-view.js +21 -0
- package/views/dist/panels/react.d.ts +1 -1
- package/views/dist/panels/toolbar/model.d.ts +2 -2
- package/views/dist/provider/components.d.ts +88 -8
- package/views/dist/provider/desktop.d.ts +2 -1
- package/views/dist/provider/desktop.js +5 -2
- package/views/dist/react.d.ts +1 -1
- package/views/dist/styles.css +198 -84
- package/views/dist/styles.unlayered.css +198 -84
- package/views/docs/contract.md +87 -32
- package/views/docs/controls/list.md +2 -0
- package/views/docs/controls/menu.md +2 -0
- package/views/docs/controls/picker.md +2 -0
- package/views/docs/controls/popover.md +7 -0
- package/views/docs/controls/tooltip.md +2 -0
- package/views/docs/guides/atoms.md +11 -10
- package/views/docs/guides/the-grid.md +7 -5
- package/views/docs/guides/the-provider.md +2 -2
- package/views/docs/reference/controls.md +24 -18
- package/views/docs/reference/display.md +1 -1
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +4 -4
- package/views/docs/reference/list.md +30 -11
- package/views/docs/reference/looks.md +4 -1
- package/views/docs/reference/panels-react.md +7 -6
- package/views/docs/reference/panels.md +2 -2
- package/views/docs/reference/react.md +22 -10
- package/views/docs/reference/views.md +2 -2
- package/views/docs/reshaping.md +2 -2
- package/views/skills/views/SKILL.md +1 -1
package/views/dist/list/parts.js
CHANGED
|
@@ -3,21 +3,21 @@ const kitPhone = (ctx) => ctx.arrangement === "kit" && ctx.phone;
|
|
|
3
3
|
const lineOf = (part) => ((part.line ?? 1) === 2 ? "bar" : "row");
|
|
4
4
|
export function placesOf(parts, ctx) {
|
|
5
5
|
const byKey = new Map(parts.map((part) => [part.key, part]));
|
|
6
|
-
const
|
|
7
|
-
key
|
|
6
|
+
const placeOne = (part, line) => Object.keys(part.apart ?? { [part.key]: null }).map((key) => ({
|
|
7
|
+
key,
|
|
8
8
|
line,
|
|
9
9
|
side: part.side ?? "start",
|
|
10
10
|
words: part.words ?? "both",
|
|
11
|
-
});
|
|
11
|
+
}));
|
|
12
12
|
if (kitPhone(ctx)) {
|
|
13
13
|
const [line] = arrangeToolbar(parts, "phone", { fold: true });
|
|
14
14
|
const slots = line ? [...line.start, ...line.end] : [];
|
|
15
15
|
return slots.flatMap((slot) => {
|
|
16
16
|
const part = byKey.get(slot.key);
|
|
17
|
-
return part ?
|
|
17
|
+
return part ? placeOne(part, part.key === "new" && part.foot !== false ? "foot" : "row") : [];
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
const drawn = (line, side) => parts.filter((part) => lineOf(part) === line && (part.side ?? "start") === side).
|
|
20
|
+
const drawn = (line, side) => parts.filter((part) => lineOf(part) === line && (part.side ?? "start") === side).flatMap((part) => placeOne(part, line));
|
|
21
21
|
return [...drawn("row", "start"), ...drawn("row", "end"), ...drawn("bar", "start"), ...drawn("bar", "end")];
|
|
22
22
|
}
|
|
23
23
|
const samePlaces = (a, b) => a.length === b.length &&
|
|
@@ -34,10 +34,17 @@ export function applyParts(parts, place, ctx) {
|
|
|
34
34
|
const back = place(given, ctx);
|
|
35
35
|
if (samePlaces(back, given))
|
|
36
36
|
return parts;
|
|
37
|
-
const byKey = new Map(
|
|
37
|
+
const byKey = new Map();
|
|
38
|
+
for (const part of parts) {
|
|
39
|
+
if (!part.apart)
|
|
40
|
+
byKey.set(part.key, part);
|
|
41
|
+
else
|
|
42
|
+
for (const [key, node] of Object.entries(part.apart))
|
|
43
|
+
byKey.set(key, { ...withoutHalves(part), key, node });
|
|
44
|
+
}
|
|
38
45
|
const seen = new Set();
|
|
39
46
|
const one = kitPhone(ctx);
|
|
40
|
-
|
|
47
|
+
const drawn = back.flatMap((at) => {
|
|
41
48
|
if (seen.has(at.key))
|
|
42
49
|
return [];
|
|
43
50
|
seen.add(at.key);
|
|
@@ -56,6 +63,8 @@ export function applyParts(parts, place, ctx) {
|
|
|
56
63
|
next.words = at.words;
|
|
57
64
|
if (at.words === "both" && own === "icon" && !part.shed)
|
|
58
65
|
next.shed = true;
|
|
66
|
+
if (at.words === "word")
|
|
67
|
+
delete next.shed;
|
|
59
68
|
if (one && part.key === "new") {
|
|
60
69
|
if (at.line === "foot")
|
|
61
70
|
delete next.foot;
|
|
@@ -64,4 +73,19 @@ export function applyParts(parts, place, ctx) {
|
|
|
64
73
|
}
|
|
65
74
|
return [next];
|
|
66
75
|
});
|
|
76
|
+
return parts.reduce((list, part) => (part.apart ? rejoined(list, part) : list), drawn);
|
|
77
|
+
}
|
|
78
|
+
const withoutHalves = ({ apart: _apart, ...part }) => part;
|
|
79
|
+
function rejoined(drawn, whole) {
|
|
80
|
+
const halves = Object.keys(whole.apart ?? {});
|
|
81
|
+
const at = drawn.findIndex((part) => part.key === halves[0]);
|
|
82
|
+
if (at < 0)
|
|
83
|
+
return drawn;
|
|
84
|
+
const run = drawn.slice(at, at + halves.length);
|
|
85
|
+
const together = run.length === halves.length &&
|
|
86
|
+
run.every((part, i) => part.key === halves[i] && (part.line ?? 1) === (run[0].line ?? 1) && (part.side ?? "start") === (run[0].side ?? "start"));
|
|
87
|
+
if (!together)
|
|
88
|
+
return drawn;
|
|
89
|
+
const { key: _key, node: _node, ...first } = run[0];
|
|
90
|
+
return [...drawn.slice(0, at), { ...withoutHalves(whole), ...first, key: whole.key, node: whole.node }, ...drawn.slice(at + halves.length)];
|
|
67
91
|
}
|
|
@@ -19,6 +19,7 @@ import { ToolbarFilterAdd } from "../panels/react/toolbar/ToolbarFilterAdd.js";
|
|
|
19
19
|
import { ToolbarFilters, foldableFilters } from "../panels/react/toolbar/ToolbarFilters.js";
|
|
20
20
|
import { ToolbarNew } from "../panels/react/toolbar/ToolbarNew.js";
|
|
21
21
|
import { ToolbarOptions } from "../panels/react/toolbar/ToolbarOptions.js";
|
|
22
|
+
import { EditorMenus } from "../panels/react/toolbar/editor-menus.js";
|
|
22
23
|
import { PaneBox, PaneHost } from "../panels/react/toolbar/pane-host.js";
|
|
23
24
|
import { ToolbarQuickFilters } from "../panels/react/toolbar/ToolbarQuickFilters.js";
|
|
24
25
|
import { ToolbarSave } from "../panels/react/toolbar/ToolbarSave.js";
|
|
@@ -27,12 +28,15 @@ import { ToolbarSort } from "../panels/react/toolbar/ToolbarSort.js";
|
|
|
27
28
|
import { ToolbarSortPill } from "../panels/react/toolbar/ToolbarSortPill.js";
|
|
28
29
|
import { ToolbarAdvancedFilters } from "../panels/react/toolbar/ToolbarAdvancedFilters.js";
|
|
29
30
|
import { ToolbarViews } from "../panels/react/toolbar/ToolbarViews.js";
|
|
31
|
+
import { MoreViews } from "../panels/react/views-row/more-views.js";
|
|
32
|
+
import { ScreenForms } from "../internal/screen-forms.js";
|
|
30
33
|
import { applyParts } from "./parts.js";
|
|
31
34
|
import { useList, useListPanel, useListStore } from "./root-base.js";
|
|
32
35
|
import { useListViewsAxis } from "./views-axis.js";
|
|
33
36
|
import { EMPTY_LAYER, layerHolds } from "./layer.js";
|
|
34
37
|
export function ListToolbar(props) {
|
|
35
|
-
|
|
38
|
+
const { sortEditor: sort, filterEditor: filter, groupEditor: group } = props.menus ?? {};
|
|
39
|
+
return (_jsx(PaneBox.Provider, { value: props.paneBox ?? null, children: _jsx(EditorMenus.Provider, { value: { ...(sort && { sort }), ...(filter && { filter }), ...(group && { group }) }, children: _jsx(MoreViews.Provider, { value: props.moreViews ?? null, children: _jsx(ScreenForms, { off: props.phone !== undefined, children: _jsx(ToolbarOfList, { ...props }) }) }) }) }));
|
|
36
40
|
}
|
|
37
41
|
function ToolbarOfList(props) {
|
|
38
42
|
const { views: viewsHanded, viewsLayout, onAdd, addItems, addLabel, fieldEditor, searchPlaceholder, searching, hosts, narrow, className, viewName, onRenameView, onCopyLink, onExport, exportCount, menus, toolbarParts, overflow, } = props;
|
|
@@ -180,6 +184,8 @@ function ToolbarOfList(props) {
|
|
|
180
184
|
useLayoutEffect(() => store.patch({ panels: { barShown: barPublished, footHere: footPublished } }), [store, barPublished, footPublished]);
|
|
181
185
|
if (kit) {
|
|
182
186
|
const clearable = !view && (layered || settingsCleared(input, "options", { phone }) !== null);
|
|
187
|
+
const saveOf = (only) => (_jsx(ToolbarSave, { view: view, layered: layered, onClear: clearable ? resetAll : undefined, ...(only && { only }) }));
|
|
188
|
+
const saveParts = { node: saveOf(), apart: { clear: saveOf("clear"), save: saveOf("save") } };
|
|
183
189
|
const tabs = !phone && viewAxes?.length === 1 ? Math.max(0, viewAxes[0].options.length - 1) : 0;
|
|
184
190
|
const Sort = icons.sort;
|
|
185
191
|
const Filter = icons.filter;
|
|
@@ -235,7 +241,7 @@ function ToolbarOfList(props) {
|
|
|
235
241
|
icon: _jsx(Edit, { className: "h-4 w-4" }),
|
|
236
242
|
onSelect: () => options.onOpenChange(true),
|
|
237
243
|
},
|
|
238
|
-
node: (_jsx(ToolbarOptions, { ...inputs, view: view, ...(layered && { layered }), viewFoot: !footHere ? "none" : view ? undefined : "kit", footClear: footHere && clearable ? resetAll : undefined, resets: resets, fieldEditor: fieldEditor, onClear: resetAll, open: options.open, onOpenChange: options.onOpenChange, page: options.page, onPageChange: options.onPageChange, host: optionsHost, ...customizeOwn })),
|
|
244
|
+
node: (_jsx(ToolbarOptions, { ...inputs, view: view, ...(layered && { layered }), viewFoot: !footHere ? "none" : view ? undefined : "kit", footClear: footHere && clearable ? resetAll : undefined, resets: resets, customizeItems: menus?.customize, fieldEditor: fieldEditor, onClear: resetAll, open: options.open, onOpenChange: options.onOpenChange, page: options.page, onPageChange: options.onPageChange, host: optionsHost, ...customizeOwn })),
|
|
239
245
|
},
|
|
240
246
|
...(quickNode
|
|
241
247
|
? [
|
|
@@ -275,7 +281,7 @@ function ToolbarOfList(props) {
|
|
|
275
281
|
key: "save",
|
|
276
282
|
line: 2,
|
|
277
283
|
side: "end",
|
|
278
|
-
|
|
284
|
+
...saveParts,
|
|
279
285
|
},
|
|
280
286
|
]
|
|
281
287
|
: []),
|
|
@@ -332,7 +338,7 @@ function ToolbarOfList(props) {
|
|
|
332
338
|
key: "save",
|
|
333
339
|
line: 2,
|
|
334
340
|
side: "end",
|
|
335
|
-
|
|
341
|
+
...saveParts,
|
|
336
342
|
},
|
|
337
343
|
]
|
|
338
344
|
: [];
|
|
@@ -394,7 +400,7 @@ function ToolbarOfList(props) {
|
|
|
394
400
|
{
|
|
395
401
|
key: "options",
|
|
396
402
|
side: "end",
|
|
397
|
-
node: (_jsx(ToolbarOptions, { ...inputs, view: view, ...(layered && { layered }), resets: resets, fieldEditor: fieldEditor, onClear: resetAll, open: options.open, onOpenChange: options.onOpenChange, page: options.page, onPageChange: options.onPageChange, host: optionsHost, ...customizeOwn })),
|
|
403
|
+
node: (_jsx(ToolbarOptions, { ...inputs, view: view, ...(layered && { layered }), resets: resets, customizeItems: menus?.customize, fieldEditor: fieldEditor, onClear: resetAll, open: options.open, onOpenChange: options.onOpenChange, page: options.page, onPageChange: options.onPageChange, host: optionsHost, ...customizeOwn })),
|
|
398
404
|
},
|
|
399
405
|
{ key: "new", side: "end", node: _jsx(ToolbarNew, { onAdd: onAdd, items: newItems, label: addLabel }) },
|
|
400
406
|
];
|
|
@@ -6,6 +6,7 @@ export { lookAttrs, lookPicks, lookWorn, lookWornOf, type Look, type LookDevice,
|
|
|
6
6
|
export { LOOKS } from "./pieces.js";
|
|
7
7
|
export { GRID_LOOKS, GRID_LOOK_READ, gridLookProps, gridLookWorn, gridLookWornOf, type GridLookOptionId, type GridLookProps, type GridLookWorn, } from "../grid/looks.js";
|
|
8
8
|
export { BUTTON_LOOKS, type ButtonLookOptionId } from "../controls/button/looks.js";
|
|
9
|
+
export { buttonOwnAttrs, buttonOwnOptions, type ButtonOwnLook } from "../controls/button/own-look.js";
|
|
9
10
|
export { SPINNER_LOOKS, type SpinnerLookOptionId } from "../controls/spinner/looks.js";
|
|
10
11
|
export { KBD_LOOKS, type KbdLookOptionId } from "../controls/kbd/looks.js";
|
|
11
12
|
export { TOOLTIP_LOOKS, type TooltipLookOptionId } from "../controls/tooltip/looks.js";
|
|
@@ -2,6 +2,7 @@ export { lookAttrs, lookPicks, lookWorn, lookWornOf, } from "./looks.js";
|
|
|
2
2
|
export { LOOKS } from "./pieces.js";
|
|
3
3
|
export { GRID_LOOKS, GRID_LOOK_READ, gridLookProps, gridLookWorn, gridLookWornOf, } from "../grid/looks.js";
|
|
4
4
|
export { BUTTON_LOOKS } from "../controls/button/looks.js";
|
|
5
|
+
export { buttonOwnAttrs, buttonOwnOptions } from "../controls/button/own-look.js";
|
|
5
6
|
export { SPINNER_LOOKS } from "../controls/spinner/looks.js";
|
|
6
7
|
export { KBD_LOOKS } from "../controls/kbd/looks.js";
|
|
7
8
|
export { TOOLTIP_LOOKS } from "../controls/tooltip/looks.js";
|
|
@@ -10,7 +10,7 @@ export declare function groupBodyValue(group: GroupConfig): ViewsGroupValue;
|
|
|
10
10
|
export declare function groupBodyWrite(group: GroupConfig, next: ViewsGroupValue): (() => void) | null;
|
|
11
11
|
/** What a `GroupBody` is handed, its chrome (`form`, `onDone`, `actions`) aside: a Customize body's `group` too. */
|
|
12
12
|
export declare function groupBodyProps(group: GroupConfig, messages: ViewsMessageResolver): Omit<ViewsGroupBodyProps, "form" | "onDone" | "actions">;
|
|
13
|
-
/** ViewKit's page as a Customize body's: a page under a section is that section's
|
|
13
|
+
/** ViewKit's page as a Customize body's: a page under a section is that section's; an app's own page `page:<key>`. */
|
|
14
14
|
export declare function customizePageOf(panel: ActivePanel): ViewsCustomizePage;
|
|
15
15
|
/** A Customize body's page as ViewKit's: its list is no page; Filter is the folded Filter page. */
|
|
16
16
|
export declare function activePanelOf(page: ViewsCustomizePage): ActivePanel;
|
|
@@ -111,6 +111,8 @@ export function customizePageOf(panel) {
|
|
|
111
111
|
case "groupSort":
|
|
112
112
|
case "groupDateBy":
|
|
113
113
|
return "group";
|
|
114
|
+
case "page":
|
|
115
|
+
return `page:${panel.key}`;
|
|
114
116
|
default:
|
|
115
117
|
return "list";
|
|
116
118
|
}
|
|
@@ -121,8 +123,13 @@ export function activePanelOf(page) {
|
|
|
121
123
|
return null;
|
|
122
124
|
case "filter":
|
|
123
125
|
return { type: "filters" };
|
|
124
|
-
|
|
126
|
+
case "layout":
|
|
127
|
+
case "columns":
|
|
128
|
+
case "sort":
|
|
129
|
+
case "group":
|
|
125
130
|
return { type: page };
|
|
131
|
+
default:
|
|
132
|
+
return page.startsWith("page:") ? { type: "page", key: page.slice("page:".length) } : null;
|
|
126
133
|
}
|
|
127
134
|
}
|
|
128
135
|
export function customizeToggleOf(toggle) {
|
|
@@ -400,6 +400,11 @@ export type ActivePanel = {
|
|
|
400
400
|
| {
|
|
401
401
|
type: "columns";
|
|
402
402
|
}
|
|
403
|
+
/** A Customize page of the app's own (`menus.customize`, VK-1062), by its row's key. */
|
|
404
|
+
| {
|
|
405
|
+
type: "page";
|
|
406
|
+
key: string;
|
|
407
|
+
}
|
|
403
408
|
/** One column's own settings, one level under the Columns list. */
|
|
404
409
|
| {
|
|
405
410
|
type: "column";
|
|
@@ -11,6 +11,7 @@ import { activePanelOf, customizeColumnsOf, customizeLayoutOf, customizePageOf,
|
|
|
11
11
|
import { filterBodyChangeFits, listedFieldsOf, takesValue } from "../settings/filter-groups.js";
|
|
12
12
|
import { sortBodyOptions } from "../sort-body-options.js";
|
|
13
13
|
import { PanelStepHold } from "./panel-step.js";
|
|
14
|
+
import { useEditorMenus } from "./toolbar/editor-menus.js";
|
|
14
15
|
import { filterBodyFields } from "./filter/filter-body.js";
|
|
15
16
|
import { FilterValueBody } from "./filter/FilterValueBody.js";
|
|
16
17
|
function customizeFilterOf(filterTree, messages) {
|
|
@@ -85,7 +86,7 @@ export function customizeFieldsOf(props, { icons, messages, conventions }) {
|
|
|
85
86
|
return items.length ? { folded: props.foldFilters ?? true, items } : undefined;
|
|
86
87
|
}
|
|
87
88
|
export function customizeBodyPropsOf(props, { components, icons, messages, conventions }) {
|
|
88
|
-
const { layout: handed, filterTree, group, toggles, activePanel, onOpenPanel, anyActive, clearAll, onClose, closeButton = true, view, viewFoot, footClear, resets, layered, fieldEditor, form, viewName, onRenameView, onCopyLink, onExport, exportCount, } = props;
|
|
89
|
+
const { layout: handed, filterTree, group, toggles, activePanel, onOpenPanel, anyActive, clearAll, onClose, closeButton = true, view, viewFoot, footClear, resets, layered, customizeItems, fieldEditor, form, viewName, onRenameView, onCopyLink, onExport, exportCount, } = props;
|
|
89
90
|
const layout = handed && (form === "phone" ? layoutOnPhone(handed) : handed);
|
|
90
91
|
const columns = layout ? customizeColumnsOf(layout, fieldEditor, messages) : undefined;
|
|
91
92
|
const fields = customizeFieldsOf(props, { icons, messages, conventions });
|
|
@@ -120,6 +121,7 @@ export function customizeBodyPropsOf(props, { components, icons, messages, conve
|
|
|
120
121
|
...(viewFoot && { foot: viewFoot }),
|
|
121
122
|
...(!view && footClear && { onClear: footClear }),
|
|
122
123
|
...(resets && { resets }),
|
|
124
|
+
...(customizeItems && { items: customizeItems }),
|
|
123
125
|
...(!view && anyActive && { clearAll }),
|
|
124
126
|
form,
|
|
125
127
|
onDone: onClose ?? (() => undefined),
|
|
@@ -137,5 +139,12 @@ export function AppCustomizeBody(props) {
|
|
|
137
139
|
const views = useViews();
|
|
138
140
|
const step = useContext(PanelStepHold);
|
|
139
141
|
const CustomizeBody = views.components.CustomizeBody;
|
|
140
|
-
|
|
142
|
+
const menus = useEditorMenus(), body = customizeBodyPropsOf(props, views);
|
|
143
|
+
const withItems = {
|
|
144
|
+
...body,
|
|
145
|
+
...(body.sort && menus.sort && { sort: { ...body.sort, items: menus.sort } }),
|
|
146
|
+
...(body.filter && menus.filter && { filter: { ...body.filter, items: menus.filter } }),
|
|
147
|
+
...(body.group && menus.group && { group: { ...body.group, items: menus.group } }),
|
|
148
|
+
};
|
|
149
|
+
return _jsx(CustomizeBody, { ...withItems, ...(props.form === "phone" && step && { onStepChange: step.onStepChange }) });
|
|
141
150
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CustomizePage } from "../toolbar/page-resets.js";
|
|
2
|
+
import type { ViewsCustomizeItems } from "../../provider/components.js";
|
|
2
3
|
import type { ActivePanel, ViewOptionInputs } from "../model.js";
|
|
3
4
|
import type { CollectionViewState } from "../view-state.js";
|
|
4
5
|
import type { PanelFieldEditor } from "./field-editor.js";
|
|
@@ -20,6 +21,8 @@ export type ViewOptionsPanelContentProps<S extends string = string, G extends st
|
|
|
20
21
|
resets?: Partial<Record<CustomizePage, () => void>>;
|
|
21
22
|
/** The reader's own layer holds something: handed to the body's `view.layered` (VK-1034). */
|
|
22
23
|
layered?: boolean;
|
|
24
|
+
/** Customize's rows as data (`menus.customize`, VK-1062): handed to the body as `items`. */
|
|
25
|
+
customizeItems?: ViewsCustomizeItems;
|
|
23
26
|
/** The body's `fields` folded behind one Filter row (list pages); off, each is a row of its own (dashboards). */
|
|
24
27
|
foldFilters?: boolean;
|
|
25
28
|
/** Dismisses the whole panel: the body's `onDone`, and on a phone its ✕. */
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import type { FilterEditorField } from "../../model.js";
|
|
3
|
-
export declare function FilterFieldList({ fields, own, relations, onPick, onDone, form, }: {
|
|
3
|
+
export declare function FilterFieldList({ fields, own, ownRelation, relations, onPick, onDone, form, }: {
|
|
4
4
|
fields: readonly FilterEditorField[];
|
|
5
5
|
/** The rule whose field this list changes: its field is ticked. */
|
|
6
6
|
own?: string;
|
|
7
|
+
/** For a rule on a related record's field, the relation `own` stands under (its key), so the far field is ticked. */
|
|
8
|
+
ownRelation?: string;
|
|
7
9
|
/** Whether a relation's far fields are offered: not where a relation rule can't stand. */
|
|
8
10
|
relations?: boolean;
|
|
9
11
|
/** A field picked: the list's own, or a relation and one of its far fields. */
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { markGlyph } from "../../../grid/chrome/column-glyph.js";
|
|
4
4
|
import { useViews } from "../../../provider/context.js";
|
|
5
|
-
export function FilterFieldList({ fields, own, relations = true, onPick, onDone, form = "computer", }) {
|
|
5
|
+
export function FilterFieldList({ fields, own, ownRelation, relations = true, onPick, onDone, form = "computer", }) {
|
|
6
6
|
const { components, icons, messages } = useViews();
|
|
7
7
|
const FieldsBody = components.FieldsBody;
|
|
8
8
|
const glyphs = { icons, AppIcon: components.AppIcon };
|
|
@@ -18,7 +18,7 @@ export function FilterFieldList({ fields, own, relations = true, onPick, onDone,
|
|
|
18
18
|
return (_jsx(FieldsBody, { purpose: "filter", label: messages({ key: "views.panels.filter" }), search: messages({ key: "views.panels.filter-search" }), fields: [
|
|
19
19
|
...listOwn.map(asData),
|
|
20
20
|
...related.map((relation) => ({ ...asData(relation), far: (relation.far ?? []).map(asData) })),
|
|
21
|
-
], ...(own !== undefined ? { own } : {}), form: form, onPick: (key, farKey) => {
|
|
21
|
+
], ...(own !== undefined ? { own } : {}), ...(own !== undefined && ownRelation !== undefined ? { ownRelation } : {}), form: form, onPick: (key, farKey) => {
|
|
22
22
|
if (farKey === undefined) {
|
|
23
23
|
const picked = listOwn.find((field) => field.key === key);
|
|
24
24
|
if (picked && picked.disabled === undefined)
|
|
@@ -4,6 +4,7 @@ import { useMemo } from "react";
|
|
|
4
4
|
import { FILTER_TREE_MAX_UI_DEPTH, isRelationRule, } from "viewkitjs/fields/query";
|
|
5
5
|
import { nodeAt, replaceAt, shownRuleCount } from "../../../filters/filter-tree.js";
|
|
6
6
|
import { useViews } from "../../../provider/context.js";
|
|
7
|
+
import { useEditorMenus } from "../toolbar/editor-menus.js";
|
|
7
8
|
import { filterBodyChangeFits, listedFieldsOf, takesValue } from "../../settings/filter-groups.js";
|
|
8
9
|
import { asideFilterWords, barFilterWords } from "../../toolbar/filter-words.js";
|
|
9
10
|
import { relationOf } from "./editor-ctx.js";
|
|
@@ -35,6 +36,7 @@ export function filterBodyFields(fields, optionsOf, relation) {
|
|
|
35
36
|
}
|
|
36
37
|
export function AppFilterBody({ ctx, level, relation, excludable, label, onDone, actions, onStepChange, }) {
|
|
37
38
|
const { components, conventions, messages } = useViews();
|
|
39
|
+
const editorMenus = useEditorMenus();
|
|
38
40
|
const FilterBody = components.FilterBody;
|
|
39
41
|
const { listed, fields: named, optionsOf } = ctx.filterTree;
|
|
40
42
|
const fields = useMemo(() => filterBodyFields(listedFieldsOf({ listed, fields: named }), optionsOf), [listed, named, optionsOf]);
|
|
@@ -82,5 +84,5 @@ export function AppFilterBody({ ctx, level, relation, excludable, label, onDone,
|
|
|
82
84
|
quantifier: relation.quantifier,
|
|
83
85
|
...(gone ? { gone: messages({ key: "views.panels.filter-relation-gone" }) } : {}),
|
|
84
86
|
}
|
|
85
|
-
: undefined, form: ctx.form, onFilterChange: onFilterChange, ruleValue: ruleValue, onDone: () => onDone?.(), actions: actions, ruleWords: ruleWords, ...(onStepChange ? { onStepChange } : {}) }));
|
|
87
|
+
: undefined, form: ctx.form, onFilterChange: onFilterChange, ruleValue: ruleValue, onDone: () => onDone?.(), actions: actions, ruleWords: ruleWords, ...(onStepChange ? { onStepChange } : {}), ...(editorMenus.filter && { items: editorMenus.filter }) }));
|
|
86
88
|
}
|
|
@@ -3,12 +3,14 @@ import type { ReactNode } from "react";
|
|
|
3
3
|
import type { ViewsPickerItem } from "../../../provider/components.js";
|
|
4
4
|
import type { FilterEditorField } from "../../model.js";
|
|
5
5
|
/** The app's `FilterPartBody` for a rule's way or value, over the holder's own writes. */
|
|
6
|
-
export declare function AppFilterPart({ part, rule, field, own, options, form, onWay, onValue, onDone, }: {
|
|
6
|
+
export declare function AppFilterPart({ part, rule, field, own, options, relation, form, onWay, onValue, onDone, }: {
|
|
7
7
|
part: "way" | "value";
|
|
8
8
|
rule: FilterRule;
|
|
9
9
|
field: FilterEditorField;
|
|
10
10
|
/** The field's values as the Picker draws them, where ViewKit holds them (`FilterTreeConfig.optionsOf`). */
|
|
11
11
|
options?: readonly ViewsPickerItem[];
|
|
12
|
+
/** For a far rule, the relation's field key it stands under (VK-626). */
|
|
13
|
+
relation?: string;
|
|
12
14
|
/** ViewKit's own value body for the rule (`<FilterValueBody filter={config} />`), null at `way`. */
|
|
13
15
|
own: ReactNode;
|
|
14
16
|
form: "computer" | "phone";
|
|
@@ -3,14 +3,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { useViews } from "../../../provider/context.js";
|
|
4
4
|
import { filterPartChangeFits, filterWaysOf } from "../../settings/filter-groups.js";
|
|
5
5
|
import { filterBodyFields } from "./filter-body.js";
|
|
6
|
-
export function AppFilterPart({ part, rule, field, own, options, form, onWay, onValue, onDone, }) {
|
|
6
|
+
export function AppFilterPart({ part, rule, field, own, options, relation, form, onWay, onValue, onDone, }) {
|
|
7
7
|
const { components, conventions, messages } = useViews();
|
|
8
8
|
const FilterPartBody = components.FilterPartBody;
|
|
9
9
|
const [shown] = filterBodyFields([field]);
|
|
10
10
|
const { far: _far, ...bodyField } = shown;
|
|
11
11
|
if (options)
|
|
12
12
|
bodyField.options = options;
|
|
13
|
-
return (_jsx(FilterPartBody, { part: part, label: messages({ key: part === "way" ? "views.panels.filter-way" : "views.panels.filter-value" }), rule: rule, field: bodyField, ways: filterWaysOf(field, conventions), own: own, form: form, onRuleChange: (next) => {
|
|
13
|
+
return (_jsx(FilterPartBody, { part: part, label: messages({ key: part === "way" ? "views.panels.filter-way" : "views.panels.filter-value" }), rule: rule, field: bodyField, ...(relation !== undefined ? { relation } : {}), ways: filterWaysOf(field, conventions), own: own, form: form, onRuleChange: (next) => {
|
|
14
14
|
const fits = filterPartChangeFits(field, rule, next);
|
|
15
15
|
if (fits === "way")
|
|
16
16
|
onWay(next.operator);
|
|
@@ -21,7 +21,9 @@ export declare function keepPanelOpenForPortals(event: {
|
|
|
21
21
|
}): void;
|
|
22
22
|
/**
|
|
23
23
|
* What the Customize popover adds on top of the app's menu popover, which is the panel itself: the width, the
|
|
24
|
-
* widen-for-a-calendar rule, the z-index that sits under an entity overlay, and its slide-from-the-right motion
|
|
24
|
+
* widen-for-a-calendar rule, the z-index that sits under an entity overlay, and its slide-from-the-right motion, as long as a popup's
|
|
25
|
+
* motion says (`--vk-popup-open-duration`, `--vk-popup-close-duration`), else `--vk-duration`. Its width
|
|
26
|
+
* is the app's `--vk-panel-w` where it declares one (VK-992), else 240, 248 on a calendar's page.
|
|
25
27
|
*/
|
|
26
28
|
export declare function viewOptionsPopoverClassName(activePanel: ActivePanel, widthClassName?: string): string;
|
|
27
29
|
/** Which page the panel is on, and the active-options count and clear it starts from. */
|
|
@@ -17,9 +17,9 @@ export function keepPanelOpenForPortals(event) {
|
|
|
17
17
|
if (source === document.body || source === document.documentElement)
|
|
18
18
|
event.preventDefault();
|
|
19
19
|
}
|
|
20
|
-
export function viewOptionsPopoverClassName(activePanel, widthClassName = "w-60") {
|
|
20
|
+
export function viewOptionsPopoverClassName(activePanel, widthClassName = "w-(--vk-panel-w,calc(var(--spacing)*60))") {
|
|
21
21
|
const isWidePanel = activePanel?.type === "dateRange" || activePanel?.type === "timeScope";
|
|
22
|
-
return cx("z-90", isWidePanel ? "w-62" : widthClassName, "data-[state=open]:slide-in-from-right-3 data-[state=closed]:slide-out-to-right-3", "data-[state=open]:zoom-in-100 data-[state=closed]:zoom-out-100", "duration-(--vk-duration,150ms)");
|
|
22
|
+
return cx("z-90", isWidePanel ? "w-(--vk-panel-w,calc(var(--spacing)*62))" : widthClassName, "data-[state=open]:slide-in-from-right-3 data-[state=closed]:slide-out-to-right-3", "data-[state=open]:zoom-in-100 data-[state=closed]:zoom-out-100", "duration-(--vk-popup-open-duration,var(--vk-duration,150ms))", "data-ending-style:duration-(--vk-popup-close-duration,var(--vk-duration,150ms)) data-[state=closed]:duration-(--vk-popup-close-duration,var(--vk-duration,150ms))");
|
|
23
23
|
}
|
|
24
24
|
export function useViewActivePanel(args) {
|
|
25
25
|
const [activePanel, setActivePanel] = useState(null);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useLayoutEffect, useRef } from "react";
|
|
4
4
|
import { useViews } from "../../../provider/context.js";
|
|
5
|
+
import { useEditorMenus } from "../toolbar/editor-menus.js";
|
|
5
6
|
import { sortBodyChangeFits } from "../../settings/sorts.js";
|
|
6
7
|
import { sortBodyOptions } from "../../sort-body-options.js";
|
|
7
8
|
import { usePanelStep } from "../panel-step.js";
|
|
@@ -11,6 +12,7 @@ const sameAside = (a, b) => a.length === b.length && a.every((rule, at) => rule.
|
|
|
11
12
|
export function useSortEditorHost(o) {
|
|
12
13
|
const { sorts, form, open, onDone, addSort = false } = o;
|
|
13
14
|
const { messages, components, icons } = useViews();
|
|
15
|
+
const editorMenus = useEditorMenus();
|
|
14
16
|
const SortBody = components.SortBody;
|
|
15
17
|
const step = usePanelStep();
|
|
16
18
|
const latest = useRef(sorts.rules);
|
|
@@ -48,7 +50,7 @@ export function useSortEditorHost(o) {
|
|
|
48
50
|
const body = (closeButton = true) => (_jsx(SortBody, { label: sorts.label ?? messages({ key: "views.panels.sort" }), options: sortBodyOptions(sorts.options, { icons, AppIcon: components.AppIcon }), rules: sorts.rules, setAside: sorts.setAside ?? [], max: sorts.max, form: form, addSort: addSort, onRulesChange: (rules, setAside) => {
|
|
49
51
|
if (sortBodyChangeFits(sorts, rules, setAside))
|
|
50
52
|
change(rules, setAside);
|
|
51
|
-
}, onDone: () => onDone?.(), actions: form === "phone" && closeButton ? head : undefined, ...(form === "phone" && { onStepChange: step.onStepChange }) }));
|
|
53
|
+
}, onDone: () => onDone?.(), actions: form === "phone" && closeButton ? head : undefined, ...(form === "phone" && { onStepChange: step.onStepChange }), ...(editorMenus.sort && { items: editorMenus.sort }) }));
|
|
52
54
|
return { body, head, title: step.title, escapeBack: step.escapeBack };
|
|
53
55
|
}
|
|
54
56
|
export function SortEditorHost({ sorts, form, open = true, onDone, addSort, }) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import type { ViewsMenuItem, ViewsViewVerbs } from "../../../provider/components.js";
|
|
2
|
+
import type { ViewsCustomizeItems, ViewsFilterEditorItems, ViewsGroupEditorItems, ViewsMenuItem, ViewsSortEditorItems, ViewsViewVerbs } from "../../../provider/components.js";
|
|
3
3
|
import type { ToggleConfig } from "../../model.js";
|
|
4
4
|
import type { QuickFiltersConfig } from "../../quick/model.js";
|
|
5
5
|
import type { SettingsPanelsInput } from "../../settings/input.js";
|
|
@@ -8,7 +8,7 @@ import type { CollectionViewsInput, ViewsLayout } from "../../views-row/model.js
|
|
|
8
8
|
import type { PanelFieldEditor } from "../field-editor.js";
|
|
9
9
|
import type { ToolbarPanelHost } from "./panel-part.js";
|
|
10
10
|
import type { ToolbarPanelPlace } from "./context.js";
|
|
11
|
-
import type { ToolbarMore, ToolbarOverflow, ToolbarPartButton } from "./Toolbar.js";
|
|
11
|
+
import type { ToolbarMore, ToolbarMoreViews, ToolbarOverflow, ToolbarPartButton } from "./Toolbar.js";
|
|
12
12
|
/** The toolbar's menus as data (VK-741): each handed its default items, each item keyed, and handing back the items it shows.
|
|
13
13
|
* `view`, a view's menu, handed the view too: the rows an option hands (`menu`, Edit view… among them) and the menu a views
|
|
14
14
|
* list draws from an axis's verbs. `add`, New's items: `addItems`, or, with `onAdd` alone, one row keyed `new` that runs it;
|
|
@@ -17,11 +17,19 @@ export type ToolbarMenus = {
|
|
|
17
17
|
view?: ViewsViewVerbs["menu"];
|
|
18
18
|
add?: (items: ViewsMenuItem[]) => ViewsMenuItem[];
|
|
19
19
|
more?: ToolbarMore;
|
|
20
|
+
/** Customize's rows as data (VK-1062): handed its list's, Layout's and Columns' default rows, it hands back the rows drawn. */
|
|
21
|
+
customize?: ViewsCustomizeItems;
|
|
22
|
+
/** The sort editor's menus as data (VK-1063): a rule's ⋯ and a set-aside rule's, wherever the sort editor stands. */
|
|
23
|
+
sortEditor?: ViewsSortEditorItems;
|
|
24
|
+
/** The filter editor's menus as data (VK-1063): a rule's ⋮, a set-aside rule's and a group's actions. */
|
|
25
|
+
filterEditor?: ViewsFilterEditorItems;
|
|
26
|
+
/** The group editor's rows as data (VK-1063): its settings and its foot, on Customize's Group page. */
|
|
27
|
+
groupEditor?: ViewsGroupEditorItems;
|
|
20
28
|
};
|
|
21
29
|
/** A part of the ready toolbar as the app places it (VK-967): its key (list.md, Default keys); the line it stands on: `row`,
|
|
22
30
|
* `bar` (the filter bar; in `row`, the line below the row) or `foot` (a kit phone list's foot, New's place: anywhere else, the
|
|
23
31
|
* row); on a kit phone the row and the bar are one line. Its side, and its words (`both`, as the look's words say; `icon`, its
|
|
24
|
-
* icon alone), meaningful for a part whose button has a word: `search`, `quick`, `sort`, `filter`, `filter-add`, `options`,
|
|
32
|
+
* icon alone; `word`, its word alone, VK-970), meaningful for a part whose button has a word: `search`, `quick`, `sort`, `filter`, `filter-add`, `options`,
|
|
25
33
|
* `new`. `node`: a part of the app's own, under a key of its own (a key the form holds keeps its own node).
|
|
26
34
|
* Its look (VK-984): `className`, put on every toolbar button the part draws (each handed its `part`, list.md's table), and
|
|
27
35
|
* `button`, your own button drawn for each of them in place of your `ToolbarButton`, handed the very props it would get, `ref`
|
|
@@ -31,7 +39,7 @@ export type ToolbarPartPlace = {
|
|
|
31
39
|
key: string;
|
|
32
40
|
line: "row" | "bar" | "foot";
|
|
33
41
|
side: "start" | "end";
|
|
34
|
-
words: "both" | "icon";
|
|
42
|
+
words: "both" | "icon" | "word";
|
|
35
43
|
node?: ReactNode;
|
|
36
44
|
className?: string;
|
|
37
45
|
button?: ToolbarPartButton;
|
|
@@ -134,6 +142,9 @@ export type ReadyToolbarProps<Row> = SettingsPanelsInput<Row> & {
|
|
|
134
142
|
/** ⋯ as the app draws it where the parts don't fit (VK-1031, `ToolbarOverflow`): its glyph, its class, or its whole button,
|
|
135
143
|
* handed the props your `ToolbarButton` would get. Absent, your `ToolbarButton` with `icons.more`. */
|
|
136
144
|
overflow?: ToolbarOverflow;
|
|
145
|
+
/** The views row's "+N" as the app draws it (VK-1068, `ToolbarMoreViews`): its class on ViewKit's own, or its whole button, handed
|
|
146
|
+
* the props your `ToolbarButton` would get. Absent, ViewKit's own. In your own frame "+N" is your `ToolbarButton` (`views-more`). */
|
|
147
|
+
moreViews?: ToolbarMoreViews;
|
|
137
148
|
className?: string;
|
|
138
149
|
};
|
|
139
150
|
export declare function ReadyToolbar<Row>({ settings, layer, onChange, onLayerChange, view, sortFilter, bar, ...rest }: ReadyToolbarProps<Row>): ReactNode;
|
|
@@ -34,7 +34,17 @@ export type ToolbarOverflow = {
|
|
|
34
34
|
className?: string;
|
|
35
35
|
button?: ToolbarPartButton;
|
|
36
36
|
};
|
|
37
|
-
|
|
37
|
+
/** The views row's "+N" as the app draws it (VK-1068), as ⋯ is handed: `className`, put on ViewKit's own "+N"; `button`, your own
|
|
38
|
+
* button drawn in its place, handed the props your `ToolbarButton` would get (`part: "views-more"`, "+N" as its `children`,
|
|
39
|
+
* `popup: "dialog"`, `open`, `ref` included: put `ref` on your button, so the folded views' list hangs at it). Absent, ViewKit's. */
|
|
40
|
+
export type ToolbarMoreViews = {
|
|
41
|
+
className?: string;
|
|
42
|
+
button?: ToolbarPartButton;
|
|
43
|
+
};
|
|
44
|
+
/** Server-rendered with no `phone` handed, it draws the phone's form and the computer's, CSS showing the screen's until the
|
|
45
|
+
* page comes alive (VK-1038, `ScreenForms`). */
|
|
46
|
+
export declare function Toolbar(props: Parameters<typeof ToolbarOnScreen>[0]): ReactNode;
|
|
47
|
+
declare function ToolbarOnScreen({ parts, phone, narrow, narrowBelow, fold, more, overflow, className, }: {
|
|
38
48
|
parts: readonly ToolbarPart[];
|
|
39
49
|
/** The phone's one row; absent, the provider's answer (`desktopQuery`). */
|
|
40
50
|
phone?: boolean;
|
|
@@ -57,3 +67,4 @@ export declare function Toolbar({ parts, phone, narrow, narrowBelow, fold, more,
|
|
|
57
67
|
/** A line between what belongs together and what doesn't: placed with `role: "separator"`, drawn in the fold
|
|
58
68
|
* arrangement only while a part of its side stands drawn on each side of it, and never on a phone's line. */
|
|
59
69
|
export declare function ToolbarSeparator(): ReactNode;
|
|
70
|
+
export {};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Fragment, useContext, useRef, useState } from "react";
|
|
4
4
|
import { cx } from "../../../internal/cx.js";
|
|
5
|
+
import { ScreenForms } from "../../../internal/screen-forms.js";
|
|
5
6
|
import { useViews } from "../../../provider/context.js";
|
|
6
7
|
import { useDesktop } from "../../../provider/desktop.js";
|
|
7
8
|
import { TOOLBAR_NARROW_BELOW, arrangeToolbar, foldState, foldSteps, toolbarForm, } from "../../toolbar/model.js";
|
|
@@ -11,7 +12,10 @@ import { ToolbarButton } from "./ToolbarButton.js";
|
|
|
11
12
|
import { useBoxNarrow } from "./use-box-narrow.js";
|
|
12
13
|
import { useGiveWay } from "./use-give-way.js";
|
|
13
14
|
const CLUSTER_FADE = "linear-gradient(to right, transparent 0, var(--vk-ground) 1.25rem, var(--vk-ground) 100%)";
|
|
14
|
-
export function Toolbar(
|
|
15
|
+
export function Toolbar(props) {
|
|
16
|
+
return (_jsx(ScreenForms, { off: props.phone !== undefined, children: _jsx(ToolbarOnScreen, { ...props }) }));
|
|
17
|
+
}
|
|
18
|
+
function ToolbarOnScreen({ parts, phone, narrow, narrowBelow = TOOLBAR_NARROW_BELOW, fold = false, more, overflow, className, }) {
|
|
15
19
|
const box = useRef(null);
|
|
16
20
|
const desktop = useDesktop();
|
|
17
21
|
const measured = useBoxNarrow(box, narrowBelow);
|
|
@@ -82,5 +82,5 @@ export function AdvancedFilterPill({ filterTree, at, count, aside = false, host:
|
|
|
82
82
|
return (_jsxs("span", { "data-slot": "vk-toolbar-advanced-filter", "data-open": (slot.fold || foldedAt) && panel.open ? "" : undefined, hidden: foldedAt ? true : undefined, className: "relative inline-flex shrink-0 items-center", children: [aside ? (_jsx(Tooltip, { content: messages({ key: "views.panels.advanced-filter-set-aside" }), side: "bottom", children: _jsx("span", { className: "inline-flex min-w-0", children: button }) })) : (button), Host ? (_jsx(Host, { open: panel.open, onOpenChange: panel.onOpenChange, title: name, children: content })) : (_jsx(Popover, { open: panel.open, onOpenChange: (next, details) => {
|
|
83
83
|
if (!next)
|
|
84
84
|
close(details?.reason !== "outside-press" && details?.reason !== "focus-out");
|
|
85
|
-
}, anchor: anchor, ...hangs, chrome: "
|
|
85
|
+
}, anchor: anchor, ...hangs, chrome: "menu", className: "w-(--vk-panel-w,fit-content) max-w-[calc(100vw-2rem)]", panelData: { "data-slot": "vk-toolbar-advanced-filter-panel" }, children: content }))] }));
|
|
86
86
|
}
|
|
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useEffect, useRef } from "react";
|
|
4
4
|
import { canGroupAt, nodeAt } from "../../../filters/filter-tree.js";
|
|
5
5
|
import { useViews } from "../../../provider/context.js";
|
|
6
|
+
import { markGlyph } from "../../../grid/chrome/column-glyph.js";
|
|
6
7
|
import { drawsUnnamedValue } from "../../labels.js";
|
|
7
8
|
import { listedFieldsOf, takesValue, withOperator } from "../../settings/filter-groups.js";
|
|
8
9
|
import { barFilterWords } from "../../toolbar/filter-words.js";
|
|
@@ -32,6 +33,7 @@ export function ToolbarBarFilter({ ctx, at, rule, open, onOpenChange, foldedAt,
|
|
|
32
33
|
const openAtPress = useRef(null);
|
|
33
34
|
const relation = at.far?.relation;
|
|
34
35
|
const field = fieldOfRule(ctx.filterTree.fields, rule, relation);
|
|
36
|
+
const fieldGlyph = field?.mark ? markGlyph({ icons, AppIcon: components.AppIcon }, field.mark) : null;
|
|
35
37
|
const words = barFilterWords(at.item
|
|
36
38
|
? relation
|
|
37
39
|
? {
|
|
@@ -81,14 +83,14 @@ export function ToolbarBarFilter({ ctx, at, rule, open, onOpenChange, foldedAt,
|
|
|
81
83
|
onOpenChange(null);
|
|
82
84
|
anchorOf(part).current?.focus({ preventScroll: true });
|
|
83
85
|
};
|
|
84
|
-
return (_jsxs("span", { ref: placeBox, "data-slot": "vk-toolbar-filter-rule", role: "group", "aria-label": words.sentence, "data-open": open ? "" : undefined, hidden: foldedAt ? true : undefined, className: "relative inline-flex min-w-0 shrink-0 items-center", children: [_jsx(ToolbarButton, { part: "filters", ref: fieldBox, icon:
|
|
86
|
+
return (_jsxs("span", { ref: placeBox, "data-slot": "vk-toolbar-filter-rule", role: "group", "aria-label": words.sentence, "data-open": open ? "" : undefined, hidden: foldedAt ? true : undefined, className: "relative inline-flex min-w-0 shrink-0 items-center", children: [_jsx(ToolbarButton, { part: "filters", ref: fieldBox, icon: fieldGlyph, label: messages({ key: "views.panels.filter-field" }), joined: "start", popup: "dialog", open: open === "field", ...press("field"), children: words.field }), _jsx(Popover, { open: open === "field", onOpenChange: closed("field"), anchor: anchorOf("field"), align: "start", sideOffset: 8, chrome: "menu", children: _jsx(FilterFieldList, { fields: listedFieldsOf(ctx.filterTree), own: field?.key, ...(relation ? { ownRelation: relation.key } : {}), relations: true, onPick: (picked, far) => {
|
|
85
87
|
done("field");
|
|
86
88
|
pickBarField(ctx, at, rule, picked, far);
|
|
87
|
-
}, onDone: () => done("field") }) }), _jsx(ToolbarButton, { part: "filters", ref: wayBox, icon: null, label: messages({ key: "views.panels.filter-way" }), joined: "middle", popup: "dialog", open: open === "way", ...(field && press("way")), children: words.way }), field && (_jsx(Popover, { open: open === "way", onOpenChange: closed("way"), anchor: anchorOf("way"), align: "start", sideOffset: 8, chrome: "menu", children: _jsx(AppFilterPart, { part: "way", rule: rule, field: field, options: ctx.filterTree.optionsOf?.(rule.fieldKey, rule.part, relation?.fieldKey), own: null, form: "computer", onWay: (operator) => {
|
|
89
|
+
}, onDone: () => done("field") }) }), _jsx(ToolbarButton, { part: "filters", ref: wayBox, icon: null, label: messages({ key: "views.panels.filter-way" }), joined: "middle", popup: "dialog", open: open === "way", ...(field && press("way")), children: words.way }), field && (_jsx(Popover, { open: open === "way", onOpenChange: closed("way"), anchor: anchorOf("way"), align: "start", sideOffset: 8, chrome: "menu", children: _jsx(AppFilterPart, { part: "way", rule: rule, field: field, options: ctx.filterTree.optionsOf?.(rule.fieldKey, rule.part, relation?.fieldKey), ...(relation ? { relation: relation.fieldKey } : {}), own: null, form: "computer", onWay: (operator) => {
|
|
88
90
|
done("way");
|
|
89
91
|
if (operator !== rule.operator)
|
|
90
92
|
writeBarRule(ctx, at, withOperator(rule, field.type, operator));
|
|
91
|
-
}, onValue: write, onDone: () => done("way") }) })), words.value !== null && (_jsxs("span", { "data-part": "value", className: "inline-flex min-w-0 max-w-60", children: [_jsx(ToolbarButton, { part: "filters", ref: valueBox, icon: null, label: messages({ key: "views.panels.filter-value" }), joined: "middle", waits: words.waits, popup: "dialog", open: open === "value", ...press("value"), children: words.value }), config && (_jsx(Popover, { open: open === "value", onOpenChange: closed("value"), anchor: anchorOf("value"), align: "start", sideOffset: 8, chrome: "menu", initialFocus: false, children: field ? (_jsx(AppFilterPart, { part: "value", rule: rule, field: field, options: ctx.filterTree.optionsOf?.(rule.fieldKey, rule.part, relation?.fieldKey), own: _jsx(FilterValueBody, { filter: config }), form: "computer", onWay: (operator) => {
|
|
93
|
+
}, onValue: write, onDone: () => done("way") }) })), words.value !== null && (_jsxs("span", { "data-part": "value", className: "inline-flex min-w-0 max-w-60", children: [_jsx(ToolbarButton, { part: "filters", ref: valueBox, icon: null, label: messages({ key: "views.panels.filter-value" }), joined: "middle", waits: words.waits, popup: "dialog", open: open === "value", ...press("value"), children: words.value }), config && (_jsx(Popover, { open: open === "value", onOpenChange: closed("value"), anchor: anchorOf("value"), align: "start", sideOffset: 8, chrome: "menu", initialFocus: false, children: field ? (_jsx(AppFilterPart, { part: "value", rule: rule, field: field, options: ctx.filterTree.optionsOf?.(rule.fieldKey, rule.part, relation?.fieldKey), ...(relation ? { relation: relation.fieldKey } : {}), own: _jsx(FilterValueBody, { filter: config }), form: "computer", onWay: (operator) => {
|
|
92
94
|
if (operator !== rule.operator)
|
|
93
95
|
writeBarRule(ctx, at, withOperator(rule, field.type, operator));
|
|
94
96
|
}, onValue: write, onDone: () => done("value") })) : (_jsx(FilterValueBody, { filter: config })) }))] })), _jsx(ToolbarButton, { part: "filters", ref: menuBox, icon: _jsx(More, { className: "h-4 w-4 shrink-0" }), label: actions, joined: "end", iconAlone: true, popup: "menu", open: open === "menu", ...press("menu") }), _jsx(Menu, { open: open === "menu", onOpenChange: closed("menu"), anchor: anchorOf("menu"), align: "end", label: actions, items: [
|
|
@@ -8,8 +8,9 @@ export function ToolbarButton({ size, ...props }) {
|
|
|
8
8
|
const slot = useToolbarSlot();
|
|
9
9
|
const iconOnly = slot.words === "icon" && props.icon != null;
|
|
10
10
|
const hasWords = props.word !== null || props.children != null;
|
|
11
|
-
const
|
|
11
|
+
const wordOnly = slot.words === "word" && hasWords && !props.foot;
|
|
12
|
+
const alone = !wordOnly && (slot.iconAlone || (iconOnly && hasWords));
|
|
12
13
|
const Button = slot.button ?? atoms.ToolbarButton;
|
|
13
14
|
const className = cx(slot.className, props.className) || undefined;
|
|
14
|
-
return (_jsx(Button, { ...props, ...(iconOnly && { word: null }), ...(alone && { iconAlone: true }), ...(className && { className }), size: size ?? slot.size }));
|
|
15
|
+
return (_jsx(Button, { ...props, ...(iconOnly && { word: null }), ...(wordOnly && { icon: null, children: props.children ?? props.word ?? props.label }), ...(alone && { iconAlone: true }), ...(className && { className }), size: size ?? slot.size }));
|
|
15
16
|
}
|
|
@@ -52,7 +52,5 @@ export function ToolbarFilterAdd({ filterTree, onHeldChange, open, onOpenChange,
|
|
|
52
52
|
const why = details?.reason;
|
|
53
53
|
if (!next && why !== "outside-press" && why !== "focus-out")
|
|
54
54
|
hangsAt.anchor.current?.focus({ preventScroll: true });
|
|
55
|
-
}, anchor: hangsAt.anchor, ...hangs, ...(opens === "filters"
|
|
56
|
-
? { chrome: "panel", className: "w-fit max-w-[calc(100vw-2rem)]" }
|
|
57
|
-
: { chrome: "menu" }), panelData: { "data-slot": "vk-toolbar-filters-panel" }, children: list }))] }));
|
|
55
|
+
}, anchor: hangsAt.anchor, ...hangs, chrome: "menu", ...(opens === "filters" && { className: "w-(--vk-panel-w,fit-content) max-w-[calc(100vw-2rem)]" }), panelData: { "data-slot": "vk-toolbar-filters-panel" }, children: list }))] }));
|
|
58
56
|
}
|