@viewkitjs/views 0.1.0 → 0.3.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 +767 -1
- package/README.md +92 -41
- package/dist/atoms/LoadMore.js +11 -1
- package/dist/atoms/Row.js +1 -1
- package/dist/atoms/RowMenu.d.ts +1 -1
- package/dist/atoms/RowMenu.js +20 -6
- package/dist/atoms/types.d.ts +4 -4
- package/dist/cells/cell-format.d.ts +3 -3
- package/dist/cells/cell-title.d.ts +1 -2
- package/dist/cells/cell-title.js +2 -2
- package/dist/cells/cell-values.js +6 -3
- package/dist/contract.d.ts +79 -8
- package/dist/contract.js +55 -8
- package/dist/display/converted.d.ts +19 -0
- package/dist/display/converted.js +12 -0
- package/dist/display/format.d.ts +16 -1
- package/dist/display/format.js +10 -1
- package/dist/display/index.d.ts +2 -1
- package/dist/display/index.js +2 -1
- package/dist/display/link-click.d.ts +11 -0
- package/dist/display/link-click.js +3 -0
- package/dist/display/link.js +12 -6
- package/dist/display/location.d.ts +4 -3
- package/dist/display/location.js +12 -5
- package/dist/display/multi-value.d.ts +1 -1
- package/dist/display/multi-value.js +1 -1
- package/dist/display/options.d.ts +8 -2
- package/dist/display/percent.js +10 -3
- package/dist/display/phone.d.ts +2 -1
- package/dist/display/phone.js +11 -2
- package/dist/display/relation.js +1 -1
- package/dist/editors/ChipsEditor.d.ts +9 -4
- package/dist/editors/ChipsEditor.js +7 -3
- package/dist/editors/DateEditor.d.ts +21 -6
- package/dist/editors/DateEditor.js +118 -30
- package/dist/editors/EditorPanel.d.ts +61 -0
- package/dist/editors/EditorPanel.js +54 -0
- package/dist/editors/LocationEditor.d.ts +3 -0
- package/dist/editors/LocationEditor.js +28 -21
- package/dist/editors/NameEditor.d.ts +3 -0
- package/dist/editors/NameEditor.js +15 -10
- package/dist/editors/NumberEditor.d.ts +3 -0
- package/dist/editors/NumberEditor.js +7 -7
- package/dist/editors/RangeEditor.d.ts +16 -1
- package/dist/editors/RangeEditor.js +22 -6
- package/dist/editors/RelationEditor.d.ts +13 -28
- package/dist/editors/RelationEditor.js +17 -40
- package/dist/editors/RelationSetEditor.d.ts +53 -0
- package/dist/editors/RelationSetEditor.js +112 -0
- package/dist/editors/SelectEditor.d.ts +21 -3
- package/dist/editors/SelectEditor.js +55 -9
- package/dist/editors/TextEditor.d.ts +51 -0
- package/dist/editors/TextEditor.js +81 -0
- package/dist/editors/ValueListEditor.d.ts +5 -2
- package/dist/editors/ValueListEditor.js +11 -9
- package/dist/editors/edit-cores.d.ts +13 -10
- package/dist/editors/edit-cores.js +7 -6
- package/dist/editors/edit-session.d.ts +21 -11
- package/dist/editors/edit-session.js +19 -5
- package/dist/editors/keep-inside.d.ts +12 -0
- package/dist/editors/keep-inside.js +20 -0
- package/dist/editors/open-value.d.ts +21 -0
- package/dist/editors/open-value.js +36 -0
- package/dist/editors/open-values.d.ts +4 -0
- package/dist/editors/open-values.js +7 -0
- package/dist/editors/relation-kinds.d.ts +7 -0
- package/dist/editors/relation-kinds.js +21 -0
- package/dist/editors/relation-panel.d.ts +69 -0
- package/dist/editors/relation-panel.js +40 -0
- package/dist/field-row/FieldNoteLine.d.ts +14 -0
- package/dist/field-row/FieldNoteLine.js +14 -0
- package/dist/field-row/FieldRow.d.ts +73 -0
- package/dist/field-row/FieldRow.js +157 -0
- package/dist/field-row/FieldRowLane.d.ts +19 -0
- package/dist/field-row/FieldRowLane.js +11 -0
- package/dist/field-row/editors/RowChipsEditor.d.ts +11 -0
- package/dist/field-row/editors/RowChipsEditor.js +25 -0
- package/dist/field-row/editors/RowDateEditor.d.ts +16 -0
- package/dist/field-row/editors/RowDateEditor.js +18 -0
- package/dist/field-row/editors/RowEditor.d.ts +39 -0
- package/dist/field-row/editors/RowEditor.js +64 -0
- package/dist/field-row/editors/RowNameEditor.d.ts +4 -0
- package/dist/field-row/editors/RowNameEditor.js +15 -0
- package/dist/field-row/editors/RowNumberEditor.d.ts +12 -0
- package/dist/field-row/editors/RowNumberEditor.js +18 -0
- package/dist/field-row/editors/RowPlaceEditor.d.ts +8 -0
- package/dist/field-row/editors/RowPlaceEditor.js +18 -0
- package/dist/field-row/editors/RowRangeEditor.d.ts +4 -0
- package/dist/field-row/editors/RowRangeEditor.js +15 -0
- package/dist/field-row/editors/RowRelationEditor.d.ts +20 -0
- package/dist/field-row/editors/RowRelationEditor.js +77 -0
- package/dist/field-row/editors/RowSelectEditor.d.ts +13 -0
- package/dist/field-row/editors/RowSelectEditor.js +23 -0
- package/dist/field-row/editors/RowTextEditor.d.ts +15 -0
- package/dist/field-row/editors/RowTextEditor.js +16 -0
- package/dist/field-row/editors/RowValueListEditor.d.ts +4 -0
- package/dist/field-row/editors/RowValueListEditor.js +21 -0
- package/dist/field-row/editors/host.d.ts +59 -0
- package/dist/field-row/editors/host.js +1 -0
- package/dist/field-row/editors/row-session.d.ts +49 -0
- package/dist/field-row/editors/row-session.js +49 -0
- package/dist/field-row/index.d.ts +5 -0
- package/dist/field-row/index.js +5 -0
- package/dist/field-row/row-target.d.ts +20 -0
- package/dist/field-row/row-target.js +3 -0
- package/dist/field-row/useFieldWrite.d.ts +45 -0
- package/dist/field-row/useFieldWrite.js +190 -0
- package/dist/field-row/useRowSettlement.d.ts +33 -0
- package/dist/field-row/useRowSettlement.js +23 -0
- package/dist/fields/binding.d.ts +7 -2
- package/dist/fields/binding.js +13 -6
- package/dist/fields/currency.d.ts +0 -10
- package/dist/fields/currency.js +0 -14
- package/dist/fields/edit-core-types.d.ts +9 -9
- package/dist/fields/edit-core-types.js +6 -6
- package/dist/fields/money.d.ts +6 -0
- package/dist/fields/money.js +11 -0
- package/dist/fields/number-edit.d.ts +6 -0
- package/dist/fields/number-edit.js +4 -0
- package/dist/fields/prepare-write.js +6 -1
- package/dist/fields/relation-source-types.d.ts +12 -0
- package/dist/fields/write-target.d.ts +50 -0
- package/dist/fields/write-target.js +10 -0
- package/dist/filters/filter-model.d.ts +0 -1
- package/dist/filters/registry.d.ts +3 -36
- package/dist/filters/registry.js +0 -38
- package/dist/grid/chrome/GridAddColumn.d.ts +11 -0
- package/dist/grid/chrome/GridAddColumn.js +29 -0
- package/dist/grid/chrome/GridAggregateMenu.d.ts +31 -0
- package/dist/grid/chrome/GridAggregateMenu.js +29 -0
- package/dist/grid/chrome/GridCellEditors.d.ts +71 -0
- package/dist/grid/chrome/GridCellEditors.js +126 -0
- package/dist/grid/chrome/GridCellOutline.d.ts +49 -0
- package/dist/grid/chrome/GridCellOutline.js +16 -0
- package/dist/grid/chrome/GridChipsEditor.d.ts +38 -0
- package/dist/grid/chrome/GridChipsEditor.js +35 -0
- package/dist/grid/chrome/GridColumnColorSection.d.ts +11 -0
- package/dist/grid/chrome/GridColumnColorSection.js +40 -0
- package/dist/grid/chrome/GridColumnDateSection.d.ts +23 -0
- package/dist/grid/chrome/GridColumnDateSection.js +23 -0
- package/dist/grid/chrome/GridColumnDurationSection.d.ts +19 -0
- package/dist/grid/chrome/GridColumnDurationSection.js +24 -0
- package/dist/grid/chrome/GridColumnMenu.d.ts +101 -0
- package/dist/grid/chrome/GridColumnMenu.js +103 -0
- package/dist/grid/chrome/GridColumnNumberSection.d.ts +25 -0
- package/dist/grid/chrome/GridColumnNumberSection.js +27 -0
- package/dist/grid/chrome/GridColumnPercentSection.d.ts +15 -0
- package/dist/grid/chrome/GridColumnPercentSection.js +16 -0
- package/dist/grid/chrome/GridColumnSortSection.d.ts +18 -0
- package/dist/grid/chrome/GridColumnSortSection.js +16 -0
- package/dist/grid/chrome/GridDateEditor.d.ts +34 -0
- package/dist/grid/chrome/GridDateEditor.js +19 -0
- package/dist/grid/chrome/GridFlyout.d.ts +44 -0
- package/dist/grid/chrome/GridFlyout.js +80 -0
- package/dist/grid/chrome/GridFooter.d.ts +33 -0
- package/dist/grid/chrome/GridFooter.js +85 -0
- package/dist/grid/chrome/GridGroupMenu.d.ts +37 -0
- package/dist/grid/chrome/GridGroupMenu.js +64 -0
- package/dist/grid/chrome/GridHeader.d.ts +66 -0
- package/dist/grid/chrome/GridHeader.js +42 -0
- package/dist/grid/chrome/GridLongTextEditor.d.ts +55 -0
- package/dist/grid/chrome/GridLongTextEditor.js +69 -0
- package/dist/grid/chrome/GridMenuRow.d.ts +15 -0
- package/dist/grid/chrome/GridMenuRow.js +15 -0
- package/dist/grid/chrome/GridNameEditor.d.ts +24 -0
- package/dist/grid/chrome/GridNameEditor.js +21 -0
- package/dist/grid/chrome/GridNumberEditor.d.ts +49 -0
- package/dist/grid/chrome/GridNumberEditor.js +51 -0
- package/dist/grid/chrome/GridPlaceEditor.d.ts +26 -0
- package/dist/grid/chrome/GridPlaceEditor.js +22 -0
- package/dist/grid/chrome/GridRangeEditor.d.ts +30 -0
- package/dist/grid/chrome/GridRangeEditor.js +21 -0
- package/dist/grid/chrome/GridRelationEditor.d.ts +45 -0
- package/dist/grid/chrome/GridRelationEditor.js +92 -0
- package/dist/grid/chrome/GridResizeHandle.d.ts +19 -0
- package/dist/grid/chrome/GridResizeHandle.js +19 -0
- package/dist/grid/chrome/GridRow.d.ts +31 -0
- package/dist/grid/chrome/GridRow.js +179 -0
- package/dist/grid/chrome/GridRowActions.d.ts +32 -0
- package/dist/grid/chrome/GridRowActions.js +25 -0
- package/dist/grid/chrome/GridRowCells.d.ts +4 -0
- package/dist/grid/chrome/GridRowCells.js +128 -0
- package/dist/grid/chrome/GridRowGlyph.d.ts +12 -0
- package/dist/grid/chrome/GridRowGlyph.js +13 -0
- package/dist/grid/chrome/GridSelectEditor.d.ts +33 -0
- package/dist/grid/chrome/GridSelectEditor.js +43 -0
- package/dist/grid/chrome/GridStructure.d.ts +47 -0
- package/dist/grid/chrome/GridStructure.js +41 -0
- package/dist/grid/chrome/GridTable.d.ts +4 -0
- package/dist/grid/chrome/GridTable.js +192 -0
- package/dist/grid/chrome/GridTableSurface.d.ts +52 -0
- package/dist/grid/chrome/GridTableSurface.js +15 -0
- package/dist/grid/chrome/GridTextEditor.d.ts +45 -0
- package/dist/grid/chrome/GridTextEditor.js +38 -0
- package/dist/grid/chrome/GridValueListEditor.d.ts +30 -0
- package/dist/grid/chrome/GridValueListEditor.js +19 -0
- package/dist/grid/chrome/StuckMarker.d.ts +16 -0
- package/dist/grid/chrome/StuckMarker.js +34 -0
- package/dist/grid/chrome/cell-clipboard.d.ts +9 -0
- package/dist/grid/chrome/cell-clipboard.js +28 -0
- package/dist/grid/chrome/cell-cut-off.d.ts +11 -0
- package/dist/grid/chrome/cell-cut-off.js +20 -0
- package/dist/grid/chrome/cells.d.ts +21 -0
- package/dist/grid/chrome/cells.js +19 -0
- package/dist/grid/chrome/checks.d.ts +32 -0
- package/dist/grid/chrome/checks.js +32 -0
- package/dist/grid/chrome/column-glyph.d.ts +14 -0
- package/dist/grid/chrome/column-glyph.js +44 -0
- package/dist/grid/chrome/editors.d.ts +9 -0
- package/dist/grid/chrome/editors.js +10 -0
- package/dist/grid/chrome/grid-cell-classes.d.ts +53 -0
- package/dist/grid/chrome/grid-cell-classes.js +32 -0
- package/dist/grid/chrome/grid-cell-link.d.ts +13 -0
- package/dist/grid/chrome/grid-cell-link.js +9 -0
- package/dist/grid/chrome/grid-edit-session.d.ts +63 -0
- package/dist/grid/chrome/grid-edit-session.js +118 -0
- package/dist/grid/chrome/grid-hover.d.ts +60 -0
- package/dist/grid/chrome/grid-hover.js +81 -0
- package/dist/grid/chrome/grid-menu-focus.d.ts +43 -0
- package/dist/grid/chrome/grid-menu-focus.js +93 -0
- package/dist/grid/chrome/grid-menu-search.d.ts +7 -0
- package/dist/grid/chrome/grid-menu-search.js +7 -0
- package/dist/grid/chrome/grid-row-menu-key.d.ts +15 -0
- package/dist/grid/chrome/grid-row-menu-key.js +36 -0
- package/dist/grid/chrome/grid-row-props.d.ts +143 -0
- package/dist/grid/chrome/grid-row-props.js +1 -0
- package/dist/grid/chrome/grid-row-window.d.ts +61 -0
- package/dist/grid/chrome/grid-row-window.js +212 -0
- package/dist/grid/chrome/grid-scroll-owner.d.ts +38 -0
- package/dist/grid/chrome/grid-scroll-owner.js +75 -0
- package/dist/grid/chrome/grid-styles.d.ts +40 -0
- package/dist/grid/chrome/grid-styles.js +9 -0
- package/dist/grid/chrome/grid-table-props.d.ts +172 -0
- package/dist/grid/chrome/grid-table-props.js +1 -0
- package/dist/grid/chrome/useGridBatchApi.d.ts +34 -0
- package/dist/grid/chrome/useGridBatchApi.js +35 -0
- package/dist/grid/chrome/useGridColumnLayout.d.ts +30 -0
- package/dist/grid/chrome/useGridColumnLayout.js +206 -0
- package/dist/grid/chrome/useGridFocus.d.ts +45 -0
- package/dist/grid/chrome/useGridFocus.js +122 -0
- package/dist/grid/chrome/useGridHeaderDrag.d.ts +20 -0
- package/dist/grid/chrome/useGridHeaderDrag.js +37 -0
- package/dist/grid/chrome/useGridKeyboard.d.ts +64 -0
- package/dist/grid/chrome/useGridKeyboard.js +450 -0
- package/dist/grid/chrome/useGridPendingReconciliation.d.ts +12 -0
- package/dist/grid/chrome/useGridPendingReconciliation.js +32 -0
- package/dist/grid/chrome/useGridRailReveal.d.ts +57 -0
- package/dist/grid/chrome/useGridRailReveal.js +67 -0
- package/dist/grid/chrome/useGridRangeActions.d.ts +51 -0
- package/dist/grid/chrome/useGridRangeActions.js +195 -0
- package/dist/grid/chrome/useGridRangeGestures.d.ts +32 -0
- package/dist/grid/chrome/useGridRangeGestures.js +237 -0
- package/dist/grid/chrome/useGridRowContextMenu.d.ts +37 -0
- package/dist/grid/chrome/useGridRowContextMenu.js +153 -0
- package/dist/grid/chrome/useGridScaleStyles.d.ts +3 -0
- package/dist/grid/chrome/useGridScaleStyles.js +28 -0
- package/dist/grid/chrome/useGridScrollArea.d.ts +21 -0
- package/dist/grid/chrome/useGridScrollArea.js +65 -0
- package/dist/grid/chrome/useGridTableInteractionModel.d.ts +78 -0
- package/dist/grid/chrome/useGridTableInteractionModel.js +249 -0
- package/dist/grid/chrome/useGridTableSelection.d.ts +29 -0
- package/dist/grid/chrome/useGridTableSelection.js +55 -0
- package/dist/grid/chrome/useHeaderDragReorder.d.ts +21 -0
- package/dist/grid/chrome/useHeaderDragReorder.js +216 -0
- package/dist/grid/core/clipboard-model.d.ts +83 -0
- package/dist/grid/core/clipboard-model.js +291 -0
- package/dist/grid/core/column-values.d.ts +27 -0
- package/dist/grid/core/column-values.js +76 -0
- package/dist/grid/core/commit-model.d.ts +41 -0
- package/dist/grid/core/commit-model.js +3 -0
- package/dist/grid/core/coordinates.d.ts +48 -0
- package/dist/grid/core/coordinates.js +27 -0
- package/dist/grid/core/edge-scroll.d.ts +21 -0
- package/dist/grid/core/edge-scroll.js +23 -0
- package/dist/grid/core/edit-values.d.ts +9 -0
- package/dist/grid/core/edit-values.js +1 -0
- package/dist/grid/core/editing-controller.d.ts +60 -0
- package/dist/grid/core/editing-controller.js +266 -0
- package/dist/grid/core/editing-model.d.ts +87 -0
- package/dist/grid/core/editing-model.js +148 -0
- package/dist/grid/core/flat-rows.d.ts +35 -0
- package/dist/grid/core/flat-rows.js +20 -0
- package/dist/grid/core/grid-aria.d.ts +27 -0
- package/dist/grid/core/grid-aria.js +39 -0
- package/dist/grid/core/grid-focus.d.ts +54 -0
- package/dist/grid/core/grid-focus.js +148 -0
- package/dist/grid/core/grid-scale.d.ts +14 -0
- package/dist/grid/core/grid-scale.js +8 -0
- package/dist/grid/core/nav.d.ts +94 -0
- package/dist/grid/core/nav.js +92 -0
- package/dist/grid/core/pending-reconciliation.d.ts +53 -0
- package/dist/grid/core/pending-reconciliation.js +51 -0
- package/dist/grid/core/range-model.d.ts +25 -0
- package/dist/grid/core/range-model.js +59 -0
- package/dist/grid/core/row-window.d.ts +40 -0
- package/dist/grid/core/row-window.js +43 -0
- package/dist/grid/core/spreadsheet-operations.d.ts +101 -0
- package/dist/grid/core/spreadsheet-operations.js +280 -0
- package/dist/grid/core/useGridEditing.d.ts +46 -0
- package/dist/grid/core/useGridEditing.js +93 -0
- package/dist/grid/core/useGridRange.d.ts +20 -0
- package/dist/grid/core/useGridRange.js +24 -0
- package/dist/grid/core/value-equality.d.ts +54 -0
- package/dist/grid/core/value-equality.js +80 -0
- package/dist/grid/index.d.ts +18 -0
- package/dist/grid/index.js +5 -0
- package/dist/grid/useGridTablePrefs.d.ts +49 -0
- package/dist/grid/useGridTablePrefs.js +99 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/viewport.d.ts +3 -0
- package/dist/internal/viewport.js +15 -0
- package/dist/model/column-capabilities.d.ts +3 -2
- package/dist/model/column-capabilities.js +28 -8
- package/dist/model/column-from.js +3 -0
- package/dist/model/column-inspect.d.ts +10 -2
- package/dist/model/column-inspect.js +9 -0
- package/dist/model/column-schema.d.ts +6 -1
- package/dist/model/column-state.d.ts +1 -1
- package/dist/model/column-types.d.ts +3 -1
- package/dist/model/column-types.js +1 -1
- package/dist/model/density.js +3 -3
- package/dist/model/filter-capabilities.d.ts +1 -1
- package/dist/model/filter-capabilities.js +1 -1
- package/dist/model/index.d.ts +4 -6
- package/dist/model/index.js +0 -1
- package/dist/model/preferences.d.ts +7 -7
- package/dist/model/preferences.js +0 -1
- package/dist/model/prefs-buckets.d.ts +0 -1
- package/dist/model/prefs-buckets.js +0 -3
- package/dist/model/render-count.d.ts +6 -0
- package/dist/model/render-count.js +11 -0
- package/dist/provider/ViewsProvider.d.ts +6 -2
- package/dist/provider/ViewsProvider.js +12 -2
- package/dist/provider/components.d.ts +35 -9
- package/dist/provider/components.js +4 -2
- package/dist/provider/context.d.ts +8 -4
- package/dist/provider/desktop.d.ts +9 -0
- package/dist/provider/desktop.js +22 -0
- package/dist/provider/menu-groups.d.ts +8 -0
- package/dist/provider/menu-groups.js +38 -0
- package/dist/provider/plain-input.d.ts +8 -0
- package/dist/provider/plain-input.js +5 -0
- package/dist/provider/ports.d.ts +22 -0
- package/dist/provider/ports.js +1 -0
- package/dist/react.d.ts +3 -2
- package/dist/react.js +1 -0
- package/dist/selection/SelectCheckbox.d.ts +3 -1
- package/dist/selection/SelectCheckbox.js +2 -2
- package/dist/selection/useCheckDragSelect.js +6 -5
- package/docs/contract.md +202 -72
- package/docs/getting-started.md +250 -0
- package/docs/guides/atoms.md +245 -0
- package/docs/guides/cells.md +302 -0
- package/docs/guides/columns.md +413 -0
- package/docs/guides/display.md +204 -0
- package/docs/guides/editors.md +462 -0
- package/docs/guides/ports.md +246 -0
- package/docs/guides/selection.md +270 -0
- package/docs/guides/the-grid.md +696 -0
- package/docs/guides/the-provider.md +448 -0
- package/docs/index.md +52 -0
- package/docs/install.md +9 -47
- package/docs/reference/cells.md +28 -0
- package/docs/reference/display.md +44 -0
- package/docs/reference/editors-chips.md +6 -0
- package/docs/reference/editors-date.md +6 -0
- package/docs/reference/editors-location.md +10 -0
- package/docs/reference/editors-name.md +6 -0
- package/docs/reference/editors-number.md +11 -0
- package/docs/reference/editors-open-values.md +10 -0
- package/docs/reference/editors-panel.md +12 -0
- package/docs/reference/editors-range.md +6 -0
- package/docs/reference/editors-relation.md +12 -0
- package/docs/reference/editors-select.md +9 -0
- package/docs/reference/editors-session.md +11 -0
- package/docs/reference/editors-text.md +9 -0
- package/docs/reference/editors-value-list.md +6 -0
- package/docs/reference/editors.md +5 -0
- package/docs/reference/field-row.md +16 -0
- package/docs/reference/grid.md +39 -0
- package/docs/reference/react.md +89 -0
- package/docs/reference/selection.md +33 -0
- package/docs/reference/views.md +622 -0
- package/package.json +27 -4
- package/skills/views/SKILL.md +20 -5
- package/dist/filters/types.d.ts +0 -27
- package/dist/filters/types.js +0 -1
- package/dist/model/filter-pushdown.d.ts +0 -106
- package/dist/model/filter-pushdown.js +0 -147
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext, useSyncExternalStore, } from "react";
|
|
4
|
+
import { cx } from "../../internal/cx.js";
|
|
5
|
+
import { useDesktop } from "../../provider/desktop.js";
|
|
6
|
+
import { useViews } from "../../provider/context.js";
|
|
7
|
+
import { GridRowActions } from "./GridRowActions.js";
|
|
8
|
+
export function createGridHoverStore() {
|
|
9
|
+
let current = null;
|
|
10
|
+
const listeners = new Set();
|
|
11
|
+
return {
|
|
12
|
+
get: () => current,
|
|
13
|
+
set(target) {
|
|
14
|
+
if (current?.rowKey === target?.rowKey && current?.colId === target?.colId)
|
|
15
|
+
return;
|
|
16
|
+
current = target;
|
|
17
|
+
for (const listener of listeners)
|
|
18
|
+
listener();
|
|
19
|
+
},
|
|
20
|
+
subscribe(listener) {
|
|
21
|
+
listeners.add(listener);
|
|
22
|
+
return () => listeners.delete(listener);
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export const GridHoverContext = createContext(null);
|
|
27
|
+
const NO_STORE = () => () => { };
|
|
28
|
+
function useHovered(answer) {
|
|
29
|
+
const store = useContext(GridHoverContext);
|
|
30
|
+
return useSyncExternalStore(store ? store.subscribe : NO_STORE, () => (store ? answer(store.get()) : false), () => false);
|
|
31
|
+
}
|
|
32
|
+
export function useGridRowHovered(rowKey) {
|
|
33
|
+
return useHovered((target) => target?.rowKey === rowKey);
|
|
34
|
+
}
|
|
35
|
+
export function useGridCellHovered(rowKey, colId) {
|
|
36
|
+
return useHovered((target) => target?.rowKey === rowKey && target.colId === colId);
|
|
37
|
+
}
|
|
38
|
+
export function useGridRowHoverHandlers(rowKey) {
|
|
39
|
+
const store = useContext(GridHoverContext);
|
|
40
|
+
const clearOwn = () => {
|
|
41
|
+
if (store?.get()?.rowKey === rowKey)
|
|
42
|
+
store.set(null);
|
|
43
|
+
};
|
|
44
|
+
return {
|
|
45
|
+
onPointerOver(event) {
|
|
46
|
+
if (!store || event.pointerType === "touch")
|
|
47
|
+
return;
|
|
48
|
+
const row = event.currentTarget;
|
|
49
|
+
const target = event.target;
|
|
50
|
+
if (!row.contains(target)) {
|
|
51
|
+
clearOwn();
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const from = target instanceof Element ? target : target.parentElement;
|
|
55
|
+
const cell = from?.closest("[data-col-id]");
|
|
56
|
+
store.set({ rowKey, colId: cell && row.contains(cell) ? cell.getAttribute("data-col-id") : null });
|
|
57
|
+
},
|
|
58
|
+
onPointerLeave: clearOwn,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export function GridRowHoverActions({ rowKey, row, selected, actions, }) {
|
|
62
|
+
if (!useGridRowHovered(rowKey))
|
|
63
|
+
return null;
|
|
64
|
+
return _jsx(GridRowActions, { row: row, selected: selected, actions: actions });
|
|
65
|
+
}
|
|
66
|
+
export function GridPickerCaret({ rowKey, colId, editing, onOpen, }) {
|
|
67
|
+
const hovered = useGridCellHovered(rowKey, colId);
|
|
68
|
+
if (!hovered && !editing)
|
|
69
|
+
return null;
|
|
70
|
+
return _jsx(PickerCaretButton, { editing: editing, onOpen: onOpen });
|
|
71
|
+
}
|
|
72
|
+
function PickerCaretButton({ editing, onOpen }) {
|
|
73
|
+
const { icons, messages } = useViews();
|
|
74
|
+
if (!useDesktop())
|
|
75
|
+
return null;
|
|
76
|
+
return (_jsx("button", { type: "button", tabIndex: -1, "aria-label": messages({ key: "views.grid.change-value" }), onClick: (e) => {
|
|
77
|
+
e.stopPropagation();
|
|
78
|
+
if (!editing)
|
|
79
|
+
onOpen();
|
|
80
|
+
}, className: cx("absolute right-1 top-1/2 flex h-5 w-5 -translate-y-1/2 items-center justify-center hover:text-(color:--vk-fg)", editing ? "text-(color:--vk-fg)" : "text-(color:--vk-fg-subtlest)"), children: _jsx(icons.caretDown, { className: cx("h-3 w-3 transition-transform duration-100", editing && "rotate-180") }) }));
|
|
81
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type KeyboardEvent as ReactKeyboardEvent, type MouseEvent as ReactMouseEvent } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Gives the focus back to `anchor` when a menu that opened from it has closed, and only where the focus had nowhere
|
|
4
|
+
* else to go. Focus on the body goes back at once. Focus still inside a popup (an app's popover that plays its exit
|
|
5
|
+
* stays on the page, the focus in it, after it closed) goes back once that element has left the page, if the focus
|
|
6
|
+
* then fell to the body: a popup with no trigger, as the grid's are, gives it back to nothing. Focus a press or a
|
|
7
|
+
* pick moved elsewhere (another cell, a dialog a pick opened) stays there.
|
|
8
|
+
*
|
|
9
|
+
* A cell inside an inert subtree can't take the focus: a list that reloads on a pick (a sort) holds the table it is
|
|
10
|
+
* leaving `inert`, the same cells, until the new rows are in. The focus then goes back once the cell is out of it, if
|
|
11
|
+
* it is still on nothing. Returns what stops the watch: a reopen, or the grid leaving the page.
|
|
12
|
+
*/
|
|
13
|
+
export declare function returnGridFocus(anchor: HTMLElement): () => void;
|
|
14
|
+
/**
|
|
15
|
+
* ↓ and ↑ for a grid menu's rows: the `onKeyDown` of the box that holds them. They move the focus to the next or the
|
|
16
|
+
* previous enabled row, round at either end, from the focused one (from outside them, ↓ to the first and ↑ to the
|
|
17
|
+
* last). Only the box's own rows answer: a flyout's popup, drawn elsewhere on the page, keeps its keys.
|
|
18
|
+
*
|
|
19
|
+
* A menu whose first rows sit in a searchable list hands its search field in as `search`: the field is then the
|
|
20
|
+
* walk's first stop, standing for the list, and a key that starts in it is the field's (`gridMenuSearchArrows`).
|
|
21
|
+
* Coming into the field, the walk moves the list's highlight to the end it enters from, ↓ (round from the last row)
|
|
22
|
+
* to the first match and ↑ (from the row below) to the last, by the Home and End a cmdk list answers; left on the
|
|
23
|
+
* other end, the field would hand the next key straight back. A list that doesn't answer them keeps its highlight.
|
|
24
|
+
*/
|
|
25
|
+
export declare function gridMenuArrows(event: ReactKeyboardEvent<HTMLElement>, search?: HTMLElement | null): void;
|
|
26
|
+
/**
|
|
27
|
+
* ↓ and ↑ in a grid menu's search field, its `onKeyDown`: the list walks its own matches, and at its ends the walk
|
|
28
|
+
* goes on through the menu's other rows in `box`, ↓ past the last match (or with none) to the first row and ↑ past
|
|
29
|
+
* the first match round to the last. The default is prevented there, so the list's own arrows stay still. The match
|
|
30
|
+
* the list has highlighted is the option the field names in `aria-activedescendant`, as a combobox does; a list that
|
|
31
|
+
* names none keeps its arrows, and Tab leaves it.
|
|
32
|
+
*/
|
|
33
|
+
export declare function gridMenuSearchArrows(event: ReactKeyboardEvent<HTMLElement>, box: HTMLElement | null): void;
|
|
34
|
+
/**
|
|
35
|
+
* Focus for a menu the grid's chrome opens (a column's menu, a footer's figure picker, a group's ⋯): opened by a key
|
|
36
|
+
* (a click with no pointer behind it, `detail === 0`, which is what the grid's Enter and Space send), it opens with
|
|
37
|
+
* focus on its first row; opened by a pointer, as it always has, with nothing focused. Closed, it gives the focus back
|
|
38
|
+
* to its cell where it had nowhere else to go (`returnGridFocus`).
|
|
39
|
+
*/
|
|
40
|
+
export declare function useGridMenuFocus(open: boolean, anchor: HTMLElement | null): {
|
|
41
|
+
initialFocus: boolean;
|
|
42
|
+
noteOpen: (event: ReactMouseEvent) => void;
|
|
43
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useEffect, useRef, useState, } from "react";
|
|
3
|
+
const POPUP = '[role="dialog"], [role="menu"]';
|
|
4
|
+
const onNothing = (active) => active == null || active === document.body;
|
|
5
|
+
export function returnGridFocus(anchor) {
|
|
6
|
+
const held = document.activeElement;
|
|
7
|
+
const waitsOnPopup = !onNothing(held) && !!held?.closest?.(POPUP);
|
|
8
|
+
if (!onNothing(held) && !waitsOnPopup)
|
|
9
|
+
return () => { };
|
|
10
|
+
const giveBack = () => {
|
|
11
|
+
if (waitsOnPopup && held.isConnected)
|
|
12
|
+
return false;
|
|
13
|
+
if (!onNothing(document.activeElement) || !anchor.isConnected)
|
|
14
|
+
return true;
|
|
15
|
+
if (anchor.closest("[inert]"))
|
|
16
|
+
return false;
|
|
17
|
+
anchor.focus({ preventScroll: true });
|
|
18
|
+
return true;
|
|
19
|
+
};
|
|
20
|
+
if (giveBack() || typeof MutationObserver === "undefined")
|
|
21
|
+
return () => { };
|
|
22
|
+
const stop = () => {
|
|
23
|
+
watch.disconnect();
|
|
24
|
+
document.removeEventListener("focusin", stop, true);
|
|
25
|
+
};
|
|
26
|
+
const watch = new MutationObserver(() => {
|
|
27
|
+
if (!giveBack())
|
|
28
|
+
return;
|
|
29
|
+
stop();
|
|
30
|
+
});
|
|
31
|
+
watch.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ["inert"] });
|
|
32
|
+
document.addEventListener("focusin", stop, true);
|
|
33
|
+
return stop;
|
|
34
|
+
}
|
|
35
|
+
const isArrow = (event) => (event.key === "ArrowDown" || event.key === "ArrowUp") && !(event.altKey || event.ctrlKey || event.metaKey || event.shiftKey);
|
|
36
|
+
const menuRows = (box) => [...box.querySelectorAll("button:not(:disabled)")];
|
|
37
|
+
export function gridMenuArrows(event, search) {
|
|
38
|
+
if (!isArrow(event))
|
|
39
|
+
return;
|
|
40
|
+
const box = event.currentTarget;
|
|
41
|
+
if (!box.contains(event.target))
|
|
42
|
+
return;
|
|
43
|
+
if (search?.contains(event.target))
|
|
44
|
+
return;
|
|
45
|
+
const rows = search?.isConnected ? [search, ...menuRows(box)] : menuRows(box);
|
|
46
|
+
if (rows.length === 0)
|
|
47
|
+
return;
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
const at = rows.indexOf(document.activeElement);
|
|
50
|
+
const down = event.key === "ArrowDown";
|
|
51
|
+
const next = at < 0 ? (down ? 0 : rows.length - 1) : (at + (down ? 1 : -1) + rows.length) % rows.length;
|
|
52
|
+
const row = rows[next];
|
|
53
|
+
row.focus();
|
|
54
|
+
if (row === search) {
|
|
55
|
+
row.dispatchEvent(new KeyboardEvent("keydown", { key: down ? "Home" : "End", bubbles: true, cancelable: true }));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
export function gridMenuSearchArrows(event, box) {
|
|
59
|
+
if (!box || !isArrow(event))
|
|
60
|
+
return;
|
|
61
|
+
const rows = menuRows(box);
|
|
62
|
+
if (rows.length === 0)
|
|
63
|
+
return;
|
|
64
|
+
const down = event.key === "ArrowDown";
|
|
65
|
+
const matches = [...box.querySelectorAll('[role="option"]:not([aria-disabled="true"])')];
|
|
66
|
+
if (matches.length > 0) {
|
|
67
|
+
const named = event.currentTarget.getAttribute("aria-activedescendant");
|
|
68
|
+
if (!named)
|
|
69
|
+
return;
|
|
70
|
+
const at = matches.findIndex((match) => match.id === named);
|
|
71
|
+
if (at !== (down ? matches.length - 1 : 0))
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
(down ? rows[0] : rows[rows.length - 1]).focus();
|
|
76
|
+
}
|
|
77
|
+
export function useGridMenuFocus(open, anchor) {
|
|
78
|
+
const [byKey, setByKey] = useState(false);
|
|
79
|
+
const wasOpen = useRef(false);
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
if (open) {
|
|
82
|
+
wasOpen.current = true;
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (!wasOpen.current)
|
|
86
|
+
return;
|
|
87
|
+
wasOpen.current = false;
|
|
88
|
+
if (anchor)
|
|
89
|
+
return returnGridFocus(anchor);
|
|
90
|
+
}, [open, anchor]);
|
|
91
|
+
const noteOpen = useCallback((event) => setByKey(event.detail === 0), []);
|
|
92
|
+
return { initialFocus: byKey, noteOpen };
|
|
93
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** How many options a grid menu lists before it offers a search: a group band's Sort rows. */
|
|
2
|
+
export declare const GRID_MENU_SEARCH_AFTER = 8;
|
|
3
|
+
/** The options a grid menu lists for a search: every one while the search is empty, else those whose label
|
|
4
|
+
* holds it. */
|
|
5
|
+
export declare function matchMenuOptions<O extends {
|
|
6
|
+
label: string;
|
|
7
|
+
}>(options: readonly O[], query: string): O[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A row's menu by keyboard. Shift+F10 and the menu key are ARIA's keys for a context menu; ⌘⇧\ (Ctrl+Shift+\ off a
|
|
3
|
+
* Mac) is Google Sheets', the one a Mac keyboard reaches without fn (decided 11 Nov). Matched on the key's place
|
|
4
|
+
* (`code`), so Shift's "|" and a layout's own backslash read the same.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isGridRowMenuKey(event: Pick<KeyboardEvent, "key" | "code" | "shiftKey" | "metaKey" | "ctrlKey" | "altKey">): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Opens the row's menu from its focused cell the way the row's ⋯ does: a right-click dispatched on the cell, under
|
|
9
|
+
* it, which the row's menu (the app's `RowMenu`, or the default) answers with the rows a right-click on that cell
|
|
10
|
+
* gets. Then it watches the page until a menu has come and gone, and puts focus back on the cell when it fell to the
|
|
11
|
+
* body (a menu with no trigger gives it back to nothing), as the column and footer menus do. Focus put elsewhere (a
|
|
12
|
+
* click away, a dialog a pick opened) is left there. Returns what stops the watch: the next key on the cell, or the
|
|
13
|
+
* grid leaving the page, for a menu that never opened.
|
|
14
|
+
*/
|
|
15
|
+
export declare function openGridRowMenu(cell: HTMLElement): () => void;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
export function isGridRowMenuKey(event) {
|
|
3
|
+
const { key, code, shiftKey, metaKey, ctrlKey, altKey } = event;
|
|
4
|
+
if (key === "ContextMenu")
|
|
5
|
+
return !shiftKey && !metaKey && !ctrlKey && !altKey;
|
|
6
|
+
if (key === "F10")
|
|
7
|
+
return shiftKey && !metaKey && !ctrlKey && !altKey;
|
|
8
|
+
return code === "Backslash" && shiftKey && (metaKey || ctrlKey) && !altKey;
|
|
9
|
+
}
|
|
10
|
+
const MENU = '[role="menu"]';
|
|
11
|
+
export function openGridRowMenu(cell) {
|
|
12
|
+
const rect = cell.getBoundingClientRect();
|
|
13
|
+
cell.dispatchEvent(new MouseEvent("contextmenu", { bubbles: true, cancelable: true, clientX: rect.left, clientY: rect.bottom }));
|
|
14
|
+
if (typeof MutationObserver === "undefined")
|
|
15
|
+
return () => { };
|
|
16
|
+
let entered = document.activeElement?.closest?.(MENU) != null;
|
|
17
|
+
const onFocusIn = (event) => {
|
|
18
|
+
if (event.target?.closest?.(MENU))
|
|
19
|
+
entered = true;
|
|
20
|
+
};
|
|
21
|
+
const stop = () => {
|
|
22
|
+
watch.disconnect();
|
|
23
|
+
document.removeEventListener("focusin", onFocusIn, true);
|
|
24
|
+
};
|
|
25
|
+
const watch = new MutationObserver(() => {
|
|
26
|
+
if (!entered || document.querySelector(MENU))
|
|
27
|
+
return;
|
|
28
|
+
stop();
|
|
29
|
+
const active = document.activeElement;
|
|
30
|
+
if ((active == null || active === document.body) && cell.isConnected)
|
|
31
|
+
cell.focus({ preventScroll: true });
|
|
32
|
+
});
|
|
33
|
+
document.addEventListener("focusin", onFocusIn, true);
|
|
34
|
+
watch.observe(document.body, { childList: true, subtree: true });
|
|
35
|
+
return stop;
|
|
36
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { ViewsRowMenuItem } from "../../atoms/types.js";
|
|
3
|
+
import type { FieldMenus } from "../../fields/menus.js";
|
|
4
|
+
import type { ListSettingsConfig } from "../../model/column-capabilities.js";
|
|
5
|
+
import type { ListCellAction, ListColumn, ListOptionColorOverrides, ListRelationValue } from "../../model/column-schema.js";
|
|
6
|
+
import type { ListDateStyleOverrides, ListDurationStyleOverrides, ListNumberFormatOverrides, ListPercentDisplayOverrides, ListShowTimeOverrides } from "../../model/column-format.js";
|
|
7
|
+
import type { ListRowIconAccessor } from "../../model/row-icon.js";
|
|
8
|
+
import type { GridRowRangeSpan } from "../core/useGridRange.js";
|
|
9
|
+
export type GridRowProps<Row> = {
|
|
10
|
+
row: Row;
|
|
11
|
+
/** The DATA id — what a write, the optimistic overlay and selection address.
|
|
12
|
+
* Shared by every copy of a row that is drawn more than once. */
|
|
13
|
+
id: string;
|
|
14
|
+
/** This RENDERED row's identity, unique even when the same record is drawn
|
|
15
|
+
* under several groups. Focus, the editor, arrows and ranges are in terms of
|
|
16
|
+
* it; see `GridCellPos`. */
|
|
17
|
+
rowKey: string;
|
|
18
|
+
columns: ListColumn<Row>[];
|
|
19
|
+
selectable: boolean;
|
|
20
|
+
selected: boolean;
|
|
21
|
+
/** The row directly above in the SAME rendered list is selected. Every
|
|
22
|
+
* selected row draws its own BOTTOM rule; the top one is drawn only to CAP a
|
|
23
|
+
* run, which is what leaves exactly one line at each boundary — with both
|
|
24
|
+
* ends unconditional, two adjacent rows would land a rule each on
|
|
25
|
+
* neighbouring pixels and read as a 2px line. Plain boolean on purpose: this
|
|
26
|
+
* row is `memo()`d with no comparator. */
|
|
27
|
+
selectedAbove: boolean;
|
|
28
|
+
selecting: boolean;
|
|
29
|
+
toggle: (id: string, next?: boolean) => void;
|
|
30
|
+
toggleRange: (id: string) => void;
|
|
31
|
+
contextMenu?: (row: Row) => ViewsRowMenuItem[];
|
|
32
|
+
rowClassName?: (row: Row) => string | undefined;
|
|
33
|
+
rowHref?: (row: Row) => string | undefined;
|
|
34
|
+
onOpenRow: (row: Row) => void;
|
|
35
|
+
onPrefetchRow?: (row: Row) => void;
|
|
36
|
+
onRowDelete?: (id: string) => Promise<void>;
|
|
37
|
+
deleteLabel?: string;
|
|
38
|
+
/** Per-row actions in the title cell's hover lane, before the built-in Edit. */
|
|
39
|
+
rowActions?: ListCellAction<Row>[];
|
|
40
|
+
/** Leading ICON at the START of the title cell — a bare glyph, never an
|
|
41
|
+
* avatar component (see GridTableProps.rowIcon). Undefined = the user
|
|
42
|
+
* turned the "Row icon" toggle off, or the list has no icon to draw. */
|
|
43
|
+
rowIcon?: ListRowIconAccessor<Row>;
|
|
44
|
+
verticalBorders?: boolean;
|
|
45
|
+
optionColors?: ListOptionColorOverrides;
|
|
46
|
+
dateStyles?: ListDateStyleOverrides;
|
|
47
|
+
/** Per-field duration rendering (override → `format.durationStyle` → adaptive). */
|
|
48
|
+
durationStyles?: ListDurationStyleOverrides;
|
|
49
|
+
/** Per-field decimals / display-currency (host-owned, from the header menu). */
|
|
50
|
+
numberFormats?: ListNumberFormatOverrides;
|
|
51
|
+
/** Per-field show-time overrides for date columns. */
|
|
52
|
+
showTimeOverrides?: ListShowTimeOverrides;
|
|
53
|
+
/** Per-field percent drawing (text, bar, ring). */
|
|
54
|
+
percentDisplays?: ListPercentDisplayOverrides;
|
|
55
|
+
/** The grid has a commit handler — cells with editors may enter edit mode. */
|
|
56
|
+
editingEnabled: boolean;
|
|
57
|
+
/** Focused/editing column id — null unless it's THIS row's cell. */
|
|
58
|
+
focusedColId: string | null;
|
|
59
|
+
editingColId: string | null;
|
|
60
|
+
/** columnId → optimistic pending value (undefined when this row has none). */
|
|
61
|
+
pendingByCol?: Record<string, unknown>;
|
|
62
|
+
/** columnId → `requested` for a pending value saved here but not yet accepted
|
|
63
|
+
* by the provider that owns it (spec §11.2) — drawn as the cell's pending state. */
|
|
64
|
+
settlementByCol?: Record<string, "requested">;
|
|
65
|
+
/** columnId → option values for status/select editors (declared + discovered).
|
|
66
|
+
* One memo-stable object shared by every row. */
|
|
67
|
+
selectValues?: Record<string, string[]>;
|
|
68
|
+
/** THIS row's slices of the 2D range selection (visible-column indices),
|
|
69
|
+
* memo-stable (GridTable caches identity per row). Undefined when no
|
|
70
|
+
* multi-cell range touches the row — the common case renders as before. */
|
|
71
|
+
rowRange?: GridRowRangeSpan[];
|
|
72
|
+
/** The row's number among every row of the grid, bars, column names and footers included (1-based). */
|
|
73
|
+
ariaRowIndex?: number;
|
|
74
|
+
/** In a tree grid (a grouped grid): 2, a group's row; its place in its group and the group's size. */
|
|
75
|
+
ariaLevel?: number;
|
|
76
|
+
ariaPosInSet?: number;
|
|
77
|
+
ariaSetSize?: number;
|
|
78
|
+
/** Columns before the first data column: 1 with the checkbox lane, else 0. */
|
|
79
|
+
ariaColOffset?: number;
|
|
80
|
+
/** The tail's column (the row's ⋯): the last. */
|
|
81
|
+
ariaTailIndex?: number;
|
|
82
|
+
/** How many LEADING columns are pinned to the left edge. A plain number, so a
|
|
83
|
+
* memoized row doesn't re-render on every scroll; the row computes its own
|
|
84
|
+
* sticky offsets from it. 0 = nothing frozen. */
|
|
85
|
+
frozenCount?: number;
|
|
86
|
+
/** Sticky `left` for the frozen column at visible index i — a calc() over the
|
|
87
|
+
* width vars, so live resize re-lays the frozen stack without React. */
|
|
88
|
+
frozenLeft?: (i: number) => string;
|
|
89
|
+
/** Workspace-settings capability locks (table read-only / per-column) — subtracts from
|
|
90
|
+
* what the columns declare. Memo-stable: threaded straight from the host. */
|
|
91
|
+
listConfig?: ListSettingsConfig;
|
|
92
|
+
onFocusCell: (rowId: string, columnId: string) => void;
|
|
93
|
+
/** Open a cell's editor. `seed`: the character that opened it (type-to-replace). `whole`: the
|
|
94
|
+
* text was cut off in its cell, so it opens whole in the panel over the cell. */
|
|
95
|
+
onStartEdit: (rowId: string, columnId: string, seed?: string | null, whole?: boolean) => void;
|
|
96
|
+
/** A second click or a double-click on a cell that opens nothing: the grid
|
|
97
|
+
* says why it can't be edited (or nothing, when it can be written). */
|
|
98
|
+
onRefuseEdit?: (columnId: string) => void;
|
|
99
|
+
/** Tab out of an editor → next/prev cell in reading order (grid-owned so it
|
|
100
|
+
* matches Tab-while-focused; wraps rows). */
|
|
101
|
+
onEditorTab: (rowId: string, columnId: string, backwards: boolean) => void;
|
|
102
|
+
/** Enter out of an editor → advance one row down. */
|
|
103
|
+
onEditorEnter: (rowId: string, columnId: string) => void;
|
|
104
|
+
/** Type-to-replace seed: the character that opened THIS row's editor, or null.
|
|
105
|
+
* Used as the editor's initial value in place of the cell's own. */
|
|
106
|
+
editSeed?: string | null;
|
|
107
|
+
/** THIS row's open text was cut off when it opened: it shows whole in the panel over the cell.
|
|
108
|
+
* False on every row but the editing one. */
|
|
109
|
+
editWhole?: boolean;
|
|
110
|
+
/** Shift-click: extend the active range to this cell (anchor stays). */
|
|
111
|
+
onExtendCell: (rowId: string, columnId: string) => void;
|
|
112
|
+
/** ⌘-click: add this cell as its own range. */
|
|
113
|
+
onAddCell: (rowId: string, columnId: string) => void;
|
|
114
|
+
onCommitCell: (row: Row, rowId: string, columnId: string, prev: unknown, next: unknown, opts?: {
|
|
115
|
+
overlay?: boolean;
|
|
116
|
+
}) => void;
|
|
117
|
+
/** Cell-scoped args make late (animation-deferred) cancels safe. */
|
|
118
|
+
onCancelEdit: (rowId?: string, columnId?: string) => void;
|
|
119
|
+
/** Open the entity a `relation` cell POINTS AT — a different entity from the
|
|
120
|
+
* one `onOpenRow` opens, which is why it can't reuse that handler. Omitted
|
|
121
|
+
* by a host with nowhere to send the click; the chip then renders inert
|
|
122
|
+
* rather than advertising a navigation it can't perform. */
|
|
123
|
+
onOpenRelation?: (value: ListRelationValue, columnId: string, row: Row) => void;
|
|
124
|
+
/** This app's glyph for an entity kind — see `GridCellOptions.entityIcon`. */
|
|
125
|
+
entityIcon?: (kind: string | undefined) => ReactNode;
|
|
126
|
+
/** The verbs a `command` column's cell opens, by field key — the host's, the
|
|
127
|
+
* same map the drawer's `FieldPanel` takes. Memo-stable: threaded straight
|
|
128
|
+
* from the host. See `GridCellOptions.commandItems`. */
|
|
129
|
+
commands?: FieldMenus<Row>;
|
|
130
|
+
/** Whether a cell sits inside the active MULTI-cell range — the context
|
|
131
|
+
* menu's verbs then act on the whole range instead of the one cell. */
|
|
132
|
+
inActiveRange: (rowId: string, columnId: string) => boolean;
|
|
133
|
+
/** Whether the active range holds any clearable column (greys Cut/Clear —
|
|
134
|
+
* required fields can't be emptied). */
|
|
135
|
+
rangeCanClear: () => boolean;
|
|
136
|
+
onRangeCopy: () => void;
|
|
137
|
+
onRangeCut: () => void;
|
|
138
|
+
onRangePaste: () => void;
|
|
139
|
+
onRangeClear: () => void;
|
|
140
|
+
/** Paste the clipboard MATRIX anchored at this cell (single-cell menu path
|
|
141
|
+
* when the clipboard holds a range copy). */
|
|
142
|
+
onPasteAtCell: (rowId: string, columnId: string) => void;
|
|
143
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type ReactNode, type RefObject } from "react";
|
|
2
|
+
import type { GridFlatRows, GridRowPlace } from "../core/flat-rows.js";
|
|
3
|
+
import { type GridRowRange } from "../core/row-window.js";
|
|
4
|
+
/**
|
|
5
|
+
* THE ROWS ON SCREEN. Each group draws only the rows its scroll owner shows, plus `GRID_WINDOW_OVERSCAN` each side,
|
|
6
|
+
* in flow between spacers as tall as the rows they stand for, so every group's box stays as tall as the group and its
|
|
7
|
+
* head pins as before (`prototypes/pinned-group-header/`). The rows kept drawn wherever they are (the focused, the editing, a focused checkbox's, the last revealed)
|
|
8
|
+
* are their own runs between spacers.
|
|
9
|
+
*
|
|
10
|
+
* One store per table, like the hover store: a scroll anywhere (one capture listener on the document, which hears the
|
|
11
|
+
* grid's own area and the page alike) and a resize write each group's range, and each group's rows subscribe to their
|
|
12
|
+
* own, so a scroll redraws only the rows lists whose range changed: never the table, a head or a footer.
|
|
13
|
+
*/
|
|
14
|
+
/** A group's window. `range` is undefined until the first measure writes one: its rows draw their fallback. */
|
|
15
|
+
export type GridRowWindowSnapshot = {
|
|
16
|
+
range: GridRowRange | undefined;
|
|
17
|
+
revealed: number | null;
|
|
18
|
+
};
|
|
19
|
+
export type GridRowWindowStore = {
|
|
20
|
+
get(groupKey: string): GridRowWindowSnapshot;
|
|
21
|
+
/** Writes every group's range; notifies only the groups whose snapshot changed. */
|
|
22
|
+
setRanges(ranges: ReadonlyMap<string, GridRowRange>): void;
|
|
23
|
+
/** Marks one row as revealed (kept drawn) and clears the last one. */
|
|
24
|
+
reveal(place: GridRowPlace | null): void;
|
|
25
|
+
subscribe(groupKey: string, listener: () => void): () => void;
|
|
26
|
+
};
|
|
27
|
+
export declare function createGridRowWindowStore(): GridRowWindowStore;
|
|
28
|
+
export declare const GridRowWindowContext: import("react").Context<GridRowWindowStore | null>;
|
|
29
|
+
/** One group's window. With no store (rows drawn outside a table), every row. */
|
|
30
|
+
export declare function useGridGroupWindow(groupKey: string): GridRowWindowSnapshot;
|
|
31
|
+
/** What an open group draws where nothing can be measured: its first rows. A collapsed group draws none. */
|
|
32
|
+
export declare function fallbackRange(count: number, collapsed: boolean): GridRowRange;
|
|
33
|
+
/**
|
|
34
|
+
* Measures the groups' rows regions, follows every scroll, and answers the reveal seam (`revealGridCell`'s
|
|
35
|
+
* `revealRow`). Positions are read in the content box's coordinates: a group's rows start at its region's top, and
|
|
36
|
+
* its region ends where its box does, so a collapsing group draws only what its clip still shows.
|
|
37
|
+
*/
|
|
38
|
+
export declare function useGridRowWindow<Row>({ rootRef, flat, rowHeight, }: {
|
|
39
|
+
rootRef: RefObject<HTMLDivElement | null>;
|
|
40
|
+
flat: GridFlatRows<Row>;
|
|
41
|
+
/** One row's height in px: `GRID_ROW_PX` times the grid's scale, what `--vk-row-h` resolves to. */
|
|
42
|
+
rowHeight: number;
|
|
43
|
+
}): {
|
|
44
|
+
store: GridRowWindowStore;
|
|
45
|
+
revealRow: (rowKey: string, columnId?: string) => void;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* The row lines an undrawn stretch shows: one hairline a row apart, the rows' own bottom border, so a fling that
|
|
49
|
+
* outruns the drawing shows empty rows filling in, never a blank.
|
|
50
|
+
*/
|
|
51
|
+
export declare const GRID_GAP_LINES = "repeating-linear-gradient(to bottom, transparent 0 calc(var(--vk-row-h) - 1px), var(--vk-border-subtle) calc(var(--vk-row-h) - 1px) var(--vk-row-h))";
|
|
52
|
+
/** One section's rows: its window's rows and the kept ones between spacers, inside its rows region. */
|
|
53
|
+
export declare function GridWindowRows<Row>({ groupKey, items, collapsed, kept, renderRow, }: {
|
|
54
|
+
groupKey: string;
|
|
55
|
+
items: Row[];
|
|
56
|
+
/** A shut group: before the first measure it draws none. */
|
|
57
|
+
collapsed: boolean;
|
|
58
|
+
/** Indices drawn wherever they are: the focused and the editing row. */
|
|
59
|
+
kept: readonly number[];
|
|
60
|
+
renderRow: (row: Row, index: number, items: Row[], groupKey: string) => ReactNode;
|
|
61
|
+
}): import("react/jsx-runtime").JSX.Element;
|