viewkitjs 0.33.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +139 -0
- package/package.json +1 -1
- package/views/README.md +1 -1
- package/views/dist/atoms/Avatar.js +2 -1
- package/views/dist/atoms/RelationChip.d.ts +2 -0
- package/views/dist/atoms/RelationChip.js +5 -0
- package/views/dist/atoms/RowMenu.d.ts +1 -1
- package/views/dist/atoms/RowMenu.js +15 -3
- package/views/dist/atoms/defaults.js +2 -0
- package/views/dist/atoms/types.d.ts +40 -4
- package/views/dist/cells/relation-wrap.js +9 -2
- package/views/dist/contract.d.ts +27 -14
- package/views/dist/contract.js +40 -4
- package/views/dist/controls/alert/alert.js +2 -1
- package/views/dist/controls/alert-dialog/alert-dialog.js +3 -2
- package/views/dist/controls/avatar/avatar-mark.d.ts +4 -0
- package/views/dist/controls/avatar/avatar-mark.js +5 -0
- package/views/dist/controls/avatar/avatar.d.ts +7 -4
- package/views/dist/controls/avatar/avatar.js +10 -4
- package/views/dist/controls/avatar/looks.d.ts +1 -1
- package/views/dist/controls/avatar/looks.js +3 -0
- package/views/dist/controls/avatar/record-mark.d.ts +16 -0
- package/views/dist/controls/avatar/record-mark.js +13 -0
- package/views/dist/controls/avatar/tokens.d.ts +12 -0
- package/views/dist/controls/avatar/tokens.js +3 -0
- package/views/dist/controls/avatar.css +54 -17
- package/views/dist/controls/bulk-bar/bulk-bar.js +29 -27
- package/views/dist/controls/bulk-bar/map-selection-bar.js +2 -1
- package/views/dist/controls/compound-editor/compound-editor.d.ts +3 -0
- package/views/dist/controls/compound-editor/map-parts-body.d.ts +1 -1
- package/views/dist/controls/compound-editor/map-parts-body.js +6 -1
- package/views/dist/controls/compound-editor/name-parts.js +2 -1
- package/views/dist/controls/compound-editor/place-parts.js +2 -2
- package/views/dist/controls/compound-editor/range-parts.js +10 -9
- package/views/dist/controls/controls.d.ts +2 -0
- package/views/dist/controls/controls.js +2 -0
- package/views/dist/controls/customize/customize.d.ts +14 -5
- package/views/dist/controls/customize/customize.js +19 -20
- package/views/dist/controls/customize/map-customize-body.d.ts +2 -2
- package/views/dist/controls/customize/map-customize-body.js +15 -13
- package/views/dist/controls/customize/words.d.ts +3 -3
- package/views/dist/controls/date-editor/date-editor.d.ts +3 -0
- package/views/dist/controls/date-editor/date-editor.js +13 -7
- package/views/dist/controls/date-editor/map-calendar.js +2 -0
- package/views/dist/controls/date-editor/map-date-body.d.ts +1 -1
- package/views/dist/controls/date-editor/map-date-body.js +7 -3
- package/views/dist/controls/filter-editor/filter-editor.d.ts +2 -0
- package/views/dist/controls/filter-editor/filter-editor.js +4 -6
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +2 -0
- package/views/dist/controls/filter-editor/map-filter-body.js +7 -4
- package/views/dist/controls/filter-editor/parts.d.ts +4 -2
- package/views/dist/controls/filter-editor/parts.js +8 -7
- package/views/dist/controls/group-editor/group-editor.js +2 -1
- package/views/dist/controls/group-editor/map-group-body.d.ts +1 -0
- package/views/dist/controls/group-editor/map-group-body.js +5 -1
- package/views/dist/controls/index.d.ts +1 -1
- package/views/dist/controls/input/input.js +2 -1
- package/views/dist/controls/internal/head-button.d.ts +9 -0
- package/views/dist/controls/internal/head-button.js +13 -0
- package/views/dist/controls/internal/map-panel-controls.js +9 -5
- package/views/dist/controls/internal/panel-controls.d.ts +38 -6
- package/views/dist/controls/internal/panel-controls.js +191 -19
- package/views/dist/controls/links-editor/links-editor.js +5 -7
- package/views/dist/controls/links-editor/map-links-body.d.ts +1 -1
- package/views/dist/controls/links-editor/map-links-body.js +5 -1
- package/views/dist/controls/menu/menu.d.ts +5 -1
- package/views/dist/controls/menu/menu.js +4 -3
- package/views/dist/controls/modal/modal.js +5 -3
- package/views/dist/controls/number-editor/map-number-body.js +5 -1
- package/views/dist/controls/number-editor/number-editor.js +6 -6
- package/views/dist/controls/pane/map-pane.d.ts +3 -0
- package/views/dist/controls/pane/map-pane.js +5 -0
- package/views/dist/controls/picker/map-fields-body.d.ts +2 -2
- package/views/dist/controls/picker/map-fields-body.js +30 -2
- package/views/dist/controls/picker/map-picker.d.ts +8 -3
- package/views/dist/controls/picker/map-picker.js +14 -3
- package/views/dist/controls/picker/picker.js +11 -8
- package/views/dist/controls/picker/rows.d.ts +7 -2
- package/views/dist/controls/picker.css +10 -1
- package/views/dist/controls/quick-filters/map-quick-filters-body.d.ts +2 -1
- package/views/dist/controls/quick-filters/map-quick-filters-body.js +9 -4
- package/views/dist/controls/quick-filters/quick-filters.js +8 -6
- package/views/dist/controls/quick-filters/reminder.js +2 -2
- package/views/dist/controls/quick-filters/rules.d.ts +4 -1
- package/views/dist/controls/quick-filters/words.d.ts +2 -0
- package/views/dist/controls/quick-filters/words.js +1 -0
- package/views/dist/controls/select/select.d.ts +3 -0
- package/views/dist/controls/select/select.js +9 -3
- package/views/dist/controls/setting-row/looks.js +5 -5
- package/views/dist/controls/setting-row/setting-row.d.ts +3 -1
- package/views/dist/controls/setting-row/setting-row.js +3 -1
- package/views/dist/controls/setting-row.css +3 -2
- package/views/dist/controls/sheet/bottom-sheet.d.ts +3 -1
- package/views/dist/controls/sheet/bottom-sheet.js +2 -2
- package/views/dist/controls/sort-editor/map-sort-body.js +4 -4
- package/views/dist/controls/sort-editor/sort-editor.d.ts +2 -0
- package/views/dist/controls/sort-editor/sort-editor.js +4 -5
- package/views/dist/controls/text-editor/map-text-body.js +5 -1
- package/views/dist/controls/text-editor/text-editor.js +5 -4
- package/views/dist/controls/toolbar/toolbar.d.ts +29 -14
- package/views/dist/controls/toolbar/toolbar.js +17 -22
- package/views/dist/controls/toolbar.css +0 -5
- package/views/dist/controls/tooltip/map-tooltip.d.ts +1 -1
- package/views/dist/controls/tooltip/map-tooltip.js +4 -2
- package/views/dist/controls/values-editor/map-values-body.d.ts +1 -2
- package/views/dist/controls/values-editor/map-values-body.js +5 -1
- package/views/dist/controls/values-editor/values-editor.js +8 -7
- package/views/dist/controls/views-list/map-view-menu.d.ts +3 -2
- package/views/dist/controls/views-list/map-view-menu.js +6 -2
- package/views/dist/controls/views-list/map-views-list-body.d.ts +2 -1
- package/views/dist/controls/views-list/map-views-list-body.js +6 -5
- package/views/dist/controls/views-list/view-menu.js +3 -4
- package/views/dist/controls/views-list/views-list.js +2 -2
- package/views/dist/display/option-badges.d.ts +16 -0
- package/views/dist/display/option-badges.js +11 -0
- package/views/dist/display/relation-link.d.ts +12 -0
- package/views/dist/display/relation-link.js +17 -0
- package/views/dist/display/relation.d.ts +1 -1
- package/views/dist/display/relation.js +10 -3
- package/views/dist/display/select.js +1 -8
- package/views/dist/editors/EditorPanel.js +4 -4
- package/views/dist/editors/RangeEditor.d.ts +3 -0
- package/views/dist/editors/RangeEditor.js +2 -2
- package/views/dist/editors/SelectEditor.d.ts +2 -2
- package/views/dist/editors/SelectEditor.js +1 -1
- package/views/dist/editors/TextEditor.js +4 -2
- package/views/dist/editors/ValueListEditor.js +2 -1
- package/views/dist/field-row/FieldRow.js +32 -5
- package/views/dist/field-row/editors/RowRangeEditor.js +2 -1
- package/views/dist/grid/chrome/GridAddColumn.js +9 -6
- package/views/dist/grid/chrome/GridCellEditors.js +1 -1
- package/views/dist/grid/chrome/GridCellOutline.d.ts +3 -1
- package/views/dist/grid/chrome/GridCellOutline.js +16 -6
- package/views/dist/grid/chrome/GridChipsEditor.js +3 -2
- package/views/dist/grid/chrome/GridColumnMenu.js +7 -4
- package/views/dist/grid/chrome/GridFooter.d.ts +4 -1
- package/views/dist/grid/chrome/GridFooter.js +4 -4
- package/views/dist/grid/chrome/GridGroupMenu.js +39 -14
- package/views/dist/grid/chrome/GridHeader.d.ts +1 -1
- package/views/dist/grid/chrome/GridHeader.js +1 -2
- package/views/dist/grid/chrome/GridRangeEditor.d.ts +4 -1
- package/views/dist/grid/chrome/GridRangeEditor.js +2 -2
- package/views/dist/grid/chrome/GridRow.js +5 -3
- package/views/dist/grid/chrome/GridRowActions.d.ts +4 -1
- package/views/dist/grid/chrome/GridRowActions.js +2 -2
- package/views/dist/grid/chrome/GridRowCells.js +3 -2
- package/views/dist/grid/chrome/GridStructure.js +1 -1
- package/views/dist/grid/chrome/GridTable.js +32 -20
- package/views/dist/grid/chrome/checks.d.ts +1 -1
- package/views/dist/grid/chrome/checks.js +4 -1
- package/views/dist/grid/chrome/grid-cell-classes.d.ts +6 -2
- package/views/dist/grid/chrome/grid-cell-classes.js +10 -5
- package/views/dist/grid/chrome/grid-hover.d.ts +10 -2
- package/views/dist/grid/chrome/grid-hover.js +14 -4
- package/views/dist/grid/chrome/grid-row-props.d.ts +4 -0
- package/views/dist/grid/chrome/grid-rows-menu.js +9 -4
- package/views/dist/grid/chrome/grid-table-props.d.ts +10 -2
- package/views/dist/grid/grid.css +6 -0
- package/views/dist/grid/looks.d.ts +3 -1
- package/views/dist/grid/looks.js +10 -4
- package/views/dist/list/layer.d.ts +8 -0
- package/views/dist/list/layer.js +7 -0
- package/views/dist/list/list.d.ts +6 -2
- package/views/dist/list/list.js +6 -2
- package/views/dist/list/parts.js +3 -2
- package/views/dist/list/store.d.ts +1 -1
- package/views/dist/list/toolbar.js +51 -20
- package/views/dist/list/views.js +1 -0
- package/views/dist/panels/availability.d.ts +5 -0
- package/views/dist/panels/availability.js +4 -5
- package/views/dist/panels/customize-body.d.ts +4 -0
- package/views/dist/panels/customize-body.js +13 -11
- package/views/dist/panels/model.d.ts +9 -4
- package/views/dist/panels/react/customize-body.js +5 -2
- package/views/dist/panels/react/customize.d.ts +5 -0
- package/views/dist/panels/react/filter/FilterEditor.d.ts +6 -0
- package/views/dist/panels/react/filter/FilterEditor.js +7 -0
- package/views/dist/panels/react/quick/QuickFiltersPanel.d.ts +3 -1
- package/views/dist/panels/react/quick/QuickFiltersPanel.js +7 -3
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +17 -1
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +15 -1
- package/views/dist/panels/react/toolbar/Toolbar.js +24 -9
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +3 -2
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.d.ts +6 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +14 -6
- package/views/dist/panels/react/toolbar/ToolbarFilters.d.ts +7 -3
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +21 -10
- package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +6 -1
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +2 -2
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +1 -1
- package/views/dist/panels/react/toolbar/ToolbarSave.d.ts +3 -1
- package/views/dist/panels/react/toolbar/ToolbarSave.js +5 -4
- package/views/dist/panels/react/toolbar/ToolbarSort.d.ts +7 -1
- package/views/dist/panels/react/toolbar/ToolbarSort.js +6 -3
- package/views/dist/panels/react/toolbar/ToolbarSortPill.d.ts +3 -0
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +7 -6
- package/views/dist/panels/react/toolbar/context.d.ts +21 -0
- package/views/dist/panels/react/toolbar/context.js +4 -0
- package/views/dist/panels/react/toolbar/pane-host.d.ts +6 -0
- package/views/dist/panels/react/toolbar/pane-host.js +17 -0
- package/views/dist/panels/react/toolbar/panel-part.js +3 -2
- package/views/dist/panels/react/views-row/ViewPicker.js +13 -5
- package/views/dist/panels/react.d.ts +2 -2
- package/views/dist/panels/settings/layout.js +6 -38
- package/views/dist/panels/toolbar/page-resets.d.ts +17 -0
- package/views/dist/panels/toolbar/page-resets.js +62 -0
- package/views/dist/panels/toolbar/same-item.d.ts +7 -0
- package/views/dist/panels/toolbar/same-item.js +9 -0
- package/views/dist/panels/view-state.d.ts +4 -0
- package/views/dist/provider/ViewsProvider.d.ts +9 -3
- package/views/dist/provider/ViewsProvider.js +13 -2
- package/views/dist/provider/components.d.ts +59 -8
- package/views/dist/provider/components.js +1 -1
- package/views/dist/react.d.ts +2 -2
- package/views/dist/styles.css +194 -100
- package/views/dist/styles.unlayered.css +194 -100
- package/views/docs/contract.md +96 -27
- package/views/docs/controls/alert-dialog.md +4 -0
- package/views/docs/controls/alert.md +4 -0
- package/views/docs/controls/avatar.md +3 -0
- package/views/docs/controls/bulk-bar.md +7 -1
- package/views/docs/controls/compound-editor.md +2 -0
- package/views/docs/controls/customize.md +3 -1
- package/views/docs/controls/date-editor.md +2 -0
- package/views/docs/controls/filter-editor.md +1 -1
- package/views/docs/controls/group-editor.md +2 -0
- package/views/docs/controls/links-editor.md +2 -0
- package/views/docs/controls/menu.md +3 -1
- package/views/docs/controls/modal.md +4 -0
- package/views/docs/controls/number-editor.md +2 -0
- package/views/docs/controls/pane.md +1 -1
- package/views/docs/controls/picker.md +2 -0
- package/views/docs/controls/quick-filters.md +4 -2
- package/views/docs/controls/sheet.md +1 -1
- package/views/docs/controls/text-editor.md +3 -1
- package/views/docs/controls/toolbar.md +4 -0
- package/views/docs/controls/values-editor.md +2 -0
- package/views/docs/controls/views-list.md +2 -0
- package/views/docs/guides/atoms.md +54 -3
- package/views/docs/guides/display.md +1 -1
- package/views/docs/guides/looks.md +1 -1
- package/views/docs/guides/the-grid.md +4 -2
- package/views/docs/guides/the-provider.md +4 -4
- package/views/docs/index.md +2 -2
- package/views/docs/install.md +198 -104
- package/views/docs/reference/controls.md +21 -17
- package/views/docs/reference/editors-range.md +1 -1
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +2 -1
- package/views/docs/reference/list.md +7 -5
- package/views/docs/reference/looks.md +6 -6
- package/views/docs/reference/panels-react.md +17 -15
- package/views/docs/reference/panels.md +4 -4
- package/views/docs/reference/react.md +15 -12
- package/views/docs/reference/views.md +6 -4
- package/views/docs/reshaping.md +32 -5
- package/views/skills/views/SKILL.md +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { layoutStandsOnPhone } from "./availability.js";
|
|
2
2
|
import { offersManualOrder } from "./group-sort.js";
|
|
3
3
|
import { groupOrderFor, } from "./model.js";
|
|
4
4
|
import { columnToggleRefusal, newLineRefusal } from "./react/column-refusals.js";
|
|
@@ -132,7 +132,6 @@ export function customizeToggleOf(toggle) {
|
|
|
132
132
|
value: toggle.value,
|
|
133
133
|
onChange: toggle.onChange,
|
|
134
134
|
...(toggle.icon !== undefined && { icon: toggle.icon }),
|
|
135
|
-
...(toggle.reset && { reset: toggle.reset.onReset }),
|
|
136
135
|
...(toggle.section !== undefined && { section: toggle.section }),
|
|
137
136
|
};
|
|
138
137
|
}
|
|
@@ -143,11 +142,22 @@ const choiceOf = (choice) => ({
|
|
|
143
142
|
options: choice.options,
|
|
144
143
|
onChange: choice.onChange,
|
|
145
144
|
});
|
|
145
|
+
export function layoutOnPhone(layout) {
|
|
146
|
+
if (!layoutStandsOnPhone(layout))
|
|
147
|
+
return null;
|
|
148
|
+
return {
|
|
149
|
+
...layout,
|
|
150
|
+
value: layout.mobileValue ?? layout.value,
|
|
151
|
+
options: layout.mobileOptions ?? layout.options,
|
|
152
|
+
...((layout.mobileRefused ?? layout.refused) && { refused: layout.mobileRefused ?? layout.refused }),
|
|
153
|
+
onChange: layout.onMobileChange ?? layout.onChange,
|
|
154
|
+
...(layout.toggles && { toggles: layout.toggles.filter((toggle) => !toggle.desktopOnly) }),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
146
157
|
export function customizeLayoutOf(layout, messages) {
|
|
147
158
|
const showSub = !layout.subOptionsFor || layout.value === layout.subOptionsFor;
|
|
148
159
|
const density = !layout.densityFor || layout.densityFor.includes(layout.value) ? layout.density : undefined;
|
|
149
160
|
const choices = (layout.choices ?? []).filter((choice) => !choice.views || choice.views.includes(layout.value));
|
|
150
|
-
const personal = resolvePersonalSection(layout, messages);
|
|
151
161
|
return {
|
|
152
162
|
label: layout.label ?? messages({ key: "views.panels.layout" }),
|
|
153
163
|
value: layout.value,
|
|
@@ -168,14 +178,6 @@ export function customizeLayoutOf(layout, messages) {
|
|
|
168
178
|
onChange: density.onChange,
|
|
169
179
|
},
|
|
170
180
|
}),
|
|
171
|
-
...(personal && {
|
|
172
|
-
personal: {
|
|
173
|
-
label: personal.label,
|
|
174
|
-
toggles: personal.toggles.map(customizeToggleOf),
|
|
175
|
-
choices: personal.choices.map(choiceOf),
|
|
176
|
-
...(personal.onReset && { onReset: personal.onReset }),
|
|
177
|
-
},
|
|
178
|
-
}),
|
|
179
181
|
};
|
|
180
182
|
}
|
|
181
183
|
export function columnsBodyWrite(columns, next, messages) {
|
|
@@ -188,8 +188,8 @@ export type ToggleConfig = {
|
|
|
188
188
|
icon?: ReactNode;
|
|
189
189
|
/** Omit controls that only exist on desktop from the mobile sheet. */
|
|
190
190
|
desktopOnly?: boolean;
|
|
191
|
-
/**
|
|
192
|
-
*
|
|
191
|
+
/** @deprecated Read by nothing since a toggle carries no way back of its own in Customize (VK-1033): its Reset is the
|
|
192
|
+
* way back. To be removed in a later release. */
|
|
193
193
|
reset?: {
|
|
194
194
|
onReset: () => void;
|
|
195
195
|
};
|
|
@@ -276,6 +276,8 @@ export type LayoutDensityConfig = {
|
|
|
276
276
|
* and only the heading differs, because the difference that matters is not how
|
|
277
277
|
* a control looks but who feels it. A list with saved views passes this; every
|
|
278
278
|
* other list passes nothing and the section does not exist.
|
|
279
|
+
*
|
|
280
|
+
* @deprecated Read by nothing since Customize's Layout page ends at its toggles (VK-1033). To be removed in a later release.
|
|
279
281
|
*/
|
|
280
282
|
export type LayoutPersonalConfig<V extends string = string> = {
|
|
281
283
|
/** Defaults to "For you". */
|
|
@@ -319,11 +321,14 @@ export type LayoutConfig<V extends string = string> = {
|
|
|
319
321
|
/** Views whose Density section shows. Absent → every view (the pre-board
|
|
320
322
|
* behavior). The board has one card spacing and offers no density. */
|
|
321
323
|
densityFor?: V[];
|
|
322
|
-
/**
|
|
323
|
-
*
|
|
324
|
+
/** @deprecated Read by nothing since Customize's Layout page ends at its toggles (VK-1033); the phone's layout is
|
|
325
|
+
* `mobileValue` and `onMobileChange`, picked in the Layout picker on a phone (VK-900). To be removed in a later release. */
|
|
324
326
|
personal?: LayoutPersonalConfig<V>;
|
|
327
|
+
/** The Layout stands on a computer alone: on a phone it is absent unless it has `mobileValue` and `onMobileChange`. */
|
|
325
328
|
desktopOnly?: boolean;
|
|
329
|
+
/** The phone's own layout, what Customize's Layout picker names on a phone; the computer's (`value`) where absent. */
|
|
326
330
|
mobileValue?: V;
|
|
331
|
+
/** The phone's layout picked, on a phone: written in place of `onChange`, so neither form's pick changes the other's. */
|
|
327
332
|
onMobileChange?(value: V): void;
|
|
328
333
|
/** The views offerable on a PHONE, when they differ from the desktop's.
|
|
329
334
|
* Defaults to `options`. */
|
|
@@ -7,7 +7,7 @@ import { dateRangeValueLabel, filterValueLabel, timeScopeRowValueLabel } from ".
|
|
|
7
7
|
import { isDateRangeActive } from "../model.js";
|
|
8
8
|
import { FilterIcon } from "../filter/FilterIcon.js";
|
|
9
9
|
import { useViews } from "../../provider/context.js";
|
|
10
|
-
import { activePanelOf, customizeColumnsOf, customizeLayoutOf, customizePageOf, customizeSortOf, customizeToggleOf, groupBodyProps, } from "../customize-body.js";
|
|
10
|
+
import { activePanelOf, customizeColumnsOf, customizeLayoutOf, customizePageOf, customizeSortOf, customizeToggleOf, groupBodyProps, layoutOnPhone, } from "../customize-body.js";
|
|
11
11
|
import { filterBodyChangeFits, listedFieldsOf, takesValue } from "../settings/filter-groups.js";
|
|
12
12
|
import { sortBodyOptions } from "../sort-body-options.js";
|
|
13
13
|
import { PanelStepHold } from "./panel-step.js";
|
|
@@ -85,7 +85,8 @@ export function customizeFieldsOf(props, { icons, messages, conventions }) {
|
|
|
85
85
|
return items.length ? { folded: props.foldFilters ?? true, items } : undefined;
|
|
86
86
|
}
|
|
87
87
|
export function customizeBodyPropsOf(props, { components, icons, messages, conventions }) {
|
|
88
|
-
const { layout, filterTree, group, toggles, activePanel, onOpenPanel, anyActive, clearAll, onClose, closeButton = true, view, viewFoot, footClear, fieldEditor, form, viewName, onRenameView, onCopyLink, onExport, exportCount, } = props;
|
|
88
|
+
const { layout: handed, filterTree, group, toggles, activePanel, onOpenPanel, anyActive, clearAll, onClose, closeButton = true, view, viewFoot, footClear, resets, layered, fieldEditor, form, viewName, onRenameView, onCopyLink, onExport, exportCount, } = props;
|
|
89
|
+
const layout = handed && (form === "phone" ? layoutOnPhone(handed) : handed);
|
|
89
90
|
const columns = layout ? customizeColumnsOf(layout, fieldEditor, messages) : undefined;
|
|
90
91
|
const fields = customizeFieldsOf(props, { icons, messages, conventions });
|
|
91
92
|
const unmarked = customizeSortOf(props, messages);
|
|
@@ -113,10 +114,12 @@ export function customizeBodyPropsOf(props, { components, icons, messages, conve
|
|
|
113
114
|
onReset: view.onReset,
|
|
114
115
|
onPublish: view.onPublish,
|
|
115
116
|
...(view.own && { own: true }),
|
|
117
|
+
...(layered && { layered: true }),
|
|
116
118
|
},
|
|
117
119
|
}),
|
|
118
120
|
...(viewFoot && { foot: viewFoot }),
|
|
119
121
|
...(!view && footClear && { onClear: footClear }),
|
|
122
|
+
...(resets && { resets }),
|
|
120
123
|
...(!view && anyActive && { clearAll }),
|
|
121
124
|
form,
|
|
122
125
|
onDone: onClose ?? (() => undefined),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CustomizePage } from "../toolbar/page-resets.js";
|
|
1
2
|
import type { ActivePanel, ViewOptionInputs } from "../model.js";
|
|
2
3
|
import type { CollectionViewState } from "../view-state.js";
|
|
3
4
|
import type { PanelFieldEditor } from "./field-editor.js";
|
|
@@ -15,6 +16,10 @@ export type ViewOptionsPanelContentProps<S extends string = string, G extends st
|
|
|
15
16
|
viewFoot?: "kit" | "none";
|
|
16
17
|
/** With no shared view, the foot's Clear, taking the list back to its default; absent, no foot. */
|
|
17
18
|
footClear?: () => void;
|
|
19
|
+
/** Each Customize page's own Reset, while that page differs (VK-1034): handed to the body as `resets`. */
|
|
20
|
+
resets?: Partial<Record<CustomizePage, () => void>>;
|
|
21
|
+
/** The reader's own layer holds something: handed to the body's `view.layered` (VK-1034). */
|
|
22
|
+
layered?: boolean;
|
|
18
23
|
/** The body's `fields` folded behind one Filter row (list pages); off, each is a row of its own (dashboards). */
|
|
19
24
|
foldFilters?: boolean;
|
|
20
25
|
/** Dismisses the whole panel: the body's `onDone`, and on a phone its ✕. */
|
|
@@ -8,3 +8,9 @@ export declare function FilterEditorHost({ filterTree, at, onDone, onRemoved, }:
|
|
|
8
8
|
/** A delete took a node away: the outermost one that went, so the pills' keys follow. */
|
|
9
9
|
onRemoved?: (removed: FilterPath) => void;
|
|
10
10
|
}): ReactNode;
|
|
11
|
+
/** The whole filter on a computer (VK-1047): what the row's Filter opens, the app's own `FilterBody` on every rule of the
|
|
12
|
+
* view, edited in place as the phone's Filter and Customize's Filter edit it, Add filter under the rules. */
|
|
13
|
+
export declare function WholeFilterEditor({ filterTree, onDone }: {
|
|
14
|
+
filterTree: FilterTreeConfig;
|
|
15
|
+
onDone?: () => void;
|
|
16
|
+
}): ReactNode;
|
|
@@ -18,3 +18,10 @@ export function FilterEditorHost({ filterTree, at, onDone, onRemoved, }) {
|
|
|
18
18
|
const ownGroup = at.length > 0;
|
|
19
19
|
return (_jsx(AppFilterBody, { ctx: ctx, level: group, relation: relation, excludable: ownGroup && !relation, label: filterTree.label ?? messages({ key: "views.panels.advanced-filter" }), onDone: onDone }));
|
|
20
20
|
}
|
|
21
|
+
export function WholeFilterEditor({ filterTree, onDone }) {
|
|
22
|
+
const { messages } = useViews();
|
|
23
|
+
const { ctx, group } = useEditorCtx({ filterTree, at: [], form: "computer", whole: true, onDone });
|
|
24
|
+
if (!group)
|
|
25
|
+
return null;
|
|
26
|
+
return (_jsx(AppFilterBody, { ctx: ctx, level: group, relation: null, excludable: false, label: filterTree.label ?? messages({ key: "views.panels.filter" }), onDone: onDone }));
|
|
27
|
+
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import { type QuickFiltersConfig } from "../../quick/model.js";
|
|
3
|
-
export declare function QuickFiltersPanel({ quickFilters, form, onDone, closeButton, }: {
|
|
3
|
+
export declare function QuickFiltersPanel({ quickFilters, form, onDone, closeButton, inHost, }: {
|
|
4
4
|
quickFilters: QuickFiltersConfig;
|
|
5
5
|
form: "computer" | "phone";
|
|
6
6
|
/** The job is done and what holds the panel closes. */
|
|
7
7
|
onDone?: () => void;
|
|
8
8
|
/** Its own ✕: false in a sheet whose head draws one. */
|
|
9
9
|
closeButton?: boolean;
|
|
10
|
+
/** It stands in the app's own host (`hosts.quick`), which draws no head: on a computer, the panels' header over it. */
|
|
11
|
+
inHost?: boolean;
|
|
10
12
|
}): ReactNode;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useViews } from "../../../provider/context.js";
|
|
4
|
+
import { PanelHeader } from "../panel-header.js";
|
|
4
5
|
import { quickFieldsShown, quickHoldFits, quickValuesShown, } from "../../quick/model.js";
|
|
5
|
-
export function QuickFiltersPanel({ quickFilters, form, onDone, closeButton = true, }) {
|
|
6
|
+
export function QuickFiltersPanel({ quickFilters, form, onDone, closeButton = true, inHost = false, }) {
|
|
6
7
|
const { components, messages } = useViews();
|
|
7
8
|
const Body = components.QuickFiltersBody;
|
|
8
9
|
const label = quickFilters.label ?? messages({ key: "views.panels.quick-filters" });
|
|
@@ -13,7 +14,7 @@ export function QuickFiltersPanel({ quickFilters, form, onDone, closeButton = tr
|
|
|
13
14
|
const close = {
|
|
14
15
|
close: { label: messages({ key: "views.panels.close" }), onPress: done },
|
|
15
16
|
};
|
|
16
|
-
|
|
17
|
+
const body = (_jsx(Body, { label: label, fields: quickFieldsShown(quickFilters).map((field) => ({
|
|
17
18
|
key: field.key,
|
|
18
19
|
label: field.label,
|
|
19
20
|
searchPlaceholder: searchWords(field, messages),
|
|
@@ -23,6 +24,9 @@ export function QuickFiltersPanel({ quickFilters, form, onDone, closeButton = tr
|
|
|
23
24
|
if (quickHoldFits(quickFilters, next))
|
|
24
25
|
quickFilters.onHoldChange(next);
|
|
25
26
|
}, onDone: done, actions: form === "phone" && closeButton ? close : undefined }));
|
|
27
|
+
if (!(inHost && form === "computer" && closeButton))
|
|
28
|
+
return body;
|
|
29
|
+
return (_jsxs("div", { className: "flex h-full min-h-0 flex-col", children: [_jsx(PanelHeader, { title: label, onClose: done }), _jsx("div", { className: "min-h-0 flex-1 overflow-y-auto overscroll-contain", children: body })] }));
|
|
26
30
|
}
|
|
27
31
|
const searchWords = (field, messages) => field.searchPlaceholder ??
|
|
28
32
|
messages({ key: "views.panels.quick-search", values: { field: field.label } });
|
|
@@ -7,7 +7,8 @@ import type { CollectionViewState } from "../../view-state.js";
|
|
|
7
7
|
import type { CollectionViewsInput, ViewsLayout } from "../../views-row/model.js";
|
|
8
8
|
import type { PanelFieldEditor } from "../field-editor.js";
|
|
9
9
|
import type { ToolbarPanelHost } from "./panel-part.js";
|
|
10
|
-
import type {
|
|
10
|
+
import type { ToolbarPanelPlace } from "./context.js";
|
|
11
|
+
import type { ToolbarMore, ToolbarOverflow, ToolbarPartButton } from "./Toolbar.js";
|
|
11
12
|
/** The toolbar's menus as data (VK-741): each handed its default items, each item keyed, and handing back the items it shows.
|
|
12
13
|
* `view`, a view's menu, handed the view too: the rows an option hands (`menu`, Edit view… among them) and the menu a views
|
|
13
14
|
* list draws from an axis's verbs. `add`, New's items: `addItems`, or, with `onAdd` alone, one row keyed `new` that runs it;
|
|
@@ -34,6 +35,9 @@ export type ToolbarPartPlace = {
|
|
|
34
35
|
node?: ReactNode;
|
|
35
36
|
className?: string;
|
|
36
37
|
button?: ToolbarPartButton;
|
|
38
|
+
/** Where what it opens hangs at its button (VK-994): its popover's `side`, `align` and `offset`. Absent, toward its side
|
|
39
|
+
* of its line, 8 px below it. */
|
|
40
|
+
panel?: ToolbarPanelPlace;
|
|
37
41
|
};
|
|
38
42
|
/** Which form's parts these are. */
|
|
39
43
|
export type ToolbarPartsContext = {
|
|
@@ -69,6 +73,15 @@ export type ReadyToolbarProps<Row> = SettingsPanelsInput<Row> & {
|
|
|
69
73
|
filter?: ToolbarPanelHost;
|
|
70
74
|
quick?: ToolbarPanelHost;
|
|
71
75
|
};
|
|
76
|
+
/** Where Customize opens on a computer (VK-1026): `"popover"`, the default, at its button; `"pane"`, in the components map's
|
|
77
|
+
* `Pane` (`CONTROLS.Pane`), at the right edge of `paneBox` under the toolbar, as tall as the list (where the list has a
|
|
78
|
+
* height of its own: a page that scrolls whole makes it as tall as every row), the list in use beside it. On a phone Customize keeps its Sheet either way. A map with no `Pane`, or an app's own `hosts.options`, keeps
|
|
79
|
+
* theirs. */
|
|
80
|
+
customizeIn?: "popover" | "pane";
|
|
81
|
+
/** The list's box the Pane stands in, with `customizeIn: "pane"`: positioned, holding the grid (which scrolls inside it)
|
|
82
|
+
* under the toolbar, never scrolling itself. Null until it is on the page; not handed, Customize opens in the popover.
|
|
83
|
+
* The ready `<List>` hands its own. */
|
|
84
|
+
paneBox?: HTMLElement | null;
|
|
72
85
|
/** Quick filters (VK-563): the fields offered, the hold and its writes. Handed, their button stands on the row. */
|
|
73
86
|
quickFilters?: QuickFiltersConfig;
|
|
74
87
|
/** The quick filters' panel open, when the app holds it (VK-566), so the reminder at its list's foot
|
|
@@ -118,6 +131,9 @@ export type ReadyToolbarProps<Row> = SettingsPanelsInput<Row> & {
|
|
|
118
131
|
* `menu.drop` and `menu.add` (`viewkitjs/views/list`) take them too. Not `parts`, which lists a field's part columns in
|
|
119
132
|
* Customize. */
|
|
120
133
|
toolbarParts?: ToolbarParts;
|
|
134
|
+
/** ⋯ as the app draws it where the parts don't fit (VK-1031, `ToolbarOverflow`): its glyph, its class, or its whole button,
|
|
135
|
+
* handed the props your `ToolbarButton` would get. Absent, your `ToolbarButton` with `icons.more`. */
|
|
136
|
+
overflow?: ToolbarOverflow;
|
|
121
137
|
className?: string;
|
|
122
138
|
};
|
|
123
139
|
export declare function ReadyToolbar<Row>({ settings, layer, onChange, onLayerChange, view, sortFilter, bar, ...rest }: ReadyToolbarProps<Row>): ReactNode;
|
|
@@ -2,6 +2,7 @@ import { type ComponentType, type ReactNode } from "react";
|
|
|
2
2
|
import type { ViewsToolbarButtonProps } from "../../../atoms/types.js";
|
|
3
3
|
import type { ViewsMenuItem } from "../../../provider/components.js";
|
|
4
4
|
import { type ToolbarPlacement } from "../../toolbar/model.js";
|
|
5
|
+
import { type ToolbarPanelPlace } from "./context.js";
|
|
5
6
|
/** ⋯ as data (VK-741): the folded parts' rows, each keyed by its part, and which line's ⋯ they are in. */
|
|
6
7
|
export type ToolbarMore = (items: ViewsMenuItem[], ctx: {
|
|
7
8
|
line: "row" | "bar";
|
|
@@ -19,10 +20,21 @@ export type ToolbarPart = ToolbarPlacement & {
|
|
|
19
20
|
className?: string;
|
|
20
21
|
/** Drawn for every toolbar button the part draws, in place of the app's `ToolbarButton`, handed the same props (VK-984). */
|
|
21
22
|
button?: ToolbarPartButton;
|
|
23
|
+
/** Where what it opens hangs at its button (VK-994): its popover's side, align and offset. Absent, toward the part's
|
|
24
|
+
* side of its line, 8 px below it. */
|
|
25
|
+
panel?: ToolbarPanelPlace;
|
|
22
26
|
};
|
|
23
27
|
/** A place's own button (VK-984): a `ToolbarButton` of the app's, for one place. */
|
|
24
28
|
export type ToolbarPartButton = ComponentType<ViewsToolbarButtonProps>;
|
|
25
|
-
|
|
29
|
+
/** ⋯ as the app draws it (VK-1031), as a place's look is handed: `icon`, its glyph over your `icons.more`; `className`, put on
|
|
30
|
+
* it; `button`, your own button drawn in place of your `ToolbarButton`, handed the very props it would get (`part: "more"`,
|
|
31
|
+
* `ref` included). Absent, ⋯ is your `ToolbarButton` with `icons.more`, as before. */
|
|
32
|
+
export type ToolbarOverflow = {
|
|
33
|
+
icon?: ReactNode;
|
|
34
|
+
className?: string;
|
|
35
|
+
button?: ToolbarPartButton;
|
|
36
|
+
};
|
|
37
|
+
export declare function Toolbar({ parts, phone, narrow, narrowBelow, fold, more, overflow, className, }: {
|
|
26
38
|
parts: readonly ToolbarPart[];
|
|
27
39
|
/** The phone's one row; absent, the provider's answer (`desktopQuery`). */
|
|
28
40
|
phone?: boolean;
|
|
@@ -38,6 +50,8 @@ export declare function Toolbar({ parts, phone, narrow, narrowBelow, fold, more,
|
|
|
38
50
|
/** ⋯ as data (VK-741): handed the folded parts' rows, each keyed by its part, and which line's ⋯ it is (each line folds into
|
|
39
51
|
* its own: the row's, or the filter bar's), it hands back the rows ⋯ shows. A press on any of them closes ⋯ first. */
|
|
40
52
|
more?: ToolbarMore;
|
|
53
|
+
/** ⋯ as the app draws it (VK-1031): its glyph, its class, or its whole button. Absent, ViewKit's. */
|
|
54
|
+
overflow?: ToolbarOverflow;
|
|
41
55
|
className?: string;
|
|
42
56
|
}): ReactNode;
|
|
43
57
|
/** A line between what belongs together and what doesn't: placed with `role: "separator"`, drawn in the fold
|
|
@@ -11,7 +11,7 @@ import { ToolbarButton } from "./ToolbarButton.js";
|
|
|
11
11
|
import { useBoxNarrow } from "./use-box-narrow.js";
|
|
12
12
|
import { useGiveWay } from "./use-give-way.js";
|
|
13
13
|
const CLUSTER_FADE = "linear-gradient(to right, transparent 0, var(--vk-ground) 1.25rem, var(--vk-ground) 100%)";
|
|
14
|
-
export function Toolbar({ parts, phone, narrow, narrowBelow = TOOLBAR_NARROW_BELOW, fold = false, more, className, }) {
|
|
14
|
+
export function Toolbar({ parts, phone, narrow, narrowBelow = TOOLBAR_NARROW_BELOW, fold = false, more, overflow, className, }) {
|
|
15
15
|
const box = useRef(null);
|
|
16
16
|
const desktop = useDesktop();
|
|
17
17
|
const measured = useBoxNarrow(box, narrowBelow);
|
|
@@ -29,21 +29,23 @@ export function Toolbar({ parts, phone, narrow, narrowBelow = TOOLBAR_NARROW_BEL
|
|
|
29
29
|
...(part.foot !== undefined && { foot: part.foot }),
|
|
30
30
|
...(part.className && { className: part.className }),
|
|
31
31
|
...(part.button && { button: part.button }),
|
|
32
|
+
...(part.panel && { panel: part.panel }),
|
|
32
33
|
},
|
|
33
34
|
]));
|
|
34
35
|
if (fold) {
|
|
35
36
|
const menus = new Map(parts.flatMap((part) => (part.menu ? [[part.key, part.menu]] : [])));
|
|
36
|
-
return (_jsx(ToolbarRadioContext.Provider, { value: radio, children: _jsx("div", { ref: box, "data-slot": "vk-toolbar", "data-form": form, "data-fold": "", className: cx("@container flex w-full flex-col", className), children: lines.map((line) => (_jsx(FoldLine, { line: line, form: form, nodes: nodes, placed: placed, menus: menus, more: more, search: { open: searchOpen, onOpenChange: setSearchOpen } }, line.kind))) }) }));
|
|
37
|
+
return (_jsx(ToolbarRadioContext.Provider, { value: radio, children: _jsx("div", { ref: box, "data-slot": "vk-toolbar", "data-form": form, "data-fold": "", className: cx("@container flex w-full flex-col", className), children: lines.map((line) => (_jsx(FoldLine, { line: line, form: form, nodes: nodes, placed: placed, menus: menus, more: more, overflow: overflow, search: { open: searchOpen, onOpenChange: setSearchOpen } }, line.kind))) }) }));
|
|
37
38
|
}
|
|
38
39
|
return (_jsx(ToolbarRadioContext.Provider, { value: radio, children: _jsx("div", { ref: box, "data-slot": "vk-toolbar", "data-form": form, className: cx("flex w-full flex-col", form === "row" ? "gap-1" : "gap-2", className), children: lines.map((line) => (_jsx(Line, { line: line, form: form, nodes: nodes, placed: placed }, line.kind))) }) }));
|
|
39
40
|
}
|
|
41
|
+
const sideOf = (line, key) => (line.end.some((slot) => slot.key === key) ? "end" : "start");
|
|
40
42
|
function useLineName(kind) {
|
|
41
43
|
const { messages } = useViews();
|
|
42
44
|
return messages({ key: kind === "bar" || kind === "below" ? "views.panels.toolbar-bar" : "views.panels.toolbar-row" });
|
|
43
45
|
}
|
|
44
46
|
function Line({ line, form, nodes, placed }) {
|
|
45
47
|
const name = useLineName(line.kind);
|
|
46
|
-
const draw = (slots) => slots.map((slot) => (_jsx(ToolbarSlotContext.Provider, { value: { form, fill: slot.fill, size: line.size, line: line.kind, ...NOT_FOLDING, appFrame: false, ...placed.get(slot.key) }, children: _jsx(Fragment, { children: nodes.get(slot.key) }) }, slot.key)));
|
|
48
|
+
const draw = (slots) => slots.map((slot) => (_jsx(ToolbarSlotContext.Provider, { value: { form, fill: slot.fill, size: line.size, line: line.kind, ...NOT_FOLDING, appFrame: false, side: sideOf(line, slot.key), ...placed.get(slot.key) }, children: _jsx(Fragment, { children: nodes.get(slot.key) }) }, slot.key)));
|
|
47
49
|
const mark = { "data-slot": "vk-toolbar-line", "data-line": line.kind, role: "toolbar", "aria-label": name };
|
|
48
50
|
if (line.kind === "main" && form === "row") {
|
|
49
51
|
return (_jsxs("div", { ...mark, "data-toolbar-row": true, className: "relative flex min-h-9 items-center empty:hidden", children: [_jsx("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: draw(line.start) }), line.end.length > 0 && (_jsx("div", { "data-slot": "vk-toolbar-cluster", "data-toolbar-cluster": true, className: "absolute inset-y-0 right-0 flex items-center gap-1 pl-8", style: { background: CLUSTER_FADE }, children: draw(line.end) }))] }));
|
|
@@ -57,7 +59,7 @@ function Line({ line, form, nodes, placed }) {
|
|
|
57
59
|
}
|
|
58
60
|
return (_jsxs("div", { ...mark, className: "flex flex-wrap items-center gap-2 empty:hidden", children: [draw(line.start), line.end.length > 0 && _jsx("div", { className: "ml-auto flex items-center gap-1", children: draw(line.end) })] }));
|
|
59
61
|
}
|
|
60
|
-
function FoldLine({ line, form, nodes, placed, menus, more: reshape, search, }) {
|
|
62
|
+
function FoldLine({ line, form, nodes, placed, menus, more: reshape, overflow, search, }) {
|
|
61
63
|
const name = useLineName(line.kind);
|
|
62
64
|
const [element, setElement] = useState(null);
|
|
63
65
|
const more = useRef(null);
|
|
@@ -96,6 +98,7 @@ function FoldLine({ line, form, nodes, placed, menus, more: reshape, search, })
|
|
|
96
98
|
more,
|
|
97
99
|
search: slot.search ? search : null,
|
|
98
100
|
appFrame: false,
|
|
101
|
+
side: sideOf(line, folded && state.moreAfter ? state.moreAfter : slot.key),
|
|
99
102
|
...placed.get(slot.key),
|
|
100
103
|
}, children: _jsx(Fragment, { children: nodes.get(slot.key) }) }) }, slot.key));
|
|
101
104
|
if (slot.key !== state.moreAfter)
|
|
@@ -104,18 +107,20 @@ function FoldLine({ line, form, nodes, placed, menus, more: reshape, search, })
|
|
|
104
107
|
const menu = state.folded.has(s.key) ? menus.get(s.key) : undefined;
|
|
105
108
|
return menu ? [{ key: s.key, ...menu }] : [];
|
|
106
109
|
});
|
|
107
|
-
const align = line
|
|
108
|
-
return [itemNode, _jsx(Overflow, { anchor: more, rows: rows, reshape: reshape && ((items) => reshape(items, { line: line.kind === "bar" || line.kind === "below" ? "bar" : "row" })), size: line.size, form: form, align: align }, "vk-overflow")];
|
|
110
|
+
const align = sideOf(line, slot.key);
|
|
111
|
+
return [itemNode, _jsx(Overflow, { anchor: more, rows: rows, reshape: reshape && ((items) => reshape(items, { line: line.kind === "bar" || line.kind === "below" ? "bar" : "row" })), size: line.size, form: form, align: align, look: overflow }, "vk-overflow")];
|
|
109
112
|
});
|
|
110
113
|
};
|
|
111
|
-
return (_jsxs("div", { ref: setElement, "data-slot": "vk-toolbar-line", "data-line": line.kind, role: "toolbar", "aria-label": name, ...(line.kind === "main" ? { "data-toolbar-row": "" } : {}), className: cx("flex min-w-0 items-center", phone
|
|
114
|
+
return (_jsxs("div", { ref: setElement, "data-slot": "vk-toolbar-line", "data-line": line.kind, role: "toolbar", "aria-label": name, ...(line.kind === "main" ? { "data-toolbar-row": "" } : {}), className: cx("flex min-w-0 items-center", phone
|
|
115
|
+
? "gap-1.5"
|
|
116
|
+
: "gap-(--vk-toolbar-line-gap,calc(var(--spacing)*2)) border-b-(length:--vk-toolbar-line-w,1px) border-(color:--vk-border-subtle) py-(--vk-toolbar-line-py,calc(var(--spacing)*2.5))"), children: [draw(line.start), !searchTakesLine && _jsx("span", { "data-toolbar-spacer": true, "aria-hidden": true, className: "min-w-0 flex-1" }), draw(line.end)] }));
|
|
112
117
|
}
|
|
113
118
|
const closingFirst = (items, setOpen) => items.map((item) => ({
|
|
114
119
|
...item,
|
|
115
120
|
...(item.onSelect && { onSelect: () => { setOpen(false); item.onSelect?.(); } }),
|
|
116
121
|
...(item.children && { children: closingFirst(item.children, setOpen) }),
|
|
117
122
|
}));
|
|
118
|
-
function Overflow({ anchor, rows, reshape, size, form, align, }) {
|
|
123
|
+
function Overflow({ anchor, rows, reshape, size, form, align, look, }) {
|
|
119
124
|
const { components, icons, messages } = useViews();
|
|
120
125
|
const { Menu } = components;
|
|
121
126
|
const More = icons.more;
|
|
@@ -126,7 +131,17 @@ function Overflow({ anchor, rows, reshape, size, form, align, }) {
|
|
|
126
131
|
const items = list.map((row) => ({ key: row.key, label: row.label, icon: row.icon, onSelect: row.onSelect }));
|
|
127
132
|
return reshape ? reshape(items) : items;
|
|
128
133
|
};
|
|
129
|
-
return (_jsxs("span", { "data-slot": "vk-toolbar-overflow", className: "relative inline-flex shrink-0", children: [_jsx(ToolbarSlotContext.Provider, { value: {
|
|
134
|
+
return (_jsxs("span", { "data-slot": "vk-toolbar-overflow", className: "relative inline-flex shrink-0", children: [_jsx(ToolbarSlotContext.Provider, { value: {
|
|
135
|
+
form,
|
|
136
|
+
fill: false,
|
|
137
|
+
size,
|
|
138
|
+
line: "main",
|
|
139
|
+
...NOT_FOLDING,
|
|
140
|
+
iconAlone: true,
|
|
141
|
+
appFrame: false,
|
|
142
|
+
...(look?.className && { className: look.className }),
|
|
143
|
+
...(look?.button && { button: look.button }),
|
|
144
|
+
}, children: _jsx(ToolbarButton, { part: "more", ref: anchor, icon: look?.icon ?? _jsx(More, { className: "h-4 w-4 shrink-0" }), label: name, word: null, popup: "menu", open: toggle.open, onPointerDown: toggle.triggerProps.onPointerDown, onClick: toggle.triggerProps.onClick }) }), _jsx(Menu, { open: toggle.open, onOpenChange: toggle.onOpenChange, anchor: anchor, align: align, label: name, items: closingFirst(own(rows), toggle.setOpen) })] }));
|
|
130
145
|
}
|
|
131
146
|
export function ToolbarSeparator() {
|
|
132
147
|
return _jsx("span", { role: "separator", "aria-orientation": "vertical", "data-slot": "vk-toolbar-separator", className: "h-4 w-px shrink-0 self-center bg-(color:--vk-border)" });
|
|
@@ -5,7 +5,7 @@ import { advancedFiltersOf, followAdvancedKeys, } from "../../../filters/filter-
|
|
|
5
5
|
import { useViews } from "../../../provider/context.js";
|
|
6
6
|
import { FilterEditorHost } from "../filter/FilterEditor.js";
|
|
7
7
|
import { useSheetPanels } from "../panel-sheet.js";
|
|
8
|
-
import { useToolbarPanel, useToolbarSlot } from "./context.js";
|
|
8
|
+
import { usePanelPlace, useToolbarPanel, useToolbarSlot } from "./context.js";
|
|
9
9
|
import { ToolbarButton } from "./ToolbarButton.js";
|
|
10
10
|
export function ToolbarAdvancedFilters({ filterTree, host, }) {
|
|
11
11
|
const phone = useSheetPanels();
|
|
@@ -65,6 +65,7 @@ export function AdvancedFilterPill({ filterTree, at, count, aside = false, host:
|
|
|
65
65
|
const name = messages({ key: "views.panels.advanced-filter" });
|
|
66
66
|
const openAtPress = useRef(false);
|
|
67
67
|
const anchor = foldedAt ?? pill;
|
|
68
|
+
const hangs = usePanelPlace("end");
|
|
68
69
|
const close = (focus = true) => {
|
|
69
70
|
panel.onOpenChange(false);
|
|
70
71
|
if (focus)
|
|
@@ -81,5 +82,5 @@ export function AdvancedFilterPill({ filterTree, at, count, aside = false, host:
|
|
|
81
82
|
return (_jsxs("span", { "data-slot": "vk-toolbar-advanced-filter", "data-open": (slot.fold || foldedAt) && panel.open ? "" : undefined, hidden: foldedAt ? true : undefined, className: "relative inline-flex shrink-0 items-center", children: [aside ? (_jsx(Tooltip, { content: messages({ key: "views.panels.advanced-filter-set-aside" }), side: "bottom", children: _jsx("span", { className: "inline-flex min-w-0", children: button }) })) : (button), Host ? (_jsx(Host, { open: panel.open, onOpenChange: panel.onOpenChange, title: name, children: content })) : (_jsx(Popover, { open: panel.open, onOpenChange: (next, details) => {
|
|
82
83
|
if (!next)
|
|
83
84
|
close(details?.reason !== "outside-press" && details?.reason !== "focus-out");
|
|
84
|
-
}, anchor: anchor,
|
|
85
|
+
}, anchor: anchor, ...hangs, chrome: "panel", className: "w-fit max-w-[calc(100vw-2rem)]", panelData: { "data-slot": "vk-toolbar-advanced-filter-panel" }, children: content }))] }));
|
|
85
86
|
}
|
|
@@ -2,7 +2,7 @@ import { type ReactNode } from "react";
|
|
|
2
2
|
import type { FilterTreeConfig } from "../../model.js";
|
|
3
3
|
import type { Pending } from "../filter/editor-ctx.js";
|
|
4
4
|
import type { ToolbarPanelHost } from "./panel-part.js";
|
|
5
|
-
export declare function ToolbarFilterAdd({ filterTree, onHeldChange, open, onOpenChange, host, }: {
|
|
5
|
+
export declare function ToolbarFilterAdd({ filterTree, onHeldChange, open, onOpenChange, host, changed, opens, }: {
|
|
6
6
|
/** The builder's filter tree: `settingsPanels(…).filterTree`. */
|
|
7
7
|
filterTree: FilterTreeConfig;
|
|
8
8
|
/** Holds a yes/no until its value is picked, where the toolbar holds the bar's held rule (so the bar shows it and
|
|
@@ -13,4 +13,9 @@ export declare function ToolbarFilterAdd({ filterTree, onHeldChange, open, onOpe
|
|
|
13
13
|
onOpenChange?: (open: boolean) => void;
|
|
14
14
|
/** The app's drawer or sheet for the fields; absent, the map's `Popover`. */
|
|
15
15
|
host?: ToolbarPanelHost;
|
|
16
|
+
/** Lit while the filter differs from the saved view (VK-1046): the ready toolbar hands it. Default unlit, as before. */
|
|
17
|
+
changed?: boolean;
|
|
18
|
+
/** What a press opens: the fields, a pick adding a filter (the default), or the view's filters, editable, Add filter
|
|
19
|
+
* under them, as the row's Sort opens its rules (`"filters"`: the ready toolbar's, VK-1047). */
|
|
20
|
+
opens?: "fields" | "filters";
|
|
16
21
|
}): ReactNode;
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { WholeFilterEditor } from "../filter/FilterEditor.js";
|
|
3
4
|
import { useRef } from "react";
|
|
4
5
|
import { useViews } from "../../../provider/context.js";
|
|
5
6
|
import { listedFieldsOf } from "../../settings/filter-groups.js";
|
|
6
7
|
import { FilterFieldList } from "../filter/FilterFieldList.js";
|
|
7
8
|
import { useSheetPanels } from "../panel-sheet.js";
|
|
8
|
-
import { useFoldAnchor, useToolbarPanel } from "./context.js";
|
|
9
|
+
import { useFoldAnchor, usePanelPlace, useToolbarPanel } from "./context.js";
|
|
9
10
|
import { ToolbarButton } from "./ToolbarButton.js";
|
|
10
11
|
import { useFilterAdd } from "./use-filter-add.js";
|
|
11
|
-
export function ToolbarFilterAdd({ filterTree, onHeldChange, open, onOpenChange, host, }) {
|
|
12
|
+
export function ToolbarFilterAdd({ filterTree, onHeldChange, open, onOpenChange, host, changed = false, opens = "fields", }) {
|
|
12
13
|
const { components, icons, messages } = useViews();
|
|
13
14
|
const { Popover } = components;
|
|
14
15
|
const phone = useSheetPanels();
|
|
15
16
|
const fields = useToolbarPanel("filter-add", open === undefined || !onOpenChange ? undefined : { open, onOpenChange });
|
|
16
17
|
const box = useRef(null);
|
|
17
18
|
const hangsAt = useFoldAnchor(box);
|
|
19
|
+
const hangs = usePanelPlace("start");
|
|
18
20
|
const atPress = useRef(false);
|
|
19
21
|
const { refusal, reason, onPick } = useFilterAdd({
|
|
20
22
|
filterTree,
|
|
@@ -28,15 +30,19 @@ export function ToolbarFilterAdd({ filterTree, onHeldChange, open, onOpenChange,
|
|
|
28
30
|
fields.onOpenChange(false);
|
|
29
31
|
onPick(picked, far);
|
|
30
32
|
};
|
|
31
|
-
const
|
|
33
|
+
const close = () => {
|
|
34
|
+
fields.onOpenChange(false);
|
|
35
|
+
hangsAt.anchor.current?.focus({ preventScroll: true });
|
|
36
|
+
};
|
|
37
|
+
const list = opens === "filters" ? (_jsx(WholeFilterEditor, { filterTree: filterTree, onDone: close })) : (_jsx(FilterFieldList, { fields: listedFieldsOf(filterTree), relations: true, onPick: pick, onDone: () => {
|
|
32
38
|
fields.onOpenChange(false);
|
|
33
39
|
hangsAt.anchor.current?.focus({ preventScroll: true });
|
|
34
40
|
} }));
|
|
35
41
|
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, 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: () => {
|
|
42
|
+
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, changed: changed, disabled: opens === "fields" && !!refusal, disabledReason: opens === "fields" ? reason : undefined, onPointerDown: () => {
|
|
37
43
|
atPress.current = fields.open;
|
|
38
44
|
}, onClick: (event) => {
|
|
39
|
-
if (refusal)
|
|
45
|
+
if (opens === "fields" && refusal)
|
|
40
46
|
return;
|
|
41
47
|
const wasOpen = event.detail === 0 ? fields.open : atPress.current;
|
|
42
48
|
atPress.current = false;
|
|
@@ -46,5 +52,7 @@ export function ToolbarFilterAdd({ filterTree, onHeldChange, open, onOpenChange,
|
|
|
46
52
|
const why = details?.reason;
|
|
47
53
|
if (!next && why !== "outside-press" && why !== "focus-out")
|
|
48
54
|
hangsAt.anchor.current?.focus({ preventScroll: true });
|
|
49
|
-
}, anchor: hangsAt.anchor,
|
|
55
|
+
}, anchor: hangsAt.anchor, ...hangs, ...(opens === "filters"
|
|
56
|
+
? { chrome: "panel", className: "w-fit max-w-[calc(100vw-2rem)]" }
|
|
57
|
+
: { chrome: "menu" }), panelData: { "data-slot": "vk-toolbar-filters-panel" }, children: list }))] }));
|
|
50
58
|
}
|
|
@@ -3,9 +3,10 @@ import { type FilterTree } from "viewkitjs/fields/query";
|
|
|
3
3
|
import type { FilterTreeConfig } from "../../model.js";
|
|
4
4
|
import { type Pending } from "../filter/editor-ctx.js";
|
|
5
5
|
import type { ToolbarPanelHost } from "./panel-part.js";
|
|
6
|
-
/** How many of the bar's filters may fold: its top-level items less the one a held rule stands in place of
|
|
7
|
-
|
|
8
|
-
export declare function
|
|
6
|
+
/** How many of the bar's filters may fold: its top-level items less the one a held rule stands in place of, and less the
|
|
7
|
+
* saved view's own (`saved`, VK-1046), which stand in Customize, not on the bar. */
|
|
8
|
+
export declare function foldableFilters(tree: FilterTree, held: Pending | null, saved?: FilterTree): number;
|
|
9
|
+
export declare function ToolbarFilters({ filterTree, open: openIn, onOpenChange: onOpenChangeIn, held: heldIn, onHeldChange, host, emptyPlace, saved, }: {
|
|
9
10
|
/** The builder's filter tree: `settingsPanels(…).filterTree`, with `filterGroups`. */
|
|
10
11
|
filterTree: FilterTreeConfig;
|
|
11
12
|
/** Whether Filter and + list its fields' pages open: the ready toolbar holds it, so ⋯ can open Filter. */
|
|
@@ -19,4 +20,7 @@ export declare function ToolbarFilters({ filterTree, open: openIn, onOpenChange:
|
|
|
19
20
|
/** While nothing filters, Filter, an empty place (the default); false, nothing, where Filter stands on the row's right
|
|
20
21
|
* instead (`ToolbarFilterAdd`, Mihai's look): the bar holds a filter only once one is set or held. */
|
|
21
22
|
emptyPlace?: boolean;
|
|
23
|
+
/** The saved view's filter (VK-1046): its own top-level items stand in Customize, not on the bar, and an edited one
|
|
24
|
+
* stands as edited; every write is still the whole filter's. Absent, every filter stands, as before. */
|
|
25
|
+
saved?: FilterTree;
|
|
22
26
|
}): ReactNode;
|