viewkitjs 0.26.0 → 0.28.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 +95 -0
- package/MIGRATION.md +122 -7
- package/package.json +1 -1
- package/views/dist/cells/cell-format.d.ts +3 -1
- package/views/dist/cells/cell-format.js +2 -2
- package/views/dist/cells/use-cell-format.d.ts +8 -1
- package/views/dist/cells/use-cell-format.js +13 -2
- package/views/dist/contract.d.ts +240 -3
- package/views/dist/contract.js +238 -0
- package/views/dist/controls/alert/alert.d.ts +46 -0
- package/views/dist/controls/alert/alert.js +11 -0
- package/views/dist/controls/alert/looks.d.ts +4 -0
- package/views/dist/controls/alert/looks.js +19 -0
- package/views/dist/controls/alert/tokens.d.ts +92 -0
- package/views/dist/controls/alert/tokens.js +25 -0
- package/views/dist/controls/alert-dialog/alert-dialog.d.ts +50 -0
- package/views/dist/controls/alert-dialog/alert-dialog.js +67 -0
- package/views/dist/controls/alert-dialog/confirm.d.ts +13 -0
- package/views/dist/controls/alert-dialog/confirm.js +11 -0
- package/views/dist/controls/alert-dialog/looks.d.ts +4 -0
- package/views/dist/controls/alert-dialog/looks.js +17 -0
- package/views/dist/controls/alert-dialog/tokens.d.ts +119 -0
- package/views/dist/controls/alert-dialog/tokens.js +32 -0
- package/views/dist/controls/alert-dialog.css +95 -0
- package/views/dist/controls/alert.css +51 -0
- package/views/dist/controls/collapsible/collapsible.d.ts +39 -0
- package/views/dist/controls/collapsible/collapsible.js +18 -0
- package/views/dist/controls/collapsible/looks.d.ts +4 -0
- package/views/dist/controls/collapsible/looks.js +5 -0
- package/views/dist/controls/collapsible/map-collapse.d.ts +2 -0
- package/views/dist/controls/collapsible/map-collapse.js +6 -0
- package/views/dist/controls/collapsible/tokens.d.ts +68 -0
- package/views/dist/controls/collapsible/tokens.js +19 -0
- package/views/dist/controls/collapsible.css +83 -0
- package/views/dist/controls/compound-editor/map-parts-body.js +2 -1
- package/views/dist/controls/compound-editor/name-parts.js +10 -2
- package/views/dist/controls/compound-editor/place-parts.js +5 -1
- package/views/dist/controls/compound-editor/place.d.ts +2 -1
- package/views/dist/controls/compound-editor/place.js +2 -0
- package/views/dist/controls/controls.d.ts +17 -0
- package/views/dist/controls/controls.js +17 -0
- package/views/dist/controls/date-editor/date-editor.d.ts +2 -1
- package/views/dist/controls/date-editor/map-calendar.js +3 -1
- package/views/dist/controls/filter-editor/filter-editor.d.ts +56 -0
- package/views/dist/controls/filter-editor/filter-editor.js +208 -0
- package/views/dist/controls/filter-editor/how.d.ts +23 -0
- package/views/dist/controls/filter-editor/how.js +13 -0
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +18 -0
- package/views/dist/controls/filter-editor/map-filter-body.js +164 -0
- package/views/dist/controls/filter-editor/map-rules.d.ts +85 -0
- package/views/dist/controls/filter-editor/map-rules.js +273 -0
- package/views/dist/controls/filter-editor/parts.d.ts +46 -0
- package/views/dist/controls/filter-editor/parts.js +75 -0
- package/views/dist/controls/filter-editor/rules.d.ts +104 -0
- package/views/dist/controls/filter-editor/rules.js +148 -0
- package/views/dist/controls/filter-editor/tokens.d.ts +83 -0
- package/views/dist/controls/filter-editor/tokens.js +23 -0
- package/views/dist/controls/filter-editor/words.d.ts +59 -0
- package/views/dist/controls/filter-editor/words.js +40 -0
- package/views/dist/controls/filter-editor.css +124 -0
- package/views/dist/controls/group-editor/group-editor.d.ts +56 -0
- package/views/dist/controls/group-editor/group-editor.js +126 -0
- package/views/dist/controls/group-editor/map-group-body.d.ts +19 -0
- package/views/dist/controls/group-editor/map-group-body.js +106 -0
- package/views/dist/controls/group-editor/rules.d.ts +48 -0
- package/views/dist/controls/group-editor/rules.js +41 -0
- package/views/dist/controls/group-editor/tokens.d.ts +15 -0
- package/views/dist/controls/group-editor/tokens.js +6 -0
- package/views/dist/controls/group-editor/words.d.ts +39 -0
- package/views/dist/controls/group-editor/words.js +21 -0
- package/views/dist/controls/group-editor.css +20 -0
- package/views/dist/controls/index.d.ts +35 -1
- package/views/dist/controls/index.js +35 -1
- package/views/dist/controls/internal/editor-parts.d.ts +47 -0
- package/views/dist/controls/internal/editor-parts.js +48 -0
- package/views/dist/controls/internal/step-return.d.ts +9 -0
- package/views/dist/controls/internal/step-return.js +27 -0
- package/views/dist/controls/links-editor/links-editor.d.ts +80 -0
- package/views/dist/controls/links-editor/links-editor.js +329 -0
- package/views/dist/controls/links-editor/links.d.ts +62 -0
- package/views/dist/controls/links-editor/links.js +50 -0
- package/views/dist/controls/links-editor/map-links-body.d.ts +10 -0
- package/views/dist/controls/links-editor/map-links-body.js +74 -0
- package/views/dist/controls/links-editor/tokens.d.ts +71 -0
- package/views/dist/controls/links-editor/tokens.js +20 -0
- package/views/dist/controls/links-editor/words.d.ts +56 -0
- package/views/dist/controls/links-editor/words.js +33 -0
- package/views/dist/controls/links-editor.css +132 -0
- package/views/dist/controls/menu-list/menu-list.d.ts +17 -2
- package/views/dist/controls/menu-list/menu-list.js +25 -16
- package/views/dist/controls/modal/looks.d.ts +4 -0
- package/views/dist/controls/modal/looks.js +25 -0
- package/views/dist/controls/modal/modal.d.ts +69 -0
- package/views/dist/controls/modal/modal.js +62 -0
- package/views/dist/controls/modal/tokens.d.ts +192 -0
- package/views/dist/controls/modal/tokens.js +50 -0
- package/views/dist/controls/modal.css +130 -0
- package/views/dist/controls/notice/notice.d.ts +49 -0
- package/views/dist/controls/notice/notice.js +35 -0
- package/views/dist/controls/notice/tokens.d.ts +99 -0
- package/views/dist/controls/notice/tokens.js +27 -0
- package/views/dist/controls/notice.css +100 -0
- package/views/dist/controls/number-editor/format.d.ts +31 -0
- package/views/dist/controls/number-editor/format.js +79 -0
- package/views/dist/controls/number-editor/looks.d.ts +14 -0
- package/views/dist/controls/number-editor/looks.js +17 -0
- package/views/dist/controls/number-editor/map-number-body.d.ts +16 -0
- package/views/dist/controls/number-editor/map-number-body.js +57 -0
- package/views/dist/controls/number-editor/number-editor.d.ts +72 -0
- package/views/dist/controls/number-editor/number-editor.js +202 -0
- package/views/dist/controls/number-editor/tokens.d.ts +28 -0
- package/views/dist/controls/number-editor/tokens.js +9 -0
- package/views/dist/controls/number-editor/words.d.ts +23 -0
- package/views/dist/controls/number-editor/words.js +13 -0
- package/views/dist/controls/number-editor.css +37 -0
- package/views/dist/controls/number-field/number-field.js +57 -5
- package/views/dist/controls/pane/looks.d.ts +4 -0
- package/views/dist/controls/pane/looks.js +11 -0
- package/views/dist/controls/pane/pane.d.ts +63 -0
- package/views/dist/controls/pane/pane.js +98 -0
- package/views/dist/controls/pane/state.d.ts +14 -0
- package/views/dist/controls/pane/state.js +7 -0
- package/views/dist/controls/pane/tokens.d.ts +79 -0
- package/views/dist/controls/pane/tokens.js +22 -0
- package/views/dist/controls/pane.css +104 -0
- package/views/dist/controls/picker/rows.d.ts +4 -2
- package/views/dist/controls/picker/rows.js +4 -3
- package/views/dist/controls/radio/radio.d.ts +33 -0
- package/views/dist/controls/radio/radio.js +19 -0
- package/views/dist/controls/radio/tokens.d.ts +127 -0
- package/views/dist/controls/radio/tokens.js +34 -0
- package/views/dist/controls/radio.css +104 -0
- package/views/dist/controls/sort-editor/map-sort-body.d.ts +9 -0
- package/views/dist/controls/sort-editor/map-sort-body.js +81 -0
- package/views/dist/controls/sort-editor/rules.d.ts +48 -0
- package/views/dist/controls/sort-editor/rules.js +24 -0
- package/views/dist/controls/sort-editor/sort-editor.d.ts +58 -0
- package/views/dist/controls/sort-editor/sort-editor.js +180 -0
- package/views/dist/controls/sort-editor/tokens.d.ts +79 -0
- package/views/dist/controls/sort-editor/tokens.js +22 -0
- package/views/dist/controls/sort-editor/words.d.ts +48 -0
- package/views/dist/controls/sort-editor/words.js +25 -0
- package/views/dist/controls/sort-editor.css +96 -0
- package/views/dist/controls/text-editor/phone-number.d.ts +4 -0
- package/views/dist/controls/text-editor/phone-number.js +20 -0
- package/views/dist/controls/text-editor/text-editor.js +2 -19
- package/views/dist/controls/toast/toast.d.ts +75 -0
- package/views/dist/controls/toast/toast.js +99 -0
- package/views/dist/controls/toast/tokens.d.ts +100 -0
- package/views/dist/controls/toast/tokens.js +27 -0
- package/views/dist/controls/toast.css +93 -0
- package/views/dist/controls/tokens.js +30 -0
- package/views/dist/controls/values-editor/looks.d.ts +16 -0
- package/views/dist/controls/values-editor/looks.js +19 -0
- package/views/dist/controls/values-editor/map-values-body.d.ts +12 -0
- package/views/dist/controls/values-editor/map-values-body.js +71 -0
- package/views/dist/controls/values-editor/tokens.d.ts +132 -0
- package/views/dist/controls/values-editor/tokens.js +35 -0
- package/views/dist/controls/values-editor/values-editor.d.ts +62 -0
- package/views/dist/controls/values-editor/values-editor.js +441 -0
- package/views/dist/controls/values-editor/values.d.ts +71 -0
- package/views/dist/controls/values-editor/values.js +59 -0
- package/views/dist/controls/values-editor/words.d.ts +50 -0
- package/views/dist/controls/values-editor/words.js +29 -0
- package/views/dist/controls/values-editor.css +207 -0
- package/views/dist/controls/views-list/looks.d.ts +13 -0
- package/views/dist/controls/views-list/looks.js +12 -0
- package/views/dist/controls/views-list/map-views-list-body.d.ts +19 -0
- package/views/dist/controls/views-list/map-views-list-body.js +65 -0
- package/views/dist/controls/views-list/rules.d.ts +72 -0
- package/views/dist/controls/views-list/rules.js +4 -0
- package/views/dist/controls/views-list/tokens.d.ts +11 -0
- package/views/dist/controls/views-list/tokens.js +5 -0
- package/views/dist/controls/views-list/views-list.d.ts +44 -0
- package/views/dist/controls/views-list/views-list.js +57 -0
- package/views/dist/controls/views-list/words.d.ts +22 -0
- package/views/dist/controls/views-list/words.js +3 -0
- package/views/dist/controls/views-list.css +8 -0
- package/views/dist/display/date.js +2 -2
- package/views/dist/display/format.js +10 -2
- package/views/dist/display/options.d.ts +3 -1
- package/views/dist/display/use-display-options.d.ts +3 -0
- package/views/dist/display/use-display-options.js +10 -2
- package/views/dist/display/viewer.d.ts +1 -1
- package/views/dist/display/viewer.js +1 -1
- package/views/dist/editors/DateEditor.js +11 -9
- package/views/dist/editors/NumberEditor.js +3 -1
- package/views/dist/editors/relation-panel.js +7 -1
- package/views/dist/editors/relation-picker.d.ts +2 -1
- package/views/dist/editors/relation-picker.js +4 -3
- package/views/dist/editors/relation-source.d.ts +4 -1
- package/views/dist/editors/relation-source.js +5 -2
- package/views/dist/field-row/editors/RowNumberEditor.js +2 -2
- package/views/dist/fields/number-edit.d.ts +6 -0
- package/views/dist/fields/number-edit.js +8 -1
- package/views/dist/grid/chrome/GridCellEditors.js +3 -3
- package/views/dist/grid/chrome/GridColumnDateSection.d.ts +4 -3
- package/views/dist/grid/chrome/GridColumnDateSection.js +4 -4
- package/views/dist/grid/chrome/GridColumnDurationSection.js +2 -2
- package/views/dist/grid/chrome/GridColumnMenu.js +6 -4
- package/views/dist/grid/chrome/GridDateEditor.d.ts +3 -1
- package/views/dist/grid/chrome/GridDateEditor.js +2 -1
- package/views/dist/grid/chrome/GridFooter.js +2 -2
- package/views/dist/grid/chrome/grid-column-menu-items.js +4 -2
- package/views/dist/grid/chrome/useGridBandFigures.js +2 -2
- package/views/dist/grid/chrome/useGridFittedWidths.d.ts +3 -0
- package/views/dist/grid/chrome/useGridFittedWidths.js +9 -3
- package/views/dist/grid/chrome/useGridKeyboard.d.ts +4 -1
- package/views/dist/grid/chrome/useGridKeyboard.js +5 -2
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +2 -1
- package/views/dist/grid/core/commit-model.d.ts +7 -0
- package/views/dist/grid/core/commit-model.js +5 -1
- package/views/dist/grid/core/editing-controller.js +10 -2
- package/views/dist/grid/core/editing-model.js +3 -7
- package/views/dist/grid/core/undo-owner.d.ts +6 -0
- package/views/dist/grid/core/undo-owner.js +13 -0
- package/views/dist/grid/core/useGridEditing.d.ts +2 -0
- package/views/dist/grid/core/useGridEditing.js +4 -0
- package/views/dist/looks/index.d.ts +8 -0
- package/views/dist/looks/index.js +8 -0
- package/views/dist/looks/pieces.js +16 -0
- package/views/dist/panels/model.d.ts +6 -1
- package/views/dist/panels/react/customize-body.d.ts +4 -2
- package/views/dist/panels/react/customize-body.js +3 -3
- package/views/dist/panels/react/customize.js +4 -2
- package/views/dist/panels/react/filter/FilterEditor.js +2 -2
- package/views/dist/panels/react/filter/PhoneFilterEditor.d.ts +8 -2
- package/views/dist/panels/react/filter/PhoneFilterEditor.js +9 -6
- package/views/dist/panels/react/filter/filter-body.d.ts +8 -5
- package/views/dist/panels/react/filter/filter-body.js +17 -6
- package/views/dist/panels/react/filter/filter-part-body.d.ts +4 -1
- package/views/dist/panels/react/filter/filter-part-body.js +3 -1
- package/views/dist/panels/react/panel-sheet.d.ts +5 -1
- package/views/dist/panels/react/panel-sheet.js +6 -2
- package/views/dist/panels/react/panel-step.d.ts +12 -0
- package/views/dist/panels/react/panel-step.js +26 -0
- package/views/dist/panels/react/sort/SortEditor.d.ts +4 -0
- package/views/dist/panels/react/sort/SortEditor.js +5 -2
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +8 -0
- package/views/dist/panels/react/toolbar/ReadyToolbar.js +84 -2
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.d.ts +16 -0
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +49 -0
- package/views/dist/panels/react/toolbar/ToolbarFilterSheet.js +3 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.d.ts +4 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +36 -21
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.d.ts +4 -1
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarSortPill.d.ts +5 -0
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +15 -6
- package/views/dist/panels/react/toolbar/panel-part.d.ts +5 -1
- package/views/dist/panels/react/toolbar/panel-part.js +2 -2
- package/views/dist/panels/react/toolbar/use-filter-add.d.ts +16 -0
- package/views/dist/panels/react/toolbar/use-filter-add.js +32 -0
- package/views/dist/panels/react.d.ts +1 -0
- package/views/dist/panels/react.js +1 -0
- package/views/dist/panels/settings/filter-groups.js +35 -1
- package/views/dist/panels/settings/group-buckets.js +1 -0
- package/views/dist/provider/ViewsProvider.d.ts +7 -1
- package/views/dist/provider/ViewsProvider.js +23 -3
- package/views/dist/provider/components.d.ts +34 -4
- package/views/dist/provider/moment.d.ts +6 -0
- package/views/dist/provider/moment.js +10 -0
- package/views/dist/styles.css +1276 -51
- package/views/dist/styles.unlayered.css +1277 -51
- package/views/docs/contract.md +23 -15
- package/views/docs/controls/alert-dialog.md +37 -0
- package/views/docs/controls/alert.md +30 -0
- package/views/docs/controls/collapsible.md +22 -0
- package/views/docs/controls/filter-editor.md +28 -0
- package/views/docs/controls/group-editor.md +11 -0
- package/views/docs/controls/links-editor.md +25 -0
- package/views/docs/controls/modal.md +55 -0
- package/views/docs/controls/notice.md +32 -0
- package/views/docs/controls/number-editor.md +12 -0
- package/views/docs/controls/pane.md +25 -0
- package/views/docs/controls/radio.md +39 -0
- package/views/docs/controls/sort-editor.md +27 -0
- package/views/docs/controls/toast.md +32 -0
- package/views/docs/controls/values-editor.md +40 -0
- package/views/docs/controls/views-list.md +8 -0
- package/views/docs/guides/cells.md +1 -1
- package/views/docs/guides/display.md +1 -1
- package/views/docs/guides/the-grid.md +1 -1
- package/views/docs/guides/the-provider.md +19 -0
- package/views/docs/reference/cells.md +2 -2
- package/views/docs/reference/controls.md +326 -8
- package/views/docs/reference/display.md +2 -2
- package/views/docs/reference/editors-relation.md +1 -1
- package/views/docs/reference/looks.md +20 -3
- package/views/docs/reference/panels-react.md +7 -6
- package/views/docs/reference/panels.md +1 -1
- package/views/docs/reference/react.md +8 -8
- package/views/docs/reference/views.md +1 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Button } from "../button/button.js";
|
|
5
|
+
import { PhoneHost, phoneMark, usePhone } from "../internal/phone.js";
|
|
6
|
+
import { useStepReturn } from "../internal/step-return.js";
|
|
7
|
+
import { MENU_LIST_CARD_FRAME } from "../menu-list/looks.js";
|
|
8
|
+
import { MenuList, MenuListPanelRows } from "../menu-list/menu-list.js";
|
|
9
|
+
import { Picker, usePicker } from "../picker/picker.js";
|
|
10
|
+
import { openLevels } from "../picker/rows.js";
|
|
11
|
+
import { SheetStep } from "../sheet/bottom-sheet.js";
|
|
12
|
+
import { directionTurns, groupLabel, groupOrders, hideAllGroups, moveGroup, noneShown, orderedGroups, setGroupShown, showAllGroups, startGroup } from "./rules.js";
|
|
13
|
+
import { groupWords } from "./words.js";
|
|
14
|
+
function FieldsOnPhone(props) {
|
|
15
|
+
return _jsx(_Fragment, { children: usePicker({ label: props.label, items: props.items, value: props.value, search: props.search, searchShown: true, form: "phone", words: props.words,
|
|
16
|
+
levels: props.levels, onLevelsChange: props.onLevelsChange, onValueChange: (v) => { if (typeof v === "string")
|
|
17
|
+
props.onPick(v); } }).body });
|
|
18
|
+
}
|
|
19
|
+
export function useGroupEditor(props) {
|
|
20
|
+
const { label, fields, ownOrders = {}, group, values, onGroupChange, opens, orders = {}, manualOrder = true, steps = {} } = props;
|
|
21
|
+
const w = groupWords(props.words), search = props.search ?? w.search;
|
|
22
|
+
const NAMES = { field: w.groupBy, order: w.order, direction: w.direction, step: w.dateStep };
|
|
23
|
+
const LEVEL_OF = Object.fromEntries(Object.entries(NAMES).map(([k, v]) => [v, k]));
|
|
24
|
+
const DIRECTIONS = [{ value: "ascending", label: w.ascending }, { value: "descending", label: w.descending }];
|
|
25
|
+
const ordersOf = (field) => {
|
|
26
|
+
const named = orders[field];
|
|
27
|
+
const offered = [...(named ?? ["field", "name", "count"]).filter((o) => o !== "own"), ...(manualOrder ? ["own"] : [])];
|
|
28
|
+
return groupOrders(ownOrders[field], offered, w);
|
|
29
|
+
};
|
|
30
|
+
const stepsOf = (field) => steps[field] ?? [];
|
|
31
|
+
const screen = React.useContext(PhoneHost), small = usePhone(), phone = (props.form ?? (screen || small ? "phone" : "computer")) === "phone";
|
|
32
|
+
const now = React.useRef(group);
|
|
33
|
+
React.useLayoutEffect(() => { now.current = group; });
|
|
34
|
+
const change = (next) => { now.current = next; onGroupChange(next); };
|
|
35
|
+
const [level, setLevel] = React.useState(opens ?? null), [wentBack, setWentBack] = React.useState(false);
|
|
36
|
+
const [fieldLevels, setFieldLevels] = React.useState(opens === "field" && props.opensLevel ? [props.opensLevel] : []);
|
|
37
|
+
const [focusTo, setFocusTo] = React.useState(null), root = React.useRef(null);
|
|
38
|
+
const placeRoot = React.useCallback((el) => { root.current = el; if (!el && !opens) {
|
|
39
|
+
setLevel(null);
|
|
40
|
+
setFieldLevels([]);
|
|
41
|
+
} }, [opens]);
|
|
42
|
+
React.useLayoutEffect(() => {
|
|
43
|
+
if (!focusTo || phone)
|
|
44
|
+
return;
|
|
45
|
+
setFocusTo(null);
|
|
46
|
+
const rows = [...(root.current?.querySelectorAll("[data-item]") ?? [])];
|
|
47
|
+
const to = focusTo === "ticked" ? rows.find((r) => r.getAttribute("aria-checked") === "true") : rows.find((r) => r.querySelector(".o-menu-name")?.textContent === focusTo);
|
|
48
|
+
to?.focus({ preventScroll: true });
|
|
49
|
+
}, [focusTo, phone]);
|
|
50
|
+
const open = (to) => { setWentBack(false); setLevel(to); setFieldLevels([]); if (to !== "field")
|
|
51
|
+
setFocusTo("ticked"); };
|
|
52
|
+
const back = () => { const from = level; setWentBack(true); setLevel(null); setFieldLevels([]); if (from)
|
|
53
|
+
setFocusTo(NAMES[from]); };
|
|
54
|
+
const levelName = level && (level === "field" || group) ? NAMES[level] : null;
|
|
55
|
+
useStepReturn(root, phone && levelName ? [(r) => [...r.querySelectorAll(".o-menu-list-row, [data-item]")].find((x) => x.querySelector(".o-menu-list-name, .o-menu-name")?.textContent === levelName) ?? null] : []);
|
|
56
|
+
const onFieldLevels = (next) => { setWentBack(next.length < fieldLevels.length); setFieldLevels(next); };
|
|
57
|
+
const backField = () => { setWentBack(true); setFieldLevels((l) => l.slice(0, -1)); };
|
|
58
|
+
const dateSteps = group ? stepsOf(group.field) : [], heldStep = group?.step ?? dateSteps[0]?.value ?? "";
|
|
59
|
+
const hideEmptyTo = (on) => { if (now.current)
|
|
60
|
+
change({ ...now.current, hideEmpty: on }); };
|
|
61
|
+
const settings = [
|
|
62
|
+
{ kind: "choices", icon: null, label: NAMES.field, value: group?.field ?? "", choices: [], detail: groupLabel(group, fields, w.none) },
|
|
63
|
+
...(group ? [
|
|
64
|
+
{ kind: "choices", icon: null, label: NAMES.order, value: group.order, choices: ordersOf(group.field) },
|
|
65
|
+
directionTurns(group)
|
|
66
|
+
? { kind: "choices", icon: null, label: NAMES.direction, value: group.direction, choices: DIRECTIONS }
|
|
67
|
+
: { icon: null, label: NAMES.direction, disabled: w.ownNoDirection },
|
|
68
|
+
...(dateSteps.length ? [{ kind: "choices", icon: null, label: NAMES.step, value: heldStep, choices: dateSteps }] : []),
|
|
69
|
+
{ kind: "check", label: w.hideEmpty, checked: group.hideEmpty, onCheckedChange: hideEmptyTo },
|
|
70
|
+
] : []),
|
|
71
|
+
];
|
|
72
|
+
const opened = (e) => { if ("label" in e && LEVEL_OF[e.label])
|
|
73
|
+
open(LEVEL_OF[e.label]); };
|
|
74
|
+
const groups = group ? orderedGroups(values, group).map((v) => ({ kind: "check", label: v.label, icon: v.mark, checked: !group.hidden.includes(v.value), grip: true,
|
|
75
|
+
onCheckedChange: (on) => { if (now.current)
|
|
76
|
+
change(setGroupShown(now.current, v.value, on)); } })) : [];
|
|
77
|
+
const move = (from, to) => { if (now.current)
|
|
78
|
+
change(moveGroup(now.current, values, from, to)); };
|
|
79
|
+
const none = !!group && noneShown(group, values);
|
|
80
|
+
const heading = (_jsxs("div", { className: "o-group-editor-heading", children: [_jsx("p", { className: "o-list-heading", children: w.groups }), _jsx(Button, { kind: "link", size: "line", onClick: () => { if (now.current)
|
|
81
|
+
change(none ? showAllGroups(now.current) : hideAllGroups(now.current, values)); }, children: none ? w.showAll : w.hideAll })] }));
|
|
82
|
+
const removeRow = { icon: null, label: w.remove, danger: true, onSelect: () => { change(null); setLevel(null); setFocusTo(NAMES.field); } };
|
|
83
|
+
const foot = [{ kind: "separator" }, removeRow];
|
|
84
|
+
const pickField = (v) => {
|
|
85
|
+
if (v !== now.current?.field)
|
|
86
|
+
change(startGroup(v, v in ownOrders, now.current?.hideEmpty ?? false, stepsOf(v)[0]?.value));
|
|
87
|
+
back();
|
|
88
|
+
};
|
|
89
|
+
const pick = (which) => (v) => {
|
|
90
|
+
const g = now.current;
|
|
91
|
+
if (g && which === "order" && v !== g.order)
|
|
92
|
+
change({ ...g, order: v });
|
|
93
|
+
else if (g && which === "direction" && v !== g.direction)
|
|
94
|
+
change({ ...g, direction: v });
|
|
95
|
+
else if (g && which === "step" && v !== (g.step ?? stepsOf(g.field)[0]?.value))
|
|
96
|
+
change({ ...g, step: v });
|
|
97
|
+
back();
|
|
98
|
+
};
|
|
99
|
+
const choices = (which) => group
|
|
100
|
+
? [which === "order" ? { kind: "pick", value: group.order, choices: ordersOf(group.field), onChoose: pick(which) }
|
|
101
|
+
: which === "direction" ? { kind: "pick", value: group.direction, choices: DIRECTIONS, onChoose: pick(which) }
|
|
102
|
+
: { kind: "pick", value: heldStep, choices: dateSteps, onChoose: pick(which) }]
|
|
103
|
+
: [];
|
|
104
|
+
const at = level && (level === "field" || group) ? level : null;
|
|
105
|
+
const form = phone ? "phone" : "computer";
|
|
106
|
+
let content;
|
|
107
|
+
if (at === "field") {
|
|
108
|
+
content = phone
|
|
109
|
+
? _jsx(FieldsOnPhone, { label: NAMES.field, items: fields, value: group?.field ?? null, search: search, onPick: pickField, words: w.picker, levels: fieldLevels, onLevelsChange: onFieldLevels })
|
|
110
|
+
: _jsx("div", { className: "o-group-editor-fields", children: _jsx(Picker, { label: NAMES.field, items: fields, value: group?.field ?? null, search: search, words: w.picker, searchShown: true, form: "computer", autoFocus: !opens, standing: !!opens, searchLook: "soft", levels: fieldLevels, onLevelsChange: onFieldLevels, onValueChange: (v) => { if (typeof v === "string")
|
|
111
|
+
pickField(v); } }) });
|
|
112
|
+
}
|
|
113
|
+
else if (at) {
|
|
114
|
+
content = phone ? _jsx(MenuList, { words: w.list, label: NAMES[at], entries: choices(at) }) : _jsx(MenuListPanelRows, { words: w.list, label: NAMES[at], entries: choices(at) });
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
content = phone ? (_jsxs(_Fragment, { children: [_jsx(MenuList, { words: w.list, label: label, entries: settings, onOpen: opened }), group && _jsxs(_Fragment, { children: [values.length > 0 && _jsxs(_Fragment, { children: [heading, _jsx(MenuList, { words: w.list, label: w.groups, entries: groups, onMove: move })] }), _jsx(MenuList, { words: w.list, label: w.remove, entries: [removeRow] })] })] })) : (_jsxs(_Fragment, { children: [_jsx(MenuListPanelRows, { words: w.list, label: label, entries: settings, ticks: "switch", onOpen: opened }), group && _jsxs(_Fragment, { children: [values.length > 0 && _jsxs(_Fragment, { children: [heading, _jsx(MenuListPanelRows, { words: w.list, label: w.groups, entries: groups, ticks: "switch", onMove: move })] }), _jsx(MenuListPanelRows, { words: w.list, label: w.remove, entries: foot })] })] }));
|
|
118
|
+
}
|
|
119
|
+
const fieldLevel = at === "field" ? openLevels(fields, fieldLevels).slice(-1)[0] : undefined;
|
|
120
|
+
const step = fieldLevel ? `field:${fieldLevels.join(">")}` : at ?? "settings";
|
|
121
|
+
const body = (_jsx("div", { ref: placeRoot, className: "o-group-editor", "data-kit": "group-editor", "data-group-form": form, "data-group-level": at ?? "settings", ...phoneMark(!!screen || small), ...MENU_LIST_CARD_FRAME, children: phone ? _jsx(SheetStep, { step: step, back: wentBack, children: _jsx("div", { className: "o-group-editor-step", children: content }) }) : content }));
|
|
122
|
+
return { body, level: fieldLevel ? { name: fieldLevel.label, back: backField } : at ? { name: NAMES[at], back } : null };
|
|
123
|
+
}
|
|
124
|
+
export function GroupEditor(props) {
|
|
125
|
+
return _jsx(_Fragment, { children: useGroupEditor(props).body });
|
|
126
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ViewsMessageResolver } from "../../contract.js";
|
|
2
|
+
import type { ViewsGroupBodyProps, ViewsGroupValue } from "../../provider/components.js";
|
|
3
|
+
import { type GroupEditorProps, type GroupEditorValue } from "./group-editor.js";
|
|
4
|
+
import type { ListGroup } from "./rules.js";
|
|
5
|
+
import type { GroupEditorWords } from "./words.js";
|
|
6
|
+
/** The group editor's words in the app's messages. */
|
|
7
|
+
export declare function groupEditorWordsOf(say: ViewsMessageResolver): GroupEditorWords;
|
|
8
|
+
/** ViewKit's group as the editor takes it; null ungrouped. Your own order's groups stand placed as the list shows them. */
|
|
9
|
+
export declare function kitGroupOf(group: ViewsGroupValue, dated?: boolean): ListGroup | null;
|
|
10
|
+
/** ViewKit's groups as the editor's values, in the field's own order (ViewKit hands them as the list shows them: a field's own
|
|
11
|
+
* order turned comes back the right way round), each with its count; the empty group named `noValue`. */
|
|
12
|
+
export declare function kitGroupValuesOf(group: ViewsGroupValue, noValue: string, dated?: boolean): GroupEditorValue[];
|
|
13
|
+
/** The editor's group, changed once, as the one change ViewKit writes: a new Group by, the field alone, so ViewKit opens it in the
|
|
14
|
+
* field's own order, direction and step, as its own pages do; else the groups' new places (a drag); else the order or its
|
|
15
|
+
* direction; else a date's step; else Hide empty groups; else which groups show. */
|
|
16
|
+
export declare function viewKitGroupOf(next: ListGroup | null, now: ViewsGroupValue, dated?: boolean): ViewsGroupValue;
|
|
17
|
+
/** ViewKit's group body's props as the group editor's. */
|
|
18
|
+
export declare function groupEditorPropsOf(p: ViewsGroupBodyProps, words: GroupEditorWords): GroupEditorProps;
|
|
19
|
+
export declare function MapGroupBody(props: ViewsGroupBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { resolveViewsMessage } from "../../contract.js";
|
|
5
|
+
import { ViewsContext } from "../../provider/context.js";
|
|
6
|
+
import { useToldStep } from "../internal/told-step.js";
|
|
7
|
+
import { pickerWordsOf } from "../picker/map-picker.js";
|
|
8
|
+
import { useGroupEditor } from "./group-editor.js";
|
|
9
|
+
const VIEWKIT = { field: "lifecycle", name: "name", count: "count", own: "manual" };
|
|
10
|
+
const KIT = { lifecycle: "field", name: "name", count: "count", manual: "own" };
|
|
11
|
+
const KIT_WAY = { asc: "ascending", desc: "descending" };
|
|
12
|
+
const VIEWKIT_WAY = { ascending: "asc", descending: "desc" };
|
|
13
|
+
export function groupEditorWordsOf(say) {
|
|
14
|
+
return {
|
|
15
|
+
groupBy: say({ key: "views.panels.group-by" }),
|
|
16
|
+
order: say({ key: "views.panels.group-order" }),
|
|
17
|
+
direction: say({ key: "views.panels.sort-direction" }),
|
|
18
|
+
dateStep: say({ key: "views.panels.group-date-step" }),
|
|
19
|
+
ascending: say({ key: "views.panels.sort-ascending" }),
|
|
20
|
+
descending: say({ key: "views.panels.sort-descending" }),
|
|
21
|
+
name: say({ key: "views.panels.group-order-name" }),
|
|
22
|
+
count: say({ key: "views.panels.group-order-count" }),
|
|
23
|
+
own: say({ key: "views.panels.group-order-own" }),
|
|
24
|
+
ownNoDirection: say({ key: "views.panels.group-own-no-direction" }),
|
|
25
|
+
hideEmpty: say({ key: "views.panels.hide-empty-groups" }),
|
|
26
|
+
groups: say({ key: "views.panels.groups" }),
|
|
27
|
+
hideAll: say({ key: "views.panels.groups-hide-all" }),
|
|
28
|
+
showAll: say({ key: "views.panels.groups-show-all" }),
|
|
29
|
+
remove: say({ key: "views.panels.group-remove" }),
|
|
30
|
+
none: say({ key: "views.panels.group-none" }),
|
|
31
|
+
search: say({ key: "views.panels.sort-search" }),
|
|
32
|
+
noValue: say({ key: "views.panels.group-no-value" }),
|
|
33
|
+
picker: pickerWordsOf(say),
|
|
34
|
+
list: {
|
|
35
|
+
move: (label) => say({ key: "views.panels.sort-move", values: { label } }),
|
|
36
|
+
howKeys: say({ key: "views.panels.list-move-keys" }),
|
|
37
|
+
howHold: say({ key: "views.panels.list-move-hold" }),
|
|
38
|
+
movedTo: (label, at, of) => say({ key: "views.panels.list-moved", values: { label, at, of } }),
|
|
39
|
+
on: say({ key: "views.panels.toggle-on" }),
|
|
40
|
+
off: say({ key: "views.panels.toggle-off" }),
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const kitOrderOf = (mode, dated) => (dated && mode === "name" ? "field" : KIT[mode]);
|
|
45
|
+
const viewKitOrderOf = (order, dated) => (dated && order === "field" ? "name" : VIEWKIT[order]);
|
|
46
|
+
const datedIn = (dimensions, value) => !!dimensions.find((d) => d.value === value)?.granularities?.length;
|
|
47
|
+
export function kitGroupOf(group, dated = false) {
|
|
48
|
+
if (group.value === "none")
|
|
49
|
+
return null;
|
|
50
|
+
const order = group.order ?? { mode: "name", dir: "asc" }, groups = group.groups ?? [];
|
|
51
|
+
return { field: group.value, order: kitOrderOf(order.mode, dated), direction: KIT_WAY[order.dir], hideEmpty: group.hideEmpty ?? false,
|
|
52
|
+
placed: order.mode === "manual" ? groups.map((g) => g.key) : [], hidden: groups.filter((g) => g.hidden).map((g) => g.key),
|
|
53
|
+
...(group.granularity !== undefined && { step: group.granularity }) };
|
|
54
|
+
}
|
|
55
|
+
export function kitGroupValuesOf(group, noValue, dated = false) {
|
|
56
|
+
const groups = group.groups ?? [];
|
|
57
|
+
const fieldOwn = group.order?.mode === "lifecycle" || (dated && group.order?.mode === "name");
|
|
58
|
+
const own = fieldOwn && group.order?.dir === "desc" ? [...groups].reverse() : groups;
|
|
59
|
+
return own.map((g) => ({ value: g.key, label: g.label || noValue, count: g.count ?? 0 }));
|
|
60
|
+
}
|
|
61
|
+
export function viewKitGroupOf(next, now, dated = false) {
|
|
62
|
+
if (!next)
|
|
63
|
+
return { value: "none" };
|
|
64
|
+
const order = { mode: viewKitOrderOf(next.order, dated), dir: VIEWKIT_WAY[next.direction] };
|
|
65
|
+
if (next.field !== now.value)
|
|
66
|
+
return { value: next.field };
|
|
67
|
+
const groups = now.groups ?? [];
|
|
68
|
+
if (next.order === "own" && next.placed.length && next.placed.join("\u0000") !== groups.map((g) => g.key).join("\u0000")) {
|
|
69
|
+
const at = new Map(groups.map((g) => [g.key, g]));
|
|
70
|
+
return { ...now, groups: [...next.placed.flatMap((k) => at.get(k) ?? []), ...groups.filter((g) => !next.placed.includes(g.key))] };
|
|
71
|
+
}
|
|
72
|
+
if (order.mode !== now.order?.mode || order.dir !== now.order?.dir)
|
|
73
|
+
return { ...now, order };
|
|
74
|
+
if (next.step !== undefined && next.step !== now.granularity)
|
|
75
|
+
return { ...now, granularity: next.step };
|
|
76
|
+
if (next.hideEmpty !== (now.hideEmpty ?? false))
|
|
77
|
+
return { ...now, hideEmpty: next.hideEmpty };
|
|
78
|
+
return { ...now, groups: groups.map((g) => ({ ...g, hidden: next.hidden.includes(g.key) })) };
|
|
79
|
+
}
|
|
80
|
+
export function groupEditorPropsOf(p, words) {
|
|
81
|
+
const { dimensions, group } = p, dated = datedIn(dimensions, group.value);
|
|
82
|
+
return {
|
|
83
|
+
label: p.label,
|
|
84
|
+
fields: dimensions.map((d) => ({ value: d.value, label: d.label })),
|
|
85
|
+
ownOrders: Object.fromEntries(dimensions.flatMap((d) => {
|
|
86
|
+
const own = d.orderOptions.find((o) => o.value === (d.granularities?.length ? "name" : "lifecycle"));
|
|
87
|
+
return own ? [[d.value, own.label]] : [];
|
|
88
|
+
})),
|
|
89
|
+
orders: Object.fromEntries(dimensions.map((d) => [d.value, d.orderOptions.map((o) => kitOrderOf(o.value, !!d.granularities?.length))])),
|
|
90
|
+
manualOrder: p.manualOrder,
|
|
91
|
+
steps: Object.fromEntries(dimensions.flatMap((d) => (d.granularities?.length ? [[d.value, [...d.granularities]]] : []))),
|
|
92
|
+
group: kitGroupOf(group, dated),
|
|
93
|
+
values: kitGroupValuesOf(group, words.noValue, dated),
|
|
94
|
+
onGroupChange: (next) => p.onGroupChange(viewKitGroupOf(next, group, dated)),
|
|
95
|
+
form: p.form,
|
|
96
|
+
words,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
export function MapGroupBody(props) {
|
|
100
|
+
const views = React.useContext(ViewsContext);
|
|
101
|
+
const messages = views?.messages ?? resolveViewsMessage;
|
|
102
|
+
const words = React.useMemo(() => groupEditorWordsOf(messages), [messages]);
|
|
103
|
+
const parts = useGroupEditor(groupEditorPropsOf(props, words));
|
|
104
|
+
useToldStep({ head: { onBack: parts.level?.back }, title: parts.level?.name }, props.onStepChange);
|
|
105
|
+
return _jsx(_Fragment, { children: parts.body });
|
|
106
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type PickerItem } from "../picker/rows.js";
|
|
2
|
+
import { type GroupEditorWords } from "./words.js";
|
|
3
|
+
export type GroupOrder = "field" | "name" | "count" | "own";
|
|
4
|
+
export type GroupDirection = "ascending" | "descending";
|
|
5
|
+
/** A list's group: the field it groups by (one level in, its path: company.industry), its order and direction, whether its empty
|
|
6
|
+
* groups are hidden, the groups in your own order (`placed`) and those hidden by their Switch, and a date field's step (`step`:
|
|
7
|
+
* Relative, Month…), absent for a field with none. */
|
|
8
|
+
export interface ListGroup {
|
|
9
|
+
field: string;
|
|
10
|
+
order: GroupOrder;
|
|
11
|
+
direction: GroupDirection;
|
|
12
|
+
hideEmpty: boolean;
|
|
13
|
+
placed: string[];
|
|
14
|
+
hidden: string[];
|
|
15
|
+
step?: string;
|
|
16
|
+
}
|
|
17
|
+
/** A group: a value of the field, its name, how many records it holds (never drawn; Count orders by it). */
|
|
18
|
+
export interface GroupValue {
|
|
19
|
+
value: string;
|
|
20
|
+
label: string;
|
|
21
|
+
count: number;
|
|
22
|
+
}
|
|
23
|
+
/** A new group by `field`: in its own order when its values have one, else by name; ascending; every group shown, none placed;
|
|
24
|
+
* a date's `step` held where handed. */
|
|
25
|
+
export declare function startGroup(field: string, ownOrder: boolean, hideEmpty?: boolean, step?: string): ListGroup;
|
|
26
|
+
/** The orders a field offers: its own first, named by `ownOrder` ("The stages' order"), where its values have one; then Name,
|
|
27
|
+
* Count and Your own; only those in `offered`, where its holder hands which it offers. */
|
|
28
|
+
export declare function groupOrders(ownOrder?: string, offered?: readonly GroupOrder[], words?: Pick<GroupEditorWords, "name" | "count" | "own">): {
|
|
29
|
+
value: GroupOrder;
|
|
30
|
+
label: string;
|
|
31
|
+
}[];
|
|
32
|
+
/** The groups in the order the list shows them. */
|
|
33
|
+
export declare function orderedGroups<V extends GroupValue>(values: V[], group: ListGroup): V[];
|
|
34
|
+
/** A group moved from its place to another, among the groups as the list shows them: the order becomes your own. A place off the
|
|
35
|
+
* list moves nothing (internal/reorder.ts' `moved`, written here so the rules load no React). */
|
|
36
|
+
export declare function moveGroup(group: ListGroup, values: GroupValue[], from: number, to: number): ListGroup;
|
|
37
|
+
/** A group shown or hidden by its Switch. */
|
|
38
|
+
export declare function setGroupShown(group: ListGroup, value: string, shown: boolean): ListGroup;
|
|
39
|
+
/** Every group hidden. */
|
|
40
|
+
export declare const hideAllGroups: (group: ListGroup, values: GroupValue[]) => ListGroup;
|
|
41
|
+
/** Every group shown. */
|
|
42
|
+
export declare const showAllGroups: (group: ListGroup) => ListGroup;
|
|
43
|
+
/** Whether no group shows. */
|
|
44
|
+
export declare const noneShown: (group: ListGroup, values: GroupValue[]) => boolean;
|
|
45
|
+
/** Whether Direction turns the order: every order but your own. */
|
|
46
|
+
export declare const directionTurns: (group: ListGroup) => boolean;
|
|
47
|
+
/** The group as its row and Customize's Group name it: its field, one level in by its path ("Company › Industry"); none, None. */
|
|
48
|
+
export declare function groupLabel(group: ListGroup | null, fields: PickerItem[], none?: string): string;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { itemLabel } from "../picker/rows.js";
|
|
2
|
+
import { GROUP_EDITOR_WORDS } from "./words.js";
|
|
3
|
+
export function startGroup(field, ownOrder, hideEmpty = false, step) {
|
|
4
|
+
return { field, order: ownOrder ? "field" : "name", direction: "ascending", hideEmpty, placed: [], hidden: [], ...(step !== undefined && { step }) };
|
|
5
|
+
}
|
|
6
|
+
export function groupOrders(ownOrder, offered, words = GROUP_EDITOR_WORDS) {
|
|
7
|
+
const all = [...(ownOrder ? [{ value: "field", label: ownOrder }] : []), { value: "name", label: words.name }, { value: "count", label: words.count }, { value: "own", label: words.own }];
|
|
8
|
+
return offered ? all.filter((o) => offered.includes(o.value)) : all;
|
|
9
|
+
}
|
|
10
|
+
const byName = (a, b) => a.label.localeCompare(b.label, undefined, { sensitivity: "base" }) || (a.value < b.value ? -1 : a.value > b.value ? 1 : 0);
|
|
11
|
+
export function orderedGroups(values, group) {
|
|
12
|
+
if (group.order === "own") {
|
|
13
|
+
const at = new Map(values.map((v) => [v.value, v]));
|
|
14
|
+
const placed = [...new Set(group.placed)].flatMap((p) => { const v = at.get(p); return v ? [v] : []; });
|
|
15
|
+
const kept = new Set(placed.map((v) => v.value));
|
|
16
|
+
return [...placed, ...values.filter((v) => !kept.has(v.value)).sort(byName)];
|
|
17
|
+
}
|
|
18
|
+
const sign = group.direction === "descending" ? -1 : 1;
|
|
19
|
+
if (group.order === "field")
|
|
20
|
+
return sign > 0 ? [...values] : [...values].reverse();
|
|
21
|
+
if (group.order === "count")
|
|
22
|
+
return [...values].sort((a, b) => (a.count - b.count) * sign || byName(a, b));
|
|
23
|
+
return [...values].sort((a, b) => byName(a, b) * sign);
|
|
24
|
+
}
|
|
25
|
+
export function moveGroup(group, values, from, to) {
|
|
26
|
+
const shown = orderedGroups(values, group).map((v) => v.value);
|
|
27
|
+
if (from !== to && from >= 0 && to >= 0 && from < shown.length && to < shown.length)
|
|
28
|
+
shown.splice(to, 0, ...shown.splice(from, 1));
|
|
29
|
+
return { ...group, order: "own", placed: shown };
|
|
30
|
+
}
|
|
31
|
+
export function setGroupShown(group, value, shown) {
|
|
32
|
+
const hidden = group.hidden.filter((h) => h !== value);
|
|
33
|
+
return { ...group, hidden: shown ? hidden : [...hidden, value] };
|
|
34
|
+
}
|
|
35
|
+
export const hideAllGroups = (group, values) => ({ ...group, hidden: values.map((v) => v.value) });
|
|
36
|
+
export const showAllGroups = (group) => ({ ...group, hidden: [] });
|
|
37
|
+
export const noneShown = (group, values) => values.every((v) => group.hidden.includes(v.value));
|
|
38
|
+
export const directionTurns = (group) => group.order !== "own";
|
|
39
|
+
export function groupLabel(group, fields, none = GROUP_EDITOR_WORDS.none) {
|
|
40
|
+
return group ? itemLabel(fields, group.field) : none;
|
|
41
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const GROUP_EDITOR_TOKENS: readonly [{
|
|
2
|
+
readonly name: "--vk-font-size-sm";
|
|
3
|
+
readonly kind: "size";
|
|
4
|
+
readonly outright: "--text-sm";
|
|
5
|
+
}, {
|
|
6
|
+
readonly name: "--vk-line-height-sm";
|
|
7
|
+
readonly kind: "size";
|
|
8
|
+
readonly outright: "--text-sm--line-height";
|
|
9
|
+
}, {
|
|
10
|
+
readonly name: "--vk-spacing";
|
|
11
|
+
readonly kind: "size";
|
|
12
|
+
readonly outright: "--spacing";
|
|
13
|
+
}];
|
|
14
|
+
/** The prefixes of the group editor's own machinery, set and read by it alone: none. */
|
|
15
|
+
export declare const GROUP_EDITOR_PRIVATE: readonly [];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const GROUP_EDITOR_TOKENS = [
|
|
2
|
+
{ name: "--vk-font-size-sm", kind: "size", outright: "--text-sm" },
|
|
3
|
+
{ name: "--vk-line-height-sm", kind: "size", outright: "--text-sm--line-height" },
|
|
4
|
+
{ name: "--vk-spacing", kind: "size", outright: "--spacing" },
|
|
5
|
+
];
|
|
6
|
+
export const GROUP_EDITOR_PRIVATE = [];
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { MenuListWords } from "../menu-list/menu-list.js";
|
|
2
|
+
import type { PickerWords } from "../picker/picker.js";
|
|
3
|
+
export interface GroupEditorWords {
|
|
4
|
+
/** The setting that picks the field grouped by, and its level's name. */
|
|
5
|
+
groupBy: string;
|
|
6
|
+
/** The setting that picks the order, and its level's name. */
|
|
7
|
+
order: string;
|
|
8
|
+
/** The setting that turns the order, and its level's name. */
|
|
9
|
+
direction: string;
|
|
10
|
+
/** A date field's setting that picks its step (Relative, Month…), and its level's name. */
|
|
11
|
+
dateStep: string;
|
|
12
|
+
ascending: string;
|
|
13
|
+
descending: string;
|
|
14
|
+
/** The orders: by name, by count, your own. A field's own order is named by its holder. */
|
|
15
|
+
name: string;
|
|
16
|
+
count: string;
|
|
17
|
+
own: string;
|
|
18
|
+
/** Why Direction is greyed under your own order. */
|
|
19
|
+
ownNoDirection: string;
|
|
20
|
+
hideEmpty: string;
|
|
21
|
+
/** The groups' heading, and their list's name. */
|
|
22
|
+
groups: string;
|
|
23
|
+
hideAll: string;
|
|
24
|
+
showAll: string;
|
|
25
|
+
remove: string;
|
|
26
|
+
/** What Group by says ungrouped. */
|
|
27
|
+
none: string;
|
|
28
|
+
/** The fields' search, before anything is typed. */
|
|
29
|
+
search: string;
|
|
30
|
+
/** The empty group's name. */
|
|
31
|
+
noValue: string;
|
|
32
|
+
/** The lists' own words (the Picker's). */
|
|
33
|
+
picker?: Partial<PickerWords>;
|
|
34
|
+
/** The rows' own words (the Menu list's: a group's grip, how the groups move, a Switch's two words). */
|
|
35
|
+
list?: Partial<MenuListWords>;
|
|
36
|
+
}
|
|
37
|
+
export declare const GROUP_EDITOR_WORDS: GroupEditorWords;
|
|
38
|
+
/** The group editor's words: the handed ones over the English. */
|
|
39
|
+
export declare const groupWords: (given?: Partial<GroupEditorWords>) => GroupEditorWords;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const GROUP_EDITOR_WORDS = {
|
|
2
|
+
groupBy: "Group by",
|
|
3
|
+
order: "Order",
|
|
4
|
+
direction: "Direction",
|
|
5
|
+
dateStep: "Date step",
|
|
6
|
+
ascending: "Ascending",
|
|
7
|
+
descending: "Descending",
|
|
8
|
+
name: "Name",
|
|
9
|
+
count: "Count",
|
|
10
|
+
own: "Your own",
|
|
11
|
+
ownNoDirection: "Your own order has no direction",
|
|
12
|
+
hideEmpty: "Hide empty groups",
|
|
13
|
+
groups: "Groups",
|
|
14
|
+
hideAll: "Hide all",
|
|
15
|
+
showAll: "Show all",
|
|
16
|
+
remove: "Remove grouping",
|
|
17
|
+
none: "None",
|
|
18
|
+
search: "Search fields",
|
|
19
|
+
noValue: "No value",
|
|
20
|
+
};
|
|
21
|
+
export const groupWords = (given) => (given ? { ...GROUP_EDITOR_WORDS, ...given } : GROUP_EDITOR_WORDS);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* The group editor: a body (KIT-671; ViewKit's since VK-839), as the toolbar's map draws it (step 3, parts 57 and 58) on the canvas's round 12. Every value
|
|
2
|
+
is a public --vk-* name (group-editor/tokens.ts); this file only lays out its own parts: its blocks one under another, and the groups' heading with Hide
|
|
3
|
+
all at its end. The kit's components inside it (the Menu list's rows, the Picker, the Button) are drawn by their own files, as they
|
|
4
|
+
are. On a computer it stands in the Pane's body; on a phone (data-group-form="phone") in the Sheet's body, a step of it.
|
|
5
|
+
The rules sit in the components layer, so a utility class still wins. */
|
|
6
|
+
@layer components {
|
|
7
|
+
|
|
8
|
+
/* ── What it holds, one under another ── */
|
|
9
|
+
.o-group-editor, .o-group-editor-step { display: flex; flex-direction: column; gap: calc(var(--vk-spacing) * 1); min-width: 0; }
|
|
10
|
+
.o-group-editor[data-group-form="phone"], .o-group-editor[data-group-form="phone"] .o-group-editor-step { gap: calc(var(--vk-spacing) * 3); }
|
|
11
|
+
|
|
12
|
+
/* ── The groups' heading, Hide all at its end ── */
|
|
13
|
+
.o-group-editor-heading { display: flex; align-items: center; justify-content: space-between; gap: calc(var(--vk-spacing) * 2); margin-top: calc(var(--vk-spacing) * 1); padding-right: calc(var(--vk-spacing) * 2); }
|
|
14
|
+
.o-group-editor-heading > .o-list-heading { flex: 1; min-width: 0; }
|
|
15
|
+
[data-group-form="phone"] .o-group-editor-heading { margin-top: calc(var(--vk-spacing) * 2); padding: 0 calc(var(--vk-spacing) * 1); }
|
|
16
|
+
[data-group-form="phone"] .o-group-editor-heading > .o-list-heading { padding: 0; font-size: var(--vk-font-size-sm); line-height: calc(var(--vk-font-size-sm) * var(--vk-line-height-sm)); }
|
|
17
|
+
|
|
18
|
+
/* ── Group by's fields, the Picker standing in its place ── */
|
|
19
|
+
.o-group-editor-fields { display: flex; flex-direction: column; min-width: 0; }
|
|
20
|
+
}
|
|
@@ -40,7 +40,7 @@ export { GRIP, GRIP_LOOK, Grip } from "./grip/grip.js";
|
|
|
40
40
|
export { useHoldDrag, type HoldDragProps, type HoldReads } from "./internal/hold.js";
|
|
41
41
|
export { dragAt, gapOf, moved, useReorder, type ReorderDrag, type RowEdges } from "./internal/reorder.js";
|
|
42
42
|
export { rowFor, rowStarting } from "./menu-list/keys.js";
|
|
43
|
-
export { MenuList, MenuListPanelRows, MenuListRow, MenuListRows, MenuListShown, MenuScroll, menuListCloseOf, menuListRowsOf, sheetFormOf, tilesOf, useMenuListOption, useMenuListRows, type MenuChoice, type MenuEntry, type MenuListEntry, type MenuListPanelRowsProps, type MenuListProps, type MenuListTile, } from "./menu-list/menu-list.js";
|
|
43
|
+
export { MENU_LIST_WORDS, MenuList, MenuListPanelRows, MenuListRow, MenuListRows, MenuListShown, MenuScroll, menuListCloseOf, menuListRowsOf, sheetFormOf, tilesOf, useMenuListOption, useMenuListRows, type MenuChoice, type MenuEntry, type MenuListEntry, type MenuListPanelRowsProps, type MenuListProps, type MenuListTile, type MenuListWords, } from "./menu-list/menu-list.js";
|
|
44
44
|
export { COMPUTER_HOST, ComputerHost, PHONE_MARK, PhoneHost, PhoneLine, phoneMark, usePhone, usePhoneForm } from "./internal/phone.js";
|
|
45
45
|
export { drawnAt, focusWhereItStands, focusesInPlace, holdsThePage, keepsToItsList, overflows, scaleOf, scrollInList, scrollTopFor, scrollTopForDrag, staysInView, tapsInPlace, typesInto, } from "./internal/scroll.js";
|
|
46
46
|
export { ContextMenu, Menu, MenuDots, useSheetMenus, type MenuChangeDetails, type MenuProps, type MenuWords, } from "./menu/menu.js";
|
|
@@ -53,6 +53,29 @@ export { Select, SelectShown, toPickerItems, type SelectAloneProps, type SelectI
|
|
|
53
53
|
export { listSide, type ListSide } from "./select/side.js";
|
|
54
54
|
export { chipsThatFit } from "./select/fit.js";
|
|
55
55
|
export { filledMatch } from "./select/filled.js";
|
|
56
|
+
export { Pane, PaneBody, PaneClose, PaneFoot, PaneHead, PaneTitle, paneAfter, usePane, type PaneChangeDetails, type PaneCloseReason, type PanePress, type PaneProps, type PaneState } from "./pane/pane.js";
|
|
57
|
+
export { Radio, RadioGroup, type RadioGroupProps, type RadioProps } from "./radio/radio.js";
|
|
58
|
+
export { sortableFields, useSortEditor as useSortEditorParts, type SortEditorOpens, type SortEditorParts, type SortEditorProps } from "./sort-editor/sort-editor.js";
|
|
59
|
+
export { SORT_MAX, addSort, canAddSort, dropAside, openPlaces, putBack, repoint, sortLabel, sortedFields, takenBy, type FieldOf, type SortAside } from "./sort-editor/rules.js";
|
|
60
|
+
export { SORT_EDITOR_WORDS, sortWords, type SortEditorWords } from "./sort-editor/words.js";
|
|
61
|
+
export { LOCK, useViewsList, useViewsListWorn, ViewsList, type ViewsListParts } from "./views-list/views-list.js";
|
|
62
|
+
export { JUST_ME, listed, SHARED, type ListView, type ViewsListChange, type ViewsListLayout } from "./views-list/rules.js";
|
|
63
|
+
export { VIEWS_LIST_ATTRS, viewsListWornOf, type ViewsListWorn } from "./views-list/looks.js";
|
|
64
|
+
export { VIEWS_LIST_WORDS, viewsListWords, type ViewsListWords } from "./views-list/words.js";
|
|
65
|
+
export { useFilterEditor as useFilterEditorParts, type FilterEditorParts, type FilterEditorProps, type FilterOwn } from "./filter-editor/filter-editor.js";
|
|
66
|
+
export { FILTER_SEARCH, FilterPartBody, PairValue, valuePlaceholder, type FilterPart, type FilterPartProps } from "./filter-editor/parts.js";
|
|
67
|
+
export { CHECKED, HOW, wayOf, type FilterField, type FilterWay, type Takes } from "./filter-editor/how.js";
|
|
68
|
+
export { FILTER_DEPTH, NO_FILTER, OWN_WAY, addRule, barOf, canGroup, changeRule, clearAll, depthOf, fieldOf, idsOf, isAdvanced, isGroup, isOwnWay, isPair, isSetAside, isWhole, itemOf, removeRule, ruleText, rulesOf, setGroup, setJoin, takesOf, toAdvanced, toGroup, valueText, type BarFilter, type FilterAside } from "./filter-editor/rules.js";
|
|
69
|
+
export { FILTER_EDITOR_WORDS, filterWords, type FilterEditorWords } from "./filter-editor/words.js";
|
|
70
|
+
export { useGroupEditor, type GroupEditorLevel, type GroupEditorParts, type GroupEditorProps, type GroupEditorValue } from "./group-editor/group-editor.js";
|
|
71
|
+
export { directionTurns, groupLabel, groupOrders, hideAllGroups, moveGroup, noneShown, orderedGroups, setGroupShown, showAllGroups, startGroup, type GroupDirection, type GroupOrder, type GroupValue } from "./group-editor/rules.js";
|
|
72
|
+
export { GROUP_EDITOR_WORDS, groupWords, type GroupEditorWords } from "./group-editor/words.js";
|
|
73
|
+
export { MODAL_WORDS, Modal, type ModalAction, type ModalFoot, type ModalProps, type ModalSize, type ModalState, type ModalWords } from "./modal/modal.js";
|
|
74
|
+
export { ALERT_DIALOG_WORDS, AlertDialog, AlertDialogHost, AlertDialogPanel, confirm, type AlertDialogPanelProps, type AlertDialogProps, type AlertDialogWords } from "./alert-dialog/alert-dialog.js";
|
|
75
|
+
export { TOAST_WORDS, Toast, ToastShown, createToastManager, useToast, type ToastManager, type ToastOptions, type ToastWords } from "./toast/toast.js";
|
|
76
|
+
export { Collapsible, CollapsiblePanel, CollapsibleTrigger, type CollapsiblePanelProps, type CollapsibleProps, type CollapsibleTriggerProps } from "./collapsible/collapsible.js";
|
|
77
|
+
export { ALERT_WORDS, Alert, type AlertAsk, type AlertKind, type AlertProps, type AlertState, type AlertWords } from "./alert/alert.js";
|
|
78
|
+
export { NOTICE_ICONS, NOTICE_WORDS, Notice, type NoticeAction, type NoticeMeaning, type NoticeProps, type NoticeWords } from "./notice/notice.js";
|
|
56
79
|
export { useTextEditor, type TextEditorParts } from "./text-editor/text-editor.js";
|
|
57
80
|
export { TEXT_KEYS, enterDoes, kept, lineOf, midWord, ownChange, textRefusal, tidy, type TextKeys, type TextKind } from "./text-editor/check.js";
|
|
58
81
|
export { DIALS, countryName, dialOf, exampleOf, patternOf, phoneHanded, phoneOf, phoneParts, type Dial } from "./text-editor/phone-number.js";
|
|
@@ -73,3 +96,14 @@ export type { Range } from "./compound-editor/range.js";
|
|
|
73
96
|
export { compoundEditorRead, compoundEditorWornOf, type CompoundEditorWorn } from "./compound-editor/looks.js";
|
|
74
97
|
export { COMPOUND_EDITOR_WORDS, compoundWords, type CompoundEditorWords } from "./compound-editor/words.js";
|
|
75
98
|
export { Flag } from "./flag/flag.js";
|
|
99
|
+
export { useNumberEditor, useNumberEditorWorn, type NumberEditorParts, type NumberEditorProps } from "./number-editor/number-editor.js";
|
|
100
|
+
export { boxLocale, numberText, readTyped, type Currency, type NumberKind, type Unit, type Units } from "./number-editor/format.js";
|
|
101
|
+
export { NUMBER_EDITOR_ATTRS, numberEditorWornOf, type NumberEditorWorn } from "./number-editor/looks.js";
|
|
102
|
+
export { NUMBER_EDITOR_WORDS, numberWords, type NumberEditorWords } from "./number-editor/words.js";
|
|
103
|
+
export { ValuesEditor, useValuesEditor, useValuesEditorWorn, type ValuesEditorParts, type ValuesEditorProps } from "./values-editor/values-editor.js";
|
|
104
|
+
export { LABELS, added, charsThatFit, labelFor, listOf, openOf, splitEmail, valuesText, type DialCode, type ListedValue, type ValuesKind } from "./values-editor/values.js";
|
|
105
|
+
export { VALUES_EDITOR_ATTRS, valuesEditorWornOf, type ValuesEditorWorn } from "./values-editor/looks.js";
|
|
106
|
+
export { VALUES_EDITOR_WORDS, valuesWords, type ValuesEditorWords } from "./values-editor/words.js";
|
|
107
|
+
export { LinksEditor, useLinksEditor, type LinksEditorAction, type LinksEditorLead, type LinksEditorOpens, type LinksEditorParts, type LinksEditorProps, } from "./links-editor/links-editor.js";
|
|
108
|
+
export { found, heldOf, leadAfter, offered, removed, said, saidShort, setValue, ticked, type LinkChoice, type LinkField, type LinkFieldKind, type LinkValue, } from "./links-editor/links.js";
|
|
109
|
+
export { LINKS_EDITOR_WORDS, linksWords, type LinksEditorWords } from "./links-editor/words.js";
|
|
@@ -34,7 +34,7 @@ export { GRIP, GRIP_LOOK, Grip } from "./grip/grip.js";
|
|
|
34
34
|
export { useHoldDrag } from "./internal/hold.js";
|
|
35
35
|
export { dragAt, gapOf, moved, useReorder } from "./internal/reorder.js";
|
|
36
36
|
export { rowFor, rowStarting } from "./menu-list/keys.js";
|
|
37
|
-
export { MenuList, MenuListPanelRows, MenuListRow, MenuListRows, MenuListShown, MenuScroll, menuListCloseOf, menuListRowsOf, sheetFormOf, tilesOf, useMenuListOption, useMenuListRows, } from "./menu-list/menu-list.js";
|
|
37
|
+
export { MENU_LIST_WORDS, MenuList, MenuListPanelRows, MenuListRow, MenuListRows, MenuListShown, MenuScroll, menuListCloseOf, menuListRowsOf, sheetFormOf, tilesOf, useMenuListOption, useMenuListRows, } from "./menu-list/menu-list.js";
|
|
38
38
|
export { COMPUTER_HOST, ComputerHost, PHONE_MARK, PhoneHost, PhoneLine, phoneMark, usePhone, usePhoneForm } from "./internal/phone.js";
|
|
39
39
|
export { drawnAt, focusWhereItStands, focusesInPlace, holdsThePage, keepsToItsList, overflows, scaleOf, scrollInList, scrollTopFor, scrollTopForDrag, staysInView, tapsInPlace, typesInto, } from "./internal/scroll.js";
|
|
40
40
|
export { ContextMenu, Menu, MenuDots, useSheetMenus, } from "./menu/menu.js";
|
|
@@ -47,6 +47,29 @@ export { Select, SelectShown, toPickerItems, } from "./select/select.js";
|
|
|
47
47
|
export { listSide } from "./select/side.js";
|
|
48
48
|
export { chipsThatFit } from "./select/fit.js";
|
|
49
49
|
export { filledMatch } from "./select/filled.js";
|
|
50
|
+
export { Pane, PaneBody, PaneClose, PaneFoot, PaneHead, PaneTitle, paneAfter, usePane } from "./pane/pane.js";
|
|
51
|
+
export { Radio, RadioGroup } from "./radio/radio.js";
|
|
52
|
+
export { sortableFields, useSortEditor as useSortEditorParts } from "./sort-editor/sort-editor.js";
|
|
53
|
+
export { SORT_MAX, addSort, canAddSort, dropAside, openPlaces, putBack, repoint, sortLabel, sortedFields, takenBy } from "./sort-editor/rules.js";
|
|
54
|
+
export { SORT_EDITOR_WORDS, sortWords } from "./sort-editor/words.js";
|
|
55
|
+
export { LOCK, useViewsList, useViewsListWorn, ViewsList } from "./views-list/views-list.js";
|
|
56
|
+
export { JUST_ME, listed, SHARED } from "./views-list/rules.js";
|
|
57
|
+
export { VIEWS_LIST_ATTRS, viewsListWornOf } from "./views-list/looks.js";
|
|
58
|
+
export { VIEWS_LIST_WORDS, viewsListWords } from "./views-list/words.js";
|
|
59
|
+
export { useFilterEditor as useFilterEditorParts } from "./filter-editor/filter-editor.js";
|
|
60
|
+
export { FILTER_SEARCH, FilterPartBody, PairValue, valuePlaceholder } from "./filter-editor/parts.js";
|
|
61
|
+
export { CHECKED, HOW, wayOf } from "./filter-editor/how.js";
|
|
62
|
+
export { FILTER_DEPTH, NO_FILTER, OWN_WAY, addRule, barOf, canGroup, changeRule, clearAll, depthOf, fieldOf, idsOf, isAdvanced, isGroup, isOwnWay, isPair, isSetAside, isWhole, itemOf, removeRule, ruleText, rulesOf, setGroup, setJoin, takesOf, toAdvanced, toGroup, valueText } from "./filter-editor/rules.js";
|
|
63
|
+
export { FILTER_EDITOR_WORDS, filterWords } from "./filter-editor/words.js";
|
|
64
|
+
export { useGroupEditor } from "./group-editor/group-editor.js";
|
|
65
|
+
export { directionTurns, groupLabel, groupOrders, hideAllGroups, moveGroup, noneShown, orderedGroups, setGroupShown, showAllGroups, startGroup } from "./group-editor/rules.js";
|
|
66
|
+
export { GROUP_EDITOR_WORDS, groupWords } from "./group-editor/words.js";
|
|
67
|
+
export { MODAL_WORDS, Modal } from "./modal/modal.js";
|
|
68
|
+
export { ALERT_DIALOG_WORDS, AlertDialog, AlertDialogHost, AlertDialogPanel, confirm } from "./alert-dialog/alert-dialog.js";
|
|
69
|
+
export { TOAST_WORDS, Toast, ToastShown, createToastManager, useToast } from "./toast/toast.js";
|
|
70
|
+
export { Collapsible, CollapsiblePanel, CollapsibleTrigger } from "./collapsible/collapsible.js";
|
|
71
|
+
export { ALERT_WORDS, Alert } from "./alert/alert.js";
|
|
72
|
+
export { NOTICE_ICONS, NOTICE_WORDS, Notice } from "./notice/notice.js";
|
|
50
73
|
export { useTextEditor } from "./text-editor/text-editor.js";
|
|
51
74
|
export { TEXT_KEYS, enterDoes, kept, lineOf, midWord, ownChange, textRefusal, tidy } from "./text-editor/check.js";
|
|
52
75
|
export { DIALS, countryName, dialOf, exampleOf, patternOf, phoneHanded, phoneOf, phoneParts } from "./text-editor/phone-number.js";
|
|
@@ -66,3 +89,14 @@ export { ATTIO_ROWS, PLACE_PARTS, countriesOf, placeLine, placeOf, placeText, re
|
|
|
66
89
|
export { compoundEditorRead, compoundEditorWornOf } from "./compound-editor/looks.js";
|
|
67
90
|
export { COMPOUND_EDITOR_WORDS, compoundWords } from "./compound-editor/words.js";
|
|
68
91
|
export { Flag } from "./flag/flag.js";
|
|
92
|
+
export { useNumberEditor, useNumberEditorWorn } from "./number-editor/number-editor.js";
|
|
93
|
+
export { boxLocale, numberText, readTyped } from "./number-editor/format.js";
|
|
94
|
+
export { NUMBER_EDITOR_ATTRS, numberEditorWornOf } from "./number-editor/looks.js";
|
|
95
|
+
export { NUMBER_EDITOR_WORDS, numberWords } from "./number-editor/words.js";
|
|
96
|
+
export { ValuesEditor, useValuesEditor, useValuesEditorWorn } from "./values-editor/values-editor.js";
|
|
97
|
+
export { LABELS, added, charsThatFit, labelFor, listOf, openOf, splitEmail, valuesText } from "./values-editor/values.js";
|
|
98
|
+
export { VALUES_EDITOR_ATTRS, valuesEditorWornOf } from "./values-editor/looks.js";
|
|
99
|
+
export { VALUES_EDITOR_WORDS, valuesWords } from "./values-editor/words.js";
|
|
100
|
+
export { LinksEditor, useLinksEditor, } from "./links-editor/links-editor.js";
|
|
101
|
+
export { found, heldOf, leadAfter, offered, removed, said, saidShort, setValue, ticked, } from "./links-editor/links.js";
|
|
102
|
+
export { LINKS_EDITOR_WORDS, linksWords } from "./links-editor/words.js";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ButtonOwnLook } from "../button/own-look.js";
|
|
2
|
+
import { type PickerItem, type PickerProps } from "../picker/picker.js";
|
|
3
|
+
import type { SelectItem } from "../select/select.js";
|
|
4
|
+
import { type SheetHeadProps } from "../sheet/bottom-sheet.js";
|
|
5
|
+
/** A mark as the editors draw it: its paths on a 24 grid, in the words' colour. */
|
|
6
|
+
export declare const glyph: (paths: string[], className?: string) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
/** A dot of a mark, at x and y. */
|
|
8
|
+
export declare const dots: (x: number, y: number) => string;
|
|
9
|
+
export declare const X: string[], PLUS: string[], TICK: string[];
|
|
10
|
+
export declare const DOTS: string[];
|
|
11
|
+
export declare const TRASH: string[];
|
|
12
|
+
/** ⋯ on a phone, 40 × 44, the Button: no edge, its press the card's. */
|
|
13
|
+
export declare const DOTS_LOOK: ButtonOwnLook;
|
|
14
|
+
/** ⋮ in a narrow place (a rule's row in the Pane), 28, quiet and faint. */
|
|
15
|
+
export declare const DOTS_UP: string[];
|
|
16
|
+
export declare const MORE_LOOK: ButtonOwnLook;
|
|
17
|
+
/** A list's rows as the Select takes them: each its mark, its line, "you", greyed where it can't be picked, one level in too. */
|
|
18
|
+
export declare const asSelect: (items: PickerItem[]) => SelectItem[];
|
|
19
|
+
/** A Picker in a full Sheet on top of the editor's, its name the title: a link's field. `onGone` once its Sheet has gone, so what
|
|
20
|
+
* holds it can drop it then. The Picker's words come in its props (`picker.words`), its head's ✕ and ‹ names in `words`. */
|
|
21
|
+
export declare function OnTop({ open, onOpenChange, onGone, title, picker, container, standing, words }: {
|
|
22
|
+
open: boolean;
|
|
23
|
+
onOpenChange: (open: boolean) => void;
|
|
24
|
+
onGone: () => void;
|
|
25
|
+
title: string;
|
|
26
|
+
picker: Omit<PickerProps, "form" | "onDone">;
|
|
27
|
+
container?: HTMLElement | null;
|
|
28
|
+
standing: boolean;
|
|
29
|
+
words?: SheetHeadProps["words"];
|
|
30
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
/** The room a list a page shows standing open needs, on a computer: it stands over the rows under what opens it (`selector`, in
|
|
32
|
+
* the editor's body `root`), and the body grows by what it runs past, since the Popover round the body cuts it. Read again as
|
|
33
|
+
* the list resizes, and whenever one of `again` changes. Nothing on a phone. */
|
|
34
|
+
export declare function useStandingRoom(root: HTMLElement | null, selector: string, phone: boolean, again: readonly unknown[]): number;
|
|
35
|
+
/** On a phone, the Sheet head's ✕ and ✓ round an editor whose every change is handed on as it is made: ✕ takes what it holds
|
|
36
|
+
* back to what it held as its body was placed (the Sheet opening on it, which mounts the body afresh each time), then closes; ✓
|
|
37
|
+
* keeps it, as it is already. `place` is handed the body's element as it comes and goes; `now` is what it holds, a change ahead
|
|
38
|
+
* of the next render; `words` the two buttons' names. */
|
|
39
|
+
export declare function useDecide<T>(now: {
|
|
40
|
+
current: T;
|
|
41
|
+
}, change: (was: T) => void, onDone?: () => void, words?: {
|
|
42
|
+
close: string;
|
|
43
|
+
save: string;
|
|
44
|
+
}): {
|
|
45
|
+
place: (el: HTMLElement | null) => void;
|
|
46
|
+
head: Pick<SheetHeadProps, "left" | "right">;
|
|
47
|
+
};
|