viewkitjs 0.29.0 → 0.30.1
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 +127 -6
- package/MIGRATION.md +97 -8
- package/package.json +1 -1
- package/views/dist/cells/cell-format.d.ts +2 -2
- package/views/dist/cells/cell-values.js +0 -2
- package/views/dist/contract.d.ts +15 -18
- package/views/dist/contract.js +13 -27
- package/views/dist/controls/button/map-button.d.ts +5 -3
- package/views/dist/controls/button/map-button.js +14 -7
- package/views/dist/controls/controls.d.ts +2 -4
- package/views/dist/controls/controls.js +2 -2
- package/views/dist/controls/customize/customize.d.ts +51 -0
- package/views/dist/controls/customize/customize.js +128 -23
- package/views/dist/controls/customize/map-customize-body.d.ts +0 -3
- package/views/dist/controls/customize/map-customize-body.js +46 -11
- package/views/dist/controls/customize/map-ranges.d.ts +23 -0
- package/views/dist/controls/customize/map-ranges.js +41 -0
- package/views/dist/controls/customize/rules.d.ts +17 -1
- package/views/dist/controls/customize/rules.js +2 -0
- package/views/dist/controls/customize/words.d.ts +7 -0
- package/views/dist/controls/customize/words.js +5 -0
- package/views/dist/controls/customize.css +3 -0
- package/views/dist/controls/filter-editor/filter-editor.d.ts +2 -0
- package/views/dist/controls/filter-editor/filter-editor.js +1 -0
- package/views/dist/controls/filter-editor/rules.d.ts +1 -2
- package/views/dist/controls/index.d.ts +8 -8
- package/views/dist/controls/index.js +8 -8
- package/views/dist/controls/menu-list/menu-list.d.ts +16 -1
- package/views/dist/controls/menu-list/menu-list.js +26 -8
- package/views/dist/controls/menu-list.css +8 -0
- package/views/dist/controls/quick-filters/map-quick-filters-body.d.ts +1 -1
- package/views/dist/controls/quick-filters/map-quick-filters-body.js +6 -3
- package/views/dist/controls/sheet/map-sheet.js +1 -1
- package/views/dist/controls/text-editor/map-text-body.d.ts +1 -1
- package/views/dist/controls/text-editor/map-text-body.js +2 -2
- package/views/dist/controls/text-editor/text-editor.d.ts +3 -0
- package/views/dist/controls/text-editor/text-editor.js +16 -2
- package/views/dist/controls/text-editor.css +11 -0
- package/views/dist/controls/values-editor/values.js +6 -2
- package/views/dist/display/options.d.ts +1 -1
- package/views/dist/display/rich-text.js +0 -1
- package/views/dist/editors/ChipsEditor.d.ts +4 -5
- package/views/dist/editors/ChipsEditor.js +12 -78
- package/views/dist/editors/DateEditor.d.ts +12 -16
- package/views/dist/editors/DateEditor.js +40 -191
- package/views/dist/editors/EditorPanel.d.ts +2 -6
- package/views/dist/editors/EditorPanel.js +2 -2
- package/views/dist/editors/LocationEditor.d.ts +11 -19
- package/views/dist/editors/LocationEditor.js +19 -211
- package/views/dist/editors/NameEditor.d.ts +8 -16
- package/views/dist/editors/NameEditor.js +11 -100
- package/views/dist/editors/NumberEditor.d.ts +14 -21
- package/views/dist/editors/NumberEditor.js +22 -49
- package/views/dist/editors/RangeEditor.d.ts +9 -33
- package/views/dist/editors/RangeEditor.js +12 -97
- package/views/dist/editors/RelationEditor.d.ts +6 -9
- package/views/dist/editors/RelationEditor.js +11 -30
- package/views/dist/editors/RelationSetEditor.d.ts +13 -24
- package/views/dist/editors/RelationSetEditor.js +33 -101
- package/views/dist/editors/SelectEditor.d.ts +15 -17
- package/views/dist/editors/SelectEditor.js +15 -94
- package/views/dist/editors/TextEditor.d.ts +23 -26
- package/views/dist/editors/TextEditor.js +11 -48
- package/views/dist/editors/ValueListEditor.d.ts +14 -23
- package/views/dist/editors/ValueListEditor.js +16 -202
- package/views/dist/editors/body-panel.d.ts +13 -7
- package/views/dist/editors/body-panel.js +3 -7
- package/views/dist/editors/edit-cores.d.ts +15 -15
- package/views/dist/editors/edit-cores.js +14 -14
- package/views/dist/editors/number-body.d.ts +1 -1
- package/views/dist/editors/number-step.d.ts +0 -34
- package/views/dist/editors/number-step.js +0 -37
- package/views/dist/editors/option-add-flow.d.ts +1 -13
- package/views/dist/editors/option-add-flow.js +0 -22
- package/views/dist/editors/relation-links-body.d.ts +2 -3
- package/views/dist/editors/relation-picker.d.ts +13 -3
- package/views/dist/editors/relation-source.d.ts +0 -22
- package/views/dist/editors/relation-source.js +0 -21
- package/views/dist/field-row/FieldRow.js +5 -6
- package/views/dist/field-row/FieldRowLane.js +0 -1
- package/views/dist/field-row/editors/RowChipsEditor.js +2 -2
- package/views/dist/field-row/editors/RowDateEditor.d.ts +2 -2
- package/views/dist/field-row/editors/RowDateEditor.js +2 -2
- package/views/dist/field-row/editors/RowNameEditor.d.ts +2 -5
- package/views/dist/field-row/editors/RowNameEditor.js +7 -12
- package/views/dist/field-row/editors/RowNumberEditor.d.ts +1 -1
- package/views/dist/field-row/editors/RowNumberEditor.js +4 -4
- package/views/dist/field-row/editors/RowPlaceEditor.js +3 -3
- package/views/dist/field-row/editors/RowRangeEditor.d.ts +2 -5
- package/views/dist/field-row/editors/RowRangeEditor.js +7 -14
- package/views/dist/field-row/editors/RowRelationEditor.js +3 -3
- package/views/dist/field-row/editors/RowSelectEditor.js +2 -2
- package/views/dist/field-row/editors/RowTextEditor.d.ts +1 -1
- package/views/dist/field-row/editors/RowTextEditor.js +3 -4
- package/views/dist/field-row/editors/RowValueListEditor.js +5 -5
- package/views/dist/field-row/field-row-button.d.ts +6 -9
- package/views/dist/field-row/field-row-button.js +1 -6
- package/views/dist/field-row/field-row-checkbox.d.ts +1 -1
- package/views/dist/field-row/row-target.d.ts +0 -7
- package/views/dist/field-row/row-target.js +0 -2
- package/views/dist/grid/chrome/GridAddColumn.d.ts +2 -1
- package/views/dist/grid/chrome/GridAddColumn.js +8 -66
- package/views/dist/grid/chrome/GridAggregateMenu.d.ts +5 -7
- package/views/dist/grid/chrome/GridAggregateMenu.js +20 -39
- package/views/dist/grid/chrome/GridCellEditors.d.ts +2 -2
- package/views/dist/grid/chrome/GridCellEditors.js +12 -12
- package/views/dist/grid/chrome/GridChipsEditor.js +3 -3
- package/views/dist/grid/chrome/GridColumnMenu.d.ts +11 -12
- package/views/dist/grid/chrome/GridColumnMenu.js +32 -93
- package/views/dist/grid/chrome/GridDateEditor.d.ts +6 -6
- package/views/dist/grid/chrome/GridDateEditor.js +3 -3
- package/views/dist/grid/chrome/GridGroupMenu.d.ts +4 -6
- package/views/dist/grid/chrome/GridGroupMenu.js +21 -62
- package/views/dist/grid/chrome/GridHeader.d.ts +1 -2
- package/views/dist/grid/chrome/GridHeader.js +2 -2
- package/views/dist/grid/chrome/GridLongTextEditor.d.ts +17 -38
- package/views/dist/grid/chrome/GridLongTextEditor.js +6 -7
- package/views/dist/grid/chrome/GridNameEditor.js +4 -4
- package/views/dist/grid/chrome/GridNumberEditor.d.ts +4 -5
- package/views/dist/grid/chrome/GridNumberEditor.js +3 -4
- package/views/dist/grid/chrome/GridPlaceEditor.d.ts +2 -5
- package/views/dist/grid/chrome/GridPlaceEditor.js +5 -5
- package/views/dist/grid/chrome/GridRangeEditor.d.ts +6 -12
- package/views/dist/grid/chrome/GridRangeEditor.js +7 -15
- package/views/dist/grid/chrome/GridRelationEditor.js +5 -5
- package/views/dist/grid/chrome/GridRow.js +0 -3
- package/views/dist/grid/chrome/GridRowActions.d.ts +1 -1
- package/views/dist/grid/chrome/GridRowActions.js +0 -5
- package/views/dist/grid/chrome/GridRowCells.js +9 -6
- package/views/dist/grid/chrome/GridSelectEditor.js +3 -3
- package/views/dist/grid/chrome/GridStructure.js +0 -1
- package/views/dist/grid/chrome/GridTable.js +1 -1
- package/views/dist/grid/chrome/GridTextEditor.d.ts +5 -7
- package/views/dist/grid/chrome/GridTextEditor.js +4 -17
- package/views/dist/grid/chrome/GridValueListEditor.js +4 -4
- package/views/dist/grid/chrome/grid-body-place.d.ts +2 -3
- package/views/dist/grid/chrome/grid-body-place.js +4 -8
- package/views/dist/grid/chrome/grid-button.d.ts +7 -10
- package/views/dist/grid/chrome/grid-button.js +1 -6
- package/views/dist/grid/chrome/grid-cell-classes.js +1 -1
- package/views/dist/grid/chrome/grid-column-menu-items.d.ts +4 -4
- package/views/dist/grid/chrome/grid-column-menu-items.js +10 -6
- package/views/dist/grid/chrome/grid-group-menu-parts.d.ts +5 -9
- package/views/dist/grid/chrome/grid-group-menu-parts.js +1 -3
- package/views/dist/grid/chrome/grid-hover.js +0 -1
- package/views/dist/grid/chrome/grid-menu-focus.d.ts +7 -31
- package/views/dist/grid/chrome/grid-menu-focus.js +7 -47
- package/views/dist/grid/chrome/grid-styles.d.ts +0 -3
- package/views/dist/grid/chrome/grid-styles.js +0 -1
- package/views/dist/grid/chrome/grid-table-props.d.ts +6 -10
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +2 -4
- package/views/dist/grid/core/editing-controller.d.ts +2 -1
- package/views/dist/grid/core/editing-controller.js +10 -2
- package/views/dist/grid/core/refusal-sentence.d.ts +3 -0
- package/views/dist/grid/core/refusal-sentence.js +2 -2
- package/views/dist/grid/core/write-states.d.ts +3 -1
- package/views/dist/grid/core/write-states.js +6 -2
- package/views/dist/grid/grid.css +1 -1
- package/views/dist/model/body-frame.d.ts +0 -32
- package/views/dist/model/body-frame.js +1 -15
- package/views/dist/model/column-inspect.d.ts +5 -5
- package/views/dist/model/column-inspect.js +2 -2
- package/views/dist/panels/customize-body.d.ts +1 -10
- package/views/dist/panels/customize-body.js +0 -3
- package/views/dist/panels/filter/MenuSelect.js +0 -5
- package/views/dist/panels/filter/RangeFilterBody.js +0 -1
- package/views/dist/panels/filter/details.d.ts +1 -5
- package/views/dist/panels/filter/details.js +0 -13
- package/views/dist/panels/filter/filter-list.d.ts +0 -1
- package/views/dist/panels/filter/filter-list.js +1 -1
- package/views/dist/panels/panel-button.d.ts +10 -12
- package/views/dist/panels/panel-button.js +1 -6
- package/views/dist/panels/react/chrome.d.ts +0 -17
- package/views/dist/panels/react/chrome.js +0 -8
- package/views/dist/panels/react/customize-body.d.ts +9 -12
- package/views/dist/panels/react/customize-body.js +57 -11
- package/views/dist/panels/react/customize.d.ts +9 -12
- package/views/dist/panels/react/customize.js +3 -112
- package/views/dist/panels/react/filter/FilterEditor.d.ts +4 -18
- package/views/dist/panels/react/filter/FilterEditor.js +6 -330
- package/views/dist/panels/react/filter/FilterFieldList.d.ts +1 -1
- package/views/dist/panels/react/filter/FilterFieldList.js +27 -59
- package/views/dist/panels/react/filter/PhoneFilterEditor.d.ts +1 -11
- package/views/dist/panels/react/filter/PhoneFilterEditor.js +8 -144
- package/views/dist/panels/react/filter/editor-ctx.d.ts +1 -33
- package/views/dist/panels/react/filter/editor-ctx.js +5 -33
- package/views/dist/panels/react/filter/filter-part-body.d.ts +3 -6
- package/views/dist/panels/react/filter/filter-part-body.js +0 -5
- package/views/dist/panels/react/filter/rule-writes.d.ts +1 -26
- package/views/dist/panels/react/filter/rule-writes.js +4 -95
- package/views/dist/panels/react/order-details.d.ts +1 -26
- package/views/dist/panels/react/order-details.js +3 -69
- package/views/dist/panels/react/panel-header.js +0 -1
- package/views/dist/panels/react/popover.d.ts +4 -7
- package/views/dist/panels/react/quick/QuickFiltersPanel.d.ts +2 -4
- package/views/dist/panels/react/quick/QuickFiltersPanel.js +16 -137
- package/views/dist/panels/react/sort/SortEditor.d.ts +4 -4
- package/views/dist/panels/react/sort/SortEditor.js +8 -245
- package/views/dist/panels/react/sort/SortFieldList.d.ts +1 -1
- package/views/dist/panels/react/sort/SortFieldList.js +11 -25
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +4 -16
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSave.js +0 -4
- package/views/dist/panels/react/toolbar/ToolbarSearch.js +0 -1
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +3 -3
- package/views/dist/panels/react/view-actions.js +0 -1
- package/views/dist/panels/react/views-row/FoldingViewRow.js +5 -9
- package/views/dist/panels/react/views-row/ViewCreatePill.js +0 -1
- package/views/dist/panels/react/views-row/ViewPicker.js +7 -43
- package/views/dist/panels/react/views-row/ViewPickerRow.js +0 -2
- package/views/dist/panels/react/views-row/menu-classes.d.ts +0 -4
- package/views/dist/panels/react/views-row/menu-classes.js +0 -2
- package/views/dist/panels/react.d.ts +5 -12
- package/views/dist/panels/react.js +5 -12
- package/views/dist/provider/ViewsProvider.d.ts +2 -46
- package/views/dist/provider/ViewsProvider.js +2 -22
- package/views/dist/provider/components.d.ts +153 -106
- package/views/dist/provider/context.d.ts +1 -21
- package/views/dist/provider/missing-slot.d.ts +3 -7
- package/views/dist/provider/missing-slot.js +2 -9
- package/views/dist/react.d.ts +1 -2
- package/views/dist/selection/SelectionBar.js +2 -3
- package/views/dist/styles.css +40 -168
- package/views/dist/styles.unlayered.css +40 -168
- package/views/docs/contract.md +99 -123
- package/views/docs/getting-started.md +222 -2
- package/views/docs/guides/cells.md +222 -2
- package/views/docs/guides/display.md +1 -1
- package/views/docs/guides/editors.md +235 -20
- package/views/docs/guides/ports.md +1 -1
- package/views/docs/guides/selection.md +1 -1
- package/views/docs/guides/the-grid.md +14 -16
- package/views/docs/guides/the-provider.md +9 -15
- package/views/docs/reference/cells.md +1 -1
- package/views/docs/reference/controls.md +28 -15
- package/views/docs/reference/editors-chips.md +2 -2
- package/views/docs/reference/editors-date.md +4 -4
- package/views/docs/reference/editors-location.md +4 -7
- package/views/docs/reference/editors-name.md +3 -5
- package/views/docs/reference/editors-number.md +10 -10
- package/views/docs/reference/editors-panel.md +3 -3
- package/views/docs/reference/editors-range.md +3 -5
- package/views/docs/reference/editors-relation.md +4 -4
- package/views/docs/reference/editors-select.md +3 -3
- package/views/docs/reference/editors-text.md +3 -4
- package/views/docs/reference/editors-value-list.md +3 -3
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +2 -2
- package/views/docs/reference/panels-react.md +20 -34
- package/views/docs/reference/react.md +11 -18
- package/views/docs/reference/views.md +5 -5
- package/views/skills/views/SKILL.md +1 -1
- package/views/dist/editors/relation-panel.d.ts +0 -69
- package/views/dist/editors/relation-panel.js +0 -46
- package/views/dist/grid/chrome/GridColumnColorSection.d.ts +0 -13
- package/views/dist/grid/chrome/GridColumnColorSection.js +0 -40
- package/views/dist/grid/chrome/GridColumnDateSection.d.ts +0 -28
- package/views/dist/grid/chrome/GridColumnDateSection.js +0 -23
- package/views/dist/grid/chrome/GridColumnDurationSection.d.ts +0 -23
- package/views/dist/grid/chrome/GridColumnDurationSection.js +0 -24
- package/views/dist/grid/chrome/GridColumnNumberSection.d.ts +0 -29
- package/views/dist/grid/chrome/GridColumnNumberSection.js +0 -27
- package/views/dist/grid/chrome/GridColumnPercentSection.d.ts +0 -16
- package/views/dist/grid/chrome/GridColumnPercentSection.js +0 -16
- package/views/dist/grid/chrome/GridColumnSortSection.d.ts +0 -38
- package/views/dist/grid/chrome/GridColumnSortSection.js +0 -33
- package/views/dist/grid/chrome/GridFlyout.d.ts +0 -44
- package/views/dist/grid/chrome/GridFlyout.js +0 -80
- package/views/dist/grid/chrome/GridMenuRow.d.ts +0 -15
- package/views/dist/grid/chrome/GridMenuRow.js +0 -15
- package/views/dist/grid/chrome/grid-menu-search.d.ts +0 -7
- package/views/dist/grid/chrome/grid-menu-search.js +0 -7
- package/views/dist/panels/react/GroupBucketsList.d.ts +0 -16
- package/views/dist/panels/react/GroupBucketsList.js +0 -44
- package/views/dist/panels/react/LayoutColumnsList.d.ts +0 -24
- package/views/dist/panels/react/LayoutColumnsList.js +0 -101
- package/views/dist/panels/react/PopoverColumnDetail.d.ts +0 -11
- package/views/dist/panels/react/PopoverColumnDetail.js +0 -24
- package/views/dist/panels/react/drag.d.ts +0 -2
- package/views/dist/panels/react/drag.js +0 -5
- package/views/dist/panels/react/layout-detail.d.ts +0 -4
- package/views/dist/panels/react/layout-detail.js +0 -29
- package/views/dist/panels/react/root-list.d.ts +0 -6
- package/views/dist/panels/react/root-list.js +0 -31
- package/views/dist/panels/react/sort/use-sort-drag.d.ts +0 -17
- package/views/dist/panels/react/sort/use-sort-drag.js +0 -39
- package/views/dist/panels/react/view-footer.d.ts +0 -20
- package/views/dist/panels/react/view-footer.js +0 -41
|
@@ -4,11 +4,11 @@ import { useEffect, useRef } from "react";
|
|
|
4
4
|
import { canGroupAt, nodeAt } from "../../../filters/filter-tree.js";
|
|
5
5
|
import { useViews } from "../../../provider/context.js";
|
|
6
6
|
import { drawsUnnamedValue } from "../../labels.js";
|
|
7
|
-
import {
|
|
7
|
+
import { listedFieldsOf, takesValue, withOperator } from "../../settings/filter-groups.js";
|
|
8
8
|
import { barFilterWords } from "../../toolbar/filter-words.js";
|
|
9
9
|
import { fieldOfRule } from "../filter/editor-ctx.js";
|
|
10
10
|
import { FilterFieldList } from "../filter/FilterFieldList.js";
|
|
11
|
-
import { AppFilterPart
|
|
11
|
+
import { AppFilterPart } from "../filter/filter-part-body.js";
|
|
12
12
|
import { FilterValueBody } from "../filter/FilterValueBody.js";
|
|
13
13
|
import { convertBarFilter, pickBarField, writeBarRule } from "./bar-writes.js";
|
|
14
14
|
import { useToolbarPanel } from "./context.js";
|
|
@@ -57,10 +57,8 @@ export function ToolbarBarFilter({ ctx, at, rule, open, onOpenChange, foldedAt,
|
|
|
57
57
|
asked.current.add(askKey);
|
|
58
58
|
ask();
|
|
59
59
|
});
|
|
60
|
-
const ways = field ? filterWaysOf(field, conventions) : [];
|
|
61
60
|
const actions = messages({ key: "views.panels.filter-rule-actions", values: { label: words.field } });
|
|
62
61
|
const More = icons.more;
|
|
63
|
-
const partBody = useFilterPartBody();
|
|
64
62
|
const anchorOf = (part) => foldedAt ?? boxes[part];
|
|
65
63
|
const press = (part) => ({
|
|
66
64
|
onPointerDown: () => {
|
|
@@ -86,21 +84,11 @@ export function ToolbarBarFilter({ ctx, at, rule, open, onOpenChange, foldedAt,
|
|
|
86
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) => {
|
|
87
85
|
done("field");
|
|
88
86
|
pickBarField(ctx, at, rule, picked, far);
|
|
89
|
-
}, onDone: () => done("field") }) }), _jsx(ToolbarButton, { ref: wayBox, icon: null, label: messages({ key: "views.panels.filter-way" }), joined: "middle", popup:
|
|
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) => {
|
|
90
88
|
done("way");
|
|
91
89
|
if (operator !== rule.operator)
|
|
92
90
|
writeBarRule(ctx, at, withOperator(rule, field.type, operator));
|
|
93
|
-
}, onValue: write, onDone: () => done("way") }) })) : (_jsx(
|
|
94
|
-
key: way.value,
|
|
95
|
-
label: way.label,
|
|
96
|
-
checked: way.value === rule.operator,
|
|
97
|
-
separatorBefore: way.value === "is_empty",
|
|
98
|
-
onSelect: () => {
|
|
99
|
-
done("way");
|
|
100
|
-
if (field && way.value !== rule.operator)
|
|
101
|
-
writeBarRule(ctx, at, withOperator(rule, field.type, way.value));
|
|
102
|
-
},
|
|
103
|
-
})) })), 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: partBody && 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, { 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) => {
|
|
104
92
|
if (operator !== rule.operator)
|
|
105
93
|
writeBarRule(ctx, at, withOperator(rule, field.type, operator));
|
|
106
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: [
|
|
@@ -12,5 +12,5 @@ export function ToolbarQuickFilters({ quickFilters, open, onOpenChange, host, ic
|
|
|
12
12
|
return null;
|
|
13
13
|
const Glyph = icons.filterCategory;
|
|
14
14
|
const label = quickFilters.label ?? messages({ key: "views.panels.quick-filters" });
|
|
15
|
-
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 ? null : label, changed: holdStands(quickFilters.hold), open: open, onOpenChange: onOpenChange, host: host, children: ({
|
|
15
|
+
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 ? 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 })) }));
|
|
16
16
|
}
|
|
@@ -4,8 +4,6 @@ import { useViews } from "../../../provider/context.js";
|
|
|
4
4
|
import { drawPanelButton } from "../../panel-button.js";
|
|
5
5
|
import { useToolbarSlot } from "./context.js";
|
|
6
6
|
import { ToolbarButton } from "./ToolbarButton.js";
|
|
7
|
-
const CLEAR_CLASS = "inline-flex h-8 shrink-0 items-center rounded-full px-3 text-sm text-(color:--vk-fg-subtle) transition-colors hover:bg-(color:--vk-hovered) hover:text-(color:--vk-fg) disabled:opacity-50";
|
|
8
|
-
const SAVE_CLASS = "inline-flex h-8 shrink-0 items-center rounded-full border border-(color:--vk-border) px-3 text-sm font-medium text-(color:--vk-fg) transition-colors hover:bg-(color:--vk-hovered) disabled:opacity-50";
|
|
9
7
|
export function ToolbarSave({ view, onClear, }) {
|
|
10
8
|
const views = useViews();
|
|
11
9
|
const { messages } = views;
|
|
@@ -20,7 +18,6 @@ export function ToolbarSave({ view, onClear, }) {
|
|
|
20
18
|
return (_jsxs("span", { "data-slot": "vk-toolbar-save", className: "inline-flex shrink-0 items-center gap-2", children: [_jsx(ToolbarButton, { icon: null, label: clearWord, part: "clear", disabled: pending, onClick: clear, children: clearWord }), view?.canPublish && (_jsx(ToolbarButton, { icon: null, label: saveWord, part: "save", disabled: pending, onClick: view.onPublish, children: saveWord }))] }));
|
|
21
19
|
}
|
|
22
20
|
return (_jsxs("span", { "data-slot": "vk-toolbar-save", className: "inline-flex shrink-0 items-center gap-2", children: [drawPanelButton(views, {
|
|
23
|
-
own: CLEAR_CLASS,
|
|
24
21
|
frame: "h-8 px-3",
|
|
25
22
|
variant: "ghost",
|
|
26
23
|
size: "sm",
|
|
@@ -30,7 +27,6 @@ export function ToolbarSave({ view, onClear, }) {
|
|
|
30
27
|
children: messages({ key: "views.panels.view-clear" }),
|
|
31
28
|
}), view?.canPublish &&
|
|
32
29
|
drawPanelButton(views, {
|
|
33
|
-
own: SAVE_CLASS,
|
|
34
30
|
frame: "h-8 px-3",
|
|
35
31
|
variant: "outline",
|
|
36
32
|
size: "sm",
|
|
@@ -71,7 +71,6 @@ export function ToolbarSearch({ value, onChange, placeholder, searching = false,
|
|
|
71
71
|
event.preventDefault();
|
|
72
72
|
clear();
|
|
73
73
|
}, className: cx("h-9 w-full min-w-0 rounded-full bg-transparent pl-9 outline-none", desktop ? "text-sm" : "text-base", withClose ? "pr-9" : "pr-3", "[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none") }), withClose && (drawPanelButton(views, {
|
|
74
|
-
own: "absolute right-1.5 top-1/2 inline-flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded-full text-(color:--vk-fg-subtlest) transition-colors hover:bg-(color:--vk-hovered) hover:text-(color:--vk-fg)",
|
|
75
74
|
frame: "absolute right-1.5 top-1/2 h-6 w-6 -translate-y-1/2",
|
|
76
75
|
variant: "ghost",
|
|
77
76
|
size: "icon",
|
|
@@ -4,7 +4,7 @@ import { useRef, useState } from "react";
|
|
|
4
4
|
import { useViews } from "../../../provider/context.js";
|
|
5
5
|
import { addSortRule, canAddSortRule, isSortRulesActive, openSortPlaces, sortRulesLabel, } from "../../settings/sorts.js";
|
|
6
6
|
import { useSheetDrawsClose, useSheetPanels } from "../panel-sheet.js";
|
|
7
|
-
import {
|
|
7
|
+
import { SortEditorHost, useSortEditorHost } from "../sort/SortEditor.js";
|
|
8
8
|
import { SortFieldList } from "../sort/SortFieldList.js";
|
|
9
9
|
import { useFoldAnchor, useToolbarPanel } from "./context.js";
|
|
10
10
|
import { ToolbarPanelPart } from "./panel-part.js";
|
|
@@ -59,7 +59,7 @@ function ComputerPill({ sorts, open: openIn, onOpenChange: onOpenChangeIn, host:
|
|
|
59
59
|
close();
|
|
60
60
|
},
|
|
61
61
|
};
|
|
62
|
-
const content = opens.what === "editor" ? (_jsx(
|
|
62
|
+
const content = opens.what === "editor" ? (_jsx(SortEditorHost, { sorts: editing, form: "computer", addSort: opens.addSort, onDone: () => close() })) : (_jsx(SortFieldList, { sorts: sorts, onPick: (value) => {
|
|
63
63
|
const next = addSortRule(sorts.rules, value, places);
|
|
64
64
|
sorts.onChange(next);
|
|
65
65
|
close(true, opens.at === "add" && canAddSortRule(next, places));
|
|
@@ -81,7 +81,7 @@ function PhonePill({ sorts, open: openIn, onOpenChange: onOpenChangeIn, host })
|
|
|
81
81
|
const holds = openIn !== undefined && !!onOpenChangeIn;
|
|
82
82
|
const open = holds ? openIn : held;
|
|
83
83
|
const onOpenChange = holds ? onOpenChangeIn : setHeld;
|
|
84
|
-
const editor =
|
|
84
|
+
const editor = useSortEditorHost({ sorts, form: "phone", open, onDone: () => onOpenChange(false) });
|
|
85
85
|
const headDraws = useSheetDrawsClose();
|
|
86
86
|
const Glyph = icons.sort;
|
|
87
87
|
const name = messages({ key: "views.panels.sort" });
|
|
@@ -31,7 +31,6 @@ function ExportCsvRow({ exportCsv }) {
|
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
return drawPanelButton(views, {
|
|
34
|
-
own: cx(ACTION_ROW_CLASS, "hover:bg-(color:--vk-hovered) disabled:pointer-events-none"),
|
|
35
34
|
frame: "h-auto w-full justify-start gap-2.5 px-3 py-2 text-left [font:inherit]",
|
|
36
35
|
variant: "ghost",
|
|
37
36
|
size: "sm",
|
|
@@ -89,19 +89,16 @@ export function FoldingViewRow({ axis, folded: told }) {
|
|
|
89
89
|
const ordered = pills.filter(inBlock).map((pill) => (visibleValues.has(pill.value) ? dealt.shift() : pill.value));
|
|
90
90
|
axis.onReorder(ordered);
|
|
91
91
|
};
|
|
92
|
-
return (_jsxs("div", { ref: hostRef, "data-slot": "vk-views-row", className: isTold ? "relative flex flex-none items-center gap-0.5" : "relative flex min-w-0 flex-1 items-center gap-0.5", children: [_jsx(PillGroup, { value: axis.value, options: shown, onChange: axis.onChange, variant: "plain", onReorder: axis.onReorder ? onPillReorder : undefined, canDrag: axis.canDrag }), folded.length > 0 && _jsx(FoldedViews, { axis: axis, options: foldedOptions }), axis.onCreate && _jsx(ViewCreatePill, { label: axis.createLabel, onClick: axis.onCreate }), !isTold && (_jsx("div", { "aria-hidden": true, inert: true, className: "pointer-events-none absolute inset-0 overflow-hidden", style: { visibility: "hidden" }, children: _jsxs("div", { ref: measureRef, "data-slot": "vk-views-row", className: "pointer-events-none absolute left-0 top-0 flex items-center gap-0.5 whitespace-nowrap", children: [_jsx("div", { "data-measure-pills": true, className: "contents", children: _jsx(PillGroup, { value: axis.value, options: pills, onChange: () => { }, variant: "plain" }) }), inFrame ? (_jsx("span", { "data-measure-more": true, className: "inline-flex", children: _jsx(MoreButton, { count: 99 }) })) :
|
|
93
|
-
own: MORE_CHIP_CLASS,
|
|
92
|
+
return (_jsxs("div", { ref: hostRef, "data-slot": "vk-views-row", className: isTold ? "relative flex flex-none items-center gap-0.5" : "relative flex min-w-0 flex-1 items-center gap-0.5", children: [_jsx(PillGroup, { value: axis.value, options: shown, onChange: axis.onChange, variant: "plain", onReorder: axis.onReorder ? onPillReorder : undefined, canDrag: axis.canDrag }), folded.length > 0 && _jsx(FoldedViews, { axis: axis, options: foldedOptions }), axis.onCreate && _jsx(ViewCreatePill, { label: axis.createLabel, onClick: axis.onCreate }), !isTold && (_jsx("div", { "aria-hidden": true, inert: true, className: "pointer-events-none absolute inset-0 overflow-hidden", style: { visibility: "hidden" }, children: _jsxs("div", { ref: measureRef, "data-slot": "vk-views-row", className: "pointer-events-none absolute left-0 top-0 flex items-center gap-0.5 whitespace-nowrap", children: [_jsx("div", { "data-measure-pills": true, className: "contents", children: _jsx(PillGroup, { value: axis.value, options: pills, onChange: () => { }, variant: "plain" }) }), inFrame ? (_jsx("span", { "data-measure-more": true, className: "inline-flex", children: _jsx(MoreButton, { count: 99 }) })) : (_jsx("span", { "data-measure-more": true, className: "inline-flex", children: drawPanelButton(views, {
|
|
94
93
|
frame: MORE_CHIP_FRAME,
|
|
95
94
|
variant: "ghost",
|
|
96
95
|
size: "sm",
|
|
97
96
|
"data-slot": "vk-views-more",
|
|
98
|
-
children:
|
|
99
|
-
}) }))
|
|
97
|
+
children: moreChipInner(views, 99),
|
|
98
|
+
}) })), axis.onCreate && (_jsx("span", { "data-measure-ghost": true, children: _jsx(ViewCreatePill, { label: axis.createLabel, onClick: () => { } }) }))] }) }))] }));
|
|
100
99
|
}
|
|
101
|
-
const MORE_CHIP_CLASS = "inline-flex h-8 shrink-0 items-center gap-0.5 whitespace-nowrap rounded-full px-2.5 text-sm font-medium text-(color:--vk-fg-subtle) transition-colors duration-(--vk-duration,150ms) hover:bg-(color:--vk-hovered) hover:text-(color:--vk-fg) data-[state=open]:bg-(color:--vk-pressed) data-[state=open]:text-(color:--vk-fg)";
|
|
102
100
|
const MORE_CHIP_FRAME = "h-8 shrink-0 gap-0.5 whitespace-nowrap px-2.5";
|
|
103
|
-
function
|
|
104
|
-
const { conventions, icons } = useViews();
|
|
101
|
+
function moreChipInner({ conventions, icons }, count) {
|
|
105
102
|
const Chevron = icons.chevronDown;
|
|
106
103
|
return (_jsxs(_Fragment, { children: ["+", formatCount(count, conventions), _jsx(Chevron, { className: "h-3.5 w-3.5 shrink-0 opacity-70" })] }));
|
|
107
104
|
}
|
|
@@ -117,7 +114,6 @@ function FoldedViews({ axis, options, }) {
|
|
|
117
114
|
const toggle = useAnchoredToggle(anchor);
|
|
118
115
|
const inFrame = useViewsRowInFrame();
|
|
119
116
|
return (_jsxs(_Fragment, { children: [inFrame ? (_jsx(MoreButton, { count: options.length, ref: anchor, open: toggle.open, onPointerDown: toggle.triggerProps.onPointerDown, onClick: toggle.triggerProps.onClick })) : (_jsx(PanelButton, { views: views, draw: {
|
|
120
|
-
own: MORE_CHIP_CLASS,
|
|
121
117
|
frame: MORE_CHIP_FRAME,
|
|
122
118
|
variant: "ghost",
|
|
123
119
|
size: "sm",
|
|
@@ -129,7 +125,7 @@ function FoldedViews({ axis, options, }) {
|
|
|
129
125
|
"data-state": toggle.open ? "open" : "closed",
|
|
130
126
|
onPointerDown: toggle.triggerProps.onPointerDown,
|
|
131
127
|
onClick: toggle.triggerProps.onClick,
|
|
132
|
-
children:
|
|
128
|
+
children: moreChipInner(views, options.length),
|
|
133
129
|
} })), _jsx(Popover, { open: toggle.open, onOpenChange: toggle.onOpenChange, anchor: anchor, align: "start", sideOffset: 6, chrome: "menu", className: "w-64", children: _jsx("div", { role: "listbox", "aria-label": messages({ key: "views.panels.views-more-list" }), className: VIEWS_LIST_CLASS, children: options.map((option) => (_jsx(ViewPickerRow, { option: option, active: option.value === axis.value, hideCounts: axis.hideCounts, onSelect: () => {
|
|
134
130
|
axis.onChange(option.value);
|
|
135
131
|
toggle.close();
|
|
@@ -15,7 +15,6 @@ export function ViewCreatePill({ label, onClick, size = "default", className, })
|
|
|
15
15
|
return (_jsx(ToolbarButton, { icon: _jsx(Add, { className: "h-3.5 w-3.5 shrink-0" }), label: name, word: null, part: "views-add", size: size === "sm" ? "sm" : undefined, onClick: onClick }));
|
|
16
16
|
}
|
|
17
17
|
return drawPanelButton(views, {
|
|
18
|
-
own: cx("inline-flex shrink-0 items-center justify-center rounded-full text-(color:--vk-fg-subtle) transition-colors duration-(--vk-duration,150ms) hover:bg-(color:--vk-hovered) hover:text-(color:--vk-fg)", size === "sm" ? "h-6 w-6" : "h-8 w-8", className),
|
|
19
18
|
frame: cx("shrink-0", size === "sm" ? "h-6 w-6" : "h-8 w-8", className),
|
|
20
19
|
variant: "ghost",
|
|
21
20
|
size: "icon",
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx,
|
|
3
|
-
import { useCallback,
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useRef } 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";
|
|
7
|
-
import { VIEWS_LIST_CLASS, VIEWS_LIST_LABEL_CLASS, VIEWS_LIST_SEPARATOR_CLASS } from "./menu-classes.js";
|
|
8
7
|
import { viewsListOrderFits, viewsListPickFits, } from "../../views-row/model.js";
|
|
9
8
|
import { PanelButton } from "../../panel-button.js";
|
|
10
9
|
import { PanelSheet, useSheetDrawsClose, useSheetPanels } from "../panel-sheet.js";
|
|
@@ -13,55 +12,31 @@ import { useAnchoredToggle } from "./use-anchored-toggle.js";
|
|
|
13
12
|
import { ToolbarButton } from "../toolbar/ToolbarButton.js";
|
|
14
13
|
import { useViewsRowInFrame } from "./in-frame.js";
|
|
15
14
|
import { ViewCreatePill } from "./ViewCreatePill.js";
|
|
16
|
-
import { ViewPickerRow } from "./ViewPickerRow.js";
|
|
17
|
-
const SEARCH_FROM = 6;
|
|
18
15
|
export function ViewPicker({ axis, className }) {
|
|
19
16
|
const context = useViews();
|
|
20
|
-
const {
|
|
17
|
+
const { components, conventions, icons, messages } = context;
|
|
21
18
|
const { AppIcon, Popover, ViewsListBody } = components;
|
|
22
19
|
const Chevron = icons.chevronDown;
|
|
23
|
-
const Add = icons.add;
|
|
24
20
|
const anchor = useRef(null);
|
|
25
21
|
const toggle = useAnchoredToggle(anchor);
|
|
26
22
|
const inFrame = useViewsRowInFrame();
|
|
27
23
|
const sheet = useSheetPanels();
|
|
28
24
|
const sheetDrawsClose = useSheetDrawsClose();
|
|
29
|
-
const [query, setQuery] = useState("");
|
|
30
25
|
const step = usePanelStep();
|
|
31
26
|
const holding = useRef(false);
|
|
32
27
|
const onHold = useCallback((on) => {
|
|
33
28
|
holding.current = on;
|
|
34
29
|
}, []);
|
|
35
30
|
const active = axis.options.find((option) => option.value === axis.value);
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
const seen = q ? axis.options.filter((o) => o.label.toLowerCase().includes(q)) : axis.options;
|
|
39
|
-
return {
|
|
40
|
-
shared: seen.filter((o) => !o.private),
|
|
41
|
-
personal: seen.filter((o) => o.private),
|
|
42
|
-
};
|
|
43
|
-
}, [axis.options, query]);
|
|
44
|
-
const onOpenChange = (next, details) => {
|
|
45
|
-
toggle.onOpenChange(next, details);
|
|
46
|
-
if (!next)
|
|
47
|
-
setQuery("");
|
|
48
|
-
};
|
|
49
|
-
const close = () => {
|
|
50
|
-
toggle.close();
|
|
51
|
-
setQuery("");
|
|
52
|
-
};
|
|
53
|
-
const pick = (option) => {
|
|
54
|
-
axis.onChange(option.value);
|
|
55
|
-
close();
|
|
56
|
-
};
|
|
31
|
+
const onOpenChange = toggle.onOpenChange;
|
|
32
|
+
const close = toggle.close;
|
|
57
33
|
if (axis.options.length === 0) {
|
|
58
34
|
return axis.onCreate ? _jsx(ViewCreatePill, { label: axis.createLabel, onClick: axis.onCreate, className: className }) : null;
|
|
59
35
|
}
|
|
60
|
-
const rows = (views) => views.map((option) => (_jsx(ViewPickerRow, { option: option, active: option.value === axis.value, onSelect: () => pick(option), hideCounts: axis.hideCounts }, option.value)));
|
|
61
36
|
const { onCreate, onReorder } = axis;
|
|
62
37
|
const listLabel = messages({ key: "views.panels.views-list" });
|
|
63
38
|
const createLabel = axis.createLabel ?? messages({ key: "views.panels.view-create" });
|
|
64
|
-
const list =
|
|
39
|
+
const list = (_jsx(ViewsListBody, { label: listLabel, views: axis.options.map((option) => ({
|
|
65
40
|
value: option.value,
|
|
66
41
|
label: option.label,
|
|
67
42
|
...(option.icon !== undefined && { icon: option.icon }),
|
|
@@ -92,21 +67,12 @@ export function ViewPicker({ axis, className }) {
|
|
|
92
67
|
close: { label: messages({ key: "views.panels.close" }), onPress: close },
|
|
93
68
|
...(step.back && { back: { label: messages({ key: "views.panels.back" }), onPress: step.back } }),
|
|
94
69
|
},
|
|
95
|
-
}) }))
|
|
96
|
-
key: "views.panels.view-create-row",
|
|
97
|
-
values: { label: axis.createLabel ?? messages({ key: "views.panels.view-create" }) },
|
|
98
|
-
}), leading: _jsx(Add, { className: "h-4 w-4 shrink-0 text-(color:--vk-fg-subtle)" }), onClick: () => {
|
|
99
|
-
close();
|
|
100
|
-
axis.onCreate?.();
|
|
101
|
-
} })] }))] })] }));
|
|
70
|
+
}) }));
|
|
102
71
|
const words = (_jsxs(_Fragment, { children: [_jsx("span", { className: "truncate", children: active?.label ?? messages({ key: "views.panels.view-fallback" }) }), active && !axis.hideCounts && typeof active.count === "number" && (_jsxs("span", { className: "font-medium opacity-70 tabular-nums", children: ["\u00B7 ", formatCount(active.count, conventions)] }))] }));
|
|
103
72
|
const onChipClick = (event) => {
|
|
104
73
|
toggle.triggerProps.onClick(event);
|
|
105
|
-
if (toggle.open)
|
|
106
|
-
setQuery("");
|
|
107
74
|
};
|
|
108
75
|
return (_jsxs(_Fragment, { children: [inFrame ? (_jsx(ToolbarButton, { ref: anchor, icon: active?.icon ? _jsx(AppIcon, { name: active.icon, className: "h-3.5 w-3.5 shrink-0" }) : null, label: messages({ key: "views.panels.view-change" }), part: "views-chip", popup: "dialog", open: toggle.open, onPointerDown: toggle.triggerProps.onPointerDown, onClick: onChipClick, children: words })) : (_jsx(PanelButton, { views: context, draw: {
|
|
109
|
-
own: cx("inline-flex h-8 max-w-full items-center gap-1.5 rounded-full bg-(color:--vk-selected,var(--vk-neutral)) pl-2.5 pr-2.5 text-sm font-medium text-(color:--vk-fg) transition-colors duration-(--vk-duration,150ms) data-[state=open]:bg-(color:--vk-pressed)", className),
|
|
110
76
|
frame: cx("h-8 max-w-full gap-1.5 px-2.5", className),
|
|
111
77
|
variant: "secondary",
|
|
112
78
|
size: "sm",
|
|
@@ -121,8 +87,6 @@ export function ViewPicker({ axis, className }) {
|
|
|
121
87
|
children: (_jsxs(_Fragment, { children: [active?.icon && _jsx(AppIcon, { name: active.icon, className: "h-3.5 w-3.5 shrink-0" }), words, _jsx(Chevron, { className: "h-3.5 w-3.5 shrink-0 opacity-60" })] })),
|
|
122
88
|
} })), sheet ? (_jsx(PanelSheet, { open: toggle.open, onOpenChange: (next) => {
|
|
123
89
|
toggle.setOpen(next);
|
|
124
|
-
if (!next)
|
|
125
|
-
setQuery("");
|
|
126
90
|
}, title: messages({ key: "views.panels.views-list" }), snap: "auto", ...(step.title !== undefined && { sheetTitle: step.title || listLabel, headed: !sheetDrawsClose }), ...(step.back &&
|
|
127
91
|
sheetDrawsClose && {
|
|
128
92
|
actions: {
|
|
@@ -18,7 +18,6 @@ export function ViewPickerRow({ option, active, onSelect, hideCounts, }) {
|
|
|
18
18
|
const toggle = useAnchoredToggle(anchor);
|
|
19
19
|
const count = !hideCounts && typeof option.count === "number" ? option.count : null;
|
|
20
20
|
return (_jsxs("div", { className: cx("group flex items-center rounded-lg transition-colors", active ? "bg-(color:--vk-neutral)" : "hover:bg-(color:--vk-hovered)"), children: [drawPanelButton(views, {
|
|
21
|
-
own: "flex h-8 min-w-0 flex-1 items-center gap-2.5 px-2 text-left text-sm",
|
|
22
21
|
frame: "h-8 min-w-0 flex-1 justify-start gap-2.5 px-2 text-left text-sm font-normal",
|
|
23
22
|
variant: "ghost",
|
|
24
23
|
size: "sm",
|
|
@@ -27,7 +26,6 @@ export function ViewPickerRow({ option, active, onSelect, hideCounts, }) {
|
|
|
27
26
|
onClick: onSelect,
|
|
28
27
|
children: (_jsxs(_Fragment, { children: [option.icon && (_jsx(AppIcon, { name: option.icon, className: cx("h-4 w-4 shrink-0", active ? "text-(color:--vk-fg)" : "text-(color:--vk-fg-subtle)") })), _jsx("span", { className: cx("min-w-0 flex-1 truncate", active && "[-webkit-text-stroke:var(--vk-selected-stroke,0.4px)_currentColor]"), children: option.label }), option.private && _jsx(Lock, { className: "h-3 w-3 shrink-0 text-(color:--vk-fg-subtle) opacity-70" }), count !== null && _jsx("span", { className: "shrink-0 text-xs tabular-nums text-(color:--vk-fg-subtle)", children: formatCount(count, conventions) })] })),
|
|
29
28
|
}), option.menu?.length ? (_jsxs(_Fragment, { children: [drawPanelButton(views, {
|
|
30
|
-
own: "mr-1 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-(color:--vk-fg-subtle) transition-opacity hover:text-(color:--vk-fg) data-desktop:opacity-0 data-desktop:group-hover:opacity-100 data-desktop:group-focus-within:opacity-100 data-[state=open]:text-(color:--vk-fg) data-desktop:data-[state=open]:opacity-100",
|
|
31
29
|
frame: "h-6 w-6",
|
|
32
30
|
variant: "ghost",
|
|
33
31
|
size: "icon",
|
|
@@ -1,6 +1,2 @@
|
|
|
1
1
|
/** The list's own inset, a panel's (`--vk-panel-padding`, 6px undeclared), as a menu's. */
|
|
2
2
|
export declare const VIEWS_LIST_CLASS = "p-(--vk-panel-padding,0.375rem)";
|
|
3
|
-
/** A heading over a run of rows: Shared, Personal. */
|
|
4
|
-
export declare const VIEWS_LIST_LABEL_CLASS = "px-2 py-1.5 text-xs font-semibold text-(color:--vk-fg-subtle)";
|
|
5
|
-
/** The hairline between two runs of rows, 6px off the row on either side. */
|
|
6
|
-
export declare const VIEWS_LIST_SEPARATOR_CLASS = "-mx-1 my-1.5 h-px bg-(color:--vk-border)";
|
|
@@ -17,18 +17,12 @@ export type { DateFilterEditor } from "./filter/DateFilterBody.js";
|
|
|
17
17
|
export { DateFilterCalendar } from "./filter/DateFilterCalendar.js";
|
|
18
18
|
export type { DateFilterEditingEnd } from "./filter/DateFilterCalendar.js";
|
|
19
19
|
export { FilterIcon } from "./filter/FilterIcon.js";
|
|
20
|
-
export { CompactFilterList, FilterSectionHeading
|
|
21
|
-
export { CompactDateRangeDetail, CompactFilterDetail
|
|
20
|
+
export { CompactFilterList, FilterSectionHeading } from "./filter/filter-list.js";
|
|
21
|
+
export { CompactDateRangeDetail, CompactFilterDetail } from "./filter/details.js";
|
|
22
22
|
export { CompactTimeScopeDetail } from "./filter/TimeScopeDetail.js";
|
|
23
23
|
export type { PanelFieldEditor } from "./react/field-editor.js";
|
|
24
|
-
export {
|
|
25
|
-
export { LayoutColumnsList } from "./react/LayoutColumnsList.js";
|
|
26
|
-
export { CompactGroupByDetail, CompactGroupDateByDetail, CompactGroupDetail, CompactGroupSortDetail, CompactSortDetail, } from "./react/order-details.js";
|
|
27
|
-
export { CompactLayoutDetail } from "./react/layout-detail.js";
|
|
28
|
-
export { PopoverColumnDetail } from "./react/PopoverColumnDetail.js";
|
|
24
|
+
export { CompactSortDetail } from "./react/order-details.js";
|
|
29
25
|
export { ViewOptionsPanelContent } from "./react/customize.js";
|
|
30
|
-
export { PopoverRootList } from "./react/root-list.js";
|
|
31
|
-
export { ViewFooter } from "./react/view-footer.js";
|
|
32
26
|
export { ViewOptionsActions } from "./react/view-actions.js";
|
|
33
27
|
export { ViewOptionsPopoverPanel, keepPanelOpenForPortals, useViewActivePanel, useViewOptionsPopover, viewOptionsPopoverClassName, } from "./react/popover.js";
|
|
34
28
|
export type { ViewOptionsPopoverState } from "./react/popover.js";
|
|
@@ -44,7 +38,7 @@ export { ToolbarViews } from "./react/toolbar/ToolbarViews.js";
|
|
|
44
38
|
export { ToolbarOptions } from "./react/toolbar/ToolbarOptions.js";
|
|
45
39
|
export { ToolbarSort } from "./react/toolbar/ToolbarSort.js";
|
|
46
40
|
export { ToolbarSortPill } from "./react/toolbar/ToolbarSortPill.js";
|
|
47
|
-
export {
|
|
41
|
+
export { SortEditorHost, useSortEditorHost, type SortEditorOptions } from "./react/sort/SortEditor.js";
|
|
48
42
|
export { SortFieldList } from "./react/sort/SortFieldList.js";
|
|
49
43
|
export { ToolbarQuickFilters } from "./react/toolbar/ToolbarQuickFilters.js";
|
|
50
44
|
export { QuickFiltersPanel } from "./react/quick/QuickFiltersPanel.js";
|
|
@@ -53,8 +47,7 @@ export { ToolbarAdvancedFilters } from "./react/toolbar/ToolbarAdvancedFilters.j
|
|
|
53
47
|
export { ToolbarFilters, foldableFilters } from "./react/toolbar/ToolbarFilters.js";
|
|
54
48
|
export { ToolbarFilterAdd } from "./react/toolbar/ToolbarFilterAdd.js";
|
|
55
49
|
export type { Pending } from "./react/filter/editor-ctx.js";
|
|
56
|
-
export {
|
|
57
|
-
export { PhoneFilterEditor, usePhoneFilterEditor } from "./react/filter/PhoneFilterEditor.js";
|
|
50
|
+
export { FilterEditorHost } from "./react/filter/FilterEditor.js";
|
|
58
51
|
export { FilterFieldList } from "./react/filter/FilterFieldList.js";
|
|
59
52
|
export { FilterValueBody } from "./react/filter/FilterValueBody.js";
|
|
60
53
|
export { ToolbarFilter } from "./react/toolbar/ToolbarFilter.js";
|
|
@@ -16,17 +16,11 @@ export { DateFilterInput } from "./filter/DateFilterInput.js";
|
|
|
16
16
|
export { DateFilterBody, DateFilterFields, useDateFilterEditor } from "./filter/DateFilterBody.js";
|
|
17
17
|
export { DateFilterCalendar } from "./filter/DateFilterCalendar.js";
|
|
18
18
|
export { FilterIcon } from "./filter/FilterIcon.js";
|
|
19
|
-
export { CompactFilterList, FilterSectionHeading
|
|
20
|
-
export { CompactDateRangeDetail, CompactFilterDetail
|
|
19
|
+
export { CompactFilterList, FilterSectionHeading } from "./filter/filter-list.js";
|
|
20
|
+
export { CompactDateRangeDetail, CompactFilterDetail } from "./filter/details.js";
|
|
21
21
|
export { CompactTimeScopeDetail } from "./filter/TimeScopeDetail.js";
|
|
22
|
-
export {
|
|
23
|
-
export { LayoutColumnsList } from "./react/LayoutColumnsList.js";
|
|
24
|
-
export { CompactGroupByDetail, CompactGroupDateByDetail, CompactGroupDetail, CompactGroupSortDetail, CompactSortDetail, } from "./react/order-details.js";
|
|
25
|
-
export { CompactLayoutDetail } from "./react/layout-detail.js";
|
|
26
|
-
export { PopoverColumnDetail } from "./react/PopoverColumnDetail.js";
|
|
22
|
+
export { CompactSortDetail } from "./react/order-details.js";
|
|
27
23
|
export { ViewOptionsPanelContent } from "./react/customize.js";
|
|
28
|
-
export { PopoverRootList } from "./react/root-list.js";
|
|
29
|
-
export { ViewFooter } from "./react/view-footer.js";
|
|
30
24
|
export { ViewOptionsActions } from "./react/view-actions.js";
|
|
31
25
|
export { ViewOptionsPopoverPanel, keepPanelOpenForPortals, useViewActivePanel, useViewOptionsPopover, viewOptionsPopoverClassName, } from "./react/popover.js";
|
|
32
26
|
export { Toolbar, ToolbarSeparator } from "./react/toolbar/Toolbar.js";
|
|
@@ -39,7 +33,7 @@ export { ToolbarViews } from "./react/toolbar/ToolbarViews.js";
|
|
|
39
33
|
export { ToolbarOptions } from "./react/toolbar/ToolbarOptions.js";
|
|
40
34
|
export { ToolbarSort } from "./react/toolbar/ToolbarSort.js";
|
|
41
35
|
export { ToolbarSortPill } from "./react/toolbar/ToolbarSortPill.js";
|
|
42
|
-
export {
|
|
36
|
+
export { SortEditorHost, useSortEditorHost } from "./react/sort/SortEditor.js";
|
|
43
37
|
export { SortFieldList } from "./react/sort/SortFieldList.js";
|
|
44
38
|
export { ToolbarQuickFilters } from "./react/toolbar/ToolbarQuickFilters.js";
|
|
45
39
|
export { QuickFiltersPanel } from "./react/quick/QuickFiltersPanel.js";
|
|
@@ -47,8 +41,7 @@ export { QuickFiltersReminder } from "./react/quick/QuickFiltersReminder.js";
|
|
|
47
41
|
export { ToolbarAdvancedFilters } from "./react/toolbar/ToolbarAdvancedFilters.js";
|
|
48
42
|
export { ToolbarFilters, foldableFilters } from "./react/toolbar/ToolbarFilters.js";
|
|
49
43
|
export { ToolbarFilterAdd } from "./react/toolbar/ToolbarFilterAdd.js";
|
|
50
|
-
export {
|
|
51
|
-
export { PhoneFilterEditor, usePhoneFilterEditor } from "./react/filter/PhoneFilterEditor.js";
|
|
44
|
+
export { FilterEditorHost } from "./react/filter/FilterEditor.js";
|
|
52
45
|
export { FilterFieldList } from "./react/filter/FilterFieldList.js";
|
|
53
46
|
export { FilterValueBody } from "./react/filter/FilterValueBody.js";
|
|
54
47
|
export { ToolbarFilter } from "./react/toolbar/ToolbarFilter.js";
|
|
@@ -3,11 +3,10 @@ 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 { ViewsComponents, ViewsDatePicks,
|
|
6
|
+
import type { ViewsComponents, ViewsDatePicks, ViewsSelectionBarSettings, 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";
|
|
10
|
-
import type { ViewsBodyFrame, ViewsGridBodyPlace } from "../model/body-frame.js";
|
|
11
10
|
import type { ViewsSeveralValues } from "../display/fit-values.js";
|
|
12
11
|
import { type ViewsPorts } from "./ports.js";
|
|
13
12
|
export { useViews, type ViewsContextValue } from "./context.js";
|
|
@@ -42,54 +41,11 @@ export type ViewsProviderProps = {
|
|
|
42
41
|
* list holding one value (`list`: one line, no label, no main mark, no line to add another), in the grid and in a
|
|
43
42
|
* field row alike. It writes the same string the text box writes. Pass a module-level object. */
|
|
44
43
|
oneValue?: ViewsOneValueEditors;
|
|
45
|
-
/** The grid says, through the toast port's `error`, why your app refused an edit it sent. Default false:
|
|
46
|
-
* your app says it. */
|
|
47
|
-
sayRefusals?: boolean;
|
|
48
|
-
/** How the grid opens its own menus. `popover` (the default): ViewKit's rows in your `Popover`. `menu`:
|
|
49
|
-
* your `Menu`, handed its rows as data, with the three hints a row may carry (`beside`, `keepOpen`,
|
|
50
|
-
* `detail`). */
|
|
51
|
-
menus?: ViewsMenuRoute;
|
|
52
|
-
/** Who draws the buttons the grid draws itself: a group's fold and ⋯, "+ Add column", a row's ⋯, the name's
|
|
53
|
-
* actions, an action column's buttons and a pick-list cell's ▾. `own` (the default): ViewKit's, as on 0.5.0.
|
|
54
|
-
* `button`: your `Button`, handed the grid's box in `className`, and a ref, `tabIndex`, `aria-haspopup`,
|
|
55
|
-
* `aria-expanded`, `data-slot` and `data-open` to forward to its element. */
|
|
56
|
-
gridButtons?: ViewsGridButtons;
|
|
57
44
|
/** How a cell of several values draws on one line: a multiselect's options, several emails, phones, links or
|
|
58
45
|
* domains, several records, a lookup's names or places. `fit` (the default): as many whole values as fit its
|
|
59
46
|
* width, then a count, following a column resize; the first shows cut when even it doesn't fit. `first`: its
|
|
60
47
|
* first value and a count, at any width, as on 0.5.0. A wrapped row shows three either way. */
|
|
61
48
|
severalValues?: ViewsSeveralValues;
|
|
62
|
-
/** Who draws a yes/no cell's box in the grid (the checkbox style). `own` (the default): ViewKit's tick box in its
|
|
63
|
-
* own button, as on 0.5.0. `checkbox`: your `Checkbox`, the box your rail draws, handed `checked`, the column's
|
|
64
|
-
* name, `tabIndex` -1 and `onCheckedChange`; a cell the grid can't write is handed `readOnly` instead. */
|
|
65
|
-
gridCheckboxes?: ViewsGridCheckboxes;
|
|
66
|
-
/** Who draws a field row's own buttons: its edit target, the verb trigger around a value, the lane's ▾ and rich
|
|
67
|
-
* text's Show more. `own` (the default): ViewKit's, as on 0.5.0. `button`: your `Button`, `ghost`, handed ViewKit's
|
|
68
|
-
* box in `className`, and the edit target a ref and `aria-disabled` while its write is pending. The grid's
|
|
69
|
-
* `gridButtons` doesn't reach a field row. */
|
|
70
|
-
fieldRowButtons?: ViewsFieldRowButtons;
|
|
71
|
-
/** Who draws a field row's yes/no box (the checkbox style). `own` (the default): ViewKit's tick box in its own
|
|
72
|
-
* button, as on 0.5.0. `checkbox`: your `Checkbox`, handed `checked`, the field's name and `onCheckedChange`, and
|
|
73
|
-
* no `tabIndex`, so it stays a Tab stop; a row it can't write is handed `readOnly` instead. */
|
|
74
|
-
fieldRowCheckboxes?: ViewsFieldRowCheckboxes;
|
|
75
|
-
/** Who draws the buttons ViewKit draws itself in the toolbar's panels, the search's ✕ and the views row: a filter's
|
|
76
|
-
* select, a range's presets and its clears, the eyes and new-line marks of the Columns and group lists, a column's
|
|
77
|
-
* opener, Clear all, Reset, show or hide every group, a panel header's back and ✕, Export, Publish, the "+N" chip,
|
|
78
|
-
* the + and the views picker's chip, rows and ⋯. `own` (the default): ViewKit's, as on 0.6.0. `button`: your
|
|
79
|
-
* `Button`, handed ViewKit's box in `className`, the `secondary` variant on the picker's chip, and a ref,
|
|
80
|
-
* `aria-haspopup`, `aria-expanded`, `aria-pressed`, `role`, `aria-selected`, `data-slot`, `data-state` and
|
|
81
|
-
* `data-vs-row` to forward to its element. The `ToolbarButton` atom's parts stay the atom's either way. */
|
|
82
|
-
panelButtons?: ViewsPanelButtons;
|
|
83
|
-
/** Who sets the width and padding of the popover around a whole body your app hands (`Picker`, `PartsBody`,
|
|
84
|
-
* `ValuesBody`, `LinksBody`). `views` (the default): ViewKit's own, as for its own lists. `popover`: none of ViewKit's, so your
|
|
85
|
-
* `Popover` stands at its own width, and the popover carries `data-vk-body` (`picker`, `parts`, `values` or `links`). An
|
|
86
|
-
* editor that draws ViewKit's own body keeps ViewKit's width either way. */
|
|
87
|
-
bodyFrame?: ViewsBodyFrame;
|
|
88
|
-
/** Where a grid editor opens the popover around a whole body your app hands (`Picker`, `DateBody`, `PartsBody`,
|
|
89
|
-
* `ValuesBody`, `LinksBody`) on a computer. `under` (the default): 4px under the cell, as on 0.7.0. `over`: its top on the cell's
|
|
90
|
-
* top, as long text opens. An editor drawing ViewKit's own body stays under the cell either way; a field row and the
|
|
91
|
-
* phone's sheet don't read it. */
|
|
92
|
-
gridBodyPlace?: ViewsGridBodyPlace;
|
|
93
49
|
/** Where the selection bar sits: its bottom, its layer and its classes on the desktop and on the phone,
|
|
94
50
|
* and the media query that makes it the phone's pill. Pass a module-level object. Default: 1rem above
|
|
95
51
|
* the screen's foot, layer 50, the pill wherever `desktopQuery` does not match. */
|
|
@@ -106,4 +62,4 @@ export type ViewsProviderProps = {
|
|
|
106
62
|
now?: Date;
|
|
107
63
|
children: ReactNode;
|
|
108
64
|
};
|
|
109
|
-
export declare function ViewsProvider({ children, components, conventions, icons, ports, atoms, messages, presentation, desktopQuery, sheetActions, escape, oneValue,
|
|
65
|
+
export declare function ViewsProvider({ children, components, conventions, icons, ports, atoms, messages, presentation, desktopQuery, sheetActions, escape, oneValue, severalValues, selectionBar, datePicks, now, }: ViewsProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,17 +6,16 @@ import { DEFAULT_VIEWS_ATOMS } from "../atoms/defaults.js";
|
|
|
6
6
|
import { ViewsContext } from "./context.js";
|
|
7
7
|
import { HasMomentContext, MomentContext } from "./moment.js";
|
|
8
8
|
import { PlainInput } from "./plain-input.js";
|
|
9
|
-
import { missingComponent
|
|
9
|
+
import { missingComponent } 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
12
|
import { browserConfirm, NOOP_TOAST } from "./ports.js";
|
|
13
13
|
export { useViews } from "./context.js";
|
|
14
|
-
const MISSING_COMMAND_PARTS = missingParts("Command");
|
|
15
14
|
const MISSING_CALENDAR_COMPONENT = missingComponent("Calendar");
|
|
16
15
|
const NO_SUBSCRIBE = () => () => { };
|
|
17
16
|
const IN_BROWSER = () => true;
|
|
18
17
|
const ON_SERVER = () => false;
|
|
19
|
-
export function ViewsProvider({ children, components, conventions, icons, ports, atoms, messages = resolveViewsMessage, presentation, desktopQuery = DEFAULT_DESKTOP_QUERY, sheetActions = "bar", escape, oneValue,
|
|
18
|
+
export function ViewsProvider({ children, components, conventions, icons, ports, atoms, messages = resolveViewsMessage, presentation, desktopQuery = DEFAULT_DESKTOP_QUERY, sheetActions = "bar", escape, oneValue, severalValues = "fit", selectionBar, datePicks, now, }) {
|
|
20
19
|
const [readNow, setReadNow] = useState(null);
|
|
21
20
|
useEffect(() => {
|
|
22
21
|
if (now)
|
|
@@ -41,7 +40,6 @@ export function ViewsProvider({ children, components, conventions, icons, ports,
|
|
|
41
40
|
...components,
|
|
42
41
|
Menu: withSettledGroups(components.Menu),
|
|
43
42
|
Input: components.Input ?? PlainInput,
|
|
44
|
-
Command: components.Command ?? MISSING_COMMAND_PARTS,
|
|
45
43
|
Calendar: components.Calendar ?? MISSING_CALENDAR_COMPONENT,
|
|
46
44
|
}), [components]);
|
|
47
45
|
const hosted = useRef({});
|
|
@@ -75,16 +73,7 @@ export function ViewsProvider({ children, components, conventions, icons, ports,
|
|
|
75
73
|
sheetActions,
|
|
76
74
|
escape,
|
|
77
75
|
oneValue,
|
|
78
|
-
sayRefusals,
|
|
79
|
-
menus,
|
|
80
|
-
gridButtons,
|
|
81
76
|
severalValues,
|
|
82
|
-
gridCheckboxes,
|
|
83
|
-
fieldRowButtons,
|
|
84
|
-
fieldRowCheckboxes,
|
|
85
|
-
panelButtons,
|
|
86
|
-
bodyFrame,
|
|
87
|
-
gridBodyPlace,
|
|
88
77
|
selectionBar,
|
|
89
78
|
datePicks,
|
|
90
79
|
}), [
|
|
@@ -102,16 +91,7 @@ export function ViewsProvider({ children, components, conventions, icons, ports,
|
|
|
102
91
|
sheetActions,
|
|
103
92
|
escape,
|
|
104
93
|
oneValue,
|
|
105
|
-
sayRefusals,
|
|
106
|
-
menus,
|
|
107
|
-
gridButtons,
|
|
108
94
|
severalValues,
|
|
109
|
-
gridCheckboxes,
|
|
110
|
-
fieldRowButtons,
|
|
111
|
-
fieldRowCheckboxes,
|
|
112
|
-
panelButtons,
|
|
113
|
-
bodyFrame,
|
|
114
|
-
gridBodyPlace,
|
|
115
95
|
selectionBar,
|
|
116
96
|
datePicks,
|
|
117
97
|
]);
|