viewkitjs 0.34.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 +110 -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 +9 -6
- package/views/dist/contract.js +4 -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 +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 +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/customize/customize.d.ts +14 -5
- package/views/dist/controls/customize/customize.js +11 -14
- package/views/dist/controls/customize/map-customize-body.js +12 -11
- package/views/dist/controls/customize/words.d.ts +3 -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/parts.d.ts +1 -1
- package/views/dist/controls/filter-editor/parts.js +4 -4
- package/views/dist/controls/index.d.ts +1 -1
- package/views/dist/controls/internal/map-panel-controls.js +9 -5
- package/views/dist/controls/internal/panel-controls.d.ts +27 -3
- package/views/dist/controls/internal/panel-controls.js +141 -12
- 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 +3 -0
- package/views/dist/controls/menu/menu.js +2 -1
- package/views/dist/controls/picker/map-fields-body.d.ts +2 -2
- package/views/dist/controls/picker/map-fields-body.js +5 -1
- 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/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/select.d.ts +3 -0
- package/views/dist/controls/select/select.js +9 -3
- 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/toolbar/toolbar.d.ts +25 -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/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 +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.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/store.d.ts +1 -1
- package/views/dist/list/toolbar.js +44 -19
- 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 +4 -1
- 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/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 +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 +4 -4
- package/views/dist/panels/react/views-row/ViewPicker.js +13 -5
- 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 +27 -5
- package/views/dist/provider/components.js +1 -1
- package/views/dist/react.d.ts +1 -1
- package/views/dist/styles.css +98 -23
- package/views/dist/styles.unlayered.css +98 -23
- package/views/docs/contract.md +38 -25
- 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 +17 -15
- 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 +2 -2
- package/views/docs/reference/looks.md +5 -5
- package/views/docs/reference/panels-react.md +13 -12
- package/views/docs/reference/panels.md +4 -4
- package/views/docs/reference/react.md +10 -8
- package/views/docs/reference/views.md +2 -2
- package/views/docs/reshaping.md +22 -6
- package/views/skills/views/SKILL.md +2 -2
|
@@ -51,7 +51,7 @@ function GridGroupSection({ group, collapsed, count, selectable, foldOverChecks
|
|
|
51
51
|
: "mt-(--vk-group-gap,calc(var(--spacing)*5))"
|
|
52
52
|
: "mt-(--vk-group-gap,calc(var(--spacing)*5)) first:mt-0", children: [_jsx(StuckMarker, {}), _jsxs("div", { "data-slot": "vk-grid-group-head", className: oneHead
|
|
53
53
|
? "sticky top-(--vk-head-h) z-30 flow-root data-[stuck=true]:bg-(color:--vk-ground)"
|
|
54
|
-
: "sticky top-0 z-30 data-[stuck=true]:bg-(color:--vk-ground)", children: [_jsx("div", { "data-slot": "vk-grid-group-header", role: "row", "aria-rowindex": barIndex, "aria-level": 1, "aria-expanded": !collapsed, className: cx("group/gridlabel [position:var(--vk-pin,sticky)] left-(--vk-sx,0px) mb-1.5 flex h-(--vk-label-h) w-max max-w-[100cqw] select-none items-center gap-2", GRID_ROW_PAD), children: _jsxs("div", { "data-bar-name": true, tabIndex: -1, role: "gridcell", "aria-colindex": 1, "aria-colspan": ariaColCount, className: cx("flex min-w-0 items-center gap-2 rounded-sm", GRID_CHROME_FOCUS), children: [drawGridButton(views, {
|
|
54
|
+
: "sticky top-0 z-30 data-[stuck=true]:bg-(color:--vk-ground)", children: [_jsx("div", { "data-slot": "vk-grid-group-header", role: "row", "aria-rowindex": barIndex, "aria-level": 1, "aria-expanded": !collapsed, className: cx("group/gridlabel [position:var(--vk-pin,sticky)] left-(--vk-sx,0px) mb-1.5 flex h-(--vk-label-h) w-max max-w-[100cqw] select-none items-center gap-2", GRID_ROW_PAD), children: _jsxs("div", { "data-bar-name": true, tabIndex: -1, role: "gridcell", "aria-colindex": 1, "aria-colspan": ariaColCount, className: cx("relative flex min-w-0 items-center gap-2 rounded-sm", GRID_CHROME_FOCUS), children: [drawGridButton(views, {
|
|
55
55
|
frame: cx("h-6 w-6 shrink-0", foldOverChecks && "ml-(--vk-px)"),
|
|
56
56
|
variant: "ghost",
|
|
57
57
|
size: "icon",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useContext, useDeferredValue, useLayoutEffect, useMemo, useRef, useState, } from "react";
|
|
4
|
-
import { createGridHoverStore, GridHoverContext, useAnyHover, useGridHeldHover } from "./grid-hover.js";
|
|
4
|
+
import { createGridHoverStore, GridHoverContext, GridRowHighlightContext, useAnyHover, useGridHeldHover } from "./grid-hover.js";
|
|
5
5
|
import { GridFitContext } from "./useGridFittedWidths.js";
|
|
6
6
|
import { useViews } from "../../provider/context.js";
|
|
7
7
|
import { GridRailProbe, useGridRailReveal } from "./useGridRailReveal.js";
|
|
@@ -255,6 +255,16 @@ function GridTableContent(given) {
|
|
|
255
255
|
revealCell,
|
|
256
256
|
desktopQuery,
|
|
257
257
|
});
|
|
258
|
+
const highlight = props.rowHighlight ?? "hover";
|
|
259
|
+
const [activeRow, setActiveRow] = useState(null);
|
|
260
|
+
const pickedRow = focusedCell?.rowId ?? null;
|
|
261
|
+
const [seenPick, setSeenPick] = useState(pickedRow);
|
|
262
|
+
if (pickedRow !== seenPick) {
|
|
263
|
+
setSeenPick(pickedRow);
|
|
264
|
+
if (pickedRow != null)
|
|
265
|
+
setActiveRow(pickedRow);
|
|
266
|
+
}
|
|
267
|
+
const onActivate = highlight === "active" ? setActiveRow : undefined;
|
|
258
268
|
const railRow = focus.chrome?.kind === "rail" ? focus.chrome.rowKey : undefined;
|
|
259
269
|
const keptFor = (groupKey) => {
|
|
260
270
|
const kept = [];
|
|
@@ -330,6 +340,8 @@ function GridTableContent(given) {
|
|
|
330
340
|
listConfig,
|
|
331
341
|
rowWritable: props.rowWritable?.(row) ?? true,
|
|
332
342
|
focusedColId: focusedCell?.rowId === rowKey ? focusedCell.columnId : null,
|
|
343
|
+
active: onActivate != null && activeRow === rowKey,
|
|
344
|
+
onActivate,
|
|
333
345
|
editingColId: editingCell?.rowId === rowKey ? editingCell.columnId : null,
|
|
334
346
|
editSeed: editingCell?.rowId === rowKey ? editSeed : null,
|
|
335
347
|
editWhole: editingCell?.rowId === rowKey && editWhole,
|
|
@@ -379,24 +391,24 @@ function GridTableContent(given) {
|
|
|
379
391
|
const pinFooter = props.pinFooter && footerKey.includes("1")
|
|
380
392
|
? { pin: grouped ? "group" : "foot", flush: footerKey.endsWith("1") }
|
|
381
393
|
: undefined;
|
|
382
|
-
const footer = (group) => (_jsx(GridFooter, { group: group, ariaRowIndex: aria.footIndex(grouped ? group.key : (flat.sections[0]?.groupKey ?? group.key)), ariaLevel: grouped ? 2 : undefined, ariaColOffset: ariaColOffset, columns: visibleColumns, selecting: selecting, aggregates: aggregates, numberFormats: numberFormats, renderAggregate: renderAggregate, onAggregateChange: onAggregateChange, viewBacked: props.viewBacked, frozenCount: frozenCount, frozenLeft: frozenLeft, continuation: props.renderGroupFooter?.(group), defaultCurrency: props.defaultCurrency, pageOnly: paged, pin: pinFooter?.pin }));
|
|
394
|
+
const footer = (group) => (_jsx(GridFooter, { group: group, ariaRowIndex: aria.footIndex(grouped ? group.key : (flat.sections[0]?.groupKey ?? group.key)), ariaLevel: grouped ? 2 : undefined, ariaColOffset: ariaColOffset, columns: visibleColumns, selecting: selecting, aggregates: aggregates, numberFormats: numberFormats, renderAggregate: renderAggregate, onAggregateChange: onAggregateChange, viewBacked: props.viewBacked, frozenCount: frozenCount, frozenLeft: frozenLeft, continuation: props.renderGroupFooter?.(group), defaultCurrency: props.defaultCurrency, pageOnly: paged, pin: pinFooter?.pin, verticalBorders: verticalBorders }));
|
|
383
395
|
const groupCheckbox = (items) => pickOnPhone ? (_jsx(GridHeadCheckBox, { ...groupSelection(items), "aria-label": messages({ key: "views.grid.select-group" }) })) : (_jsx(GridHeadCheck, { selecting: selecting, ...groupSelection(items), "aria-label": messages({ key: "views.grid.select-group" }) }));
|
|
384
|
-
return (_jsx(EditLeaveContext.Provider, { value: leaveScope, children: _jsx(GridFitContext.Provider, { value: fit, children: _jsx(GridHoverContext.Provider, { value: hoverStore, children: _jsx(GridRowWindowContext.Provider, { value: rowWindow.store, children: _jsx(GridTableSurface, { rootRef: rootRef, empty: empty, desktop: !phone, areaRef: areaRef, panRef: panRef, boxes: boxes, minWidth: minWidth, columnsTemplate: gridTemplate, gridAria: empty
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
396
|
+
return (_jsx(EditLeaveContext.Provider, { value: leaveScope, children: _jsx(GridFitContext.Provider, { value: fit, children: _jsx(GridHoverContext.Provider, { value: hoverStore, children: _jsx(GridRowHighlightContext.Provider, { value: highlight, children: _jsx(GridRowWindowContext.Provider, { value: rowWindow.store, children: _jsx(GridTableSurface, { rootRef: rootRef, empty: empty, desktop: !phone, areaRef: areaRef, panRef: panRef, boxes: boxes, minWidth: minWidth, columnsTemplate: gridTemplate, gridAria: empty
|
|
397
|
+
? { role: "grid", rowCount: 2, colCount: ariaTailIndex }
|
|
398
|
+
: { role: aria.role, rowCount: aria.rowCount, colCount: ariaTailIndex }, style: { ...widthVarsStyle, ...scaleVarsStyle }, selecting: selecting, pinFooter: pinFooter, railRootProps: rail.rootProps, onPointerDown: (event) => {
|
|
399
|
+
longPress.onPointerDown(event);
|
|
400
|
+
if (checkDrag.tryArm(event))
|
|
401
|
+
return;
|
|
402
|
+
handleRootPointerDown(event);
|
|
403
|
+
}, onPointerDownCapture: handleRootPointerDownCapture, onClickCapture: (event) => {
|
|
404
|
+
if (checkDrag.consumeDrag() || longPress.consumeClick()) {
|
|
405
|
+
event.preventDefault();
|
|
406
|
+
event.stopPropagation();
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
handleRootClickCapture(event);
|
|
410
|
+
}, railProbe: _jsx(GridRailProbe, { probeRef: rail.probeRef }), onGuardFocus: (which, from) => {
|
|
411
|
+
if (!settlingFrom())
|
|
412
|
+
enterGrid(which, from);
|
|
413
|
+
}, body: _jsx(GridBody, { empty: empty, emptyState: emptyState, grouped: grouped, oneHead: oneHead, groups: groups, rows: flatRows, selectable: selectable, selecting: selecting, phoneChecks: pickOnPhone, foldOverChecks: foldOverChecks, allSelected: sel.allSelected, someSelected: sel.someSelected, selectAll: sel.selectAll, clearSelection: sel.clear, isCollapsed: isCollapsed, countOf: countOf, sort: sort, sortOptions: sortOptions, groupSummary: groupSummary, onToggleGroup: onToggleGroup, onGroupSummaryChange: onGroupSummaryChange, renderGroupLabel: renderGroupLabel, onHideGroup: onHideGroup, groupMenu: props.groupMenu, menus: props.menus, figures: bandFigures, countNoun: countNoun, renderHeader: header, renderGroupCheckbox: groupCheckbox, selectGroup: groupSelection, renderRow: renderRow, wrapRows: wrapRows, renderFooter: footer, keptFor: keptFor, barIndexOf: aria.barIndex, ariaColCount: ariaTailIndex }), loadMore: !paged && loadMore?.hasMore ? _jsx(LoadMore, { onReveal: loadMore.onReveal, label: loadMore.label }) : undefined, pager: paged ? _jsx(GridPager, { pages: pages, rowsOnPage: total }) : undefined, selectionBar: selection?.renderBar?.(sel, batchApi) }) }) }) }) }) }));
|
|
402
414
|
}
|
|
@@ -7,7 +7,7 @@ export declare function GridFrozenEdge(): import("react/jsx-runtime").JSX.Elemen
|
|
|
7
7
|
/** Empty rail segment — keeps the opaque lane continuous across the header and
|
|
8
8
|
* footer rows, which have no checkbox of their own. `bordered` follows whether
|
|
9
9
|
* that surface's own cells draw a bottom rule: the header's do, the footer's
|
|
10
|
-
*
|
|
10
|
+
* only under the column lines (`verticalBorders`). */
|
|
11
11
|
export declare function GridRailSpacer({ selecting, bordered, shadow, cell, }: {
|
|
12
12
|
selecting: boolean;
|
|
13
13
|
bordered?: boolean;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useContext } from "react";
|
|
3
4
|
import { useViews } from "../../provider/context.js";
|
|
4
5
|
import { cx } from "../../internal/cx.js";
|
|
5
6
|
import { gridFrozenBg } from "./GridCellOutline.js";
|
|
7
|
+
import { GridRowHighlightContext } from "./grid-hover.js";
|
|
6
8
|
import { GRID_CONTENT_PAD, GRID_GROUND_WHILE_SCROLLED } from "./grid-styles.js";
|
|
7
9
|
import { GRID_RAIL_PLACE } from "./grid-columns-template.js";
|
|
8
10
|
import { SelectCheckbox } from "../../selection/SelectCheckbox.js";
|
|
@@ -23,8 +25,9 @@ export function GridFrozenEdge() {
|
|
|
23
25
|
return (_jsx("div", { "aria-hidden": true, className: cx("pointer-events-none absolute inset-0", GRID_CONTENT_PAD), children: _jsx("div", { className: cx(RAIL_HOLD, "w-0"), children: _jsx(FrozenShadow, {}) }) }));
|
|
24
26
|
}
|
|
25
27
|
function RailSlot({ shadow = true, selecting, selected = false, bordered = false, reveal, cell, children, }) {
|
|
28
|
+
const highlight = useContext(GridRowHighlightContext);
|
|
26
29
|
const stands = children ? (reveal === "head" ? "head" : "row") : cell;
|
|
27
|
-
return (_jsxs("div", { "data-slot": "vk-grid-rail", role: stands === "head" ? "columnheader" : stands ? "gridcell" : undefined, "aria-colindex": stands ? 1 : undefined, "aria-hidden": stands ? undefined : true, style: GRID_RAIL_PLACE, className: RAIL_HOLD, "data-action-menu": true, onClick: (e) => e.stopPropagation(), children: [_jsx("div", { "data-row-check": selecting ? "" : undefined, className: cx("relative flex h-full w-[calc(var(--vk-gutter,0px)+var(--vk-indent,0px))] -translate-x-full items-start justify-end", "pr-[calc(var(--vk-rail-gap)+((var(--vk-rail-w)-16px)/2-var(--vk-rail-gap))*var(--vk-parked,0)*(1-var(--vk-frozen-on,0)))]", "transition-[padding-right] duration-(--vk-duration,150ms)", "before:pointer-events-none before:absolute before:inset-0 before:content-['']", gridFrozenBg(selected, "before"), "before:opacity-[calc(var(--vk-frozen-on,0)*var(--vk-scrolled,0))] before:transition-opacity before:duration-(--vk-duration,150ms)", reveal && HOVER_RAISE[reveal].backing, "group-data-[rail=on]/gridtable:before:opacity-(--vk-scrolled,0)", bordered &&
|
|
30
|
+
return (_jsxs("div", { "data-slot": "vk-grid-rail", role: stands === "head" ? "columnheader" : stands ? "gridcell" : undefined, "aria-colindex": stands ? 1 : undefined, "aria-hidden": stands ? undefined : true, style: GRID_RAIL_PLACE, className: RAIL_HOLD, "data-action-menu": true, onClick: (e) => e.stopPropagation(), children: [_jsx("div", { "data-row-check": selecting ? "" : undefined, className: cx("relative flex h-full w-[calc(var(--vk-gutter,0px)+var(--vk-indent,0px))] -translate-x-full items-start justify-end", "pr-[calc(var(--vk-rail-gap)+((var(--vk-rail-w)-16px)/2-var(--vk-rail-gap))*var(--vk-parked,0)*(1-var(--vk-frozen-on,0)))]", "transition-[padding-right] duration-(--vk-duration,150ms)", "before:pointer-events-none before:absolute before:inset-0 before:content-['']", gridFrozenBg(selected, "before", highlight), "before:opacity-[calc(var(--vk-frozen-on,0)*var(--vk-scrolled,0))] before:transition-opacity before:duration-(--vk-duration,150ms)", reveal && HOVER_RAISE[reveal].backing, "group-data-[rail=on]/gridtable:before:opacity-(--vk-scrolled,0)", bordered &&
|
|
28
31
|
"after:pointer-events-none after:absolute after:inset-x-0 after:bottom-0 after:h-px after:content-[''] after:bg-(color:--vk-border-subtle)"), children: children ? (_jsx("span", { "data-row-check": true, className: "relative flex h-full items-center", children: children })) : null }), shadow && _jsx(FrozenShadow, {})] }));
|
|
29
32
|
}
|
|
30
33
|
export function GridRailSpacer({ selecting, bordered = false, shadow = true, cell, }) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FieldSettlement } from "viewkitjs/fields";
|
|
2
|
+
import { type GridRowHighlight } from "./GridCellOutline.js";
|
|
2
3
|
import type { GridWriteState } from "../core/write-states.js";
|
|
3
4
|
/**
|
|
4
5
|
* One body cell's class string.
|
|
@@ -21,10 +22,11 @@ export type GridCellClassState = {
|
|
|
21
22
|
inRange: boolean;
|
|
22
23
|
/** The row is selected (frozen cells repaint the selection tint). */
|
|
23
24
|
selected: boolean;
|
|
25
|
+
/** Which row the grid tints (`rowHighlight`): a frozen cell repaints the row's tint by the same rule. */
|
|
26
|
+
highlight?: GridRowHighlight;
|
|
24
27
|
/** The cell opens a pick-list (select, relation, chips): its ▾ is placed by the cell's edges. */
|
|
25
28
|
picker?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
lastColumn: boolean;
|
|
29
|
+
/** The lines between the columns: every cell's right border, the last column's included, so the line closes the table. */
|
|
28
30
|
verticalBorders: boolean;
|
|
29
31
|
/** The value is saved here but its provider has not accepted it yet (spec
|
|
30
32
|
* §11.2) — the one pending state the grid draws, beside `data-settlement`. */
|
|
@@ -93,4 +95,6 @@ export declare function gridRowClassName(state: {
|
|
|
93
95
|
selected: boolean;
|
|
94
96
|
selectable: boolean;
|
|
95
97
|
hostClass?: string;
|
|
98
|
+
/** Which row tints (`rowHighlight`): the one under the pointer or held there, or the active row (`data-active`) alone. */
|
|
99
|
+
highlight?: GridRowHighlight;
|
|
96
100
|
}): string;
|
|
@@ -39,7 +39,7 @@ export function gridCellStates(state) {
|
|
|
39
39
|
}
|
|
40
40
|
export function gridCellClassName(state) {
|
|
41
41
|
const { focused, editing, inRange, frozen, selected } = state;
|
|
42
|
-
return cx(state.settlement === "requested" && GRID_CELL_REQUESTED, "group/gridcell", "outline-none", "data-invalid:outline-solid data-invalid:outline-(length:--vk-border-width,1px) data-invalid:-outline-offset-(--vk-border-width,1px) data-invalid:outline-(color:--vk-border-danger,var(--vk-danger))", "flex min-w-0 border-b border-r border-(color:--vk-border-subtle) px-(--vk-px) text-(length:--vk-text)", "h-(--vk-row-h) items-center whitespace-nowrap", "scroll-mt-(--vk-scroll-mt)", "scroll-ml-[calc(var(--vk-rail-w)+var(--vk-frozen-w,0px))]",
|
|
42
|
+
return cx(state.settlement === "requested" && GRID_CELL_REQUESTED, "group/gridcell", "outline-none", "data-invalid:outline-solid data-invalid:outline-(length:--vk-border-width,1px) data-invalid:-outline-offset-(--vk-border-width,1px) data-invalid:outline-(color:--vk-border-danger,var(--vk-danger))", "flex min-w-0 border-b border-r border-(color:--vk-border-subtle) px-(--vk-px) text-(length:--vk-text)", "h-(--vk-row-h) items-center whitespace-nowrap", "scroll-mt-(--vk-scroll-mt)", "scroll-ml-[calc(var(--vk-rail-w)+var(--vk-frozen-w,0px))]", !state.verticalBorders && "border-r-transparent", state.align === "right" && "justify-end text-right tabular-nums", state.align === "center" && "justify-center text-center", frozen
|
|
43
43
|
? "[position:var(--vk-pin,sticky)]"
|
|
44
44
|
: focused || editing || inRange || state.isTitle || state.picker
|
|
45
45
|
? "relative"
|
|
@@ -55,7 +55,7 @@ export function gridCellClassName(state) {
|
|
|
55
55
|
: "z-5"
|
|
56
56
|
: inRange
|
|
57
57
|
? "z-4"
|
|
58
|
-
: undefined, frozen && gridFrozenBg(selected, editing ? undefined : "while-scrolled"), editing && GRID_GROUND, !focused &&
|
|
58
|
+
: undefined, frozen && gridFrozenBg(selected, editing ? undefined : "while-scrolled", state.highlight), editing && GRID_GROUND, !focused &&
|
|
59
59
|
!editing &&
|
|
60
60
|
!inRange &&
|
|
61
61
|
!state.isTitle &&
|
|
@@ -63,8 +63,13 @@ export function gridCellClassName(state) {
|
|
|
63
63
|
}
|
|
64
64
|
export function gridRowClassName(state) {
|
|
65
65
|
const { selected, selectable, hostClass } = state;
|
|
66
|
+
const active = state.highlight === "active";
|
|
66
67
|
const hostPaintsGround = hostClass != null && /(?:^|\s)bg-/.test(hostClass);
|
|
67
|
-
return cx("group/gridrow relative grid grid-cols-(--vk-cols) cursor-pointer pl-[calc(var(--vk-gutter,0px)+var(--vk-indent,0px))] pr-(--vk-gutter,0px)", GRID_ONE_LINE, selectable && ROW_NO_TEXT_SELECT,
|
|
68
|
-
?
|
|
69
|
-
|
|
68
|
+
return cx("group/gridrow relative grid grid-cols-(--vk-cols) cursor-pointer pl-[calc(var(--vk-gutter,0px)+var(--vk-indent,0px))] pr-(--vk-gutter,0px)", GRID_ONE_LINE, selectable && ROW_NO_TEXT_SELECT, active
|
|
69
|
+
? selected
|
|
70
|
+
? "data-active:bg-[linear-gradient(color-mix(in_oklab,_var(--vk-brand)_10%,_transparent),color-mix(in_oklab,_var(--vk-brand)_10%,_transparent))]"
|
|
71
|
+
: "data-active:bg-[linear-gradient(var(--vk-hovered),var(--vk-hovered))]"
|
|
72
|
+
: selected
|
|
73
|
+
? "hover:bg-[linear-gradient(color-mix(in_oklab,_var(--vk-brand)_10%,_transparent),color-mix(in_oklab,_var(--vk-brand)_10%,_transparent))] data-hovered:bg-[linear-gradient(color-mix(in_oklab,_var(--vk-brand)_10%,_transparent),color-mix(in_oklab,_var(--vk-brand)_10%,_transparent))]"
|
|
74
|
+
: "hover:bg-[linear-gradient(var(--vk-hovered),var(--vk-hovered))] data-hovered:bg-[linear-gradient(var(--vk-hovered),var(--vk-hovered))]", selected && !hostPaintsGround && "bg-(color:--vk-brand-subtlest)", hostClass);
|
|
70
75
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type PointerEvent as ReactPointerEvent } from "react";
|
|
2
2
|
import type { ListCellAction } from "../../model/column-schema.js";
|
|
3
|
+
import type { GridRowHighlight } from "./GridCellOutline.js";
|
|
3
4
|
import { type GridButtonViews } from "./grid-button.js";
|
|
4
5
|
/**
|
|
5
6
|
* WHERE THE POINTER IS, for the two things a row draws only there: the name's
|
|
@@ -16,20 +17,27 @@ export type GridHoverTarget = {
|
|
|
16
17
|
rowKey: string;
|
|
17
18
|
colId: string | null;
|
|
18
19
|
};
|
|
20
|
+
/** Which row the grid tints (`rowHighlight`), handed by the table to the parts of a row that repaint its tint over their
|
|
21
|
+
* own ground: the row itself, its pinned cells, its rail and the name's action lane. */
|
|
22
|
+
export declare const GridRowHighlightContext: import("react").Context<GridRowHighlight>;
|
|
19
23
|
export type GridHoverStore = {
|
|
20
24
|
get(): GridHoverTarget | null;
|
|
21
25
|
set(target: GridHoverTarget | null): void;
|
|
22
26
|
/** The record an app draws as under the pointer (`hoveredRow`), beside wherever the real pointer is. */
|
|
23
27
|
held(): string | null;
|
|
24
28
|
hold(rowId: string | null): void;
|
|
29
|
+
/** The drawn row the row menu is open on, by its key: drawn as under the pointer while the menu is open. */
|
|
30
|
+
menuRow(): string | null;
|
|
31
|
+
holdMenuRow(rowKey: string | null): void;
|
|
25
32
|
subscribe(listener: () => void): () => void;
|
|
26
33
|
};
|
|
27
34
|
export declare function createGridHoverStore(): GridHoverStore;
|
|
28
35
|
export declare const GridHoverContext: import("react").Context<GridHoverStore | null>;
|
|
29
36
|
export declare function useAnyHover(): boolean;
|
|
30
|
-
/** Whether the pointer is over this row,
|
|
37
|
+
/** Whether the pointer is over this row, the app holds it there, or the row menu is open on it. */
|
|
31
38
|
export declare function useGridRowHovered(rowKey: string): boolean;
|
|
32
|
-
/** Whether the app holds this row under the pointer (`hoveredRow`): the row's
|
|
39
|
+
/** Whether the app holds this row under the pointer (`hoveredRow`), or the row menu is open on it: the row's
|
|
40
|
+
* `data-hovered`. */
|
|
33
41
|
export declare function useGridRowHeld(rowKey: string): boolean;
|
|
34
42
|
/** Whether the pointer is over this cell. */
|
|
35
43
|
export declare function useGridCellHovered(rowKey: string, colId: string): boolean;
|
|
@@ -7,9 +7,11 @@ import { useDesktop } from "../../provider/desktop.js";
|
|
|
7
7
|
import { useViews } from "../../provider/context.js";
|
|
8
8
|
import { GridRowActions } from "./GridRowActions.js";
|
|
9
9
|
import { drawGridButton } from "./grid-button.js";
|
|
10
|
+
export const GridRowHighlightContext = createContext("hover");
|
|
10
11
|
export function createGridHoverStore() {
|
|
11
12
|
let current = null;
|
|
12
13
|
let heldId = null;
|
|
14
|
+
let menuKey = null;
|
|
13
15
|
const listeners = new Set();
|
|
14
16
|
const tell = () => {
|
|
15
17
|
for (const listener of listeners)
|
|
@@ -30,6 +32,13 @@ export function createGridHoverStore() {
|
|
|
30
32
|
heldId = rowId;
|
|
31
33
|
tell();
|
|
32
34
|
},
|
|
35
|
+
menuRow: () => menuKey,
|
|
36
|
+
holdMenuRow(rowKey) {
|
|
37
|
+
if (menuKey === rowKey)
|
|
38
|
+
return;
|
|
39
|
+
menuKey = rowKey;
|
|
40
|
+
tell();
|
|
41
|
+
},
|
|
33
42
|
subscribe(listener) {
|
|
34
43
|
listeners.add(listener);
|
|
35
44
|
return () => listeners.delete(listener);
|
|
@@ -51,13 +60,13 @@ export function useAnyHover() {
|
|
|
51
60
|
const NO_STORE = () => () => { };
|
|
52
61
|
function useHovered(answer) {
|
|
53
62
|
const store = useContext(GridHoverContext);
|
|
54
|
-
return useSyncExternalStore(store ? store.subscribe : NO_STORE, () => (store ? answer(store.get(), store.held()) : false), () => false);
|
|
63
|
+
return useSyncExternalStore(store ? store.subscribe : NO_STORE, () => (store ? answer(store.get(), store.held(), store.menuRow()) : false), () => false);
|
|
55
64
|
}
|
|
56
65
|
export function useGridRowHovered(rowKey) {
|
|
57
|
-
return useHovered((target, held) => target?.rowKey === rowKey || (held != null && gridRowIdFromKey(rowKey) === held));
|
|
66
|
+
return useHovered((target, held, menuRow) => target?.rowKey === rowKey || menuRow === rowKey || (held != null && gridRowIdFromKey(rowKey) === held));
|
|
58
67
|
}
|
|
59
68
|
export function useGridRowHeld(rowKey) {
|
|
60
|
-
return useHovered((_target, held) => held != null && gridRowIdFromKey(rowKey) === held);
|
|
69
|
+
return useHovered((_target, held, menuRow) => menuRow === rowKey || (held != null && gridRowIdFromKey(rowKey) === held));
|
|
61
70
|
}
|
|
62
71
|
export function useGridCellHovered(rowKey, colId) {
|
|
63
72
|
return useHovered((target) => target?.rowKey === rowKey && target.colId === colId);
|
|
@@ -118,9 +127,10 @@ export function useGridRowHoverHandlers(rowKey) {
|
|
|
118
127
|
};
|
|
119
128
|
}
|
|
120
129
|
export function GridRowHoverActions({ views, rowKey, row, selected, actions, }) {
|
|
130
|
+
const highlight = useContext(GridRowHighlightContext);
|
|
121
131
|
if (!useGridRowHovered(rowKey))
|
|
122
132
|
return null;
|
|
123
|
-
return _jsx(GridRowActions, { views: views, row: row, selected: selected, actions: actions });
|
|
133
|
+
return _jsx(GridRowActions, { views: views, row: row, selected: selected, highlight: highlight, actions: actions });
|
|
124
134
|
}
|
|
125
135
|
export function GridPickerCaret({ rowKey, colId, editing, onOpen, }) {
|
|
126
136
|
const hovered = useGridCellHovered(rowKey, colId);
|
|
@@ -66,6 +66,10 @@ export type GridRowProps<Row> = {
|
|
|
66
66
|
editingEnabled: boolean;
|
|
67
67
|
/** Focused/editing column id — null unless it's THIS row's cell. */
|
|
68
68
|
focusedColId: string | null;
|
|
69
|
+
/** The active row, under `rowHighlight: "active"`: it carries `data-active` and the row's tint. */
|
|
70
|
+
active?: boolean;
|
|
71
|
+
/** Told this row's key on a press anywhere on it, under `rowHighlight: "active"`; absent otherwise. */
|
|
72
|
+
onActivate?: (rowKey: string) => void;
|
|
69
73
|
editingColId: string | null;
|
|
70
74
|
/** columnId → optimistic pending value (undefined when this row has none). */
|
|
71
75
|
pendingByCol?: Record<string, unknown>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { cloneElement, createContext, useEffect, useLayoutEffect, useRef, useState, } from "react";
|
|
3
|
+
import { cloneElement, createContext, useContext, useEffect, useLayoutEffect, useRef, useState, } from "react";
|
|
4
4
|
import { useViews } from "../../provider/context.js";
|
|
5
5
|
import { gridRowMenuColumnAt, gridRowMenuItems, reshapeRowMenu, rowMenuWaiting } from "./grid-row-menu-items.js";
|
|
6
|
+
import { GridHoverContext } from "./grid-hover.js";
|
|
6
7
|
const ROW = '[data-slot="vk-grid-row"]';
|
|
7
8
|
function rowKeyAt(container, target) {
|
|
8
9
|
const row = target instanceof Element ? target.closest(ROW) : null;
|
|
@@ -14,6 +15,7 @@ const TOUCH_AIM_MS = 250;
|
|
|
14
15
|
export function GridRowsMenu({ rowPropsFor, selectable, answerHeldPress, children, }) {
|
|
15
16
|
const views = useViews();
|
|
16
17
|
const RowMenu = views.atoms.RowMenu;
|
|
18
|
+
const hoverStore = useContext(GridHoverContext);
|
|
17
19
|
const [aim, setAim] = useState(null);
|
|
18
20
|
const [menuColumnId, setMenuColumnId] = useState(null);
|
|
19
21
|
const [opening, setOpening] = useState(null);
|
|
@@ -34,9 +36,10 @@ export function GridRowsMenu({ rowPropsFor, selectable, answerHeldPress, childre
|
|
|
34
36
|
setMenuColumnId(columnId);
|
|
35
37
|
setOpening(null);
|
|
36
38
|
};
|
|
37
|
-
const
|
|
39
|
+
const hold = (rowKey) => hoverStore?.holdMenuRow(rowKey);
|
|
40
|
+
const latest = useRef({ rowPropsFor, aimAt, aim, views, hold });
|
|
38
41
|
useLayoutEffect(() => {
|
|
39
|
-
latest.current = { rowPropsFor, aimAt, aim, views };
|
|
42
|
+
latest.current = { rowPropsFor, aimAt, aim, views, hold };
|
|
40
43
|
});
|
|
41
44
|
const [aimByRow] = useState(() => (rowKey, event) => {
|
|
42
45
|
const aimed = latest.current.rowPropsFor(rowKey);
|
|
@@ -101,7 +104,9 @@ export function GridRowsMenu({ rowPropsFor, selectable, answerHeldPress, childre
|
|
|
101
104
|
},
|
|
102
105
|
}));
|
|
103
106
|
const rows = cloneElement(children, target);
|
|
104
|
-
|
|
107
|
+
const [onOpenChange] = useState(() => (open) => latest.current.hold(open ? aimRef.current : null));
|
|
108
|
+
useEffect(() => () => hoverStore?.holdMenuRow(null), [hoverStore]);
|
|
109
|
+
return (_jsx(GridRowMenuAimContext.Provider, { value: aimByRow, children: _jsx(RowMenu, { rowId: props?.id ?? "", items: items, openHref: props && !reshape ? props.rowHref?.(props.row) : undefined, onDelete: reshape ? undefined : props?.onRowDelete, deleteLabel: props?.deleteLabel, onOpenChange: onOpenChange, onToggleSelect: selectable
|
|
105
110
|
? () => {
|
|
106
111
|
if (answerHeldPress?.())
|
|
107
112
|
return;
|
|
@@ -178,9 +178,11 @@ export type GridTableProps<Row> = {
|
|
|
178
178
|
/** The reader's default currency: a money column read in Original totals in it. The host's
|
|
179
179
|
* answer (the portal: the reader's preference); default `DEFAULT_DISPLAY_CURRENCY`. */
|
|
180
180
|
defaultCurrency?: DisplayCurrency;
|
|
181
|
-
/** Rules between the columns: the rows'
|
|
181
|
+
/** Rules between the columns, the last column's closing the table: the rows' and the footer's, which then also draws a
|
|
182
|
+
* line under itself, pinned or not; the header's too with `headerVerticalBorders`. Default true. */
|
|
182
183
|
verticalBorders?: boolean;
|
|
183
|
-
/** The header's columns follow `verticalBorders` as the rows' do, the last
|
|
184
|
+
/** The header's columns follow `verticalBorders` as the rows' do, the last column's line closing the table as in the
|
|
185
|
+
* rows and the footer. Default false: the header draws no
|
|
184
186
|
* line between its columns unless the app asks. */
|
|
185
187
|
headerVerticalBorders?: boolean;
|
|
186
188
|
/** The columns share the grid's whole width, each growing in proportion to its own width and never below it; a
|
|
@@ -299,6 +301,12 @@ export type GridTableProps<Row> = {
|
|
|
299
301
|
* record a grouping draws twice. Drawn, as a hover is, only on a screen whose pointer hovers (`any-hover`). Absent
|
|
300
302
|
* or null: none. */
|
|
301
303
|
hoveredRow?: string | null;
|
|
304
|
+
/** Which row the grid tints: `"hover"` (the default), the row under the pointer, as always; or `"active"`, the active
|
|
305
|
+
* row alone, the row a person last pressed (anywhere on it) or the row of the picked cell, so the keyboard moves it
|
|
306
|
+
* too, carrying `data-active`. It stays through a press outside the grid and Escape, until another row is pressed or
|
|
307
|
+
* picked. Under `"active"` no row tints under the pointer, nor one held there by `hoveredRow`; the hover's other
|
|
308
|
+
* reveals (the row's box, its ⋯, the name's actions) stay. */
|
|
309
|
+
rowHighlight?: "hover" | "active";
|
|
302
310
|
/** Told the row a person's pointer moves onto (its id) and off (null), on a screen whose pointer hovers. */
|
|
303
311
|
onHoveredRowChange?: (id: string | null) => void;
|
|
304
312
|
/** A cell drawn as picked, and its ranges, as a person's click and drag pick them; applied each time its value
|
package/views/dist/grid/grid.css
CHANGED
|
@@ -231,6 +231,12 @@
|
|
|
231
231
|
margin-right: var(--vk-spacing);
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
+
/* Add calculation, Always (Attio's table): every empty footer cell (data-empty) shows its offer at rest, the words Figures
|
|
235
|
+
dresses, "+ Add calculation" under Value first; the pointer opens the same picker. On hover is the grid's own. */
|
|
236
|
+
[data-grid-offer="always"] [data-slot="vk-grid-figure-pick"] {
|
|
237
|
+
opacity: 1;
|
|
238
|
+
}
|
|
239
|
+
|
|
234
240
|
/* 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
241
|
picker is, and + Add column's corner of the header while its menu is (data-open). */
|
|
236
242
|
[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
|
}
|
|
@@ -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
|
+
}
|
|
@@ -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";
|