react-glide-table 2.3.5 → 2.3.6

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.
@@ -5,7 +5,9 @@ import { ReactNode, CSSProperties, InputHTMLAttributes, ComponentType, Ref } fro
5
5
  * Built-in cell kinds inspired by Glide Data Grid All Cell Kinds.
6
6
  * Custom kinds are plain strings registered via `cellRenderers`.
7
7
  */
8
- type BuiltinCellKind = "text" | "number" | "boolean" | "uri" | "image" | "bubble" | "markdown" | "drilldown" | "loading" | "protected" | "row-id";
8
+ type BuiltinCellKind = "text" | "number" | "boolean" | "uri" | "image" | "bubble" | "markdown" | "drilldown" | "loading" | "protected" | "row-id"
9
+ /** Checkbox bound to the row's selection (`rowSelectionMode`) */
10
+ | "row-select";
9
11
  type CellKind = BuiltinCellKind | (string & {});
10
12
  type CellRenderContext<T extends Record<string, unknown> = Record<string, unknown>, V = unknown> = {
11
13
  value: V;
@@ -169,6 +171,18 @@ type DataTableLabels = {
169
171
  searchPrevious: string;
170
172
  searchNext: string;
171
173
  searchClose: string;
174
+ /** Search status line ("2 of 5 results") */
175
+ searchResultCount: (status: SearchStatus) => string;
176
+ /** Accessible label of a `kind: "protected"` cell */
177
+ protectedCell: string;
178
+ /** Compound `Table.Pagination` buttons (the Pagination props win when set) */
179
+ paginationPrevious: string;
180
+ paginationNext: string;
181
+ /**
182
+ * Toolbar row count. When omitted the toolbar shows the bare numbers
183
+ * (`filtered / total`).
184
+ */
185
+ count?: (filteredCount: number | undefined, totalCount: number | undefined) => ReactNode;
172
186
  };
173
187
  /** Default copy. Override via the `labels` option. */
174
188
  declare const DEFAULT_DATA_TABLE_LABELS: DataTableLabels;
@@ -185,6 +199,13 @@ type DataTableEditInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, "type
185
199
  * - function: custom clipboard string
186
200
  */
187
201
  type ColumnCopyValue<T extends Record<string, unknown> = Record<string, unknown>, V = unknown> = "display" | "value" | "omit" | ((ctx: CellRenderContext<T, V>) => string);
202
+ /**
203
+ * Per-column inline-search text.
204
+ * - `"value"` (default): raw accessor / field value
205
+ * - `"display"`: text of the rendered cell (`render` / `kind`)
206
+ * - function: custom search string
207
+ */
208
+ type ColumnSearchValue<T extends Record<string, unknown> = Record<string, unknown>, V = unknown> = "value" | "display" | ((ctx: CellRenderContext<T, V>) => string);
188
209
 
189
210
  declare module "@tanstack/react-table" {
190
211
  interface ColumnMeta<TData, TValue> {
@@ -225,6 +246,13 @@ declare module "@tanstack/react-table" {
225
246
  * - function: custom string for the clipboard
226
247
  */
227
248
  copyValue?: ColumnCopyValue;
249
+ /** Inline-search text for this column. Defaults to the raw value. */
250
+ searchValue?: ColumnSearchValue;
251
+ /**
252
+ * Set by compound `Table.Column sortable`: the column's current sort
253
+ * direction, or `false` when it is sortable but unsorted. Drives `aria-sort`.
254
+ */
255
+ sortDirection?: "asc" | "desc" | false;
228
256
  /**
229
257
  * Freeze (sticky) this column without reordering.
230
258
  * `true` / `"left"` stick to the scrollport left; `"right"` to the right.
@@ -300,6 +328,11 @@ type RowsPastePayload = {
300
328
  anchorRowId: string;
301
329
  /** Visible column ids from startCol for clipboard width */
302
330
  columnIds: string[];
331
+ /**
332
+ * The subset of `columnIds` the table itself would write to (editable and
333
+ * not `kind: "protected"`), the same rule as editing and the fill handle.
334
+ */
335
+ editableColumnIds?: string[];
303
336
  /** Parsed TSV matrix (rows × cols) */
304
337
  values: string[][];
305
338
  /**
@@ -349,13 +382,22 @@ type DataTableProps<T extends Record<string, unknown>> = {
349
382
  */
350
383
  enableCellSelection?: boolean;
351
384
  /**
352
- * @deprecated Combining with paged/tree-transformed data can corrupt the source.
353
- * Prefer onCellChange / onBatchChange.
385
+ * Receives the full original `data` with the change applied (also for tree,
386
+ * sorted and paginated tables). Used when neither `onCellChange` nor
387
+ * `onBatchChange` is given.
354
388
  */
355
389
  onDataChange?: (data: T[]) => void;
356
- /** Single-cell change (edit commit). Takes precedence over onDataChange */
390
+ /**
391
+ * Single-cell change (edit commit, render `update`, boolean checkbox).
392
+ * Also receives fill changes one by one when `onBatchChange` is absent.
393
+ * Takes precedence over onDataChange.
394
+ */
357
395
  onCellChange?: (rowId: string, columnId: string, value: unknown) => void;
358
- /** Multi-cell change (fill handle, etc.). Takes precedence over onDataChange */
396
+ /**
397
+ * Multi-cell change (fill handle, Delete key). Also receives single-cell
398
+ * changes as a one-item batch when `onCellChange` is absent.
399
+ * Takes precedence over onDataChange.
400
+ */
359
401
  onBatchChange?: (changes: Array<{
360
402
  rowId: string;
361
403
  columnId: string;
@@ -380,10 +422,21 @@ type DataTableProps<T extends Record<string, unknown>> = {
380
422
  classNames?: DataTableClassNames;
381
423
  /** Expand key field. Enables tree conversion / expand UI when set. Default `id` */
382
424
  toggleField?: string;
425
+ /** Alias of `toggleField`: the row id field of a tree. Enables tree mode when set. */
426
+ idField?: string;
383
427
  /** Child → parent reference field. Default `parentId` */
384
428
  childField?: string;
429
+ /** Alias of `childField`: the field holding the parent row's id. */
430
+ parentIdField?: string;
385
431
  /** Nested children array field. Default `children` */
386
432
  flattenField?: string;
433
+ /** Alias of `flattenField`: the nested children array field. */
434
+ childrenField?: string;
435
+ /**
436
+ * Column id that shows the expand toggle. Defaults to the `toggleField`
437
+ * column, else the column after a `no` / `treeNo` column, else the first.
438
+ */
439
+ expandColumn?: string;
387
440
  /** Parent quantity field used for parentCount. Default `qty` */
388
441
  qtyField?: string;
389
442
  /** Expanded row key set (controlled) */
@@ -391,11 +444,24 @@ type DataTableProps<T extends Record<string, unknown>> = {
391
444
  onExpandedRowsChange?: (next: Set<string>) => void;
392
445
  /** When true, expand is disabled (children always visible) */
393
446
  preventExpand?: boolean;
447
+ /**
448
+ * Expand every parent once when data first loads (reported through
449
+ * `onExpandedRowsChange` when controlled). Default `true`. Set `false` to
450
+ * keep the initial `expandedRows` you pass in.
451
+ */
452
+ autoExpandOnLoad?: boolean;
394
453
  /**
395
454
  * Enables Ctrl/Cmd+Shift+C and programmatic subtree copy for collapsed tree rows.
396
455
  * Defaults to true when `toggleField` is set.
397
456
  */
398
457
  enableSubtreeCopy?: boolean;
458
+ /**
459
+ * Prefixes copied cells that start with `=`, `+`, `-`, `@` (or a tab / CR)
460
+ * with `'` so spreadsheets paste them as text instead of evaluating them as
461
+ * formulas (CSV / formula injection). Enable when the table shows data that
462
+ * other users can write. Defaults to false.
463
+ */
464
+ escapeCopyFormulas?: boolean;
399
465
  /** Receives copy helpers once the table mounts or updates. */
400
466
  onCopyActionsReady?: (actions: DataTableCopyActions) => void;
401
467
  /**
@@ -418,6 +484,10 @@ type DataTableProps<T extends Record<string, unknown>> = {
418
484
  estimateRowHeight?: number;
419
485
  /** Virtualization overscan row count. Default 8 */
420
486
  virtualOverscan?: number;
487
+ /**
488
+ * W/A/S/D move the cell selection like the arrow keys. Defaults to true.
489
+ */
490
+ enableWasdNavigation?: boolean;
421
491
  /**
422
492
  * Enable drag-to-resize on column headers. Defaults to false.
423
493
  * Opt out per column with `Column.resizable={false}` / `enableResizing: false`.
@@ -477,6 +547,10 @@ type DataTableProps<T extends Record<string, unknown>> = {
477
547
  */
478
548
  type DataTableClassNames = {
479
549
  root?: string;
550
+ /** Compound `Table` only: the outer wrapper around the table and pagination */
551
+ tableRoot?: string;
552
+ /** Compound `Table` only: the pagination bar */
553
+ pagination?: string;
480
554
  pending?: string;
481
555
  loadingText?: string;
482
556
  toolbar?: string;
@@ -521,6 +595,8 @@ type DataTableToolbarSlotProps = {
521
595
  summary?: ReactNode;
522
596
  selectedCount: number;
523
597
  selectionLabel?: (selectedCount: number) => ReactNode;
598
+ /** Renders the row count instead of the bare numbers (`labels.count`) */
599
+ countLabel?: (filteredCount: number | undefined, totalCount: number | undefined) => ReactNode;
524
600
  toolbar?: ReactNode;
525
601
  className?: string;
526
602
  classNames?: Pick<DataTableClassNames, "toolbar" | "toolbarLeft" | "toolbarRight" | "toolbarCount" | "toolbarSelection" | "toolbarActions">;
@@ -647,6 +723,13 @@ type TableColumnProps<T extends Record<string, unknown>, K extends string = keyo
647
723
  * - function: custom string for the clipboard
648
724
  */
649
725
  copyValue?: ColumnCopyValue<T, K extends keyof T ? T[K] : unknown>;
726
+ /**
727
+ * Inline-search text for this column.
728
+ * - `"value"` (default): raw field value
729
+ * - `"display"`: text of the rendered cell
730
+ * - function: custom search string
731
+ */
732
+ searchValue?: ColumnSearchValue<T, K extends keyof T ? T[K] : unknown>;
650
733
  };
651
734
  /** Declares a multi-row header group wrapping leaf `Table.Column`s. */
652
735
  type TableColumnGroupProps = {
@@ -658,8 +741,20 @@ type TableColumnGroupProps = {
658
741
  align?: "left" | "center" | "right";
659
742
  headerClassName?: string;
660
743
  };
744
+ type TableSort = {
745
+ field: string;
746
+ direction: "asc" | "desc";
747
+ };
661
748
  type TableProps<T extends Record<string, unknown>> = Omit<DataTableProps<T>, "columns"> & {
662
749
  children: ReactNode;
750
+ /** Controlled sort (`null` = unsorted). Use with `onSortChange`. */
751
+ sort?: TableSort | null;
752
+ /** Initial sort when uncontrolled. */
753
+ defaultSort?: TableSort | null;
754
+ /** Called with the next sort when a sortable header is clicked. */
755
+ onSortChange?: (sort: TableSort | null) => void;
756
+ /** Locale for string sorting. Defaults to `"ko"`. */
757
+ sortLocale?: string;
663
758
  };
664
759
 
665
- export { collectAncestorKeysToExpand as A, type BuiltinCellKind as B, type CellKind as C, DEFAULT_DATA_TABLE_LABELS as D, collectSearchMatchesInRange as E, createSearchRegex as F, escapeSearchRegex as G, formatSearchResultLabel as H, INLINE_SEARCH_MAX_RESULTS as I, getColumnFreezeEdgeAttr as J, getColumnFreezeStyle as K, mapSearchResultToVisibleItem as L, mapSearchResultsToVisibleKeys as M, nextSearchIndex as N, nextSearchStride as O, type PasteMode as P, previousSearchIndex as Q, type RowSelectionMode as R, type SearchCorpusRow as S, type TableColumnGroupProps as T, resolveColumnFreezeSide as U, resolveDataTableLabels as V, resolveHeaderFreezeOffset as W, type CellEditType as X, type CellRenderContext as a, type CellRenderFn as b, type CellRenderer as c, type ColumnCopyValue as d, type ColumnFreezeColumnInput as e, type ColumnFreezeEdgeSide as f, type ColumnFreezeMeta as g, type ColumnFreezeOffset as h, type ColumnFreezeSide as i, type DataTableClassNames as j, type DataTableCopyActions as k, type DataTableLabels as l, type DataTableProps as m, type DataTableScrollSlotProps as n, type DataTableSlots as o, type RowsPastePayload as p, type SearchResultItem as q, type SearchStatus as r, type TableColumnProps as s, type TableProps as t, buildColumnFreezeOffsets as u, buildFlatSearchCorpus as v, buildSearchMatchKey as w, buildSearchMatchKeys as x, buildTreeSearchCorpus as y, cellValueToSearchText as z };
760
+ export { cellValueToSearchText as A, type BuiltinCellKind as B, type CellKind as C, DEFAULT_DATA_TABLE_LABELS as D, collectAncestorKeysToExpand as E, collectSearchMatchesInRange as F, createSearchRegex as G, escapeSearchRegex as H, INLINE_SEARCH_MAX_RESULTS as I, formatSearchResultLabel as J, getColumnFreezeEdgeAttr as K, getColumnFreezeStyle as L, mapSearchResultToVisibleItem as M, mapSearchResultsToVisibleKeys as N, nextSearchIndex as O, type PasteMode as P, nextSearchStride as Q, type RowSelectionMode as R, type SearchCorpusRow as S, type TableColumnGroupProps as T, previousSearchIndex as U, resolveColumnFreezeSide as V, resolveDataTableLabels as W, resolveHeaderFreezeOffset as X, type TableSort as Y, type CellEditType as Z, type CellRenderContext as a, type CellRenderFn as b, type CellRenderer as c, type ColumnCopyValue as d, type ColumnFreezeColumnInput as e, type ColumnFreezeEdgeSide as f, type ColumnFreezeMeta as g, type ColumnFreezeOffset as h, type ColumnFreezeSide as i, type ColumnSearchValue as j, type DataTableClassNames as k, type DataTableCopyActions as l, type DataTableLabels as m, type DataTableProps as n, type DataTableScrollSlotProps as o, type DataTableSlots as p, type RowsPastePayload as q, type SearchResultItem as r, type SearchStatus as s, type TableColumnProps as t, type TableProps as u, buildColumnFreezeOffsets as v, buildFlatSearchCorpus as w, buildSearchMatchKey as x, buildSearchMatchKeys as y, buildTreeSearchCorpus as z };
@@ -5,7 +5,9 @@ import { ReactNode, CSSProperties, InputHTMLAttributes, ComponentType, Ref } fro
5
5
  * Built-in cell kinds inspired by Glide Data Grid All Cell Kinds.
6
6
  * Custom kinds are plain strings registered via `cellRenderers`.
7
7
  */
8
- type BuiltinCellKind = "text" | "number" | "boolean" | "uri" | "image" | "bubble" | "markdown" | "drilldown" | "loading" | "protected" | "row-id";
8
+ type BuiltinCellKind = "text" | "number" | "boolean" | "uri" | "image" | "bubble" | "markdown" | "drilldown" | "loading" | "protected" | "row-id"
9
+ /** Checkbox bound to the row's selection (`rowSelectionMode`) */
10
+ | "row-select";
9
11
  type CellKind = BuiltinCellKind | (string & {});
10
12
  type CellRenderContext<T extends Record<string, unknown> = Record<string, unknown>, V = unknown> = {
11
13
  value: V;
@@ -169,6 +171,18 @@ type DataTableLabels = {
169
171
  searchPrevious: string;
170
172
  searchNext: string;
171
173
  searchClose: string;
174
+ /** Search status line ("2 of 5 results") */
175
+ searchResultCount: (status: SearchStatus) => string;
176
+ /** Accessible label of a `kind: "protected"` cell */
177
+ protectedCell: string;
178
+ /** Compound `Table.Pagination` buttons (the Pagination props win when set) */
179
+ paginationPrevious: string;
180
+ paginationNext: string;
181
+ /**
182
+ * Toolbar row count. When omitted the toolbar shows the bare numbers
183
+ * (`filtered / total`).
184
+ */
185
+ count?: (filteredCount: number | undefined, totalCount: number | undefined) => ReactNode;
172
186
  };
173
187
  /** Default copy. Override via the `labels` option. */
174
188
  declare const DEFAULT_DATA_TABLE_LABELS: DataTableLabels;
@@ -185,6 +199,13 @@ type DataTableEditInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, "type
185
199
  * - function: custom clipboard string
186
200
  */
187
201
  type ColumnCopyValue<T extends Record<string, unknown> = Record<string, unknown>, V = unknown> = "display" | "value" | "omit" | ((ctx: CellRenderContext<T, V>) => string);
202
+ /**
203
+ * Per-column inline-search text.
204
+ * - `"value"` (default): raw accessor / field value
205
+ * - `"display"`: text of the rendered cell (`render` / `kind`)
206
+ * - function: custom search string
207
+ */
208
+ type ColumnSearchValue<T extends Record<string, unknown> = Record<string, unknown>, V = unknown> = "value" | "display" | ((ctx: CellRenderContext<T, V>) => string);
188
209
 
189
210
  declare module "@tanstack/react-table" {
190
211
  interface ColumnMeta<TData, TValue> {
@@ -225,6 +246,13 @@ declare module "@tanstack/react-table" {
225
246
  * - function: custom string for the clipboard
226
247
  */
227
248
  copyValue?: ColumnCopyValue;
249
+ /** Inline-search text for this column. Defaults to the raw value. */
250
+ searchValue?: ColumnSearchValue;
251
+ /**
252
+ * Set by compound `Table.Column sortable`: the column's current sort
253
+ * direction, or `false` when it is sortable but unsorted. Drives `aria-sort`.
254
+ */
255
+ sortDirection?: "asc" | "desc" | false;
228
256
  /**
229
257
  * Freeze (sticky) this column without reordering.
230
258
  * `true` / `"left"` stick to the scrollport left; `"right"` to the right.
@@ -300,6 +328,11 @@ type RowsPastePayload = {
300
328
  anchorRowId: string;
301
329
  /** Visible column ids from startCol for clipboard width */
302
330
  columnIds: string[];
331
+ /**
332
+ * The subset of `columnIds` the table itself would write to (editable and
333
+ * not `kind: "protected"`), the same rule as editing and the fill handle.
334
+ */
335
+ editableColumnIds?: string[];
303
336
  /** Parsed TSV matrix (rows × cols) */
304
337
  values: string[][];
305
338
  /**
@@ -349,13 +382,22 @@ type DataTableProps<T extends Record<string, unknown>> = {
349
382
  */
350
383
  enableCellSelection?: boolean;
351
384
  /**
352
- * @deprecated Combining with paged/tree-transformed data can corrupt the source.
353
- * Prefer onCellChange / onBatchChange.
385
+ * Receives the full original `data` with the change applied (also for tree,
386
+ * sorted and paginated tables). Used when neither `onCellChange` nor
387
+ * `onBatchChange` is given.
354
388
  */
355
389
  onDataChange?: (data: T[]) => void;
356
- /** Single-cell change (edit commit). Takes precedence over onDataChange */
390
+ /**
391
+ * Single-cell change (edit commit, render `update`, boolean checkbox).
392
+ * Also receives fill changes one by one when `onBatchChange` is absent.
393
+ * Takes precedence over onDataChange.
394
+ */
357
395
  onCellChange?: (rowId: string, columnId: string, value: unknown) => void;
358
- /** Multi-cell change (fill handle, etc.). Takes precedence over onDataChange */
396
+ /**
397
+ * Multi-cell change (fill handle, Delete key). Also receives single-cell
398
+ * changes as a one-item batch when `onCellChange` is absent.
399
+ * Takes precedence over onDataChange.
400
+ */
359
401
  onBatchChange?: (changes: Array<{
360
402
  rowId: string;
361
403
  columnId: string;
@@ -380,10 +422,21 @@ type DataTableProps<T extends Record<string, unknown>> = {
380
422
  classNames?: DataTableClassNames;
381
423
  /** Expand key field. Enables tree conversion / expand UI when set. Default `id` */
382
424
  toggleField?: string;
425
+ /** Alias of `toggleField`: the row id field of a tree. Enables tree mode when set. */
426
+ idField?: string;
383
427
  /** Child → parent reference field. Default `parentId` */
384
428
  childField?: string;
429
+ /** Alias of `childField`: the field holding the parent row's id. */
430
+ parentIdField?: string;
385
431
  /** Nested children array field. Default `children` */
386
432
  flattenField?: string;
433
+ /** Alias of `flattenField`: the nested children array field. */
434
+ childrenField?: string;
435
+ /**
436
+ * Column id that shows the expand toggle. Defaults to the `toggleField`
437
+ * column, else the column after a `no` / `treeNo` column, else the first.
438
+ */
439
+ expandColumn?: string;
387
440
  /** Parent quantity field used for parentCount. Default `qty` */
388
441
  qtyField?: string;
389
442
  /** Expanded row key set (controlled) */
@@ -391,11 +444,24 @@ type DataTableProps<T extends Record<string, unknown>> = {
391
444
  onExpandedRowsChange?: (next: Set<string>) => void;
392
445
  /** When true, expand is disabled (children always visible) */
393
446
  preventExpand?: boolean;
447
+ /**
448
+ * Expand every parent once when data first loads (reported through
449
+ * `onExpandedRowsChange` when controlled). Default `true`. Set `false` to
450
+ * keep the initial `expandedRows` you pass in.
451
+ */
452
+ autoExpandOnLoad?: boolean;
394
453
  /**
395
454
  * Enables Ctrl/Cmd+Shift+C and programmatic subtree copy for collapsed tree rows.
396
455
  * Defaults to true when `toggleField` is set.
397
456
  */
398
457
  enableSubtreeCopy?: boolean;
458
+ /**
459
+ * Prefixes copied cells that start with `=`, `+`, `-`, `@` (or a tab / CR)
460
+ * with `'` so spreadsheets paste them as text instead of evaluating them as
461
+ * formulas (CSV / formula injection). Enable when the table shows data that
462
+ * other users can write. Defaults to false.
463
+ */
464
+ escapeCopyFormulas?: boolean;
399
465
  /** Receives copy helpers once the table mounts or updates. */
400
466
  onCopyActionsReady?: (actions: DataTableCopyActions) => void;
401
467
  /**
@@ -418,6 +484,10 @@ type DataTableProps<T extends Record<string, unknown>> = {
418
484
  estimateRowHeight?: number;
419
485
  /** Virtualization overscan row count. Default 8 */
420
486
  virtualOverscan?: number;
487
+ /**
488
+ * W/A/S/D move the cell selection like the arrow keys. Defaults to true.
489
+ */
490
+ enableWasdNavigation?: boolean;
421
491
  /**
422
492
  * Enable drag-to-resize on column headers. Defaults to false.
423
493
  * Opt out per column with `Column.resizable={false}` / `enableResizing: false`.
@@ -477,6 +547,10 @@ type DataTableProps<T extends Record<string, unknown>> = {
477
547
  */
478
548
  type DataTableClassNames = {
479
549
  root?: string;
550
+ /** Compound `Table` only: the outer wrapper around the table and pagination */
551
+ tableRoot?: string;
552
+ /** Compound `Table` only: the pagination bar */
553
+ pagination?: string;
480
554
  pending?: string;
481
555
  loadingText?: string;
482
556
  toolbar?: string;
@@ -521,6 +595,8 @@ type DataTableToolbarSlotProps = {
521
595
  summary?: ReactNode;
522
596
  selectedCount: number;
523
597
  selectionLabel?: (selectedCount: number) => ReactNode;
598
+ /** Renders the row count instead of the bare numbers (`labels.count`) */
599
+ countLabel?: (filteredCount: number | undefined, totalCount: number | undefined) => ReactNode;
524
600
  toolbar?: ReactNode;
525
601
  className?: string;
526
602
  classNames?: Pick<DataTableClassNames, "toolbar" | "toolbarLeft" | "toolbarRight" | "toolbarCount" | "toolbarSelection" | "toolbarActions">;
@@ -647,6 +723,13 @@ type TableColumnProps<T extends Record<string, unknown>, K extends string = keyo
647
723
  * - function: custom string for the clipboard
648
724
  */
649
725
  copyValue?: ColumnCopyValue<T, K extends keyof T ? T[K] : unknown>;
726
+ /**
727
+ * Inline-search text for this column.
728
+ * - `"value"` (default): raw field value
729
+ * - `"display"`: text of the rendered cell
730
+ * - function: custom search string
731
+ */
732
+ searchValue?: ColumnSearchValue<T, K extends keyof T ? T[K] : unknown>;
650
733
  };
651
734
  /** Declares a multi-row header group wrapping leaf `Table.Column`s. */
652
735
  type TableColumnGroupProps = {
@@ -658,8 +741,20 @@ type TableColumnGroupProps = {
658
741
  align?: "left" | "center" | "right";
659
742
  headerClassName?: string;
660
743
  };
744
+ type TableSort = {
745
+ field: string;
746
+ direction: "asc" | "desc";
747
+ };
661
748
  type TableProps<T extends Record<string, unknown>> = Omit<DataTableProps<T>, "columns"> & {
662
749
  children: ReactNode;
750
+ /** Controlled sort (`null` = unsorted). Use with `onSortChange`. */
751
+ sort?: TableSort | null;
752
+ /** Initial sort when uncontrolled. */
753
+ defaultSort?: TableSort | null;
754
+ /** Called with the next sort when a sortable header is clicked. */
755
+ onSortChange?: (sort: TableSort | null) => void;
756
+ /** Locale for string sorting. Defaults to `"ko"`. */
757
+ sortLocale?: string;
663
758
  };
664
759
 
665
- export { collectAncestorKeysToExpand as A, type BuiltinCellKind as B, type CellKind as C, DEFAULT_DATA_TABLE_LABELS as D, collectSearchMatchesInRange as E, createSearchRegex as F, escapeSearchRegex as G, formatSearchResultLabel as H, INLINE_SEARCH_MAX_RESULTS as I, getColumnFreezeEdgeAttr as J, getColumnFreezeStyle as K, mapSearchResultToVisibleItem as L, mapSearchResultsToVisibleKeys as M, nextSearchIndex as N, nextSearchStride as O, type PasteMode as P, previousSearchIndex as Q, type RowSelectionMode as R, type SearchCorpusRow as S, type TableColumnGroupProps as T, resolveColumnFreezeSide as U, resolveDataTableLabels as V, resolveHeaderFreezeOffset as W, type CellEditType as X, type CellRenderContext as a, type CellRenderFn as b, type CellRenderer as c, type ColumnCopyValue as d, type ColumnFreezeColumnInput as e, type ColumnFreezeEdgeSide as f, type ColumnFreezeMeta as g, type ColumnFreezeOffset as h, type ColumnFreezeSide as i, type DataTableClassNames as j, type DataTableCopyActions as k, type DataTableLabels as l, type DataTableProps as m, type DataTableScrollSlotProps as n, type DataTableSlots as o, type RowsPastePayload as p, type SearchResultItem as q, type SearchStatus as r, type TableColumnProps as s, type TableProps as t, buildColumnFreezeOffsets as u, buildFlatSearchCorpus as v, buildSearchMatchKey as w, buildSearchMatchKeys as x, buildTreeSearchCorpus as y, cellValueToSearchText as z };
760
+ export { cellValueToSearchText as A, type BuiltinCellKind as B, type CellKind as C, DEFAULT_DATA_TABLE_LABELS as D, collectAncestorKeysToExpand as E, collectSearchMatchesInRange as F, createSearchRegex as G, escapeSearchRegex as H, INLINE_SEARCH_MAX_RESULTS as I, formatSearchResultLabel as J, getColumnFreezeEdgeAttr as K, getColumnFreezeStyle as L, mapSearchResultToVisibleItem as M, mapSearchResultsToVisibleKeys as N, nextSearchIndex as O, type PasteMode as P, nextSearchStride as Q, type RowSelectionMode as R, type SearchCorpusRow as S, type TableColumnGroupProps as T, previousSearchIndex as U, resolveColumnFreezeSide as V, resolveDataTableLabels as W, resolveHeaderFreezeOffset as X, type TableSort as Y, type CellEditType as Z, type CellRenderContext as a, type CellRenderFn as b, type CellRenderer as c, type ColumnCopyValue as d, type ColumnFreezeColumnInput as e, type ColumnFreezeEdgeSide as f, type ColumnFreezeMeta as g, type ColumnFreezeOffset as h, type ColumnFreezeSide as i, type ColumnSearchValue as j, type DataTableClassNames as k, type DataTableCopyActions as l, type DataTableLabels as m, type DataTableProps as n, type DataTableScrollSlotProps as o, type DataTableSlots as p, type RowsPastePayload as q, type SearchResultItem as r, type SearchStatus as s, type TableColumnProps as t, type TableProps as u, buildColumnFreezeOffsets as v, buildFlatSearchCorpus as w, buildSearchMatchKey as x, buildSearchMatchKeys as y, buildTreeSearchCorpus as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-glide-table",
3
- "version": "2.3.5",
3
+ "version": "2.3.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/zpxlffjrm/react-glide-table.git"