viewkitjs 0.34.0 → 0.36.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 +173 -0
- package/MIGRATION.md +7 -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 -7
- package/views/dist/contract.js +25 -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 +10 -5
- package/views/dist/controls/avatar/avatar.js +12 -6
- 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 +4 -5
- 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 +8 -1
- package/views/dist/controls/compound-editor/name-parts.js +3 -2
- package/views/dist/controls/compound-editor/place-parts.js +3 -3
- package/views/dist/controls/compound-editor/range-parts.js +11 -10
- package/views/dist/controls/compound-editor/words.d.ts +3 -0
- package/views/dist/controls/compound-editor/words.js +2 -0
- package/views/dist/controls/customize/customize.d.ts +22 -6
- package/views/dist/controls/customize/customize.js +154 -73
- package/views/dist/controls/customize/items.d.ts +49 -0
- package/views/dist/controls/customize/items.js +104 -0
- package/views/dist/controls/customize/map-customize-body.js +19 -15
- package/views/dist/controls/customize/words.d.ts +5 -3
- package/views/dist/controls/customize/words.js +1 -0
- package/views/dist/controls/filter-editor/block.js +5 -2
- package/views/dist/controls/filter-editor/filter-editor.d.ts +16 -1
- package/views/dist/controls/filter-editor/filter-editor.js +22 -16
- package/views/dist/controls/filter-editor/map-filter-body.d.ts +3 -2
- package/views/dist/controls/filter-editor/map-filter-body.js +16 -2
- package/views/dist/controls/filter-editor/map-rules.d.ts +9 -2
- package/views/dist/controls/filter-editor/map-rules.js +18 -13
- package/views/dist/controls/filter-editor/parts.d.ts +1 -1
- package/views/dist/controls/filter-editor/parts.js +16 -15
- package/views/dist/controls/filter-editor/rules.d.ts +4 -4
- package/views/dist/controls/filter-editor/rules.js +6 -3
- package/views/dist/controls/filter-editor/words.d.ts +2 -0
- package/views/dist/controls/filter-editor/words.js +1 -0
- package/views/dist/controls/group-editor/group-editor.d.ts +3 -0
- package/views/dist/controls/group-editor/group-editor.js +21 -15
- package/views/dist/controls/group-editor/map-group-body.js +1 -0
- package/views/dist/controls/index.d.ts +1 -1
- package/views/dist/controls/internal/kit-words.d.ts +11 -0
- package/views/dist/controls/internal/kit-words.js +7 -0
- package/views/dist/controls/internal/map-panel-controls.d.ts +4 -1
- package/views/dist/controls/internal/map-panel-controls.js +23 -6
- package/views/dist/controls/internal/menu-items.d.ts +9 -0
- package/views/dist/controls/internal/menu-items.js +97 -0
- package/views/dist/controls/internal/panel-controls.d.ts +27 -3
- package/views/dist/controls/internal/panel-controls.js +142 -13
- 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 +4 -1
- package/views/dist/controls/menu/menu.js +3 -2
- package/views/dist/controls/number-editor/map-number-body.js +2 -0
- package/views/dist/controls/number-editor/number-editor.js +1 -1
- package/views/dist/controls/number-editor/words.d.ts +3 -0
- package/views/dist/controls/number-editor/words.js +2 -0
- package/views/dist/controls/picker/fields-frame.d.ts +5 -0
- package/views/dist/controls/picker/fields-frame.js +30 -0
- package/views/dist/controls/picker/map-fields-body.d.ts +2 -2
- package/views/dist/controls/picker/map-fields-body.js +7 -26
- package/views/dist/controls/picker/map-picker.d.ts +9 -3
- package/views/dist/controls/picker/map-picker.js +16 -3
- package/views/dist/controls/picker/picker.js +20 -10
- package/views/dist/controls/picker/rows.d.ts +9 -2
- package/views/dist/controls/picker.css +2 -0
- package/views/dist/controls/quick-filters/map-quick-filters-body.js +2 -1
- package/views/dist/controls/quick-filters/quick-filters.js +4 -4
- 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/map-select.d.ts +1 -1
- package/views/dist/controls/select/map-select.js +4 -1
- package/views/dist/controls/select/select.d.ts +5 -0
- package/views/dist/controls/select/select.js +11 -3
- package/views/dist/controls/sheet/bottom-sheet.d.ts +6 -1
- package/views/dist/controls/sheet/bottom-sheet.js +3 -3
- package/views/dist/controls/sort-editor/map-sort-body.js +1 -0
- package/views/dist/controls/sort-editor/sort-editor.d.ts +5 -1
- package/views/dist/controls/sort-editor/sort-editor.js +9 -8
- package/views/dist/controls/tag/tag.js +4 -2
- package/views/dist/controls/text-editor/map-text-body.js +4 -1
- package/views/dist/controls/text-editor/text-editor.js +2 -2
- package/views/dist/controls/text-editor/words.d.ts +3 -0
- package/views/dist/controls/text-editor/words.js +1 -1
- package/views/dist/controls/toolbar/toolbar.d.ts +31 -12
- package/views/dist/controls/toolbar/toolbar.js +15 -20
- 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-views-list-body.js +9 -1
- package/views/dist/controls/views-list/rules.d.ts +1 -0
- package/views/dist/controls/views-list/rules.js +2 -2
- package/views/dist/controls/views-list/view-menu.js +2 -2
- package/views/dist/controls/views-list/words.d.ts +4 -0
- package/views/dist/controls/views-list/words.js +2 -1
- package/views/dist/display/option-badges.d.ts +17 -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 +1 -1
- 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.d.ts +7 -2
- package/views/dist/grid/chrome/GridAddColumn.js +13 -9
- 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 +4 -3
- package/views/dist/grid/chrome/GridNumberEditor.js +1 -1
- 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 +11 -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/GridTableSurface.js +2 -1
- 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-fitted-box.d.ts +5 -2
- package/views/dist/grid/chrome/grid-fitted-box.js +14 -4
- 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 +16 -4
- package/views/dist/grid/chrome/useGridScaleStyles.d.ts +9 -1
- package/views/dist/grid/chrome/useGridScaleStyles.js +1 -4
- package/views/dist/grid/grid-format-props.d.ts +1 -1
- package/views/dist/grid/grid-format-props.js +18 -5
- package/views/dist/grid/grid.css +11 -1
- package/views/dist/grid/looks.d.ts +3 -1
- package/views/dist/grid/looks.js +10 -4
- package/views/dist/grid/useGridTablePrefs.d.ts +1 -1
- package/views/dist/grid/useGridTableSettings.d.ts +1 -1
- package/views/dist/list/layer.d.ts +8 -0
- package/views/dist/list/layer.js +7 -0
- package/views/dist/list/list.js +2 -2
- package/views/dist/list/menu.d.ts +5 -4
- package/views/dist/list/store.d.ts +1 -1
- package/views/dist/list/toolbar.js +47 -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 +5 -1
- package/views/dist/panels/customize-body.js +21 -12
- package/views/dist/panels/model.d.ts +14 -4
- package/views/dist/panels/react/customize-body.js +15 -3
- package/views/dist/panels/react/customize.d.ts +8 -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/filter/FilterFieldList.d.ts +3 -1
- package/views/dist/panels/react/filter/FilterFieldList.js +2 -2
- package/views/dist/panels/react/filter/filter-body.js +3 -1
- package/views/dist/panels/react/filter/filter-part-body.d.ts +3 -1
- package/views/dist/panels/react/filter/filter-part-body.js +2 -2
- 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/sort/SortEditor.js +3 -1
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +13 -2
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +11 -1
- package/views/dist/panels/react/toolbar/Toolbar.js +16 -6
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +5 -3
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.d.ts +6 -1
- package/views/dist/panels/react/toolbar/ToolbarFilterAdd.js +12 -5
- package/views/dist/panels/react/toolbar/ToolbarFilters.d.ts +7 -3
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +18 -8
- package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +9 -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 +4 -4
- package/views/dist/panels/react/toolbar/editor-menus.d.ts +8 -0
- package/views/dist/panels/react/toolbar/editor-menus.js +3 -0
- package/views/dist/panels/react/views-row/FoldingViewRow.js +3 -5
- package/views/dist/panels/react/views-row/HScrollRow.d.ts +4 -2
- package/views/dist/panels/react/views-row/HScrollRow.js +6 -2
- package/views/dist/panels/react/views-row/ViewAxes.js +6 -1
- package/views/dist/panels/react/views-row/ViewPicker.js +8 -3
- package/views/dist/panels/react/views-row/new-view.d.ts +11 -0
- package/views/dist/panels/react/views-row/new-view.js +21 -0
- package/views/dist/panels/react.d.ts +1 -1
- 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 -4
- package/views/dist/provider/ViewsProvider.js +13 -2
- package/views/dist/provider/components.d.ts +109 -7
- package/views/dist/provider/components.js +1 -1
- package/views/dist/react.d.ts +2 -2
- package/views/dist/styles.css +115 -27
- package/views/dist/styles.unlayered.css +115 -27
- package/views/docs/contract.md +55 -35
- package/views/docs/controls/avatar.md +3 -0
- package/views/docs/controls/bulk-bar.md +3 -1
- package/views/docs/controls/compound-editor.md +2 -0
- package/views/docs/controls/customize.md +1 -1
- package/views/docs/controls/filter-editor.md +1 -1
- package/views/docs/controls/links-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 +1 -1
- package/views/docs/controls/text-editor.md +1 -1
- package/views/docs/controls/values-editor.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 +2 -2
- package/views/docs/index.md +2 -2
- package/views/docs/install.md +198 -104
- package/views/docs/reference/controls.md +27 -24
- package/views/docs/reference/editors-range.md +1 -1
- package/views/docs/reference/field-row.md +1 -1
- package/views/docs/reference/grid.md +6 -5
- package/views/docs/reference/list.md +27 -7
- package/views/docs/reference/looks.md +5 -5
- package/views/docs/reference/panels-react.md +15 -14
- package/views/docs/reference/panels.md +5 -5
- package/views/docs/reference/react.md +25 -11
- package/views/docs/reference/views.md +2 -2
- package/views/docs/reshaping.md +22 -6
- package/views/skills/views/SKILL.md +2 -2
|
@@ -9,7 +9,7 @@ import type { ListSelectionConfig } from "../../selection/types.js";
|
|
|
9
9
|
import type { ListSettingsConfig } from "../../model/column-capabilities.js";
|
|
10
10
|
import type { ListAggregateKind, ListCellAction, ListColumn, ListOptionColorOverrides, ListRelationValue, ListSelectColor } from "../../model/column-schema.js";
|
|
11
11
|
import type { ListDateStyle, ListDateStyleOverrides, ListDurationStyle, ListDurationStyleOverrides, ListNumberFormatOverrides, ListPercentDisplayOverrides, ListShowTimeOverrides } from "../../model/column-format.js";
|
|
12
|
-
import type { ListColumnState, ListColumnsConfig } from "../../model/column-state.js";
|
|
12
|
+
import type { ListColumnItem, ListColumnState, ListColumnsConfig } from "../../model/column-state.js";
|
|
13
13
|
import type { PercentDisplay } from "viewkitjs/fields";
|
|
14
14
|
import type { ListGroupSummaryPart } from "../../model/preferences.js";
|
|
15
15
|
import type { ListRowIconAccessor } from "../../model/row-icon.js";
|
|
@@ -20,7 +20,8 @@ import type { GridGroupSortOption } from "./GridGroupMenu.js";
|
|
|
20
20
|
import type { GridGroupMenuPart } from "./grid-group-menu-parts.js";
|
|
21
21
|
/** Each of the grid's menus as a function from its default items to the items it shows (`menu.drop`, `menu.rename`,
|
|
22
22
|
* `menu.add` and `menu.move` on `viewkitjs/views/list` do the usual changes). `column` gets the column and its field,
|
|
23
|
-
* `row` the row, `group` the group its band names
|
|
23
|
+
* `row` the row, `group` the group its band names, `addColumn` every column of the list, shown or hidden (+ Add column's
|
|
24
|
+
* rows: each hidden column `add:<id>`, a field with parts `field:<id>`, or `all-shown`). Each reshapes a menu the grid opens: a column or band whose menu holds
|
|
24
25
|
* none of the grid's rows stays without one. Called while a menu draws: keep them pure and cheap.
|
|
25
26
|
*
|
|
26
27
|
* `row` is asked as a row's menu opens (a right-click, the row's ⋯, the menu key), never for a row drawn or pressed, and
|
|
@@ -39,6 +40,9 @@ export type GridMenus<Row> = {
|
|
|
39
40
|
group?: (items: ViewsMenuItem[], ctx: {
|
|
40
41
|
group: ListGroup<Row>;
|
|
41
42
|
}) => ViewsMenuItem[];
|
|
43
|
+
addColumn?: (items: ViewsMenuItem[], ctx: {
|
|
44
|
+
columns: readonly ListColumnItem[];
|
|
45
|
+
}) => ViewsMenuItem[];
|
|
42
46
|
};
|
|
43
47
|
/** A group count's noun, singular and plural ("company", "companies"): "2 companies". None: a bare
|
|
44
48
|
* count. */
|
|
@@ -178,9 +182,11 @@ export type GridTableProps<Row> = {
|
|
|
178
182
|
/** The reader's default currency: a money column read in Original totals in it. The host's
|
|
179
183
|
* answer (the portal: the reader's preference); default `DEFAULT_DISPLAY_CURRENCY`. */
|
|
180
184
|
defaultCurrency?: DisplayCurrency;
|
|
181
|
-
/** Rules between the columns: the rows'
|
|
185
|
+
/** Rules between the columns, the last column's closing the table: the rows' and the footer's, which then also draws a
|
|
186
|
+
* line under itself, pinned or not; the header's too with `headerVerticalBorders`. Default true. */
|
|
182
187
|
verticalBorders?: boolean;
|
|
183
|
-
/** The header's columns follow `verticalBorders` as the rows' do, the last
|
|
188
|
+
/** The header's columns follow `verticalBorders` as the rows' do, the last column's line closing the table as in the
|
|
189
|
+
* rows and the footer. Default false: the header draws no
|
|
184
190
|
* line between its columns unless the app asks. */
|
|
185
191
|
headerVerticalBorders?: boolean;
|
|
186
192
|
/** The columns share the grid's whole width, each growing in proportion to its own width and never below it; a
|
|
@@ -299,6 +305,12 @@ export type GridTableProps<Row> = {
|
|
|
299
305
|
* record a grouping draws twice. Drawn, as a hover is, only on a screen whose pointer hovers (`any-hover`). Absent
|
|
300
306
|
* or null: none. */
|
|
301
307
|
hoveredRow?: string | null;
|
|
308
|
+
/** Which row the grid tints: `"hover"` (the default), the row under the pointer, as always; or `"active"`, the active
|
|
309
|
+
* row alone, the row a person last pressed (anywhere on it) or the row of the picked cell, so the keyboard moves it
|
|
310
|
+
* too, carrying `data-active`. It stays through a press outside the grid and Escape, until another row is pressed or
|
|
311
|
+
* picked. Under `"active"` no row tints under the pointer, nor one held there by `hoveredRow`; the hover's other
|
|
312
|
+
* reveals (the row's box, its ⋯, the name's actions) stay. */
|
|
313
|
+
rowHighlight?: "hover" | "active";
|
|
302
314
|
/** Told the row a person's pointer moves onto (its id) and off (null), on a screen whose pointer hovers. */
|
|
303
315
|
onHoveredRowChange?: (id: string | null) => void;
|
|
304
316
|
/** A cell drawn as picked, and its ranges, as a person's click and drag pick them; applied each time its value
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
/** One row's height at scale 1, in px: `--vk-row-h`
|
|
1
|
+
/** One row's height at scale 1, in px: `--vk-row-h`'s default (`GRID_HEIGHTS`), and the row window's count until it has
|
|
2
|
+
* measured a drawn row. */
|
|
2
3
|
export declare const GRID_ROW_PX = 37;
|
|
4
|
+
/**
|
|
5
|
+
* The four heights an app sets on the frame (`--vk-row-h`, `--vk-head-h`, `--vk-label-h`, `--vk-footer-h`), at the
|
|
6
|
+
* scale: classes on the frame, never an inline declaration, which would beat the app's own rule there. Each weighs
|
|
7
|
+
* nothing (`:where`), so any rule on the frame wins over it: an app's, and the grid look's (its Words header's height).
|
|
8
|
+
* Written whole, as the stylesheet's scan reads them; the row's is `GRID_ROW_PX`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const GRID_HEIGHTS = "[:where(&)]:[--vk-row-h:calc(37px*var(--vk-scale))] [:where(&)]:[--vk-head-h:calc(32px*var(--vk-scale))] [:where(&)]:[--vk-label-h:calc(36px*var(--vk-scale))] [:where(&)]:[--vk-footer-h:calc(36px*var(--vk-scale))]";
|
|
3
11
|
export declare function useGridScaleStyles(scale: number, grouped: boolean, phone: boolean, addColumn?: boolean): import("react").CSSProperties;
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
export const GRID_ROW_PX = 37;
|
|
4
|
+
export const GRID_HEIGHTS = "[:where(&)]:[--vk-row-h:calc(37px*var(--vk-scale))] [:where(&)]:[--vk-head-h:calc(32px*var(--vk-scale))] [:where(&)]:[--vk-label-h:calc(36px*var(--vk-scale))] [:where(&)]:[--vk-footer-h:calc(36px*var(--vk-scale))]";
|
|
4
5
|
export function useGridScaleStyles(scale, grouped, phone, addColumn = false) {
|
|
5
6
|
return useMemo(() => ({
|
|
6
7
|
"--vk-scale": String(scale),
|
|
7
8
|
"--vk-indent": phone ? "0px" : "24px",
|
|
8
|
-
"--vk-row-h": `calc(${GRID_ROW_PX}px * var(--vk-scale))`,
|
|
9
9
|
"--vk-line-h": "calc(22px * var(--vk-scale))",
|
|
10
|
-
"--vk-head-h": "calc(32px * var(--vk-scale))",
|
|
11
10
|
"--vk-head-text": "calc(12px * var(--vk-scale))",
|
|
12
11
|
"--vk-head-glyph": "calc(12px * var(--vk-scale))",
|
|
13
|
-
"--vk-footer-h": "calc(36px * var(--vk-scale))",
|
|
14
|
-
"--vk-label-h": "calc(36px * var(--vk-scale))",
|
|
15
12
|
"--vk-text": "calc(14px * var(--vk-scale))",
|
|
16
13
|
"--vk-text-xs": "calc(12px * var(--vk-scale))",
|
|
17
14
|
"--vk-text-10": "calc(10px * var(--vk-scale))",
|
|
@@ -8,7 +8,7 @@ export type GridFormatPrefs = Pick<ListViewPrefs, "gridOptionColors" | "gridDate
|
|
|
8
8
|
/** The grid's format props and the handlers that write them back through `setFormats`. Every format is keyed by the
|
|
9
9
|
* FIELD key (`fieldKeyOf(column)`), the name every surface shares. */
|
|
10
10
|
export declare function useGridFormatProps<Row>(formats: GridFormatPrefs, setFormats: (patch: Partial<GridFormatPrefs>) => void, columns: ListColumn<Row>[]): {
|
|
11
|
-
optionColors: import("
|
|
11
|
+
optionColors: Record<string, Record<string, import("viewkitjs/fields/design/category-colors").CategoryColor>>;
|
|
12
12
|
onOptionColorChange: (key: string, value: string, color: ListSelectColor | null) => void;
|
|
13
13
|
dateStyles: import("../model/column-format.js").ListDateStyleOverrides;
|
|
14
14
|
onDateStyleChange: (key: string, style: ListDateStyle) => void;
|
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useCallback, useMemo } from "react";
|
|
2
|
+
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
3
3
|
import { fieldKeyOf } from "../model/view-rules.js";
|
|
4
4
|
import { setCurrency, setDateStyle, setDecimals, setDurationStyle, setOptionColor, setPercentDisplay, setShowTime, } from "../model/preferences.js";
|
|
5
5
|
import { moneyReadingOf } from "../fields/money.js";
|
|
6
6
|
import { isMoneyReading, MONEY_READING_OPTIONS } from "../fields/currency.js";
|
|
7
|
+
function settled(map) {
|
|
8
|
+
if (!Object.values(map).includes(null))
|
|
9
|
+
return map;
|
|
10
|
+
return Object.fromEntries(Object.entries(map).filter(([, held]) => held !== null));
|
|
11
|
+
}
|
|
7
12
|
export function useGridFormatProps(formats, setFormats, columns) {
|
|
8
|
-
const { gridOptionColors, gridDateStyles, gridDurationStyles, gridShowTime, gridPercentDisplays, gridDecimals, gridCurrencies, } = formats;
|
|
13
|
+
const { gridOptionColors: storedColors, gridDateStyles, gridDurationStyles, gridShowTime, gridPercentDisplays, gridDecimals: storedDecimals, gridCurrencies, } = formats;
|
|
14
|
+
const gridOptionColors = useMemo(() => settled(storedColors), [storedColors]);
|
|
15
|
+
const gridDecimals = useMemo(() => settled(storedDecimals), [storedDecimals]);
|
|
16
|
+
const colours = useRef(gridOptionColors);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
colours.current = gridOptionColors;
|
|
19
|
+
}, [gridOptionColors]);
|
|
9
20
|
const onOptionColorChange = useCallback((key, value, color) => {
|
|
10
|
-
|
|
11
|
-
|
|
21
|
+
const next = setOptionColor(colours.current, key, value, color);
|
|
22
|
+
colours.current = next;
|
|
23
|
+
setFormats({ gridOptionColors: { ...next, [key]: next[key] ?? null } });
|
|
24
|
+
}, [setFormats]);
|
|
12
25
|
const onDateStyleChange = useCallback((key, style) => setFormats({ gridDateStyles: setDateStyle(gridDateStyles, key, style) }), [gridDateStyles, setFormats]);
|
|
13
26
|
const onDurationStyleChange = useCallback((key, style) => setFormats({ gridDurationStyles: setDurationStyle(gridDurationStyles, key, style) }), [gridDurationStyles, setFormats]);
|
|
14
27
|
const onShowTimeChange = useCallback((key, show) => setFormats({ gridShowTime: setShowTime(gridShowTime, key, show) }), [gridShowTime, setFormats]);
|
|
@@ -31,7 +44,7 @@ export function useGridFormatProps(formats, setFormats, columns) {
|
|
|
31
44
|
if (patch.currency != null && isMoneyReading(patch.currency))
|
|
32
45
|
setFormats({ gridCurrencies: setCurrency(gridCurrencies, key, patch.currency) });
|
|
33
46
|
if (patch.decimals === null)
|
|
34
|
-
setFormats({ gridDecimals: { [key]: null } });
|
|
47
|
+
setFormats({ gridDecimals: { ...gridDecimals, [key]: null } });
|
|
35
48
|
else if (patch.decimals !== undefined)
|
|
36
49
|
setFormats({ gridDecimals: setDecimals(gridDecimals, key, patch.decimals) });
|
|
37
50
|
}, [gridCurrencies, gridDecimals, setFormats]);
|
package/views/dist/grid/grid.css
CHANGED
|
@@ -28,11 +28,15 @@
|
|
|
28
28
|
one; the grid draws them at 70% of it. */
|
|
29
29
|
[data-grid-header="words"] [data-slot="vk-grid"][data-desktop] [data-slot="vk-grid-header"],
|
|
30
30
|
[data-slot="vk-grid"][data-desktop] [data-slot="vk-grid-header"]:not([data-grid-header] *) {
|
|
31
|
-
--vk-head-h: calc(var(--vk-spacing) * 9 * var(--vk-scale));
|
|
32
31
|
--vk-head-text: calc(var(--vk-font-size-sm) * var(--vk-scale));
|
|
33
32
|
--vk-head-glyph: calc(var(--vk-spacing) * 3.5 * var(--vk-scale));
|
|
34
33
|
--vk-head-glyph-fg: var(--vk-fg-subtle);
|
|
35
34
|
}
|
|
35
|
+
/* Its height is the frame's, where an app sets the header's own (`--vk-head-h`): weighing nothing (`:where`), so
|
|
36
|
+
any rule of the app's on the frame wins over the look's. */
|
|
37
|
+
:where([data-grid-header="words"] [data-slot="vk-grid"][data-desktop], [data-slot="vk-grid"][data-desktop]:not([data-grid-header] *)) {
|
|
38
|
+
--vk-head-h: calc(var(--vk-spacing) * 9 * var(--vk-scale));
|
|
39
|
+
}
|
|
36
40
|
[data-grid-header="words"] [data-slot="vk-grid"][data-desktop] [data-slot="vk-grid-header-cell"],
|
|
37
41
|
[data-slot="vk-grid"][data-desktop] [data-slot="vk-grid-header-cell"]:not([data-grid-header] *) {
|
|
38
42
|
--vk-fg-subtle: var(--vk-fg);
|
|
@@ -231,6 +235,12 @@
|
|
|
231
235
|
margin-right: var(--vk-spacing);
|
|
232
236
|
}
|
|
233
237
|
|
|
238
|
+
/* Add calculation, Always (Attio's table): every empty footer cell (data-empty) shows its offer at rest, the words Figures
|
|
239
|
+
dresses, "+ Add calculation" under Value first; the pointer opens the same picker. On hover is the grid's own. */
|
|
240
|
+
[data-grid-offer="always"] [data-slot="vk-grid-figure-pick"] {
|
|
241
|
+
opacity: 1;
|
|
242
|
+
}
|
|
243
|
+
|
|
234
244
|
/* Pressed while its menu is open, in every look: a header cell while its column's menu is, a footer cell while its figure
|
|
235
245
|
picker is, and + Add column's corner of the header while its menu is (data-open). */
|
|
236
246
|
[data-slot="vk-grid-header-cell"][data-open],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GridGroupMenuPart } from "./chrome/grid-group-menu-parts.js";
|
|
2
2
|
import { type LookPicks, type PieceLooks } from "../looks/looks.js";
|
|
3
|
-
export type GridLookOptionId = "header" | "lines" | "columns" | "density" | "phone" | "name" | "edge" | "boxes" | "icon" | "picked" | "cell" | "corners" | "hover" | "frame" | "groups" | "names" | "phones" | "typed" | "figures" | "width" | "more" | "wait" | "foot" | "add" | "picking";
|
|
3
|
+
export type GridLookOptionId = "header" | "lines" | "columns" | "density" | "phone" | "name" | "edge" | "boxes" | "icon" | "picked" | "cell" | "corners" | "hover" | "highlight" | "frame" | "groups" | "names" | "phones" | "typed" | "figures" | "offer" | "width" | "more" | "wait" | "foot" | "add" | "picking";
|
|
4
4
|
/** The grid's options and its two looks, attio and portal. Nothing picked wears each option's default, My preset's grid look
|
|
5
5
|
* (the Decisions of 25 Nov 2026: "My preset from the station is the look and ViewKit's default"), which differs from Attio's
|
|
6
6
|
* in ten options: its column lines all, its pinned edge a line, its checkboxes always, picked rows tinted and lined, round
|
|
@@ -23,6 +23,7 @@ export type GridLookWorn = {
|
|
|
23
23
|
foot: "pinned" | "rows";
|
|
24
24
|
add: "name" | "end";
|
|
25
25
|
picking: "press" | "rail";
|
|
26
|
+
highlight: "hover" | "active";
|
|
26
27
|
};
|
|
27
28
|
/** The options the grid's code reads, in this order. */
|
|
28
29
|
export declare const GRID_LOOK_READ: readonly (keyof GridLookWorn)[];
|
|
@@ -44,6 +45,7 @@ export type GridLookProps = {
|
|
|
44
45
|
pinFooter: boolean;
|
|
45
46
|
addColumnAt: "end" | "title";
|
|
46
47
|
phonePicking: boolean;
|
|
48
|
+
rowHighlight: "hover" | "active";
|
|
47
49
|
};
|
|
48
50
|
/** What a worn look hands GridTable, on a phone or a computer. */
|
|
49
51
|
export declare function gridLookProps(worn: GridLookWorn, phone: boolean): GridLookProps;
|
package/views/dist/grid/looks.js
CHANGED
|
@@ -13,12 +13,14 @@ const options = [
|
|
|
13
13
|
{ id: "cell", name: "Picked cell", def: "wash", values: [{ id: "wash", name: "Wash" }, { id: "ring", name: "Ring" }] },
|
|
14
14
|
{ id: "corners", name: "Cell corners", def: "round", values: [{ id: "square", name: "Square" }, { id: "round", name: "Round" }] },
|
|
15
15
|
{ id: "hover", name: "Hover frame", def: "strong", values: [{ id: "none", name: "None" }, { id: "subtle", name: "Subtle" }, { id: "strong", name: "Strong" }] },
|
|
16
|
+
{ id: "highlight", name: "Row highlight", def: "hover", values: [{ id: "hover", name: "Hover" }, { id: "active", name: "Active row" }] },
|
|
16
17
|
{ id: "frame", name: "Picked cell frame", def: "brand", values: [{ id: "brand", name: "Brand" }, { id: "neutral", name: "Neutral" }] },
|
|
17
18
|
{ id: "groups", name: "Groups", def: "titles", values: [{ id: "compact", name: "Compact" }, { id: "titles", name: "Own titles" }] },
|
|
18
19
|
{ id: "names", name: "Names", def: "hover", values: [{ id: "underline", name: "Underlined" }, { id: "hover", name: "On hover" }] },
|
|
19
20
|
{ id: "phones", name: "Phones", def: "text", values: [{ id: "link", name: "Link" }, { id: "text", name: "As text" }] },
|
|
20
21
|
{ id: "typed", name: "Phones as typed", def: "dotted", values: [{ id: "none", name: "None" }, { id: "dotted", name: "Dotted line" }, { id: "subtle", name: "Subtle" }, { id: "dot", name: "Dot" }, { id: "tint", name: "Tinted" }] },
|
|
21
22
|
{ id: "figures", name: "Figures", def: "word", values: [{ id: "value", name: "Value first" }, { id: "word", name: "Word first" }] },
|
|
23
|
+
{ id: "offer", name: "Add calculation", def: "hover", values: [{ id: "hover", name: "On hover" }, { id: "always", name: "Always" }] },
|
|
22
24
|
{ id: "width", name: "Width", def: "own", values: [{ id: "own", name: "The columns' own" }, { id: "fill", name: "Fill" }] },
|
|
23
25
|
{ id: "more", name: "More rows", def: "scroll", values: [{ id: "scroll", name: "As you scroll" }, { id: "pages", name: "In pages" }] },
|
|
24
26
|
{ id: "wait", name: "Rows changing", def: "kept", values: [{ id: "kept", name: "Kept" }, { id: "cleared", name: "Cleared" }] },
|
|
@@ -36,8 +38,9 @@ export const GRID_LOOKS = {
|
|
|
36
38
|
name: "Attio",
|
|
37
39
|
picks: {
|
|
38
40
|
header: "words", lines: "on", columns: "pinned", density: "default", phone: "attio", name: "pinned", edge: "fade",
|
|
39
|
-
boxes: "hover", icon: "on", picked: "tint", cell: "wash", corners: "square", hover: "subtle",
|
|
40
|
-
groups: "compact", names: "underline", phones: "link", typed: "dotted", figures: "value",
|
|
41
|
+
boxes: "hover", icon: "on", picked: "tint", cell: "wash", corners: "square", hover: "subtle", highlight: "hover",
|
|
42
|
+
frame: "brand", groups: "compact", names: "underline", phones: "link", typed: "dotted", figures: "value", offer: "hover",
|
|
43
|
+
width: "own", more: "scroll",
|
|
41
44
|
wait: "kept", foot: "pinned", add: "name", picking: "press",
|
|
42
45
|
},
|
|
43
46
|
},
|
|
@@ -46,8 +49,9 @@ export const GRID_LOOKS = {
|
|
|
46
49
|
name: "The portal's",
|
|
47
50
|
picks: {
|
|
48
51
|
header: "quiet", lines: "on", columns: "all", density: "default", phone: "computer", name: "pinned", edge: "shadow",
|
|
49
|
-
boxes: "hover", icon: "off", picked: "line", cell: "ring", corners: "square", hover: "strong",
|
|
50
|
-
groups: "titles", names: "hover", phones: "text", typed: "subtle", figures: "word",
|
|
52
|
+
boxes: "hover", icon: "off", picked: "line", cell: "ring", corners: "square", hover: "strong", highlight: "hover",
|
|
53
|
+
frame: "brand", groups: "titles", names: "hover", phones: "text", typed: "subtle", figures: "word", offer: "hover",
|
|
54
|
+
width: "own", more: "scroll",
|
|
51
55
|
wait: "kept", foot: "rows", add: "end", picking: "rail",
|
|
52
56
|
},
|
|
53
57
|
},
|
|
@@ -55,6 +59,7 @@ export const GRID_LOOKS = {
|
|
|
55
59
|
};
|
|
56
60
|
export const GRID_LOOK_READ = [
|
|
57
61
|
"columns", "density", "phone", "name", "boxes", "icon", "groups", "figures", "width", "more", "wait", "foot", "add", "picking",
|
|
62
|
+
"highlight",
|
|
58
63
|
];
|
|
59
64
|
export function gridLookWorn(picks) {
|
|
60
65
|
return lookWorn(GRID_LOOKS, picks, GRID_LOOK_READ);
|
|
@@ -78,5 +83,6 @@ export function gridLookProps(worn, phone) {
|
|
|
78
83
|
pinFooter: phone && worn.foot === "pinned",
|
|
79
84
|
addColumnAt: phone && worn.add === "name" ? "title" : "end",
|
|
80
85
|
phonePicking: phone && worn.picking === "press",
|
|
86
|
+
rowHighlight: worn.highlight,
|
|
81
87
|
};
|
|
82
88
|
}
|
|
@@ -24,7 +24,7 @@ export declare function useGridTablePrefs<Row>({ prefs, setPrefs, columns, viewB
|
|
|
24
24
|
aggregates: Record<string, import("viewkitjs/fields/query").FigureKind>;
|
|
25
25
|
onAggregateChange: (columnId: string, kind: ListAggregateKind) => void;
|
|
26
26
|
viewBacked: boolean;
|
|
27
|
-
optionColors: import("
|
|
27
|
+
optionColors: Record<string, Record<string, import("viewkitjs/fields/design/category-colors").CategoryColor>>;
|
|
28
28
|
onOptionColorChange: (key: string, value: string, color: import("../model/column-schema.js").ListSelectColor | null) => void;
|
|
29
29
|
dateStyles: import("../model/column-format.js").ListDateStyleOverrides;
|
|
30
30
|
onDateStyleChange: (key: string, style: import("../model/column-format.js").ListDateStyle) => void;
|
|
@@ -36,7 +36,7 @@ export declare function useGridTableSettings<Row>({ settings, layer, columns, pa
|
|
|
36
36
|
aggregates: Record<string, import("viewkitjs/fields/query").FigureKind>;
|
|
37
37
|
onAggregateChange: (columnId: string, kind: ListAggregateKind) => void;
|
|
38
38
|
viewBacked: true;
|
|
39
|
-
optionColors: import("
|
|
39
|
+
optionColors: Record<string, Record<string, import("viewkitjs/fields/design/category-colors").CategoryColor>>;
|
|
40
40
|
onOptionColorChange: (key: string, value: string, color: import("../model/column-schema.js").ListSelectColor | null) => void;
|
|
41
41
|
dateStyles: import("../model/column-format.js").ListDateStyleOverrides;
|
|
42
42
|
onDateStyleChange: (key: string, style: import("../model/column-format.js").ListDateStyle) => void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ListPersonalLayer } from "viewkitjs/fields/query";
|
|
2
|
+
/** A layer with nothing in it, every key present, so a store that merges a patch clears each one. */
|
|
3
|
+
export declare const EMPTY_LAYER: ListPersonalLayer;
|
|
4
|
+
/** Whether a person's layer holds anything that shows: a width, a fold, a look of their own, and on a phone (`phone`) their
|
|
5
|
+
* phone's layout. */
|
|
6
|
+
export declare function layerHolds(layer: ListPersonalLayer, { phone }?: {
|
|
7
|
+
phone?: boolean;
|
|
8
|
+
}): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const EMPTY_LAYER = { look: {}, widths: {}, folded: [], phoneLayout: undefined };
|
|
2
|
+
export function layerHolds(layer, { phone = true } = {}) {
|
|
3
|
+
return (Object.keys(layer.look ?? {}).length > 0 ||
|
|
4
|
+
Object.keys(layer.widths ?? {}).length > 0 ||
|
|
5
|
+
(layer.folded ?? []).length > 0 ||
|
|
6
|
+
(phone && layer.phoneLayout !== undefined));
|
|
7
|
+
}
|
package/views/dist/list/list.js
CHANGED
|
@@ -9,8 +9,8 @@ function handed(from) {
|
|
|
9
9
|
return Object.fromEntries(Object.entries(from).filter(([, value]) => value !== undefined));
|
|
10
10
|
}
|
|
11
11
|
export function List({ id, fields, rows, source, pageSize, save, columns, views, defaults, sortFilter, bar, menus, toolbarParts, customizeIn, link = true, can, onOpenRow, rowHref, rowWritable, onAdd, addItems, quickFilters, toolbar, grid, bulk, className, }) {
|
|
12
|
-
const toolbarMenus = { ...toolbar?.menus, ...handed({ view: menus?.view, add: menus?.add, more: menus?.more }) };
|
|
13
|
-
const gridMenus = { ...grid?.menus, ...handed({ column: menus?.column, row: menus?.row, group: menus?.group }) };
|
|
12
|
+
const toolbarMenus = { ...toolbar?.menus, ...handed({ view: menus?.view, add: menus?.add, more: menus?.more, customize: menus?.customize, sortEditor: menus?.sortEditor, filterEditor: menus?.filterEditor, groupEditor: menus?.groupEditor }) };
|
|
13
|
+
const gridMenus = { ...grid?.menus, ...handed({ column: menus?.column, row: menus?.row, group: menus?.group, addColumn: menus?.addColumn }) };
|
|
14
14
|
const [box, setBox] = useState(null);
|
|
15
15
|
const inPane = (customizeIn ?? toolbar?.customizeIn) === "pane";
|
|
16
16
|
const gridOf = (_jsx(ListGrid, { ...grid, ...handed({ onOpenRow, rowHref, rowWritable }), menus: gridMenus, children: grid?.children ?? _jsx(ListBulkBar, { ...bulk }) }));
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { GridMenus } from "../grid/chrome/grid-table-props.js";
|
|
2
2
|
import type { ToolbarMenus } from "../panels/react/toolbar/ReadyToolbar.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* (`view`, `add`, `more`, which `ReadyToolbar` and `ListToolbar` take as `menus`). Each is handed its default items and hands
|
|
3
|
+
/** Every menu of a list as data: the grid's (`column`, `row`, `group`, `addColumn`, which `GridTable` takes as `menus`) and the toolbar's
|
|
4
|
+
* (`view`, `add`, `more`, `customize`, which `ReadyToolbar` and `ListToolbar` take as `menus`). Each is handed its default items and hands
|
|
6
5
|
* back the items it shows; a menu with no function is as ViewKit draws it. */
|
|
7
6
|
export type ListMenus<Row> = GridMenus<Row> & ToolbarMenus;
|
|
8
7
|
/** Where a row goes: right after the row of that key, or right before it. */
|
|
@@ -18,7 +17,9 @@ type Keyed<T> = {
|
|
|
18
17
|
children?: T[];
|
|
19
18
|
};
|
|
20
19
|
declare function drop<T extends Keyed<T>>(items: T[], ...keys: string[]): T[];
|
|
21
|
-
declare function rename
|
|
20
|
+
declare function rename<T extends Keyed<T> & {
|
|
21
|
+
label: string;
|
|
22
|
+
}>(items: T[], key: string, label: string): T[];
|
|
22
23
|
declare function add<T extends Keyed<T>>(items: T[], item: T, place?: MenuPlace): T[];
|
|
23
24
|
declare function move<T extends Keyed<T>>(items: T[], key: string, place: MenuPlace): T[];
|
|
24
25
|
/** The four changes an app's menu function makes to the items it is handed. */
|
|
@@ -26,7 +26,7 @@ export type ListState = {
|
|
|
26
26
|
held: Pending | null;
|
|
27
27
|
/** The filter bar shows (the toolbar says, as it draws). */
|
|
28
28
|
barShown: boolean;
|
|
29
|
-
/** Clear and Save stand in Customize's foot
|
|
29
|
+
/** Clear and Save stand in Customize's foot (in Mihai's look beside the bar's, VK-1046; the toolbar says, as it draws). */
|
|
30
30
|
footHere: boolean;
|
|
31
31
|
sortFilter: "right" | "bar";
|
|
32
32
|
bar: "added" | "always";
|
|
@@ -8,6 +8,7 @@ import { useDesktop } from "../provider/desktop.js";
|
|
|
8
8
|
import { getViewOptionAvailability } from "../panels/availability.js";
|
|
9
9
|
import { settingsPanels } from "../panels/settings/settings-panels.js";
|
|
10
10
|
import { settingsCleared } from "../panels/toolbar/clear.js";
|
|
11
|
+
import { pageResets } from "../panels/toolbar/page-resets.js";
|
|
11
12
|
import { countsToggle, groupShown, showCountsChange, showCountsOf } from "../panels/toolbar/counts.js";
|
|
12
13
|
import { withEditView, withViewMenu } from "../panels/toolbar/edit-view.js";
|
|
13
14
|
import { splitViewAxes } from "../panels/views-row/model.js";
|
|
@@ -18,6 +19,7 @@ import { ToolbarFilterAdd } from "../panels/react/toolbar/ToolbarFilterAdd.js";
|
|
|
18
19
|
import { ToolbarFilters, foldableFilters } from "../panels/react/toolbar/ToolbarFilters.js";
|
|
19
20
|
import { ToolbarNew } from "../panels/react/toolbar/ToolbarNew.js";
|
|
20
21
|
import { ToolbarOptions } from "../panels/react/toolbar/ToolbarOptions.js";
|
|
22
|
+
import { EditorMenus } from "../panels/react/toolbar/editor-menus.js";
|
|
21
23
|
import { PaneBox, PaneHost } from "../panels/react/toolbar/pane-host.js";
|
|
22
24
|
import { ToolbarQuickFilters } from "../panels/react/toolbar/ToolbarQuickFilters.js";
|
|
23
25
|
import { ToolbarSave } from "../panels/react/toolbar/ToolbarSave.js";
|
|
@@ -29,11 +31,13 @@ import { ToolbarViews } from "../panels/react/toolbar/ToolbarViews.js";
|
|
|
29
31
|
import { applyParts } from "./parts.js";
|
|
30
32
|
import { useList, useListPanel, useListStore } from "./root-base.js";
|
|
31
33
|
import { useListViewsAxis } from "./views-axis.js";
|
|
34
|
+
import { EMPTY_LAYER, layerHolds } from "./layer.js";
|
|
32
35
|
export function ListToolbar(props) {
|
|
33
|
-
|
|
36
|
+
const { sortEditor: sort, filterEditor: filter, groupEditor: group } = props.menus ?? {};
|
|
37
|
+
return (_jsx(PaneBox.Provider, { value: props.paneBox ?? null, children: _jsx(EditorMenus.Provider, { value: { ...(sort && { sort }), ...(filter && { filter }), ...(group && { group }) }, children: _jsx(ToolbarOfList, { ...props }) }) }));
|
|
34
38
|
}
|
|
35
39
|
function ToolbarOfList(props) {
|
|
36
|
-
const { views: viewsHanded, viewsLayout, onAdd, addItems, addLabel, fieldEditor, searchPlaceholder, searching, hosts, narrow, className, viewName, onRenameView, onCopyLink, onExport, exportCount, menus, toolbarParts, } = props;
|
|
40
|
+
const { views: viewsHanded, viewsLayout, onAdd, addItems, addLabel, fieldEditor, searchPlaceholder, searching, hosts, narrow, className, viewName, onRenameView, onCopyLink, onExport, exportCount, menus, toolbarParts, overflow, } = props;
|
|
37
41
|
const storeViews = useListViewsAxis(props.layouts);
|
|
38
42
|
const rootColumns = useList((s) => s.columns);
|
|
39
43
|
const answer = useList((s) => s.answer);
|
|
@@ -43,7 +47,7 @@ function ToolbarOfList(props) {
|
|
|
43
47
|
const layer = useList((s) => s.view.layer);
|
|
44
48
|
const onChange = useList((s) => s.setSettings);
|
|
45
49
|
const onLayerChange = useList((s) => s.setLayer);
|
|
46
|
-
const
|
|
50
|
+
const shared = useList((s) => s.view.shared) ?? undefined;
|
|
47
51
|
const sortFilter = useList((s) => s.panels.sortFilter);
|
|
48
52
|
const bar = useList((s) => s.panels.bar);
|
|
49
53
|
const customizeOwn = {
|
|
@@ -108,6 +112,29 @@ function ToolbarOfList(props) {
|
|
|
108
112
|
if (change)
|
|
109
113
|
onChange(change);
|
|
110
114
|
};
|
|
115
|
+
const layered = layerHolds(layer, { phone });
|
|
116
|
+
const resetAll = () => {
|
|
117
|
+
if (shared) {
|
|
118
|
+
if (shared.changes > 0)
|
|
119
|
+
shared.onReset();
|
|
120
|
+
}
|
|
121
|
+
else
|
|
122
|
+
clear("options")();
|
|
123
|
+
if (layered)
|
|
124
|
+
onLayerChange(EMPTY_LAYER);
|
|
125
|
+
};
|
|
126
|
+
const view = shared && { ...shared, onReset: resetAll };
|
|
127
|
+
const resets = shared && !shared.saved ? undefined : Object.fromEntries(Object.entries(pageResets(input, shared ? shared.saved ?? null : null, { cleared: !shared, phone })).map(([page, back]) => [
|
|
128
|
+
page,
|
|
129
|
+
() => {
|
|
130
|
+
if (back.change)
|
|
131
|
+
onChange(back.change);
|
|
132
|
+
if (back.layer)
|
|
133
|
+
onLayerChange(back.layer);
|
|
134
|
+
},
|
|
135
|
+
]));
|
|
136
|
+
const differs = resets && { sort: !!resets.sort, filter: !!resets.filter };
|
|
137
|
+
const savedFilter = shared?.saved?.filter;
|
|
111
138
|
const Edit = icons.options;
|
|
112
139
|
const editable = getViewOptionAvailability(inputs).desktop
|
|
113
140
|
? withEditView(views, {
|
|
@@ -127,7 +154,7 @@ function ToolbarOfList(props) {
|
|
|
127
154
|
if (Object.keys(change).length > 0)
|
|
128
155
|
onChange(change);
|
|
129
156
|
} }));
|
|
130
|
-
const sortNode = several && panels.sorts ? (_jsx(ToolbarSortPill, { sorts: panels.sorts, open: sortState.open, onOpenChange: sortState.onOpenChange, host: hosts?.sort, addAfter: props.addAfter })) : (_jsx(ToolbarSort, { sort: panels.sort, open: sortState.open, onOpenChange: sortState.onOpenChange, host: hosts?.sort }));
|
|
157
|
+
const sortNode = several && panels.sorts ? (_jsx(ToolbarSortPill, { sorts: panels.sorts, open: sortState.open, onOpenChange: sortState.onOpenChange, host: hosts?.sort, addAfter: props.addAfter, ...(differs && { changed: differs.sort }) })) : (_jsx(ToolbarSort, { sort: panels.sort, open: sortState.open, onOpenChange: sortState.onOpenChange, host: hosts?.sort }));
|
|
131
158
|
const filterNode = (_jsx(ToolbarFilter, { filters: panels.filters, filterTree: panels.filterTree, onClear: clear("filters"), open: filterState.open, onOpenChange: filterState.onOpenChange, page: filterState.page, onPageChange: filterState.onPageChange, host: hosts?.filter }));
|
|
132
159
|
const holdCounts = answer?.holdCounts;
|
|
133
160
|
const quick = props.quickFilters?.fields.length
|
|
@@ -147,14 +174,14 @@ function ToolbarOfList(props) {
|
|
|
147
174
|
const tree = panels.filterTree;
|
|
148
175
|
const mihais = sortFilter === "right" && !phone;
|
|
149
176
|
const always = bar === "always";
|
|
150
|
-
const filtered = tree ?
|
|
151
|
-
const barShown = always || !!stackedAxes || filtered;
|
|
152
|
-
const footHere = phone ||
|
|
177
|
+
const filtered = tree ? foldableFilters(tree.tree, null, savedFilter) > 0 || !!heldStands(held, tree.tree) : false;
|
|
178
|
+
const barShown = always || !!stackedAxes || filtered || (!!differs && (differs.sort || differs.filter));
|
|
179
|
+
const footHere = phone || mihais;
|
|
153
180
|
const barPublished = kit && !phone && (sortFilter === "bar" || barShown);
|
|
154
181
|
const footPublished = kit ? footHere : true;
|
|
155
182
|
useLayoutEffect(() => store.patch({ panels: { barShown: barPublished, footHere: footPublished } }), [store, barPublished, footPublished]);
|
|
156
183
|
if (kit) {
|
|
157
|
-
const clearable = !view && settingsCleared(input, "options", { phone }) !== null;
|
|
184
|
+
const clearable = !view && (layered || settingsCleared(input, "options", { phone }) !== null);
|
|
158
185
|
const tabs = !phone && viewAxes?.length === 1 ? Math.max(0, viewAxes[0].options.length - 1) : 0;
|
|
159
186
|
const Sort = icons.sort;
|
|
160
187
|
const Filter = icons.filter;
|
|
@@ -210,7 +237,7 @@ function ToolbarOfList(props) {
|
|
|
210
237
|
icon: _jsx(Edit, { className: "h-4 w-4" }),
|
|
211
238
|
onSelect: () => options.onOpenChange(true),
|
|
212
239
|
},
|
|
213
|
-
node: (_jsx(ToolbarOptions, { ...inputs, view: view, viewFoot: !footHere ? "none" : view ? undefined : "kit", footClear: footHere && clearable ?
|
|
240
|
+
node: (_jsx(ToolbarOptions, { ...inputs, view: view, ...(layered && { layered }), viewFoot: !footHere ? "none" : view ? undefined : "kit", footClear: footHere && clearable ? resetAll : undefined, resets: resets, customizeItems: menus?.customize, fieldEditor: fieldEditor, onClear: resetAll, open: options.open, onOpenChange: options.onOpenChange, page: options.page, onPageChange: options.onPageChange, host: optionsHost, ...customizeOwn })),
|
|
214
241
|
},
|
|
215
242
|
...(quickNode
|
|
216
243
|
? [
|
|
@@ -250,7 +277,7 @@ function ToolbarOfList(props) {
|
|
|
250
277
|
key: "save",
|
|
251
278
|
line: 2,
|
|
252
279
|
side: "end",
|
|
253
|
-
node: _jsx(ToolbarSave, { view: view, onClear: clearable ?
|
|
280
|
+
node: _jsx(ToolbarSave, { view: view, layered: layered, onClear: clearable ? resetAll : undefined }),
|
|
254
281
|
},
|
|
255
282
|
]
|
|
256
283
|
: []),
|
|
@@ -260,10 +287,10 @@ function ToolbarOfList(props) {
|
|
|
260
287
|
const phoneParts = quickHere
|
|
261
288
|
? [...kitParts.filter((part) => part !== quickHere), { ...quickHere, line: 2, side: "start" }]
|
|
262
289
|
: kitParts;
|
|
263
|
-
return _jsx(Toolbar, { parts: placed(phoneParts), phone: true, fold: true, more: menus?.more, className: className });
|
|
290
|
+
return _jsx(Toolbar, { parts: placed(phoneParts), phone: true, fold: true, more: menus?.more, overflow: overflow, className: className });
|
|
264
291
|
}
|
|
265
292
|
if (sortFilter === "bar")
|
|
266
|
-
return _jsx(Toolbar, { parts: placed(kitParts), phone: phone, fold: true, more: menus?.more, className: className });
|
|
293
|
+
return _jsx(Toolbar, { parts: placed(kitParts), phone: phone, fold: true, more: menus?.more, overflow: overflow, className: className });
|
|
267
294
|
const rowSort = {
|
|
268
295
|
key: "sort",
|
|
269
296
|
side: "end",
|
|
@@ -274,7 +301,7 @@ function ToolbarOfList(props) {
|
|
|
274
301
|
icon: _jsx(Sort, { className: "h-4 w-4" }),
|
|
275
302
|
onSelect: () => sortAdd.onOpenChange(true),
|
|
276
303
|
},
|
|
277
|
-
node: panels.sorts ? (_jsx(ToolbarSortPill, { row: true, sorts: panels.sorts, open: sortAdd.open, onOpenChange: sortAdd.onOpenChange, host: hosts?.sort })) : (_jsx(ToolbarSort, { sort: panels.sort, open: sortAdd.open, onOpenChange: sortAdd.onOpenChange, host: hosts?.sort })),
|
|
304
|
+
node: panels.sorts ? (_jsx(ToolbarSortPill, { row: true, sorts: panels.sorts, open: sortAdd.open, onOpenChange: sortAdd.onOpenChange, host: hosts?.sort, ...(differs && { changed: differs.sort }) })) : (_jsx(ToolbarSort, { sort: panels.sort, open: sortAdd.open, onOpenChange: sortAdd.onOpenChange, host: hosts?.sort, ...(differs && { changed: differs.sort }) })),
|
|
278
305
|
};
|
|
279
306
|
const rowFilter = tree
|
|
280
307
|
? {
|
|
@@ -283,10 +310,10 @@ function ToolbarOfList(props) {
|
|
|
283
310
|
shed: true,
|
|
284
311
|
fold: true,
|
|
285
312
|
menu: { ...filterMenu, onSelect: () => filterAdd.onOpenChange(true) },
|
|
286
|
-
node: (_jsx(ToolbarFilterAdd, { filterTree: tree, onHeldChange: setHeld, open: filterAdd.open, onOpenChange: filterAdd.onOpenChange, host: hosts?.filter })),
|
|
313
|
+
node: (_jsx(ToolbarFilterAdd, { filterTree: tree, onHeldChange: setHeld, open: filterAdd.open, onOpenChange: filterAdd.onOpenChange, host: hosts?.filter, changed: !!differs?.filter, opens: "filters" })),
|
|
287
314
|
}
|
|
288
315
|
: { key: "filter", side: "end", shed: true, fold: true, menu: filterMenu, node: filterNode };
|
|
289
|
-
const pill = always && panels.sorts ? (_jsx(ToolbarSortPill, { sorts: panels.sorts, open: sortState.open, onOpenChange: sortState.onOpenChange, host: hosts?.sort, addAfter: false })) : null;
|
|
316
|
+
const pill = (always || !!differs?.sort) && (panels.sorts ?? panels.sort).options.length > 0 ? (panels.sorts ? (_jsx(ToolbarSortPill, { sorts: panels.sorts, open: sortState.open, onOpenChange: sortState.onOpenChange, host: hosts?.sort, addAfter: false })) : (_jsx(ToolbarSort, { bar: true, sort: panels.sort, open: sortState.open, onOpenChange: sortState.onOpenChange, host: hosts?.sort }))) : null;
|
|
290
317
|
const stackedPart = kitParts.find((part) => part.key === "views-stacked");
|
|
291
318
|
const barParts = barShown
|
|
292
319
|
? [
|
|
@@ -298,8 +325,8 @@ function ToolbarOfList(props) {
|
|
|
298
325
|
{
|
|
299
326
|
key: "filters",
|
|
300
327
|
line: 2,
|
|
301
|
-
filters: foldableFilters(tree.tree, held),
|
|
302
|
-
node: (_jsx(ToolbarFilters, { filterTree: tree, open: filterState.open, onOpenChange: filterState.onOpenChange, held: held, onHeldChange: setHeld, host: hosts?.filter, emptyPlace: always })),
|
|
328
|
+
filters: foldableFilters(tree.tree, held, always ? undefined : savedFilter),
|
|
329
|
+
node: (_jsx(ToolbarFilters, { filterTree: tree, open: filterState.open, onOpenChange: filterState.onOpenChange, held: held, onHeldChange: setHeld, host: hosts?.filter, emptyPlace: always, ...(!always && savedFilter && { saved: savedFilter }) })),
|
|
303
330
|
},
|
|
304
331
|
]
|
|
305
332
|
: []),
|
|
@@ -307,7 +334,7 @@ function ToolbarOfList(props) {
|
|
|
307
334
|
key: "save",
|
|
308
335
|
line: 2,
|
|
309
336
|
side: "end",
|
|
310
|
-
node: _jsx(ToolbarSave, { view: view, onClear: clearable ?
|
|
337
|
+
node: _jsx(ToolbarSave, { view: view, layered: layered, onClear: clearable ? resetAll : undefined }),
|
|
311
338
|
},
|
|
312
339
|
]
|
|
313
340
|
: [];
|
|
@@ -330,7 +357,7 @@ function ToolbarOfList(props) {
|
|
|
330
357
|
at("new"),
|
|
331
358
|
...barParts,
|
|
332
359
|
];
|
|
333
|
-
return _jsx(Toolbar, { parts: placed(mihaisParts), phone: phone, fold: true, more: menus?.more, className: className });
|
|
360
|
+
return _jsx(Toolbar, { parts: placed(mihaisParts), phone: phone, fold: true, more: menus?.more, overflow: overflow, className: className });
|
|
334
361
|
}
|
|
335
362
|
const parts = [
|
|
336
363
|
...(shownViews
|
|
@@ -369,7 +396,7 @@ function ToolbarOfList(props) {
|
|
|
369
396
|
{
|
|
370
397
|
key: "options",
|
|
371
398
|
side: "end",
|
|
372
|
-
node: (_jsx(ToolbarOptions, { ...inputs, view: view,
|
|
399
|
+
node: (_jsx(ToolbarOptions, { ...inputs, view: view, ...(layered && { layered }), resets: resets, customizeItems: menus?.customize, fieldEditor: fieldEditor, onClear: resetAll, open: options.open, onOpenChange: options.onOpenChange, page: options.page, onPageChange: options.onPageChange, host: optionsHost, ...customizeOwn })),
|
|
373
400
|
},
|
|
374
401
|
{ key: "new", side: "end", node: _jsx(ToolbarNew, { onAdd: onAdd, items: newItems, label: addLabel }) },
|
|
375
402
|
];
|
package/views/dist/list/views.js
CHANGED
|
@@ -17,7 +17,12 @@ type ResolvedPersonalSection<V extends string = string> = {
|
|
|
17
17
|
choices: LayoutViewChoice<V>[];
|
|
18
18
|
onReset?: () => void;
|
|
19
19
|
};
|
|
20
|
+
/** @deprecated Read by nothing since Customize's Layout page ends at its toggles (VK-1033): an app's `personal` draws
|
|
21
|
+
* nowhere. To be removed in a later release. */
|
|
20
22
|
export declare function resolvePersonalSection<V extends string>(layout: LayoutConfig<V>, messages?: ViewsMessageResolver): ResolvedPersonalSection<V> | null;
|
|
23
|
+
/** Whether a list's Layout stands on a phone: not marked for the computer alone, or with the phone's own value and its
|
|
24
|
+
* write. */
|
|
25
|
+
export declare function layoutStandsOnPhone(layout: LayoutConfig<string>): boolean;
|
|
21
26
|
/** Desktop-only controls must not create an empty mobile View sheet. */
|
|
22
27
|
export declare function getViewOptionAvailability<S extends string, G extends string, T extends string>({ filters, sort, group, timeScopeConfig, dateRangeConfigs, toggles, layout, }: ViewOptionInputs<S, G, T>): {
|
|
23
28
|
desktop: boolean;
|
|
@@ -14,13 +14,12 @@ export function resolvePersonalSection(layout, messages = resolveViewsMessage) {
|
|
|
14
14
|
onReset: personal.onReset,
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
+
export function layoutStandsOnPhone(layout) {
|
|
18
|
+
return !layout.desktopOnly || (layout.mobileValue != null && layout.onMobileChange !== undefined);
|
|
19
|
+
}
|
|
17
20
|
export function getViewOptionAvailability({ filters, sort, group, timeScopeConfig, dateRangeConfigs, toggles, layout, }) {
|
|
18
21
|
const shared = !!filters?.length || !!sort || !!group || !!timeScopeConfig || !!dateRangeConfigs?.length;
|
|
19
|
-
const
|
|
20
|
-
const mobileLayout = !!layout &&
|
|
21
|
-
(hasPersonal ||
|
|
22
|
-
!layout.desktopOnly ||
|
|
23
|
-
(layout.mobileValue != null && layout.onMobileChange !== undefined));
|
|
22
|
+
const mobileLayout = !!layout && layoutStandsOnPhone(layout);
|
|
24
23
|
return {
|
|
25
24
|
desktop: shared || !!toggles?.length || !!layout,
|
|
26
25
|
mobile: shared || !!toggles?.some((toggle) => !toggle.desktopOnly) || mobileLayout,
|
|
@@ -10,12 +10,16 @@ export declare function groupBodyValue(group: GroupConfig): ViewsGroupValue;
|
|
|
10
10
|
export declare function groupBodyWrite(group: GroupConfig, next: ViewsGroupValue): (() => void) | null;
|
|
11
11
|
/** What a `GroupBody` is handed, its chrome (`form`, `onDone`, `actions`) aside: a Customize body's `group` too. */
|
|
12
12
|
export declare function groupBodyProps(group: GroupConfig, messages: ViewsMessageResolver): Omit<ViewsGroupBodyProps, "form" | "onDone" | "actions">;
|
|
13
|
-
/** ViewKit's page as a Customize body's: a page under a section is that section's
|
|
13
|
+
/** ViewKit's page as a Customize body's: a page under a section is that section's; an app's own page `page:<key>`. */
|
|
14
14
|
export declare function customizePageOf(panel: ActivePanel): ViewsCustomizePage;
|
|
15
15
|
/** A Customize body's page as ViewKit's: its list is no page; Filter is the folded Filter page. */
|
|
16
16
|
export declare function activePanelOf(page: ViewsCustomizePage): ActivePanel;
|
|
17
17
|
/** A toggle as a Customize body is handed it. */
|
|
18
18
|
export declare function customizeToggleOf(toggle: ToggleConfig): ViewsCustomizeToggle;
|
|
19
|
+
/** A list's Layout as a phone reads it (VK-900): the phone's own layout, its options and refusals, and its write, each the
|
|
20
|
+
* computer's where the phone has none of its own, and no toggle marked for the computer alone; null where the Layout is
|
|
21
|
+
* the computer's alone. The computer's layout is never written from a phone, nor the phone's from a computer. */
|
|
22
|
+
export declare function layoutOnPhone<V extends string>(layout: LayoutConfig<V>): LayoutConfig<V> | null;
|
|
19
23
|
/** The Layout section, gated as ViewKit's own Layout page gates it: the layout's toggles only on the layout they
|
|
20
24
|
* belong to (`subOptionsFor`), Density where `densityFor` names the layout, each choice on its own `views`. */
|
|
21
25
|
export declare function customizeLayoutOf(layout: LayoutConfig, messages: ViewsMessageResolver): ViewsCustomizeLayout;
|