@viewkitjs/views 0.0.0-stage → 0.2.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 +615 -0
- package/LICENSE.md +7 -0
- package/README.md +99 -2
- package/dist/atoms/CommandMenu.d.ts +2 -0
- package/dist/atoms/CommandMenu.js +20 -0
- package/dist/atoms/List.d.ts +2 -0
- package/dist/atoms/List.js +6 -0
- package/dist/atoms/LoadMore.d.ts +2 -0
- package/dist/atoms/LoadMore.js +25 -0
- package/dist/atoms/Loading.d.ts +2 -0
- package/dist/atoms/Loading.js +7 -0
- package/dist/atoms/PlatformMark.d.ts +2 -0
- package/dist/atoms/PlatformMark.js +4 -0
- package/dist/atoms/RelationLink.d.ts +2 -0
- package/dist/atoms/RelationLink.js +6 -0
- package/dist/atoms/Row.d.ts +3 -0
- package/dist/atoms/Row.js +30 -0
- package/dist/atoms/RowMenu.d.ts +2 -0
- package/dist/atoms/RowMenu.js +112 -0
- package/dist/atoms/StatusBadge.d.ts +2 -0
- package/dist/atoms/StatusBadge.js +7 -0
- package/dist/atoms/StatusMarker.d.ts +2 -0
- package/dist/atoms/StatusMarker.js +19 -0
- package/dist/atoms/Tag.d.ts +2 -0
- package/dist/atoms/Tag.js +13 -0
- package/dist/atoms/TickBox.d.ts +2 -0
- package/dist/atoms/TickBox.js +8 -0
- package/dist/atoms/defaults.d.ts +2 -0
- package/dist/atoms/defaults.js +27 -0
- package/dist/atoms/tones.d.ts +5 -0
- package/dist/atoms/tones.js +28 -0
- package/dist/atoms/types.d.ts +178 -0
- package/dist/atoms/types.js +3 -0
- package/dist/cells/cell-format.d.ts +138 -0
- package/dist/cells/cell-format.js +16 -0
- package/dist/cells/cell-title.d.ts +17 -0
- package/dist/cells/cell-title.js +8 -0
- package/dist/cells/cell-values.d.ts +28 -0
- package/dist/cells/cell-values.js +87 -0
- package/dist/cells/index.d.ts +4 -0
- package/dist/cells/index.js +4 -0
- package/dist/cells/legacy-field.d.ts +52 -0
- package/dist/cells/legacy-field.js +164 -0
- package/dist/cells/relation-wrap.d.ts +3 -0
- package/dist/cells/relation-wrap.js +24 -0
- package/dist/cells/use-cell-format.d.ts +5 -0
- package/dist/cells/use-cell-format.js +10 -0
- package/dist/contract.d.ts +461 -0
- package/dist/contract.js +682 -0
- package/dist/display/actor.d.ts +4 -0
- package/dist/display/actor.js +26 -0
- package/dist/display/boolean.d.ts +18 -0
- package/dist/display/boolean.js +43 -0
- package/dist/display/breakdown.d.ts +15 -0
- package/dist/display/breakdown.js +32 -0
- package/dist/display/currency.d.ts +9 -0
- package/dist/display/currency.js +29 -0
- package/dist/display/date.d.ts +12 -0
- package/dist/display/date.js +26 -0
- package/dist/display/display-cores.d.ts +31 -0
- package/dist/display/display-cores.js +57 -0
- package/dist/display/entity-chip.d.ts +26 -0
- package/dist/display/entity-chip.js +9 -0
- package/dist/display/format.d.ts +66 -0
- package/dist/display/format.js +190 -0
- package/dist/display/index.d.ts +8 -0
- package/dist/display/index.js +7 -0
- package/dist/display/link.d.ts +29 -0
- package/dist/display/link.js +50 -0
- package/dist/display/location.d.ts +8 -0
- package/dist/display/location.js +22 -0
- package/dist/display/multi-value.d.ts +18 -0
- package/dist/display/multi-value.js +28 -0
- package/dist/display/name.d.ts +6 -0
- package/dist/display/name.js +14 -0
- package/dist/display/number.d.ts +11 -0
- package/dist/display/number.js +27 -0
- package/dist/display/options.d.ts +153 -0
- package/dist/display/options.js +1 -0
- package/dist/display/percent.d.ts +4 -0
- package/dist/display/percent.js +40 -0
- package/dist/display/phone.d.ts +11 -0
- package/dist/display/phone.js +45 -0
- package/dist/display/range.d.ts +6 -0
- package/dist/display/range.js +29 -0
- package/dist/display/relation.d.ts +4 -0
- package/dist/display/relation.js +29 -0
- package/dist/display/rich-text.d.ts +10 -0
- package/dist/display/rich-text.js +34 -0
- package/dist/display/select.d.ts +6 -0
- package/dist/display/select.js +38 -0
- package/dist/display/text-class.d.ts +23 -0
- package/dist/display/text-class.js +5 -0
- package/dist/display/text.d.ts +19 -0
- package/dist/display/text.js +8 -0
- package/dist/display/use-display-options.d.ts +2 -0
- package/dist/display/use-display-options.js +14 -0
- package/dist/display/user.d.ts +11 -0
- package/dist/display/user.js +10 -0
- package/dist/display/value-list.d.ts +10 -0
- package/dist/display/value-list.js +12 -0
- package/dist/display/viewer.d.ts +4 -0
- package/dist/display/viewer.js +11 -0
- package/dist/display/web-href.d.ts +8 -0
- package/dist/display/web-href.js +12 -0
- package/dist/editors/ChipsEditor.d.ts +59 -0
- package/dist/editors/ChipsEditor.js +73 -0
- package/dist/editors/DateEditor.d.ts +25 -0
- package/dist/editors/DateEditor.js +122 -0
- package/dist/editors/LocationEditor.d.ts +22 -0
- package/dist/editors/LocationEditor.js +228 -0
- package/dist/editors/NameEditor.d.ts +22 -0
- package/dist/editors/NameEditor.js +92 -0
- package/dist/editors/NumberEditor.d.ts +67 -0
- package/dist/editors/NumberEditor.js +86 -0
- package/dist/editors/RangeEditor.d.ts +22 -0
- package/dist/editors/RangeEditor.js +70 -0
- package/dist/editors/RelationEditor.d.ts +65 -0
- package/dist/editors/RelationEditor.js +64 -0
- package/dist/editors/SelectEditor.d.ts +72 -0
- package/dist/editors/SelectEditor.js +59 -0
- package/dist/editors/ValueListEditor.d.ts +38 -0
- package/dist/editors/ValueListEditor.js +217 -0
- package/dist/editors/edit-cores.d.ts +83 -0
- package/dist/editors/edit-cores.js +38 -0
- package/dist/editors/edit-session.d.ts +74 -0
- package/dist/editors/edit-session.js +35 -0
- package/dist/editors/open-values.d.ts +28 -0
- package/dist/editors/open-values.js +26 -0
- package/dist/editors/relation-source.d.ts +66 -0
- package/dist/editors/relation-source.js +102 -0
- package/dist/fields/binding.d.ts +87 -0
- package/dist/fields/binding.js +117 -0
- package/dist/fields/currency.d.ts +82 -0
- package/dist/fields/currency.js +41 -0
- package/dist/fields/denomination.d.ts +42 -0
- package/dist/fields/denomination.js +11 -0
- package/dist/fields/edit-core-types.d.ts +40 -0
- package/dist/fields/edit-core-types.js +29 -0
- package/dist/fields/format-knobs.d.ts +34 -0
- package/dist/fields/format-knobs.js +36 -0
- package/dist/fields/menus.d.ts +28 -0
- package/dist/fields/menus.js +1 -0
- package/dist/fields/money.d.ts +60 -0
- package/dist/fields/money.js +78 -0
- package/dist/fields/number-edit.d.ts +11 -0
- package/dist/fields/number-edit.js +17 -0
- package/dist/fields/prepare-write.d.ts +55 -0
- package/dist/fields/prepare-write.js +67 -0
- package/dist/fields/relation-source-types.d.ts +54 -0
- package/dist/fields/relation-source-types.js +1 -0
- package/dist/figures.d.ts +52 -0
- package/dist/figures.js +63 -0
- package/dist/filters/date-filter.d.ts +2 -0
- package/dist/filters/date-filter.js +1 -0
- package/dist/filters/filter-model.d.ts +176 -0
- package/dist/filters/filter-model.js +41 -0
- package/dist/filters/number-filter.d.ts +2 -0
- package/dist/filters/number-filter.js +1 -0
- package/dist/filters/range-filter.d.ts +2 -0
- package/dist/filters/range-filter.js +1 -0
- package/dist/filters/registry.d.ts +103 -0
- package/dist/filters/registry.js +8 -0
- package/dist/filters/relation-filter.d.ts +16 -0
- package/dist/filters/relation-filter.js +53 -0
- package/dist/filters/text-filter.d.ts +2 -0
- package/dist/filters/text-filter.js +1 -0
- 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 +27 -0
- package/dist/grid/chrome/GridCellEditors.d.ts +64 -0
- package/dist/grid/chrome/GridCellEditors.js +55 -0
- package/dist/grid/chrome/GridCellOutline.d.ts +70 -0
- package/dist/grid/chrome/GridCellOutline.js +21 -0
- package/dist/grid/chrome/GridChipsEditor.d.ts +28 -0
- package/dist/grid/chrome/GridChipsEditor.js +40 -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 +99 -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 +22 -0
- package/dist/grid/chrome/GridDateEditor.js +31 -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 +23 -0
- package/dist/grid/chrome/GridFooter.js +81 -0
- package/dist/grid/chrome/GridGroupMenu.d.ts +37 -0
- package/dist/grid/chrome/GridGroupMenu.js +57 -0
- package/dist/grid/chrome/GridHeader.d.ts +61 -0
- package/dist/grid/chrome/GridHeader.js +37 -0
- package/dist/grid/chrome/GridLongTextEditor.d.ts +36 -0
- package/dist/grid/chrome/GridLongTextEditor.js +127 -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 +19 -0
- package/dist/grid/chrome/GridNameEditor.js +36 -0
- package/dist/grid/chrome/GridNumberEditor.d.ts +35 -0
- package/dist/grid/chrome/GridNumberEditor.js +25 -0
- package/dist/grid/chrome/GridRangeEditor.d.ts +20 -0
- package/dist/grid/chrome/GridRangeEditor.js +25 -0
- package/dist/grid/chrome/GridRelationEditor.d.ts +21 -0
- package/dist/grid/chrome/GridRelationEditor.js +30 -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 +25 -0
- package/dist/grid/chrome/GridRow.js +136 -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 +133 -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 +18 -0
- package/dist/grid/chrome/GridSelectEditor.js +49 -0
- package/dist/grid/chrome/GridStructure.d.ts +48 -0
- package/dist/grid/chrome/GridStructure.js +45 -0
- package/dist/grid/chrome/GridTable.d.ts +4 -0
- package/dist/grid/chrome/GridTable.js +125 -0
- package/dist/grid/chrome/GridTableSurface.d.ts +15 -0
- package/dist/grid/chrome/GridTableSurface.js +6 -0
- package/dist/grid/chrome/GridTextEditor.d.ts +11 -0
- package/dist/grid/chrome/GridTextEditor.js +40 -0
- package/dist/grid/chrome/GridValueListEditor.d.ts +18 -0
- package/dist/grid/chrome/GridValueListEditor.js +36 -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/cells.d.ts +21 -0
- package/dist/grid/chrome/cells.js +20 -0
- package/dist/grid/chrome/checks.d.ts +35 -0
- package/dist/grid/chrome/checks.js +22 -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 +59 -0
- package/dist/grid/chrome/grid-cell-classes.js +30 -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-props.d.ts +131 -0
- package/dist/grid/chrome/grid-row-props.js +1 -0
- package/dist/grid/chrome/grid-styles.d.ts +37 -0
- package/dist/grid/chrome/grid-styles.js +8 -0
- package/dist/grid/chrome/grid-table-props.d.ts +173 -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/useGridHeaderDrag.d.ts +20 -0
- package/dist/grid/chrome/useGridHeaderDrag.js +37 -0
- package/dist/grid/chrome/useGridKeyboard.d.ts +47 -0
- package/dist/grid/chrome/useGridKeyboard.js +274 -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 +49 -0
- package/dist/grid/chrome/useGridRangeActions.js +188 -0
- package/dist/grid/chrome/useGridRangeGestures.d.ts +32 -0
- package/dist/grid/chrome/useGridRangeGestures.js +190 -0
- package/dist/grid/chrome/useGridRowContextMenu.d.ts +35 -0
- package/dist/grid/chrome/useGridRowContextMenu.js +127 -0
- package/dist/grid/chrome/useGridScaleStyles.d.ts +1 -0
- package/dist/grid/chrome/useGridScaleStyles.js +29 -0
- package/dist/grid/chrome/useGridScrollSync.d.ts +38 -0
- package/dist/grid/chrome/useGridScrollSync.js +176 -0
- package/dist/grid/chrome/useGridTableInteractionModel.d.ts +55 -0
- package/dist/grid/chrome/useGridTableInteractionModel.js +197 -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 +81 -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 +34 -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/edit-values.d.ts +9 -0
- package/dist/grid/core/edit-values.js +1 -0
- package/dist/grid/core/editing-controller.d.ts +59 -0
- package/dist/grid/core/editing-controller.js +240 -0
- package/dist/grid/core/editing-model.d.ts +78 -0
- package/dist/grid/core/editing-model.js +136 -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 +50 -0
- package/dist/grid/core/pending-reconciliation.js +49 -0
- package/dist/grid/core/range-model.d.ts +25 -0
- package/dist/grid/core/range-model.js +59 -0
- package/dist/grid/core/spreadsheet-operations.d.ts +85 -0
- package/dist/grid/core/spreadsheet-operations.js +253 -0
- package/dist/grid/core/useGridEditing.d.ts +43 -0
- package/dist/grid/core/useGridEditing.js +90 -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 +32 -0
- package/dist/grid/core/value-equality.js +34 -0
- package/dist/grid/index.d.ts +18 -0
- package/dist/grid/index.js +5 -0
- package/dist/grid/useGridTablePrefs.d.ts +50 -0
- package/dist/grid/useGridTablePrefs.js +101 -0
- package/dist/grouping/sort-groups.d.ts +18 -0
- package/dist/grouping/sort-groups.js +33 -0
- package/dist/grouping/types.d.ts +10 -0
- package/dist/grouping/types.js +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +28 -0
- package/dist/internal/chip.d.ts +4 -0
- package/dist/internal/chip.js +3 -0
- package/dist/internal/cx.d.ts +3 -0
- package/dist/internal/cx.js +3 -0
- package/dist/internal/viewport.d.ts +5 -0
- package/dist/internal/viewport.js +29 -0
- package/dist/model/aggregates.d.ts +59 -0
- package/dist/model/aggregates.js +186 -0
- package/dist/model/card-density.d.ts +8 -0
- package/dist/model/card-density.js +10 -0
- package/dist/model/card-layout.d.ts +85 -0
- package/dist/model/card-layout.js +90 -0
- package/dist/model/column-capabilities.d.ts +162 -0
- package/dist/model/column-capabilities.js +233 -0
- package/dist/model/column-filters.d.ts +106 -0
- package/dist/model/column-filters.js +321 -0
- package/dist/model/column-format.d.ts +103 -0
- package/dist/model/column-format.js +1 -0
- package/dist/model/column-from.d.ts +28 -0
- package/dist/model/column-from.js +160 -0
- package/dist/model/column-inspect.d.ts +18 -0
- package/dist/model/column-inspect.js +6 -0
- package/dist/model/column-knobs.d.ts +20 -0
- package/dist/model/column-knobs.js +16 -0
- package/dist/model/column-money.d.ts +13 -0
- package/dist/model/column-money.js +27 -0
- package/dist/model/column-order.d.ts +36 -0
- package/dist/model/column-order.js +68 -0
- package/dist/model/column-schema.d.ts +335 -0
- package/dist/model/column-schema.js +1 -0
- package/dist/model/column-sort.d.ts +17 -0
- package/dist/model/column-sort.js +11 -0
- package/dist/model/column-state.d.ts +77 -0
- package/dist/model/column-state.js +95 -0
- package/dist/model/column-types.d.ts +109 -0
- package/dist/model/column-types.js +50 -0
- package/dist/model/column-warnings.d.ts +44 -0
- package/dist/model/column-warnings.js +24 -0
- package/dist/model/density.d.ts +3 -0
- package/dist/model/density.js +13 -0
- package/dist/model/field-type-of.d.ts +21 -0
- package/dist/model/field-type-of.js +11 -0
- package/dist/model/filter-capabilities.d.ts +1 -0
- package/dist/model/filter-capabilities.js +1 -0
- package/dist/model/index.d.ts +38 -0
- package/dist/model/index.js +20 -0
- package/dist/model/part-rows.d.ts +28 -0
- package/dist/model/part-rows.js +40 -0
- package/dist/model/preferences.d.ts +155 -0
- package/dist/model/preferences.js +84 -0
- package/dist/model/prefs-buckets.d.ts +173 -0
- package/dist/model/prefs-buckets.js +71 -0
- package/dist/model/relation-filters.d.ts +45 -0
- package/dist/model/relation-filters.js +78 -0
- package/dist/model/render-count.d.ts +2 -0
- package/dist/model/render-count.js +24 -0
- package/dist/model/row-icon.d.ts +23 -0
- package/dist/model/row-icon.js +5 -0
- package/dist/model/view-rules.d.ts +73 -0
- package/dist/model/view-rules.js +216 -0
- package/dist/provider/ViewsProvider.d.ts +26 -0
- package/dist/provider/ViewsProvider.js +16 -0
- package/dist/provider/components.d.ts +230 -0
- package/dist/provider/components.js +3 -0
- package/dist/provider/context.d.ts +20 -0
- package/dist/provider/context.js +10 -0
- package/dist/provider/icons.d.ts +6 -0
- package/dist/provider/icons.js +1 -0
- package/dist/provider/menu-groups.d.ts +8 -0
- package/dist/provider/menu-groups.js +38 -0
- package/dist/provider/ports.d.ts +57 -0
- package/dist/provider/ports.js +9 -0
- package/dist/react.d.ts +9 -0
- package/dist/react.js +4 -0
- package/dist/selection/SelectCheckbox.d.ts +17 -0
- package/dist/selection/SelectCheckbox.js +11 -0
- package/dist/selection/index.d.ts +7 -0
- package/dist/selection/index.js +6 -0
- package/dist/selection/model.d.ts +55 -0
- package/dist/selection/model.js +86 -0
- package/dist/selection/row-click.d.ts +35 -0
- package/dist/selection/row-click.js +20 -0
- package/dist/selection/types.d.ts +17 -0
- package/dist/selection/types.js +1 -0
- package/dist/selection/useCheckDragSelect.d.ts +61 -0
- package/dist/selection/useCheckDragSelect.js +165 -0
- package/dist/selection/useListSelection.d.ts +39 -0
- package/dist/selection/useListSelection.js +48 -0
- package/dist/selection/useListSelectionShortcuts.d.ts +6 -0
- package/dist/selection/useListSelectionShortcuts.js +14 -0
- package/dist/selection/useRestIntent.d.ts +18 -0
- package/dist/selection/useRestIntent.js +35 -0
- package/docs/contract.md +525 -0
- 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 +412 -0
- package/docs/guides/display.md +203 -0
- package/docs/guides/editors.md +404 -0
- package/docs/guides/ports.md +246 -0
- package/docs/guides/selection.md +270 -0
- package/docs/guides/the-grid.md +677 -0
- package/docs/guides/the-provider.md +446 -0
- package/docs/index.md +50 -0
- package/docs/install.md +67 -0
- package/docs/reference/cells.md +28 -0
- package/docs/reference/display.md +42 -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 +9 -0
- package/docs/reference/editors-range.md +6 -0
- package/docs/reference/editors-relation.md +9 -0
- package/docs/reference/editors-select.md +8 -0
- package/docs/reference/editors-session.md +9 -0
- package/docs/reference/editors-value-list.md +6 -0
- package/docs/reference/editors.md +5 -0
- package/docs/reference/grid.md +39 -0
- package/docs/reference/react.md +86 -0
- package/docs/reference/selection.md +33 -0
- package/docs/reference/views.md +601 -0
- package/docs/reshaping.md +19 -0
- package/package.json +118 -3
- package/skills/views/SKILL.md +102 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
3
|
+
import { useHasHover } from "../../internal/viewport.js";
|
|
4
|
+
export function useGridScrollSync(rootRef) {
|
|
5
|
+
const scrollersRef = useRef(new Set());
|
|
6
|
+
const headersRef = useRef(new Set());
|
|
7
|
+
const scrollXRef = useRef(0);
|
|
8
|
+
const wheelDriven = useHasHover();
|
|
9
|
+
const parkAtRef = useRef(0);
|
|
10
|
+
const applyX = useCallback((x) => {
|
|
11
|
+
scrollXRef.current = x;
|
|
12
|
+
for (const scroller of scrollersRef.current) {
|
|
13
|
+
if (scroller.scrollLeft !== x)
|
|
14
|
+
scroller.scrollLeft = x;
|
|
15
|
+
}
|
|
16
|
+
for (const header of headersRef.current) {
|
|
17
|
+
if (header.scrollLeft !== x)
|
|
18
|
+
header.scrollLeft = x;
|
|
19
|
+
}
|
|
20
|
+
const root = rootRef.current;
|
|
21
|
+
root?.style.setProperty("--vk-scrolled", x > 0 ? "1" : "0");
|
|
22
|
+
root?.style.setProperty("--vk-parked", x > 0 && x >= parkAtRef.current ? "1" : "0");
|
|
23
|
+
}, [rootRef]);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const root = rootRef.current;
|
|
26
|
+
if (!root)
|
|
27
|
+
return;
|
|
28
|
+
const probe = document.createElement("div");
|
|
29
|
+
probe.setAttribute("aria-hidden", "true");
|
|
30
|
+
probe.style.cssText =
|
|
31
|
+
"position:absolute;top:0;left:0;height:0;visibility:hidden;pointer-events:none;" +
|
|
32
|
+
"width:calc(var(--vk-gutter,0px) + var(--vk-indent,0px) - var(--vk-rail-w))";
|
|
33
|
+
root.appendChild(probe);
|
|
34
|
+
const read = () => {
|
|
35
|
+
parkAtRef.current = probe.offsetWidth;
|
|
36
|
+
};
|
|
37
|
+
read();
|
|
38
|
+
const observer = new ResizeObserver(read);
|
|
39
|
+
observer.observe(probe);
|
|
40
|
+
return () => {
|
|
41
|
+
observer.disconnect();
|
|
42
|
+
probe.remove();
|
|
43
|
+
};
|
|
44
|
+
}, [rootRef]);
|
|
45
|
+
const scrollByX = useCallback((delta) => {
|
|
46
|
+
let max = null;
|
|
47
|
+
for (const scroller of scrollersRef.current) {
|
|
48
|
+
if (scroller.clientWidth > 0) {
|
|
49
|
+
max = Math.max(0, scroller.scrollWidth - scroller.clientWidth);
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (max === null)
|
|
54
|
+
return;
|
|
55
|
+
const next = Math.min(max, Math.max(0, scrollXRef.current + delta));
|
|
56
|
+
if (next !== scrollXRef.current)
|
|
57
|
+
applyX(next);
|
|
58
|
+
}, [applyX]);
|
|
59
|
+
const handleScroll = (event) => {
|
|
60
|
+
const x = event.currentTarget.scrollLeft;
|
|
61
|
+
if (x === scrollXRef.current)
|
|
62
|
+
return;
|
|
63
|
+
applyX(x);
|
|
64
|
+
};
|
|
65
|
+
const handleScrollerWheel = useCallback((event) => {
|
|
66
|
+
if (!wheelDriven || event.deltaX === 0)
|
|
67
|
+
return;
|
|
68
|
+
scrollByX(event.deltaX);
|
|
69
|
+
}, [wheelDriven, scrollByX]);
|
|
70
|
+
const handleHeaderWheel = useCallback((event) => {
|
|
71
|
+
if (Math.abs(event.deltaX) <= Math.abs(event.deltaY))
|
|
72
|
+
return;
|
|
73
|
+
scrollByX(event.deltaX);
|
|
74
|
+
}, [scrollByX]);
|
|
75
|
+
const registerScroller = useCallback((element) => {
|
|
76
|
+
if (!element)
|
|
77
|
+
return;
|
|
78
|
+
scrollersRef.current.add(element);
|
|
79
|
+
if (scrollXRef.current)
|
|
80
|
+
element.scrollLeft = scrollXRef.current;
|
|
81
|
+
element.addEventListener("wheel", handleScrollerWheel, { passive: true });
|
|
82
|
+
const set = scrollersRef.current;
|
|
83
|
+
return () => {
|
|
84
|
+
set.delete(element);
|
|
85
|
+
element.removeEventListener("wheel", handleScrollerWheel);
|
|
86
|
+
};
|
|
87
|
+
}, [handleScrollerWheel]);
|
|
88
|
+
const registerHeader = useCallback((element) => {
|
|
89
|
+
if (!element)
|
|
90
|
+
return;
|
|
91
|
+
headersRef.current.add(element);
|
|
92
|
+
if (scrollXRef.current)
|
|
93
|
+
element.scrollLeft = scrollXRef.current;
|
|
94
|
+
const putBack = () => {
|
|
95
|
+
if (element.scrollLeft !== scrollXRef.current)
|
|
96
|
+
element.scrollLeft = scrollXRef.current;
|
|
97
|
+
};
|
|
98
|
+
element.addEventListener("scroll", putBack, { passive: true });
|
|
99
|
+
const set = headersRef.current;
|
|
100
|
+
return () => {
|
|
101
|
+
set.delete(element);
|
|
102
|
+
element.removeEventListener("scroll", putBack);
|
|
103
|
+
};
|
|
104
|
+
}, []);
|
|
105
|
+
const registerHeaderWheel = useCallback((element) => {
|
|
106
|
+
if (!element)
|
|
107
|
+
return;
|
|
108
|
+
element.addEventListener("wheel", handleHeaderWheel, { passive: true });
|
|
109
|
+
return () => element.removeEventListener("wheel", handleHeaderWheel);
|
|
110
|
+
}, [handleHeaderWheel]);
|
|
111
|
+
const getScroller = useCallback(() => scrollersRef.current.values().next().value, []);
|
|
112
|
+
const surface = {
|
|
113
|
+
register: registerScroller,
|
|
114
|
+
onScroll: handleScroll,
|
|
115
|
+
className: wheelDriven
|
|
116
|
+
? "overflow-x-hidden overflow-y-clip"
|
|
117
|
+
:
|
|
118
|
+
"overflow-x-auto overflow-y-clip overscroll-x-none",
|
|
119
|
+
};
|
|
120
|
+
const headerPanRef = useRef(null);
|
|
121
|
+
const handleHeaderPanDown = (event) => {
|
|
122
|
+
if (event.pointerType !== "touch")
|
|
123
|
+
return;
|
|
124
|
+
headerPanRef.current = {
|
|
125
|
+
id: event.pointerId,
|
|
126
|
+
x: event.clientX,
|
|
127
|
+
y: event.clientY,
|
|
128
|
+
horizontal: null,
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
const handleHeaderPanMove = (event) => {
|
|
132
|
+
const pan = headerPanRef.current;
|
|
133
|
+
if (!pan || pan.id !== event.pointerId)
|
|
134
|
+
return;
|
|
135
|
+
const deltaX = event.clientX - pan.x;
|
|
136
|
+
const deltaY = event.clientY - pan.y;
|
|
137
|
+
if (pan.horizontal === null) {
|
|
138
|
+
if (Math.abs(deltaX) < 4 && Math.abs(deltaY) < 4)
|
|
139
|
+
return;
|
|
140
|
+
pan.horizontal = Math.abs(deltaX) > Math.abs(deltaY);
|
|
141
|
+
}
|
|
142
|
+
if (!pan.horizontal)
|
|
143
|
+
return;
|
|
144
|
+
pan.x = event.clientX;
|
|
145
|
+
pan.y = event.clientY;
|
|
146
|
+
scrollByX(-deltaX);
|
|
147
|
+
};
|
|
148
|
+
const handleHeaderPanEnd = () => {
|
|
149
|
+
headerPanRef.current = null;
|
|
150
|
+
};
|
|
151
|
+
const headerPanHandlers = {
|
|
152
|
+
onPointerDown: handleHeaderPanDown,
|
|
153
|
+
onPointerMove: handleHeaderPanMove,
|
|
154
|
+
onPointerUp: handleHeaderPanEnd,
|
|
155
|
+
onPointerCancel: handleHeaderPanEnd,
|
|
156
|
+
};
|
|
157
|
+
useEffect(() => {
|
|
158
|
+
const root = rootRef.current;
|
|
159
|
+
if (!root)
|
|
160
|
+
return;
|
|
161
|
+
const onTouchMove = (event) => {
|
|
162
|
+
if (headerPanRef.current?.horizontal && event.cancelable)
|
|
163
|
+
event.preventDefault();
|
|
164
|
+
};
|
|
165
|
+
root.addEventListener("touchmove", onTouchMove, { passive: false });
|
|
166
|
+
return () => root.removeEventListener("touchmove", onTouchMove);
|
|
167
|
+
}, [rootRef]);
|
|
168
|
+
return {
|
|
169
|
+
scrollXRef,
|
|
170
|
+
getScroller,
|
|
171
|
+
surface,
|
|
172
|
+
registerHeader,
|
|
173
|
+
headerWheelRef: registerHeaderWheel,
|
|
174
|
+
headerPanHandlers,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type RefObject } from "react";
|
|
2
|
+
import { type GridEditCell } from "../core/useGridEditing.js";
|
|
3
|
+
import type { ListColumn } from "../../model/column-schema.js";
|
|
4
|
+
import type { GridTableProps } from "./grid-table-props.js";
|
|
5
|
+
export declare function useGridTableInteractionModel<Row>({ rootRef, props, rows, visibleRows, rowIndex, visibleColumns, selecting, }: {
|
|
6
|
+
rootRef: RefObject<HTMLDivElement | null>;
|
|
7
|
+
props: GridTableProps<Row>;
|
|
8
|
+
rows: Row[];
|
|
9
|
+
/** Row KEYS in render order — positions, not records. See `GridCellPos`. */
|
|
10
|
+
visibleRows: string[];
|
|
11
|
+
/** Row key → the rendered row and its DATA id. */
|
|
12
|
+
rowIndex: ReadonlyMap<string, {
|
|
13
|
+
key: string;
|
|
14
|
+
rowId: string;
|
|
15
|
+
row: Row;
|
|
16
|
+
}>;
|
|
17
|
+
visibleColumns: ListColumn<Row>[];
|
|
18
|
+
selecting: boolean;
|
|
19
|
+
}): {
|
|
20
|
+
onEditorTab: (rowId: string, columnId: string, backwards: boolean) => void;
|
|
21
|
+
onEditorEnter: (rowId: string, columnId: string) => void;
|
|
22
|
+
visibleColIds: string[];
|
|
23
|
+
rowSpansMap: Map<string, import("../core/range-model.js").GridRowRangeSpan[]>;
|
|
24
|
+
selectValuesByColumn: Record<string, string[]>;
|
|
25
|
+
finishFill: (targetRowId: string) => void;
|
|
26
|
+
onRangeCopy: () => void | undefined;
|
|
27
|
+
onRangeCut: () => void | undefined;
|
|
28
|
+
onRangeClear: () => void | undefined;
|
|
29
|
+
onRangePaste: () => void | undefined;
|
|
30
|
+
onPasteAtCell: (rowId: string, columnId: string) => void | undefined;
|
|
31
|
+
inActiveRange: (rowId: string, columnId: string) => boolean;
|
|
32
|
+
rangeCanClear: () => boolean;
|
|
33
|
+
rangeVerbsRef: RefObject<import("./useGridRangeActions.js").GridRangeVerbs | null>;
|
|
34
|
+
editingEnabled: boolean;
|
|
35
|
+
focusedCell: import("../core/coordinates.js").GridCellPos | null;
|
|
36
|
+
editingCell: import("../core/coordinates.js").GridCellPos | null;
|
|
37
|
+
pendingByRow: ReadonlyMap<string, Record<string, unknown>>;
|
|
38
|
+
settlementByRow: import("../core/editing-model.js").GridSettlementByRow;
|
|
39
|
+
editSeed: string | null;
|
|
40
|
+
focusCellSync: (rowId: string, columnId: string) => void;
|
|
41
|
+
startEditSync: (rowId: string, columnId: string, seed?: string) => void;
|
|
42
|
+
cancelEdit: (rowId?: string, columnId?: string) => void;
|
|
43
|
+
commitEdit: (row: Row, rowId: string, columnId: string, prev: unknown, next: unknown, opts?: {
|
|
44
|
+
overlay?: boolean;
|
|
45
|
+
}) => void;
|
|
46
|
+
commitBatch: (edits: (GridEditCell<Row> & {
|
|
47
|
+
row: Row;
|
|
48
|
+
})[]) => Promise<boolean>;
|
|
49
|
+
refuseEdit: (columnId: string) => boolean;
|
|
50
|
+
onExtendCell: (rowId: string, columnId: string) => void;
|
|
51
|
+
onAddCell: (rowId: string, columnId: string) => void;
|
|
52
|
+
handleRootPointerDown: (event: React.PointerEvent) => void;
|
|
53
|
+
handleRootPointerDownCapture: (event: React.PointerEvent) => void;
|
|
54
|
+
handleRootClickCapture: (event: React.MouseEvent) => void;
|
|
55
|
+
};
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { useViews } from "../../provider/context.js";
|
|
4
|
+
import { useGridEditing } from "../core/useGridEditing.js";
|
|
5
|
+
import { useGridRange } from "../core/useGridRange.js";
|
|
6
|
+
import { columnEffectiveWritable, gridEditRefusal, gridNormalizeWrite, } from "../../model/column-capabilities.js";
|
|
7
|
+
import { gridRowIdFromKey } from "../core/coordinates.js";
|
|
8
|
+
import { useGridKeyboard } from "./useGridKeyboard.js";
|
|
9
|
+
import { useGridPendingReconciliation } from "./useGridPendingReconciliation.js";
|
|
10
|
+
import { useGridRangeActions } from "./useGridRangeActions.js";
|
|
11
|
+
import { useGridRangeGestures } from "./useGridRangeGestures.js";
|
|
12
|
+
const REFUSAL_REPEAT_MS = 600;
|
|
13
|
+
export function useGridTableInteractionModel({ rootRef, props, rows, visibleRows, rowIndex, visibleColumns, selecting, }) {
|
|
14
|
+
const { columns, getRowId, listConfig } = props;
|
|
15
|
+
const { conventions, ports, messages } = useViews();
|
|
16
|
+
const editingEnabled = !!props.onCellCommit;
|
|
17
|
+
const { focused: focusedCell, editing: editingCell, pendingByRow, settlementByRow, focusCell, clearFocus, startEdit, cancelEdit, commitEdit: commitEditRaw, commitBatch: commitBatchRaw, undo, redo, reconcile, hasInflight, pendingBaseline, } = useGridEditing(props.onCellCommit, props.onCellsCommit);
|
|
18
|
+
const commitEdit = useCallback((row, rowId, columnId, prev, next, opts) => {
|
|
19
|
+
const col = visibleColumns.find((c) => c.id === columnId);
|
|
20
|
+
if (col) {
|
|
21
|
+
const res = gridNormalizeWrite(col, next, conventions, { messages, stored: prev });
|
|
22
|
+
if (!res.ok) {
|
|
23
|
+
ports.toast.error(res.reason);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
next = res.value;
|
|
27
|
+
}
|
|
28
|
+
commitEditRaw(row, rowId, columnId, prev, next, opts);
|
|
29
|
+
}, [visibleColumns, commitEditRaw, conventions, messages, ports]);
|
|
30
|
+
const commitBatch = useCallback((edits) => {
|
|
31
|
+
const colById = new Map(visibleColumns.map((c) => [c.id, c]));
|
|
32
|
+
const kept = [];
|
|
33
|
+
let firstRefusal;
|
|
34
|
+
for (const edit of edits) {
|
|
35
|
+
const col = colById.get(edit.columnId);
|
|
36
|
+
if (!col) {
|
|
37
|
+
kept.push(edit);
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
const res = gridNormalizeWrite(col, edit.next, conventions, { messages, stored: edit.prev });
|
|
41
|
+
if (!res.ok) {
|
|
42
|
+
firstRefusal ??= res.reason;
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
kept.push(res.value === edit.next ? edit : { ...edit, next: res.value });
|
|
46
|
+
}
|
|
47
|
+
if (kept.length === 0) {
|
|
48
|
+
if (firstRefusal)
|
|
49
|
+
ports.toast.error(firstRefusal);
|
|
50
|
+
return Promise.resolve(true);
|
|
51
|
+
}
|
|
52
|
+
return commitBatchRaw(kept);
|
|
53
|
+
}, [visibleColumns, commitBatchRaw, conventions, messages, ports]);
|
|
54
|
+
const lastRefusalRef = useRef(null);
|
|
55
|
+
const refuseEdit = useCallback((columnId) => {
|
|
56
|
+
if (!editingEnabled)
|
|
57
|
+
return false;
|
|
58
|
+
const col = visibleColumns.find((c) => c.id === columnId);
|
|
59
|
+
if (!col || columnEffectiveWritable(col, listConfig))
|
|
60
|
+
return false;
|
|
61
|
+
const reason = gridEditRefusal(col, listConfig, conventions, messages);
|
|
62
|
+
if (!reason)
|
|
63
|
+
return false;
|
|
64
|
+
const now = Date.now();
|
|
65
|
+
const last = lastRefusalRef.current;
|
|
66
|
+
lastRefusalRef.current = { columnId, at: now };
|
|
67
|
+
if (last?.columnId === columnId && now - last.at < REFUSAL_REPEAT_MS)
|
|
68
|
+
return true;
|
|
69
|
+
ports.toast.error(reason);
|
|
70
|
+
return true;
|
|
71
|
+
}, [editingEnabled, visibleColumns, listConfig, conventions, messages, ports]);
|
|
72
|
+
const { ranges, setSingle: rangeSetSingle, setRect: rangeSetRect, beginDrag: rangeBeginDrag, extendTo: rangeExtendTo, addCell: rangeAddCell, clear: rangeClear, } = useGridRange();
|
|
73
|
+
const [editSeed, setEditSeed] = useState(null);
|
|
74
|
+
const focusCellSync = useCallback((rowId, columnId) => {
|
|
75
|
+
focusCell(rowId, columnId);
|
|
76
|
+
rangeSetSingle({ rowId, columnId });
|
|
77
|
+
}, [focusCell, rangeSetSingle]);
|
|
78
|
+
const startEditSync = useCallback((rowId, columnId, seed) => {
|
|
79
|
+
setEditSeed(seed ?? null);
|
|
80
|
+
startEdit(rowId, columnId);
|
|
81
|
+
rangeSetSingle({ rowId, columnId });
|
|
82
|
+
}, [startEdit, rangeSetSingle]);
|
|
83
|
+
const clearFocusSync = useCallback(() => {
|
|
84
|
+
clearFocus();
|
|
85
|
+
rangeClear();
|
|
86
|
+
}, [clearFocus, rangeClear]);
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
if (!focusedCell && !editingCell)
|
|
89
|
+
return;
|
|
90
|
+
const visible = new Set(visibleRows);
|
|
91
|
+
const staleEdit = editingCell != null && !visible.has(editingCell.rowId);
|
|
92
|
+
const staleFocus = focusedCell != null && !visible.has(focusedCell.rowId);
|
|
93
|
+
if (!staleEdit && !staleFocus)
|
|
94
|
+
return;
|
|
95
|
+
const editedRowId = editingCell != null
|
|
96
|
+
? (rowIndex.get(editingCell.rowId)?.rowId ?? gridRowIdFromKey(editingCell.rowId))
|
|
97
|
+
: undefined;
|
|
98
|
+
const editedRowGone = editingCell != null && !rows.some((row) => getRowId(row) === editedRowId);
|
|
99
|
+
if (staleEdit)
|
|
100
|
+
cancelEdit();
|
|
101
|
+
if (staleFocus)
|
|
102
|
+
clearFocusSync();
|
|
103
|
+
if (staleEdit && editedRowGone) {
|
|
104
|
+
ports.toast.error(messages({ key: "views.grid.row-left" }));
|
|
105
|
+
}
|
|
106
|
+
}, [cancelEdit, clearFocusSync, editingCell, focusedCell, getRowId, messages, ports, rowIndex, rows, visibleRows]);
|
|
107
|
+
const visibleColumnIds = useMemo(() => visibleColumns.map((column) => column.id), [visibleColumns]);
|
|
108
|
+
const spreadsheetModel = useMemo(() => ({ rows, rowByKey: rowIndex, visibleRowIds: visibleRows, visibleColumns, pendingByRow, conventions, messages }), [rows, rowIndex, visibleRows, visibleColumns, pendingByRow, conventions, messages]);
|
|
109
|
+
const finishFillRef = useRef(() => { });
|
|
110
|
+
const { fillTargetRow, onExtendCell, onAddCell, handleRootPointerDown, handleRootPointerDownCapture, handleRootClickCapture, } = useGridRangeGestures({
|
|
111
|
+
rootRef,
|
|
112
|
+
focusedCell,
|
|
113
|
+
editingCell,
|
|
114
|
+
editingEnabled,
|
|
115
|
+
selecting,
|
|
116
|
+
focusCell,
|
|
117
|
+
clearFocus: clearFocusSync,
|
|
118
|
+
rangeBeginDrag,
|
|
119
|
+
rangeExtendTo,
|
|
120
|
+
rangeAddCell,
|
|
121
|
+
finishFillRef,
|
|
122
|
+
});
|
|
123
|
+
const rangeActions = useGridRangeActions({
|
|
124
|
+
ranges,
|
|
125
|
+
focusedCell,
|
|
126
|
+
editingCell,
|
|
127
|
+
editingEnabled,
|
|
128
|
+
fillTargetRow,
|
|
129
|
+
visibleRowIds: visibleRows,
|
|
130
|
+
visibleColumns,
|
|
131
|
+
spreadsheetModel,
|
|
132
|
+
commitBatch,
|
|
133
|
+
focusCell,
|
|
134
|
+
rangeSetRect,
|
|
135
|
+
rangeExtendTo,
|
|
136
|
+
});
|
|
137
|
+
useEffect(() => {
|
|
138
|
+
finishFillRef.current = rangeActions.finishFill;
|
|
139
|
+
}, [rangeActions.finishFill]);
|
|
140
|
+
const keyboard = useGridKeyboard({
|
|
141
|
+
rootRef,
|
|
142
|
+
focusedCell,
|
|
143
|
+
editingCell,
|
|
144
|
+
editingEnabled,
|
|
145
|
+
listConfig,
|
|
146
|
+
visibleRowIds: visibleRows,
|
|
147
|
+
visibleColIds: visibleColumnIds,
|
|
148
|
+
visibleColumns,
|
|
149
|
+
rows,
|
|
150
|
+
getRowId,
|
|
151
|
+
rowByKey: rowIndex,
|
|
152
|
+
pendingByRow,
|
|
153
|
+
rangeVerbsRef: rangeActions.rangeVerbsRef,
|
|
154
|
+
focusCell: focusCellSync,
|
|
155
|
+
clearFocus: clearFocusSync,
|
|
156
|
+
startEdit: startEditSync,
|
|
157
|
+
cancelEdit,
|
|
158
|
+
commitEdit,
|
|
159
|
+
refuseEdit,
|
|
160
|
+
undo,
|
|
161
|
+
redo,
|
|
162
|
+
rangeSetSingle,
|
|
163
|
+
rangeSetRect,
|
|
164
|
+
rangeExtendTo,
|
|
165
|
+
ranges,
|
|
166
|
+
});
|
|
167
|
+
useGridPendingReconciliation({
|
|
168
|
+
rows,
|
|
169
|
+
columns,
|
|
170
|
+
getRowId,
|
|
171
|
+
pendingByRow,
|
|
172
|
+
reconcile,
|
|
173
|
+
hasInflight,
|
|
174
|
+
pendingBaseline,
|
|
175
|
+
});
|
|
176
|
+
return {
|
|
177
|
+
editingEnabled,
|
|
178
|
+
focusedCell,
|
|
179
|
+
editingCell,
|
|
180
|
+
pendingByRow,
|
|
181
|
+
settlementByRow,
|
|
182
|
+
editSeed,
|
|
183
|
+
focusCellSync,
|
|
184
|
+
startEditSync,
|
|
185
|
+
cancelEdit,
|
|
186
|
+
commitEdit,
|
|
187
|
+
commitBatch,
|
|
188
|
+
refuseEdit,
|
|
189
|
+
onExtendCell,
|
|
190
|
+
onAddCell,
|
|
191
|
+
handleRootPointerDown,
|
|
192
|
+
handleRootPointerDownCapture,
|
|
193
|
+
handleRootClickCapture,
|
|
194
|
+
...rangeActions,
|
|
195
|
+
...keyboard,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type RefObject } from "react";
|
|
2
|
+
import type { GridTableProps } from "./grid-table-props.js";
|
|
3
|
+
export declare function getVisibleGridRowIds<Row>({ groups, grouped, isCollapsed, getRowId, }: Pick<GridTableProps<Row>, "groups" | "grouped" | "isCollapsed" | "getRowId">): string[];
|
|
4
|
+
/**
|
|
5
|
+
* The Grid renderer's list-selection binding.
|
|
6
|
+
*
|
|
7
|
+
* Selection order includes every rendered row, while checkbox-lane drag order
|
|
8
|
+
* deliberately excludes rows hidden inside collapsed groups. Keeping both
|
|
9
|
+
* orders here prevents the renderer from accidentally feeding one contract to
|
|
10
|
+
* the other when its group chrome changes.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useGridTableSelection<Row>({ rootRef, groups, grouped, isCollapsed, getRowId, selection, }: Pick<GridTableProps<Row>, "groups" | "grouped" | "isCollapsed" | "getRowId" | "selection"> & {
|
|
13
|
+
rootRef: RefObject<HTMLDivElement | null>;
|
|
14
|
+
}): {
|
|
15
|
+
selectable: boolean;
|
|
16
|
+
selecting: boolean;
|
|
17
|
+
selectionState: import("../../selection/useListSelection.js").UseListSelectionResult;
|
|
18
|
+
derivedOrderedIds: string[];
|
|
19
|
+
visibleRowIds: string[];
|
|
20
|
+
checkDrag: {
|
|
21
|
+
tryArm: (e: import("react").PointerEvent) => boolean;
|
|
22
|
+
consumeDrag: () => boolean;
|
|
23
|
+
};
|
|
24
|
+
groupSelection: (items: Row[]) => {
|
|
25
|
+
allSelected: boolean;
|
|
26
|
+
someSelected: boolean;
|
|
27
|
+
onToggle: () => void;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { useCheckDragSelect } from "../../selection/useCheckDragSelect.js";
|
|
4
|
+
import { useEscapeToClear } from "../../selection/useListSelectionShortcuts.js";
|
|
5
|
+
import { useListSelection } from "../../selection/useListSelection.js";
|
|
6
|
+
import { gridRowIdFromKey } from "../core/coordinates.js";
|
|
7
|
+
export function getVisibleGridRowIds({ groups, grouped, isCollapsed, getRowId, }) {
|
|
8
|
+
const ids = [];
|
|
9
|
+
for (const group of groups) {
|
|
10
|
+
if (grouped && (isCollapsed?.(group.key) ?? false))
|
|
11
|
+
continue;
|
|
12
|
+
for (const row of group.items)
|
|
13
|
+
ids.push(getRowId(row));
|
|
14
|
+
}
|
|
15
|
+
return ids;
|
|
16
|
+
}
|
|
17
|
+
export function useGridTableSelection({ rootRef, groups, grouped, isCollapsed, getRowId, selection, }) {
|
|
18
|
+
const selectable = !!selection;
|
|
19
|
+
const derivedOrderedIds = useMemo(() => groups.flatMap((group) => group.items).map(getRowId), [groups, getRowId]);
|
|
20
|
+
const orderedIds = selection?.orderedIds ?? derivedOrderedIds;
|
|
21
|
+
const selectionState = useListSelection({
|
|
22
|
+
orderedIds,
|
|
23
|
+
retention: selection?.retention,
|
|
24
|
+
resetKey: selection?.resetKey,
|
|
25
|
+
});
|
|
26
|
+
useEscapeToClear(selectionState.count > 0, selectionState.clear);
|
|
27
|
+
const selecting = selectable && selectionState.count > 0;
|
|
28
|
+
const visibleRowIds = useMemo(() => getVisibleGridRowIds({ groups, grouped, isCollapsed, getRowId }), [groups, grouped, isCollapsed, getRowId]);
|
|
29
|
+
const checkDrag = useCheckDragSelect({
|
|
30
|
+
enabled: selectable,
|
|
31
|
+
rootRef,
|
|
32
|
+
rowIds: visibleRowIds,
|
|
33
|
+
rowIdOf: gridRowIdFromKey,
|
|
34
|
+
isSelected: selectionState.isSelected,
|
|
35
|
+
setRowSelected: selectionState.toggle,
|
|
36
|
+
});
|
|
37
|
+
const groupSelection = (items) => {
|
|
38
|
+
const ids = items.map(getRowId);
|
|
39
|
+
const selectedCount = ids.filter((id) => selectionState.isSelected(id)).length;
|
|
40
|
+
return {
|
|
41
|
+
allSelected: selectedCount > 0 && selectedCount === ids.length,
|
|
42
|
+
someSelected: selectedCount > 0 && selectedCount < ids.length,
|
|
43
|
+
onToggle: () => selectionState.toggleMany(ids),
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
selectable,
|
|
48
|
+
selecting,
|
|
49
|
+
selectionState,
|
|
50
|
+
derivedOrderedIds,
|
|
51
|
+
visibleRowIds,
|
|
52
|
+
checkDrag,
|
|
53
|
+
groupSelection,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
export declare function useHeaderDragReorder({ enabled, ids, scrollXRef, getScroller, canDrag, onReorder, }: {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
/** Visible column ids, in current order. */
|
|
5
|
+
ids: string[];
|
|
6
|
+
/** The scroll sync's current scrollLeft (GridTable's scrollXRef). */
|
|
7
|
+
scrollXRef: React.MutableRefObject<number>;
|
|
8
|
+
/** Any one synced scroller — autoscroll target (the sync fans it out). */
|
|
9
|
+
getScroller: () => HTMLElement | undefined;
|
|
10
|
+
/** Optional ownership gate for columns that remain fixed in declaration order. */
|
|
11
|
+
canDrag?: (id: string) => boolean;
|
|
12
|
+
/** Commit: the moved id + the full visible order after the move. */
|
|
13
|
+
onReorder: (movedId: string, nextVisibleIds: string[]) => void;
|
|
14
|
+
}): {
|
|
15
|
+
cellStyle: (id: string, index: number) => React.CSSProperties | undefined;
|
|
16
|
+
onCellPointerDown: (id: string, index: number) => (e: React.PointerEvent<HTMLElement>) => void;
|
|
17
|
+
onCellPointerMove: (e: React.PointerEvent<HTMLElement>) => void;
|
|
18
|
+
onCellPointerUp: (e: React.PointerEvent<HTMLElement>) => void;
|
|
19
|
+
onCellPointerCancel: () => void;
|
|
20
|
+
onCellClickCapture: (e: React.MouseEvent<HTMLElement>) => void;
|
|
21
|
+
};
|