viewkitjs 0.33.0 → 0.35.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 +139 -0
- package/package.json +1 -1
- package/views/README.md +1 -1
- package/views/dist/atoms/Avatar.js +2 -1
- package/views/dist/atoms/RelationChip.d.ts +2 -0
- package/views/dist/atoms/RelationChip.js +5 -0
- package/views/dist/atoms/RowMenu.d.ts +1 -1
- package/views/dist/atoms/RowMenu.js +15 -3
- package/views/dist/atoms/defaults.js +2 -0
- package/views/dist/atoms/types.d.ts +40 -4
- package/views/dist/cells/relation-wrap.js +9 -2
- package/views/dist/contract.d.ts +27 -14
- package/views/dist/contract.js +40 -4
- package/views/dist/controls/alert/alert.js +2 -1
- package/views/dist/controls/alert-dialog/alert-dialog.js +3 -2
- package/views/dist/controls/avatar/avatar-mark.d.ts +4 -0
- package/views/dist/controls/avatar/avatar-mark.js +5 -0
- package/views/dist/controls/avatar/avatar.d.ts +7 -4
- package/views/dist/controls/avatar/avatar.js +10 -4
- package/views/dist/controls/avatar/looks.d.ts +1 -1
- package/views/dist/controls/avatar/looks.js +3 -0
- package/views/dist/controls/avatar/record-mark.d.ts +16 -0
- package/views/dist/controls/avatar/record-mark.js +13 -0
- package/views/dist/controls/avatar/tokens.d.ts +12 -0
- package/views/dist/controls/avatar/tokens.js +3 -0
- package/views/dist/controls/avatar.css +54 -17
- package/views/dist/controls/bulk-bar/bulk-bar.js +29 -27
- package/views/dist/controls/bulk-bar/map-selection-bar.js +2 -1
- package/views/dist/controls/compound-editor/compound-editor.d.ts +3 -0
- package/views/dist/controls/compound-editor/map-parts-body.d.ts +1 -1
- package/views/dist/controls/compound-editor/map-parts-body.js +6 -1
- package/views/dist/controls/compound-editor/name-parts.js +2 -1
- package/views/dist/controls/compound-editor/place-parts.js +2 -2
- package/views/dist/controls/compound-editor/range-parts.js +10 -9
- package/views/dist/controls/controls.d.ts +2 -0
- package/views/dist/controls/controls.js +2 -0
- package/views/dist/controls/customize/customize.d.ts +14 -5
- package/views/dist/controls/customize/customize.js +19 -20
- package/views/dist/controls/customize/map-customize-body.d.ts +2 -2
- package/views/dist/controls/customize/map-customize-body.js +15 -13
- package/views/dist/controls/customize/words.d.ts +3 -3
- package/views/dist/controls/date-editor/date-editor.d.ts +3 -0
- package/views/dist/controls/date-editor/date-editor.js +13 -7
- package/views/dist/controls/date-editor/map-calendar.js +2 -0
- package/views/dist/controls/date-editor/map-date-body.d.ts +1 -1
- package/views/dist/controls/date-editor/map-date-body.js +7 -3
- package/views/dist/controls/filter-editor/filter-editor.d.ts +2 -0
- package/views/dist/controls/filter-editor/filter-editor.js +4 -6
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +2 -0
- package/views/dist/controls/filter-editor/map-filter-body.js +7 -4
- package/views/dist/controls/filter-editor/parts.d.ts +4 -2
- package/views/dist/controls/filter-editor/parts.js +8 -7
- package/views/dist/controls/group-editor/group-editor.js +2 -1
- package/views/dist/controls/group-editor/map-group-body.d.ts +1 -0
- package/views/dist/controls/group-editor/map-group-body.js +5 -1
- package/views/dist/controls/index.d.ts +1 -1
- package/views/dist/controls/input/input.js +2 -1
- package/views/dist/controls/internal/head-button.d.ts +9 -0
- package/views/dist/controls/internal/head-button.js +13 -0
- package/views/dist/controls/internal/map-panel-controls.js +9 -5
- package/views/dist/controls/internal/panel-controls.d.ts +38 -6
- package/views/dist/controls/internal/panel-controls.js +191 -19
- package/views/dist/controls/links-editor/links-editor.js +5 -7
- package/views/dist/controls/links-editor/map-links-body.d.ts +1 -1
- package/views/dist/controls/links-editor/map-links-body.js +5 -1
- package/views/dist/controls/menu/menu.d.ts +5 -1
- package/views/dist/controls/menu/menu.js +4 -3
- package/views/dist/controls/modal/modal.js +5 -3
- package/views/dist/controls/number-editor/map-number-body.js +5 -1
- package/views/dist/controls/number-editor/number-editor.js +6 -6
- package/views/dist/controls/pane/map-pane.d.ts +3 -0
- package/views/dist/controls/pane/map-pane.js +5 -0
- package/views/dist/controls/picker/map-fields-body.d.ts +2 -2
- package/views/dist/controls/picker/map-fields-body.js +30 -2
- package/views/dist/controls/picker/map-picker.d.ts +8 -3
- package/views/dist/controls/picker/map-picker.js +14 -3
- package/views/dist/controls/picker/picker.js +11 -8
- package/views/dist/controls/picker/rows.d.ts +7 -2
- package/views/dist/controls/picker.css +10 -1
- package/views/dist/controls/quick-filters/map-quick-filters-body.d.ts +2 -1
- package/views/dist/controls/quick-filters/map-quick-filters-body.js +9 -4
- package/views/dist/controls/quick-filters/quick-filters.js +8 -6
- package/views/dist/controls/quick-filters/reminder.js +2 -2
- package/views/dist/controls/quick-filters/rules.d.ts +4 -1
- package/views/dist/controls/quick-filters/words.d.ts +2 -0
- package/views/dist/controls/quick-filters/words.js +1 -0
- package/views/dist/controls/select/select.d.ts +3 -0
- package/views/dist/controls/select/select.js +9 -3
- package/views/dist/controls/setting-row/looks.js +5 -5
- package/views/dist/controls/setting-row/setting-row.d.ts +3 -1
- package/views/dist/controls/setting-row/setting-row.js +3 -1
- package/views/dist/controls/setting-row.css +3 -2
- package/views/dist/controls/sheet/bottom-sheet.d.ts +3 -1
- package/views/dist/controls/sheet/bottom-sheet.js +2 -2
- package/views/dist/controls/sort-editor/map-sort-body.js +4 -4
- package/views/dist/controls/sort-editor/sort-editor.d.ts +2 -0
- package/views/dist/controls/sort-editor/sort-editor.js +4 -5
- package/views/dist/controls/text-editor/map-text-body.js +5 -1
- package/views/dist/controls/text-editor/text-editor.js +5 -4
- package/views/dist/controls/toolbar/toolbar.d.ts +29 -14
- package/views/dist/controls/toolbar/toolbar.js +17 -22
- package/views/dist/controls/toolbar.css +0 -5
- package/views/dist/controls/tooltip/map-tooltip.d.ts +1 -1
- package/views/dist/controls/tooltip/map-tooltip.js +4 -2
- package/views/dist/controls/values-editor/map-values-body.d.ts +1 -2
- package/views/dist/controls/values-editor/map-values-body.js +5 -1
- package/views/dist/controls/values-editor/values-editor.js +8 -7
- package/views/dist/controls/views-list/map-view-menu.d.ts +3 -2
- package/views/dist/controls/views-list/map-view-menu.js +6 -2
- package/views/dist/controls/views-list/map-views-list-body.d.ts +2 -1
- package/views/dist/controls/views-list/map-views-list-body.js +6 -5
- package/views/dist/controls/views-list/view-menu.js +3 -4
- package/views/dist/controls/views-list/views-list.js +2 -2
- package/views/dist/display/option-badges.d.ts +16 -0
- package/views/dist/display/option-badges.js +11 -0
- package/views/dist/display/relation-link.d.ts +12 -0
- package/views/dist/display/relation-link.js +17 -0
- package/views/dist/display/relation.d.ts +1 -1
- package/views/dist/display/relation.js +10 -3
- package/views/dist/display/select.js +1 -8
- package/views/dist/editors/EditorPanel.js +4 -4
- package/views/dist/editors/RangeEditor.d.ts +3 -0
- package/views/dist/editors/RangeEditor.js +2 -2
- package/views/dist/editors/SelectEditor.d.ts +2 -2
- package/views/dist/editors/SelectEditor.js +1 -1
- package/views/dist/editors/TextEditor.js +4 -2
- package/views/dist/editors/ValueListEditor.js +2 -1
- package/views/dist/field-row/FieldRow.js +32 -5
- package/views/dist/field-row/editors/RowRangeEditor.js +2 -1
- package/views/dist/grid/chrome/GridAddColumn.js +9 -6
- package/views/dist/grid/chrome/GridCellEditors.js +1 -1
- package/views/dist/grid/chrome/GridCellOutline.d.ts +3 -1
- package/views/dist/grid/chrome/GridCellOutline.js +16 -6
- package/views/dist/grid/chrome/GridChipsEditor.js +3 -2
- package/views/dist/grid/chrome/GridColumnMenu.js +7 -4
- package/views/dist/grid/chrome/GridFooter.d.ts +4 -1
- package/views/dist/grid/chrome/GridFooter.js +4 -4
- package/views/dist/grid/chrome/GridGroupMenu.js +39 -14
- package/views/dist/grid/chrome/GridHeader.d.ts +1 -1
- package/views/dist/grid/chrome/GridHeader.js +1 -2
- package/views/dist/grid/chrome/GridRangeEditor.d.ts +4 -1
- package/views/dist/grid/chrome/GridRangeEditor.js +2 -2
- package/views/dist/grid/chrome/GridRow.js +5 -3
- package/views/dist/grid/chrome/GridRowActions.d.ts +4 -1
- package/views/dist/grid/chrome/GridRowActions.js +2 -2
- package/views/dist/grid/chrome/GridRowCells.js +3 -2
- package/views/dist/grid/chrome/GridStructure.js +1 -1
- package/views/dist/grid/chrome/GridTable.js +32 -20
- package/views/dist/grid/chrome/checks.d.ts +1 -1
- package/views/dist/grid/chrome/checks.js +4 -1
- package/views/dist/grid/chrome/grid-cell-classes.d.ts +6 -2
- package/views/dist/grid/chrome/grid-cell-classes.js +10 -5
- package/views/dist/grid/chrome/grid-hover.d.ts +10 -2
- package/views/dist/grid/chrome/grid-hover.js +14 -4
- package/views/dist/grid/chrome/grid-row-props.d.ts +4 -0
- package/views/dist/grid/chrome/grid-rows-menu.js +9 -4
- package/views/dist/grid/chrome/grid-table-props.d.ts +10 -2
- package/views/dist/grid/grid.css +6 -0
- package/views/dist/grid/looks.d.ts +3 -1
- package/views/dist/grid/looks.js +10 -4
- package/views/dist/list/layer.d.ts +8 -0
- package/views/dist/list/layer.js +7 -0
- package/views/dist/list/list.d.ts +6 -2
- package/views/dist/list/list.js +6 -2
- package/views/dist/list/parts.js +3 -2
- package/views/dist/list/store.d.ts +1 -1
- package/views/dist/list/toolbar.js +51 -20
- package/views/dist/list/views.js +1 -0
- package/views/dist/panels/availability.d.ts +5 -0
- package/views/dist/panels/availability.js +4 -5
- package/views/dist/panels/customize-body.d.ts +4 -0
- package/views/dist/panels/customize-body.js +13 -11
- package/views/dist/panels/model.d.ts +9 -4
- package/views/dist/panels/react/customize-body.js +5 -2
- package/views/dist/panels/react/customize.d.ts +5 -0
- package/views/dist/panels/react/filter/FilterEditor.d.ts +6 -0
- package/views/dist/panels/react/filter/FilterEditor.js +7 -0
- package/views/dist/panels/react/quick/QuickFiltersPanel.d.ts +3 -1
- package/views/dist/panels/react/quick/QuickFiltersPanel.js +7 -3
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +17 -1
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +15 -1
- package/views/dist/panels/react/toolbar/Toolbar.js +24 -9
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +3 -2
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.d.ts +6 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +14 -6
- package/views/dist/panels/react/toolbar/ToolbarFilters.d.ts +7 -3
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +21 -10
- package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +6 -1
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSave.d.ts +3 -1
- package/views/dist/panels/react/toolbar/ToolbarSave.js +5 -4
- package/views/dist/panels/react/toolbar/ToolbarSort.d.ts +7 -1
- package/views/dist/panels/react/toolbar/ToolbarSort.js +6 -3
- package/views/dist/panels/react/toolbar/ToolbarSortPill.d.ts +3 -0
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +7 -6
- package/views/dist/panels/react/toolbar/context.d.ts +21 -0
- package/views/dist/panels/react/toolbar/context.js +4 -0
- package/views/dist/panels/react/toolbar/pane-host.d.ts +6 -0
- package/views/dist/panels/react/toolbar/pane-host.js +17 -0
- package/views/dist/panels/react/toolbar/panel-part.js +3 -2
- package/views/dist/panels/react/views-row/ViewPicker.js +13 -5
- package/views/dist/panels/react.d.ts +2 -2
- package/views/dist/panels/settings/layout.js +6 -38
- package/views/dist/panels/toolbar/page-resets.d.ts +17 -0
- package/views/dist/panels/toolbar/page-resets.js +62 -0
- package/views/dist/panels/toolbar/same-item.d.ts +7 -0
- package/views/dist/panels/toolbar/same-item.js +9 -0
- package/views/dist/panels/view-state.d.ts +4 -0
- package/views/dist/provider/ViewsProvider.d.ts +9 -3
- package/views/dist/provider/ViewsProvider.js +13 -2
- package/views/dist/provider/components.d.ts +59 -8
- package/views/dist/provider/components.js +1 -1
- package/views/dist/react.d.ts +2 -2
- package/views/dist/styles.css +194 -100
- package/views/dist/styles.unlayered.css +194 -100
- package/views/docs/contract.md +96 -27
- package/views/docs/controls/alert-dialog.md +4 -0
- package/views/docs/controls/alert.md +4 -0
- package/views/docs/controls/avatar.md +3 -0
- package/views/docs/controls/bulk-bar.md +7 -1
- package/views/docs/controls/compound-editor.md +2 -0
- package/views/docs/controls/customize.md +3 -1
- package/views/docs/controls/date-editor.md +2 -0
- package/views/docs/controls/filter-editor.md +1 -1
- package/views/docs/controls/group-editor.md +2 -0
- package/views/docs/controls/links-editor.md +2 -0
- package/views/docs/controls/menu.md +3 -1
- package/views/docs/controls/modal.md +4 -0
- package/views/docs/controls/number-editor.md +2 -0
- package/views/docs/controls/pane.md +1 -1
- package/views/docs/controls/picker.md +2 -0
- package/views/docs/controls/quick-filters.md +4 -2
- package/views/docs/controls/sheet.md +1 -1
- package/views/docs/controls/text-editor.md +3 -1
- package/views/docs/controls/toolbar.md +4 -0
- package/views/docs/controls/values-editor.md +2 -0
- package/views/docs/controls/views-list.md +2 -0
- package/views/docs/guides/atoms.md +54 -3
- package/views/docs/guides/display.md +1 -1
- package/views/docs/guides/looks.md +1 -1
- package/views/docs/guides/the-grid.md +4 -2
- package/views/docs/guides/the-provider.md +4 -4
- package/views/docs/index.md +2 -2
- package/views/docs/install.md +198 -104
- package/views/docs/reference/controls.md +21 -17
- package/views/docs/reference/editors-range.md +1 -1
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +2 -1
- package/views/docs/reference/list.md +7 -5
- package/views/docs/reference/looks.md +6 -6
- package/views/docs/reference/panels-react.md +17 -15
- package/views/docs/reference/panels.md +4 -4
- package/views/docs/reference/react.md +15 -12
- package/views/docs/reference/views.md +6 -4
- package/views/docs/reshaping.md +32 -5
- package/views/skills/views/SKILL.md +3 -3
|
@@ -11,7 +11,8 @@ import { MenuList, tilesOf, useMenuListOption, useMenuListRows } from "../menu-l
|
|
|
11
11
|
import { menuEntries } from "../menu/map-menu.js";
|
|
12
12
|
import { menuWordsOf, pickerWordsOf } from "../picker/map-picker.js";
|
|
13
13
|
import { useViewsList } from "./views-list.js";
|
|
14
|
-
import {
|
|
14
|
+
import { PanelHeadButton } from "../internal/head-button.js";
|
|
15
|
+
import { PanelControlsFromViews } from "../internal/map-panel-controls.js";
|
|
15
16
|
import { SheetPartsFrom } from "../sheet/sheet-parts.js";
|
|
16
17
|
import { Icon } from "../internal/icons.js";
|
|
17
18
|
export function viewsListWordsOf(say, createLabel) {
|
|
@@ -59,7 +60,7 @@ export function viewsListPropsOf(p, words, notNow, AppIcon) {
|
|
|
59
60
|
}
|
|
60
61
|
},
|
|
61
62
|
onDone: p.onDone,
|
|
62
|
-
entries: (id) => menuEntries(menuOf(id) ?? [], notNow),
|
|
63
|
+
entries: (id) => menuEntries(menuOf(id) ?? [], notNow, "vk-view-menu-row"),
|
|
63
64
|
...(p.onCreate ? { onNew: p.onCreate } : {}),
|
|
64
65
|
privateViews: p.views.some((v) => v.private),
|
|
65
66
|
reorder: !!p.onReorder,
|
|
@@ -105,7 +106,7 @@ export function viewMenuWordsOf(say) {
|
|
|
105
106
|
};
|
|
106
107
|
}
|
|
107
108
|
export function MapViewsListBody(props) {
|
|
108
|
-
return props.verbs ? _jsx(WithVerbs, { ...props, verbs: props.verbs }) : _jsx(Plain, { ...props });
|
|
109
|
+
return _jsx(PanelControlsFromViews, { children: props.verbs ? _jsx(WithVerbs, { ...props, verbs: props.verbs }) : _jsx(Plain, { ...props }) });
|
|
109
110
|
}
|
|
110
111
|
const _menuChangeIsTheSlots = true;
|
|
111
112
|
const _menuAskIsTheConfirmPort = true;
|
|
@@ -116,7 +117,7 @@ function useStepHead(step, props) {
|
|
|
116
117
|
const setParts = React.useContext(SheetPartsFrom);
|
|
117
118
|
React.useLayoutEffect(() => { setParts?.(step ? { title: step.title, head: { onBack: step.onBack } } : null); });
|
|
118
119
|
React.useLayoutEffect(() => () => setParts?.(null), [setParts]);
|
|
119
|
-
return step && props.actions?.back && !setParts ? (_jsx("div", { className: "o-sheet-head", "data-slot": "vk-views-list-head", children: _jsx(HeaderBar, { className: "o-sheet-row", "data-sides": "", title: _jsx("h2", { className: "o-sheet-title", children: step.title }), right: _jsx("span", {}), left: _jsx(
|
|
120
|
+
return step && props.actions?.back && !setParts ? (_jsx("div", { className: "o-sheet-head", "data-slot": "vk-views-list-head", children: _jsx(HeaderBar, { className: "o-sheet-row", "data-sides": "", title: _jsx("h2", { className: "o-sheet-title", children: step.title }), right: _jsx("span", {}), left: _jsx(PanelHeadButton, { "data-slot": "vk-editor-back", "aria-label": props.actions.back.label, className: "o-sheet-back", icon: _jsx(Icon, { name: "left" }), onClick: props.actions.back.onPress }) }) })) : null;
|
|
120
121
|
}
|
|
121
122
|
function Plain(props) {
|
|
122
123
|
const context = React.useContext(ViewsContext);
|
|
@@ -129,7 +130,7 @@ function Plain(props) {
|
|
|
129
130
|
const shown = props.form === "phone" ? props.views.find((v) => v.value === menuFor) : undefined;
|
|
130
131
|
const step = shown ? {
|
|
131
132
|
title: shown.label, onBack: () => setMenuFor(null),
|
|
132
|
-
body: _jsx("div", { style: { display: "contents" }, ...MENU_LIST_CARD_FRAME, children: _jsx(MenuList, { label: shown.label, ...tilesOf(leavingFirst(base.entries(shown.value), () => setMenuFor(null))), ...(closeRow ? { onClose: () => setMenuFor(null) } : {}), closeWord: words.menu?.close ?? say({ key: "views.panels.close" }) }) }),
|
|
133
|
+
body: _jsx("div", { style: { display: "contents" }, "data-slot": "vk-view-menu", ...MENU_LIST_CARD_FRAME, children: _jsx(MenuList, { label: shown.label, ...tilesOf(leavingFirst(base.entries(shown.value), () => setMenuFor(null))), ...(closeRow ? { onClose: () => setMenuFor(null) } : {}), closeWord: words.menu?.close ?? say({ key: "views.panels.close" }) }) }),
|
|
133
134
|
} : null;
|
|
134
135
|
const list = useViewsList({ ...base, onMenu: setMenuFor, step });
|
|
135
136
|
const head = useStepHead(step, props);
|
|
@@ -2,11 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { Alert } from "../alert/alert.js";
|
|
4
4
|
import { AlertDialog } from "../alert-dialog/alert-dialog.js";
|
|
5
|
-
import { Button } from "../button/button.js";
|
|
6
5
|
import { Field } from "../field/field.js";
|
|
7
|
-
import { Input } from "../input/input.js";
|
|
8
6
|
import { asSelect, OnTop } from "../internal/editor-parts.js";
|
|
9
7
|
import { Icon } from "../internal/icons.js";
|
|
8
|
+
import { usePanelControls } from "../internal/panel-controls.js";
|
|
10
9
|
import { PhoneHost, usePhone } from "../internal/phone.js";
|
|
11
10
|
import { menuEntries } from "../menu/map-menu.js";
|
|
12
11
|
import { MENU_LIST_CARD_FRAME } from "../menu-list/looks.js";
|
|
@@ -14,7 +13,6 @@ import { MenuList, tilesOf, useMenuListOption, useMenuListRows } from "../menu-l
|
|
|
14
13
|
import { Modal } from "../modal/modal.js";
|
|
15
14
|
import { Picker } from "../picker/picker.js";
|
|
16
15
|
import { Radio, RadioGroup } from "../radio/radio.js";
|
|
17
|
-
import { Select } from "../select/select.js";
|
|
18
16
|
import { useInToast, useToast } from "../toast/toast.js";
|
|
19
17
|
import { canDelete, deleteLine } from "./rules.js";
|
|
20
18
|
import { LOCK, useViewsListWorn } from "./views-list.js";
|
|
@@ -30,6 +28,7 @@ function ToastBridge({ onSend }) {
|
|
|
30
28
|
}
|
|
31
29
|
export function useViewMenu(props) {
|
|
32
30
|
const { views, open, layouts, columns, records, onChange, onDone, ask: askPort, report } = props;
|
|
31
|
+
const { Button, Input, Select } = usePanelControls();
|
|
33
32
|
const w = React.useMemo(() => ({ ...VIEW_MENU_WORDS, ...props.words }), [props.words]);
|
|
34
33
|
const screen = React.useContext(PhoneHost), small = usePhone(), phone = (props.form ?? (screen || small ? "phone" : "computer")) === "phone";
|
|
35
34
|
const stepping = phone && !!props.steps;
|
|
@@ -169,7 +168,7 @@ export function useViewMenu(props) {
|
|
|
169
168
|
const done = (run, disabled, label) => (_jsx("div", { className: "o-views-list-step-foot", children: _jsx(Button, { kind: "primary", className: "o-views-list-step-act", "data-slot": "vk-view-menu-act", disabled: disabled, onClick: () => { run(); toList(); }, children: label }) }));
|
|
170
169
|
if (asked.what === "menu" && target) {
|
|
171
170
|
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);
|
|
172
|
-
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 }) }) };
|
|
171
|
+
return { title: target.name, onBack: toList, body: _jsx("div", { style: { display: "contents" }, "data-slot": "vk-view-menu", ...MENU_LIST_CARD_FRAME, children: _jsx(MenuList, { label: target.name, ...tilesOf(leaving(entries(target.id))), ...(closeRow ? { onClose: toList } : {}), closeWord: w.close }) }) };
|
|
173
172
|
}
|
|
174
173
|
if (asked.what === "rename" && target)
|
|
175
174
|
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)] }) };
|
|
@@ -5,7 +5,7 @@ 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 {
|
|
8
|
+
import { PanelHeadButton } from "../internal/head-button.js";
|
|
9
9
|
import { openerAt, useStepReturn } from "../internal/step-return.js";
|
|
10
10
|
import { VIEWS_LIST_ATTRS, viewsListWornOf } from "./looks.js";
|
|
11
11
|
import { listed } from "./rules.js";
|
|
@@ -58,7 +58,7 @@ export function useViewsList(props) {
|
|
|
58
58
|
const placeRoot = React.useCallback((el) => { rootRef.current = el; setRoot(el); }, [setRoot]);
|
|
59
59
|
useStepReturn(rootRef, step && opener ? [openerAt(() => `[role="option"][data-name="${CSS.escape(opener)}"] .o-picker-row-menu`)] : []);
|
|
60
60
|
if (step) {
|
|
61
|
-
const back = _jsx(
|
|
61
|
+
const back = _jsx(PanelHeadButton, { "data-slot": "vk-editor-back", "aria-label": w.back, className: "o-sheet-back", icon: _jsx(Icon, { name: "left" }), onClick: step.onBack });
|
|
62
62
|
return {
|
|
63
63
|
body: _jsx("div", { ref: placeRoot, className: "o-views-list", "data-slot": "vk-views-list", "data-kit": "views-list", "data-views-form": "phone", "data-views-step": "", ...phoneMark(!!screen || small), children: step.body }),
|
|
64
64
|
head: { left: back, children: step.title, right: _jsx("span", {}) },
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CategoryColor } from "viewkitjs/fields/design/category-colors";
|
|
2
|
+
import type { StatusSlot } from "viewkitjs/fields/design/status-slots";
|
|
3
|
+
import type { ViewsStatusPlace } from "../atoms/types.js";
|
|
4
|
+
/** A status option as its cell draws it. */
|
|
5
|
+
export declare function OptionStatus({ slot, label, icon, place, }: {
|
|
6
|
+
slot: StatusSlot;
|
|
7
|
+
label: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
place?: ViewsStatusPlace;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
/** A category option as its cell draws it. */
|
|
12
|
+
export declare function OptionCategory({ label, color, icon }: {
|
|
13
|
+
label: string;
|
|
14
|
+
color: CategoryColor;
|
|
15
|
+
icon?: string;
|
|
16
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useViews } from "../provider/context.js";
|
|
4
|
+
export function OptionStatus({ slot, label, icon, place, }) {
|
|
5
|
+
const { atoms: { StatusBadge }, components: { AppIcon }, } = useViews();
|
|
6
|
+
return (_jsx(StatusBadge, { slot: slot, label: label, place: place, size: "row", className: "border-0", leading: icon ? _jsx(AppIcon, { name: icon, className: "size-3 shrink-0" }) : undefined }));
|
|
7
|
+
}
|
|
8
|
+
export function OptionCategory({ label, color, icon }) {
|
|
9
|
+
const { atoms: { Tag }, components: { AppIcon }, } = useViews();
|
|
10
|
+
return (_jsx(Tag, { label: label, color: color, leading: icon ? _jsx(AppIcon, { name: icon, className: "size-3 shrink-0" }) : undefined }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ReactElement } from "react";
|
|
2
|
+
import type { RelationValue } from "viewkitjs/fields";
|
|
3
|
+
import type { ViewsRelationChipLinkProps } from "../atoms/types.js";
|
|
4
|
+
import type { RelationWrap } from "./options.js";
|
|
5
|
+
/** The host's link a chip draws itself through. */
|
|
6
|
+
export type RelationLinkRender = (props: ViewsRelationChipLinkProps) => ReactElement;
|
|
7
|
+
/** The wrap, saying how it draws itself as the element the app's chip hands its props to. */
|
|
8
|
+
export declare function withRelationLink(wrap: RelationWrap, linkFor: (relation: RelationValue) => RelationLinkRender): RelationWrap;
|
|
9
|
+
/** The host's link for one relation, from the wrap it handed: what the wrap says, else the wrap around a span holding the props. */
|
|
10
|
+
export declare function relationLinkOf(wrap: RelationWrap, relation: RelationValue): RelationLinkRender;
|
|
11
|
+
/** The size a mentioned record is drawn at, by place: a field row's value says `row`. */
|
|
12
|
+
export declare const RelationChipSize: import("react").Context<"row" | "chip">;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { createContext } from "react";
|
|
4
|
+
const LINKS = new WeakMap();
|
|
5
|
+
export function withRelationLink(wrap, linkFor) {
|
|
6
|
+
LINKS.set(wrap, linkFor);
|
|
7
|
+
return wrap;
|
|
8
|
+
}
|
|
9
|
+
export function relationLinkOf(wrap, relation) {
|
|
10
|
+
const own = LINKS.get(wrap);
|
|
11
|
+
if (own)
|
|
12
|
+
return own(relation);
|
|
13
|
+
return function hostRelationLink(props) {
|
|
14
|
+
return _jsx(_Fragment, { children: wrap(relation, _jsx("span", { ...props })) });
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export const RelationChipSize = createContext("chip");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
2
|
import { type FieldDefOf } from "viewkitjs/fields";
|
|
3
3
|
import type { DisplayOptions } from "./options.js";
|
|
4
4
|
export declare function renderRelation(field: FieldDefOf<"relation">, value: unknown, opts?: DisplayOptions): ReactNode;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useContext } from "react";
|
|
3
4
|
import { orderLinks, relationKinds, relationRolesOf, resolveRelationValue, } from "viewkitjs/fields";
|
|
4
5
|
import { CHIP_BASE } from "../internal/chip.js";
|
|
5
6
|
import { useViews } from "../provider/context.js";
|
|
6
7
|
import { EntityChipIdentity } from "./entity-chip.js";
|
|
7
8
|
import { MultiValueCell } from "./multi-value.js";
|
|
9
|
+
import { RelationChipSize, relationLinkOf } from "./relation-link.js";
|
|
8
10
|
import { cellTextClass } from "./text-class.js";
|
|
9
11
|
function roleLabels(field, relation) {
|
|
10
12
|
if (field.cardinality !== "many" || !field.links)
|
|
@@ -36,9 +38,14 @@ function RelationChip({ field, relation, opts, }) {
|
|
|
36
38
|
const views = useViews();
|
|
37
39
|
const Glyph = views.icons.relation;
|
|
38
40
|
const { RelationRoles } = views.atoms;
|
|
41
|
+
const App = views.panelControls.has("RelationChip") ? views.atoms.RelationChip : null;
|
|
42
|
+
const size = useContext(RelationChipSize);
|
|
39
43
|
const roles = roleLabels(field, relation);
|
|
40
44
|
const chip = (_jsxs(_Fragment, { children: [_jsx(EntityChipIdentity, { label: relation.label, avatarUrl: relation.avatarUrl, kind: relation.entity, iconOverride: relation.icon ?? opts?.entityIcon?.(relation.entity), fallbackIcon: _jsx(Glyph, { className: "h-3 w-3 shrink-0 text-(color:--vk-fg-subtlest)" }), labelClassName: cellTextClass(opts?.wrap) }), roles.length > 0 ? _jsx(RelationRoles, { relation: relation, roles: roles }) : null] }));
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
const wrap = opts?.relationWrap;
|
|
46
|
+
const own = wrap ? (wrap(relation, chip)) : (_jsx("span", { className: CHIP_BASE, title: chipTitle(relation, roles), children: chip }));
|
|
47
|
+
if (!App)
|
|
48
|
+
return own;
|
|
49
|
+
const render = wrap && !opts?.slotOwnsClick ? relationLinkOf(wrap, relation) : undefined;
|
|
50
|
+
return _jsx(App, { relation: relation, roles: roles, size: size, ...(render ? { render } : {}), fallback: own });
|
|
44
51
|
}
|
|
@@ -3,6 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { resolveCategoryColor } from "viewkitjs/fields/design/category-colors";
|
|
4
4
|
import { optionFor } from "viewkitjs/fields";
|
|
5
5
|
import { useViews } from "../provider/context.js";
|
|
6
|
+
import { OptionCategory, OptionStatus } from "./option-badges.js";
|
|
6
7
|
import { MultiValueCell } from "./multi-value.js";
|
|
7
8
|
import { placeAmong, statusSteps } from "./status-steps.js";
|
|
8
9
|
export function renderSelect(field, value, opts) {
|
|
@@ -30,11 +31,3 @@ function StrayOption({ value }) {
|
|
|
30
31
|
const { messages } = useViews();
|
|
31
32
|
return (_jsx("span", { className: "text-(color:--vk-fg-subtle)", title: messages({ key: "views.display.not-an-option" }), children: value }));
|
|
32
33
|
}
|
|
33
|
-
function OptionStatus({ slot, label, icon, place, }) {
|
|
34
|
-
const { atoms: { StatusBadge }, components: { AppIcon }, } = useViews();
|
|
35
|
-
return (_jsx(StatusBadge, { slot: slot, label: label, place: place, size: "row", className: "border-0", leading: icon ? _jsx(AppIcon, { name: icon, className: "size-3 shrink-0" }) : undefined }));
|
|
36
|
-
}
|
|
37
|
-
function OptionCategory({ label, color, icon }) {
|
|
38
|
-
const { atoms: { Tag }, components: { AppIcon }, } = useViews();
|
|
39
|
-
return (_jsx(Tag, { label: label, color: color, leading: icon ? _jsx(AppIcon, { name: icon, className: "size-3 shrink-0" }) : undefined }));
|
|
40
|
-
}
|
|
@@ -140,9 +140,9 @@ export function EditorPanel({ session, title, anchor, inPlace = false, sheetOnPh
|
|
|
140
140
|
const back = () => stepRef.current?.onBack();
|
|
141
141
|
const actions = views.sheetActions === "head"
|
|
142
142
|
? {
|
|
143
|
-
close: { label: discardLabel, onPress: () => close("escape") },
|
|
144
|
-
...(!savesOnPick && { done: { label: saveLabel, onPress: () => close("enter") } }),
|
|
145
|
-
...(step && { back: { label: backLabel, onPress: back } }),
|
|
143
|
+
close: { label: discardLabel, onPress: () => close("escape"), slot: "vk-editor-close" },
|
|
144
|
+
...(!savesOnPick && { done: { label: saveLabel, onPress: () => close("enter"), slot: "vk-editor-save" } }),
|
|
145
|
+
...(step && { back: { label: backLabel, onPress: back, slot: "vk-editor-back" } }),
|
|
146
146
|
}
|
|
147
147
|
: undefined;
|
|
148
148
|
const sheetTitle = step ? step.title : title;
|
|
@@ -155,5 +155,5 @@ export function EditorPanel({ session, title, anchor, inPlace = false, sheetOnPh
|
|
|
155
155
|
if (details?.reason === "escape-key" && (inMarkedStep(document.activeElement) || goBack()))
|
|
156
156
|
return;
|
|
157
157
|
close("escape");
|
|
158
|
-
}, title: sheetTitle, ...(typeof sheetTitle === "string" || typeof sheetTitle === "number" ? { label: String(sheetTitle) } : {}), ...(actions && { actions }), snap: snap, children: _jsxs("div", { ref: panelRef, "data-slot": "vk-editor-panel", children: [actions ? null : (_jsxs("div", { "data-slot": "vk-editor-bar", className: "flex items-center justify-between px-2 pb-1", children: [step ? (_jsx(Button, { variant: "ghost", size: "icon", "data-slot": "vk-editor-back", "aria-label": backLabel, onClick: back, children: _jsx(Back, { className: "size-4" }) })) : (_jsx(Button, { variant: "ghost", size: "icon", "data-slot": "vk-editor-close", "aria-label": discardLabel, onClick: () => close("escape"), children: _jsx(Discard, { className: "size-4" }) })), _jsx(Button, { variant: "ghost", size: "icon", "data-slot": "vk-editor-save", "aria-label": saveLabel, onClick: () => close("enter"), children: _jsx(Save, { className: "size-4" }) })] })), _jsx(BodyStepContext.Provider, { value: hold, children: editor }), reason] }) }) }));
|
|
158
|
+
}, ...(actions ? { title: sheetTitle } : {}), ...(typeof sheetTitle === "string" || typeof sheetTitle === "number" ? { label: String(sheetTitle) } : {}), ...(actions && { actions }), snap: snap, children: _jsxs("div", { ref: panelRef, "data-slot": "vk-editor-panel", children: [actions ? null : (_jsxs("div", { "data-slot": "vk-editor-bar", className: "flex items-center justify-between gap-1 px-2 pb-1", children: [step ? (_jsx(Button, { variant: "ghost", size: "icon", "data-slot": "vk-editor-back", "aria-label": backLabel, onClick: back, children: _jsx(Back, { className: "size-4" }) })) : (_jsx(Button, { variant: "ghost", size: "icon", "data-slot": "vk-editor-close", "aria-label": discardLabel, onClick: () => close("escape"), children: _jsx(Discard, { className: "size-4" }) })), _jsx("span", { "data-slot": "vk-editor-title", className: "min-w-0 flex-1 truncate px-1 text-center text-(length:--vk-panel-title-text,15px) font-semibold text-(color:--vk-fg)", children: sheetTitle }), _jsx(Button, { variant: "ghost", size: "icon", "data-slot": "vk-editor-save", "aria-label": saveLabel, onClick: () => close("enter"), children: _jsx(Save, { className: "size-4" }) })] })), _jsx(BodyStepContext.Provider, { value: hold, children: editor }), reason] }) }) }));
|
|
159
159
|
}
|
|
@@ -23,5 +23,8 @@ export declare const RangeEditor: import("react").ForwardRefExoticComponent<{
|
|
|
23
23
|
bands?: readonly RangePreset[];
|
|
24
24
|
/** The field's name, for the app's `PartsBody`. Default: the two ends' words. */
|
|
25
25
|
label?: string;
|
|
26
|
+
/** The field's limits (`numberBounds`): the body's ends step within them (VK-904). */
|
|
27
|
+
min?: number;
|
|
28
|
+
max?: number;
|
|
26
29
|
onRequestClose: (reason: CloseReason) => void;
|
|
27
30
|
} & import("react").RefAttributes<RangeEditorHandle>>;
|
|
@@ -7,7 +7,7 @@ import { BodyFrame } from "./BodyFrame.js";
|
|
|
7
7
|
import { useBodyStep } from "./body-step.js";
|
|
8
8
|
import { mergeParts, rangeBodyStart, resolveRangeBody } from "./parts-body.js";
|
|
9
9
|
import { usePickerForm } from "./picker-slot.js";
|
|
10
|
-
export const RangeEditor = forwardRef(function RangeEditor({ initial, seed, decimals = 0, allowEmpty = false, suffix, conventions, bands, label, onRequestClose }, ref) {
|
|
10
|
+
export const RangeEditor = forwardRef(function RangeEditor({ initial, seed, decimals = 0, allowEmpty = false, suffix, conventions, bands, label, min, max, onRequestClose }, ref) {
|
|
11
11
|
const views = useViews();
|
|
12
12
|
const { PartsBody } = views.components;
|
|
13
13
|
const onStepChange = useBodyStep();
|
|
@@ -35,6 +35,6 @@ export const RangeEditor = forwardRef(function RangeEditor({ initial, seed, deci
|
|
|
35
35
|
bodyRef.current = { low: merged.low, high: merged.high, unread: false };
|
|
36
36
|
setBodyDraft(bodyRef.current);
|
|
37
37
|
};
|
|
38
|
-
return (_jsx(BodyFrame, { slot: "vk-parts-body", onRequestClose: onRequestClose, children: _jsx(PartsBody, { kind: "range", value: bodyValue, onValueChange: take, decimals: decimals, ...(suffix !== undefined ? { unit: suffix } : {}), ...(bands !== undefined ? { bands } : {}), label: label ??
|
|
38
|
+
return (_jsx(BodyFrame, { slot: "vk-parts-body", onRequestClose: onRequestClose, children: _jsx(PartsBody, { kind: "range", value: bodyValue, onValueChange: take, decimals: decimals, ...(suffix !== undefined ? { unit: suffix } : {}), ...(bands !== undefined ? { bands } : {}), ...(min !== undefined ? { min } : {}), ...(max !== undefined ? { max } : {}), label: label ??
|
|
39
39
|
`${views.messages({ key: "views.editors.range-low" })} – ${views.messages({ key: "views.editors.range-high" })}`, onDone: (how) => onRequestClose(how === "pick" ? "pick" : "enter"), empty: allowEmpty, typed: seed, autoFocus: true, form: form, ...(onStepChange && { onStepChange }) }) }));
|
|
40
40
|
});
|
|
@@ -87,8 +87,8 @@ export declare const SelectEditor: import("react").ForwardRefExoticComponent<{
|
|
|
87
87
|
*
|
|
88
88
|
* Archived options never reach a picker (`optionsOf`). A status keeps its
|
|
89
89
|
* semantic slots; a select gets the category-colour chain — the workspace's
|
|
90
|
-
* `optionColors` first, then the field's own
|
|
91
|
-
* the same colour the grid draws. `extraValues` are an open select's values, the
|
|
90
|
+
* `optionColors` first, then the field's own (an archived option's too), then the
|
|
91
|
+
* derived hue — which is the same colour the grid draws. `extraValues` are an open select's values, the
|
|
92
92
|
* ones its records hold: drawn as their raw code (a registry never invents a
|
|
93
93
|
* label); an archived value stays out. `current` is the value the surface holds:
|
|
94
94
|
* offered last when no active option is it, a stray or an archived option, so
|
|
@@ -65,7 +65,7 @@ export function pickerOptionsFromField(field, opts = {}) {
|
|
|
65
65
|
const option = field.options.find((o) => o.value === value);
|
|
66
66
|
const dressed = field.type === "status"
|
|
67
67
|
? { value, label, slot: option?.slot ?? "muted" }
|
|
68
|
-
: { value, label, color: resolveCategoryColor(value,
|
|
68
|
+
: { value, label, color: resolveCategoryColor(value, field.options, opts.optionColors) };
|
|
69
69
|
return option?.icon ? { ...dressed, icon: option.icon } : dressed;
|
|
70
70
|
};
|
|
71
71
|
return [
|
|
@@ -9,7 +9,9 @@ import { useBodyStep } from "./body-step.js";
|
|
|
9
9
|
import { resolveTextBody, textChange } from "./text-body.js";
|
|
10
10
|
const EVERY_VALUE_READS = () => null;
|
|
11
11
|
export const TextEditorHost = forwardRef(function TextEditorHost({ type, initial, seed, multiline = type === "rich_text", readOnly = false, closeOnBlur = true, label, rows = 1, maxLines = 12, className, style, boxData, check, region, escapeKeeps = false, form = "computer", place = "cell", onRequestClose, }, ref) {
|
|
12
|
-
const
|
|
12
|
+
const views = useViews();
|
|
13
|
+
const { TextBody } = views.components;
|
|
14
|
+
const phoneRegion = region ?? views.conventions.region;
|
|
13
15
|
const onStepChange = useBodyStep();
|
|
14
16
|
const draftRef = useRef(seed ?? initial);
|
|
15
17
|
const [draft, setDraft] = useState(seed ?? initial);
|
|
@@ -52,7 +54,7 @@ export const TextEditorHost = forwardRef(function TextEditorHost({ type, initial
|
|
|
52
54
|
return;
|
|
53
55
|
draftRef.current = text;
|
|
54
56
|
setDraft(text);
|
|
55
|
-
}, onDone: () => onRequestClose("enter"), check: check ?? EVERY_VALUE_READS, ...(type === "phone" &&
|
|
57
|
+
}, onDone: () => onRequestClose("enter"), check: check ?? EVERY_VALUE_READS, ...(type === "phone" && phoneRegion ? { region: phoneRegion } : {}), typed: seed, autoFocus: true, form: form, place: place, ...(onStepChange && { onStepChange }) }) }));
|
|
56
58
|
}
|
|
57
59
|
return (_jsx("textarea", { "data-slot": "vk-text-editor", ...boxData, "aria-label": label, defaultValue: seed ?? initial, readOnly: true, onKeyDown: onKeyDown, onBlur: closeOnBlur ? () => onRequestClose("blur") : undefined, onClick: (event) => event.stopPropagation(), className: cx(ELEMENT_RESET, className), style: style, ref: attach, rows: rows }));
|
|
58
60
|
});
|
|
@@ -10,6 +10,7 @@ import { bodyLines, mergeValueLines, openedItems, resolveValueRows, storedByText
|
|
|
10
10
|
export const ValueListEditor = forwardRef(function ValueListEditor({ field, initial, labels = true, allowEmpty = false, region, escapeKeeps = false, label, holds = "several", seed, onRequestClose, }, ref) {
|
|
11
11
|
const views = useViews();
|
|
12
12
|
const { ValuesBody } = views.components;
|
|
13
|
+
const phoneRegion = region ?? views.conventions.region;
|
|
13
14
|
const onStepChange = useBodyStep();
|
|
14
15
|
const [opened] = useState(() => openedItems(initial));
|
|
15
16
|
const single = (() => {
|
|
@@ -49,5 +50,5 @@ export const ValueListEditor = forwardRef(function ValueListEditor({ field, init
|
|
|
49
50
|
};
|
|
50
51
|
return (_jsx(BodyFrame, { slot: "vk-values-body", innerEscape: escapeKeeps, onRequestClose: onRequestClose, children: _jsx(ValuesBody, { label: label ?? field.label, kind: field.type, value: bodyLines(lines), onValueChange: take, onDone: () => onRequestClose("enter"), check: (text) => text.trim() === "" || opened.some((item) => valueText(item.value) === text)
|
|
51
52
|
? null
|
|
52
|
-
: check(text), labels: keepsLabels, holds: holds, ...(field.type === "phone" &&
|
|
53
|
+
: check(text), labels: keepsLabels, holds: holds, ...(field.type === "phone" && phoneRegion ? { region: phoneRegion } : {}), empty: allowEmpty, typed: seed, autoFocus: true, form: form, ...(onStepChange && { onStepChange }) }) }));
|
|
53
54
|
});
|
|
@@ -4,10 +4,12 @@ import { memo, useContext, useEffect, useLayoutEffect, useRef, useState, } from
|
|
|
4
4
|
import { optimisticDisplay, phoneText, presentedDef, resolveFieldMessage, } from "viewkitjs/fields";
|
|
5
5
|
import { ConvertedFigure } from "../display/converted.js";
|
|
6
6
|
import { renderFieldValue } from "../display/display-cores.js";
|
|
7
|
+
import { RelationChipSize } from "../display/relation-link.js";
|
|
7
8
|
import { FieldRowsCardContext, OutOfFieldRows } from "../internal/field-rows.js";
|
|
8
9
|
import { cx } from "../internal/cx.js";
|
|
9
10
|
import { ROW_INTERACTIVE_SELECTOR as OWN_PRESS } from "../selection/row-click.js";
|
|
10
11
|
import { ELEMENT_RESET } from "../internal/reset.js";
|
|
12
|
+
import { tabbable } from "../editors/tab-ends.js";
|
|
11
13
|
import { useViews } from "../provider/context.js";
|
|
12
14
|
import { useDesktop } from "../provider/desktop.js";
|
|
13
15
|
import { RowEditor, rowOpensSheet } from "./editors/RowEditor.js";
|
|
@@ -23,6 +25,13 @@ import { settlementAttributes, useRowSettlement } from "./useRowSettlement.js";
|
|
|
23
25
|
import { EditLeaveContext, useEditLeaveScope } from "../editors/leave-scope.js";
|
|
24
26
|
const FIELD_ROW_FRAME_READS = "gap-x-(--vk-field-row-gap,calc(var(--spacing)*3)) min-h-(--vk-field-row-h,auto) py-(--vk-field-row-py,calc(var(--spacing)*2.5)) border-b-(length:--vk-field-row-line-w,1px) border-(color:--vk-field-row-line,var(--vk-border)) last:border-0";
|
|
25
27
|
const EDITOR_PANEL = '[data-slot="vk-editor-panel"]';
|
|
28
|
+
function tabOn(from, by) {
|
|
29
|
+
const root = from.closest('[role="dialog"], [aria-modal="true"]') ?? from.ownerDocument.body;
|
|
30
|
+
const order = tabbable(root).filter((el) => !el.closest(EDITOR_PANEL));
|
|
31
|
+
const at = order.indexOf(from);
|
|
32
|
+
if (at >= 0)
|
|
33
|
+
order[at + by]?.focus();
|
|
34
|
+
}
|
|
26
35
|
export function fieldRowMenuItems(menu, ready, messages) {
|
|
27
36
|
return (menu ?? []).map((item) => {
|
|
28
37
|
const onClick = () => {
|
|
@@ -78,12 +87,16 @@ function FieldRowImpl({ binding, row, value, editValue, writable, ready = true,
|
|
|
78
87
|
}
|
|
79
88
|
focusBack.current = null;
|
|
80
89
|
const gone = leaving.current?.gone ?? false;
|
|
90
|
+
const tab = leaving.current?.tab ?? null;
|
|
81
91
|
leaving.current?.stop();
|
|
82
92
|
leaving.current = null;
|
|
83
93
|
const active = document.activeElement;
|
|
84
94
|
const moved = "left" in armed && active !== armed.left && active !== null && active !== document.body;
|
|
85
|
-
if (
|
|
86
|
-
|
|
95
|
+
if (moved || gone)
|
|
96
|
+
return;
|
|
97
|
+
button.focus({ preventScroll: true });
|
|
98
|
+
if (tab)
|
|
99
|
+
tabOn(button, tab);
|
|
87
100
|
}, [editing, pending, ready]);
|
|
88
101
|
useEffect(() => () => leaving.current?.stop(), []);
|
|
89
102
|
const valueRef = useRef(null);
|
|
@@ -97,19 +110,30 @@ function FieldRowImpl({ binding, row, value, editValue, writable, ready = true,
|
|
|
97
110
|
const isEmpty = shown == null || shown === "" || (Array.isArray(shown) && shown.length === 0);
|
|
98
111
|
const watchLeaving = () => {
|
|
99
112
|
leaving.current?.stop();
|
|
100
|
-
const watch = { gone: false, stop: () => { } };
|
|
113
|
+
const watch = { gone: false, exiting: false, tab: null, stop: () => { } };
|
|
101
114
|
const letGo = (event) => {
|
|
102
115
|
if (event.target instanceof Element && event.target.closest(EDITOR_PANEL))
|
|
103
116
|
return;
|
|
104
117
|
watch.gone = true;
|
|
105
118
|
watch.stop();
|
|
106
119
|
};
|
|
120
|
+
const holdTab = (event) => {
|
|
121
|
+
if (event.key !== "Tab" || !watch.exiting)
|
|
122
|
+
return;
|
|
123
|
+
const from = event.target;
|
|
124
|
+
if (!(from instanceof Element && (from.closest(EDITOR_PANEL) || from === document.body)))
|
|
125
|
+
return;
|
|
126
|
+
event.preventDefault();
|
|
127
|
+
watch.tab = event.shiftKey ? -1 : 1;
|
|
128
|
+
};
|
|
107
129
|
watch.stop = () => {
|
|
108
130
|
document.removeEventListener("pointerdown", letGo, true);
|
|
109
131
|
document.removeEventListener("focusin", letGo, true);
|
|
132
|
+
document.removeEventListener("keydown", holdTab, true);
|
|
110
133
|
};
|
|
111
134
|
document.addEventListener("pointerdown", letGo, true);
|
|
112
135
|
document.addEventListener("focusin", letGo, true);
|
|
136
|
+
document.addEventListener("keydown", holdTab, true);
|
|
113
137
|
leaving.current = watch;
|
|
114
138
|
};
|
|
115
139
|
const attempt = (resolution) => {
|
|
@@ -203,7 +227,7 @@ function FieldRowImpl({ binding, row, value, editValue, writable, ready = true,
|
|
|
203
227
|
const TypeGlyph = icons[field.type];
|
|
204
228
|
const glyph = binding.icon ? (_jsx(AppIcon, { name: binding.icon, className: "h-3.5 w-3.5 text-(color:--vk-fg-subtlest)" })) : (_jsx(TypeGlyph, { className: "h-3.5 w-3.5 text-(color:--vk-fg-subtlest)" }));
|
|
205
229
|
const menuItems = fieldRowMenuItems(menu, ready, messages);
|
|
206
|
-
const valueNode = (_jsxs("span", { ref: valueRef, className: "flex min-w-0 flex-1 items-center gap-2", children: [_jsx("span", { className: "min-w-0 wrap-break-word", children: body }), meta ? _jsx("span", { className: "shrink-0 text-xs text-(color:--vk-fg-subtle)", children: meta }) : null] }));
|
|
230
|
+
const valueNode = (_jsxs("span", { ref: valueRef, className: "flex min-w-0 flex-1 items-center gap-2", children: [_jsx("span", { className: "min-w-0 wrap-break-word", children: _jsx(RelationChipSize.Provider, { value: "row", children: body }) }), meta ? _jsx("span", { className: "shrink-0 text-xs text-(color:--vk-fg-subtle)", children: meta }) : null] }));
|
|
207
231
|
const handOver = () => {
|
|
208
232
|
const row = rowRef.current;
|
|
209
233
|
if (!row || !buttonRef.current || document.activeElement !== buttonRef.current)
|
|
@@ -269,7 +293,10 @@ function FieldRowImpl({ binding, row, value, editValue, writable, ready = true,
|
|
|
269
293
|
? "o-field-row-label"
|
|
270
294
|
: "text-sm leading-5 text-(color:--vk-field-row-label-fg,var(--vk-fg-subtle))", children: field.label }), _jsxs("div", { className: cx(inRows ? "min-w-0 flex-1" : "min-w-0 flex-1 text-sm leading-5 text-(color:--vk-fg)", !desktop && !inRows && "col-span-2 col-start-2 row-start-2", settlement.requested && "italic opacity-80"), ...settlementAttributes(settlement.requested, field.provenance, conventions), children: [editing ? (_jsx("div", { children: _jsx(RowEditor, { binding: binding, row: row, initial: retryDraft ? retryDraft.commit : editValue, refused: retryDraft?.reason, shown: shown, conversion: convertedFrom ? body : undefined, anchor: inRows ? (_jsx("span", { className: "flex min-w-0", children: valueNode })) : (_jsx("span", { className: cx(TARGET, "bg-(color:--vk-neutral)"), children: valueNode })), onAttempt: (resolution) => {
|
|
271
295
|
watchLeaving();
|
|
272
|
-
|
|
296
|
+
const answer = attempt(resolution);
|
|
297
|
+
if (answer.accepted && leaving.current)
|
|
298
|
+
leaving.current.exiting = true;
|
|
299
|
+
return answer;
|
|
273
300
|
}, onClose: closed, message: message, kindIcon: kindIcon, openedByKey: byKey }) })) : hasMenu && !verbsInLane ? (_jsx(CommandMenu, { trigger: drawFieldRowButton(views, {
|
|
274
301
|
frame: inRows ? FIELD_ROW_FRAME_ROWS : FIELD_ROW_FRAME,
|
|
275
302
|
variant: "ghost",
|
|
@@ -4,6 +4,7 @@ import { useRef } from "react";
|
|
|
4
4
|
import { isRangeValue, rangeDecimals } from "viewkitjs/fields";
|
|
5
5
|
import { EditorPanel } from "../../editors/EditorPanel.js";
|
|
6
6
|
import { RangeEditor } from "../../editors/RangeEditor.js";
|
|
7
|
+
import { numberBounds } from "../../editors/number-body.js";
|
|
7
8
|
import { useViews } from "../../provider/context.js";
|
|
8
9
|
import { useRowEditSession } from "./row-session.js";
|
|
9
10
|
import { bodyPanel } from "../../editors/body-panel.js";
|
|
@@ -13,6 +14,6 @@ export function RowRangeEditor({ field, initial, anchor, onAttempt, onClose, })
|
|
|
13
14
|
const editorRef = useRef(null);
|
|
14
15
|
const anchorRef = useRef(null);
|
|
15
16
|
const { session, close } = useRowEditSession({ editorRef, onAttempt, onClose });
|
|
16
|
-
const editor = (_jsx(RangeEditor, { ref: editorRef, initial: isRangeValue(initial) ? initial : null, decimals: rangeDecimals(field), allowEmpty: !!field.nullable, suffix: field.of === "percent" ? "%" : field.of === "currency" ? field.code?.fixed : undefined, bands: field.presets, conventions: conventions, label: field.label, onRequestClose: close }));
|
|
17
|
+
const editor = (_jsx(RangeEditor, { ref: editorRef, initial: isRangeValue(initial) ? initial : null, decimals: rangeDecimals(field), allowEmpty: !!field.nullable, suffix: field.of === "percent" ? "%" : field.of === "currency" ? field.code?.fixed : undefined, bands: field.presets, ...numberBounds(field), conventions: conventions, label: field.label, onRequestClose: close }));
|
|
17
18
|
return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, className: "block min-w-0", children: anchor }), _jsx(EditorPanel, { panelData: panel.data, session: session, title: field.label, anchor: anchorRef, align: "start", sideOffset: 4, initialFocus: false, chrome: "menu", className: panel.className, children: (surface) => (surface === "sheet" ? _jsx("div", { className: "px-4 pb-4", children: editor }) : editor) })] }));
|
|
18
19
|
}
|
|
@@ -4,7 +4,7 @@ import { useState } from "react";
|
|
|
4
4
|
import { useViews } from "../../provider/context.js";
|
|
5
5
|
import { drawGridButton } from "./grid-button.js";
|
|
6
6
|
import { gridAddColumnItems } from "./grid-add-column-items.js";
|
|
7
|
-
import { useGridMenuPress } from "./grid-menu-focus.js";
|
|
7
|
+
import { returnGridFocus, useGridMenuPress } from "./grid-menu-focus.js";
|
|
8
8
|
export function gridAddColumnDrawn(render, columns) {
|
|
9
9
|
return render?.(columns) !== null;
|
|
10
10
|
}
|
|
@@ -24,11 +24,14 @@ export function GridAddColumn({ columns, at = "end", }) {
|
|
|
24
24
|
const press = useGridMenuPress(open);
|
|
25
25
|
const word = messages({ key: "views.grid.add-column" });
|
|
26
26
|
const Add = icons.add;
|
|
27
|
-
const
|
|
27
|
+
const [leaving, setLeaving] = useState([]);
|
|
28
|
+
function close(reason = "none") {
|
|
29
|
+
setLeaving(items);
|
|
28
30
|
setOpen(false);
|
|
29
|
-
if (reason !== "outside-press" && reason !== "focus-out")
|
|
30
|
-
anchor
|
|
31
|
-
}
|
|
31
|
+
if (anchor && reason !== "outside-press" && reason !== "focus-out")
|
|
32
|
+
returnGridFocus(anchor);
|
|
33
|
+
}
|
|
34
|
+
const items = open ? gridAddColumnItems(columns, { messages, close: () => close("item-press") }) : leaving;
|
|
32
35
|
return (_jsxs(_Fragment, { children: [drawGridButton(views, {
|
|
33
36
|
ref: setAnchor,
|
|
34
37
|
tabIndex: -1,
|
|
@@ -44,5 +47,5 @@ export function GridAddColumn({ columns, at = "end", }) {
|
|
|
44
47
|
variant: "ghost",
|
|
45
48
|
size: inTitle ? "icon" : "sm",
|
|
46
49
|
children: inTitle ? (_jsx(Add, { className: "h-(--vk-head-glyph) w-(--vk-head-glyph) shrink-0" })) : (_jsxs(_Fragment, { children: [_jsx(Add, { className: "h-(--vk-head-glyph) w-(--vk-head-glyph) shrink-0 opacity-70" }), _jsx("span", { className: "truncate", children: word })] })),
|
|
47
|
-
}), _jsx(Menu, { open: open, onOpenChange: (next, details) => (next ? setOpen(true) : close(details?.reason)), anchor: anchor, side: "bottom", align: inTitle ? "start" : "end", label: word, items:
|
|
50
|
+
}), _jsx(Menu, { open: open, onOpenChange: (next, details) => (next ? setOpen(true) : close(details?.reason)), anchor: anchor, side: "bottom", align: inTitle ? "start" : "end", label: word, items: items })] }));
|
|
48
51
|
}
|
|
@@ -104,7 +104,7 @@ function AnchoredEditor({ ctx }) {
|
|
|
104
104
|
}
|
|
105
105
|
if (ctx.editorKind === "range") {
|
|
106
106
|
const def = col.field?.type === "range" ? col.field : undefined;
|
|
107
|
-
return (_jsx(GridRangeEditor, { title: col.header, initial: isRangeValue(baseline) ? baseline : null, seed: ctx.editSeed ?? undefined, decimals: def ? rangeDecimals(def) : 0, allowEmpty: !!col.clearable, suffix: def?.of === "percent" ? "%" : def?.of === "currency" ? def.code?.fixed : undefined, bands: def?.presets, refuse: (payload) => refusal(payload, baseline), onCommit: (payload) => onCommitCell(row, rowId, col.id, baseline, payload, { overlay: false }), onCancel: onCancel, onTab: ctx.onTab, onEnter: ctx.onEnter }));
|
|
107
|
+
return (_jsx(GridRangeEditor, { title: col.header, initial: isRangeValue(baseline) ? baseline : null, seed: ctx.editSeed ?? undefined, decimals: def ? rangeDecimals(def) : 0, allowEmpty: !!col.clearable, suffix: def?.of === "percent" ? "%" : def?.of === "currency" ? def.code?.fixed : undefined, bands: def?.presets, ...(def ? numberBounds(def) : {}), refuse: (payload) => refusal(payload, baseline), onCommit: (payload) => onCommitCell(row, rowId, col.id, baseline, payload, { overlay: false }), onCancel: onCancel, onTab: ctx.onTab, onEnter: ctx.onEnter }));
|
|
108
108
|
}
|
|
109
109
|
if (ctx.editorKind === "values" && col.field && isMultipleType(col.field.type) && !col.multiple) {
|
|
110
110
|
const stored = String(baseline ?? "");
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
/** Which row the grid tints (`GridTable`'s `rowHighlight`): the row under the pointer, or the active row alone. */
|
|
2
|
+
export type GridRowHighlight = "hover" | "active";
|
|
1
3
|
/** A frozen cell's paint for its row's state: the ground and the row's hover, or, on a selected
|
|
2
4
|
* row, the ground with the selection tint and its own hover. One answer per state, so no class has
|
|
3
5
|
* to beat another (`cx` joins, it does not merge). `on: "before"` paints it on the element's
|
|
4
6
|
* `::before` instead; `"while-scrolled"` paints it only while the table is scrolled sideways. */
|
|
5
|
-
export declare function gridFrozenBg(selected: boolean, on?: "before" | "while-scrolled"): string;
|
|
7
|
+
export declare function gridFrozenBg(selected: boolean, on?: "before" | "while-scrolled", highlight?: GridRowHighlight): string;
|
|
6
8
|
/**
|
|
7
9
|
* NOTE: the frozen block has NO edge treatment on ANY surface — header, rows and
|
|
8
10
|
* footer all end flat, and a frozen cell renders exactly like an unfrozen one.
|
|
@@ -13,19 +13,29 @@ const GRID_FROZEN_BG_BEFORE = {
|
|
|
13
13
|
selected: "before:bg-[linear-gradient(var(--vk-brand-subtlest),var(--vk-brand-subtlest))]",
|
|
14
14
|
selectedHover: "group-hover/gridrow:before:bg-[linear-gradient(color-mix(in_oklab,_var(--vk-brand)_10%,_transparent),color-mix(in_oklab,_var(--vk-brand)_10%,_transparent)),linear-gradient(var(--vk-brand-subtlest),var(--vk-brand-subtlest))] group-data-hovered/gridrow:before:bg-[linear-gradient(color-mix(in_oklab,_var(--vk-brand)_10%,_transparent),color-mix(in_oklab,_var(--vk-brand)_10%,_transparent)),linear-gradient(var(--vk-brand-subtlest),var(--vk-brand-subtlest))]",
|
|
15
15
|
};
|
|
16
|
-
|
|
16
|
+
const GRID_FROZEN_ACTIVE = "group-data-active/gridrow:bg-[linear-gradient(var(--vk-hovered),var(--vk-hovered))]";
|
|
17
|
+
const GRID_FROZEN_BG_SELECTED_ACTIVE = "group-data-active/gridrow:bg-[linear-gradient(color-mix(in_oklab,_var(--vk-brand)_10%,_transparent),color-mix(in_oklab,_var(--vk-brand)_10%,_transparent)),linear-gradient(var(--vk-brand-subtlest),var(--vk-brand-subtlest))]";
|
|
18
|
+
const GRID_FROZEN_ACTIVE_WHILE_SCROLLED = "group-data-active/gridrow:bg-[linear-gradient(color-mix(in_oklab,_var(--vk-hovered)_calc(var(--vk-scrolled,0)*100%),_transparent),color-mix(in_oklab,_var(--vk-hovered)_calc(var(--vk-scrolled,0)*100%),_transparent))]";
|
|
19
|
+
const GRID_FROZEN_BG_SELECTED_ACTIVE_WHILE_SCROLLED = "group-data-active/gridrow:bg-[linear-gradient(color-mix(in_oklab,_color-mix(in_oklab,_var(--vk-brand)_10%,_transparent)_calc(var(--vk-scrolled,0)*100%),_transparent),color-mix(in_oklab,_color-mix(in_oklab,_var(--vk-brand)_10%,_transparent)_calc(var(--vk-scrolled,0)*100%),_transparent)),linear-gradient(color-mix(in_oklab,_var(--vk-brand-subtlest)_calc(var(--vk-scrolled,0)*100%),_transparent),color-mix(in_oklab,_var(--vk-brand-subtlest)_calc(var(--vk-scrolled,0)*100%),_transparent))]";
|
|
20
|
+
const GRID_FROZEN_BG_BEFORE_ACTIVE = {
|
|
21
|
+
hover: "group-data-active/gridrow:before:bg-[linear-gradient(var(--vk-hovered),var(--vk-hovered))]",
|
|
22
|
+
selectedHover: "group-data-active/gridrow:before:bg-[linear-gradient(color-mix(in_oklab,_var(--vk-brand)_10%,_transparent),color-mix(in_oklab,_var(--vk-brand)_10%,_transparent)),linear-gradient(var(--vk-brand-subtlest),var(--vk-brand-subtlest))]",
|
|
23
|
+
};
|
|
24
|
+
export function gridFrozenBg(selected, on, highlight = "hover") {
|
|
25
|
+
const active = highlight === "active";
|
|
17
26
|
if (on === "before") {
|
|
18
27
|
const b = GRID_FROZEN_BG_BEFORE;
|
|
19
|
-
|
|
28
|
+
const lit = active ? GRID_FROZEN_BG_BEFORE_ACTIVE : b;
|
|
29
|
+
return selected ? cx(b.ground, b.selected, lit.selectedHover) : cx(b.ground, lit.hover);
|
|
20
30
|
}
|
|
21
31
|
if (on === "while-scrolled") {
|
|
22
32
|
return selected
|
|
23
|
-
? cx(GRID_GROUND_WHILE_SCROLLED, GRID_FROZEN_BG_SELECTED_WHILE_SCROLLED, GRID_FROZEN_BG_SELECTED_HOVER_WHILE_SCROLLED)
|
|
24
|
-
: cx(GRID_GROUND_WHILE_SCROLLED, GRID_FROZEN_HOVER_WHILE_SCROLLED);
|
|
33
|
+
? cx(GRID_GROUND_WHILE_SCROLLED, GRID_FROZEN_BG_SELECTED_WHILE_SCROLLED, active ? GRID_FROZEN_BG_SELECTED_ACTIVE_WHILE_SCROLLED : GRID_FROZEN_BG_SELECTED_HOVER_WHILE_SCROLLED)
|
|
34
|
+
: cx(GRID_GROUND_WHILE_SCROLLED, active ? GRID_FROZEN_ACTIVE_WHILE_SCROLLED : GRID_FROZEN_HOVER_WHILE_SCROLLED);
|
|
25
35
|
}
|
|
26
36
|
return selected
|
|
27
|
-
? cx(GRID_GROUND, GRID_FROZEN_BG_SELECTED, GRID_FROZEN_BG_SELECTED_HOVER)
|
|
28
|
-
: cx(GRID_GROUND, GRID_FROZEN_HOVER);
|
|
37
|
+
? cx(GRID_GROUND, GRID_FROZEN_BG_SELECTED, active ? GRID_FROZEN_BG_SELECTED_ACTIVE : GRID_FROZEN_BG_SELECTED_HOVER)
|
|
38
|
+
: cx(GRID_GROUND, active ? GRID_FROZEN_ACTIVE : GRID_FROZEN_HOVER);
|
|
29
39
|
}
|
|
30
40
|
export const GRID_CELL_HOVER_SHADOW = "hover:shadow-[var(--vk-outline-hover-shadow,0_1px_2px_rgb(0_0_0/0.05))] dark:hover:shadow-[var(--vk-outline-hover-shadow,0_1px_2px_rgb(0_0_0/0.22))]";
|
|
31
41
|
export const GRID_CELL_HOVER_RING = "hover:after:pointer-events-none hover:after:absolute hover:after:inset-0 hover:after:z-1 hover:after:rounded-(--vk-outline-radius,var(--radius-sm)) hover:after:border hover:after:border-(color:--vk-outline-hover,var(--vk-border-bold))";
|
|
@@ -5,7 +5,7 @@ import { ChipsEditor } from "../../editors/ChipsEditor.js";
|
|
|
5
5
|
import { EditorPanel } from "../../editors/EditorPanel.js";
|
|
6
6
|
import { resolveCategoryColor } from "viewkitjs/fields/design/category-colors";
|
|
7
7
|
import { prettifyOptionValue } from "../../model/column-state.js";
|
|
8
|
-
import { optionValues } from "viewkitjs/fields";
|
|
8
|
+
import { optionFor, optionValues } from "viewkitjs/fields";
|
|
9
9
|
import { offeredValues, takesNewValues, useOpenValues } from "../../editors/open-values.js";
|
|
10
10
|
import { useGridEditSession } from "./grid-edit-session.js";
|
|
11
11
|
import { bodyPanel } from "../../editors/body-panel.js";
|
|
@@ -32,7 +32,8 @@ export function GridChipsEditor({ column, title, values, suggestions, optionColo
|
|
|
32
32
|
: offeredValues(column.field, known, suggestions);
|
|
33
33
|
const resolve = (value) => ({
|
|
34
34
|
value,
|
|
35
|
-
label: column.options?.find((option) => option.value === value)?.label ??
|
|
35
|
+
label: column.options?.find((option) => option.value === value)?.label ??
|
|
36
|
+
(column.field ? (optionFor(column.field, value)?.label ?? value) : prettifyOptionValue(value)),
|
|
36
37
|
color: resolveCategoryColor(value, column.options, optionColors),
|
|
37
38
|
});
|
|
38
39
|
return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, "aria-hidden": true, className: "pointer-events-none absolute inset-0" }), _jsx(EditorPanel, { session: session, title: title, anchor: anchorRef, align: "start", sideOffset: place, initialFocus: false, panelData: { "data-slot": "vk-grid-editor", ...panel.data }, onPanelClick: (event) => event.stopPropagation(), chrome: "menu", className: panel.className, children: _jsx(ChipsEditor, { ref: editorRef, values: values, suggestions: offered, resolve: resolve, normalize: column.chips?.normalize, creatable: open, seed: seed, addOption: field ? column.addOption : undefined, onRequestClose: close, label: typeof title === "string" ? title : undefined }) })] }));
|