viewkitjs 0.28.0 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +107 -0
- package/MIGRATION.md +85 -4
- package/fields/dist/derived.d.ts +2 -1
- package/fields/dist/derived.js +9 -3
- package/fields/dist/entities.js +41 -3
- package/fields/dist/index.d.ts +1 -1
- package/fields/dist/index.js +1 -1
- package/fields/dist/messages.d.ts +8 -2
- package/fields/dist/messages.js +3 -0
- package/fields/dist/range.d.ts +6 -0
- package/fields/dist/range.js +8 -0
- package/fields/dist/registry.js +11 -1
- package/fields/dist/spec-changes.js +1 -0
- package/fields/dist/types.d.ts +23 -1
- package/fields/docs/guides/derived-fields.md +7 -5
- package/fields/docs/guides/field-types.md +2 -2
- package/fields/docs/guides/the-index.md +1 -1
- package/fields/docs/reference/fields.md +3 -1
- package/fields/docs/reference/types.md +3 -1
- package/fields/skills/viewkit/SKILL.md +1 -1
- package/package.json +2 -1
- package/postgres/dist/definitions/build.js +29 -5
- package/postgres/dist/definitions/label.d.ts +7 -0
- package/postgres/dist/definitions/label.js +9 -1
- package/postgres/dist/definitions/lookup.js +6 -2
- package/postgres/dist/definitions/place.d.ts +6 -3
- package/postgres/dist/definitions/rollup.js +5 -1
- package/postgres/dist/definitions/storage.d.ts +15 -0
- package/postgres/dist/definitions/storage.js +52 -1
- package/postgres/dist/definitions/stored.js +21 -0
- package/postgres/dist/phone.d.ts +13 -1
- package/postgres/dist/phone.js +23 -3
- package/postgres/dist/search-indexes.d.ts +6 -1
- package/postgres/dist/search-indexes.js +71 -25
- package/postgres/dist/search.js +3 -3
- package/postgres/docs/guides/definitions.md +22 -5
- package/postgres/docs/guides/field-map.md +5 -4
- package/postgres/docs/reference/definitions.md +3 -3
- package/postgres/docs/reference/postgres.md +1 -1
- package/views/dist/cells/cell-format.js +2 -2
- package/views/dist/cells/cell-values.js +9 -10
- package/views/dist/contract.d.ts +149 -3
- package/views/dist/contract.js +157 -1
- package/views/dist/controls/bulk-bar/bulk-bar-of.d.ts +66 -0
- package/views/dist/controls/bulk-bar/bulk-bar-of.js +22 -0
- package/views/dist/controls/bulk-bar/bulk-bar.d.ts +40 -0
- package/views/dist/controls/bulk-bar/bulk-bar.js +278 -0
- package/views/dist/controls/bulk-bar/looks.d.ts +10 -0
- package/views/dist/controls/bulk-bar/looks.js +14 -0
- package/views/dist/controls/bulk-bar/map-selection-bar.d.ts +19 -0
- package/views/dist/controls/bulk-bar/map-selection-bar.js +57 -0
- package/views/dist/controls/bulk-bar/tokens.d.ts +136 -0
- package/views/dist/controls/bulk-bar/tokens.js +36 -0
- package/views/dist/controls/bulk-bar/words.d.ts +50 -0
- package/views/dist/controls/bulk-bar/words.js +19 -0
- package/views/dist/controls/bulk-bar.css +96 -0
- package/views/dist/controls/button/button.js +3 -1
- package/views/dist/controls/button.css +5 -4
- package/views/dist/controls/checkbox/checkbox.js +3 -1
- package/views/dist/controls/checkbox.css +1 -1
- package/views/dist/controls/choice/tokens.d.ts +79 -0
- package/views/dist/controls/choice/tokens.js +22 -0
- package/views/dist/controls/choice.css +31 -0
- package/views/dist/controls/compound-editor/looks.js +1 -1
- package/views/dist/controls/controls.d.ts +10 -0
- package/views/dist/controls/controls.js +8 -0
- package/views/dist/controls/customize/customize.d.ts +125 -0
- package/views/dist/controls/customize/customize.js +243 -0
- package/views/dist/controls/customize/glide.d.ts +10 -0
- package/views/dist/controls/customize/glide.js +55 -0
- package/views/dist/controls/customize/looks.d.ts +13 -0
- package/views/dist/controls/customize/looks.js +11 -0
- package/views/dist/controls/customize/map-customize-body.d.ts +18 -0
- package/views/dist/controls/customize/map-customize-body.js +160 -0
- package/views/dist/controls/customize/rules.d.ts +23 -0
- package/views/dist/controls/customize/rules.js +19 -0
- package/views/dist/controls/customize/tokens.d.ts +40 -0
- package/views/dist/controls/customize/tokens.js +12 -0
- package/views/dist/controls/customize/words.d.ts +58 -0
- package/views/dist/controls/customize/words.js +37 -0
- package/views/dist/controls/customize.css +54 -0
- package/views/dist/controls/date-editor/looks.js +1 -1
- package/views/dist/controls/filter-editor/block.d.ts +31 -0
- package/views/dist/controls/filter-editor/block.js +27 -0
- package/views/dist/controls/filter-editor/filter-editor.d.ts +2 -0
- package/views/dist/controls/filter-editor/filter-editor.js +85 -43
- package/views/dist/controls/filter-editor/how.d.ts +1 -1
- package/views/dist/controls/filter-editor/how.js +1 -0
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +16 -1
- package/views/dist/controls/filter-editor/map-filter-body.js +39 -13
- package/views/dist/controls/filter-editor/map-rules.d.ts +27 -11
- package/views/dist/controls/filter-editor/map-rules.js +73 -42
- package/views/dist/controls/filter-editor/rules.d.ts +43 -5
- package/views/dist/controls/filter-editor/rules.js +55 -2
- package/views/dist/controls/filter-editor/words.d.ts +15 -0
- package/views/dist/controls/filter-editor/words.js +6 -0
- package/views/dist/controls/filter-editor.css +18 -0
- package/views/dist/controls/index.d.ts +26 -2
- package/views/dist/controls/index.js +25 -2
- package/views/dist/controls/inline-input/looks.js +1 -1
- package/views/dist/controls/input/input.js +10 -4
- package/views/dist/controls/internal/phone.d.ts +5 -4
- package/views/dist/controls/internal/phone.js +7 -7
- package/views/dist/controls/internal/scroll.js +5 -1
- package/views/dist/controls/internal/typed-run.d.ts +2 -0
- package/views/dist/controls/internal/typed-run.js +5 -0
- package/views/dist/controls/menu/map-menu.js +2 -2
- package/views/dist/controls/number-editor/looks.js +1 -1
- package/views/dist/controls/option/option.js +3 -1
- package/views/dist/controls/option.css +1 -1
- package/views/dist/controls/pane/pane.d.ts +4 -0
- package/views/dist/controls/pane/pane.js +2 -1
- package/views/dist/controls/picker/looks.js +1 -1
- package/views/dist/controls/picker/map-picker.d.ts +6 -2
- package/views/dist/controls/picker/map-picker.js +4 -2
- package/views/dist/controls/picker/picker.d.ts +7 -0
- package/views/dist/controls/picker/picker.js +57 -8
- package/views/dist/controls/popover/map-popover.d.ts +1 -1
- package/views/dist/controls/popover/map-popover.js +2 -2
- package/views/dist/controls/popover/popover.js +2 -1
- package/views/dist/controls/popover.css +3 -0
- package/views/dist/controls/ports-host/map-ports-host.d.ts +7 -0
- package/views/dist/controls/ports-host/map-ports-host.js +43 -0
- package/views/dist/controls/press/tokens.d.ts +8 -0
- package/views/dist/controls/press/tokens.js +4 -0
- package/views/dist/controls/press.css +44 -0
- package/views/dist/controls/quick-filters/looks.d.ts +11 -0
- package/views/dist/controls/quick-filters/looks.js +9 -0
- package/views/dist/controls/quick-filters/map-quick-filters-body.d.ts +31 -0
- package/views/dist/controls/quick-filters/map-quick-filters-body.js +56 -0
- package/views/dist/controls/quick-filters/quick-filters.d.ts +37 -0
- package/views/dist/controls/quick-filters/quick-filters.js +89 -0
- package/views/dist/controls/quick-filters/reminder.d.ts +18 -0
- package/views/dist/controls/quick-filters/reminder.js +41 -0
- package/views/dist/controls/quick-filters/rules.d.ts +89 -0
- package/views/dist/controls/quick-filters/rules.js +52 -0
- package/views/dist/controls/quick-filters/tokens.d.ts +112 -0
- package/views/dist/controls/quick-filters/tokens.js +30 -0
- package/views/dist/controls/quick-filters/words.d.ts +25 -0
- package/views/dist/controls/quick-filters/words.js +13 -0
- package/views/dist/controls/quick-filters.css +118 -0
- package/views/dist/controls/sheet/bottom-sheet.d.ts +9 -4
- package/views/dist/controls/sheet/bottom-sheet.js +4 -4
- package/views/dist/controls/sheet/map-sheet.d.ts +4 -1
- package/views/dist/controls/sheet/map-sheet.js +19 -6
- package/views/dist/controls/sheet/sheet-parts.d.ts +10 -0
- package/views/dist/controls/sheet/sheet-parts.js +2 -0
- package/views/dist/controls/switch-row/switch-row.d.ts +15 -0
- package/views/dist/controls/switch-row/switch-row.js +9 -0
- package/views/dist/controls/switch-row/tokens.d.ts +51 -0
- package/views/dist/controls/switch-row/tokens.js +15 -0
- package/views/dist/controls/switch-row.css +39 -0
- package/views/dist/controls/switch.css +1 -1
- package/views/dist/controls/tag/tag.js +3 -1
- package/views/dist/controls/tag-field/tag-field.d.ts +20 -0
- package/views/dist/controls/tag-field/tag-field.js +19 -0
- package/views/dist/controls/tag-field/tokens.d.ts +7 -0
- package/views/dist/controls/tag-field/tokens.js +4 -0
- package/views/dist/controls/tag-field.css +13 -0
- package/views/dist/controls/text-editor/looks.js +1 -1
- package/views/dist/controls/text-editor/text-editor.js +1 -5
- package/views/dist/controls/toast/toast.d.ts +5 -1
- package/views/dist/controls/toast/toast.js +5 -3
- package/views/dist/controls/tokens.js +18 -0
- package/views/dist/controls/toolbar/keys.d.ts +3 -0
- package/views/dist/controls/toolbar/keys.js +11 -0
- package/views/dist/controls/toolbar/looks.d.ts +10 -0
- package/views/dist/controls/toolbar/looks.js +40 -0
- package/views/dist/controls/toolbar/tokens.d.ts +28 -0
- package/views/dist/controls/toolbar/tokens.js +9 -0
- package/views/dist/controls/toolbar/toolbar.d.ts +111 -0
- package/views/dist/controls/toolbar/toolbar.js +370 -0
- package/views/dist/controls/toolbar/words.d.ts +28 -0
- package/views/dist/controls/toolbar/words.js +17 -0
- package/views/dist/controls/toolbar-button/looks.d.ts +4 -0
- package/views/dist/controls/toolbar-button/looks.js +21 -0
- package/views/dist/controls/toolbar-button/tokens.d.ts +103 -0
- package/views/dist/controls/toolbar-button/tokens.js +28 -0
- package/views/dist/controls/toolbar-button/toolbar-button.d.ts +66 -0
- package/views/dist/controls/toolbar-button/toolbar-button.js +51 -0
- package/views/dist/controls/toolbar-button.css +75 -0
- package/views/dist/controls/toolbar.css +65 -0
- package/views/dist/controls/tooltip/map-tooltip.d.ts +1 -1
- package/views/dist/controls/tooltip/map-tooltip.js +2 -2
- package/views/dist/controls/tooltip/tooltip.d.ts +3 -1
- package/views/dist/controls/tooltip/tooltip.js +2 -2
- package/views/dist/controls/values-editor/looks.js +1 -1
- package/views/dist/controls/views-list/map-views-list-body.d.ts +4 -1
- package/views/dist/controls/views-list/map-views-list-body.js +128 -4
- package/views/dist/controls/views-list/rules.d.ts +26 -0
- package/views/dist/controls/views-list/rules.js +63 -0
- package/views/dist/controls/views-list/view-menu.d.ts +84 -0
- package/views/dist/controls/views-list/view-menu.js +201 -0
- package/views/dist/controls/views-list/views-list.d.ts +8 -1
- package/views/dist/controls/views-list/views-list.js +18 -3
- package/views/dist/controls/views-list/words.d.ts +54 -0
- package/views/dist/controls/views-list/words.js +10 -1
- package/views/dist/controls/views-list.css +5 -1
- package/views/dist/display/date.js +3 -3
- package/views/dist/display/format.d.ts +6 -0
- package/views/dist/display/format.js +3 -0
- package/views/dist/display/index.d.ts +1 -1
- package/views/dist/display/index.js +1 -1
- package/views/dist/display/range.d.ts +2 -1
- package/views/dist/display/range.js +4 -1
- package/views/dist/grid/chrome/GridHeader.js +2 -1
- package/views/dist/grid/chrome/GridNumberEditor.js +2 -2
- package/views/dist/grid/chrome/GridRowCells.js +2 -1
- package/views/dist/grid/chrome/GridTextEditor.js +2 -2
- package/views/dist/grid/chrome/grid-editor-layer.d.ts +5 -1
- package/views/dist/grid/chrome/grid-editor-layer.js +1 -0
- package/views/dist/grid/chrome/grid-fitted-box.d.ts +7 -1
- package/views/dist/grid/chrome/grid-fitted-box.js +4 -4
- package/views/dist/grid/core/clipboard-model.js +9 -4
- package/views/dist/grid/grid.css +240 -0
- package/views/dist/grid/looks.d.ts +5 -1
- package/views/dist/grid/looks.js +20 -12
- package/views/dist/grid-tokens.d.ts +109 -0
- package/views/dist/grid-tokens.js +29 -0
- package/views/dist/looks/index.d.ts +5 -0
- package/views/dist/looks/index.js +5 -0
- package/views/dist/looks/pieces.js +10 -0
- package/views/dist/model/column-capabilities.d.ts +2 -0
- package/views/dist/model/column-filters.d.ts +2 -1
- package/views/dist/model/column-from.js +2 -2
- package/views/dist/model/relation-filters.d.ts +2 -0
- package/views/dist/panels/index.d.ts +2 -2
- package/views/dist/panels/index.js +2 -2
- package/views/dist/panels/labels.d.ts +4 -0
- package/views/dist/panels/labels.js +8 -0
- package/views/dist/panels/model.d.ts +10 -2
- package/views/dist/panels/quick/model.d.ts +4 -0
- package/views/dist/panels/react/customize-body.d.ts +9 -4
- package/views/dist/panels/react/customize-body.js +39 -11
- package/views/dist/panels/react/customize.d.ts +8 -1
- package/views/dist/panels/react/customize.js +9 -6
- package/views/dist/panels/react/filter/FilterEditor.js +4 -4
- package/views/dist/panels/react/filter/FilterFieldList.js +10 -2
- package/views/dist/panels/react/filter/PhoneFilterEditor.js +3 -3
- package/views/dist/panels/react/filter/filter-body.js +5 -2
- package/views/dist/panels/react/panel-step.d.ts +3 -0
- package/views/dist/panels/react/panel-step.js +2 -1
- package/views/dist/panels/react/quick/QuickFiltersPanel.js +1 -0
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +13 -3
- package/views/dist/panels/react/toolbar/ReadyToolbar.js +10 -3
- package/views/dist/panels/react/toolbar/Toolbar.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarAsideFilter.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +13 -3
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +2 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +3 -3
- package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +12 -4
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +6 -2
- package/views/dist/panels/react/view-footer.d.ts +1 -1
- package/views/dist/panels/react/views-row/ViewPicker.js +25 -4
- package/views/dist/panels/settings/filter-groups.d.ts +3 -0
- package/views/dist/panels/settings/filter-groups.js +40 -9
- package/views/dist/panels/settings/filters.d.ts +5 -0
- package/views/dist/panels/settings/filters.js +12 -6
- package/views/dist/panels/views-row/model.d.ts +10 -1
- package/views/dist/provider/ViewsProvider.js +29 -5
- package/views/dist/provider/components.d.ts +149 -8
- package/views/dist/provider/context.d.ts +6 -0
- package/views/dist/provider/ports.d.ts +18 -6
- package/views/dist/provider/ports.js +2 -1
- package/views/dist/react.d.ts +2 -2
- package/views/dist/react.js +1 -1
- package/views/dist/selection/SelectionBar.d.ts +2 -16
- package/views/dist/selection/SelectionBar.js +4 -1
- package/views/dist/selection/bar-props.d.ts +26 -0
- package/views/dist/selection/bar-props.js +1 -0
- package/views/dist/selection/index.d.ts +1 -1
- package/views/dist/selection/verbs.d.ts +32 -5
- package/views/dist/styles.css +656 -25
- package/views/dist/styles.unlayered.css +653 -22
- package/views/docs/contract.md +44 -17
- package/views/docs/controls/bulk-bar.md +41 -0
- package/views/docs/controls/choice.md +25 -0
- package/views/docs/controls/customize.md +17 -0
- package/views/docs/controls/popover.md +2 -0
- package/views/docs/controls/press.md +9 -0
- package/views/docs/controls/quick-filters.md +35 -0
- package/views/docs/controls/radio.md +1 -1
- package/views/docs/controls/switch-row.md +18 -0
- package/views/docs/controls/tag-field.md +7 -0
- package/views/docs/controls/toolbar-button.md +31 -0
- package/views/docs/controls/toolbar.md +14 -0
- package/views/docs/guides/atoms.md +2 -2
- package/views/docs/guides/cells.md +2 -2
- package/views/docs/guides/display.md +2 -2
- package/views/docs/guides/looks.md +8 -2
- package/views/docs/guides/ports.md +6 -6
- package/views/docs/guides/selection.md +5 -1
- package/views/docs/guides/the-grid.md +1 -1
- package/views/docs/guides/the-provider.md +2 -2
- package/views/docs/install.md +4 -1
- package/views/docs/reference/cells.md +1 -1
- package/views/docs/reference/controls.md +194 -13
- package/views/docs/reference/display.md +1 -0
- package/views/docs/reference/looks.md +25 -11
- package/views/docs/reference/panels-react.md +7 -7
- package/views/docs/reference/panels.md +8 -6
- package/views/docs/reference/react.md +13 -6
- package/views/docs/reference/selection.md +4 -2
- package/views/docs/reference/views.md +7 -6
- package/views/skills/views/SKILL.md +2 -2
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useRef } from "react";
|
|
4
4
|
import { useViews } from "../../../provider/context.js";
|
|
5
|
+
import { listedFieldsOf } from "../../settings/filter-groups.js";
|
|
5
6
|
import { FilterFieldList } from "../filter/FilterFieldList.js";
|
|
6
7
|
import { useSheetPanels } from "../panel-sheet.js";
|
|
7
8
|
import { useFoldAnchor, useToolbarPanel } from "./context.js";
|
|
@@ -27,7 +28,7 @@ export function ToolbarFilterAdd({ filterTree, onHeldChange, open, onOpenChange,
|
|
|
27
28
|
fields.onOpenChange(false);
|
|
28
29
|
onPick(picked, far);
|
|
29
30
|
};
|
|
30
|
-
const list = (_jsx(FilterFieldList, { fields: filterTree
|
|
31
|
+
const list = (_jsx(FilterFieldList, { fields: listedFieldsOf(filterTree), relations: true, onPick: pick, onDone: () => {
|
|
31
32
|
fields.onOpenChange(false);
|
|
32
33
|
hangsAt.anchor.current?.focus({ preventScroll: true });
|
|
33
34
|
} }));
|
|
@@ -4,7 +4,7 @@ import { useLayoutEffect, useRef, useState } from "react";
|
|
|
4
4
|
import { isRelationRule, } from "viewkitjs/fields/query";
|
|
5
5
|
import { barItemsOf, followBarKeys, } from "../../../filters/filter-tree.js";
|
|
6
6
|
import { useViews } from "../../../provider/context.js";
|
|
7
|
-
import { takesValue } from "../../settings/filter-groups.js";
|
|
7
|
+
import { listedFieldsOf, takesValue } from "../../settings/filter-groups.js";
|
|
8
8
|
import { asideFilterWords, barFilterWords } from "../../toolbar/filter-words.js";
|
|
9
9
|
import { fieldOfRule, heldStands, relationOf, samePath, useEditorCtx, } from "../filter/editor-ctx.js";
|
|
10
10
|
import { FilterFieldList } from "../filter/FilterFieldList.js";
|
|
@@ -281,7 +281,7 @@ export function ToolbarFilters({ filterTree, open: openIn, onOpenChange: onOpenC
|
|
|
281
281
|
const why = details?.reason;
|
|
282
282
|
if (!next && why !== "outside-press" && why !== "focus-out")
|
|
283
283
|
hangsAt.anchor.current?.focus({ preventScroll: true });
|
|
284
|
-
}, anchor: hangsAt.anchor, align: "start", sideOffset: 8, chrome: "menu", panelData: { "data-slot": "vk-toolbar-filters-panel" }, children: _jsx(FilterFieldList, { fields: filterTree
|
|
284
|
+
}, anchor: hangsAt.anchor, align: "start", sideOffset: 8, chrome: "menu", panelData: { "data-slot": "vk-toolbar-filters-panel" }, children: _jsx(FilterFieldList, { fields: listedFieldsOf(filterTree), relations: true, onPick: onPick, onDone: () => {
|
|
285
285
|
fields.onOpenChange(false);
|
|
286
286
|
hangsAt.anchor.current?.focus({ preventScroll: true });
|
|
287
287
|
} }) }))] }, "add"));
|
|
@@ -292,5 +292,5 @@ export function ToolbarFilters({ filterTree, open: openIn, onOpenChange: onOpenC
|
|
|
292
292
|
pending && !pending.replaces ? heldFilter() : null,
|
|
293
293
|
add,
|
|
294
294
|
];
|
|
295
|
-
return (_jsxs("span", { "data-slot": "vk-toolbar-filters", className: "inline-flex min-w-0 items-center gap-2", children: [line, HostPanel && (_jsx(HostPanel, { open: fields.open, onOpenChange: fields.onOpenChange, title: empty ? name : addLabel, children: _jsx(FilterFieldList, { fields: filterTree
|
|
295
|
+
return (_jsxs("span", { "data-slot": "vk-toolbar-filters", className: "inline-flex min-w-0 items-center gap-2", children: [line, HostPanel && (_jsx(HostPanel, { open: fields.open, onOpenChange: fields.onOpenChange, title: empty ? name : addLabel, children: _jsx(FilterFieldList, { fields: listedFieldsOf(filterTree), relations: true, onPick: onPick, onDone: () => fields.onOpenChange(false) }) }))] }));
|
|
296
296
|
}
|
|
@@ -3,10 +3,10 @@ import { type ActivePanel, type ViewOptionInputs } from "../../model.js";
|
|
|
3
3
|
import type { CollectionViewState } from "../../view-state.js";
|
|
4
4
|
import type { PanelFieldEditor } from "../field-editor.js";
|
|
5
5
|
import { type ToolbarPanelHost } from "./panel-part.js";
|
|
6
|
-
export declare function ToolbarOptions({ view, viewFoot, footClear, fieldEditor, foldFilters, onClear, open, onOpenChange, page: pageIn, onPageChange, host, widthClassName, ...inputs }: ViewOptionInputs & {
|
|
7
|
-
/** The shared view this list shows: the drift dot, and the panel's footer (Reset,
|
|
6
|
+
export declare function ToolbarOptions({ view, viewFoot, footClear, fieldEditor, foldFilters, onClear, open, onOpenChange, page: pageIn, onPageChange, host, widthClassName, viewName, onRenameView, onCopyLink, onExport, exportCount, ...inputs }: ViewOptionInputs & {
|
|
7
|
+
/** The shared view this list shows: the drift dot, and the panel's footer (Reset, Save for everyone). */
|
|
8
8
|
view?: CollectionViewState;
|
|
9
|
-
/** Customize's foot: `kit` for Clear and Save, `none` for none; absent, Reset and
|
|
9
|
+
/** Customize's foot: `kit` for Clear and Save, `none` for none; absent, Reset and Save for everyone. */
|
|
10
10
|
viewFoot?: "kit" | "none";
|
|
11
11
|
/** With no shared view, the foot's Clear (the list back to its default); absent, no foot. */
|
|
12
12
|
footClear?: () => void;
|
|
@@ -24,6 +24,14 @@ export declare function ToolbarOptions({ view, viewFoot, footClear, fieldEditor,
|
|
|
24
24
|
page?: ActivePanel;
|
|
25
25
|
onPageChange?: (page: ActivePanel) => void;
|
|
26
26
|
host?: ToolbarPanelHost;
|
|
27
|
-
/** The popover's width class. Default `w-
|
|
27
|
+
/** The popover's width class. Default `w-75`: 300 px, the Pane Customize was designed in. */
|
|
28
28
|
widthClassName?: string;
|
|
29
|
+
/** The view's name, drawn in Customize's head and renamed in place where `onRenameView` is handed too. */
|
|
30
|
+
viewName?: string;
|
|
31
|
+
onRenameView?: (name: string) => void;
|
|
32
|
+
/** Copy link to view, in Customize's foot, where handed. */
|
|
33
|
+
onCopyLink?: () => void;
|
|
34
|
+
/** Export CSV, in Customize's foot, where handed, with what it takes in words (`exportCount`, "12 deals"). */
|
|
35
|
+
onExport?: () => void;
|
|
36
|
+
exportCount?: string;
|
|
29
37
|
}): ReactNode;
|
|
@@ -6,12 +6,14 @@ import { getViewOptionAvailability } from "../../availability.js";
|
|
|
6
6
|
import { clearViewOptions, countActiveViewOptions, } from "../../model.js";
|
|
7
7
|
import { ViewOptionsPanelContent } from "../customize.js";
|
|
8
8
|
import { viewOptionsPopoverClassName } from "../popover.js";
|
|
9
|
+
import { PanelStepHold, usePanelStep } from "../panel-step.js";
|
|
9
10
|
import { ToolbarPanelPart } from "./panel-part.js";
|
|
10
|
-
export function ToolbarOptions({ view, viewFoot, footClear, fieldEditor, foldFilters = true, onClear, open, onOpenChange, page: pageIn, onPageChange, host, widthClassName, ...inputs }) {
|
|
11
|
+
export function ToolbarOptions({ view, viewFoot, footClear, fieldEditor, foldFilters = true, onClear, open, onOpenChange, page: pageIn, onPageChange, host, widthClassName, viewName, onRenameView, onCopyLink, onExport, exportCount, ...inputs }) {
|
|
11
12
|
const { icons, messages } = useViews();
|
|
12
13
|
const Glyph = icons.options;
|
|
13
14
|
const [ownOpen, setOwnOpen] = useState(false);
|
|
14
15
|
const [ownPage, setOwnPage] = useState(null);
|
|
16
|
+
const step = usePanelStep();
|
|
15
17
|
const holdsOpen = open !== undefined && !!onOpenChange;
|
|
16
18
|
const holdsPage = pageIn !== undefined && !!onPageChange;
|
|
17
19
|
const page = holdsPage ? pageIn : ownPage;
|
|
@@ -29,5 +31,7 @@ export function ToolbarOptions({ view, viewFoot, footClear, fieldEditor, foldFil
|
|
|
29
31
|
else
|
|
30
32
|
setOwnOpen(next);
|
|
31
33
|
};
|
|
32
|
-
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:
|
|
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
|
|
35
|
+
? viewOptionsPopoverClassName(page, widthClassName)
|
|
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 }) }) })) }));
|
|
33
37
|
}
|
|
@@ -14,7 +14,7 @@ export declare function ViewFooter({ view, onClear, words, className, }: {
|
|
|
14
14
|
view?: CollectionViewState;
|
|
15
15
|
/** With no shared view: Clear alone, which this takes the list back with. */
|
|
16
16
|
onClear?: () => void;
|
|
17
|
-
/** `kit`: Clear and Save, the toolbar's words for them, in place of Reset and
|
|
17
|
+
/** `kit`: Clear and Save, the toolbar's words for them, in place of Reset and Save for everyone. */
|
|
18
18
|
words?: "kit";
|
|
19
19
|
className?: string;
|
|
20
20
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useMemo, useRef, useState } from "react";
|
|
3
|
+
import { useCallback, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { cx } from "../../../internal/cx.js";
|
|
5
5
|
import { useViews } from "../../../provider/context.js";
|
|
6
6
|
import { formatCount } from "../../../internal/count.js";
|
|
@@ -8,6 +8,7 @@ import { VIEWS_LIST_CLASS, VIEWS_LIST_LABEL_CLASS, VIEWS_LIST_SEPARATOR_CLASS }
|
|
|
8
8
|
import { viewsListOrderFits, viewsListPickFits, } from "../../views-row/model.js";
|
|
9
9
|
import { PanelButton } from "../../panel-button.js";
|
|
10
10
|
import { PanelSheet, useSheetDrawsClose, useSheetPanels } from "../panel-sheet.js";
|
|
11
|
+
import { usePanelStep } from "../panel-step.js";
|
|
11
12
|
import { useAnchoredToggle } from "./use-anchored-toggle.js";
|
|
12
13
|
import { ToolbarButton } from "../toolbar/ToolbarButton.js";
|
|
13
14
|
import { useViewsRowInFrame } from "./in-frame.js";
|
|
@@ -26,6 +27,11 @@ export function ViewPicker({ axis, className }) {
|
|
|
26
27
|
const sheet = useSheetPanels();
|
|
27
28
|
const sheetDrawsClose = useSheetDrawsClose();
|
|
28
29
|
const [query, setQuery] = useState("");
|
|
30
|
+
const step = usePanelStep();
|
|
31
|
+
const holding = useRef(false);
|
|
32
|
+
const onHold = useCallback((on) => {
|
|
33
|
+
holding.current = on;
|
|
34
|
+
}, []);
|
|
29
35
|
const active = axis.options.find((option) => option.value === axis.value);
|
|
30
36
|
const { shared, personal } = useMemo(() => {
|
|
31
37
|
const q = query.trim().toLowerCase();
|
|
@@ -62,7 +68,10 @@ export function ViewPicker({ axis, className }) {
|
|
|
62
68
|
...(!axis.hideCounts && typeof option.count === "number" && { count: option.count }),
|
|
63
69
|
...(option.private !== undefined && { private: option.private }),
|
|
64
70
|
...(option.menu !== undefined && { menu: option.menu }),
|
|
65
|
-
|
|
71
|
+
...(option.layout !== undefined && { layout: option.layout }),
|
|
72
|
+
...(option.changed !== undefined && { changed: option.changed }),
|
|
73
|
+
...(option.favorite !== undefined && { favorite: option.favorite }),
|
|
74
|
+
})), ...(axis.verbs && { verbs: axis.verbs }), ...(sheet ? { onStepChange: step.onStepChange } : { onHold }), value: axis.value, form: sheet ? "phone" : "computer", onViewChange: (value) => {
|
|
66
75
|
if (viewsListPickFits(axis.options, value))
|
|
67
76
|
axis.onChange(value);
|
|
68
77
|
}, ...(onCreate && {
|
|
@@ -77,7 +86,13 @@ export function ViewPicker({ axis, className }) {
|
|
|
77
86
|
onReorder(orderedIds);
|
|
78
87
|
},
|
|
79
88
|
...(axis.canDrag && { canDrag: axis.canDrag }),
|
|
80
|
-
}), onDone: close, ...(sheet &&
|
|
89
|
+
}), onDone: close, ...(sheet &&
|
|
90
|
+
!sheetDrawsClose && {
|
|
91
|
+
actions: {
|
|
92
|
+
close: { label: messages({ key: "views.panels.close" }), onPress: close },
|
|
93
|
+
...(step.back && { back: { label: messages({ key: "views.panels.back" }), onPress: step.back } }),
|
|
94
|
+
},
|
|
95
|
+
}) })) : (_jsxs(_Fragment, { children: [axis.options.length >= SEARCH_FROM && (_jsx("div", { className: "px-1.5 pt-1.5", children: _jsx(atoms.PanelSearch, { value: query, onChange: setQuery, placeholder: messages({ key: "views.panels.views-search" }), autoFocus: !sheet }) })), _jsxs("div", { role: "listbox", "aria-label": messages({ key: "views.panels.views-list" }), className: VIEWS_LIST_CLASS, children: [shared.length > 0 && personal.length > 0 && (_jsx("div", { className: VIEWS_LIST_LABEL_CLASS, children: messages({ key: "views.panels.views-shared" }) })), rows(shared), personal.length > 0 && (_jsxs(_Fragment, { children: [shared.length > 0 && (_jsx("div", { className: VIEWS_LIST_LABEL_CLASS, children: messages({ key: "views.panels.views-personal" }) })), rows(personal)] })), shared.length + personal.length === 0 && (_jsx("div", { className: "px-2 py-3 text-sm text-(color:--vk-fg-subtle)", children: messages({ key: "views.panels.views-none" }) })), axis.onCreate && (_jsxs(_Fragment, { children: [_jsx("div", { className: VIEWS_LIST_SEPARATOR_CLASS }), _jsx(atoms.ChoiceRow, { label: messages({
|
|
81
96
|
key: "views.panels.view-create-row",
|
|
82
97
|
values: { label: axis.createLabel ?? messages({ key: "views.panels.view-create" }) },
|
|
83
98
|
}), leading: _jsx(Add, { className: "h-4 w-4 shrink-0 text-(color:--vk-fg-subtle)" }), onClick: () => {
|
|
@@ -108,5 +123,11 @@ export function ViewPicker({ axis, className }) {
|
|
|
108
123
|
toggle.setOpen(next);
|
|
109
124
|
if (!next)
|
|
110
125
|
setQuery("");
|
|
111
|
-
}, title: messages({ key: "views.panels.views-list" }), snap: "auto",
|
|
126
|
+
}, title: messages({ key: "views.panels.views-list" }), snap: "auto", ...(step.title !== undefined && { sheetTitle: step.title || listLabel, headed: !sheetDrawsClose }), ...(step.back &&
|
|
127
|
+
sheetDrawsClose && {
|
|
128
|
+
actions: {
|
|
129
|
+
close: { label: messages({ key: "views.panels.close" }), onPress: () => toggle.setOpen(false) },
|
|
130
|
+
back: { label: messages({ key: "views.panels.back" }), onPress: step.back },
|
|
131
|
+
},
|
|
132
|
+
}), onSheetEscape: step.escapeBack, children: list })) : (_jsx(Popover, { open: toggle.open, onOpenChange: onOpenChange, anchor: anchor, align: "start", sideOffset: 6, chrome: "menu", className: "w-72", onOutsidePress: () => (holding.current ? false : undefined), onEscape: () => (holding.current ? false : undefined), children: list }))] }));
|
|
112
133
|
}
|
|
@@ -34,6 +34,9 @@ export declare function takesValue(operator: FilterOperator): boolean;
|
|
|
34
34
|
/** The fields a rule can name: the Filter panel's own rows that open (columns, and the parts a place keeps), in the
|
|
35
35
|
* person's column order; then each relation the list filters across, its usable far fields one level in. */
|
|
36
36
|
export declare function filterEditorFields<Row>(input: SettingsPanelsInput<Row>): FilterEditorField[];
|
|
37
|
+
/** What a field list shows (`FilterTreeConfig.listed`): `fields`, and in their places the columns the list can't filter,
|
|
38
|
+
* greyed with their reason (VK-880). Absent `listed`, a tree's `fields`. */
|
|
39
|
+
export declare function listedFieldsOf(tree: Pick<FilterTreeConfig, "fields" | "listed">): readonly FilterEditorField[];
|
|
37
40
|
/** The builder's filter tree (VK-531): the tree, its fields, its writer, and each rule's value as its body edits it.
|
|
38
41
|
* `write` is the build's shared writer (`filterWriter`), so the editor's writes and the Filter rows' add up. */
|
|
39
42
|
export declare function settingsFilterTree<Row>(input: SettingsPanelsInput<Row>, write: (tree: FilterTree) => void): FilterTreeConfig;
|
|
@@ -7,6 +7,7 @@ import { columnMark } from "../../model/column-mark.js";
|
|
|
7
7
|
import { farPathOf, farWhereInputs, relationFilterKey } from "../../model/relation-filters.js";
|
|
8
8
|
import { columnStateOf } from "../../model/settings-columns.js";
|
|
9
9
|
import { fieldKeyOf, fromListFilterRule, toListFilterRule } from "../../model/view-rules.js";
|
|
10
|
+
import { viewFilterCapabilities } from "./filters.js";
|
|
10
11
|
const TEXT_TYPES = new Set([
|
|
11
12
|
"text",
|
|
12
13
|
"url",
|
|
@@ -108,22 +109,50 @@ function markOf(column) {
|
|
|
108
109
|
const mark = columnMark(column);
|
|
109
110
|
return mark ? { mark } : {};
|
|
110
111
|
}
|
|
112
|
+
function spokenOf(input) {
|
|
113
|
+
const messages = input.filterData?.messages ?? input.resolve;
|
|
114
|
+
const conventions = input.filterData?.conventions ?? input.conventions;
|
|
115
|
+
return { ...(messages ? { messages } : {}), ...(conventions ? { conventions } : {}) };
|
|
116
|
+
}
|
|
111
117
|
export function filterEditorFields(input) {
|
|
118
|
+
return editorFields(input).filter((field) => field.disabled === undefined);
|
|
119
|
+
}
|
|
120
|
+
export function listedFieldsOf(tree) {
|
|
121
|
+
return tree.listed ?? tree.fields;
|
|
122
|
+
}
|
|
123
|
+
function editorFields(input) {
|
|
112
124
|
const { columns, settings, filterData, relationFilters } = input;
|
|
125
|
+
const spoken = spokenOf(input);
|
|
113
126
|
const whole = columns.filter((column) => !column.partOf);
|
|
114
127
|
const rows = buildColumnFilters({
|
|
115
128
|
...filterData,
|
|
129
|
+
...spoken,
|
|
116
130
|
declared: [],
|
|
117
131
|
columns: whole,
|
|
118
132
|
order: columnStateOf(settings, input.layer, columns).order,
|
|
119
133
|
rules: {},
|
|
134
|
+
capabilities: viewFilterCapabilities(input),
|
|
120
135
|
});
|
|
136
|
+
const notOffered = (spoken.messages ?? resolveViewsMessage)({ key: "views.panels.filter-not-offered" });
|
|
121
137
|
const own = rows.flatMap((row) => {
|
|
122
|
-
|
|
123
|
-
return [];
|
|
138
|
+
const reason = row.editor === "unavailable" ? row.reason : row.disabled ? (row.disabledReason ?? notOffered) : null;
|
|
124
139
|
const direct = whole.find((column) => column.id === row.key);
|
|
125
140
|
const { id, part } = direct ? { id: row.key, part: undefined } : parsePartKey(row.key);
|
|
126
141
|
const column = direct ?? whole.find((candidate) => candidate.id === id);
|
|
142
|
+
if (reason !== null) {
|
|
143
|
+
if (!column)
|
|
144
|
+
return [];
|
|
145
|
+
return [
|
|
146
|
+
{
|
|
147
|
+
key: row.key,
|
|
148
|
+
label: row.label,
|
|
149
|
+
fieldKey: fieldKeyOf(column),
|
|
150
|
+
type: column.field ? valueTypeOf(column.field) : "text",
|
|
151
|
+
...markOf(column),
|
|
152
|
+
disabled: reason,
|
|
153
|
+
},
|
|
154
|
+
];
|
|
155
|
+
}
|
|
127
156
|
if (!column?.field)
|
|
128
157
|
return [];
|
|
129
158
|
return [
|
|
@@ -174,9 +203,8 @@ function ruleFromBody(type, rule, next) {
|
|
|
174
203
|
}
|
|
175
204
|
export function settingsFilterTree(input, write) {
|
|
176
205
|
const { columns, filterData, relationFilters } = input;
|
|
177
|
-
const
|
|
178
|
-
const
|
|
179
|
-
const spoken = { ...(messages ? { messages } : {}), ...(conventions ? { conventions } : {}) };
|
|
206
|
+
const spoken = spokenOf(input);
|
|
207
|
+
const messages = spoken.messages;
|
|
180
208
|
const whole = columns.filter((column) => !column.partOf);
|
|
181
209
|
const valueOf = (rule, writeRule, relation) => {
|
|
182
210
|
if (rule.setAside || !takesValue(rule.operator))
|
|
@@ -235,15 +263,16 @@ export function settingsFilterTree(input, write) {
|
|
|
235
263
|
? farWhereInputs(relation, target, relationFilters?.farValues).columns.find((c) => c.id === fieldKey)
|
|
236
264
|
: whole.find((c) => fieldKeyOf(c) === fieldKey);
|
|
237
265
|
const type = column?.field ? valueTypeOf(column.field) : undefined;
|
|
238
|
-
|
|
266
|
+
const country = relation === undefined && type === "location" && part === "countryCode";
|
|
267
|
+
if (!column || !type || (part !== undefined && !country) || (!country && !CHOICE_TYPES.has(type)))
|
|
239
268
|
return undefined;
|
|
240
|
-
const config = valueOf({ fieldKey, operator: "is_any_of", value: [] }, () => { }, relation);
|
|
269
|
+
const config = valueOf({ fieldKey, ...(country ? { part } : {}), operator: "is_any_of", value: [] }, () => { }, relation);
|
|
241
270
|
if (!config || config.editor !== undefined || !("options" in config))
|
|
242
271
|
return undefined;
|
|
243
272
|
const declared = column.field.options ?? [];
|
|
244
273
|
const held = relation !== undefined
|
|
245
274
|
? relationFilters?.farValues?.values[farPathOf(relation, fieldKey)] !== undefined || declared.length > 0
|
|
246
|
-
: filterData?.knownValues?.[column.id] !== undefined;
|
|
275
|
+
: filterData?.knownValues?.[country ? partKey(column.id, "countryCode") : column.id] !== undefined;
|
|
247
276
|
if (config.onOpen && !held)
|
|
248
277
|
return undefined;
|
|
249
278
|
const kind = column.field.relation?.kind;
|
|
@@ -260,9 +289,11 @@ export function settingsFilterTree(input, write) {
|
|
|
260
289
|
};
|
|
261
290
|
});
|
|
262
291
|
};
|
|
292
|
+
const listed = editorFields(input);
|
|
263
293
|
return {
|
|
264
294
|
tree: input.settings.filter,
|
|
265
|
-
fields:
|
|
295
|
+
fields: listed.filter((field) => field.disabled === undefined),
|
|
296
|
+
listed,
|
|
266
297
|
...(input.goneFields ? { gone: input.goneFields } : {}),
|
|
267
298
|
onChange: write,
|
|
268
299
|
valueOf,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type FilterTree } from "viewkitjs/fields/query";
|
|
2
2
|
import { type FilterConfig } from "../../filters/filter-model.js";
|
|
3
|
+
import type { ListFilterCapabilities } from "../../model/filter-capabilities.js";
|
|
3
4
|
import type { SettingsPanelsInput } from "./input.js";
|
|
4
5
|
/** One draft of a list's filter tree that every write of one burst adds up on: the Filter rows' and the filter
|
|
5
6
|
* editor's alike (VK-416, VK-531). */
|
|
@@ -14,6 +15,10 @@ export type FilterWriter = {
|
|
|
14
15
|
* it ends, a later write starts again from the settings, so a write the app refused or hasn't applied yet never rides
|
|
15
16
|
* in the next one. */
|
|
16
17
|
export declare function filterWriter<Row>(input: SettingsPanelsInput<Row>): FilterWriter;
|
|
18
|
+
/** What the list's columns can be filtered by, as a saved list sees them: the app's own capabilities, and a column with no
|
|
19
|
+
* field unavailable, since a saved list keeps only what it can name. The Filter rows and the filter editor's fields read
|
|
20
|
+
* the same (VK-880). */
|
|
21
|
+
export declare function viewFilterCapabilities<Row>(input: Pick<SettingsPanelsInput<Row>, "columns" | "filterData" | "resolve">): ListFilterCapabilities;
|
|
17
22
|
/** The Filter panel's rows: one per column (a column with no field shown as one a view can't filter on), then one
|
|
18
23
|
* per relation the list filters across. `writer`: the build's shared draft, so the rows' writes and the filter
|
|
19
24
|
* editor's add up; absent, the rows keep their own. */
|
|
@@ -2,7 +2,7 @@ import { isRelationRule, parsePartKey, settingsChange, } from "viewkitjs/fields/
|
|
|
2
2
|
import { resolveViewsMessage as defaultWords } from "../../contract.js";
|
|
3
3
|
import { isFilterActive } from "../../filters/filter-model.js";
|
|
4
4
|
import { canGroupAt, groupAt, orLevelWrapped, settled } from "../../filters/filter-tree.js";
|
|
5
|
-
import { columnManagedByView
|
|
5
|
+
import { columnManagedByView } from "../../model/column-capabilities.js";
|
|
6
6
|
import { setRelationRule } from "../../filters/relation-filter.js";
|
|
7
7
|
import { buildColumnFilters } from "../../model/column-filters.js";
|
|
8
8
|
import { buildRelationFilters, relationFilterKey } from "../../model/relation-filters.js";
|
|
@@ -38,6 +38,16 @@ function rootRelationIndexes(tree) {
|
|
|
38
38
|
});
|
|
39
39
|
return out;
|
|
40
40
|
}
|
|
41
|
+
export function viewFilterCapabilities(input) {
|
|
42
|
+
const capabilities = { ...input.filterData?.capabilities };
|
|
43
|
+
const word = input.filterData?.messages ?? input.resolve ?? defaultWords;
|
|
44
|
+
let reason;
|
|
45
|
+
for (const column of input.columns) {
|
|
46
|
+
if (!column.partOf && !columnManagedByView(column) && !capabilities[column.id])
|
|
47
|
+
capabilities[column.id] = { mode: "unavailable", reason: (reason ??= word({ key: "views.panels.filter-fieldless" })) };
|
|
48
|
+
}
|
|
49
|
+
return capabilities;
|
|
50
|
+
}
|
|
41
51
|
export function settingsFilters(input, writer) {
|
|
42
52
|
const { settings, columns, filterData, relationFilters } = input;
|
|
43
53
|
const groups = !!input.filterGroups;
|
|
@@ -51,12 +61,8 @@ export function settingsFilters(input, writer) {
|
|
|
51
61
|
const now = draft();
|
|
52
62
|
return groups ? (orLevelWrapped(now) ?? now) : now;
|
|
53
63
|
};
|
|
54
|
-
const capabilities =
|
|
64
|
+
const capabilities = viewFilterCapabilities(input);
|
|
55
65
|
const whole = columns.filter((column) => !column.partOf);
|
|
56
|
-
for (const column of whole) {
|
|
57
|
-
if (!columnManagedByView(column) && !capabilities[column.id])
|
|
58
|
-
capabilities[column.id] = { mode: "unavailable", reason: VIEW_FIELDLESS_FILTER_REASON };
|
|
59
|
-
}
|
|
60
66
|
const onRuleChange = (rowKey, rule) => {
|
|
61
67
|
const direct = columns.find((column) => column.id === rowKey);
|
|
62
68
|
const { id, part } = direct ? { id: rowKey, part: undefined } : parsePartKey(rowKey);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { StatusSlot } from "viewkitjs/fields/design/status-slots";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
|
-
import type { ViewsMenuItem } from "../../provider/components.js";
|
|
3
|
+
import type { ViewsMenuItem, ViewsViewVerbs } from "../../provider/components.js";
|
|
4
4
|
export type ViewTabOption<V extends string> = {
|
|
5
5
|
value: V;
|
|
6
6
|
label: string;
|
|
@@ -24,6 +24,12 @@ export type ViewTabOption<V extends string> = {
|
|
|
24
24
|
* to the view the list is showing.
|
|
25
25
|
*/
|
|
26
26
|
menu?: ViewsMenuItem[];
|
|
27
|
+
/** Its layout, by the axis's `verbs.layouts`' id: what Save as new view and New view start from. */
|
|
28
|
+
layout?: string;
|
|
29
|
+
/** It holds changes not saved: its menu offers Save for everyone, Reset and Save as new view. */
|
|
30
|
+
changed?: boolean;
|
|
31
|
+
/** One of the reader's favorites. */
|
|
32
|
+
favorite?: boolean;
|
|
27
33
|
};
|
|
28
34
|
/** One option of a `PillGroup`: any row of pills, a views row's or a tab row's. */
|
|
29
35
|
export type PillOption<T extends string = string> = {
|
|
@@ -77,6 +83,9 @@ export type CollectionViewsConfig<V extends string = string> = {
|
|
|
77
83
|
onReorder?: (orderedIds: V[]) => void;
|
|
78
84
|
/** Which pills may be picked up — a member cannot move the views everyone sees. Default: all. */
|
|
79
85
|
canDrag?: (value: V) => boolean;
|
|
86
|
+
/** A view's verbs: handed, a views list that can draw a view's menu (CONTROLS) draws Rename, New view, the delete question
|
|
87
|
+
* and Undo from them; left out, a view's menu is its `menu` rows. */
|
|
88
|
+
verbs?: ViewsViewVerbs;
|
|
80
89
|
};
|
|
81
90
|
/** Whether a view an app's views list hands back (`ViewsListBody`, VK-554) is one of the axis's views. One that isn't
|
|
82
91
|
* is never picked. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useMemo, useState } from "react";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
4
4
|
import { resolveViewsMessage } from "../contract.js";
|
|
5
5
|
import { DEFAULT_VIEWS_ATOMS } from "../atoms/defaults.js";
|
|
6
6
|
import { ViewsContext } from "./context.js";
|
|
@@ -9,10 +9,13 @@ import { PlainInput } from "./plain-input.js";
|
|
|
9
9
|
import { missingComponent, missingParts } from "./missing-slot.js";
|
|
10
10
|
import { withSettledGroups } from "./menu-groups.js";
|
|
11
11
|
import { DEFAULT_DESKTOP_QUERY, PhoneLine } from "../internal/phone-line.js";
|
|
12
|
-
import { browserConfirm } from "./ports.js";
|
|
12
|
+
import { browserConfirm, NOOP_TOAST } from "./ports.js";
|
|
13
13
|
export { useViews } from "./context.js";
|
|
14
14
|
const MISSING_COMMAND_PARTS = missingParts("Command");
|
|
15
15
|
const MISSING_CALENDAR_COMPONENT = missingComponent("Calendar");
|
|
16
|
+
const NO_SUBSCRIBE = () => () => { };
|
|
17
|
+
const IN_BROWSER = () => true;
|
|
18
|
+
const ON_SERVER = () => false;
|
|
16
19
|
export function ViewsProvider({ children, components, conventions, icons, ports, atoms, messages = resolveViewsMessage, presentation, desktopQuery = DEFAULT_DESKTOP_QUERY, sheetActions = "bar", escape, oneValue, sayRefusals = false, menus = "popover", gridButtons = "own", severalValues = "fit", gridCheckboxes = "own", fieldRowButtons = "own", fieldRowCheckboxes = "own", panelButtons = "own", bodyFrame = "views", gridBodyPlace = "under", selectionBar, datePicks, now, }) {
|
|
17
20
|
const [readNow, setReadNow] = useState(null);
|
|
18
21
|
useEffect(() => {
|
|
@@ -41,13 +44,31 @@ export function ViewsProvider({ children, components, conventions, icons, ports,
|
|
|
41
44
|
Command: components.Command ?? MISSING_COMMAND_PARTS,
|
|
42
45
|
Calendar: components.Calendar ?? MISSING_CALENDAR_COMPONENT,
|
|
43
46
|
}), [components]);
|
|
44
|
-
const
|
|
47
|
+
const hosted = useRef({});
|
|
48
|
+
const mounted = useSyncExternalStore(NO_SUBSCRIBE, IN_BROWSER, ON_SERVER);
|
|
49
|
+
const onHostReady = useCallback((p) => {
|
|
50
|
+
hosted.current = p;
|
|
51
|
+
}, []);
|
|
52
|
+
const resolved = useMemo(() => ({
|
|
53
|
+
...ports,
|
|
54
|
+
toast: ports.toast ?? {
|
|
55
|
+
success: (message, options) => (hosted.current.toast ?? NOOP_TOAST).success(message, options),
|
|
56
|
+
error: (message) => (hosted.current.toast ?? NOOP_TOAST).error(message),
|
|
57
|
+
info: (message) => (hosted.current.toast ?? NOOP_TOAST).info(message),
|
|
58
|
+
warning: (message, options) => (hosted.current.toast ?? NOOP_TOAST).warning(message, options),
|
|
59
|
+
},
|
|
60
|
+
confirm: ports.confirm ?? ((request) => (hosted.current.confirm ?? browserConfirm)(request)),
|
|
61
|
+
}), [ports]);
|
|
62
|
+
const PortsHost = components.PortsHost;
|
|
63
|
+
const host = mounted && PortsHost && (!ports.toast || !ports.confirm) ? (_jsx(PortsHost, { toast: !ports.toast, confirm: !ports.confirm, onReady: onHostReady })) : null;
|
|
45
64
|
const value = useMemo(() => ({
|
|
46
65
|
components: settled,
|
|
47
66
|
atoms: merged,
|
|
48
67
|
conventions,
|
|
49
68
|
icons,
|
|
50
69
|
ports: resolved,
|
|
70
|
+
confirmFallback: !ports.confirm && !components.PortsHost,
|
|
71
|
+
toastFallback: !ports.toast && !components.PortsHost,
|
|
51
72
|
messages,
|
|
52
73
|
presentation,
|
|
53
74
|
desktopQuery,
|
|
@@ -72,6 +93,9 @@ export function ViewsProvider({ children, components, conventions, icons, ports,
|
|
|
72
93
|
conventions,
|
|
73
94
|
icons,
|
|
74
95
|
resolved,
|
|
96
|
+
ports.confirm,
|
|
97
|
+
ports.toast,
|
|
98
|
+
components.PortsHost,
|
|
75
99
|
messages,
|
|
76
100
|
presentation,
|
|
77
101
|
desktopQuery,
|
|
@@ -91,5 +115,5 @@ export function ViewsProvider({ children, components, conventions, icons, ports,
|
|
|
91
115
|
selectionBar,
|
|
92
116
|
datePicks,
|
|
93
117
|
]);
|
|
94
|
-
return (_jsx(ViewsContext.Provider, { value: value, children: _jsx(MomentContext.Provider, { value: moment, children: _jsx(HasMomentContext.Provider, { value: moment != null, children:
|
|
118
|
+
return (_jsx(ViewsContext.Provider, { value: value, children: _jsx(MomentContext.Provider, { value: moment, children: _jsx(HasMomentContext.Provider, { value: moment != null, children: _jsxs(PhoneLine.Provider, { value: desktopQuery, children: [children, host] }) }) }) }));
|
|
95
119
|
}
|