viewkitjs 0.28.0 → 0.29.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 +107 -0
- package/MIGRATION.md +85 -4
- package/fields/dist/derived.d.ts +2 -1
- package/fields/dist/derived.js +9 -3
- package/fields/dist/entities.js +41 -3
- package/fields/dist/index.d.ts +1 -1
- package/fields/dist/index.js +1 -1
- package/fields/dist/messages.d.ts +8 -2
- package/fields/dist/messages.js +3 -0
- package/fields/dist/range.d.ts +6 -0
- package/fields/dist/range.js +8 -0
- package/fields/dist/registry.js +11 -1
- package/fields/dist/spec-changes.js +1 -0
- package/fields/dist/types.d.ts +23 -1
- package/fields/docs/guides/derived-fields.md +7 -5
- package/fields/docs/guides/field-types.md +2 -2
- package/fields/docs/guides/the-index.md +1 -1
- package/fields/docs/reference/fields.md +3 -1
- package/fields/docs/reference/types.md +3 -1
- package/fields/skills/viewkit/SKILL.md +1 -1
- package/package.json +2 -1
- package/postgres/dist/definitions/build.js +29 -5
- package/postgres/dist/definitions/label.d.ts +7 -0
- package/postgres/dist/definitions/label.js +9 -1
- package/postgres/dist/definitions/lookup.js +6 -2
- package/postgres/dist/definitions/place.d.ts +6 -3
- package/postgres/dist/definitions/rollup.js +5 -1
- package/postgres/dist/definitions/storage.d.ts +15 -0
- package/postgres/dist/definitions/storage.js +52 -1
- package/postgres/dist/definitions/stored.js +21 -0
- package/postgres/dist/phone.d.ts +13 -1
- package/postgres/dist/phone.js +23 -3
- package/postgres/dist/search-indexes.d.ts +6 -1
- package/postgres/dist/search-indexes.js +71 -25
- package/postgres/dist/search.js +3 -3
- package/postgres/docs/guides/definitions.md +22 -5
- package/postgres/docs/guides/field-map.md +5 -4
- package/postgres/docs/reference/definitions.md +3 -3
- package/postgres/docs/reference/postgres.md +1 -1
- package/views/dist/cells/cell-format.js +2 -2
- package/views/dist/cells/cell-values.js +9 -10
- package/views/dist/contract.d.ts +149 -3
- package/views/dist/contract.js +157 -1
- package/views/dist/controls/bulk-bar/bulk-bar-of.d.ts +66 -0
- package/views/dist/controls/bulk-bar/bulk-bar-of.js +22 -0
- package/views/dist/controls/bulk-bar/bulk-bar.d.ts +40 -0
- package/views/dist/controls/bulk-bar/bulk-bar.js +278 -0
- package/views/dist/controls/bulk-bar/looks.d.ts +10 -0
- package/views/dist/controls/bulk-bar/looks.js +14 -0
- package/views/dist/controls/bulk-bar/map-selection-bar.d.ts +19 -0
- package/views/dist/controls/bulk-bar/map-selection-bar.js +57 -0
- package/views/dist/controls/bulk-bar/tokens.d.ts +136 -0
- package/views/dist/controls/bulk-bar/tokens.js +36 -0
- package/views/dist/controls/bulk-bar/words.d.ts +50 -0
- package/views/dist/controls/bulk-bar/words.js +19 -0
- package/views/dist/controls/bulk-bar.css +96 -0
- package/views/dist/controls/button/button.js +3 -1
- package/views/dist/controls/button.css +5 -4
- package/views/dist/controls/checkbox/checkbox.js +3 -1
- package/views/dist/controls/checkbox.css +1 -1
- package/views/dist/controls/choice/tokens.d.ts +79 -0
- package/views/dist/controls/choice/tokens.js +22 -0
- package/views/dist/controls/choice.css +31 -0
- package/views/dist/controls/compound-editor/looks.js +1 -1
- package/views/dist/controls/controls.d.ts +10 -0
- package/views/dist/controls/controls.js +8 -0
- package/views/dist/controls/customize/customize.d.ts +125 -0
- package/views/dist/controls/customize/customize.js +243 -0
- package/views/dist/controls/customize/glide.d.ts +10 -0
- package/views/dist/controls/customize/glide.js +55 -0
- package/views/dist/controls/customize/looks.d.ts +13 -0
- package/views/dist/controls/customize/looks.js +11 -0
- package/views/dist/controls/customize/map-customize-body.d.ts +18 -0
- package/views/dist/controls/customize/map-customize-body.js +160 -0
- package/views/dist/controls/customize/rules.d.ts +23 -0
- package/views/dist/controls/customize/rules.js +19 -0
- package/views/dist/controls/customize/tokens.d.ts +40 -0
- package/views/dist/controls/customize/tokens.js +12 -0
- package/views/dist/controls/customize/words.d.ts +58 -0
- package/views/dist/controls/customize/words.js +37 -0
- package/views/dist/controls/customize.css +54 -0
- package/views/dist/controls/date-editor/looks.js +1 -1
- package/views/dist/controls/filter-editor/block.d.ts +31 -0
- package/views/dist/controls/filter-editor/block.js +27 -0
- package/views/dist/controls/filter-editor/filter-editor.d.ts +2 -0
- package/views/dist/controls/filter-editor/filter-editor.js +85 -43
- package/views/dist/controls/filter-editor/how.d.ts +1 -1
- package/views/dist/controls/filter-editor/how.js +1 -0
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +16 -1
- package/views/dist/controls/filter-editor/map-filter-body.js +39 -13
- package/views/dist/controls/filter-editor/map-rules.d.ts +27 -11
- package/views/dist/controls/filter-editor/map-rules.js +73 -42
- package/views/dist/controls/filter-editor/rules.d.ts +43 -5
- package/views/dist/controls/filter-editor/rules.js +55 -2
- package/views/dist/controls/filter-editor/words.d.ts +15 -0
- package/views/dist/controls/filter-editor/words.js +6 -0
- package/views/dist/controls/filter-editor.css +18 -0
- package/views/dist/controls/index.d.ts +26 -2
- package/views/dist/controls/index.js +25 -2
- package/views/dist/controls/inline-input/looks.js +1 -1
- package/views/dist/controls/input/input.js +10 -4
- package/views/dist/controls/internal/phone.d.ts +5 -4
- package/views/dist/controls/internal/phone.js +7 -7
- package/views/dist/controls/internal/scroll.js +5 -1
- package/views/dist/controls/internal/typed-run.d.ts +2 -0
- package/views/dist/controls/internal/typed-run.js +5 -0
- package/views/dist/controls/menu/map-menu.js +2 -2
- package/views/dist/controls/number-editor/looks.js +1 -1
- package/views/dist/controls/option/option.js +3 -1
- package/views/dist/controls/option.css +1 -1
- package/views/dist/controls/pane/pane.d.ts +4 -0
- package/views/dist/controls/pane/pane.js +2 -1
- package/views/dist/controls/picker/looks.js +1 -1
- package/views/dist/controls/picker/map-picker.d.ts +6 -2
- package/views/dist/controls/picker/map-picker.js +4 -2
- package/views/dist/controls/picker/picker.d.ts +7 -0
- package/views/dist/controls/picker/picker.js +57 -8
- package/views/dist/controls/popover/map-popover.d.ts +1 -1
- package/views/dist/controls/popover/map-popover.js +2 -2
- package/views/dist/controls/popover/popover.js +2 -1
- package/views/dist/controls/popover.css +3 -0
- package/views/dist/controls/ports-host/map-ports-host.d.ts +7 -0
- package/views/dist/controls/ports-host/map-ports-host.js +43 -0
- package/views/dist/controls/press/tokens.d.ts +8 -0
- package/views/dist/controls/press/tokens.js +4 -0
- package/views/dist/controls/press.css +44 -0
- package/views/dist/controls/quick-filters/looks.d.ts +11 -0
- package/views/dist/controls/quick-filters/looks.js +9 -0
- package/views/dist/controls/quick-filters/map-quick-filters-body.d.ts +31 -0
- package/views/dist/controls/quick-filters/map-quick-filters-body.js +56 -0
- package/views/dist/controls/quick-filters/quick-filters.d.ts +37 -0
- package/views/dist/controls/quick-filters/quick-filters.js +89 -0
- package/views/dist/controls/quick-filters/reminder.d.ts +18 -0
- package/views/dist/controls/quick-filters/reminder.js +41 -0
- package/views/dist/controls/quick-filters/rules.d.ts +89 -0
- package/views/dist/controls/quick-filters/rules.js +52 -0
- package/views/dist/controls/quick-filters/tokens.d.ts +112 -0
- package/views/dist/controls/quick-filters/tokens.js +30 -0
- package/views/dist/controls/quick-filters/words.d.ts +25 -0
- package/views/dist/controls/quick-filters/words.js +13 -0
- package/views/dist/controls/quick-filters.css +118 -0
- package/views/dist/controls/sheet/bottom-sheet.d.ts +9 -4
- package/views/dist/controls/sheet/bottom-sheet.js +4 -4
- package/views/dist/controls/sheet/map-sheet.d.ts +4 -1
- package/views/dist/controls/sheet/map-sheet.js +19 -6
- package/views/dist/controls/sheet/sheet-parts.d.ts +10 -0
- package/views/dist/controls/sheet/sheet-parts.js +2 -0
- package/views/dist/controls/switch-row/switch-row.d.ts +15 -0
- package/views/dist/controls/switch-row/switch-row.js +9 -0
- package/views/dist/controls/switch-row/tokens.d.ts +51 -0
- package/views/dist/controls/switch-row/tokens.js +15 -0
- package/views/dist/controls/switch-row.css +39 -0
- package/views/dist/controls/switch.css +1 -1
- package/views/dist/controls/tag/tag.js +3 -1
- package/views/dist/controls/tag-field/tag-field.d.ts +20 -0
- package/views/dist/controls/tag-field/tag-field.js +19 -0
- package/views/dist/controls/tag-field/tokens.d.ts +7 -0
- package/views/dist/controls/tag-field/tokens.js +4 -0
- package/views/dist/controls/tag-field.css +13 -0
- package/views/dist/controls/text-editor/looks.js +1 -1
- package/views/dist/controls/text-editor/text-editor.js +1 -5
- package/views/dist/controls/toast/toast.d.ts +5 -1
- package/views/dist/controls/toast/toast.js +5 -3
- package/views/dist/controls/tokens.js +18 -0
- package/views/dist/controls/toolbar/keys.d.ts +3 -0
- package/views/dist/controls/toolbar/keys.js +11 -0
- package/views/dist/controls/toolbar/looks.d.ts +10 -0
- package/views/dist/controls/toolbar/looks.js +40 -0
- package/views/dist/controls/toolbar/tokens.d.ts +28 -0
- package/views/dist/controls/toolbar/tokens.js +9 -0
- package/views/dist/controls/toolbar/toolbar.d.ts +111 -0
- package/views/dist/controls/toolbar/toolbar.js +370 -0
- package/views/dist/controls/toolbar/words.d.ts +28 -0
- package/views/dist/controls/toolbar/words.js +17 -0
- package/views/dist/controls/toolbar-button/looks.d.ts +4 -0
- package/views/dist/controls/toolbar-button/looks.js +21 -0
- package/views/dist/controls/toolbar-button/tokens.d.ts +103 -0
- package/views/dist/controls/toolbar-button/tokens.js +28 -0
- package/views/dist/controls/toolbar-button/toolbar-button.d.ts +66 -0
- package/views/dist/controls/toolbar-button/toolbar-button.js +51 -0
- package/views/dist/controls/toolbar-button.css +75 -0
- package/views/dist/controls/toolbar.css +65 -0
- package/views/dist/controls/tooltip/map-tooltip.d.ts +1 -1
- package/views/dist/controls/tooltip/map-tooltip.js +2 -2
- package/views/dist/controls/tooltip/tooltip.d.ts +3 -1
- package/views/dist/controls/tooltip/tooltip.js +2 -2
- package/views/dist/controls/values-editor/looks.js +1 -1
- package/views/dist/controls/views-list/map-views-list-body.d.ts +4 -1
- package/views/dist/controls/views-list/map-views-list-body.js +128 -4
- package/views/dist/controls/views-list/rules.d.ts +26 -0
- package/views/dist/controls/views-list/rules.js +63 -0
- package/views/dist/controls/views-list/view-menu.d.ts +84 -0
- package/views/dist/controls/views-list/view-menu.js +201 -0
- package/views/dist/controls/views-list/views-list.d.ts +8 -1
- package/views/dist/controls/views-list/views-list.js +18 -3
- package/views/dist/controls/views-list/words.d.ts +54 -0
- package/views/dist/controls/views-list/words.js +10 -1
- package/views/dist/controls/views-list.css +5 -1
- package/views/dist/display/date.js +3 -3
- package/views/dist/display/format.d.ts +6 -0
- package/views/dist/display/format.js +3 -0
- package/views/dist/display/index.d.ts +1 -1
- package/views/dist/display/index.js +1 -1
- package/views/dist/display/range.d.ts +2 -1
- package/views/dist/display/range.js +4 -1
- package/views/dist/grid/chrome/GridHeader.js +2 -1
- package/views/dist/grid/chrome/GridNumberEditor.js +2 -2
- package/views/dist/grid/chrome/GridRowCells.js +2 -1
- package/views/dist/grid/chrome/GridTextEditor.js +2 -2
- package/views/dist/grid/chrome/grid-editor-layer.d.ts +5 -1
- package/views/dist/grid/chrome/grid-editor-layer.js +1 -0
- package/views/dist/grid/chrome/grid-fitted-box.d.ts +7 -1
- package/views/dist/grid/chrome/grid-fitted-box.js +4 -4
- package/views/dist/grid/core/clipboard-model.js +9 -4
- package/views/dist/grid/grid.css +240 -0
- package/views/dist/grid/looks.d.ts +5 -1
- package/views/dist/grid/looks.js +20 -12
- package/views/dist/grid-tokens.d.ts +109 -0
- package/views/dist/grid-tokens.js +29 -0
- package/views/dist/looks/index.d.ts +5 -0
- package/views/dist/looks/index.js +5 -0
- package/views/dist/looks/pieces.js +10 -0
- package/views/dist/model/column-capabilities.d.ts +2 -0
- package/views/dist/model/column-filters.d.ts +2 -1
- package/views/dist/model/column-from.js +2 -2
- package/views/dist/model/relation-filters.d.ts +2 -0
- package/views/dist/panels/index.d.ts +2 -2
- package/views/dist/panels/index.js +2 -2
- package/views/dist/panels/labels.d.ts +4 -0
- package/views/dist/panels/labels.js +8 -0
- package/views/dist/panels/model.d.ts +10 -2
- package/views/dist/panels/quick/model.d.ts +4 -0
- package/views/dist/panels/react/customize-body.d.ts +9 -4
- package/views/dist/panels/react/customize-body.js +39 -11
- package/views/dist/panels/react/customize.d.ts +8 -1
- package/views/dist/panels/react/customize.js +9 -6
- package/views/dist/panels/react/filter/FilterEditor.js +4 -4
- package/views/dist/panels/react/filter/FilterFieldList.js +10 -2
- package/views/dist/panels/react/filter/PhoneFilterEditor.js +3 -3
- package/views/dist/panels/react/filter/filter-body.js +5 -2
- package/views/dist/panels/react/panel-step.d.ts +3 -0
- package/views/dist/panels/react/panel-step.js +2 -1
- package/views/dist/panels/react/quick/QuickFiltersPanel.js +1 -0
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +13 -3
- package/views/dist/panels/react/toolbar/ReadyToolbar.js +10 -3
- package/views/dist/panels/react/toolbar/Toolbar.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarAsideFilter.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +13 -3
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +2 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +3 -3
- package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +12 -4
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +6 -2
- package/views/dist/panels/react/view-footer.d.ts +1 -1
- package/views/dist/panels/react/views-row/ViewPicker.js +25 -4
- package/views/dist/panels/settings/filter-groups.d.ts +3 -0
- package/views/dist/panels/settings/filter-groups.js +40 -9
- package/views/dist/panels/settings/filters.d.ts +5 -0
- package/views/dist/panels/settings/filters.js +12 -6
- package/views/dist/panels/views-row/model.d.ts +10 -1
- package/views/dist/provider/ViewsProvider.js +29 -5
- package/views/dist/provider/components.d.ts +149 -8
- package/views/dist/provider/context.d.ts +6 -0
- package/views/dist/provider/ports.d.ts +18 -6
- package/views/dist/provider/ports.js +2 -1
- package/views/dist/react.d.ts +2 -2
- package/views/dist/react.js +1 -1
- package/views/dist/selection/SelectionBar.d.ts +2 -16
- package/views/dist/selection/SelectionBar.js +4 -1
- package/views/dist/selection/bar-props.d.ts +26 -0
- package/views/dist/selection/bar-props.js +1 -0
- package/views/dist/selection/index.d.ts +1 -1
- package/views/dist/selection/verbs.d.ts +32 -5
- package/views/dist/styles.css +656 -25
- package/views/dist/styles.unlayered.css +653 -22
- package/views/docs/contract.md +44 -17
- package/views/docs/controls/bulk-bar.md +41 -0
- package/views/docs/controls/choice.md +25 -0
- package/views/docs/controls/customize.md +17 -0
- package/views/docs/controls/popover.md +2 -0
- package/views/docs/controls/press.md +9 -0
- package/views/docs/controls/quick-filters.md +35 -0
- package/views/docs/controls/radio.md +1 -1
- package/views/docs/controls/switch-row.md +18 -0
- package/views/docs/controls/tag-field.md +7 -0
- package/views/docs/controls/toolbar-button.md +31 -0
- package/views/docs/controls/toolbar.md +14 -0
- package/views/docs/guides/atoms.md +2 -2
- package/views/docs/guides/cells.md +2 -2
- package/views/docs/guides/display.md +2 -2
- package/views/docs/guides/looks.md +8 -2
- package/views/docs/guides/ports.md +6 -6
- package/views/docs/guides/selection.md +5 -1
- package/views/docs/guides/the-grid.md +1 -1
- package/views/docs/guides/the-provider.md +2 -2
- package/views/docs/install.md +4 -1
- package/views/docs/reference/cells.md +1 -1
- package/views/docs/reference/controls.md +194 -13
- package/views/docs/reference/display.md +1 -0
- package/views/docs/reference/looks.md +25 -11
- package/views/docs/reference/panels-react.md +7 -7
- package/views/docs/reference/panels.md +8 -6
- package/views/docs/reference/react.md +13 -6
- package/views/docs/reference/selection.md +4 -2
- package/views/docs/reference/views.md +7 -6
- package/views/skills/views/SKILL.md +2 -2
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Alert } from "../alert/alert.js";
|
|
4
|
+
import { AlertDialog } from "../alert-dialog/alert-dialog.js";
|
|
5
|
+
import { Button } from "../button/button.js";
|
|
6
|
+
import { Field } from "../field/field.js";
|
|
7
|
+
import { Input } from "../input/input.js";
|
|
8
|
+
import { asSelect, OnTop } from "../internal/editor-parts.js";
|
|
9
|
+
import { Icon } from "../internal/icons.js";
|
|
10
|
+
import { PhoneHost, usePhone } from "../internal/phone.js";
|
|
11
|
+
import { MENU_LIST_CARD_FRAME } from "../menu-list/looks.js";
|
|
12
|
+
import { MenuList, tilesOf, useMenuListOption, useMenuListRows } from "../menu-list/menu-list.js";
|
|
13
|
+
import { Modal } from "../modal/modal.js";
|
|
14
|
+
import { Picker } from "../picker/picker.js";
|
|
15
|
+
import { Radio, RadioGroup } from "../radio/radio.js";
|
|
16
|
+
import { Select } from "../select/select.js";
|
|
17
|
+
import { useInToast, useToast } from "../toast/toast.js";
|
|
18
|
+
import { canDelete, deleteLine } from "./rules.js";
|
|
19
|
+
import { LOCK, useViewsListWorn } from "./views-list.js";
|
|
20
|
+
import { VIEW_MENU_WORDS } from "./words.js";
|
|
21
|
+
export { LOCK, useViewsListWorn };
|
|
22
|
+
function ToastBridge({ onSend }) {
|
|
23
|
+
const toast = useToast();
|
|
24
|
+
React.useEffect(() => {
|
|
25
|
+
onSend(toast);
|
|
26
|
+
return () => onSend(null);
|
|
27
|
+
}, [toast, onSend]);
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
export function useViewMenu(props) {
|
|
31
|
+
const { views, open, layouts, columns, records, onChange, onDone, ask: askPort, report } = props;
|
|
32
|
+
const w = React.useMemo(() => ({ ...VIEW_MENU_WORDS, ...props.words }), [props.words]);
|
|
33
|
+
const screen = React.useContext(PhoneHost), small = usePhone(), phone = (props.form ?? (screen || small ? "phone" : "computer")) === "phone";
|
|
34
|
+
const stepping = phone && !!props.steps;
|
|
35
|
+
const [mark, setMark] = React.useState(null), worn = useViewsListWorn(mark);
|
|
36
|
+
const closeShown = useMenuListOption(mark, "close"), rowsAre = useMenuListRows(mark), closeRow = closeShown === "shown" && rowsAre !== "words";
|
|
37
|
+
const inToast = useInToast(), send = React.useRef(null);
|
|
38
|
+
const onSend = React.useCallback((s) => { send.current = s; }, []);
|
|
39
|
+
const now = React.useRef({ views, open });
|
|
40
|
+
React.useLayoutEffect(() => { now.current = { views, open }; });
|
|
41
|
+
const viewOf = (id) => views.find((v) => v.id === id);
|
|
42
|
+
const [asked, setAsked] = React.useState(props.shows ?? null), [shown, setShown] = React.useState(!!props.shows);
|
|
43
|
+
const ask = (a) => { setAsked(a); setShown(true); };
|
|
44
|
+
const close = () => setShown(false);
|
|
45
|
+
const toList = () => { setAsked(null); setShown(false); };
|
|
46
|
+
const [name, setName] = React.useState(() => (props.shows?.what === "rename" ? viewOf(props.shows.id)?.name ?? "" : props.shows?.what === "new" ? props.shows.name ?? "" : ""));
|
|
47
|
+
const [layout, setLayout] = React.useState(() => (props.shows?.what === "new" ? props.shows.layout ?? layouts[0]?.id : layouts[0]?.id) ?? "");
|
|
48
|
+
const [column, setColumn] = React.useState(columns?.value ?? "");
|
|
49
|
+
const [picking, setPicking] = React.useState(null);
|
|
50
|
+
const [making, setMaking] = React.useState(null);
|
|
51
|
+
const rename = (id) => { setName(viewOf(id)?.name ?? ""); ask({ what: "rename", id }); };
|
|
52
|
+
const startNew = (from) => {
|
|
53
|
+
setName("");
|
|
54
|
+
setLayout((from && viewOf(from)?.layout) || layouts[0]?.id || "");
|
|
55
|
+
setColumn(columns?.value ?? "");
|
|
56
|
+
setMaking({ from });
|
|
57
|
+
ask({ what: "new", from });
|
|
58
|
+
};
|
|
59
|
+
const box = React.useRef(null);
|
|
60
|
+
const naming = shown && !props.standing && (asked?.what === "rename" || asked?.what === "new") ? asked.what : null;
|
|
61
|
+
React.useEffect(() => {
|
|
62
|
+
if (!naming)
|
|
63
|
+
return;
|
|
64
|
+
const frame = requestAnimationFrame(() => { const el = box.current; if (el) {
|
|
65
|
+
el.focus({ preventScroll: true });
|
|
66
|
+
if (naming === "rename")
|
|
67
|
+
el.select();
|
|
68
|
+
} });
|
|
69
|
+
return () => cancelAnimationFrame(frame);
|
|
70
|
+
}, [naming]);
|
|
71
|
+
const saveName = () => {
|
|
72
|
+
if (asked?.what !== "rename")
|
|
73
|
+
return;
|
|
74
|
+
const typed = name.trim(), was = viewOf(asked.id)?.name;
|
|
75
|
+
if (typed && typed !== was)
|
|
76
|
+
onChange({ kind: "rename", id: asked.id, name: typed });
|
|
77
|
+
};
|
|
78
|
+
const chosen = layouts.find((l) => l.id === layout);
|
|
79
|
+
const create = () => {
|
|
80
|
+
if (asked?.what !== "new" || !name.trim())
|
|
81
|
+
return;
|
|
82
|
+
onChange({ kind: "create", layout, name: name.trim(), ...(chosen?.columns && column ? { columns: column } : {}), ...(asked.from ? { from: asked.from } : {}) });
|
|
83
|
+
onDone?.();
|
|
84
|
+
};
|
|
85
|
+
const enter = (run) => (e) => {
|
|
86
|
+
if (e.key !== "Enter" || !name.trim())
|
|
87
|
+
return;
|
|
88
|
+
e.preventDefault();
|
|
89
|
+
run();
|
|
90
|
+
if (stepping)
|
|
91
|
+
toList();
|
|
92
|
+
else
|
|
93
|
+
close();
|
|
94
|
+
};
|
|
95
|
+
const say = (message, undo) => {
|
|
96
|
+
if (report)
|
|
97
|
+
report(message, { undo });
|
|
98
|
+
else
|
|
99
|
+
send.current?.({ words: message, undo });
|
|
100
|
+
};
|
|
101
|
+
const remove = (id) => {
|
|
102
|
+
const at = now.current.views.findIndex((v) => v.id === id), view = now.current.views[at];
|
|
103
|
+
if (!view)
|
|
104
|
+
return;
|
|
105
|
+
const wasOpen = now.current.open === id;
|
|
106
|
+
onChange({ kind: "delete", id });
|
|
107
|
+
onDone?.();
|
|
108
|
+
say(w.deleted(view.name), () => onChange({ kind: "restore", view, at, open: wasOpen }));
|
|
109
|
+
};
|
|
110
|
+
const lineOf = (v) => deleteLine(worn.privateViews ? v : { ...v, private: false }, records, { stay: w.stay, goes: w.goes });
|
|
111
|
+
const askDelete = (id) => {
|
|
112
|
+
const v = viewOf(id);
|
|
113
|
+
if (!stepping && askPort && v) {
|
|
114
|
+
void Promise.resolve(askPort({ message: w.deleteTitle(v.name), detail: lineOf(v), confirmLabel: w.delete, subject: v.name, destructive: true }))
|
|
115
|
+
.then((yes) => { if (yes)
|
|
116
|
+
remove(id); }, () => { });
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
ask({ what: "delete", id });
|
|
120
|
+
};
|
|
121
|
+
const entries = (id) => {
|
|
122
|
+
const v = viewOf(id);
|
|
123
|
+
if (!v)
|
|
124
|
+
return [];
|
|
125
|
+
const icon = (n) => _jsx(Icon, { name: n });
|
|
126
|
+
const changed = v.changed ? [
|
|
127
|
+
{ icon: icon("check"), label: w.saveEveryone, onSelect: () => onChange({ kind: "save", id }) },
|
|
128
|
+
{ icon: icon("undo"), label: w.reset, onSelect: () => onChange({ kind: "reset", id }) },
|
|
129
|
+
{ icon: icon("plus"), label: w.saveNew, onSelect: () => startNew(id) },
|
|
130
|
+
] : [];
|
|
131
|
+
const favorite = worn.favorites ? [{ icon: icon(v.favorite ? "star-filled" : "star"), label: v.favorite ? w.unfavorite : w.favorite, onSelect: () => onChange({ kind: "favorite", id, on: !v.favorite }) }] : [];
|
|
132
|
+
const privately = worn.privateViews ? [{ kind: "check", label: w.privateView, ...(phone ? { icon: LOCK } : {}), checked: !!v.private, onCheckedChange: (on) => onChange({ kind: "private", id, on }) }] : [];
|
|
133
|
+
const edit = { icon: icon("settings"), label: w.edit, onSelect: () => { onChange({ kind: "edit", id }); onDone?.(); } };
|
|
134
|
+
const link = { icon: icon("link"), label: phone ? w.copyLinkShort : w.copyLink, onSelect: () => onChange({ kind: "link", id }) };
|
|
135
|
+
const duplicate = { icon: icon("copy"), label: phone ? w.duplicateShort : w.duplicate, onSelect: () => { onChange({ kind: "duplicate", id }); onDone?.(); } };
|
|
136
|
+
const del = { icon: icon("trash"), label: w.delete, danger: true, ...(canDelete(views) ? {} : { disabled: w.keepOne }), onSelect: () => askDelete(id) };
|
|
137
|
+
if (phone)
|
|
138
|
+
return [
|
|
139
|
+
link, ...favorite, { icon: icon("rename"), label: w.renameShort, onSelect: () => rename(id) }, duplicate,
|
|
140
|
+
...(changed.length ? [{ kind: "group", heading: w.unsaved, entries: changed }] : []),
|
|
141
|
+
{ kind: "group", heading: w.thisView, entries: [...privately, edit] },
|
|
142
|
+
{ kind: "separator" }, del,
|
|
143
|
+
];
|
|
144
|
+
return [
|
|
145
|
+
{ icon: icon("rename"), label: w.rename, onSelect: () => rename(id) }, edit, ...privately,
|
|
146
|
+
{ kind: "separator" }, ...(changed.length ? [...changed, { kind: "separator" }] : []),
|
|
147
|
+
link, ...favorite,
|
|
148
|
+
{ kind: "separator" }, duplicate, del,
|
|
149
|
+
];
|
|
150
|
+
};
|
|
151
|
+
const where = props.container ?? undefined, standing = props.standing;
|
|
152
|
+
const target = asked && (asked.what === "rename" || asked.what === "delete" || asked.what === "menu") ? viewOf(asked.id) : undefined;
|
|
153
|
+
const asking = shown;
|
|
154
|
+
const nameField = (run) => (_jsx(Field, { label: w.name, children: _jsx(Input, { ref: box, value: name, onValueChange: (v) => setName(v), onKeyDown: enter(run), autoComplete: "off" }) }));
|
|
155
|
+
const columnsField = chosen?.columns && columns && (phone
|
|
156
|
+
? _jsx("div", { style: { display: "contents" }, ...MENU_LIST_CARD_FRAME, children: _jsx(MenuList, { label: w.columns(chosen.name), entries: [{ kind: "choices", icon: null, label: w.columns(chosen.name), value: column, choices: columns.fields.map((f) => ({ value: f.value, label: f.label })) }], onOpen: () => (stepping ? ask({ what: "columns" }) : setPicking({ open: true })) }) })
|
|
157
|
+
: _jsx(Field, { label: w.columns(chosen.name), nativeLabel: false, children: _jsx(Select, { "aria-label": w.columns(chosen.name), items: asSelect(columns.fields), value: column, onValueChange: (v) => { if (typeof v === "string")
|
|
158
|
+
setColumn(v); } }) }));
|
|
159
|
+
const newForm = (_jsxs("div", { className: "o-views-list-form", children: [_jsx(RadioGroup, { row: true, label: w.layout, value: layout, onValueChange: (v) => { if (typeof v === "string")
|
|
160
|
+
setLayout(v); }, children: layouts.map((l) => _jsx(Radio, { value: l.id, mark: l.mark, label: l.name, note: l.line }, l.id)) }), nameField(create), columnsField] }));
|
|
161
|
+
const modalWords = { close: w.close };
|
|
162
|
+
const stepOf = () => {
|
|
163
|
+
if (!stepping || !asked || !shown)
|
|
164
|
+
return null;
|
|
165
|
+
const done = (run, disabled, label) => (_jsx("div", { className: "o-views-list-step-foot", children: _jsx(Button, { kind: "primary", className: "o-views-list-step-act", disabled: disabled, onClick: () => { run(); toList(); }, children: label }) }));
|
|
166
|
+
if (asked.what === "menu" && target) {
|
|
167
|
+
const leaving = (list) => list.map((e) => e.kind === undefined || e.kind === "action" ? { ...e, onSelect: () => { toList(); e.onSelect?.(); } } : e.kind === "group" ? { ...e, entries: leaving(e.entries) } : e);
|
|
168
|
+
return { title: target.name, onBack: toList, body: _jsx("div", { style: { display: "contents" }, ...MENU_LIST_CARD_FRAME, children: _jsx(MenuList, { label: target.name, ...tilesOf(leaving(entries(target.id))), ...(closeRow ? { onClose: toList } : {}), closeWord: w.close }) }) };
|
|
169
|
+
}
|
|
170
|
+
if (asked.what === "rename" && target)
|
|
171
|
+
return { title: w.renameTitle, onBack: () => ask({ what: "menu", id: target.id }), body: _jsxs(_Fragment, { children: [_jsx("div", { className: "o-views-list-form", children: nameField(saveName) }), done(saveName, !name.trim(), w.save)] }) };
|
|
172
|
+
if (asked.what === "new")
|
|
173
|
+
return { title: w.newView, onBack: making?.from ? () => ask({ what: "menu", id: making.from }) : toList, body: _jsxs(_Fragment, { children: [newForm, done(create, !name.trim(), w.createView)] }) };
|
|
174
|
+
if (asked.what === "columns" && chosen && columns)
|
|
175
|
+
return {
|
|
176
|
+
title: w.columns(chosen.name), onBack: () => ask({ what: "new", ...(making?.from ? { from: making.from } : {}) }),
|
|
177
|
+
body: _jsx(Picker, { label: w.columns(chosen.name), items: columns.fields, value: column, onValueChange: (v) => { if (typeof v === "string")
|
|
178
|
+
setColumn(v); ask({ what: "new", ...(making?.from ? { from: making.from } : {}) }); } }),
|
|
179
|
+
};
|
|
180
|
+
if (asked.what === "delete" && target)
|
|
181
|
+
return {
|
|
182
|
+
title: "", onBack: () => ask({ what: "menu", id: target.id }),
|
|
183
|
+
body: _jsx(Alert, { title: w.deleteTitle(target.name), line: lineOf(target), action: w.delete, kind: "danger", cancel: w.cancel, phone: true, shell: "sheet", words: { tryAgain: w.tryAgain }, onAnswer: (yes) => { if (yes) {
|
|
184
|
+
toList();
|
|
185
|
+
remove(target.id);
|
|
186
|
+
}
|
|
187
|
+
else
|
|
188
|
+
ask({ what: "menu", id: target.id }); } }),
|
|
189
|
+
};
|
|
190
|
+
return null;
|
|
191
|
+
};
|
|
192
|
+
const bridge = !report && inToast ? _jsx(ToastBridge, { onSend: onSend }) : null;
|
|
193
|
+
const dialogs = stepping ? (_jsxs(_Fragment, { children: [_jsx("span", { ref: setMark, hidden: true }), bridge] })) : (_jsxs(_Fragment, { children: [_jsx("span", { ref: setMark, hidden: true }), bridge, asked?.what === "rename" && (_jsx(Modal, { open: shown, onOpenChange: (o) => { if (!o)
|
|
194
|
+
close(); }, title: w.renameTitle, size: "sm", action: { label: w.save, disabled: !name.trim(), run: saveName }, cancel: w.cancel, words: modalWords, container: where, standing: standing, children: nameField(saveName) })), asked?.what === "new" && (_jsxs(Modal, { open: shown, onOpenChange: (o) => { if (!o)
|
|
195
|
+
close(); }, title: w.newView, size: "md", action: { label: w.createView, disabled: !name.trim(), run: create }, cancel: w.cancel, words: modalWords, container: where, standing: standing, children: [newForm, phone && picking && chosen && columns && (_jsx(OnTop, { open: picking.open, onOpenChange: (o) => setPicking(o ? { open: true } : { open: false }), onGone: () => setPicking(null), title: w.columns(chosen.name), container: where ?? screen, standing: !!standing, picker: { label: w.columns(chosen.name), items: columns.fields, value: column, onValueChange: (v) => { if (typeof v === "string")
|
|
196
|
+
setColumn(v); } } }))] })), asked?.what === "delete" && target && (_jsx(AlertDialog, { open: shown, onAnswer: (yes) => { close(); if (yes)
|
|
197
|
+
remove(target.id); }, title: w.deleteTitle(target.name), line: lineOf(target), action: w.delete, kind: "danger", cancel: w.cancel, words: { close: w.close, failed: w.failed, tryAgain: w.tryAgain }, container: where, standing: standing }))] }));
|
|
198
|
+
const openMenu = (id) => { if (stepping)
|
|
199
|
+
ask({ what: "menu", id }); };
|
|
200
|
+
return { entries, startNew, dialogs, asking, openMenu, step: stepOf() };
|
|
201
|
+
}
|
|
@@ -2,6 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import type { MenuEntry } from "../menu-list/menu-list.js";
|
|
3
3
|
import { type PickerParts } from "../picker/picker.js";
|
|
4
4
|
import { type ListView, type ViewsListChange, type ViewsListLayout } from "./rules.js";
|
|
5
|
+
import type { ViewMenuStep } from "./view-menu.js";
|
|
5
6
|
import { type ViewsListWords } from "./words.js";
|
|
6
7
|
/** Held back from the controls door until VK-727: `viewkitjs/views/react`'s atom already has the name. */
|
|
7
8
|
export interface ViewsListProps {
|
|
@@ -22,6 +23,12 @@ export interface ViewsListProps {
|
|
|
22
23
|
entries?: (id: string) => MenuEntry[];
|
|
23
24
|
/** New view, the list's action; left out, no action. */
|
|
24
25
|
onNew?: () => void;
|
|
26
|
+
/** On a phone, a view's ⋯ hands its id here and opens no menu sheet of its own: the holder turns the list into the view's menu
|
|
27
|
+
* (`step`). On a computer it changes nothing. */
|
|
28
|
+
onMenu?: (id: string) => void;
|
|
29
|
+
/** On a phone, what stands in the Sheet in place of the list (a view's menu, Rename, New view, the delete question): its body,
|
|
30
|
+
* and its title and Back in the Sheet's head. Null or left out, the list stands. */
|
|
31
|
+
step?: ViewMenuStep | null;
|
|
25
32
|
/** Shared and Just me, a private view's lock; left out, the Private views option worn round it. */
|
|
26
33
|
privateViews?: boolean;
|
|
27
34
|
/** false: no row moves. */
|
|
@@ -30,7 +37,7 @@ export interface ViewsListProps {
|
|
|
30
37
|
}
|
|
31
38
|
export interface ViewsListParts {
|
|
32
39
|
body: React.ReactNode;
|
|
33
|
-
/** On a phone, the Sheet head's buttons, the Picker's; {} on a computer. */
|
|
40
|
+
/** On a phone, the Sheet head's buttons, the Picker's; {} on a computer. On a step, its Back and its title. */
|
|
34
41
|
head: PickerParts["head"];
|
|
35
42
|
}
|
|
36
43
|
/** A private view's lock, as the list draws it after its name. */
|
|
@@ -5,6 +5,8 @@ import { Icon } from "../internal/icons.js";
|
|
|
5
5
|
import { PhoneHost, phoneMark, usePhone } from "../internal/phone.js";
|
|
6
6
|
import { MENU_LIST_CARD_FRAME } from "../menu-list/looks.js";
|
|
7
7
|
import { usePicker } from "../picker/picker.js";
|
|
8
|
+
import { SheetButton } from "../sheet/bottom-sheet.js";
|
|
9
|
+
import { openerAt, useStepReturn } from "../internal/step-return.js";
|
|
8
10
|
import { VIEWS_LIST_ATTRS, viewsListWornOf } from "./looks.js";
|
|
9
11
|
import { listed } from "./rules.js";
|
|
10
12
|
import { viewsListWords } from "./words.js";
|
|
@@ -28,6 +30,7 @@ export function useViewsList(props) {
|
|
|
28
30
|
const screen = React.useContext(PhoneHost), small = usePhone(), phone = (props.form ?? (screen || small ? "phone" : "computer")) === "phone";
|
|
29
31
|
const [root, setRoot] = React.useState(null), worn = useViewsListWorn(props.privateViews === undefined ? root : null);
|
|
30
32
|
const privateViews = props.privateViews ?? worn.privateViews;
|
|
33
|
+
const [opener, setOpener] = React.useState(null);
|
|
31
34
|
const markOf = (layout) => {
|
|
32
35
|
const mark = layouts.find((l) => l.id === layout)?.mark;
|
|
33
36
|
return mark == null ? {} : { as: { mark: _jsx("span", { className: "o-views-list-mark", children: mark }) } };
|
|
@@ -44,12 +47,24 @@ export function useViewsList(props) {
|
|
|
44
47
|
onChange({ kind: "open", id: v }); },
|
|
45
48
|
onDone,
|
|
46
49
|
...(props.reorder !== false ? { onOrderChange: (ids) => onChange({ kind: "order", ids }) } : {}),
|
|
47
|
-
...(props.onNew ? { actions: [{ id: "new", label: w.newView, icon: _jsx(Icon, { name: "plus" }), onSelect: props.onNew }] } : {}),
|
|
50
|
+
...(props.onNew ? { actions: [{ id: "new", label: w.newView, icon: _jsx(Icon, { name: "plus" }), onSelect: () => { setOpener(null); props.onNew(); } }] } : {}),
|
|
48
51
|
search: phone ? w.find : w.search, searchShown: true, heldInPlace: true, actionsUnder: true, fromHeld: true,
|
|
49
|
-
...(w.none ? { none: w.none } : {}), ...(w.picker ? { words: w.picker } : {}),
|
|
52
|
+
...(w.none ? { none: w.none } : {}), ...(w.picker ? { words: w.picker } : {}), ...(w.menu ? { menuWords: w.menu } : {}),
|
|
50
53
|
menuFrame: MENU_LIST_CARD_FRAME,
|
|
54
|
+
...(phone && props.onMenu ? { onRowMenu: (id) => { setOpener(views.find((v) => v.id === id)?.name ?? null); props.onMenu(id); } } : {}),
|
|
51
55
|
});
|
|
52
|
-
const
|
|
56
|
+
const step = phone ? props.step ?? null : null;
|
|
57
|
+
const rootRef = React.useRef(null);
|
|
58
|
+
const placeRoot = React.useCallback((el) => { rootRef.current = el; setRoot(el); }, [setRoot]);
|
|
59
|
+
useStepReturn(rootRef, step && opener ? [openerAt(() => `[role="option"][data-name="${CSS.escape(opener)}"] .o-picker-row-menu`)] : []);
|
|
60
|
+
if (step) {
|
|
61
|
+
const back = _jsx(SheetButton, { "aria-label": w.back, className: "o-sheet-back", icon: _jsx(Icon, { name: "left" }), onClick: step.onBack });
|
|
62
|
+
return {
|
|
63
|
+
body: _jsx("div", { ref: placeRoot, className: "o-views-list", "data-kit": "views-list", "data-views-form": "phone", "data-views-step": "", ...phoneMark(!!screen || small), children: step.body }),
|
|
64
|
+
head: { left: back, children: step.title, right: _jsx("span", {}) },
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
const body = (_jsx("div", { ref: placeRoot, className: "o-views-list", "data-kit": "views-list", "data-views-form": phone ? "phone" : "computer", ...phoneMark(!!screen || small), children: picker.body }));
|
|
53
68
|
return { body, head: picker.head };
|
|
54
69
|
}
|
|
55
70
|
export function ViewsList(props) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MenuWords } from "../menu/menu.js";
|
|
1
2
|
import type { PickerWords } from "../picker/picker.js";
|
|
2
3
|
export interface ViewsListWords {
|
|
3
4
|
/** What it lists: the list's name to a screen reader. */
|
|
@@ -16,7 +17,60 @@ export interface ViewsListWords {
|
|
|
16
17
|
none?: string;
|
|
17
18
|
/** The words of the list itself. */
|
|
18
19
|
picker?: Partial<PickerWords>;
|
|
20
|
+
/** A phone's step's way back to the list (a view's menu, Rename…); left out, "Back". */
|
|
21
|
+
back?: string;
|
|
22
|
+
/** A view's menu's own words (a sheet's ✕ and Back, the Close row, a level's search). */
|
|
23
|
+
menu?: MenuWords;
|
|
19
24
|
}
|
|
20
25
|
export declare const VIEWS_LIST_WORDS: ViewsListWords;
|
|
21
26
|
/** The words handed over the English. */
|
|
22
27
|
export declare const viewsListWords: (given?: Partial<ViewsListWords>) => ViewsListWords;
|
|
28
|
+
/** A view's menu's words (VK-823): its entries (a computer's, a phone's shorter tiles and its two headings), Rename's and New view's
|
|
29
|
+
* Modals, the delete question, the Toast's report, a copy's name, the delete question's line and a board's columns. English unless
|
|
30
|
+
* handed, the Outright kit's as drawn; CONTROLS.ViewsListBody hands them in the app's words, from its messages. */
|
|
31
|
+
export interface ViewMenuWords {
|
|
32
|
+
rename: string;
|
|
33
|
+
/** A phone's tile. */
|
|
34
|
+
renameShort: string;
|
|
35
|
+
edit: string;
|
|
36
|
+
privateView: string;
|
|
37
|
+
saveEveryone: string;
|
|
38
|
+
reset: string;
|
|
39
|
+
saveNew: string;
|
|
40
|
+
copyLink: string;
|
|
41
|
+
/** A phone's tile. */
|
|
42
|
+
copyLinkShort: string;
|
|
43
|
+
favorite: string;
|
|
44
|
+
unfavorite: string;
|
|
45
|
+
duplicate: string;
|
|
46
|
+
/** A phone's tile. */
|
|
47
|
+
duplicateShort: string;
|
|
48
|
+
delete: string;
|
|
49
|
+
/** Why Delete can't be pressed: the list's last view. */
|
|
50
|
+
keepOne: string;
|
|
51
|
+
/** A phone's heading over Save for everyone, Reset and Save as new view. */
|
|
52
|
+
unsaved: string;
|
|
53
|
+
/** A phone's heading over Private view and Edit view. */
|
|
54
|
+
thisView: string;
|
|
55
|
+
renameTitle: string;
|
|
56
|
+
save: string;
|
|
57
|
+
newView: string;
|
|
58
|
+
createView: string;
|
|
59
|
+
layout: string;
|
|
60
|
+
name: string;
|
|
61
|
+
/** Each Modal's way out, the delete question's too. */
|
|
62
|
+
cancel: string;
|
|
63
|
+
/** A Modal's and the alert dialog's X. */
|
|
64
|
+
close: string;
|
|
65
|
+
/** What a failure says when its work threw no words; its action, once it failed. */
|
|
66
|
+
failed: string;
|
|
67
|
+
tryAgain: string;
|
|
68
|
+
deleteTitle: (name: string) => string;
|
|
69
|
+
deleted: (name: string) => string;
|
|
70
|
+
copyOf: (name: string) => string;
|
|
71
|
+
stay: (records: string) => string;
|
|
72
|
+
goes: string;
|
|
73
|
+
columns: (layout: string) => string;
|
|
74
|
+
}
|
|
75
|
+
/** A view's menu's words in English. */
|
|
76
|
+
export declare const VIEW_MENU_WORDS: ViewMenuWords;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
import { JUST_ME, SHARED } from "./rules.js";
|
|
2
|
-
export const VIEWS_LIST_WORDS = { label: "Views", search: "Search views", find: "Find a view", newView: "New view", shared: SHARED, justMe: JUST_ME };
|
|
2
|
+
export const VIEWS_LIST_WORDS = { label: "Views", search: "Search views", find: "Find a view", newView: "New view", shared: SHARED, justMe: JUST_ME, back: "Back" };
|
|
3
3
|
export const viewsListWords = (given) => (given ? { ...VIEWS_LIST_WORDS, ...given } : VIEWS_LIST_WORDS);
|
|
4
|
+
export const VIEW_MENU_WORDS = {
|
|
5
|
+
rename: "Rename…", renameShort: "Rename", edit: "Edit view…", privateView: "Private view", saveEveryone: "Save for everyone", reset: "Reset",
|
|
6
|
+
saveNew: "Save as new view…", copyLink: "Copy link to view", copyLinkShort: "Copy link", favorite: "Favorite", unfavorite: "Unfavorite",
|
|
7
|
+
duplicate: "Duplicate view", duplicateShort: "Duplicate", delete: "Delete view", keepOne: "A list keeps one view", unsaved: "Unsaved changes",
|
|
8
|
+
thisView: "This view", renameTitle: "Rename view", save: "Save", newView: "New view", createView: "Create view", layout: "Layout", name: "Name",
|
|
9
|
+
cancel: "Cancel", close: "Close", failed: "That didn't go through. Nothing changed.", tryAgain: "Try again",
|
|
10
|
+
deleteTitle: (name) => `Delete ${name}?`, deleted: (name) => `${name} was deleted`, copyOf: (name) => `Copy of ${name}`,
|
|
11
|
+
stay: (records) => `The ${records} in it stay as they are.`, goes: "The view goes for everyone who uses it.", columns: (layout) => `${layout} columns`,
|
|
12
|
+
};
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/* The views list (VK-723, from the Outright kit's KIT-678): only what is its own. Its list is the Picker, its menus the Menu, each as
|
|
2
|
-
it is. Here: a view's layout mark at a row's icon size (16 on a computer, 20 on a phone, the subtle text)
|
|
2
|
+
it is. Here: a view's layout mark at a row's icon size (16 on a computer, 20 on a phone, the subtle text); a view's menu's own (VK-823):
|
|
3
|
+
New view's and Rename's form, its fields one under another, 16 apart, and on a phone's step its action the step's width under them. */
|
|
3
4
|
@layer components {
|
|
4
5
|
.o-views-list { display: contents; }
|
|
5
6
|
.o-views-list-mark { display: inline-grid; place-items: center; color: var(--vk-fg-subtle); }
|
|
6
7
|
.o-views-list-mark > svg { width: calc(var(--vk-spacing) * 4); height: calc(var(--vk-spacing) * 4); }
|
|
7
8
|
.o-picker[data-picker-form="phone"] .o-views-list-mark > svg { width: calc(var(--vk-spacing) * 5); height: calc(var(--vk-spacing) * 5); }
|
|
9
|
+
.o-views-list-form { display: grid; gap: calc(var(--vk-spacing) * 4); }
|
|
10
|
+
.o-views-list-step-foot { margin-top: calc(var(--vk-spacing) * 4); }
|
|
11
|
+
:where([data-vk-phone], [data-vk-phone] *).o-views-list-step-act { width: 100%; }
|
|
8
12
|
}
|
|
@@ -4,7 +4,7 @@ import { useState } from "react";
|
|
|
4
4
|
import { fromDayKey } from "viewkitjs/fields/query";
|
|
5
5
|
import { cx } from "../internal/cx.js";
|
|
6
6
|
import { useViews } from "../provider/context.js";
|
|
7
|
-
import { formatDateValue } from "./format.js";
|
|
7
|
+
import { formatDateValue, timeShown } from "./format.js";
|
|
8
8
|
import { cellTextClass } from "./text-class.js";
|
|
9
9
|
import { useDateDisplayOptions } from "./use-display-options.js";
|
|
10
10
|
export function renderDate(field, value, opts) {
|
|
@@ -25,10 +25,10 @@ function DateValue({ field, value, opts: given, }) {
|
|
|
25
25
|
window.addEventListener("pointerup", release, true);
|
|
26
26
|
window.addEventListener("pointercancel", release, true);
|
|
27
27
|
};
|
|
28
|
-
const withTime =
|
|
28
|
+
const withTime = field.type === "datetime" ? timeShown(field.format?.withTime, opts.withTime) : false;
|
|
29
29
|
const cell = (_jsx("span", { className: cx(cellTextClass(opts.wrap), "tabular-nums text-(color:--vk-fg)"), onPointerMove: pointed
|
|
30
30
|
? undefined
|
|
31
|
-
: (event) => event.pointerType !== "touch" && event.buttons === 0 && setPointed(true),
|
|
31
|
+
: (event) => event.pointerType !== "touch" && event.buttons === 0 && setPointed(true), onPointerDownCapture: pointed || pressed ? undefined : (event) => event.pointerType !== "touch" && hold(), children: formatDateValue(value, opts.dateStyle ?? field.format?.dateStyle, withTime, field.type, opts) }));
|
|
32
32
|
const d = field.type === "date" && typeof value === "string"
|
|
33
33
|
? fromDayKey(value)
|
|
34
34
|
: value instanceof Date
|
|
@@ -28,6 +28,12 @@ export declare const DEFAULT_FIELD_PRESENTATION: FieldPresentation;
|
|
|
28
28
|
* the caller's answer, then the field's single declared code.
|
|
29
29
|
*/
|
|
30
30
|
export declare function formatNumberValue(value: number, format: NumberLikeFormat | undefined, opts?: NumberOverrides): string;
|
|
31
|
+
/**
|
|
32
|
+
* Whether a date-and-time shows its time: the reader's choice, else what its field or column declares, else yes. A
|
|
33
|
+
* date-and-time is one because its time matters, and a time typed then not shown reads as lost. A calendar day has no
|
|
34
|
+
* time, whatever this says.
|
|
35
|
+
*/
|
|
36
|
+
export declare function timeShown(declared?: boolean, chosen?: boolean): boolean;
|
|
31
37
|
/**
|
|
32
38
|
* A date or an instant, in the style asked for.
|
|
33
39
|
*
|
|
@@ -166,6 +166,9 @@ export function formatNumberValue(value, format, opts) {
|
|
|
166
166
|
return formatted;
|
|
167
167
|
return `${value >= 0 ? "+" : "−"} ${formatted}`;
|
|
168
168
|
}
|
|
169
|
+
export function timeShown(declared, chosen) {
|
|
170
|
+
return chosen ?? declared ?? true;
|
|
171
|
+
}
|
|
169
172
|
export function formatDateValue(value, dateStyle, withTime, kind = "datetime", opts) {
|
|
170
173
|
const d = kind === "date" && typeof value === "string"
|
|
171
174
|
? fromDayKey(value)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { DISPLAY_CORES, renderFieldValue, type DisplayCore } from "./display-cores.js";
|
|
2
2
|
export { emailHref, webHref } from "./web-href.js";
|
|
3
3
|
export type { DisplayOptions, FieldPresentation, FieldViewerContext, NumberLikeFormat, RelationWrap, } from "./options.js";
|
|
4
|
-
export { CellSuffix, DEFAULT_FIELD_PRESENTATION, formatDateValue, formatMoney, formatNumberValue, } from "./format.js";
|
|
4
|
+
export { CellSuffix, DEFAULT_FIELD_PRESENTATION, formatDateValue, timeShown, formatMoney, formatNumberValue, } from "./format.js";
|
|
5
5
|
export { viewerFrom } from "./viewer.js";
|
|
6
6
|
export { cellTextClass } from "./text-class.js";
|
|
7
7
|
export { MultiValueCell } from "./multi-value.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { DISPLAY_CORES, renderFieldValue } from "./display-cores.js";
|
|
2
2
|
export { emailHref, webHref } from "./web-href.js";
|
|
3
|
-
export { CellSuffix, DEFAULT_FIELD_PRESENTATION, formatDateValue, formatMoney, formatNumberValue, } from "./format.js";
|
|
3
|
+
export { CellSuffix, DEFAULT_FIELD_PRESENTATION, formatDateValue, timeShown, formatMoney, formatNumberValue, } from "./format.js";
|
|
4
4
|
export { viewerFrom } from "./viewer.js";
|
|
5
5
|
export { cellTextClass } from "./text-class.js";
|
|
6
6
|
export { MultiValueCell } from "./multi-value.js";
|
|
@@ -2,5 +2,6 @@ import type { ReactNode } from "react";
|
|
|
2
2
|
import { type FieldDefOf } from "viewkitjs/fields";
|
|
3
3
|
import type { DisplayOptions } from "./options.js";
|
|
4
4
|
/** A low and a high end — "11–50", "10,001+", "up to 50" — then the code and
|
|
5
|
-
* the period of an amount range
|
|
5
|
+
* the period of an amount range; or the band's name when the ends are exactly a preset's ("Small"), its numbers on
|
|
6
|
+
* hover. */
|
|
6
7
|
export declare function renderRange(field: FieldDefOf<"range">, value: unknown, opts?: DisplayOptions): ReactNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { rangeText } from "viewkitjs/fields";
|
|
3
|
+
import { exactPresetOf, rangeText } from "viewkitjs/fields";
|
|
4
4
|
import { rangePeriodShort, rangeUnit } from "../fields/range-unit.js";
|
|
5
5
|
import { useViews } from "../provider/context.js";
|
|
6
6
|
import { CellSuffix } from "./format.js";
|
|
@@ -15,5 +15,8 @@ function RangeValueCell({ field, value, opts, }) {
|
|
|
15
15
|
return null;
|
|
16
16
|
const unit = rangeUnit(field);
|
|
17
17
|
const period = rangePeriodShort(field);
|
|
18
|
+
const band = exactPresetOf(field, value);
|
|
19
|
+
if (band)
|
|
20
|
+
return _jsx("span", { className: cellTextClass(opts?.wrap), title: [text, unit, period].filter(Boolean).join(" "), children: band.label });
|
|
18
21
|
return (_jsxs("span", { className: cellTextClass(opts?.wrap), title: text, children: [_jsx("span", { className: "tabular-nums", children: text }), unit && _jsx(CellSuffix, { children: unit }), period && _jsx(CellSuffix, { children: period })] }));
|
|
19
22
|
}
|
|
@@ -15,6 +15,7 @@ import { gridColumnGlyph } from "./column-glyph.js";
|
|
|
15
15
|
import { gridFocusOnPress } from "./useGridFocus.js";
|
|
16
16
|
import { columnSortParts, effectiveSortKey, sortPartOf } from "../../model/column-sort.js";
|
|
17
17
|
import { columnPlacedByView } from "../../model/column-capabilities.js";
|
|
18
|
+
import { timeShown } from "../../display/format.js";
|
|
18
19
|
export function GridHeader({ showAddColumn = false, addColumnAt = "end", checkbox, checkColumnId, groupKey, ariaRowIndex, ariaLevel, ariaColOffset = 0, ariaTailIndex, columns, columnManager, minWidth, sort, sortMark = false, selectValues, optionColors, onOptionColorChange, dateStyles, onDateStyleChange, durationStyles, onDurationStyleChange, numberFormats, onNumberFormatChange, showTimeOverrides, onShowTimeChange, percentDisplays, onPercentDisplayChange, columnStateEnabled, listConfig, groupBy, resizingId, startResize, moveResize, endResize, resetColumnWidth, hideColumn, moveColumn, headerDrag, frozenCount = 0, frozenLeft, verticalBorders = true, headerVerticalBorders = false, viewBacked = false, formatsWritable, renderAddColumn, renderColumnMenuRows, columnMenuItems, openColumnMenu, onOpenColumnMenuChange, }) {
|
|
19
20
|
const { icons, components, messages } = useViews();
|
|
20
21
|
const headId = useId();
|
|
@@ -52,7 +53,7 @@ export function GridHeader({ showAddColumn = false, addColumnAt = "end", checkbo
|
|
|
52
53
|
: "relative"), children: [withCheck && checkbox, gridColumnGlyph({ icons, AppIcon: components.AppIcon }, column, "h-(--vk-head-glyph) w-(--vk-head-glyph) shrink-0 text-(color:--vk-head-glyph-fg,currentColor) opacity-70"), column.header ? (_jsx("span", { id: nameId, className: "truncate", children: column.header })) : null, sortMark && sortedAs && (_jsx("span", { "aria-hidden": true, className: "inline-flex shrink-0", children: _jsx(Mark, { className: "h-(--vk-head-glyph) w-(--vk-head-glyph)" }) })), withAddColumn && titleAddColumn, columnStateEnabled && (_jsx(GridResizeHandle, { active: resizingId === column.id, onResizeStart: (event) => startResize(column, event), onResizeMove: moveResize, onResizeEnd: endResize, onReset: () => resetColumnWidth(column) }))] }, column.id));
|
|
53
54
|
if (!menuEnabled)
|
|
54
55
|
return cell;
|
|
55
|
-
return (_jsx(GridColumnMenu, { column: column, values: selectValues[column.id] ?? [], viewBacked: viewBacked, sort: sort, groupBy: groupBy, optionColors: optionColors?.[fieldKeyOf(column)], onOptionColorChange: onOptionColorChange, dateStyle: dateStyles?.[fieldKeyOf(column)], onDateStyleChange: onDateStyleChange, durationStyle: durationStyles?.[fieldKeyOf(column)], onDurationStyleChange: onDurationStyleChange, numberFormat: numberFormats?.[fieldKeyOf(column)], onNumberFormatChange: onNumberFormatChange, showTime: showTimeOverrides?.[fieldKeyOf(column)]
|
|
56
|
+
return (_jsx(GridColumnMenu, { column: column, values: selectValues[column.id] ?? [], viewBacked: viewBacked, sort: sort, groupBy: groupBy, optionColors: optionColors?.[fieldKeyOf(column)], onOptionColorChange: onOptionColorChange, dateStyle: dateStyles?.[fieldKeyOf(column)], onDateStyleChange: onDateStyleChange, durationStyle: durationStyles?.[fieldKeyOf(column)], onDurationStyleChange: onDurationStyleChange, numberFormat: numberFormats?.[fieldKeyOf(column)], onNumberFormatChange: onNumberFormatChange, showTime: timeShown(column.format?.withTime, showTimeOverrides?.[fieldKeyOf(column)]), onShowTimeChange: column.type === "datetime" ? onShowTimeChange : undefined, percentDisplay: percentDisplays?.[fieldKeyOf(column)], onPercentDisplayChange: onPercentDisplayChange, onMoveLeft: canMove && index > 0 ? () => moveColumn(column, -1) : undefined, onMoveRight: canMove && index < columns.length - 1 ? () => moveColumn(column, 1) : undefined, onHide: canHide ? () => hideColumn(column) : undefined, formatsWritable: formatsWritable, renderColumnMenuRows: column.partOf ? undefined : renderColumnMenuRows, columnMenuItems: column.partOf ? undefined : columnMenuItems, open: openColumnMenu === undefined ? undefined : openColumnMenu === column.id, onOpenChange: onOpenColumnMenuChange ? (next) => onOpenColumnMenuChange(next ? column.id : null) : undefined, children: cell }, column.id));
|
|
56
57
|
}), _jsxs("div", { "data-slot": "vk-grid-tail", role: "columnheader", "aria-colindex": ariaTailIndex, style: GRID_TAIL_PLACE, className: cx("flex h-(--vk-head-h) min-w-0 items-center gap-2 border-b border-(color:--vk-border-subtle)", addColumn ? "pl-0" : "pl-(--vk-px)"), children: [listConfig?.readOnly && (_jsxs("span", { title: messages({ key: "views.grid.read-only-why" }), className: cx("inline-flex shrink-0 items-center gap-1 whitespace-nowrap text-(length:--vk-head-text) text-(color:--vk-fg-subtle)", !!addColumn && "pl-(--vk-px)"), children: [_jsx(icons.lock, { className: "h-3 w-3" }), messages({ key: "views.grid.read-only" })] })), addColumn && _jsx("div", { className: "flex h-full min-w-0 flex-1 items-stretch", children: addColumn })] })] }));
|
|
57
58
|
return (_jsx("div", { "data-slot": "vk-grid-header", "data-group-key": groupKey, role: "row", "aria-rowindex": ariaRowIndex, "aria-level": ariaLevel, className: cx("group/gridhead grid grid-cols-(--vk-cols)", GRID_ONE_LINE, GRID_CONTENT_PAD), style: { minWidth }, children: cells }));
|
|
58
59
|
}
|
|
@@ -7,7 +7,7 @@ import { ConversionLine } from "../../display/converted.js";
|
|
|
7
7
|
import { useKeepInside } from "../../editors/keep-inside.js";
|
|
8
8
|
import { cx } from "../../internal/cx.js";
|
|
9
9
|
import { useViews } from "../../provider/context.js";
|
|
10
|
-
import { GRID_EDITOR_LAYER } from "./grid-editor-layer.js";
|
|
10
|
+
import { BODY_FIGURE_ROOM_PX, GRID_EDITOR_LAYER } from "./grid-editor-layer.js";
|
|
11
11
|
import { GridFittedBox } from "./grid-fitted-box.js";
|
|
12
12
|
import { GridRefusal, UNDER_CELL_CLASS, useGridEditSession } from "./grid-edit-session.js";
|
|
13
13
|
export function GridNumberEditor({ title, initial, seed, unit, unitOptions, code, decimals = 2, durationUnit, allowEmpty = false, unitLeft = false, conversion, onCommit, onCancel, onTab, onEnter, refuse, type, bounds, }) {
|
|
@@ -33,7 +33,7 @@ export function GridNumberEditor({ title, initial, seed, unit, unitOptions, code
|
|
|
33
33
|
form: surface === "sheet" ? "phone" : "computer",
|
|
34
34
|
}
|
|
35
35
|
: {}), onRequestClose: close }));
|
|
36
|
-
return (_jsx(EditorPanel, { session: session, title: title, anchor: anchorRef, inPlace: true, sheetOnPhone: true, children: (surface) => body ? (surface === "sheet" ? (_jsxs("div", { className: "px-2 pb-3", children: [editor(surface), conversion ? _jsx(ConversionLine, { figure: conversion, className: "pt-1.5" }) : null] })) : (_jsxs("span", {
|
|
36
|
+
return (_jsx(EditorPanel, { session: session, title: title, anchor: anchorRef, inPlace: true, sheetOnPhone: true, children: (surface) => body ? (surface === "sheet" ? (_jsxs("div", { className: "px-2 pb-3", children: [editor(surface), conversion ? _jsx(ConversionLine, { figure: conversion, className: "pt-1.5" }) : null] })) : (_jsxs("span", { "data-slot": "vk-grid-editor", "data-grown": "", className: cx(GRID_EDITOR_LAYER, unitLeft && "justify-end"), children: [_jsx(GridFittedBox, { boxRef: anchorRef, edge: false, room: BODY_FIGURE_ROOM_PX, children: editor(surface) }), _jsx(GridRefusal, { reason: session.refusal }), conversion && !session.refusal ? _jsx(UnderCellConversion, { figure: conversion }) : null] }))) : surface === "sheet" ? (_jsxs("div", { className: "px-2 pb-3", children: [_jsx("div", { className: "flex h-10 min-w-0 items-center rounded-md border border-(color:--vk-border) px-2", children: editor(surface) }), conversion ? _jsx(ConversionLine, { figure: conversion, className: "pt-1.5" }) : null] })) : (_jsxs("span", { "data-slot": "vk-grid-editor", className: cx("relative flex h-full w-full min-w-0", unitLeft && "justify-end"), children: [_jsx(GridFittedBox, { boxRef: anchorRef, children: editor(surface) }), _jsx(GridRefusal, { reason: session.refusal }), conversion && !session.refusal ? _jsx(UnderCellConversion, { figure: conversion }) : null] })) }));
|
|
37
37
|
}
|
|
38
38
|
function UnderCellConversion({ figure }) {
|
|
39
39
|
const ref = useRef(null);
|
|
@@ -21,6 +21,7 @@ import { GridRowGlyph } from "./GridRowGlyph.js";
|
|
|
21
21
|
import { GridNameCheck } from "./checks.js";
|
|
22
22
|
import { SelectCheckbox } from "../../selection/SelectCheckbox.js";
|
|
23
23
|
import { requestedSettlementTitle } from "viewkitjs/fields";
|
|
24
|
+
import { timeShown } from "../../display/format.js";
|
|
24
25
|
function FillDot({ enabled }) {
|
|
25
26
|
return (_jsx("span", { "data-fill-dot": enabled ? "" : undefined, className: cx("absolute bottom-[-7px] right-[-7px] z-10 hidden h-3 w-3 rounded-full border-(length:--vk-thick-line,2px) border-(color:--vk-ground) bg-(color:--vk-brand)", "[@media(hover:hover)_and_(pointer:fine)]:block", enabled ? "cursor-crosshair" : "pointer-events-none") }));
|
|
26
27
|
}
|
|
@@ -48,7 +49,7 @@ export function GridRowCells({ props }) {
|
|
|
48
49
|
: null;
|
|
49
50
|
const fieldKey = fieldKeyOf(col);
|
|
50
51
|
const numberFormat = numberFormats?.[fieldKey];
|
|
51
|
-
const showTime =
|
|
52
|
+
const showTime = timeShown(col.format?.withTime, showTimeOverrides?.[fieldKey]);
|
|
52
53
|
const onResolve = editingEnabled &&
|
|
53
54
|
columnEffectiveWritable(col, listConfig) &&
|
|
54
55
|
gridBooleanMode(col) === "marker"
|
|
@@ -7,7 +7,7 @@ import { TextEditor, } from "../../editors/TextEditor.js";
|
|
|
7
7
|
import { cx } from "../../internal/cx.js";
|
|
8
8
|
import { useViews } from "../../provider/context.js";
|
|
9
9
|
import { GridRefusal, useGridEditSession } from "./grid-edit-session.js";
|
|
10
|
-
import { GRID_EDITOR_LAYER } from "./grid-editor-layer.js";
|
|
10
|
+
import { BODY_FIGURE_ROOM_PX, GRID_EDITOR_LAYER } from "./grid-editor-layer.js";
|
|
11
11
|
import { GridFittedBox } from "./grid-fitted-box.js";
|
|
12
12
|
const TEXT_TYPES = new Set([
|
|
13
13
|
"text",
|
|
@@ -46,6 +46,6 @@ export function GridTextEditor({ initial, seed, type = "text", paragraph = false
|
|
|
46
46
|
: {}), boxData: { "data-slot": "vk-grid-editor", "data-grid-editor": "" }, onRequestClose: close, className: surface === "sheet"
|
|
47
47
|
? "w-full min-w-0 select-text"
|
|
48
48
|
: cx("h-full w-full min-w-0 select-text bg-transparent text-(length:--vk-text) text-(color:--vk-fg) outline-hidden placeholder:text-(color:--vk-fg-subtlest)", strong && "font-medium") }));
|
|
49
|
-
return surface === "sheet" ? (open ? (_jsxs("div", { className: "flex items-center gap-2 px-4 pb-4", onInput: (e) => setStored(e.target.value === initial), children: [_jsx("div", { className: "min-w-0 flex-1", children: editor }), stored && _jsx(OpenValueAction, { type: open.type, value: open.value, label: initial })] })) : (_jsx("div", { className: "px-4 pb-4", children: editor }))) : TextBody ? (_jsxs("span", { "data-grown": "", className: GRID_EDITOR_LAYER, children: [editor, _jsx(GridRefusal, { reason: session.refusal })] })) : (_jsxs("span", { className: "relative flex h-full w-full min-w-0", children: [_jsx(GridFittedBox, { boxRef: boxRef, children: editor }), _jsx(GridRefusal, { reason: session.refusal })] }));
|
|
49
|
+
return surface === "sheet" ? (open ? (_jsxs("div", { className: "flex items-center gap-2 px-4 pb-4", onInput: (e) => setStored(e.target.value === initial), children: [_jsx("div", { className: "min-w-0 flex-1", children: editor }), stored && _jsx(OpenValueAction, { type: open.type, value: open.value, label: initial })] })) : (_jsx("div", { className: "px-4 pb-4", children: editor }))) : TextBody ? (_jsxs("span", { "data-grown": "", className: GRID_EDITOR_LAYER, children: [_jsx(GridFittedBox, { boxRef: boxRef, edge: false, room: BODY_FIGURE_ROOM_PX, children: editor }), _jsx(GridRefusal, { reason: session.refusal })] })) : (_jsxs("span", { className: "relative flex h-full w-full min-w-0", children: [_jsx(GridFittedBox, { boxRef: boxRef, children: editor }), _jsx(GridRefusal, { reason: session.refusal })] }));
|
|
50
50
|
} }));
|
|
51
51
|
}
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
* The layer an app's text or number body (`TextBody`, `NumberBody`) stands in while its cell edits on a computer:
|
|
3
3
|
* absolute on the cell, 1px past each edge so the body covers the cell's lines, above the cell's outline (layer 1).
|
|
4
4
|
* The cell keeps its padding. `data-grown` on the layer still lifts the cell over the rows below and the frozen columns
|
|
5
|
-
* (`gridCellClassName`).
|
|
5
|
+
* (`gridCellClassName`). The body stands in a fitted box inside it (`GridFittedBox`, no frame of its own), which grows past
|
|
6
|
+
* the cell, leftward in a right-aligned column, when its unit or country leaves the value too little room.
|
|
6
7
|
*/
|
|
7
8
|
export declare const GRID_EDITOR_LAYER = "absolute -inset-px z-2 flex min-w-0";
|
|
9
|
+
/** The least room a body's value keeps beside its unit's button or a phone's country, empty or not: a few digits and
|
|
10
|
+
* the caret. */
|
|
11
|
+
export declare const BODY_FIGURE_ROOM_PX = 48;
|
|
@@ -8,8 +8,14 @@ import { type ReactNode, type RefObject } from "react";
|
|
|
8
8
|
* again at every keystroke: the input says by how much its text overflows it, and the box takes that
|
|
9
9
|
* much more. Grown, it draws the editing cell's frame around itself, over the cell's own, so the editor
|
|
10
10
|
* reads as one box, and the cell rises over the frozen columns (`data-grown`, `gridCellClassName`).
|
|
11
|
+
* An app's body (`edge={false}`) draws its own edge, which grows with the box, so the box draws none; its value shares the
|
|
12
|
+
* box with a unit or a country, so it keeps `room` to type in even when empty.
|
|
11
13
|
*/
|
|
12
|
-
export declare function GridFittedBox({ boxRef, children, }: {
|
|
14
|
+
export declare function GridFittedBox({ boxRef, edge, room, children, }: {
|
|
13
15
|
boxRef: RefObject<HTMLSpanElement | null>;
|
|
16
|
+
/** The editing cell's frame round the grown box: false where what it holds draws its own edge. */
|
|
17
|
+
edge?: boolean;
|
|
18
|
+
/** The pixels the input keeps at least, its value or not: a box that shares the cell with a unit's button. */
|
|
19
|
+
room?: number;
|
|
14
20
|
children: ReactNode;
|
|
15
21
|
}): import("react/jsx-runtime").JSX.Element;
|