react-glide-table 2.0.2 → 2.1.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;
@@ -206,6 +208,11 @@ declare module "@tanstack/react-table" {
206
208
  * Middle columns are allowed; multiple frozen columns stack via cumulative offsets.
207
209
  */
208
210
  frozen?: ColumnFreezeMeta;
211
+ /**
212
+ * When false, this column cannot be dragged even if `enableColumnReorder` is on.
213
+ * Defaults to true.
214
+ */
215
+ reorderable?: boolean;
209
216
  }
210
217
  interface CellContext<TData, TValue> {
211
218
  /**
@@ -383,6 +390,15 @@ type DataTableProps<T extends Record<string, unknown>> = {
383
390
  * Use `"onEnd"` to update only after the pointer is released.
384
391
  */
385
392
  columnResizeMode?: ColumnResizeMode;
393
+ /**
394
+ * Enable drag-to-reorder on column headers. Defaults to false.
395
+ * Opt out per column with `Column.reorderable={false}` / `meta.reorderable: false`.
396
+ * Leaf columns can move across groups; consecutive same-group leaves stay wrapped.
397
+ */
398
+ enableColumnReorder?: boolean;
399
+ /** Controlled leaf column id order */
400
+ columnOrder?: ColumnOrderState;
401
+ onColumnOrderChange?: OnChangeFn<ColumnOrderState>;
386
402
  /**
387
403
  * Enable sticky freeze columns. Defaults to false.
388
404
  * Mark columns with `Column.frozen` / `meta.frozen` (`true` | `"left"` | `"right"`).
@@ -435,6 +451,8 @@ type DataTableClassNames = {
435
451
  headCell?: string;
436
452
  /** Column resize drag handle inside a header cell */
437
453
  resizeHandle?: string;
454
+ /** Drop-edge indicator while reordering columns */
455
+ dropEdge?: string;
438
456
  body?: string;
439
457
  emptyCell?: string;
440
458
  virtualSpacer?: string;
@@ -529,6 +547,11 @@ type TableColumnProps<T extends Record<string, unknown>, K extends string = keyo
529
547
  * Defaults to true.
530
548
  */
531
549
  resizable?: boolean;
550
+ /**
551
+ * When false, this column cannot be dragged even if `enableColumnReorder` is on.
552
+ * Defaults to true. Still accepts drops next to it.
553
+ */
554
+ reorderable?: boolean;
532
555
  /**
533
556
  * Freeze (sticky) without changing column order.
534
557
  * `true` / `"left"` → left edge; `"right"` → right edge.
@@ -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;
@@ -206,6 +208,11 @@ declare module "@tanstack/react-table" {
206
208
  * Middle columns are allowed; multiple frozen columns stack via cumulative offsets.
207
209
  */
208
210
  frozen?: ColumnFreezeMeta;
211
+ /**
212
+ * When false, this column cannot be dragged even if `enableColumnReorder` is on.
213
+ * Defaults to true.
214
+ */
215
+ reorderable?: boolean;
209
216
  }
210
217
  interface CellContext<TData, TValue> {
211
218
  /**
@@ -383,6 +390,15 @@ type DataTableProps<T extends Record<string, unknown>> = {
383
390
  * Use `"onEnd"` to update only after the pointer is released.
384
391
  */
385
392
  columnResizeMode?: ColumnResizeMode;
393
+ /**
394
+ * Enable drag-to-reorder on column headers. Defaults to false.
395
+ * Opt out per column with `Column.reorderable={false}` / `meta.reorderable: false`.
396
+ * Leaf columns can move across groups; consecutive same-group leaves stay wrapped.
397
+ */
398
+ enableColumnReorder?: boolean;
399
+ /** Controlled leaf column id order */
400
+ columnOrder?: ColumnOrderState;
401
+ onColumnOrderChange?: OnChangeFn<ColumnOrderState>;
386
402
  /**
387
403
  * Enable sticky freeze columns. Defaults to false.
388
404
  * Mark columns with `Column.frozen` / `meta.frozen` (`true` | `"left"` | `"right"`).
@@ -435,6 +451,8 @@ type DataTableClassNames = {
435
451
  headCell?: string;
436
452
  /** Column resize drag handle inside a header cell */
437
453
  resizeHandle?: string;
454
+ /** Drop-edge indicator while reordering columns */
455
+ dropEdge?: string;
438
456
  body?: string;
439
457
  emptyCell?: string;
440
458
  virtualSpacer?: string;
@@ -529,6 +547,11 @@ type TableColumnProps<T extends Record<string, unknown>, K extends string = keyo
529
547
  * Defaults to true.
530
548
  */
531
549
  resizable?: boolean;
550
+ /**
551
+ * When false, this column cannot be dragged even if `enableColumnReorder` is on.
552
+ * Defaults to true. Still accepts drops next to it.
553
+ */
554
+ reorderable?: boolean;
532
555
  /**
533
556
  * Freeze (sticky) without changing column order.
534
557
  * `true` / `"left"` → left edge; `"right"` → right edge.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-glide-table",
3
- "version": "2.0.2",
3
+ "version": "2.1.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/zpxlffjrm/react-glide-table.git"