viewkitjs 0.32.0 → 0.33.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 +69 -0
- package/fields/dist/index.d.ts +1 -1
- package/fields/dist/index.js +1 -1
- package/fields/dist/query/evaluate.d.ts +7 -0
- package/fields/dist/query/exact-number.d.ts +8 -2
- package/fields/dist/query/exact-number.js +14 -1
- package/fields/dist/query/sort.js +13 -10
- package/fields/dist/registry.js +5 -1
- package/fields/dist/types.d.ts +4 -1
- package/fields/dist/zod.d.ts +5 -0
- package/fields/dist/zod.js +10 -1
- package/fields/docs/guides/contact-values.md +12 -0
- package/fields/docs/guides/field-types.md +1 -1
- package/fields/docs/guides/queries.md +3 -1
- package/fields/docs/reference/fields.md +1 -0
- package/package.json +1 -1
- package/postgres/dist/check.js +4 -1
- package/postgres/dist/definitions/formula-forms.js +3 -1
- package/postgres/dist/definitions/money.js +2 -1
- package/postgres/dist/page.js +6 -3
- package/postgres/dist/rules.d.ts +15 -1
- package/postgres/dist/rules.js +16 -0
- package/postgres/dist/sort.js +7 -2
- package/postgres/docs/guides/definitions.md +1 -1
- package/postgres/docs/guides/field-map.md +1 -1
- package/postgres/docs/reference/definitions.md +1 -1
- package/postgres/docs/reference/postgres.md +1 -1
- package/views/dist/atoms/ToolbarButton.d.ts +1 -1
- package/views/dist/atoms/ToolbarButton.js +4 -3
- package/views/dist/atoms/frame-parts.d.ts +6 -0
- package/views/dist/atoms/frame-parts.js +15 -0
- package/views/dist/atoms/types.d.ts +16 -7
- package/views/dist/cells/cell-title.d.ts +3 -1
- package/views/dist/cells/cell-title.js +2 -2
- package/views/dist/cells/cell-values.js +2 -2
- package/views/dist/contract.d.ts +31 -6
- package/views/dist/contract.js +123 -0
- package/views/dist/controls/button/map-button.js +2 -0
- package/views/dist/controls/checkbox/checkbox.d.ts +3 -2
- package/views/dist/controls/checkbox/checkbox.js +2 -2
- package/views/dist/controls/compound-editor/compound-editor.d.ts +1 -1
- package/views/dist/controls/compound-editor/name-parts.js +4 -4
- package/views/dist/controls/compound-editor/place-parts.js +19 -19
- package/views/dist/controls/compound-editor/range-parts.js +14 -14
- package/views/dist/controls/compound-editor/row.d.ts +3 -1
- package/views/dist/controls/compound-editor/row.js +2 -2
- package/views/dist/controls/controls.d.ts +2 -0
- package/views/dist/controls/controls.js +2 -0
- package/views/dist/controls/customize/customize.js +37 -35
- package/views/dist/controls/customize/map-customize-body.d.ts +2 -0
- package/views/dist/controls/customize/map-customize-body.js +4 -0
- package/views/dist/controls/date-editor/date-days.js +2 -2
- package/views/dist/controls/date-editor/date-editor.js +18 -18
- package/views/dist/controls/date-editor/date-parts.js +6 -6
- package/views/dist/controls/date-editor/map-calendar.js +1 -1
- package/views/dist/controls/date-editor.css +2 -2
- package/views/dist/controls/field/field.d.ts +3 -0
- package/views/dist/controls/field/field.js +6 -6
- package/views/dist/controls/filter-editor/block.d.ts +2 -2
- package/views/dist/controls/filter-editor/block.js +5 -5
- package/views/dist/controls/filter-editor/filter-editor.js +31 -33
- package/views/dist/controls/filter-editor/how.d.ts +3 -1
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +1 -0
- package/views/dist/controls/filter-editor/map-filter-body.js +7 -3
- package/views/dist/controls/filter-editor/map-rules.js +1 -1
- package/views/dist/controls/filter-editor/parts.js +2 -1
- package/views/dist/controls/group-editor/group-editor.js +15 -13
- package/views/dist/controls/index.d.ts +2 -0
- package/views/dist/controls/index.js +1 -0
- package/views/dist/controls/input/input.js +2 -2
- package/views/dist/controls/input/map-input.js +2 -0
- package/views/dist/controls/internal/editor-parts.js +1 -1
- package/views/dist/controls/internal/map-panel-controls.d.ts +8 -0
- package/views/dist/controls/internal/map-panel-controls.js +20 -0
- package/views/dist/controls/internal/panel-controls.d.ts +50 -0
- package/views/dist/controls/internal/panel-controls.js +197 -0
- package/views/dist/controls/internal/part-slot.d.ts +12 -0
- package/views/dist/controls/internal/part-slot.js +5 -0
- package/views/dist/controls/links-editor/links-editor.d.ts +1 -1
- package/views/dist/controls/links-editor/links-editor.js +27 -27
- package/views/dist/controls/menu/map-menu.d.ts +2 -2
- package/views/dist/controls/menu/map-menu.js +15 -12
- package/views/dist/controls/menu/menu.d.ts +2 -0
- package/views/dist/controls/menu/menu.js +3 -3
- package/views/dist/controls/menu-list/menu-list.d.ts +14 -4
- package/views/dist/controls/menu-list/menu-list.js +23 -22
- package/views/dist/controls/notice/notice.d.ts +3 -1
- package/views/dist/controls/notice/notice.js +2 -2
- package/views/dist/controls/number-editor/number-editor.d.ts +1 -1
- package/views/dist/controls/number-editor/number-editor.js +13 -13
- package/views/dist/controls/number-field/number-field.js +5 -3
- package/views/dist/controls/pane/pane.d.ts +4 -2
- package/views/dist/controls/pane/pane.js +4 -4
- package/views/dist/controls/picker/picker.d.ts +2 -0
- package/views/dist/controls/picker/picker.js +37 -36
- package/views/dist/controls/picker/rows.d.ts +4 -0
- package/views/dist/controls/popover/map-popover.d.ts +1 -1
- package/views/dist/controls/popover/map-popover.js +4 -2
- package/views/dist/controls/quick-filters/quick-filters.js +4 -4
- package/views/dist/controls/radio/radio.d.ts +3 -0
- package/views/dist/controls/radio/radio.js +4 -3
- package/views/dist/controls/select/map-select.d.ts +3 -0
- package/views/dist/controls/select/map-select.js +8 -0
- package/views/dist/controls/select/select.d.ts +3 -0
- package/views/dist/controls/select/select.js +3 -3
- package/views/dist/controls/sheet/bottom-sheet.d.ts +5 -1
- package/views/dist/controls/sheet/bottom-sheet.js +2 -2
- package/views/dist/controls/sheet/map-sheet.js +1 -1
- package/views/dist/controls/sort-editor/map-sort-body.d.ts +1 -0
- package/views/dist/controls/sort-editor/map-sort-body.js +7 -3
- package/views/dist/controls/sort-editor/sort-editor.js +24 -26
- package/views/dist/controls/sort-editor.css +5 -0
- package/views/dist/controls/text-editor/text-editor.d.ts +1 -1
- package/views/dist/controls/text-editor/text-editor.js +8 -8
- package/views/dist/controls/toolbar-button/atom-toolbar-button.d.ts +3 -3
- package/views/dist/controls/toolbar-button/atom-toolbar-button.js +7 -6
- package/views/dist/controls/values-editor/values-editor.d.ts +1 -1
- package/views/dist/controls/values-editor/values-editor.js +22 -22
- package/views/dist/controls/views-list/map-view-menu.js +1 -1
- package/views/dist/controls/views-list/view-menu.js +6 -6
- package/views/dist/controls/views-list/views-list.js +4 -4
- package/views/dist/editors/EditorPanel.js +1 -1
- package/views/dist/field-row/FieldRow.js +13 -0
- package/views/dist/fields/money.d.ts +5 -2
- package/views/dist/fields/money.js +14 -2
- package/views/dist/grid/chrome/GridTable.js +4 -1
- package/views/dist/grid/chrome/cell-clipboard.d.ts +4 -2
- package/views/dist/grid/chrome/cell-clipboard.js +2 -2
- package/views/dist/grid/chrome/cells.js +3 -1
- package/views/dist/grid/chrome/grid-row-menu-items.js +1 -1
- package/views/dist/grid/chrome/useGridKeyboard.d.ts +4 -1
- package/views/dist/grid/chrome/useGridKeyboard.js +29 -6
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +9 -2
- package/views/dist/grid/core/clipboard-model.d.ts +3 -1
- package/views/dist/grid/core/clipboard-model.js +9 -8
- package/views/dist/grid/core/editing-controller.d.ts +3 -0
- package/views/dist/grid/core/editing-controller.js +6 -0
- package/views/dist/grid/core/edits-sink.d.ts +19 -0
- package/views/dist/grid/core/edits-sink.js +2 -0
- package/views/dist/grid/core/spreadsheet-operations.js +1 -1
- package/views/dist/grid/core/useGridEditing.d.ts +5 -0
- package/views/dist/grid/core/useGridEditing.js +6 -0
- package/views/dist/list/answer.d.ts +40 -0
- package/views/dist/list/answer.js +43 -0
- package/views/dist/list/bulk-bar.d.ts +7 -0
- package/views/dist/list/bulk-bar.js +10 -0
- package/views/dist/list/columns.d.ts +24 -0
- package/views/dist/list/columns.js +27 -0
- package/views/dist/list/edits.d.ts +19 -0
- package/views/dist/list/edits.js +56 -0
- package/views/dist/list/grid.d.ts +11 -0
- package/views/dist/list/grid.js +76 -0
- package/views/dist/list/index.d.ts +14 -1
- package/views/dist/list/index.js +4 -1
- package/views/dist/list/link.d.ts +8 -0
- package/views/dist/list/link.js +78 -0
- package/views/dist/list/list.d.ts +70 -0
- package/views/dist/list/list.js +14 -0
- package/views/dist/list/parts.js +10 -3
- package/views/dist/list/root-base.d.ts +46 -0
- package/views/dist/list/root-base.js +137 -0
- package/views/dist/list/root.d.ts +35 -34
- package/views/dist/list/root.js +153 -113
- package/views/dist/list/source-answers.d.ts +39 -0
- package/views/dist/list/source-answers.js +225 -0
- package/views/dist/list/store.d.ts +37 -5
- package/views/dist/list/store.js +31 -0
- package/views/dist/list/toolbar.d.ts +3 -2
- package/views/dist/list/toolbar.js +14 -2
- package/views/dist/list/views-axis.js +4 -2
- package/views/dist/list/views.d.ts +7 -2
- package/views/dist/list/views.js +16 -5
- package/views/dist/model/column-capabilities.d.ts +13 -0
- package/views/dist/model/column-capabilities.js +23 -2
- package/views/dist/model/column-schema.d.ts +11 -1
- package/views/dist/model/view-rules.js +1 -0
- package/views/dist/panels/model.d.ts +2 -0
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +8 -2
- package/views/dist/panels/react/toolbar/ReadyToolbar.js +2 -2
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +8 -1
- package/views/dist/panels/react/toolbar/Toolbar.js +12 -3
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarAsideFilter.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +4 -4
- package/views/dist/panels/react/toolbar/ToolbarButton.js +4 -1
- package/views/dist/panels/react/toolbar/ToolbarFilter.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterSheet.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarNew.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSearch.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSort.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +6 -4
- package/views/dist/panels/react/toolbar/context.d.ts +10 -1
- package/views/dist/panels/react/toolbar/panel-part.d.ts +4 -1
- package/views/dist/panels/react/toolbar/panel-part.js +5 -3
- package/views/dist/panels/settings/filter-groups.js +6 -1
- package/views/dist/provider/ViewsProvider.d.ts +6 -2
- package/views/dist/provider/ViewsProvider.js +18 -1
- package/views/dist/provider/components.d.ts +59 -0
- package/views/dist/provider/components.js +1 -1
- package/views/dist/provider/context.d.ts +4 -1
- package/views/dist/provider/own-control.d.ts +4 -0
- package/views/dist/provider/own-control.js +7 -0
- package/views/dist/provider/select-items.d.ts +3 -0
- package/views/dist/provider/select-items.js +6 -0
- package/views/dist/react.d.ts +4 -2
- package/views/dist/react.js +2 -0
- package/views/dist/styles.css +86 -78
- package/views/dist/styles.unlayered.css +86 -78
- package/views/docs/contract.md +252 -5
- package/views/docs/controls/compound-editor.md +4 -0
- package/views/docs/controls/customize.md +6 -0
- package/views/docs/controls/date-editor.md +4 -0
- package/views/docs/controls/field.md +4 -0
- package/views/docs/controls/filter-editor.md +8 -0
- package/views/docs/controls/group-editor.md +6 -0
- package/views/docs/controls/input.md +4 -0
- package/views/docs/controls/links-editor.md +4 -0
- package/views/docs/controls/menu-list.md +8 -0
- package/views/docs/controls/menu.md +4 -0
- package/views/docs/controls/notice.md +4 -0
- package/views/docs/controls/number-editor.md +4 -0
- package/views/docs/controls/pane.md +4 -0
- package/views/docs/controls/picker.md +8 -0
- package/views/docs/controls/quick-filters.md +6 -0
- package/views/docs/controls/radio.md +4 -0
- package/views/docs/controls/select.md +8 -0
- package/views/docs/controls/sheet.md +4 -0
- package/views/docs/controls/sort-editor.md +8 -0
- package/views/docs/controls/text-editor.md +4 -0
- package/views/docs/controls/values-editor.md +4 -0
- package/views/docs/controls/views-list.md +6 -0
- package/views/docs/guides/the-grid.md +2 -2
- package/views/docs/guides/the-provider.md +19 -2
- package/views/docs/reference/controls.md +7 -5
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +1 -1
- package/views/docs/reference/list.md +141 -11
- package/views/docs/reference/panels-react.md +2 -2
- package/views/docs/reference/react.md +15 -9
- package/views/docs/reference/views.md +8 -4
- package/views/docs/reshaping.md +6 -1
|
@@ -7,7 +7,7 @@ import type { CollectionViewState } from "../../view-state.js";
|
|
|
7
7
|
import type { CollectionViewsInput, ViewsLayout } from "../../views-row/model.js";
|
|
8
8
|
import type { PanelFieldEditor } from "../field-editor.js";
|
|
9
9
|
import type { ToolbarPanelHost } from "./panel-part.js";
|
|
10
|
-
import type { ToolbarMore } from "./Toolbar.js";
|
|
10
|
+
import type { ToolbarMore, ToolbarPartButton } from "./Toolbar.js";
|
|
11
11
|
/** The toolbar's menus as data (VK-741): each handed its default items, each item keyed, and handing back the items it shows.
|
|
12
12
|
* `view`, a view's menu, handed the view too: the rows an option hands (`menu`, Edit view… among them) and the menu a views
|
|
13
13
|
* list draws from an axis's verbs. `add`, New's items: `addItems`, or, with `onAdd` alone, one row keyed `new` that runs it;
|
|
@@ -21,13 +21,19 @@ export type ToolbarMenus = {
|
|
|
21
21
|
* `bar` (the filter bar; in `row`, the line below the row) or `foot` (a kit phone list's foot, New's place: anywhere else, the
|
|
22
22
|
* row); on a kit phone the row and the bar are one line. Its side, and its words (`both`, as the look's words say; `icon`, its
|
|
23
23
|
* icon alone), meaningful for a part whose button has a word: `search`, `quick`, `sort`, `filter`, `filter-add`, `options`,
|
|
24
|
-
* `new`. `node`: a part of the app's own, under a key of its own (a key the form holds keeps its own node).
|
|
24
|
+
* `new`. `node`: a part of the app's own, under a key of its own (a key the form holds keeps its own node).
|
|
25
|
+
* Its look (VK-984): `className`, put on every toolbar button the part draws (each handed its `part`, list.md's table), and
|
|
26
|
+
* `button`, your own button drawn for each of them in place of your `ToolbarButton`, handed the very props it would get, `ref`
|
|
27
|
+
* included: put `ref` on your button, so what it opens hangs at it. A part that draws ViewKit's own pills (the views row, Clear
|
|
28
|
+
* and Save, outside your own frame) takes neither. */
|
|
25
29
|
export type ToolbarPartPlace = {
|
|
26
30
|
key: string;
|
|
27
31
|
line: "row" | "bar" | "foot";
|
|
28
32
|
side: "start" | "end";
|
|
29
33
|
words: "both" | "icon";
|
|
30
34
|
node?: ReactNode;
|
|
35
|
+
className?: string;
|
|
36
|
+
button?: ToolbarPartButton;
|
|
31
37
|
};
|
|
32
38
|
/** Which form's parts these are. */
|
|
33
39
|
export type ToolbarPartsContext = {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useId } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { ListRootBase } from "../../../list/root-base.js";
|
|
5
5
|
import { ListToolbar } from "../../../list/toolbar.js";
|
|
6
6
|
export function ReadyToolbar({ settings, layer, onChange, onLayerChange, view, sortFilter, bar, ...rest }) {
|
|
7
7
|
const id = useId();
|
|
8
|
-
return (_jsx(
|
|
8
|
+
return (_jsx(ListRootBase, { id: id, settings: settings, layer: layer, onChange: onChange, onLayerChange: onLayerChange, view: view, sortFilter: sortFilter, bar: bar, children: _jsx(ListToolbar, { ...rest }) }));
|
|
9
9
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type ReactNode } from "react";
|
|
1
|
+
import { type ComponentType, type ReactNode } from "react";
|
|
2
|
+
import type { ViewsToolbarButtonProps } from "../../../atoms/types.js";
|
|
2
3
|
import type { ViewsMenuItem } from "../../../provider/components.js";
|
|
3
4
|
import { type ToolbarPlacement } from "../../toolbar/model.js";
|
|
4
5
|
/** ⋯ as data (VK-741): the folded parts' rows, each keyed by its part, and which line's ⋯ they are in. */
|
|
@@ -14,7 +15,13 @@ export type ToolbarPart = ToolbarPlacement & {
|
|
|
14
15
|
icon?: ReactNode;
|
|
15
16
|
onSelect: () => void;
|
|
16
17
|
};
|
|
18
|
+
/** Handed to every toolbar button the part draws (VK-984): its place's class. */
|
|
19
|
+
className?: string;
|
|
20
|
+
/** Drawn for every toolbar button the part draws, in place of the app's `ToolbarButton`, handed the same props (VK-984). */
|
|
21
|
+
button?: ToolbarPartButton;
|
|
17
22
|
};
|
|
23
|
+
/** A place's own button (VK-984): a `ToolbarButton` of the app's, for one place. */
|
|
24
|
+
export type ToolbarPartButton = ComponentType<ViewsToolbarButtonProps>;
|
|
18
25
|
export declare function Toolbar({ parts, phone, narrow, narrowBelow, fold, more, className, }: {
|
|
19
26
|
parts: readonly ToolbarPart[];
|
|
20
27
|
/** The phone's one row; absent, the provider's answer (`desktopQuery`). */
|
|
@@ -6,7 +6,7 @@ import { useViews } from "../../../provider/context.js";
|
|
|
6
6
|
import { useDesktop } from "../../../provider/desktop.js";
|
|
7
7
|
import { TOOLBAR_NARROW_BELOW, arrangeToolbar, foldState, foldSteps, toolbarForm, } from "../../toolbar/model.js";
|
|
8
8
|
import { useAnchoredToggle } from "../views-row/use-anchored-toggle.js";
|
|
9
|
-
import { ListRadioContext, NOT_FOLDING, ToolbarRadioContext, ToolbarSlotContext, useToolbarPanel, useToolbarRadioState } from "./context.js";
|
|
9
|
+
import { ListRadioContext, NOT_FOLDING, ToolbarRadioContext, ToolbarSlotContext, useToolbarPanel, useToolbarRadioState, } from "./context.js";
|
|
10
10
|
import { ToolbarButton } from "./ToolbarButton.js";
|
|
11
11
|
import { useBoxNarrow } from "./use-box-narrow.js";
|
|
12
12
|
import { useGiveWay } from "./use-give-way.js";
|
|
@@ -21,7 +21,16 @@ export function Toolbar({ parts, phone, narrow, narrowBelow = TOOLBAR_NARROW_BEL
|
|
|
21
21
|
const form = toolbarForm({ phone: phone ?? !desktop, narrow: fold ? false : (narrow ?? measured) });
|
|
22
22
|
const lines = arrangeToolbar(parts, form, { fold });
|
|
23
23
|
const nodes = new Map(parts.map((part) => [part.key, part.node]));
|
|
24
|
-
const placed = new Map(parts.map((part) => [
|
|
24
|
+
const placed = new Map(parts.map((part) => [
|
|
25
|
+
part.key,
|
|
26
|
+
{
|
|
27
|
+
key: part.key,
|
|
28
|
+
...(part.words && { words: part.words }),
|
|
29
|
+
...(part.foot !== undefined && { foot: part.foot }),
|
|
30
|
+
...(part.className && { className: part.className }),
|
|
31
|
+
...(part.button && { button: part.button }),
|
|
32
|
+
},
|
|
33
|
+
]));
|
|
25
34
|
if (fold) {
|
|
26
35
|
const menus = new Map(parts.flatMap((part) => (part.menu ? [[part.key, part.menu]] : [])));
|
|
27
36
|
return (_jsx(ToolbarRadioContext.Provider, { value: radio, children: _jsx("div", { ref: box, "data-slot": "vk-toolbar", "data-form": form, "data-fold": "", className: cx("@container flex w-full flex-col", className), children: lines.map((line) => (_jsx(FoldLine, { line: line, form: form, nodes: nodes, placed: placed, menus: menus, more: more, search: { open: searchOpen, onOpenChange: setSearchOpen } }, line.kind))) }) }));
|
|
@@ -117,7 +126,7 @@ function Overflow({ anchor, rows, reshape, size, form, align, }) {
|
|
|
117
126
|
const items = list.map((row) => ({ key: row.key, label: row.label, icon: row.icon, onSelect: row.onSelect }));
|
|
118
127
|
return reshape ? reshape(items) : items;
|
|
119
128
|
};
|
|
120
|
-
return (_jsxs("span", { "data-slot": "vk-toolbar-overflow", className: "relative inline-flex shrink-0", children: [_jsx(ToolbarSlotContext.Provider, { value: { form, fill: false, size, line: "main", ...NOT_FOLDING, iconAlone: true, appFrame: false }, children: _jsx(ToolbarButton, { ref: anchor, icon: _jsx(More, { className: "h-4 w-4 shrink-0" }), label: name, word: null, popup: "menu", open: toggle.open, onPointerDown: toggle.triggerProps.onPointerDown, onClick: toggle.triggerProps.onClick }) }), _jsx(Menu, { open: toggle.open, onOpenChange: toggle.onOpenChange, anchor: anchor, align: align, label: name, items: closingFirst(own(rows), toggle.setOpen) })] }));
|
|
129
|
+
return (_jsxs("span", { "data-slot": "vk-toolbar-overflow", className: "relative inline-flex shrink-0", children: [_jsx(ToolbarSlotContext.Provider, { value: { form, fill: false, size, line: "main", ...NOT_FOLDING, iconAlone: true, appFrame: false }, children: _jsx(ToolbarButton, { part: "more", ref: anchor, icon: _jsx(More, { className: "h-4 w-4 shrink-0" }), label: name, word: null, popup: "menu", open: toggle.open, onPointerDown: toggle.triggerProps.onPointerDown, onClick: toggle.triggerProps.onClick }) }), _jsx(Menu, { open: toggle.open, onOpenChange: toggle.onOpenChange, anchor: anchor, align: align, label: name, items: closingFirst(own(rows), toggle.setOpen) })] }));
|
|
121
130
|
}
|
|
122
131
|
export function ToolbarSeparator() {
|
|
123
132
|
return _jsx("span", { role: "separator", "aria-orientation": "vertical", "data-slot": "vk-toolbar-separator", className: "h-4 w-px shrink-0 self-center bg-(color:--vk-border)" });
|
|
@@ -70,7 +70,7 @@ export function AdvancedFilterPill({ filterTree, at, count, aside = false, host:
|
|
|
70
70
|
if (focus)
|
|
71
71
|
anchor.current?.focus({ preventScroll: true });
|
|
72
72
|
};
|
|
73
|
-
const button = (_jsx(ToolbarButton, { ref: pill, icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: name, changed: !aside, aside: aside, more: aside ? undefined : String(count), popup: "dialog", open: panel.open, onPointerDown: () => {
|
|
73
|
+
const button = (_jsx(ToolbarButton, { ref: pill, part: "advanced-filters", icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: name, changed: !aside, aside: aside, more: aside ? undefined : String(count), popup: "dialog", open: panel.open, onPointerDown: () => {
|
|
74
74
|
openAtPress.current = panel.open;
|
|
75
75
|
}, onClick: (event) => {
|
|
76
76
|
const wasOpen = event.detail === 0 ? panel.open : openAtPress.current;
|
|
@@ -45,12 +45,12 @@ export function ToolbarAsideFilter({ ctx, path, node, open, onOpenChange, folded
|
|
|
45
45
|
if (details?.reason !== "outside-press" && details?.reason !== "focus-out")
|
|
46
46
|
anchorOf(part).current?.focus({ preventScroll: true });
|
|
47
47
|
};
|
|
48
|
-
return (_jsxs("span", { ref: placeBox, "data-slot": "vk-toolbar-filter-aside", "data-aside": "", role: "group", "aria-label": words.sentence, "data-open": open ? "" : undefined, hidden: foldedAt ? true : undefined, className: "relative inline-flex min-w-0 shrink-0 items-center", children: [_jsx(Tooltip, { content: words.why, side: "bottom", children: _jsx("span", { className: "inline-flex min-w-0", children: _jsx(ToolbarButton, { ref: fieldBox, icon: null, label: messages({ key: "views.panels.filter-field" }), joined: "start", aside: true, popup: "dialog", open: open === "field", ...press("field"), children: words.field }) }) }), _jsx(Popover, { open: open === "field", onOpenChange: closed("field"), anchor: anchorOf("field"), align: "start", sideOffset: 8, chrome: "menu", children: _jsx(FilterFieldList, { fields: listedFieldsOf(ctx.filterTree), relations: true, onPick: (picked, far) => {
|
|
48
|
+
return (_jsxs("span", { ref: placeBox, "data-slot": "vk-toolbar-filter-aside", "data-aside": "", role: "group", "aria-label": words.sentence, "data-open": open ? "" : undefined, hidden: foldedAt ? true : undefined, className: "relative inline-flex min-w-0 shrink-0 items-center", children: [_jsx(Tooltip, { content: words.why, side: "bottom", children: _jsx("span", { className: "inline-flex min-w-0", children: _jsx(ToolbarButton, { part: "filters", ref: fieldBox, icon: null, label: messages({ key: "views.panels.filter-field" }), joined: "start", aside: true, popup: "dialog", open: open === "field", ...press("field"), children: words.field }) }) }), _jsx(Popover, { open: open === "field", onOpenChange: closed("field"), anchor: anchorOf("field"), align: "start", sideOffset: 8, chrome: "menu", children: _jsx(FilterFieldList, { fields: listedFieldsOf(ctx.filterTree), relations: true, onPick: (picked, far) => {
|
|
49
49
|
onOpenChange(null);
|
|
50
50
|
const result = repointBarFilter(ctx, path, node, picked, far);
|
|
51
51
|
if (result)
|
|
52
52
|
onRepointed?.(result);
|
|
53
|
-
}, onDone: () => onOpenChange(null) }) }), _jsx(ToolbarButton, { icon: null, label: messages({ key: "views.panels.filter-way" }), joined: "middle", disabled: true, disabledReason: words.why, children: words.way }), words.value !== null && (_jsx("span", { "data-part": "value", className: "inline-flex min-w-0 max-w-60", children: _jsx(ToolbarButton, { icon: null, label: messages({ key: "views.panels.filter-value" }), joined: "middle", disabled: true, disabledReason: words.why, children: words.value }) })), _jsx(ToolbarButton, { ref: menuBox, icon: _jsx(More, { className: "h-4 w-4 shrink-0" }), label: actions, joined: "end", iconAlone: true, popup: "menu", open: open === "menu", ...press("menu") }), _jsx(Menu, { open: open === "menu", onOpenChange: closed("menu"), anchor: anchorOf("menu"), align: "end", label: actions, items: [
|
|
53
|
+
}, onDone: () => onOpenChange(null) }) }), _jsx(ToolbarButton, { part: "filters", icon: null, label: messages({ key: "views.panels.filter-way" }), joined: "middle", disabled: true, disabledReason: words.why, children: words.way }), words.value !== null && (_jsx("span", { "data-part": "value", className: "inline-flex min-w-0 max-w-60", children: _jsx(ToolbarButton, { part: "filters", icon: null, label: messages({ key: "views.panels.filter-value" }), joined: "middle", disabled: true, disabledReason: words.why, children: words.value }) })), _jsx(ToolbarButton, { part: "filters", ref: menuBox, icon: _jsx(More, { className: "h-4 w-4 shrink-0" }), label: actions, joined: "end", iconAlone: true, popup: "menu", open: open === "menu", ...press("menu") }), _jsx(Menu, { open: open === "menu", onOpenChange: closed("menu"), anchor: anchorOf("menu"), align: "end", label: actions, items: [
|
|
54
54
|
{ key: "why", label: words.why, disabled: true },
|
|
55
55
|
...(fits
|
|
56
56
|
? [
|
|
@@ -81,17 +81,17 @@ export function ToolbarBarFilter({ ctx, at, rule, open, onOpenChange, foldedAt,
|
|
|
81
81
|
onOpenChange(null);
|
|
82
82
|
anchorOf(part).current?.focus({ preventScroll: true });
|
|
83
83
|
};
|
|
84
|
-
return (_jsxs("span", { ref: placeBox, "data-slot": "vk-toolbar-filter-rule", role: "group", "aria-label": words.sentence, "data-open": open ? "" : undefined, hidden: foldedAt ? true : undefined, className: "relative inline-flex min-w-0 shrink-0 items-center", children: [_jsx(ToolbarButton, { ref: fieldBox, icon: null, label: messages({ key: "views.panels.filter-field" }), joined: "start", popup: "dialog", open: open === "field", ...press("field"), children: words.field }), _jsx(Popover, { open: open === "field", onOpenChange: closed("field"), anchor: anchorOf("field"), align: "start", sideOffset: 8, chrome: "menu", children: _jsx(FilterFieldList, { fields: listedFieldsOf(ctx.filterTree), own: field?.key, relations: true, onPick: (picked, far) => {
|
|
84
|
+
return (_jsxs("span", { ref: placeBox, "data-slot": "vk-toolbar-filter-rule", role: "group", "aria-label": words.sentence, "data-open": open ? "" : undefined, hidden: foldedAt ? true : undefined, className: "relative inline-flex min-w-0 shrink-0 items-center", children: [_jsx(ToolbarButton, { part: "filters", ref: fieldBox, icon: null, label: messages({ key: "views.panels.filter-field" }), joined: "start", popup: "dialog", open: open === "field", ...press("field"), children: words.field }), _jsx(Popover, { open: open === "field", onOpenChange: closed("field"), anchor: anchorOf("field"), align: "start", sideOffset: 8, chrome: "menu", children: _jsx(FilterFieldList, { fields: listedFieldsOf(ctx.filterTree), own: field?.key, relations: true, onPick: (picked, far) => {
|
|
85
85
|
done("field");
|
|
86
86
|
pickBarField(ctx, at, rule, picked, far);
|
|
87
|
-
}, onDone: () => done("field") }) }), _jsx(ToolbarButton, { ref: wayBox, icon: null, label: messages({ key: "views.panels.filter-way" }), joined: "middle", popup: "dialog", open: open === "way", ...(field && press("way")), children: words.way }), field && (_jsx(Popover, { open: open === "way", onOpenChange: closed("way"), anchor: anchorOf("way"), align: "start", sideOffset: 8, chrome: "menu", children: _jsx(AppFilterPart, { part: "way", rule: rule, field: field, options: ctx.filterTree.optionsOf?.(rule.fieldKey, rule.part, relation?.fieldKey), own: null, form: "computer", onWay: (operator) => {
|
|
87
|
+
}, onDone: () => done("field") }) }), _jsx(ToolbarButton, { part: "filters", ref: wayBox, icon: null, label: messages({ key: "views.panels.filter-way" }), joined: "middle", popup: "dialog", open: open === "way", ...(field && press("way")), children: words.way }), field && (_jsx(Popover, { open: open === "way", onOpenChange: closed("way"), anchor: anchorOf("way"), align: "start", sideOffset: 8, chrome: "menu", children: _jsx(AppFilterPart, { part: "way", rule: rule, field: field, options: ctx.filterTree.optionsOf?.(rule.fieldKey, rule.part, relation?.fieldKey), own: null, form: "computer", onWay: (operator) => {
|
|
88
88
|
done("way");
|
|
89
89
|
if (operator !== rule.operator)
|
|
90
90
|
writeBarRule(ctx, at, withOperator(rule, field.type, operator));
|
|
91
|
-
}, onValue: write, onDone: () => done("way") }) })), words.value !== null && (_jsxs("span", { "data-part": "value", className: "inline-flex min-w-0 max-w-60", children: [_jsx(ToolbarButton, { ref: valueBox, icon: null, label: messages({ key: "views.panels.filter-value" }), joined: "middle", waits: words.waits, popup: "dialog", open: open === "value", ...press("value"), children: words.value }), config && (_jsx(Popover, { open: open === "value", onOpenChange: closed("value"), anchor: anchorOf("value"), align: "start", sideOffset: 8, chrome: "menu", initialFocus: false, children: field ? (_jsx(AppFilterPart, { part: "value", rule: rule, field: field, options: ctx.filterTree.optionsOf?.(rule.fieldKey, rule.part, relation?.fieldKey), own: _jsx(FilterValueBody, { filter: config }), form: "computer", onWay: (operator) => {
|
|
91
|
+
}, onValue: write, onDone: () => done("way") }) })), words.value !== null && (_jsxs("span", { "data-part": "value", className: "inline-flex min-w-0 max-w-60", children: [_jsx(ToolbarButton, { part: "filters", ref: valueBox, icon: null, label: messages({ key: "views.panels.filter-value" }), joined: "middle", waits: words.waits, popup: "dialog", open: open === "value", ...press("value"), children: words.value }), config && (_jsx(Popover, { open: open === "value", onOpenChange: closed("value"), anchor: anchorOf("value"), align: "start", sideOffset: 8, chrome: "menu", initialFocus: false, children: field ? (_jsx(AppFilterPart, { part: "value", rule: rule, field: field, options: ctx.filterTree.optionsOf?.(rule.fieldKey, rule.part, relation?.fieldKey), own: _jsx(FilterValueBody, { filter: config }), form: "computer", onWay: (operator) => {
|
|
92
92
|
if (operator !== rule.operator)
|
|
93
93
|
writeBarRule(ctx, at, withOperator(rule, field.type, operator));
|
|
94
|
-
}, onValue: write, onDone: () => done("value") })) : (_jsx(FilterValueBody, { filter: config })) }))] })), _jsx(ToolbarButton, { ref: menuBox, icon: _jsx(More, { className: "h-4 w-4 shrink-0" }), label: actions, joined: "end", iconAlone: true, popup: "menu", open: open === "menu", ...press("menu") }), _jsx(Menu, { open: open === "menu", onOpenChange: closed("menu"), anchor: anchorOf("menu"), align: "end", label: actions, items: [
|
|
94
|
+
}, onValue: write, onDone: () => done("value") })) : (_jsx(FilterValueBody, { filter: config })) }))] })), _jsx(ToolbarButton, { part: "filters", ref: menuBox, icon: _jsx(More, { className: "h-4 w-4 shrink-0" }), label: actions, joined: "end", iconAlone: true, popup: "menu", open: open === "menu", ...press("menu") }), _jsx(Menu, { open: open === "menu", onOpenChange: closed("menu"), anchor: anchorOf("menu"), align: "end", label: actions, items: [
|
|
95
95
|
...(convert && at.item && canGroupAt(ctx.view, at.item)
|
|
96
96
|
? [
|
|
97
97
|
{
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cx } from "../../../internal/cx.js";
|
|
3
4
|
import { useViews } from "../../../provider/context.js";
|
|
4
5
|
import { useToolbarSlot } from "./context.js";
|
|
5
6
|
export function ToolbarButton({ size, ...props }) {
|
|
@@ -8,5 +9,7 @@ export function ToolbarButton({ size, ...props }) {
|
|
|
8
9
|
const iconOnly = slot.words === "icon" && props.icon != null;
|
|
9
10
|
const hasWords = props.word !== null || props.children != null;
|
|
10
11
|
const alone = slot.iconAlone || (iconOnly && hasWords);
|
|
11
|
-
|
|
12
|
+
const Button = slot.button ?? atoms.ToolbarButton;
|
|
13
|
+
const className = cx(slot.className, props.className) || undefined;
|
|
14
|
+
return (_jsx(Button, { ...props, ...(iconOnly && { word: null }), ...(alone && { iconAlone: true }), ...(className && { className }), size: size ?? slot.size }));
|
|
12
15
|
}
|
|
@@ -34,7 +34,7 @@ function FilterListPart({ filters, timeScopeConfig, dateRangeConfigs, onClear, o
|
|
|
34
34
|
else
|
|
35
35
|
setOwnOpen(next);
|
|
36
36
|
};
|
|
37
|
-
return (_jsx(ToolbarPanelPart, { panelKey: "filter", slot: "vk-toolbar-filter", icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: name, word: name, words: onBar ? name : undefined, empty: onBar && count === 0, count: count, onClear: clear, open: holdsOpen ? open : ownOpen, onOpenChange: handleOpenChange, host: host, popoverClassName: viewOptionsPopoverClassName(page), children: ({ fill, close, closeButton }) => (_jsx(FilterPanelContent, { filters: filters, timeScopeConfig: timeScopeConfig, dateRangeConfigs: dateRangeConfigs, page: page, onPageChange: setPage, onClose: closeButton ? close : undefined, onConverted: sheet ? undefined : close, fill: fill })) }));
|
|
37
|
+
return (_jsx(ToolbarPanelPart, { panelKey: "filter", slot: "vk-toolbar-filter", part: "filter", icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: name, word: name, words: onBar ? name : undefined, empty: onBar && count === 0, count: count, onClear: clear, open: holdsOpen ? open : ownOpen, onOpenChange: handleOpenChange, host: host, popoverClassName: viewOptionsPopoverClassName(page), children: ({ fill, close, closeButton }) => (_jsx(FilterPanelContent, { filters: filters, timeScopeConfig: timeScopeConfig, dateRangeConfigs: dateRangeConfigs, page: page, onPageChange: setPage, onClose: closeButton ? close : undefined, onConverted: sheet ? undefined : close, fill: fill })) }));
|
|
38
38
|
}
|
|
39
39
|
export function ToolbarFilter({ filterTree, ...props }) {
|
|
40
40
|
const sheet = useSheetPanels();
|
|
@@ -33,7 +33,7 @@ export function ToolbarFilterAdd({ filterTree, onHeldChange, open, onOpenChange,
|
|
|
33
33
|
hangsAt.anchor.current?.focus({ preventScroll: true });
|
|
34
34
|
} }));
|
|
35
35
|
const HostPanel = host;
|
|
36
|
-
return (_jsxs("span", { "data-slot": "vk-toolbar-filter-add-row", "data-open": hangsAt.fold && fields.open ? "" : undefined, className: "relative inline-flex shrink-0", children: [_jsx(ToolbarButton, { ref: box, icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: name, popup: "dialog", open: fields.open, disabled: !!refusal, disabledReason: reason, onPointerDown: () => {
|
|
36
|
+
return (_jsxs("span", { "data-slot": "vk-toolbar-filter-add-row", "data-open": hangsAt.fold && fields.open ? "" : undefined, className: "relative inline-flex shrink-0", children: [_jsx(ToolbarButton, { ref: box, part: "filter-add", icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: name, popup: "dialog", open: fields.open, disabled: !!refusal, disabledReason: reason, onPointerDown: () => {
|
|
37
37
|
atPress.current = fields.open;
|
|
38
38
|
}, onClick: (event) => {
|
|
39
39
|
if (refusal)
|
|
@@ -28,5 +28,5 @@ export function FilterTreeSheetPart({ filters, filterTree, onClear, open, onOpen
|
|
|
28
28
|
const name = messages({ key: "views.panels.filter" });
|
|
29
29
|
const count = countActiveFilters({ filters }) + advancedFiltersOf(filterTree.tree).filter((advanced) => advanced.count > 0).length;
|
|
30
30
|
const clear = onClear ?? (() => clearViewOptions({ filters, filterTree }));
|
|
31
|
-
return (_jsx(ToolbarPanelPart, { panelKey: "filter", slot: "vk-toolbar-filter", icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: name, word: name, count: count, onClear: clear, open: isOpen, onOpenChange: setOpen, host: host, sheetActions: editor.head, ...(headDraws && editor.title !== undefined && { sheetTitle: editor.title }), onSheetEscape: editor.escapeBack, children: ({ closeButton }) => (_jsx("div", { className: "flex h-full min-h-0 flex-col", children: editor.body(closeButton) }, openings)) }));
|
|
31
|
+
return (_jsx(ToolbarPanelPart, { panelKey: "filter", slot: "vk-toolbar-filter", part: "filter", icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: name, word: name, count: count, onClear: clear, open: isOpen, onOpenChange: setOpen, host: host, sheetActions: editor.head, ...(headDraws && editor.title !== undefined && { sheetTitle: editor.title }), onSheetEscape: editor.escapeBack, children: ({ closeButton }) => (_jsx("div", { className: "flex h-full min-h-0 flex-col", children: editor.body(closeButton) }, openings)) }));
|
|
32
32
|
}
|
|
@@ -246,7 +246,7 @@ export function ToolbarFilters({ filterTree, open: openIn, onOpenChange: onOpenC
|
|
|
246
246
|
},
|
|
247
247
|
];
|
|
248
248
|
});
|
|
249
|
-
const moreFilters = folding.length > 0 && (_jsxs("span", { "data-slot": "vk-toolbar-more-filters", className: "relative inline-flex shrink-0", children: [_jsx(ToolbarButton, { ref: moreBox, icon: null, label: messages({ key: "views.panels.filter-more-named", values: { count: folding.length } }), popup: "menu", open: more.open, onPointerDown: () => {
|
|
249
|
+
const moreFilters = folding.length > 0 && (_jsxs("span", { "data-slot": "vk-toolbar-more-filters", className: "relative inline-flex shrink-0", children: [_jsx(ToolbarButton, { ref: moreBox, part: "more-filters", icon: null, label: messages({ key: "views.panels.filter-more-named", values: { count: folding.length } }), popup: "menu", open: more.open, onPointerDown: () => {
|
|
250
250
|
openAtPress.current = more.open;
|
|
251
251
|
}, onClick: (event) => {
|
|
252
252
|
const wasOpen = event.detail === 0 ? more.open : openAtPress.current;
|
|
@@ -276,7 +276,7 @@ export function ToolbarFilters({ filterTree, open: openIn, onOpenChange: onOpenC
|
|
|
276
276
|
fields.onOpenChange(!wasOpen);
|
|
277
277
|
},
|
|
278
278
|
};
|
|
279
|
-
const add = (_jsxs("span", { "data-slot": empty ? "vk-toolbar-filter" : "vk-toolbar-filter-add", "data-open": hangsAt.fold && fields.open ? "" : undefined, className: "relative inline-flex shrink-0", children: [empty ? (_jsx(ToolbarButton, { ref: addBox, icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: name, empty: true, popup: "dialog", open: fields.open, disabled: !!refusal, disabledReason: reason, ...pressAdd, children: name })) : (_jsx(ToolbarButton, { ref: addBox, icon: _jsx(Plus, { className: "h-4 w-4 shrink-0" }), label: addLabel, word: null, popup: "dialog", open: fields.open, disabled: !!refusal, disabledReason: reason, ...pressAdd })), host ? null : (_jsx(Popover, { open: fields.open, onOpenChange: (next, details) => {
|
|
279
|
+
const add = (_jsxs("span", { "data-slot": empty ? "vk-toolbar-filter" : "vk-toolbar-filter-add", "data-open": hangsAt.fold && fields.open ? "" : undefined, className: "relative inline-flex shrink-0", children: [empty ? (_jsx(ToolbarButton, { ref: addBox, part: "filter", icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: name, empty: true, popup: "dialog", open: fields.open, disabled: !!refusal, disabledReason: reason, ...pressAdd, children: name })) : (_jsx(ToolbarButton, { ref: addBox, part: "filter-add", icon: _jsx(Plus, { className: "h-4 w-4 shrink-0" }), label: addLabel, word: null, popup: "dialog", open: fields.open, disabled: !!refusal, disabledReason: reason, ...pressAdd })), host ? null : (_jsx(Popover, { open: fields.open, onOpenChange: (next, details) => {
|
|
280
280
|
fields.onOpenChange(next);
|
|
281
281
|
const why = details?.reason;
|
|
282
282
|
if (!next && why !== "outside-press" && why !== "focus-out")
|
|
@@ -22,7 +22,7 @@ export function ToolbarNew({ onAdd, items, label, icon, }) {
|
|
|
22
22
|
const atFoot = slot.fold && slot.form === "phone" && slot.foot !== false;
|
|
23
23
|
const place = (_jsxs("span", { "data-slot": "vk-toolbar-new", "data-at": atFoot ? "foot" : undefined, className: atFoot
|
|
24
24
|
? "fixed bottom-[calc(var(--vk-toolbar-foot,1rem)+env(safe-area-inset-bottom))] end-4 z-30 inline-flex"
|
|
25
|
-
: "relative inline-flex shrink-0", children: [_jsx(ToolbarButton, { ref: anchor, icon: icon ?? _jsx(Add, { className: "h-4 w-4 shrink-0" }), label: name, word: name, edge: true, foot: atFoot || undefined, disabled: !onAdd && !hasMenu, popup: hasMenu ? "menu" : undefined, open: hasMenu && toggle.open, onPointerDown: hasMenu ? toggle.triggerProps.onPointerDown : undefined, onClick: (event) => (hasMenu ? toggle.triggerProps.onClick(event) : onAdd?.()) }), hasMenu && (_jsx(Menu, { open: toggle.open, onOpenChange: toggle.onOpenChange, anchor: anchor, items: items, align: "end", side: atFoot ? "top" : undefined, label: name }))] }));
|
|
25
|
+
: "relative inline-flex shrink-0", children: [_jsx(ToolbarButton, { ref: anchor, part: "new", icon: icon ?? _jsx(Add, { className: "h-4 w-4 shrink-0" }), label: name, word: name, edge: true, foot: atFoot || undefined, disabled: !onAdd && !hasMenu, popup: hasMenu ? "menu" : undefined, open: hasMenu && toggle.open, onPointerDown: hasMenu ? toggle.triggerProps.onPointerDown : undefined, onClick: (event) => (hasMenu ? toggle.triggerProps.onClick(event) : onAdd?.()) }), hasMenu && (_jsx(Menu, { open: toggle.open, onOpenChange: toggle.onOpenChange, anchor: anchor, items: items, align: "end", side: atFoot ? "top" : undefined, label: name }))] }));
|
|
26
26
|
return atFoot && hasBody ? createPortal(place, document.body) : atFoot ? null : place;
|
|
27
27
|
}
|
|
28
28
|
const noSubscription = () => () => { };
|
|
@@ -31,7 +31,7 @@ export function ToolbarOptions({ view, viewFoot, footClear, fieldEditor, foldFil
|
|
|
31
31
|
else
|
|
32
32
|
setOwnOpen(next);
|
|
33
33
|
};
|
|
34
|
-
return (_jsx(ToolbarPanelPart, { panelKey: "options", slot: "vk-toolbar-options", icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: name, word: name, count: count, onClear: clear, dot: !!view && view.changes > 0, open: holdsOpen ? open : ownOpen, onOpenChange: handleOpenChange, host: host, popoverClassName: widthClassName
|
|
34
|
+
return (_jsx(ToolbarPanelPart, { panelKey: "options", slot: "vk-toolbar-options", part: "options", icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: name, word: name, count: count, onClear: clear, dot: !!view && view.changes > 0, open: holdsOpen ? open : ownOpen, onOpenChange: handleOpenChange, host: host, popoverClassName: widthClassName
|
|
35
35
|
? viewOptionsPopoverClassName(page, widthClassName)
|
|
36
36
|
: viewOptionsPopoverClassName(null, "w-75"), onSheetEscape: step.escapeBack, children: ({ fill, close, closeButton }) => (_jsx(PanelStepHold.Provider, { value: step, children: _jsx(ViewOptionsPanelContent, { ...inputs, activePanel: page, onOpenPanel: setPage, anyActive: view ? view.changes > 0 : count > 0, clearAll: clear, foldFilters: foldFilters, onClose: close, closeButton: closeButton, fill: fill, view: view, viewFoot: viewFoot, footClear: footClear, fieldEditor: fieldEditor, ...(viewName !== undefined && { viewName }), ...(onRenameView && { onRenameView }), ...(onCopyLink && { onCopyLink }), ...(onExport && { onExport }), ...(exportCount !== undefined && { exportCount }) }) })) }));
|
|
37
37
|
}
|
|
@@ -14,5 +14,5 @@ export function ToolbarQuickFilters({ quickFilters, open, onOpenChange, host, ic
|
|
|
14
14
|
return null;
|
|
15
15
|
const Glyph = icons.filterCategory;
|
|
16
16
|
const label = quickFilters.label ?? messages({ key: "views.panels.quick-filters" });
|
|
17
|
-
return (_jsx(ToolbarPanelPart, { panelKey: "quick", slot: "vk-toolbar-quick", icon: icon ?? _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: label, word: word === null && slot.words !== "both" ? null : label, changed: holdStands(quickFilters.hold), open: open, onOpenChange: onOpenChange, host: host, children: ({ close, closeButton }) => (_jsx(QuickFiltersPanel, { quickFilters: quickFilters, form: phone ? "phone" : "computer", onDone: close, closeButton: closeButton })) }));
|
|
17
|
+
return (_jsx(ToolbarPanelPart, { panelKey: "quick", slot: "vk-toolbar-quick", part: "quick", icon: icon ?? _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: label, word: word === null && slot.words !== "both" ? null : label, changed: holdStands(quickFilters.hold), open: open, onOpenChange: onOpenChange, host: host, children: ({ close, closeButton }) => (_jsx(QuickFiltersPanel, { quickFilters: quickFilters, form: phone ? "phone" : "computer", onDone: close, closeButton: closeButton })) }));
|
|
18
18
|
}
|
|
@@ -43,7 +43,7 @@ export function ToolbarSearch({ value, onChange, placeholder, searching = false,
|
|
|
43
43
|
setOpened(false);
|
|
44
44
|
};
|
|
45
45
|
if (!shown) {
|
|
46
|
-
return (_jsx("div", { "data-slot": "vk-toolbar-search", className: "relative flex flex-none items-center", children: _jsx(ToolbarButton, { icon: searching ? _jsx(LoadingRing, { label: busy, slot: "vk-toolbar-search-spinner", className: "h-4 w-4" }) : _jsx(Glass, { className: "h-4 w-4 shrink-0" }), label: name, word: slot.words === "both" ? undefined : null, onClick: () => {
|
|
46
|
+
return (_jsx("div", { "data-slot": "vk-toolbar-search", className: "relative flex flex-none items-center", children: _jsx(ToolbarButton, { part: "search", icon: searching ? _jsx(LoadingRing, { label: busy, slot: "vk-toolbar-search-spinner", className: "h-4 w-4" }) : _jsx(Glass, { className: "h-4 w-4 shrink-0" }), label: name, word: slot.words === "both" ? undefined : null, onClick: () => {
|
|
47
47
|
pressed.current = true;
|
|
48
48
|
setOpened(true);
|
|
49
49
|
} }) }));
|
|
@@ -20,10 +20,10 @@ export function ToolbarSort({ sort, sorts, open, onOpenChange, host, }) {
|
|
|
20
20
|
const n = sorts.rules.length;
|
|
21
21
|
const places = openSortPlaces(sorts);
|
|
22
22
|
const can = canAddSortRule(sorts.rules, places);
|
|
23
|
-
return (_jsx(ToolbarPanelPart, { panelKey: "sort", slot: "vk-toolbar-sort", icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: name, word: name, more: n > 1 ? String(n) : undefined, changed: isSortRulesActive(sorts), disabled: !can, disabledReason: can ? undefined : messages({ key: "views.panels.sort-max", values: { max: sorts.max } }), open: open, onOpenChange: onOpenChange, host: host, popoverClassName: viewOptionsPopoverClassName(null), children: ({ close }) => (_jsx(SortFieldList, { sorts: sorts, form: phone ? "phone" : "computer", onPick: (value) => {
|
|
23
|
+
return (_jsx(ToolbarPanelPart, { panelKey: "sort", slot: "vk-toolbar-sort", part: "sort", icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: name, word: name, more: n > 1 ? String(n) : undefined, changed: isSortRulesActive(sorts), disabled: !can, disabledReason: can ? undefined : messages({ key: "views.panels.sort-max", values: { max: sorts.max } }), open: open, onOpenChange: onOpenChange, host: host, popoverClassName: viewOptionsPopoverClassName(null), children: ({ close }) => (_jsx(SortFieldList, { sorts: sorts, form: phone ? "phone" : "computer", onPick: (value) => {
|
|
24
24
|
sorts.onChange(addSortRule(sorts.rules, value, places));
|
|
25
25
|
close();
|
|
26
26
|
}, onDone: close })) }));
|
|
27
27
|
}
|
|
28
|
-
return (_jsx(ToolbarPanelPart, { panelKey: "sort", slot: "vk-toolbar-sort", icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: name, word: name, changed: isSortActive(sort), open: open, onOpenChange: onOpenChange, host: host, popoverClassName: viewOptionsPopoverClassName(null), children: ({ fill, close, closeButton }) => (_jsxs("div", { className: fill ? "flex h-full min-h-0 flex-col" : "flex flex-col", children: [_jsx(PanelHeader, { title: sort.label ?? name, onClose: closeButton ? close : undefined }), _jsx("div", { className: fill ? "min-h-0 flex-1 overflow-y-auto overscroll-contain **:data-vs-detail:max-h-none" : undefined, children: _jsx(CompactSortDetail, { sort: sort }) })] })) }));
|
|
28
|
+
return (_jsx(ToolbarPanelPart, { panelKey: "sort", slot: "vk-toolbar-sort", part: "sort", icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: name, word: name, changed: isSortActive(sort), open: open, onOpenChange: onOpenChange, host: host, popoverClassName: viewOptionsPopoverClassName(null), children: ({ fill, close, closeButton }) => (_jsxs("div", { className: fill ? "flex h-full min-h-0 flex-col" : "flex flex-col", children: [_jsx(PanelHeader, { title: sort.label ?? name, onClose: closeButton ? close : undefined }), _jsx("div", { className: fill ? "min-h-0 flex-1 overflow-y-auto overscroll-contain **:data-vs-detail:max-h-none" : undefined, children: _jsx(CompactSortDetail, { sort: sort }) })] })) }));
|
|
29
29
|
}
|
|
@@ -6,7 +6,8 @@ import { addSortRule, canAddSortRule, isSortRulesActive, openSortPlaces, sortRul
|
|
|
6
6
|
import { useSheetDrawsClose, useSheetPanels } from "../panel-sheet.js";
|
|
7
7
|
import { SortEditorHost, useSortEditorHost } from "../sort/SortEditor.js";
|
|
8
8
|
import { SortFieldList } from "../sort/SortFieldList.js";
|
|
9
|
-
import {
|
|
9
|
+
import { placePart } from "../../../atoms/frame-parts.js";
|
|
10
|
+
import { useFoldAnchor, useToolbarPanel, useToolbarSlot } from "./context.js";
|
|
10
11
|
import { ToolbarPanelPart } from "./panel-part.js";
|
|
11
12
|
import { ToolbarButton } from "./ToolbarButton.js";
|
|
12
13
|
export function ToolbarSortPill(props) {
|
|
@@ -19,6 +20,7 @@ function ComputerPill({ sorts, open: openIn, onOpenChange: onOpenChangeIn, host:
|
|
|
19
20
|
const addAfter = row ? false : addAfterIn;
|
|
20
21
|
const { components, icons, messages } = useViews();
|
|
21
22
|
const { Popover } = components;
|
|
23
|
+
const slot = useToolbarSlot();
|
|
22
24
|
const panel = useToolbarPanel("sort", openIn !== undefined && onOpenChangeIn ? { open: openIn, onOpenChange: onOpenChangeIn } : undefined);
|
|
23
25
|
const [pressed, setOpens] = useState({ what: "editor", at: "pill" });
|
|
24
26
|
const pill = useRef(null);
|
|
@@ -64,13 +66,13 @@ function ComputerPill({ sorts, open: openIn, onOpenChange: onOpenChangeIn, host:
|
|
|
64
66
|
sorts.onChange(next);
|
|
65
67
|
close(true, opens.at === "add" && canAddSortRule(next, places));
|
|
66
68
|
}, onDone: () => close() }));
|
|
67
|
-
return (_jsxs("span", { className: "contents", "data-open": hangsAt.fold && panel.open ? "" : undefined, children: [_jsx(ToolbarButton, { ref: pill, icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: name, empty: !row && !named && !asideOnly, aside: asideOnly, changed: row ? !!named : isSortRulesActive(sorts), more: row
|
|
69
|
+
return (_jsxs("span", { className: "contents", "data-open": hangsAt.fold && panel.open ? "" : undefined, children: [_jsx(ToolbarButton, { ref: pill, part: placePart(slot.key) ?? "sort", icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: name, empty: !row && !named && !asideOnly, aside: asideOnly, changed: row ? !!named : isSortRulesActive(sorts), more: row
|
|
68
70
|
? sorts.rules.length > 1
|
|
69
71
|
? String(sorts.rules.length)
|
|
70
72
|
: undefined
|
|
71
73
|
: named && named.more > 0
|
|
72
74
|
? messages({ key: "views.panels.sort-more", values: { count: named.more } })
|
|
73
|
-
: undefined, popup: "dialog", open: panel.open && opens.at === "pill", onPointerDown: pressStart("pill"), onClick: press({ what: named || asideOnly ? "editor" : "fields", at: "pill", addSort: asideOnly || !addAfter }), children: named && !row ? (_jsxs(_Fragment, { children: [messages({ key: "views.panels.sorted-by" }), " ", _jsx("b", { children: named.first })] })) : (name) }), addAfter && named && can && (_jsx("span", { "data-slot": "vk-toolbar-sort-add", className: "inline-flex", children: _jsx(ToolbarButton, { ref: add, icon: _jsx(Plus, { className: "h-4 w-4 shrink-0" }), label: messages({ key: "views.panels.sort-add-one" }), word: null, popup: "dialog", open: panel.open && opens.at === "add", onPointerDown: pressStart("add"), onClick: press({ what: "fields", at: "add" }) }) })), Host ? (_jsx(Host, { open: panel.open, onOpenChange: panel.onOpenChange, title: name, children: content })) : (_jsx(Popover, { open: panel.open, onOpenChange: (next, details) => {
|
|
75
|
+
: undefined, popup: "dialog", open: panel.open && opens.at === "pill", onPointerDown: pressStart("pill"), onClick: press({ what: named || asideOnly ? "editor" : "fields", at: "pill", addSort: asideOnly || !addAfter }), children: named && !row ? (_jsxs(_Fragment, { children: [messages({ key: "views.panels.sorted-by" }), " ", _jsx("b", { children: named.first })] })) : (name) }), addAfter && named && can && (_jsx("span", { "data-slot": "vk-toolbar-sort-add", className: "inline-flex", children: _jsx(ToolbarButton, { ref: add, part: "sort-add", icon: _jsx(Plus, { className: "h-4 w-4 shrink-0" }), label: messages({ key: "views.panels.sort-add-one" }), word: null, popup: "dialog", open: panel.open && opens.at === "add", onPointerDown: pressStart("add"), onClick: press({ what: "fields", at: "add" }) }) })), Host ? (_jsx(Host, { open: panel.open, onOpenChange: panel.onOpenChange, title: name, children: content })) : (_jsx(Popover, { open: panel.open, onOpenChange: (next, details) => {
|
|
74
76
|
if (!next)
|
|
75
77
|
close(details?.reason !== "outside-press" && details?.reason !== "focus-out");
|
|
76
78
|
}, anchor: hangsAt.hidden ? hangsAt.anchor : opens.at === "add" ? add : pill, align: "start", sideOffset: 8, chrome: "menu", panelData: { "data-slot": "vk-toolbar-sort-panel" }, children: content }))] }));
|
|
@@ -86,5 +88,5 @@ function PhonePill({ sorts, open: openIn, onOpenChange: onOpenChangeIn, host })
|
|
|
86
88
|
const Glyph = icons.sort;
|
|
87
89
|
const name = messages({ key: "views.panels.sort" });
|
|
88
90
|
const n = sorts.rules.length;
|
|
89
|
-
return (_jsx(ToolbarPanelPart, { panelKey: "sort", slot: "vk-toolbar-sort", icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: name, word: name, more: n > 0 ? String(n) : undefined, changed: isSortRulesActive(sorts), open: open, onOpenChange: onOpenChange, host: host, sheetActions: editor.head, ...(headDraws && editor.title !== undefined && { sheetTitle: editor.title }), onSheetEscape: editor.escapeBack, children: ({ fill, closeButton }) => (_jsx("div", { className: fill ? "flex h-full min-h-0 flex-col" : "flex flex-col", children: editor.body(closeButton) })) }));
|
|
91
|
+
return (_jsx(ToolbarPanelPart, { panelKey: "sort", slot: "vk-toolbar-sort", part: "sort", icon: _jsx(Glyph, { className: "h-4 w-4 shrink-0" }), label: name, word: name, more: n > 0 ? String(n) : undefined, changed: isSortRulesActive(sorts), open: open, onOpenChange: onOpenChange, host: host, sheetActions: editor.head, ...(headDraws && editor.title !== undefined && { sheetTitle: editor.title }), onSheetEscape: editor.escapeBack, children: ({ fill, closeButton }) => (_jsx("div", { className: fill ? "flex h-full min-h-0 flex-col" : "flex flex-col", children: editor.body(closeButton) })) }));
|
|
90
92
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type ReactNode, type RefObject } from "react";
|
|
1
|
+
import { type ReactNode, type RefObject, type ComponentType } from "react";
|
|
2
|
+
import type { ViewsToolbarButtonProps } from "../../../atoms/types.js";
|
|
2
3
|
import type { ToolbarForm, ToolbarLine } from "../../toolbar/model.js";
|
|
3
4
|
/** Where a part stands: the toolbar's form, whether it fills its line, its buttons' size, and its line's kind.
|
|
4
5
|
* In the fold arrangement (`fold`), also how far its line gave way: whether its words turned to its icon
|
|
@@ -31,6 +32,14 @@ export type ToolbarSlotState = {
|
|
|
31
32
|
words?: "both" | "icon";
|
|
32
33
|
/** `false`: New stays on a phone's folding line instead of at the list's foot. */
|
|
33
34
|
foot?: boolean;
|
|
35
|
+
/** The key of the place it stands in (VK-984): a part whose button stands in more than one place (Sort's pill, a panel
|
|
36
|
+
* part) names its button after it. */
|
|
37
|
+
key?: string;
|
|
38
|
+
/** Its place's class (`ToolbarPartPlace.className`, VK-984), handed to every toolbar button the part draws. */
|
|
39
|
+
className?: string;
|
|
40
|
+
/** Its place's own button (`ToolbarPartPlace.button`, VK-984), drawn for every toolbar button the part draws, in place of
|
|
41
|
+
* your `ToolbarButton`, handed the same props. */
|
|
42
|
+
button?: ComponentType<ViewsToolbarButtonProps>;
|
|
34
43
|
};
|
|
35
44
|
/** The fold arrangement's part of a slot, for a line that doesn't fold. */
|
|
36
45
|
export declare const NOT_FOLDING: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ComponentType, type ReactNode, type RefObject } from "react";
|
|
2
2
|
import type { ViewsSheetActions } from "../../../provider/components.js";
|
|
3
|
+
import type { ViewsToolbarButtonPart } from "../../../atoms/types.js";
|
|
3
4
|
/** Where a panel part hangs its panel instead of the map's `Popover`: the app's drawer, or its sheet on a phone.
|
|
4
5
|
* The panel draws full height inside it (`fill`). */
|
|
5
6
|
export type ToolbarPanelHost = ComponentType<{
|
|
@@ -13,11 +14,13 @@ export type ToolbarPanelHost = ComponentType<{
|
|
|
13
14
|
opener?: RefObject<HTMLElement | null>;
|
|
14
15
|
children: ReactNode;
|
|
15
16
|
}>;
|
|
16
|
-
export declare function ToolbarPanelPart({ panelKey, slot, icon, label, word, count, onClear, dot, changed, open: openIn, onOpenChange: onOpenChangeIn, host: Host, popoverClassName, words, more, empty, disabled, disabledReason, sheetActions, sheetTitle, onSheetEscape, children, }: {
|
|
17
|
+
export declare function ToolbarPanelPart({ panelKey, slot, part: ownPart, icon, label, word, count, onClear, dot, changed, open: openIn, onOpenChange: onOpenChangeIn, host: Host, popoverClassName, words, more, empty, disabled, disabledReason, sheetActions, sheetTitle, onSheetEscape, children, }: {
|
|
17
18
|
/** The radio's name for it. */
|
|
18
19
|
panelKey: string;
|
|
19
20
|
/** Its place's `data-slot`; the popover, or the panel's box in a sheet, is marked `${slot}-panel`. */
|
|
20
21
|
slot: string;
|
|
22
|
+
/** Its button's `part` (VK-984) where its place doesn't name it: the key of the place it stands in wins. */
|
|
23
|
+
part: ViewsToolbarButtonPart;
|
|
21
24
|
icon: ReactNode;
|
|
22
25
|
label: string;
|
|
23
26
|
word?: string | null;
|
|
@@ -3,14 +3,16 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useEffect, useRef } from "react";
|
|
4
4
|
import { useViews } from "../../../provider/context.js";
|
|
5
5
|
import { PanelSheet, useSheetDrawsClose, useSheetPanels } from "../panel-sheet.js";
|
|
6
|
-
import {
|
|
6
|
+
import { placePart } from "../../../atoms/frame-parts.js";
|
|
7
|
+
import { useFoldAnchor, useToolbarPanel, useToolbarSlot } from "./context.js";
|
|
7
8
|
import { ToolbarButton } from "./ToolbarButton.js";
|
|
8
|
-
export function ToolbarPanelPart({ panelKey, slot, icon, label, word, count, onClear, dot, changed, open: openIn, onOpenChange: onOpenChangeIn, host: Host, popoverClassName, words, more, empty, disabled, disabledReason, sheetActions, sheetTitle, onSheetEscape, children, }) {
|
|
9
|
+
export function ToolbarPanelPart({ panelKey, slot, part: ownPart, icon, label, word, count, onClear, dot, changed, open: openIn, onOpenChange: onOpenChangeIn, host: Host, popoverClassName, words, more, empty, disabled, disabledReason, sheetActions, sheetTitle, onSheetEscape, children, }) {
|
|
9
10
|
const { components } = useViews();
|
|
10
11
|
const sheet = useSheetPanels();
|
|
11
12
|
const headCloses = useSheetDrawsClose();
|
|
12
13
|
const { Popover } = components;
|
|
13
14
|
const anchor = useRef(null);
|
|
15
|
+
const part = placePart(useToolbarSlot().key) ?? ownPart;
|
|
14
16
|
const held = useToolbarPanel(panelKey, openIn === undefined || !onOpenChangeIn ? undefined : { open: openIn, onOpenChange: onOpenChangeIn });
|
|
15
17
|
const { open, onOpenChange } = held;
|
|
16
18
|
const hangsAt = useFoldAnchor(anchor);
|
|
@@ -29,7 +31,7 @@ export function ToolbarPanelPart({ panelKey, slot, icon, label, word, count, onC
|
|
|
29
31
|
focusBack.current = false;
|
|
30
32
|
hangsAt.anchor.current?.focus({ preventScroll: true });
|
|
31
33
|
}, [open, hangsAt.anchor]);
|
|
32
|
-
return (_jsxs("span", { "data-slot": slot, "data-open": hangsAt.fold && open ? "" : undefined, className: "relative inline-flex shrink-0", children: [_jsx(ToolbarButton, { ref: anchor, ...(words != null && { children: words }), icon: icon, label: label, word: word, count: count, onClear: onClear, dot: dot, changed: changed, popup: "dialog", open: open, more: more, empty: empty, disabled: disabled, disabledReason: disabledReason, onPointerDown: () => {
|
|
34
|
+
return (_jsxs("span", { "data-slot": slot, "data-open": hangsAt.fold && open ? "" : undefined, className: "relative inline-flex shrink-0", children: [_jsx(ToolbarButton, { ref: anchor, part: part, ...(words != null && { children: words }), icon: icon, label: label, word: word, count: count, onClear: onClear, dot: dot, changed: changed, popup: "dialog", open: open, more: more, empty: empty, disabled: disabled, disabledReason: disabledReason, onPointerDown: () => {
|
|
33
35
|
openAtPress.current = open;
|
|
34
36
|
}, onClick: (event) => {
|
|
35
37
|
if (disabled)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { valueTypeOf } from "viewkitjs/fields";
|
|
1
|
+
import { isIntegerField, valueTypeOf } from "viewkitjs/fields";
|
|
2
2
|
import { LIST_SETTINGS_LIMITS, filterValueSchema, isFilterGroup, isRelationRule, operatorsFor, parsePartKey, partKey, treeDepth, } from "viewkitjs/fields/query";
|
|
3
3
|
import { resolveViewsMessage } from "../../contract.js";
|
|
4
4
|
import { columnLabel } from "../../model/column-capabilities.js";
|
|
@@ -109,6 +109,9 @@ function markOf(column) {
|
|
|
109
109
|
const mark = columnMark(column);
|
|
110
110
|
return mark ? { mark } : {};
|
|
111
111
|
}
|
|
112
|
+
function wholeOf(column, part) {
|
|
113
|
+
return part === undefined && column.field && isIntegerField(column.field) ? { integer: true } : {};
|
|
114
|
+
}
|
|
112
115
|
function spokenOf(input) {
|
|
113
116
|
const messages = input.filterData?.messages ?? input.resolve;
|
|
114
117
|
const conventions = input.filterData?.conventions ?? input.conventions;
|
|
@@ -163,6 +166,7 @@ function editorFields(input) {
|
|
|
163
166
|
...(part !== undefined ? { part } : {}),
|
|
164
167
|
type: valueTypeOf(column.field),
|
|
165
168
|
...markOf(column),
|
|
169
|
+
...wholeOf(column, part),
|
|
166
170
|
},
|
|
167
171
|
];
|
|
168
172
|
});
|
|
@@ -175,6 +179,7 @@ function editorFields(input) {
|
|
|
175
179
|
fieldKey: column.id,
|
|
176
180
|
type: valueTypeOf(column.field),
|
|
177
181
|
...markOf(column),
|
|
182
|
+
...wholeOf(column),
|
|
178
183
|
}));
|
|
179
184
|
return {
|
|
180
185
|
key: relationFilterKey(key),
|
|
@@ -3,7 +3,7 @@ import { type FieldConventions } from "viewkitjs/fields";
|
|
|
3
3
|
import { type ViewsMessageResolver } from "../contract.js";
|
|
4
4
|
import type { ViewsAtoms } from "../atoms/types.js";
|
|
5
5
|
import type { FieldPresentation } from "../display/options.js";
|
|
6
|
-
import type
|
|
6
|
+
import { type PanelControlName, type ViewsComponents, type ViewsDatePicks, type ViewsSelectionBarSettings, type ViewsSheetActionsPlace } from "./components.js";
|
|
7
7
|
import type { ViewsIcons } from "./icons.js";
|
|
8
8
|
import type { ViewsEscapeRules } from "../editors/escape-rule.js";
|
|
9
9
|
import type { ViewsOneValueEditors } from "../model/one-value.js";
|
|
@@ -69,6 +69,10 @@ export type ViewsProviderProps = {
|
|
|
69
69
|
* while rendering; until the first read a date that needs it draws its full form. A moment you hand is kept as it is:
|
|
70
70
|
* hand a new one to move it. */
|
|
71
71
|
now?: Date;
|
|
72
|
+
/** Which of your own controls ViewKit's panels draw inside them (VK-1013): `true` for all five, or the names among `Button`,
|
|
73
|
+
* `Select`, `Menu`, `Popover` and `Input`. Each is handed the map's props and the part's `data-slot` and `data-key`. A
|
|
74
|
+
* control of `CONTROLS`' stays ViewKit's whatever this says. Absent, the panels draw ViewKit's own, as before. */
|
|
75
|
+
panelControls?: boolean | readonly PanelControlName[];
|
|
72
76
|
children: ReactNode;
|
|
73
77
|
};
|
|
74
|
-
export declare function ViewsProvider({ children, components, conventions, icons: ownIcons, ports, atoms, messages, presentation, desktopQuery, sheetActions, escape, oneValue, severalValues, selectionBar, datePicks, now, }: ViewsProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
78
|
+
export declare function ViewsProvider({ children, components, conventions, icons: ownIcons, ports, atoms, messages, presentation, desktopQuery, sheetActions, escape, oneValue, severalValues, selectionBar, datePicks, now, panelControls: opted, }: ViewsProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,6 +7,8 @@ import { carriedAtoms } from "../atoms/carried.js";
|
|
|
7
7
|
import { DEFAULT_VIEWS_ATOMS } from "../atoms/defaults.js";
|
|
8
8
|
import { ViewsContext } from "./context.js";
|
|
9
9
|
import { HasMomentContext, MomentContext } from "./moment.js";
|
|
10
|
+
import { PANEL_CONTROL_NAMES, } from "./components.js";
|
|
11
|
+
import { isOwnControl } from "./own-control.js";
|
|
10
12
|
import { PlainInput } from "./plain-input.js";
|
|
11
13
|
import { missingComponent } from "./missing-slot.js";
|
|
12
14
|
import { withSettledGroups } from "./menu-groups.js";
|
|
@@ -26,7 +28,7 @@ const MISSING_CALENDAR_COMPONENT = missingComponent("Calendar");
|
|
|
26
28
|
const NO_SUBSCRIBE = () => () => { };
|
|
27
29
|
const IN_BROWSER = () => true;
|
|
28
30
|
const ON_SERVER = () => false;
|
|
29
|
-
export function ViewsProvider({ children, components, conventions = DEFAULT_CONVENTIONS, icons: ownIcons, ports = NO_PORTS, atoms, messages = resolveViewsMessage, presentation, desktopQuery = DEFAULT_DESKTOP_QUERY, sheetActions = "bar", escape, oneValue, severalValues = "fit", selectionBar, datePicks, now, }) {
|
|
31
|
+
export function ViewsProvider({ children, components, conventions = DEFAULT_CONVENTIONS, icons: ownIcons, ports = NO_PORTS, atoms, messages = resolveViewsMessage, presentation, desktopQuery = DEFAULT_DESKTOP_QUERY, sheetActions = "bar", escape, oneValue, severalValues = "fit", selectionBar, datePicks, now, panelControls: opted, }) {
|
|
30
32
|
const [readNow, setReadNow] = useState(null);
|
|
31
33
|
const [lists] = useState(createListRegistry);
|
|
32
34
|
useEffect(() => {
|
|
@@ -57,6 +59,19 @@ export function ViewsProvider({ children, components, conventions = DEFAULT_CONV
|
|
|
57
59
|
Input: components.Input ?? PlainInput,
|
|
58
60
|
Calendar: components.Calendar ?? MISSING_CALENDAR_COMPONENT,
|
|
59
61
|
}), [components]);
|
|
62
|
+
const optedKey = opted === true ? "all" : opted ? opted.join(",") : "";
|
|
63
|
+
const panelControls = useMemo(() => {
|
|
64
|
+
const names = optedKey === "all" ? PANEL_CONTROL_NAMES : (optedKey ? optedKey.split(",") : []);
|
|
65
|
+
return new Set(PANEL_CONTROL_NAMES.filter((name) => names.includes(name) && components[name] != null && !isOwnControl(components[name])));
|
|
66
|
+
}, [optedKey, components]);
|
|
67
|
+
const strandedSelect = components.Select != null && !isOwnControl(components.Select) && !panelControls.has("Select");
|
|
68
|
+
const warnedSelect = useRef(false);
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
if (!strandedSelect || warnedSelect.current || process.env.NODE_ENV === "production")
|
|
71
|
+
return;
|
|
72
|
+
warnedSelect.current = true;
|
|
73
|
+
console.warn("ViewKit: components.Select is drawn only inside ViewKit's panels, and panelControls doesn't name \"Select\", so it is never drawn.");
|
|
74
|
+
}, [strandedSelect]);
|
|
60
75
|
const hosted = useRef({});
|
|
61
76
|
const mounted = useSyncExternalStore(NO_SUBSCRIBE, IN_BROWSER, ON_SERVER);
|
|
62
77
|
const onHostReady = useCallback((p) => {
|
|
@@ -94,6 +109,7 @@ export function ViewsProvider({ children, components, conventions = DEFAULT_CONV
|
|
|
94
109
|
severalValues,
|
|
95
110
|
selectionBar,
|
|
96
111
|
datePicks,
|
|
112
|
+
panelControls,
|
|
97
113
|
}), [
|
|
98
114
|
settled,
|
|
99
115
|
merged,
|
|
@@ -112,6 +128,7 @@ export function ViewsProvider({ children, components, conventions = DEFAULT_CONV
|
|
|
112
128
|
severalValues,
|
|
113
129
|
selectionBar,
|
|
114
130
|
datePicks,
|
|
131
|
+
panelControls,
|
|
115
132
|
]);
|
|
116
133
|
return (_jsx(ViewsContext.Provider, { value: value, children: _jsx(MomentContext.Provider, { value: moment, children: _jsx(HasMomentContext.Provider, { value: moment != null, children: _jsx(PhoneLine.Provider, { value: desktopQuery, children: _jsxs(ListRegistryContext.Provider, { value: lists, children: [children, host] }) }) }) }) }));
|
|
117
134
|
}
|