react-glide-table 1.1.8 → 1.1.9

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/compound.cjs CHANGED
@@ -789,6 +789,19 @@ function cn(...inputs) {
789
789
 
790
790
  // src/components/ui/table/components/DataTable/DataTableRow.tsx
791
791
  var import_jsx_runtime3 = require("react/jsx-runtime");
792
+ function isInteractiveMouseTarget(target) {
793
+ if (!(target instanceof Element)) return false;
794
+ const interactiveSelector = [
795
+ "input",
796
+ "textarea",
797
+ "select",
798
+ "button",
799
+ "a[href]",
800
+ "[contenteditable]:not([contenteditable='false'])",
801
+ "[data-table-disable-cell-selection]"
802
+ ].join(",");
803
+ return target.closest(interactiveSelector) !== null;
804
+ }
792
805
  function resolveExpandCellIndex(cells, toggleField) {
793
806
  if (!toggleField) return 0;
794
807
  const matchedIndex = cells.findIndex(
@@ -855,6 +868,33 @@ function DataTableRow({
855
868
  const isGroupHovered = enableRowSpan && hoveredRowIndex !== null && hoveredRowIndex >= primaryGroupStart && hoveredRowIndex <= primaryGroupStart + primaryGroupSpan - 1;
856
869
  const visibleCells = row.getVisibleCells();
857
870
  const columnIdsByIndex = visibleCells.map((cell) => cell.column.id);
871
+ row.getIsCellDragSelected = (columnId) => {
872
+ if (!activeSelectionBounds) return false;
873
+ if (columnId) {
874
+ const colIndex = columnIdsByIndex.indexOf(columnId);
875
+ if (colIndex < 0) return false;
876
+ const { startRow, rowSpan: rowSpan2 } = resolveRowSpanAt(
877
+ columnRowSpanMap.get(columnIdsByIndex[colIndex]),
878
+ rowIndex
879
+ );
880
+ return isCellInSelection(
881
+ startRow,
882
+ colIndex,
883
+ activeSelectionBounds,
884
+ rowSpan2
885
+ );
886
+ }
887
+ for (let colIndex = 0; colIndex < columnIdsByIndex.length; colIndex += 1) {
888
+ const { startRow, rowSpan: rowSpan2 } = resolveRowSpanAt(
889
+ columnRowSpanMap.get(columnIdsByIndex[colIndex]),
890
+ rowIndex
891
+ );
892
+ if (isCellInSelection(startRow, colIndex, activeSelectionBounds, rowSpan2)) {
893
+ return true;
894
+ }
895
+ }
896
+ return false;
897
+ };
858
898
  const isVisuallySelectedAt = activeSelectionBounds ? (targetRow, targetCol) => {
859
899
  if (targetCol < activeSelectionBounds.startCol || targetCol > activeSelectionBounds.endCol) {
860
900
  return false;
@@ -982,6 +1022,7 @@ function DataTableRow({
982
1022
  return;
983
1023
  }
984
1024
  if (!enableCellSelection) return;
1025
+ if (isInteractiveMouseTarget(event.target)) return;
985
1026
  event.preventDefault();
986
1027
  onCellMouseDown(
987
1028
  resolveCellRowIndex(event.clientY, event.currentTarget),
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, ReactElement } from 'react';
3
- import { d as DataTableProps, T as TableColumnProps, g as TableProps } from './types-Ce4qepIU.cjs';
4
- export { a as DataTableClassNames, c as DataTableLabels, e as DataTableSlots, P as PasteMode, R as RowSelectionMode, f as RowsPastePayload } from './types-Ce4qepIU.cjs';
3
+ import { d as DataTableProps, T as TableColumnProps, g as TableProps } from './types-xxzMLUwM.cjs';
4
+ export { a as DataTableClassNames, c as DataTableLabels, e as DataTableSlots, P as PasteMode, R as RowSelectionMode, f as RowsPastePayload } from './types-xxzMLUwM.cjs';
5
5
  export { ColumnDef, RowSelectionState } from '@tanstack/react-table';
6
6
 
7
7
  /**
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, ReactElement } from 'react';
3
- import { d as DataTableProps, T as TableColumnProps, g as TableProps } from './types-Ce4qepIU.js';
4
- export { a as DataTableClassNames, c as DataTableLabels, e as DataTableSlots, P as PasteMode, R as RowSelectionMode, f as RowsPastePayload } from './types-Ce4qepIU.js';
3
+ import { d as DataTableProps, T as TableColumnProps, g as TableProps } from './types-xxzMLUwM.js';
4
+ export { a as DataTableClassNames, c as DataTableLabels, e as DataTableSlots, P as PasteMode, R as RowSelectionMode, f as RowsPastePayload } from './types-xxzMLUwM.js';
5
5
  export { ColumnDef, RowSelectionState } from '@tanstack/react-table';
6
6
 
7
7
  /**
package/dist/compound.js CHANGED
@@ -761,6 +761,19 @@ function cn(...inputs) {
761
761
 
762
762
  // src/components/ui/table/components/DataTable/DataTableRow.tsx
763
763
  import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
764
+ function isInteractiveMouseTarget(target) {
765
+ if (!(target instanceof Element)) return false;
766
+ const interactiveSelector = [
767
+ "input",
768
+ "textarea",
769
+ "select",
770
+ "button",
771
+ "a[href]",
772
+ "[contenteditable]:not([contenteditable='false'])",
773
+ "[data-table-disable-cell-selection]"
774
+ ].join(",");
775
+ return target.closest(interactiveSelector) !== null;
776
+ }
764
777
  function resolveExpandCellIndex(cells, toggleField) {
765
778
  if (!toggleField) return 0;
766
779
  const matchedIndex = cells.findIndex(
@@ -827,6 +840,33 @@ function DataTableRow({
827
840
  const isGroupHovered = enableRowSpan && hoveredRowIndex !== null && hoveredRowIndex >= primaryGroupStart && hoveredRowIndex <= primaryGroupStart + primaryGroupSpan - 1;
828
841
  const visibleCells = row.getVisibleCells();
829
842
  const columnIdsByIndex = visibleCells.map((cell) => cell.column.id);
843
+ row.getIsCellDragSelected = (columnId) => {
844
+ if (!activeSelectionBounds) return false;
845
+ if (columnId) {
846
+ const colIndex = columnIdsByIndex.indexOf(columnId);
847
+ if (colIndex < 0) return false;
848
+ const { startRow, rowSpan: rowSpan2 } = resolveRowSpanAt(
849
+ columnRowSpanMap.get(columnIdsByIndex[colIndex]),
850
+ rowIndex
851
+ );
852
+ return isCellInSelection(
853
+ startRow,
854
+ colIndex,
855
+ activeSelectionBounds,
856
+ rowSpan2
857
+ );
858
+ }
859
+ for (let colIndex = 0; colIndex < columnIdsByIndex.length; colIndex += 1) {
860
+ const { startRow, rowSpan: rowSpan2 } = resolveRowSpanAt(
861
+ columnRowSpanMap.get(columnIdsByIndex[colIndex]),
862
+ rowIndex
863
+ );
864
+ if (isCellInSelection(startRow, colIndex, activeSelectionBounds, rowSpan2)) {
865
+ return true;
866
+ }
867
+ }
868
+ return false;
869
+ };
830
870
  const isVisuallySelectedAt = activeSelectionBounds ? (targetRow, targetCol) => {
831
871
  if (targetCol < activeSelectionBounds.startCol || targetCol > activeSelectionBounds.endCol) {
832
872
  return false;
@@ -954,6 +994,7 @@ function DataTableRow({
954
994
  return;
955
995
  }
956
996
  if (!enableCellSelection) return;
997
+ if (isInteractiveMouseTarget(event.target)) return;
957
998
  event.preventDefault();
958
999
  onCellMouseDown(
959
1000
  resolveCellRowIndex(event.clientY, event.currentTarget),
package/dist/core.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CellEditType, a as DataTableClassNames, R as RowSelectionMode, d as DataTableProps, c as DataTableLabels, b as DataTableCopyActions, P as PasteMode, f as RowsPastePayload } from './types-Ce4qepIU.cjs';
2
- export { D as DEFAULT_DATA_TABLE_LABELS, r as resolveDataTableLabels } from './types-Ce4qepIU.cjs';
1
+ import { C as CellEditType, a as DataTableClassNames, R as RowSelectionMode, d as DataTableProps, c as DataTableLabels, b as DataTableCopyActions, P as PasteMode, f as RowsPastePayload } from './types-xxzMLUwM.cjs';
2
+ export { D as DEFAULT_DATA_TABLE_LABELS, r as resolveDataTableLabels } from './types-xxzMLUwM.cjs';
3
3
  import { Row, ColumnDef, Table, Updater, RowSelectionState } from '@tanstack/react-table';
4
4
  export { ColumnDef, RowSelectionState } from '@tanstack/react-table';
5
5
  import { Virtualizer, VirtualItem } from '@tanstack/react-virtual';
package/dist/core.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CellEditType, a as DataTableClassNames, R as RowSelectionMode, d as DataTableProps, c as DataTableLabels, b as DataTableCopyActions, P as PasteMode, f as RowsPastePayload } from './types-Ce4qepIU.js';
2
- export { D as DEFAULT_DATA_TABLE_LABELS, r as resolveDataTableLabels } from './types-Ce4qepIU.js';
1
+ import { C as CellEditType, a as DataTableClassNames, R as RowSelectionMode, d as DataTableProps, c as DataTableLabels, b as DataTableCopyActions, P as PasteMode, f as RowsPastePayload } from './types-xxzMLUwM.js';
2
+ export { D as DEFAULT_DATA_TABLE_LABELS, r as resolveDataTableLabels } from './types-xxzMLUwM.js';
3
3
  import { Row, ColumnDef, Table, Updater, RowSelectionState } from '@tanstack/react-table';
4
4
  export { ColumnDef, RowSelectionState } from '@tanstack/react-table';
5
5
  import { Virtualizer, VirtualItem } from '@tanstack/react-virtual';
package/dist/index.cjs CHANGED
@@ -1740,6 +1740,19 @@ function cn(...inputs) {
1740
1740
 
1741
1741
  // src/components/ui/table/components/DataTable/DataTableRow.tsx
1742
1742
  var import_jsx_runtime3 = require("react/jsx-runtime");
1743
+ function isInteractiveMouseTarget(target) {
1744
+ if (!(target instanceof Element)) return false;
1745
+ const interactiveSelector = [
1746
+ "input",
1747
+ "textarea",
1748
+ "select",
1749
+ "button",
1750
+ "a[href]",
1751
+ "[contenteditable]:not([contenteditable='false'])",
1752
+ "[data-table-disable-cell-selection]"
1753
+ ].join(",");
1754
+ return target.closest(interactiveSelector) !== null;
1755
+ }
1743
1756
  function resolveExpandCellIndex(cells, toggleField) {
1744
1757
  if (!toggleField) return 0;
1745
1758
  const matchedIndex = cells.findIndex(
@@ -1806,6 +1819,33 @@ function DataTableRow({
1806
1819
  const isGroupHovered = enableRowSpan && hoveredRowIndex !== null && hoveredRowIndex >= primaryGroupStart && hoveredRowIndex <= primaryGroupStart + primaryGroupSpan - 1;
1807
1820
  const visibleCells = row.getVisibleCells();
1808
1821
  const columnIdsByIndex = visibleCells.map((cell) => cell.column.id);
1822
+ row.getIsCellDragSelected = (columnId) => {
1823
+ if (!activeSelectionBounds) return false;
1824
+ if (columnId) {
1825
+ const colIndex = columnIdsByIndex.indexOf(columnId);
1826
+ if (colIndex < 0) return false;
1827
+ const { startRow, rowSpan: rowSpan2 } = resolveRowSpanAt(
1828
+ columnRowSpanMap.get(columnIdsByIndex[colIndex]),
1829
+ rowIndex
1830
+ );
1831
+ return isCellInSelection(
1832
+ startRow,
1833
+ colIndex,
1834
+ activeSelectionBounds,
1835
+ rowSpan2
1836
+ );
1837
+ }
1838
+ for (let colIndex = 0; colIndex < columnIdsByIndex.length; colIndex += 1) {
1839
+ const { startRow, rowSpan: rowSpan2 } = resolveRowSpanAt(
1840
+ columnRowSpanMap.get(columnIdsByIndex[colIndex]),
1841
+ rowIndex
1842
+ );
1843
+ if (isCellInSelection(startRow, colIndex, activeSelectionBounds, rowSpan2)) {
1844
+ return true;
1845
+ }
1846
+ }
1847
+ return false;
1848
+ };
1809
1849
  const isVisuallySelectedAt = activeSelectionBounds ? (targetRow, targetCol) => {
1810
1850
  if (targetCol < activeSelectionBounds.startCol || targetCol > activeSelectionBounds.endCol) {
1811
1851
  return false;
@@ -1933,6 +1973,7 @@ function DataTableRow({
1933
1973
  return;
1934
1974
  }
1935
1975
  if (!enableCellSelection) return;
1976
+ if (isInteractiveMouseTarget(event.target)) return;
1936
1977
  event.preventDefault();
1937
1978
  onCellMouseDown(
1938
1979
  resolveCellRowIndex(event.clientY, event.currentTarget),
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { D as DEFAULT_DATA_TABLE_LABELS, a as DataTableClassNames, b as DataTableCopyActions, c as DataTableLabels, d as DataTableProps, e as DataTableSlots, P as PasteMode, R as RowSelectionMode, f as RowsPastePayload, T as TableColumnProps, g as TableProps, r as resolveDataTableLabels } from './types-Ce4qepIU.cjs';
1
+ export { D as DEFAULT_DATA_TABLE_LABELS, a as DataTableClassNames, b as DataTableCopyActions, c as DataTableLabels, d as DataTableProps, e as DataTableSlots, P as PasteMode, R as RowSelectionMode, f as RowsPastePayload, T as TableColumnProps, g as TableProps, r as resolveDataTableLabels } from './types-xxzMLUwM.cjs';
2
2
  export { CELL_SELECTION_EDGES_CLASS, CellSelectionBounds, ColumnRowSpanMap, CopyRowEntry, CopySelectionMode, DEFAULT_TREE_CHILDREN_FIELD, DEFAULT_TREE_ID_FIELD, DEFAULT_TREE_PARENT_ID_FIELD, DEFAULT_TREE_QTY_FIELD, DragState, EditingCell, RowSpanInfo, TreeRow, UseConvertTreeDataParams, UseGlideTableOptions, UseGlideTableResult, applyCellEdit, applyFillData, applySelectionUpdater, buildColumnRowSpanMap, buildRowsPastePayload, canExpandRow, collectCopyRowEntries, collectCopyRows, collectFillChanges, collectRowSpanColumns, flattenSubtreeRows, getCellEditDraftValue, getCellSelectionEdgeStyle, getColumnEditType, getRowIndexInMergedCell, hasCellSelectionEdges, isCellInSelection, isColumnEditable, isEditablePasteTarget, measureMergedSpanRowHeights, parseCellEditValue, parseClipboardTSV, parseClipboardTSVWithDepths, resolvePasteColumnIds, resolveRowSelection, resolveRowSpanAt, rowRangeToHeightRatios, serializeCopyRowsToTSV, serializeSelectionToTSV, toggleExpandedRowId, useCellEdit, useCellSelection, useConvertTreeData, useGlideTable, writeSelectionToClipboard } from './core.cjs';
3
3
  export { DataTable, Table, TableCompoundComponent, createTable } from './compound.cjs';
4
4
  export { ColumnDef, RowSelectionState } from '@tanstack/react-table';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { D as DEFAULT_DATA_TABLE_LABELS, a as DataTableClassNames, b as DataTableCopyActions, c as DataTableLabels, d as DataTableProps, e as DataTableSlots, P as PasteMode, R as RowSelectionMode, f as RowsPastePayload, T as TableColumnProps, g as TableProps, r as resolveDataTableLabels } from './types-Ce4qepIU.js';
1
+ export { D as DEFAULT_DATA_TABLE_LABELS, a as DataTableClassNames, b as DataTableCopyActions, c as DataTableLabels, d as DataTableProps, e as DataTableSlots, P as PasteMode, R as RowSelectionMode, f as RowsPastePayload, T as TableColumnProps, g as TableProps, r as resolveDataTableLabels } from './types-xxzMLUwM.js';
2
2
  export { CELL_SELECTION_EDGES_CLASS, CellSelectionBounds, ColumnRowSpanMap, CopyRowEntry, CopySelectionMode, DEFAULT_TREE_CHILDREN_FIELD, DEFAULT_TREE_ID_FIELD, DEFAULT_TREE_PARENT_ID_FIELD, DEFAULT_TREE_QTY_FIELD, DragState, EditingCell, RowSpanInfo, TreeRow, UseConvertTreeDataParams, UseGlideTableOptions, UseGlideTableResult, applyCellEdit, applyFillData, applySelectionUpdater, buildColumnRowSpanMap, buildRowsPastePayload, canExpandRow, collectCopyRowEntries, collectCopyRows, collectFillChanges, collectRowSpanColumns, flattenSubtreeRows, getCellEditDraftValue, getCellSelectionEdgeStyle, getColumnEditType, getRowIndexInMergedCell, hasCellSelectionEdges, isCellInSelection, isColumnEditable, isEditablePasteTarget, measureMergedSpanRowHeights, parseCellEditValue, parseClipboardTSV, parseClipboardTSVWithDepths, resolvePasteColumnIds, resolveRowSelection, resolveRowSpanAt, rowRangeToHeightRatios, serializeCopyRowsToTSV, serializeSelectionToTSV, toggleExpandedRowId, useCellEdit, useCellSelection, useConvertTreeData, useGlideTable, writeSelectionToClipboard } from './core.js';
3
3
  export { DataTable, Table, TableCompoundComponent, createTable } from './compound.js';
4
4
  export { ColumnDef, RowSelectionState } from '@tanstack/react-table';
package/dist/index.js CHANGED
@@ -1681,6 +1681,19 @@ function cn(...inputs) {
1681
1681
 
1682
1682
  // src/components/ui/table/components/DataTable/DataTableRow.tsx
1683
1683
  import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
1684
+ function isInteractiveMouseTarget(target) {
1685
+ if (!(target instanceof Element)) return false;
1686
+ const interactiveSelector = [
1687
+ "input",
1688
+ "textarea",
1689
+ "select",
1690
+ "button",
1691
+ "a[href]",
1692
+ "[contenteditable]:not([contenteditable='false'])",
1693
+ "[data-table-disable-cell-selection]"
1694
+ ].join(",");
1695
+ return target.closest(interactiveSelector) !== null;
1696
+ }
1684
1697
  function resolveExpandCellIndex(cells, toggleField) {
1685
1698
  if (!toggleField) return 0;
1686
1699
  const matchedIndex = cells.findIndex(
@@ -1747,6 +1760,33 @@ function DataTableRow({
1747
1760
  const isGroupHovered = enableRowSpan && hoveredRowIndex !== null && hoveredRowIndex >= primaryGroupStart && hoveredRowIndex <= primaryGroupStart + primaryGroupSpan - 1;
1748
1761
  const visibleCells = row.getVisibleCells();
1749
1762
  const columnIdsByIndex = visibleCells.map((cell) => cell.column.id);
1763
+ row.getIsCellDragSelected = (columnId) => {
1764
+ if (!activeSelectionBounds) return false;
1765
+ if (columnId) {
1766
+ const colIndex = columnIdsByIndex.indexOf(columnId);
1767
+ if (colIndex < 0) return false;
1768
+ const { startRow, rowSpan: rowSpan2 } = resolveRowSpanAt(
1769
+ columnRowSpanMap.get(columnIdsByIndex[colIndex]),
1770
+ rowIndex
1771
+ );
1772
+ return isCellInSelection(
1773
+ startRow,
1774
+ colIndex,
1775
+ activeSelectionBounds,
1776
+ rowSpan2
1777
+ );
1778
+ }
1779
+ for (let colIndex = 0; colIndex < columnIdsByIndex.length; colIndex += 1) {
1780
+ const { startRow, rowSpan: rowSpan2 } = resolveRowSpanAt(
1781
+ columnRowSpanMap.get(columnIdsByIndex[colIndex]),
1782
+ rowIndex
1783
+ );
1784
+ if (isCellInSelection(startRow, colIndex, activeSelectionBounds, rowSpan2)) {
1785
+ return true;
1786
+ }
1787
+ }
1788
+ return false;
1789
+ };
1750
1790
  const isVisuallySelectedAt = activeSelectionBounds ? (targetRow, targetCol) => {
1751
1791
  if (targetCol < activeSelectionBounds.startCol || targetCol > activeSelectionBounds.endCol) {
1752
1792
  return false;
@@ -1874,6 +1914,7 @@ function DataTableRow({
1874
1914
  return;
1875
1915
  }
1876
1916
  if (!enableCellSelection) return;
1917
+ if (isInteractiveMouseTarget(event.target)) return;
1877
1918
  event.preventDefault();
1878
1919
  onCellMouseDown(
1879
1920
  resolveCellRowIndex(event.clientY, event.currentTarget),
@@ -32,6 +32,15 @@ declare module "@tanstack/react-table" {
32
32
  /** Inline editor input attribute overrides */
33
33
  editInputProps?: DataTableEditInputProps;
34
34
  }
35
+ interface Row<TData> {
36
+ /**
37
+ * Returns whether this row's cell is inside the active drag selection.
38
+ * Attached at render time by DataTableRow (optional outside that renderer).
39
+ * - `columnId` omitted: true when any visible cell in the row is selected.
40
+ * - `columnId` provided: checks only that column (row-span aware via merge origin).
41
+ */
42
+ getIsCellDragSelected?: (columnId?: string) => boolean;
43
+ }
35
44
  }
36
45
  type DataTableCopyActions = {
37
46
  /** Copies the active cell selection. Defaults to visible rows only. */
@@ -32,6 +32,15 @@ declare module "@tanstack/react-table" {
32
32
  /** Inline editor input attribute overrides */
33
33
  editInputProps?: DataTableEditInputProps;
34
34
  }
35
+ interface Row<TData> {
36
+ /**
37
+ * Returns whether this row's cell is inside the active drag selection.
38
+ * Attached at render time by DataTableRow (optional outside that renderer).
39
+ * - `columnId` omitted: true when any visible cell in the row is selected.
40
+ * - `columnId` provided: checks only that column (row-span aware via merge origin).
41
+ */
42
+ getIsCellDragSelected?: (columnId?: string) => boolean;
43
+ }
35
44
  }
36
45
  type DataTableCopyActions = {
37
46
  /** Copies the active cell selection. Defaults to visible rows only. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-glide-table",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/zpxlffjrm/react-glide-table.git"