@lensui/lens-table 0.1.80 → 0.1.82

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/dist/index.cjs CHANGED
@@ -4876,6 +4876,23 @@ function TableInner({
4876
4876
  setSelection(cell);
4877
4877
  return true;
4878
4878
  },
4879
+ getSelectedRange: () => selectionRange ? { anchor: { ...selectionRange.anchor }, focus: { ...selectionRange.focus } } : null,
4880
+ setSelectedRange: (target) => {
4881
+ if (target === null) {
4882
+ rangeDragRef.current = null;
4883
+ setSelectionRange(null);
4884
+ return true;
4885
+ }
4886
+ if (!rangeSelection) return false;
4887
+ const anchor = resolveDataCell(target.anchor);
4888
+ const focus = resolveDataCell(target.focus);
4889
+ if (!anchor || !focus) return false;
4890
+ rangeDragRef.current = null;
4891
+ setEditing(null);
4892
+ setSelection(null);
4893
+ setSelectionRange({ anchor, focus });
4894
+ return true;
4895
+ },
4879
4896
  getSelectedRowKeys: () => [...rowKeys],
4880
4897
  getSelectedRows: () => rows.filter((row, index) => selectedRowKeySet.has(getRowKey(row, index))),
4881
4898
  setSelectedRowKeys: (keys) => {
package/dist/index.d.cts CHANGED
@@ -260,6 +260,16 @@ type GridSelectionTarget = {
260
260
  rowKey?: GridKey;
261
261
  columnIndex?: number;
262
262
  };
263
+ /** Fully resolved rectangular cell selection. */
264
+ interface GridSelectionRange {
265
+ anchor: GridSelection;
266
+ focus: GridSelection;
267
+ }
268
+ /** Stable locators accepted when restoring a rectangular cell selection. */
269
+ interface GridSelectionRangeTarget {
270
+ anchor: GridSelectionTarget;
271
+ focus: GridSelectionTarget;
272
+ }
263
273
  /** Fully resolved selected cell returned by onSelectedCellChange. */
264
274
  interface SelectedCellChange extends GridSelection {
265
275
  value: unknown;
@@ -283,6 +293,9 @@ interface TableRef<Row extends object> {
283
293
  scrollToCell: (target: GridSelectionTarget) => boolean;
284
294
  getSelectedCell: () => TableCellContext<Row> | null;
285
295
  setSelectedCell: (target: GridSelectionTarget | null) => boolean;
296
+ getSelectedRange: () => GridSelectionRange | null;
297
+ /** Restore or clear the native range outline; false if range selection is disabled or a target is unavailable. */
298
+ setSelectedRange: (target: GridSelectionRangeTarget | null) => boolean;
286
299
  getSelectedRowKeys: () => GridKey[];
287
300
  getSelectedRows: () => Row[];
288
301
  setSelectedRowKeys: (keys: GridKey[]) => void;
@@ -513,4 +526,4 @@ declare function hitTestColumn(metrics: ColumnMetric[], contentX: number): numbe
513
526
 
514
527
  type TableFilterValues = Record<string, string>;
515
528
 
516
- export { type AxisSelectionConfig, type CellChange, type ContextMenuEvent, type GridCellPosition, type GridColumn, type GridKey, type GridSelection, type GridSelectionTarget, type GridSortState, type RowSelectionConfig, type SelectedCellChange, type SelectionMode, type SortDirection, Table, type CellChange as TableCellChange, type TableCellContext, type GridCellPosition as TableCellPosition, type TableCellSpan, type TableCellSpanRule, type TableCellSpanRuleContext, type TableCellSpans, type GridColumn as TableColumn, type TableContextMenu, type TableContextMenuConfig, type ContextMenuEvent as TableContextMenuEvent, type GridSelection as TableEditingCell, type TableFilterValues, type TableHighlightConfig, type GridKey as TableKey, type TableLabels, type TableLayoutConfig, type TableLocaleCode, type TableLocaleConfig, type TableProps, type TableRef, type TableResolvedCellSpan, type TableRowNumberConfig, type GridSortState as TableSorter, type TableSummaryConfig, type TableTooltipConfig, type ViewportRange as TableViewportRange, type TableVirtualizedConfig, Table as VelocityGrid, type TableCellSpan as VelocityGridCellSpan, type TableCellSpanRule as VelocityGridCellSpanRule, type TableCellSpanRuleContext as VelocityGridCellSpanRuleContext, type TableCellSpans as VelocityGridCellSpans, type TableContextMenu as VelocityGridContextMenu, type TableContextMenuConfig as VelocityGridContextMenuConfig, type TableHighlightConfig as VelocityGridHighlightConfig, type TableLabels as VelocityGridLabels, type TableLayoutConfig as VelocityGridLayoutConfig, type TableLocaleCode as VelocityGridLocaleCode, type TableLocaleConfig as VelocityGridLocaleConfig, type TableProps as VelocityGridProps, type TableRef as VelocityGridRef, type TableResolvedCellSpan as VelocityGridResolvedCellSpan, type TableSummaryConfig as VelocityGridSummaryConfig, type TableTooltipConfig as VelocityGridTooltipConfig, type TableVirtualizedConfig as VelocityGridVirtualizedConfig, type ViewportRange, buildColumnMetrics, getViewportRange, hitTestColumn };
529
+ export { type AxisSelectionConfig, type CellChange, type ContextMenuEvent, type GridCellPosition, type GridColumn, type GridKey, type GridSelection, type GridSelectionRange, type GridSelectionRangeTarget, type GridSelectionTarget, type GridSortState, type RowSelectionConfig, type SelectedCellChange, type SelectionMode, type SortDirection, Table, type CellChange as TableCellChange, type TableCellContext, type GridCellPosition as TableCellPosition, type TableCellSpan, type TableCellSpanRule, type TableCellSpanRuleContext, type TableCellSpans, type GridColumn as TableColumn, type TableContextMenu, type TableContextMenuConfig, type ContextMenuEvent as TableContextMenuEvent, type GridSelection as TableEditingCell, type TableFilterValues, type TableHighlightConfig, type GridKey as TableKey, type TableLabels, type TableLayoutConfig, type TableLocaleCode, type TableLocaleConfig, type TableProps, type TableRef, type TableResolvedCellSpan, type TableRowNumberConfig, type GridSortState as TableSorter, type TableSummaryConfig, type TableTooltipConfig, type ViewportRange as TableViewportRange, type TableVirtualizedConfig, Table as VelocityGrid, type TableCellSpan as VelocityGridCellSpan, type TableCellSpanRule as VelocityGridCellSpanRule, type TableCellSpanRuleContext as VelocityGridCellSpanRuleContext, type TableCellSpans as VelocityGridCellSpans, type TableContextMenu as VelocityGridContextMenu, type TableContextMenuConfig as VelocityGridContextMenuConfig, type TableHighlightConfig as VelocityGridHighlightConfig, type TableLabels as VelocityGridLabels, type TableLayoutConfig as VelocityGridLayoutConfig, type TableLocaleCode as VelocityGridLocaleCode, type TableLocaleConfig as VelocityGridLocaleConfig, type TableProps as VelocityGridProps, type TableRef as VelocityGridRef, type TableResolvedCellSpan as VelocityGridResolvedCellSpan, type TableSummaryConfig as VelocityGridSummaryConfig, type TableTooltipConfig as VelocityGridTooltipConfig, type TableVirtualizedConfig as VelocityGridVirtualizedConfig, type ViewportRange, buildColumnMetrics, getViewportRange, hitTestColumn };
package/dist/index.d.ts CHANGED
@@ -260,6 +260,16 @@ type GridSelectionTarget = {
260
260
  rowKey?: GridKey;
261
261
  columnIndex?: number;
262
262
  };
263
+ /** Fully resolved rectangular cell selection. */
264
+ interface GridSelectionRange {
265
+ anchor: GridSelection;
266
+ focus: GridSelection;
267
+ }
268
+ /** Stable locators accepted when restoring a rectangular cell selection. */
269
+ interface GridSelectionRangeTarget {
270
+ anchor: GridSelectionTarget;
271
+ focus: GridSelectionTarget;
272
+ }
263
273
  /** Fully resolved selected cell returned by onSelectedCellChange. */
264
274
  interface SelectedCellChange extends GridSelection {
265
275
  value: unknown;
@@ -283,6 +293,9 @@ interface TableRef<Row extends object> {
283
293
  scrollToCell: (target: GridSelectionTarget) => boolean;
284
294
  getSelectedCell: () => TableCellContext<Row> | null;
285
295
  setSelectedCell: (target: GridSelectionTarget | null) => boolean;
296
+ getSelectedRange: () => GridSelectionRange | null;
297
+ /** Restore or clear the native range outline; false if range selection is disabled or a target is unavailable. */
298
+ setSelectedRange: (target: GridSelectionRangeTarget | null) => boolean;
286
299
  getSelectedRowKeys: () => GridKey[];
287
300
  getSelectedRows: () => Row[];
288
301
  setSelectedRowKeys: (keys: GridKey[]) => void;
@@ -513,4 +526,4 @@ declare function hitTestColumn(metrics: ColumnMetric[], contentX: number): numbe
513
526
 
514
527
  type TableFilterValues = Record<string, string>;
515
528
 
516
- export { type AxisSelectionConfig, type CellChange, type ContextMenuEvent, type GridCellPosition, type GridColumn, type GridKey, type GridSelection, type GridSelectionTarget, type GridSortState, type RowSelectionConfig, type SelectedCellChange, type SelectionMode, type SortDirection, Table, type CellChange as TableCellChange, type TableCellContext, type GridCellPosition as TableCellPosition, type TableCellSpan, type TableCellSpanRule, type TableCellSpanRuleContext, type TableCellSpans, type GridColumn as TableColumn, type TableContextMenu, type TableContextMenuConfig, type ContextMenuEvent as TableContextMenuEvent, type GridSelection as TableEditingCell, type TableFilterValues, type TableHighlightConfig, type GridKey as TableKey, type TableLabels, type TableLayoutConfig, type TableLocaleCode, type TableLocaleConfig, type TableProps, type TableRef, type TableResolvedCellSpan, type TableRowNumberConfig, type GridSortState as TableSorter, type TableSummaryConfig, type TableTooltipConfig, type ViewportRange as TableViewportRange, type TableVirtualizedConfig, Table as VelocityGrid, type TableCellSpan as VelocityGridCellSpan, type TableCellSpanRule as VelocityGridCellSpanRule, type TableCellSpanRuleContext as VelocityGridCellSpanRuleContext, type TableCellSpans as VelocityGridCellSpans, type TableContextMenu as VelocityGridContextMenu, type TableContextMenuConfig as VelocityGridContextMenuConfig, type TableHighlightConfig as VelocityGridHighlightConfig, type TableLabels as VelocityGridLabels, type TableLayoutConfig as VelocityGridLayoutConfig, type TableLocaleCode as VelocityGridLocaleCode, type TableLocaleConfig as VelocityGridLocaleConfig, type TableProps as VelocityGridProps, type TableRef as VelocityGridRef, type TableResolvedCellSpan as VelocityGridResolvedCellSpan, type TableSummaryConfig as VelocityGridSummaryConfig, type TableTooltipConfig as VelocityGridTooltipConfig, type TableVirtualizedConfig as VelocityGridVirtualizedConfig, type ViewportRange, buildColumnMetrics, getViewportRange, hitTestColumn };
529
+ export { type AxisSelectionConfig, type CellChange, type ContextMenuEvent, type GridCellPosition, type GridColumn, type GridKey, type GridSelection, type GridSelectionRange, type GridSelectionRangeTarget, type GridSelectionTarget, type GridSortState, type RowSelectionConfig, type SelectedCellChange, type SelectionMode, type SortDirection, Table, type CellChange as TableCellChange, type TableCellContext, type GridCellPosition as TableCellPosition, type TableCellSpan, type TableCellSpanRule, type TableCellSpanRuleContext, type TableCellSpans, type GridColumn as TableColumn, type TableContextMenu, type TableContextMenuConfig, type ContextMenuEvent as TableContextMenuEvent, type GridSelection as TableEditingCell, type TableFilterValues, type TableHighlightConfig, type GridKey as TableKey, type TableLabels, type TableLayoutConfig, type TableLocaleCode, type TableLocaleConfig, type TableProps, type TableRef, type TableResolvedCellSpan, type TableRowNumberConfig, type GridSortState as TableSorter, type TableSummaryConfig, type TableTooltipConfig, type ViewportRange as TableViewportRange, type TableVirtualizedConfig, Table as VelocityGrid, type TableCellSpan as VelocityGridCellSpan, type TableCellSpanRule as VelocityGridCellSpanRule, type TableCellSpanRuleContext as VelocityGridCellSpanRuleContext, type TableCellSpans as VelocityGridCellSpans, type TableContextMenu as VelocityGridContextMenu, type TableContextMenuConfig as VelocityGridContextMenuConfig, type TableHighlightConfig as VelocityGridHighlightConfig, type TableLabels as VelocityGridLabels, type TableLayoutConfig as VelocityGridLayoutConfig, type TableLocaleCode as VelocityGridLocaleCode, type TableLocaleConfig as VelocityGridLocaleConfig, type TableProps as VelocityGridProps, type TableRef as VelocityGridRef, type TableResolvedCellSpan as VelocityGridResolvedCellSpan, type TableSummaryConfig as VelocityGridSummaryConfig, type TableTooltipConfig as VelocityGridTooltipConfig, type TableVirtualizedConfig as VelocityGridVirtualizedConfig, type ViewportRange, buildColumnMetrics, getViewportRange, hitTestColumn };
package/dist/index.js CHANGED
@@ -4846,6 +4846,23 @@ function TableInner({
4846
4846
  setSelection(cell);
4847
4847
  return true;
4848
4848
  },
4849
+ getSelectedRange: () => selectionRange ? { anchor: { ...selectionRange.anchor }, focus: { ...selectionRange.focus } } : null,
4850
+ setSelectedRange: (target) => {
4851
+ if (target === null) {
4852
+ rangeDragRef.current = null;
4853
+ setSelectionRange(null);
4854
+ return true;
4855
+ }
4856
+ if (!rangeSelection) return false;
4857
+ const anchor = resolveDataCell(target.anchor);
4858
+ const focus = resolveDataCell(target.focus);
4859
+ if (!anchor || !focus) return false;
4860
+ rangeDragRef.current = null;
4861
+ setEditing(null);
4862
+ setSelection(null);
4863
+ setSelectionRange({ anchor, focus });
4864
+ return true;
4865
+ },
4849
4866
  getSelectedRowKeys: () => [...rowKeys],
4850
4867
  getSelectedRows: () => rows.filter((row, index) => selectedRowKeySet.has(getRowKey(row, index))),
4851
4868
  setSelectedRowKeys: (keys) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lensui/lens-table",
3
- "version": "0.1.80",
3
+ "version": "0.1.82",
4
4
  "description": "A lightweight, canvas-rendered React table component for LensUI.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",