viewkitjs 0.32.0 → 0.34.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 +98 -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 +46 -11
- package/views/dist/contract.js +157 -0
- package/views/dist/controls/alert/alert.js +2 -1
- package/views/dist/controls/alert-dialog/alert-dialog.js +3 -2
- package/views/dist/controls/bulk-bar/bulk-bar.js +25 -22
- 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 +4 -0
- package/views/dist/controls/controls.js +4 -0
- package/views/dist/controls/customize/customize.js +43 -39
- package/views/dist/controls/customize/map-customize-body.d.ts +2 -0
- package/views/dist/controls/customize/map-customize-body.js +7 -2
- package/views/dist/controls/date-editor/date-days.js +2 -2
- package/views/dist/controls/date-editor/date-editor.d.ts +3 -0
- package/views/dist/controls/date-editor/date-editor.js +27 -21
- package/views/dist/controls/date-editor/date-parts.js +6 -6
- package/views/dist/controls/date-editor/map-calendar.js +3 -1
- package/views/dist/controls/date-editor/map-date-body.d.ts +1 -1
- package/views/dist/controls/date-editor/map-date-body.js +7 -3
- package/views/dist/controls/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 +3 -0
- package/views/dist/controls/filter-editor/map-filter-body.js +11 -4
- package/views/dist/controls/filter-editor/map-rules.js +1 -1
- package/views/dist/controls/filter-editor/parts.d.ts +3 -1
- package/views/dist/controls/filter-editor/parts.js +8 -6
- package/views/dist/controls/group-editor/group-editor.js +17 -14
- package/views/dist/controls/group-editor/map-group-body.d.ts +1 -0
- package/views/dist/controls/group-editor/map-group-body.js +5 -1
- package/views/dist/controls/index.d.ts +2 -0
- package/views/dist/controls/index.js +1 -0
- package/views/dist/controls/input/input.js +4 -3
- 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/head-button.d.ts +9 -0
- package/views/dist/controls/internal/head-button.js +13 -0
- 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 +58 -0
- package/views/dist/controls/internal/panel-controls.js +240 -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 +3 -0
- package/views/dist/controls/menu/menu.js +5 -5
- 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/modal/modal.js +5 -3
- 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/map-number-body.js +5 -1
- package/views/dist/controls/number-editor/number-editor.d.ts +1 -1
- package/views/dist/controls/number-editor/number-editor.js +16 -16
- package/views/dist/controls/number-field/number-field.js +5 -3
- package/views/dist/controls/pane/map-pane.d.ts +3 -0
- package/views/dist/controls/pane/map-pane.js +5 -0
- package/views/dist/controls/pane/pane.d.ts +4 -2
- package/views/dist/controls/pane/pane.js +4 -4
- package/views/dist/controls/picker/map-fields-body.js +25 -1
- 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/picker.css +10 -1
- 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/map-quick-filters-body.d.ts +2 -1
- package/views/dist/controls/quick-filters/map-quick-filters-body.js +7 -3
- package/views/dist/controls/quick-filters/quick-filters.js +8 -6
- 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/setting-row/looks.js +5 -5
- package/views/dist/controls/setting-row/setting-row.d.ts +3 -1
- package/views/dist/controls/setting-row/setting-row.js +3 -1
- package/views/dist/controls/setting-row.css +3 -2
- package/views/dist/controls/sheet/bottom-sheet.d.ts +8 -2
- package/views/dist/controls/sheet/bottom-sheet.js +4 -4
- 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 +8 -4
- 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/map-text-body.js +5 -1
- package/views/dist/controls/text-editor/text-editor.d.ts +1 -1
- package/views/dist/controls/text-editor/text-editor.js +11 -10
- package/views/dist/controls/toolbar/toolbar.d.ts +4 -2
- package/views/dist/controls/toolbar/toolbar.js +2 -2
- 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.d.ts +3 -2
- package/views/dist/controls/views-list/map-view-menu.js +7 -3
- package/views/dist/controls/views-list/map-views-list-body.d.ts +2 -1
- package/views/dist/controls/views-list/map-views-list-body.js +6 -5
- package/views/dist/controls/views-list/view-menu.js +9 -10
- package/views/dist/controls/views-list/views-list.js +6 -6
- package/views/dist/editors/EditorPanel.js +4 -4
- 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 +74 -0
- package/views/dist/list/list.js +18 -0
- package/views/dist/list/parts.js +11 -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 +23 -5
- 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 +21 -2
- package/views/dist/panels/react/toolbar/ReadyToolbar.js +2 -2
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +12 -1
- package/views/dist/panels/react/toolbar/Toolbar.js +20 -6
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +4 -3
- 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 +4 -3
- package/views/dist/panels/react/toolbar/ToolbarFilterSheet.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +5 -4
- 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 +8 -5
- package/views/dist/panels/react/toolbar/context.d.ts +31 -1
- package/views/dist/panels/react/toolbar/context.js +4 -0
- package/views/dist/panels/react/toolbar/pane-host.d.ts +6 -0
- package/views/dist/panels/react/toolbar/pane-host.js +17 -0
- package/views/dist/panels/react/toolbar/panel-part.d.ts +4 -1
- package/views/dist/panels/react/toolbar/panel-part.js +7 -4
- package/views/dist/panels/react.d.ts +1 -1
- package/views/dist/panels/settings/filter-groups.js +6 -1
- package/views/dist/provider/ViewsProvider.d.ts +7 -2
- package/views/dist/provider/ViewsProvider.js +18 -1
- package/views/dist/provider/components.d.ts +90 -2
- 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 +107 -80
- package/views/dist/styles.unlayered.css +107 -80
- package/views/docs/contract.md +310 -7
- package/views/docs/controls/alert-dialog.md +4 -0
- package/views/docs/controls/alert.md +4 -0
- package/views/docs/controls/bulk-bar.md +4 -0
- package/views/docs/controls/compound-editor.md +4 -0
- package/views/docs/controls/customize.md +8 -0
- package/views/docs/controls/date-editor.md +6 -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 +8 -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 +6 -0
- package/views/docs/controls/modal.md +4 -0
- package/views/docs/controls/notice.md +4 -0
- package/views/docs/controls/number-editor.md +6 -0
- package/views/docs/controls/pane.md +4 -0
- package/views/docs/controls/picker.md +8 -0
- package/views/docs/controls/quick-filters.md +8 -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 +6 -0
- package/views/docs/controls/toolbar.md +4 -0
- package/views/docs/controls/values-editor.md +4 -0
- package/views/docs/controls/views-list.md +8 -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 +11 -7
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +1 -1
- package/views/docs/reference/list.md +143 -11
- package/views/docs/reference/looks.md +1 -1
- package/views/docs/reference/panels-react.md +6 -5
- package/views/docs/reference/react.md +19 -12
- package/views/docs/reference/views.md +11 -5
- package/views/docs/reshaping.md +17 -1
- package/views/skills/views/SKILL.md +1 -1
|
@@ -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();
|
|
@@ -5,7 +5,7 @@ import { useViews } from "../../../provider/context.js";
|
|
|
5
5
|
import { listedFieldsOf } from "../../settings/filter-groups.js";
|
|
6
6
|
import { FilterFieldList } from "../filter/FilterFieldList.js";
|
|
7
7
|
import { useSheetPanels } from "../panel-sheet.js";
|
|
8
|
-
import { useFoldAnchor, useToolbarPanel } from "./context.js";
|
|
8
|
+
import { useFoldAnchor, usePanelPlace, useToolbarPanel } from "./context.js";
|
|
9
9
|
import { ToolbarButton } from "./ToolbarButton.js";
|
|
10
10
|
import { useFilterAdd } from "./use-filter-add.js";
|
|
11
11
|
export function ToolbarFilterAdd({ filterTree, onHeldChange, open, onOpenChange, host, }) {
|
|
@@ -15,6 +15,7 @@ export function ToolbarFilterAdd({ filterTree, onHeldChange, open, onOpenChange,
|
|
|
15
15
|
const fields = useToolbarPanel("filter-add", open === undefined || !onOpenChange ? undefined : { open, onOpenChange });
|
|
16
16
|
const box = useRef(null);
|
|
17
17
|
const hangsAt = useFoldAnchor(box);
|
|
18
|
+
const hangs = usePanelPlace("start");
|
|
18
19
|
const atPress = useRef(false);
|
|
19
20
|
const { refusal, reason, onPick } = useFilterAdd({
|
|
20
21
|
filterTree,
|
|
@@ -33,7 +34,7 @@ export function ToolbarFilterAdd({ filterTree, onHeldChange, open, onOpenChange,
|
|
|
33
34
|
hangsAt.anchor.current?.focus({ preventScroll: true });
|
|
34
35
|
} }));
|
|
35
36
|
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: () => {
|
|
37
|
+
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
38
|
atPress.current = fields.open;
|
|
38
39
|
}, onClick: (event) => {
|
|
39
40
|
if (refusal)
|
|
@@ -46,5 +47,5 @@ export function ToolbarFilterAdd({ filterTree, onHeldChange, open, onOpenChange,
|
|
|
46
47
|
const why = details?.reason;
|
|
47
48
|
if (!next && why !== "outside-press" && why !== "focus-out")
|
|
48
49
|
hangsAt.anchor.current?.focus({ preventScroll: true });
|
|
49
|
-
}, anchor: hangsAt.anchor,
|
|
50
|
+
}, anchor: hangsAt.anchor, ...hangs, chrome: "menu", panelData: { "data-slot": "vk-toolbar-filters-panel" }, children: list }))] }));
|
|
50
51
|
}
|
|
@@ -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
|
}
|
|
@@ -9,7 +9,7 @@ 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";
|
|
11
11
|
import { useSheetPanels } from "../panel-sheet.js";
|
|
12
|
-
import { useFoldAnchor, useToolbarPanel, useToolbarSlot } from "./context.js";
|
|
12
|
+
import { useFoldAnchor, usePanelPlace, useToolbarPanel, useToolbarSlot } from "./context.js";
|
|
13
13
|
import { AdvancedFilterPill } from "./ToolbarAdvancedFilters.js";
|
|
14
14
|
import { ToolbarAsideFilter } from "./ToolbarAsideFilter.js";
|
|
15
15
|
import { ToolbarBarFilter } from "./ToolbarBarFilter.js";
|
|
@@ -86,6 +86,7 @@ export function ToolbarFilters({ filterTree, open: openIn, onOpenChange: onOpenC
|
|
|
86
86
|
const addBox = useRef(null);
|
|
87
87
|
const fields = useToolbarPanel("filters", openIn === undefined || !onOpenChangeIn ? undefined : { open: openIn, onOpenChange: onOpenChangeIn });
|
|
88
88
|
const hangsAt = useFoldAnchor(addBox);
|
|
89
|
+
const hangs = usePanelPlace("start");
|
|
89
90
|
const fieldsAtPress = useRef(false);
|
|
90
91
|
const leaving = useRef(null);
|
|
91
92
|
const leave = (from) => {
|
|
@@ -246,7 +247,7 @@ export function ToolbarFilters({ filterTree, open: openIn, onOpenChange: onOpenC
|
|
|
246
247
|
},
|
|
247
248
|
];
|
|
248
249
|
});
|
|
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: () => {
|
|
250
|
+
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
251
|
openAtPress.current = more.open;
|
|
251
252
|
}, onClick: (event) => {
|
|
252
253
|
const wasOpen = event.detail === 0 ? more.open : openAtPress.current;
|
|
@@ -276,12 +277,12 @@ export function ToolbarFilters({ filterTree, open: openIn, onOpenChange: onOpenC
|
|
|
276
277
|
fields.onOpenChange(!wasOpen);
|
|
277
278
|
},
|
|
278
279
|
};
|
|
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) => {
|
|
280
|
+
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
281
|
fields.onOpenChange(next);
|
|
281
282
|
const why = details?.reason;
|
|
282
283
|
if (!next && why !== "outside-press" && why !== "focus-out")
|
|
283
284
|
hangsAt.anchor.current?.focus({ preventScroll: true });
|
|
284
|
-
}, anchor: hangsAt.anchor,
|
|
285
|
+
}, anchor: hangsAt.anchor, ...hangs, chrome: "menu", panelData: { "data-slot": "vk-toolbar-filters-panel" }, children: _jsx(FilterFieldList, { fields: listedFieldsOf(filterTree), relations: true, onPick: onPick, onDone: () => {
|
|
285
286
|
fields.onOpenChange(false);
|
|
286
287
|
hangsAt.anchor.current?.focus({ preventScroll: true });
|
|
287
288
|
} }) }))] }, "add"));
|
|
@@ -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, usePanelPlace, 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,11 +20,13 @@ 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);
|
|
25
27
|
const add = useRef(null);
|
|
26
28
|
const hangsAt = useFoldAnchor(pill);
|
|
29
|
+
const hangs = usePanelPlace("start");
|
|
27
30
|
const named = sortRulesLabel(sorts);
|
|
28
31
|
const asideOnly = !named && (sorts.setAside?.length ?? 0) > 0;
|
|
29
32
|
const places = openSortPlaces(sorts);
|
|
@@ -64,16 +67,16 @@ function ComputerPill({ sorts, open: openIn, onOpenChange: onOpenChangeIn, host:
|
|
|
64
67
|
sorts.onChange(next);
|
|
65
68
|
close(true, opens.at === "add" && canAddSortRule(next, places));
|
|
66
69
|
}, 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
|
|
70
|
+
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
71
|
? sorts.rules.length > 1
|
|
69
72
|
? String(sorts.rules.length)
|
|
70
73
|
: undefined
|
|
71
74
|
: named && named.more > 0
|
|
72
75
|
? 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) => {
|
|
76
|
+
: 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
77
|
if (!next)
|
|
75
78
|
close(details?.reason !== "outside-press" && details?.reason !== "focus-out");
|
|
76
|
-
}, anchor: hangsAt.hidden ? hangsAt.anchor : opens.at === "add" ? add : pill,
|
|
79
|
+
}, anchor: hangsAt.hidden ? hangsAt.anchor : opens.at === "add" ? add : pill, ...hangs, chrome: "menu", panelData: { "data-slot": "vk-toolbar-sort-panel" }, children: content }))] }));
|
|
77
80
|
}
|
|
78
81
|
function PhonePill({ sorts, open: openIn, onOpenChange: onOpenChangeIn, host }) {
|
|
79
82
|
const { icons, messages } = useViews();
|
|
@@ -86,5 +89,5 @@ function PhonePill({ sorts, open: openIn, onOpenChange: onOpenChangeIn, host })
|
|
|
86
89
|
const Glyph = icons.sort;
|
|
87
90
|
const name = messages({ key: "views.panels.sort" });
|
|
88
91
|
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) })) }));
|
|
92
|
+
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
93
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
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";
|
|
3
|
+
import type { ViewsAlign, ViewsSide } from "../../../provider/components.js";
|
|
2
4
|
import type { ToolbarForm, ToolbarLine } from "../../toolbar/model.js";
|
|
3
5
|
/** Where a part stands: the toolbar's form, whether it fills its line, its buttons' size, and its line's kind.
|
|
4
6
|
* In the fold arrangement (`fold`), also how far its line gave way: whether its words turned to its icon
|
|
@@ -31,6 +33,34 @@ export type ToolbarSlotState = {
|
|
|
31
33
|
words?: "both" | "icon";
|
|
32
34
|
/** `false`: New stays on a phone's folding line instead of at the list's foot. */
|
|
33
35
|
foot?: boolean;
|
|
36
|
+
/** 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
|
|
37
|
+
* part) names its button after it. */
|
|
38
|
+
key?: string;
|
|
39
|
+
/** Its place's class (`ToolbarPartPlace.className`, VK-984), handed to every toolbar button the part draws. */
|
|
40
|
+
className?: string;
|
|
41
|
+
/** Its place's own button (`ToolbarPartPlace.button`, VK-984), drawn for every toolbar button the part draws, in place of
|
|
42
|
+
* your `ToolbarButton`, handed the same props. */
|
|
43
|
+
button?: ComponentType<ViewsToolbarButtonProps>;
|
|
44
|
+
/** Its side of its line (VK-994), folded into ⋯ ⋯'s side: what it opens hangs toward it. Absent outside ViewKit's
|
|
45
|
+
* `Toolbar`. */
|
|
46
|
+
side?: "start" | "end";
|
|
47
|
+
/** Its place's own placement for what it opens (`ToolbarPartPlace.panel`, VK-994). */
|
|
48
|
+
panel?: ToolbarPanelPlace;
|
|
49
|
+
};
|
|
50
|
+
/** Where a part's popover hangs at its button (VK-994): the popover's `side`, `align` and `sideOffset` (`offset`). */
|
|
51
|
+
export type ToolbarPanelPlace = {
|
|
52
|
+
side?: ViewsSide;
|
|
53
|
+
align?: ViewsAlign;
|
|
54
|
+
offset?: number;
|
|
55
|
+
};
|
|
56
|
+
/** Where a part's popover hangs: its place's own `panel` first; else toward its side of its line, on the end side
|
|
57
|
+
* aligned to its button's end, on the start side to its start; outside ViewKit's `Toolbar`, `own`, as it always hung.
|
|
58
|
+
* 8 px below its button unless its place says. Read from where it stands, never from whether it is open, so a closing
|
|
59
|
+
* panel keeps its side. */
|
|
60
|
+
export declare function usePanelPlace(own: ViewsAlign): {
|
|
61
|
+
side?: ViewsSide;
|
|
62
|
+
align: ViewsAlign;
|
|
63
|
+
sideOffset: number;
|
|
34
64
|
};
|
|
35
65
|
/** The fold arrangement's part of a slot, for a line that doesn't fold. */
|
|
36
66
|
export declare const NOT_FOLDING: {
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { createContext, createElement, useCallback, useContext, useEffect, useId, useLayoutEffect, useRef, useState, } from "react";
|
|
3
3
|
import { useDesktop } from "../../../provider/desktop.js";
|
|
4
|
+
export function usePanelPlace(own) {
|
|
5
|
+
const { side, panel } = useToolbarSlot();
|
|
6
|
+
return { ...(panel?.side && { side: panel.side }), align: panel?.align ?? side ?? own, sideOffset: panel?.offset ?? 8 };
|
|
7
|
+
}
|
|
4
8
|
export const NOT_FOLDING = {
|
|
5
9
|
fold: false,
|
|
6
10
|
iconAlone: false,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ComponentProps, type ReactNode } from "react";
|
|
2
|
+
import type { ToolbarPanelHost } from "./panel-part.js";
|
|
3
|
+
/** The list's box the Pane stands in: positioned, holding the grid under the toolbar. Null until it is on the page. */
|
|
4
|
+
export declare const PaneBox: import("react").Context<HTMLElement | null>;
|
|
5
|
+
/** A toolbar panel in the map's `Pane`, in the box `PaneBox` holds. Drawn only where the map has a `Pane`. */
|
|
6
|
+
export declare function PaneHost({ open, onOpenChange, title, opener, children }: ComponentProps<ToolbarPanelHost>): ReactNode;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext, useLayoutEffect, useState } from "react";
|
|
4
|
+
import { useViews } from "../../../provider/context.js";
|
|
5
|
+
export const PaneBox = createContext(null);
|
|
6
|
+
export function PaneHost({ open, onOpenChange, title, opener, children }) {
|
|
7
|
+
const { Pane } = useViews().components;
|
|
8
|
+
const box = useContext(PaneBox);
|
|
9
|
+
const [from, setFrom] = useState(null);
|
|
10
|
+
useLayoutEffect(() => {
|
|
11
|
+
if (open)
|
|
12
|
+
setFrom(opener?.current ?? null);
|
|
13
|
+
}, [open, opener]);
|
|
14
|
+
if (!Pane)
|
|
15
|
+
return null;
|
|
16
|
+
return (_jsx(Pane, { open: open, onOpenChange: onOpenChange, container: box, opener: from, label: title, children: children }));
|
|
17
|
+
}
|
|
@@ -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,17 +3,20 @@ 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, usePanelPlace, 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);
|
|
19
|
+
const hangs = usePanelPlace("end");
|
|
17
20
|
const openAtPress = useRef(false);
|
|
18
21
|
const focusBack = useRef(false);
|
|
19
22
|
const close = () => {
|
|
@@ -29,7 +32,7 @@ export function ToolbarPanelPart({ panelKey, slot, icon, label, word, count, onC
|
|
|
29
32
|
focusBack.current = false;
|
|
30
33
|
hangsAt.anchor.current?.focus({ preventScroll: true });
|
|
31
34
|
}, [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: () => {
|
|
35
|
+
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
36
|
openAtPress.current = open;
|
|
34
37
|
}, onClick: (event) => {
|
|
35
38
|
if (disabled)
|
|
@@ -42,7 +45,7 @@ export function ToolbarPanelPart({ panelKey, slot, icon, label, word, count, onC
|
|
|
42
45
|
const reason = details?.reason;
|
|
43
46
|
if (!next && reason !== "outside-press" && reason !== "focus-out")
|
|
44
47
|
hangsAt.anchor.current?.focus({ preventScroll: true });
|
|
45
|
-
}, anchor: hangsAt.anchor,
|
|
48
|
+
}, anchor: hangsAt.anchor, ...hangs, chrome: "menu", className: popoverClassName, panelData: { "data-slot": `${slot}-panel` }, children: _jsx(PanelBody, { render: children, args: { fill: false, close, closeButton: true } }) }))] }));
|
|
46
49
|
}
|
|
47
50
|
function PanelBody({ render, args }) {
|
|
48
51
|
return render(args);
|
|
@@ -31,7 +31,7 @@ export type { ToolbarMore, ToolbarPart } from "./react/toolbar/Toolbar.js";
|
|
|
31
31
|
export { ToolbarButton } from "./react/toolbar/ToolbarButton.js";
|
|
32
32
|
export { useToolbarPanel, useToolbarSlot } from "./react/toolbar/context.js";
|
|
33
33
|
export { ToolbarRadioProvider, ToolbarSlotProvider } from "./react/toolbar/context.js";
|
|
34
|
-
export type { ToolbarSlotState } from "./react/toolbar/context.js";
|
|
34
|
+
export type { ToolbarPanelPlace, ToolbarSlotState } from "./react/toolbar/context.js";
|
|
35
35
|
export { ToolbarSearch } from "./react/toolbar/ToolbarSearch.js";
|
|
36
36
|
export { ToolbarNew } from "./react/toolbar/ToolbarNew.js";
|
|
37
37
|
export { ToolbarViews } from "./react/toolbar/ToolbarViews.js";
|
|
@@ -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,11 @@ 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 and field editors draw inside them (VK-1013, VK-1021): `true` for all six, or
|
|
73
|
+
* the names among `Button`, `Select`, `Menu`, `Popover`, `Input` and `Calendar` (the date editor's month; the filter's range
|
|
74
|
+
* calendar reads your `Calendar` whatever this says). Each is handed the map's props and the part's `data-slot` and
|
|
75
|
+
* `data-key`. A control of `CONTROLS`' stays ViewKit's whatever this says. Absent, they draw ViewKit's own, as before. */
|
|
76
|
+
panelControls?: boolean | readonly PanelControlName[];
|
|
72
77
|
children: ReactNode;
|
|
73
78
|
};
|
|
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;
|
|
79
|
+
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
|
}
|