react-glide-table 2.0.2 → 2.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.
@@ -1,4 +1,4 @@
1
- import { Row, ColumnDef, RowSelectionState, Updater, ColumnSizingState, OnChangeFn, ColumnResizeMode } from '@tanstack/react-table';
1
+ import { Row, ColumnDef, RowSelectionState, Updater, ColumnSizingState, OnChangeFn, ColumnResizeMode, ColumnOrderState } from '@tanstack/react-table';
2
2
  import { ReactNode, CSSProperties, InputHTMLAttributes, ComponentType, Ref } from 'react';
3
3
 
4
4
  /**
@@ -161,6 +161,8 @@ type DataTableLabels = {
161
161
  collapseRow: string;
162
162
  /** Accessible label for the column resize handle */
163
163
  resizeColumn: string;
164
+ /** Accessible label for a draggable column header */
165
+ reorderColumn: string;
164
166
  /** Built-in find-in-page search overlay */
165
167
  searchPlaceholder: string;
166
168
  searchResultHint: string;
@@ -178,10 +180,17 @@ type DataTableEditInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, "type
178
180
 
179
181
  declare module "@tanstack/react-table" {
180
182
  interface ColumnMeta<TData, TValue> {
181
- /** Whether this column participates in vertical row spanning */
183
+ /**
184
+ * Whether this column participates in vertical row spanning.
185
+ */
182
186
  rowSpan?: boolean;
183
187
  /** Merge key field. Falls back to the column id when omitted */
184
188
  rowSpanKey?: string;
189
+ /**
190
+ * Parent column id, rowSpanKey, or row field(s) that bound this merge.
191
+ * The column only groups consecutive rows that stay inside those parent groups.
192
+ */
193
+ rowSpanParent?: string | readonly string[];
185
194
  align?: "left" | "center" | "right";
186
195
  className?: string;
187
196
  headerClassName?: string;
@@ -206,6 +215,11 @@ declare module "@tanstack/react-table" {
206
215
  * Middle columns are allowed; multiple frozen columns stack via cumulative offsets.
207
216
  */
208
217
  frozen?: ColumnFreezeMeta;
218
+ /**
219
+ * When false, this column cannot be dragged even if `enableColumnReorder` is on.
220
+ * Defaults to true.
221
+ */
222
+ reorderable?: boolean;
209
223
  }
210
224
  interface CellContext<TData, TValue> {
211
225
  /**
@@ -383,6 +397,15 @@ type DataTableProps<T extends Record<string, unknown>> = {
383
397
  * Use `"onEnd"` to update only after the pointer is released.
384
398
  */
385
399
  columnResizeMode?: ColumnResizeMode;
400
+ /**
401
+ * Enable drag-to-reorder on column headers. Defaults to false.
402
+ * Opt out per column with `Column.reorderable={false}` / `meta.reorderable: false`.
403
+ * Leaf columns can move across groups; consecutive same-group leaves stay wrapped.
404
+ */
405
+ enableColumnReorder?: boolean;
406
+ /** Controlled leaf column id order */
407
+ columnOrder?: ColumnOrderState;
408
+ onColumnOrderChange?: OnChangeFn<ColumnOrderState>;
386
409
  /**
387
410
  * Enable sticky freeze columns. Defaults to false.
388
411
  * Mark columns with `Column.frozen` / `meta.frozen` (`true` | `"left"` | `"right"`).
@@ -435,6 +458,8 @@ type DataTableClassNames = {
435
458
  headCell?: string;
436
459
  /** Column resize drag handle inside a header cell */
437
460
  resizeHandle?: string;
461
+ /** Drop-edge indicator while reordering columns */
462
+ dropEdge?: string;
438
463
  body?: string;
439
464
  emptyCell?: string;
440
465
  virtualSpacer?: string;
@@ -529,6 +554,11 @@ type TableColumnProps<T extends Record<string, unknown>, K extends string = keyo
529
554
  * Defaults to true.
530
555
  */
531
556
  resizable?: boolean;
557
+ /**
558
+ * When false, this column cannot be dragged even if `enableColumnReorder` is on.
559
+ * Defaults to true. Still accepts drops next to it.
560
+ */
561
+ reorderable?: boolean;
532
562
  /**
533
563
  * Freeze (sticky) without changing column order.
534
564
  * `true` / `"left"` → left edge; `"right"` → right edge.
@@ -536,8 +566,14 @@ type TableColumnProps<T extends Record<string, unknown>, K extends string = keyo
536
566
  */
537
567
  frozen?: ColumnFreezeMeta;
538
568
  align?: "left" | "center" | "right";
569
+ /** Vertical cell merge for consecutive identical `rowSpanKey` values. */
539
570
  rowSpan?: boolean;
540
571
  rowSpanKey?: string;
572
+ /**
573
+ * Parent field(s) this merge is nested under — a column `field`, `rowSpanKey`,
574
+ * or row data key. Omit to merge independently of other rowSpan columns.
575
+ */
576
+ rowSpanParent?: string | readonly string[];
541
577
  editable?: boolean;
542
578
  editType?: CellEditType;
543
579
  /** Inline editor input attribute overrides */
@@ -1,4 +1,4 @@
1
- import { Row, ColumnDef, RowSelectionState, Updater, ColumnSizingState, OnChangeFn, ColumnResizeMode } from '@tanstack/react-table';
1
+ import { Row, ColumnDef, RowSelectionState, Updater, ColumnSizingState, OnChangeFn, ColumnResizeMode, ColumnOrderState } from '@tanstack/react-table';
2
2
  import { ReactNode, CSSProperties, InputHTMLAttributes, ComponentType, Ref } from 'react';
3
3
 
4
4
  /**
@@ -161,6 +161,8 @@ type DataTableLabels = {
161
161
  collapseRow: string;
162
162
  /** Accessible label for the column resize handle */
163
163
  resizeColumn: string;
164
+ /** Accessible label for a draggable column header */
165
+ reorderColumn: string;
164
166
  /** Built-in find-in-page search overlay */
165
167
  searchPlaceholder: string;
166
168
  searchResultHint: string;
@@ -178,10 +180,17 @@ type DataTableEditInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, "type
178
180
 
179
181
  declare module "@tanstack/react-table" {
180
182
  interface ColumnMeta<TData, TValue> {
181
- /** Whether this column participates in vertical row spanning */
183
+ /**
184
+ * Whether this column participates in vertical row spanning.
185
+ */
182
186
  rowSpan?: boolean;
183
187
  /** Merge key field. Falls back to the column id when omitted */
184
188
  rowSpanKey?: string;
189
+ /**
190
+ * Parent column id, rowSpanKey, or row field(s) that bound this merge.
191
+ * The column only groups consecutive rows that stay inside those parent groups.
192
+ */
193
+ rowSpanParent?: string | readonly string[];
185
194
  align?: "left" | "center" | "right";
186
195
  className?: string;
187
196
  headerClassName?: string;
@@ -206,6 +215,11 @@ declare module "@tanstack/react-table" {
206
215
  * Middle columns are allowed; multiple frozen columns stack via cumulative offsets.
207
216
  */
208
217
  frozen?: ColumnFreezeMeta;
218
+ /**
219
+ * When false, this column cannot be dragged even if `enableColumnReorder` is on.
220
+ * Defaults to true.
221
+ */
222
+ reorderable?: boolean;
209
223
  }
210
224
  interface CellContext<TData, TValue> {
211
225
  /**
@@ -383,6 +397,15 @@ type DataTableProps<T extends Record<string, unknown>> = {
383
397
  * Use `"onEnd"` to update only after the pointer is released.
384
398
  */
385
399
  columnResizeMode?: ColumnResizeMode;
400
+ /**
401
+ * Enable drag-to-reorder on column headers. Defaults to false.
402
+ * Opt out per column with `Column.reorderable={false}` / `meta.reorderable: false`.
403
+ * Leaf columns can move across groups; consecutive same-group leaves stay wrapped.
404
+ */
405
+ enableColumnReorder?: boolean;
406
+ /** Controlled leaf column id order */
407
+ columnOrder?: ColumnOrderState;
408
+ onColumnOrderChange?: OnChangeFn<ColumnOrderState>;
386
409
  /**
387
410
  * Enable sticky freeze columns. Defaults to false.
388
411
  * Mark columns with `Column.frozen` / `meta.frozen` (`true` | `"left"` | `"right"`).
@@ -435,6 +458,8 @@ type DataTableClassNames = {
435
458
  headCell?: string;
436
459
  /** Column resize drag handle inside a header cell */
437
460
  resizeHandle?: string;
461
+ /** Drop-edge indicator while reordering columns */
462
+ dropEdge?: string;
438
463
  body?: string;
439
464
  emptyCell?: string;
440
465
  virtualSpacer?: string;
@@ -529,6 +554,11 @@ type TableColumnProps<T extends Record<string, unknown>, K extends string = keyo
529
554
  * Defaults to true.
530
555
  */
531
556
  resizable?: boolean;
557
+ /**
558
+ * When false, this column cannot be dragged even if `enableColumnReorder` is on.
559
+ * Defaults to true. Still accepts drops next to it.
560
+ */
561
+ reorderable?: boolean;
532
562
  /**
533
563
  * Freeze (sticky) without changing column order.
534
564
  * `true` / `"left"` → left edge; `"right"` → right edge.
@@ -536,8 +566,14 @@ type TableColumnProps<T extends Record<string, unknown>, K extends string = keyo
536
566
  */
537
567
  frozen?: ColumnFreezeMeta;
538
568
  align?: "left" | "center" | "right";
569
+ /** Vertical cell merge for consecutive identical `rowSpanKey` values. */
539
570
  rowSpan?: boolean;
540
571
  rowSpanKey?: string;
572
+ /**
573
+ * Parent field(s) this merge is nested under — a column `field`, `rowSpanKey`,
574
+ * or row data key. Omit to merge independently of other rowSpan columns.
575
+ */
576
+ rowSpanParent?: string | readonly string[];
541
577
  editable?: boolean;
542
578
  editType?: CellEditType;
543
579
  /** Inline editor input attribute overrides */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-glide-table",
3
- "version": "2.0.2",
3
+ "version": "2.2.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/zpxlffjrm/react-glide-table.git"