react-glide-table 2.2.0 → 2.2.1
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/README.md +27 -9
- package/dist/compound.cjs +33 -11
- package/dist/compound.d.cts +2 -2
- package/dist/compound.d.ts +2 -2
- package/dist/compound.js +33 -11
- package/dist/core.cjs +21 -7
- package/dist/core.d.cts +10 -5
- package/dist/core.d.ts +10 -5
- package/dist/core.js +21 -7
- package/dist/index.cjs +33 -11
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +33 -11
- package/dist/{types-Iot4g4sq.d.cts → types-CnsQ8GZb.d.cts} +16 -2
- package/dist/{types-Iot4g4sq.d.ts → types-CnsQ8GZb.d.ts} +16 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -259,6 +259,18 @@ import type { RowsPastePayload } from "react-glide-table/compound";
|
|
|
259
259
|
Related props: `onRowsPaste`, `enableInsertPaste`, `enableSubtreeCopy`, `onCopyActionsReady`.
|
|
260
260
|
Helpers (`/core`): `buildRowsPastePayload`, `parseClipboardTSV`, `parseClipboardTSVWithDepths`, `serializeSelectionToTSV`, …
|
|
261
261
|
|
|
262
|
+
## Column width
|
|
263
|
+
|
|
264
|
+
`Column.width` sets the default size. `minWidth` / `maxWidth` are CSS constraints on header and body cells — they do not clamp drag-resize.
|
|
265
|
+
|
|
266
|
+
```tsx
|
|
267
|
+
<ProductTable.Column field="note" minWidth={80} maxWidth={240}>
|
|
268
|
+
Note
|
|
269
|
+
</ProductTable.Column>
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
With `ColumnDef` (non-compound), put the same values on `meta.minWidth` / `meta.maxWidth`.
|
|
273
|
+
|
|
262
274
|
## Column resize
|
|
263
275
|
|
|
264
276
|
Opt in with `enableColumnResize`. Drag the handle on the right edge of a header cell; double-click resets to the column’s default `width` / `size`.
|
|
@@ -272,7 +284,12 @@ Opt in with `enableColumnResize`. Drag the handle on the right edge of a header
|
|
|
272
284
|
// onColumnSizingChange={setSizing}
|
|
273
285
|
>
|
|
274
286
|
<ProductTable.Header>
|
|
275
|
-
<ProductTable.Column
|
|
287
|
+
<ProductTable.Column
|
|
288
|
+
field="name"
|
|
289
|
+
width={200}
|
|
290
|
+
minResizeWidth={80}
|
|
291
|
+
maxResizeWidth={480}
|
|
292
|
+
>
|
|
276
293
|
Name
|
|
277
294
|
</ProductTable.Column>
|
|
278
295
|
<ProductTable.Column field="sku" resizable={false}>
|
|
@@ -282,14 +299,15 @@ Opt in with `enableColumnResize`. Drag the handle on the right edge of a header
|
|
|
282
299
|
</ProductTable>
|
|
283
300
|
```
|
|
284
301
|
|
|
285
|
-
| Prop
|
|
286
|
-
|
|
|
287
|
-
| `enableColumnResize`
|
|
288
|
-
| `columnSizing` / `onColumnSizingChange`
|
|
289
|
-
| `columnResizeMode`
|
|
290
|
-
| `Column.width`
|
|
291
|
-
| `Column.
|
|
292
|
-
| `
|
|
302
|
+
| Prop | Role |
|
|
303
|
+
| ------------------------------------------ | -------------------------------------------- |
|
|
304
|
+
| `enableColumnResize` | Turn on header drag resize (default `false`) |
|
|
305
|
+
| `columnSizing` / `onColumnSizingChange` | Controlled width map `{ [columnId]: px }` |
|
|
306
|
+
| `columnResizeMode` | `"onChange"` (live) or `"onEnd"` |
|
|
307
|
+
| `Column.width` | Default column size |
|
|
308
|
+
| `Column.minResizeWidth` / `maxResizeWidth` | Drag-resize clamp sizes |
|
|
309
|
+
| `Column.resizable={false}` | Disable resize for one column |
|
|
310
|
+
| `classNames.resizeHandle` | Style hook for the drag handle |
|
|
293
311
|
|
|
294
312
|
## Column reorder
|
|
295
313
|
|
package/dist/compound.cjs
CHANGED
|
@@ -531,15 +531,29 @@ function flattenHeaderLeaves(column) {
|
|
|
531
531
|
|
|
532
532
|
// src/components/ui/table/features/column-resize/columnResize.ts
|
|
533
533
|
function getColumnSizeStyle(size, options) {
|
|
534
|
-
const { force = false, lockMax = false } = options ?? {};
|
|
535
|
-
if (
|
|
534
|
+
const { force = false, lockMax = false, minWidth, maxWidth } = options ?? {};
|
|
535
|
+
if (lockMax) {
|
|
536
|
+
return {
|
|
537
|
+
width: size,
|
|
538
|
+
minWidth: size,
|
|
539
|
+
maxWidth: size
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
const hasExplicitSize = force || size !== DATA_TABLE_COLUMN_SIZE;
|
|
543
|
+
if (!hasExplicitSize && minWidth == null && maxWidth == null) {
|
|
536
544
|
return void 0;
|
|
537
545
|
}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
}
|
|
546
|
+
const style = {};
|
|
547
|
+
if (hasExplicitSize) {
|
|
548
|
+
style.width = size;
|
|
549
|
+
style.minWidth = minWidth ?? size;
|
|
550
|
+
} else if (minWidth != null) {
|
|
551
|
+
style.minWidth = minWidth;
|
|
552
|
+
}
|
|
553
|
+
if (maxWidth != null) {
|
|
554
|
+
style.maxWidth = maxWidth;
|
|
555
|
+
}
|
|
556
|
+
return style;
|
|
543
557
|
}
|
|
544
558
|
|
|
545
559
|
// src/components/ui/table/features/inline-search/inlineSearch.ts
|
|
@@ -1407,7 +1421,9 @@ function DataTableRow({
|
|
|
1407
1421
|
const hasSelectionEdges = hasCellSelectionEdges(selectionEdgeStyle);
|
|
1408
1422
|
const sizeStyle = getColumnSizeStyle(cell.column.getSize(), {
|
|
1409
1423
|
force: enableColumnResize,
|
|
1410
|
-
lockMax: enableColumnResize
|
|
1424
|
+
lockMax: enableColumnResize,
|
|
1425
|
+
minWidth: meta?.minWidth,
|
|
1426
|
+
maxWidth: meta?.maxWidth
|
|
1411
1427
|
});
|
|
1412
1428
|
const freezeOffset = enableColumnFreeze ? freezeOffsets.get(columnId) : void 0;
|
|
1413
1429
|
const freezeStyle = getColumnFreezeStyle(freezeOffset);
|
|
@@ -4230,7 +4246,9 @@ function DataTable({
|
|
|
4230
4246
|
const canResize = enableColumnResize && header.column.getCanResize();
|
|
4231
4247
|
const sizeStyle = getColumnSizeStyle(header.getSize(), {
|
|
4232
4248
|
force: enableColumnResize,
|
|
4233
|
-
lockMax: enableColumnResize
|
|
4249
|
+
lockMax: enableColumnResize,
|
|
4250
|
+
minWidth: header.column.columnDef.meta?.minWidth,
|
|
4251
|
+
maxWidth: header.column.columnDef.meta?.maxWidth
|
|
4234
4252
|
});
|
|
4235
4253
|
const freezeOffset = enableColumnFreeze ? resolveHeaderFreezeOffset(header.column, freezeOffsets) : void 0;
|
|
4236
4254
|
const freezeStyle = getColumnFreezeStyle(freezeOffset, {
|
|
@@ -4470,6 +4488,8 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
4470
4488
|
width,
|
|
4471
4489
|
minWidth,
|
|
4472
4490
|
maxWidth,
|
|
4491
|
+
minResizeWidth,
|
|
4492
|
+
maxResizeWidth,
|
|
4473
4493
|
resizable,
|
|
4474
4494
|
reorderable,
|
|
4475
4495
|
frozen,
|
|
@@ -4490,8 +4510,8 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
4490
4510
|
id: field,
|
|
4491
4511
|
...!virtual ? { accessorKey: field } : {},
|
|
4492
4512
|
size: width ?? DATA_TABLE_COLUMN_SIZE,
|
|
4493
|
-
...
|
|
4494
|
-
...
|
|
4513
|
+
...minResizeWidth != null ? { minSize: minResizeWidth } : {},
|
|
4514
|
+
...maxResizeWidth != null ? { maxSize: maxResizeWidth } : {},
|
|
4495
4515
|
...resizable === false ? { enableResizing: false } : {},
|
|
4496
4516
|
header: sortable ? () => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4497
4517
|
SortableHeader,
|
|
@@ -4520,6 +4540,8 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
4520
4540
|
cellRender: render,
|
|
4521
4541
|
frozen,
|
|
4522
4542
|
reorderable,
|
|
4543
|
+
minWidth,
|
|
4544
|
+
maxWidth,
|
|
4523
4545
|
className,
|
|
4524
4546
|
headerClassName
|
|
4525
4547
|
}
|
package/dist/compound.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, ReactElement } from 'react';
|
|
3
|
-
import { l as DataTableProps, r as TableColumnProps, T as TableColumnGroupProps, s as TableProps } from './types-
|
|
4
|
-
export { B as BuiltinCellKind, C as CellKind, a as CellRenderContext, b as CellRenderFn, c as CellRenderer, f as ColumnFreezeMeta, h as ColumnFreezeSide, i as DataTableClassNames, k as DataTableLabels, m as DataTableScrollSlotProps, n as DataTableSlots, P as PasteMode, R as RowSelectionMode, o as RowsPastePayload, p as SearchResultItem } from './types-
|
|
3
|
+
import { l as DataTableProps, r as TableColumnProps, T as TableColumnGroupProps, s as TableProps } from './types-CnsQ8GZb.cjs';
|
|
4
|
+
export { B as BuiltinCellKind, C as CellKind, a as CellRenderContext, b as CellRenderFn, c as CellRenderer, f as ColumnFreezeMeta, h as ColumnFreezeSide, i as DataTableClassNames, k as DataTableLabels, m as DataTableScrollSlotProps, n as DataTableSlots, P as PasteMode, R as RowSelectionMode, o as RowsPastePayload, p as SearchResultItem } from './types-CnsQ8GZb.cjs';
|
|
5
5
|
export { ColumnDef, ColumnOrderState, ColumnResizeMode, ColumnSizingState, RowSelectionState } from '@tanstack/react-table';
|
|
6
6
|
|
|
7
7
|
/**
|
package/dist/compound.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, ReactElement } from 'react';
|
|
3
|
-
import { l as DataTableProps, r as TableColumnProps, T as TableColumnGroupProps, s as TableProps } from './types-
|
|
4
|
-
export { B as BuiltinCellKind, C as CellKind, a as CellRenderContext, b as CellRenderFn, c as CellRenderer, f as ColumnFreezeMeta, h as ColumnFreezeSide, i as DataTableClassNames, k as DataTableLabels, m as DataTableScrollSlotProps, n as DataTableSlots, P as PasteMode, R as RowSelectionMode, o as RowsPastePayload, p as SearchResultItem } from './types-
|
|
3
|
+
import { l as DataTableProps, r as TableColumnProps, T as TableColumnGroupProps, s as TableProps } from './types-CnsQ8GZb.js';
|
|
4
|
+
export { B as BuiltinCellKind, C as CellKind, a as CellRenderContext, b as CellRenderFn, c as CellRenderer, f as ColumnFreezeMeta, h as ColumnFreezeSide, i as DataTableClassNames, k as DataTableLabels, m as DataTableScrollSlotProps, n as DataTableSlots, P as PasteMode, R as RowSelectionMode, o as RowsPastePayload, p as SearchResultItem } from './types-CnsQ8GZb.js';
|
|
5
5
|
export { ColumnDef, ColumnOrderState, ColumnResizeMode, ColumnSizingState, RowSelectionState } from '@tanstack/react-table';
|
|
6
6
|
|
|
7
7
|
/**
|
package/dist/compound.js
CHANGED
|
@@ -503,15 +503,29 @@ function flattenHeaderLeaves(column) {
|
|
|
503
503
|
|
|
504
504
|
// src/components/ui/table/features/column-resize/columnResize.ts
|
|
505
505
|
function getColumnSizeStyle(size, options) {
|
|
506
|
-
const { force = false, lockMax = false } = options ?? {};
|
|
507
|
-
if (
|
|
506
|
+
const { force = false, lockMax = false, minWidth, maxWidth } = options ?? {};
|
|
507
|
+
if (lockMax) {
|
|
508
|
+
return {
|
|
509
|
+
width: size,
|
|
510
|
+
minWidth: size,
|
|
511
|
+
maxWidth: size
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
const hasExplicitSize = force || size !== DATA_TABLE_COLUMN_SIZE;
|
|
515
|
+
if (!hasExplicitSize && minWidth == null && maxWidth == null) {
|
|
508
516
|
return void 0;
|
|
509
517
|
}
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
}
|
|
518
|
+
const style = {};
|
|
519
|
+
if (hasExplicitSize) {
|
|
520
|
+
style.width = size;
|
|
521
|
+
style.minWidth = minWidth ?? size;
|
|
522
|
+
} else if (minWidth != null) {
|
|
523
|
+
style.minWidth = minWidth;
|
|
524
|
+
}
|
|
525
|
+
if (maxWidth != null) {
|
|
526
|
+
style.maxWidth = maxWidth;
|
|
527
|
+
}
|
|
528
|
+
return style;
|
|
515
529
|
}
|
|
516
530
|
|
|
517
531
|
// src/components/ui/table/features/inline-search/inlineSearch.ts
|
|
@@ -1379,7 +1393,9 @@ function DataTableRow({
|
|
|
1379
1393
|
const hasSelectionEdges = hasCellSelectionEdges(selectionEdgeStyle);
|
|
1380
1394
|
const sizeStyle = getColumnSizeStyle(cell.column.getSize(), {
|
|
1381
1395
|
force: enableColumnResize,
|
|
1382
|
-
lockMax: enableColumnResize
|
|
1396
|
+
lockMax: enableColumnResize,
|
|
1397
|
+
minWidth: meta?.minWidth,
|
|
1398
|
+
maxWidth: meta?.maxWidth
|
|
1383
1399
|
});
|
|
1384
1400
|
const freezeOffset = enableColumnFreeze ? freezeOffsets.get(columnId) : void 0;
|
|
1385
1401
|
const freezeStyle = getColumnFreezeStyle(freezeOffset);
|
|
@@ -4225,7 +4241,9 @@ function DataTable({
|
|
|
4225
4241
|
const canResize = enableColumnResize && header.column.getCanResize();
|
|
4226
4242
|
const sizeStyle = getColumnSizeStyle(header.getSize(), {
|
|
4227
4243
|
force: enableColumnResize,
|
|
4228
|
-
lockMax: enableColumnResize
|
|
4244
|
+
lockMax: enableColumnResize,
|
|
4245
|
+
minWidth: header.column.columnDef.meta?.minWidth,
|
|
4246
|
+
maxWidth: header.column.columnDef.meta?.maxWidth
|
|
4229
4247
|
});
|
|
4230
4248
|
const freezeOffset = enableColumnFreeze ? resolveHeaderFreezeOffset(header.column, freezeOffsets) : void 0;
|
|
4231
4249
|
const freezeStyle = getColumnFreezeStyle(freezeOffset, {
|
|
@@ -4465,6 +4483,8 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
4465
4483
|
width,
|
|
4466
4484
|
minWidth,
|
|
4467
4485
|
maxWidth,
|
|
4486
|
+
minResizeWidth,
|
|
4487
|
+
maxResizeWidth,
|
|
4468
4488
|
resizable,
|
|
4469
4489
|
reorderable,
|
|
4470
4490
|
frozen,
|
|
@@ -4485,8 +4505,8 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
4485
4505
|
id: field,
|
|
4486
4506
|
...!virtual ? { accessorKey: field } : {},
|
|
4487
4507
|
size: width ?? DATA_TABLE_COLUMN_SIZE,
|
|
4488
|
-
...
|
|
4489
|
-
...
|
|
4508
|
+
...minResizeWidth != null ? { minSize: minResizeWidth } : {},
|
|
4509
|
+
...maxResizeWidth != null ? { maxSize: maxResizeWidth } : {},
|
|
4490
4510
|
...resizable === false ? { enableResizing: false } : {},
|
|
4491
4511
|
header: sortable ? () => /* @__PURE__ */ jsx8(
|
|
4492
4512
|
SortableHeader,
|
|
@@ -4515,6 +4535,8 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
4515
4535
|
cellRender: render,
|
|
4516
4536
|
frozen,
|
|
4517
4537
|
reorderable,
|
|
4538
|
+
minWidth,
|
|
4539
|
+
maxWidth,
|
|
4518
4540
|
className,
|
|
4519
4541
|
headerClassName
|
|
4520
4542
|
}
|
package/dist/core.cjs
CHANGED
|
@@ -3122,15 +3122,29 @@ function ResolvedTableCell({
|
|
|
3122
3122
|
|
|
3123
3123
|
// src/components/ui/table/features/column-resize/columnResize.ts
|
|
3124
3124
|
function getColumnSizeStyle(size, options) {
|
|
3125
|
-
const { force = false, lockMax = false } = options ?? {};
|
|
3126
|
-
if (
|
|
3125
|
+
const { force = false, lockMax = false, minWidth, maxWidth } = options ?? {};
|
|
3126
|
+
if (lockMax) {
|
|
3127
|
+
return {
|
|
3128
|
+
width: size,
|
|
3129
|
+
minWidth: size,
|
|
3130
|
+
maxWidth: size
|
|
3131
|
+
};
|
|
3132
|
+
}
|
|
3133
|
+
const hasExplicitSize = force || size !== DATA_TABLE_COLUMN_SIZE;
|
|
3134
|
+
if (!hasExplicitSize && minWidth == null && maxWidth == null) {
|
|
3127
3135
|
return void 0;
|
|
3128
3136
|
}
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
}
|
|
3137
|
+
const style = {};
|
|
3138
|
+
if (hasExplicitSize) {
|
|
3139
|
+
style.width = size;
|
|
3140
|
+
style.minWidth = minWidth ?? size;
|
|
3141
|
+
} else if (minWidth != null) {
|
|
3142
|
+
style.minWidth = minWidth;
|
|
3143
|
+
}
|
|
3144
|
+
if (maxWidth != null) {
|
|
3145
|
+
style.maxWidth = maxWidth;
|
|
3146
|
+
}
|
|
3147
|
+
return style;
|
|
3134
3148
|
}
|
|
3135
3149
|
|
|
3136
3150
|
// src/components/ui/table/features/column-reorder/useColumnReorder.ts
|
package/dist/core.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { W as CellEditType, c as CellRenderer, C as CellKind, a as CellRenderContext, i as DataTableClassNames, R as RowSelectionMode, g as ColumnFreezeOffset, p as SearchResultItem, q as SearchStatus, l as DataTableProps, k as DataTableLabels, j as DataTableCopyActions, P as PasteMode, o as RowsPastePayload } from './types-
|
|
2
|
-
export { B as BuiltinCellKind, b as CellRenderFn, d as ColumnFreezeColumnInput, e as ColumnFreezeEdgeSide, f as ColumnFreezeMeta, h as ColumnFreezeSide, D as DEFAULT_DATA_TABLE_LABELS, I as INLINE_SEARCH_MAX_RESULTS, S as SearchCorpusRow, t as buildColumnFreezeOffsets, u as buildFlatSearchCorpus, v as buildSearchMatchKey, w as buildSearchMatchKeys, x as buildTreeSearchCorpus, y as cellValueToSearchText, z as collectAncestorKeysToExpand, A as collectSearchMatchesInRange, E as createSearchRegex, F as escapeSearchRegex, G as formatSearchResultLabel, H as getColumnFreezeEdgeAttr, J as getColumnFreezeStyle, K as mapSearchResultToVisibleItem, L as mapSearchResultsToVisibleKeys, M as nextSearchIndex, N as nextSearchStride, O as previousSearchIndex, Q as resolveColumnFreezeSide, U as resolveDataTableLabels, V as resolveHeaderFreezeOffset } from './types-
|
|
1
|
+
import { W as CellEditType, c as CellRenderer, C as CellKind, a as CellRenderContext, i as DataTableClassNames, R as RowSelectionMode, g as ColumnFreezeOffset, p as SearchResultItem, q as SearchStatus, l as DataTableProps, k as DataTableLabels, j as DataTableCopyActions, P as PasteMode, o as RowsPastePayload } from './types-CnsQ8GZb.cjs';
|
|
2
|
+
export { B as BuiltinCellKind, b as CellRenderFn, d as ColumnFreezeColumnInput, e as ColumnFreezeEdgeSide, f as ColumnFreezeMeta, h as ColumnFreezeSide, D as DEFAULT_DATA_TABLE_LABELS, I as INLINE_SEARCH_MAX_RESULTS, S as SearchCorpusRow, t as buildColumnFreezeOffsets, u as buildFlatSearchCorpus, v as buildSearchMatchKey, w as buildSearchMatchKeys, x as buildTreeSearchCorpus, y as cellValueToSearchText, z as collectAncestorKeysToExpand, A as collectSearchMatchesInRange, E as createSearchRegex, F as escapeSearchRegex, G as formatSearchResultLabel, H as getColumnFreezeEdgeAttr, J as getColumnFreezeStyle, K as mapSearchResultToVisibleItem, L as mapSearchResultsToVisibleKeys, M as nextSearchIndex, N as nextSearchStride, O as previousSearchIndex, Q as resolveColumnFreezeSide, U as resolveDataTableLabels, V as resolveHeaderFreezeOffset } from './types-CnsQ8GZb.cjs';
|
|
3
3
|
import { Row, ColumnDef, CellContext, Table, Cell, ColumnOrderState, Updater, RowSelectionState } from '@tanstack/react-table';
|
|
4
4
|
export { ColumnDef, ColumnOrderState, ColumnResizeMode, ColumnSizingState, RowSelectionState } from '@tanstack/react-table';
|
|
5
5
|
import { Virtualizer, VirtualItem } from '@tanstack/react-virtual';
|
|
@@ -340,11 +340,16 @@ declare function ResolvedTableCell<T extends Record<string, unknown>>({ info, }:
|
|
|
340
340
|
info: CellContext<T, unknown>;
|
|
341
341
|
}): react.ReactNode;
|
|
342
342
|
|
|
343
|
-
|
|
344
|
-
declare function getColumnSizeStyle(size: number, options?: {
|
|
343
|
+
type ColumnSizeStyleOptions = {
|
|
345
344
|
force?: boolean;
|
|
346
345
|
lockMax?: boolean;
|
|
347
|
-
|
|
346
|
+
/** CSS min-width for the cell. Ignored when `lockMax` is on. */
|
|
347
|
+
minWidth?: number;
|
|
348
|
+
/** CSS max-width for the cell. Ignored when `lockMax` is on. */
|
|
349
|
+
maxWidth?: number;
|
|
350
|
+
};
|
|
351
|
+
/** Width styles for header/body cells when column sizing is active. */
|
|
352
|
+
declare function getColumnSizeStyle(size: number, options?: ColumnSizeStyleOptions): CSSProperties | undefined;
|
|
348
353
|
|
|
349
354
|
type ColumnDropEdge = "before" | "after";
|
|
350
355
|
declare function collectLeafColumnIds<T>(columns: readonly ColumnDef<T, unknown>[]): string[];
|
package/dist/core.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { W as CellEditType, c as CellRenderer, C as CellKind, a as CellRenderContext, i as DataTableClassNames, R as RowSelectionMode, g as ColumnFreezeOffset, p as SearchResultItem, q as SearchStatus, l as DataTableProps, k as DataTableLabels, j as DataTableCopyActions, P as PasteMode, o as RowsPastePayload } from './types-
|
|
2
|
-
export { B as BuiltinCellKind, b as CellRenderFn, d as ColumnFreezeColumnInput, e as ColumnFreezeEdgeSide, f as ColumnFreezeMeta, h as ColumnFreezeSide, D as DEFAULT_DATA_TABLE_LABELS, I as INLINE_SEARCH_MAX_RESULTS, S as SearchCorpusRow, t as buildColumnFreezeOffsets, u as buildFlatSearchCorpus, v as buildSearchMatchKey, w as buildSearchMatchKeys, x as buildTreeSearchCorpus, y as cellValueToSearchText, z as collectAncestorKeysToExpand, A as collectSearchMatchesInRange, E as createSearchRegex, F as escapeSearchRegex, G as formatSearchResultLabel, H as getColumnFreezeEdgeAttr, J as getColumnFreezeStyle, K as mapSearchResultToVisibleItem, L as mapSearchResultsToVisibleKeys, M as nextSearchIndex, N as nextSearchStride, O as previousSearchIndex, Q as resolveColumnFreezeSide, U as resolveDataTableLabels, V as resolveHeaderFreezeOffset } from './types-
|
|
1
|
+
import { W as CellEditType, c as CellRenderer, C as CellKind, a as CellRenderContext, i as DataTableClassNames, R as RowSelectionMode, g as ColumnFreezeOffset, p as SearchResultItem, q as SearchStatus, l as DataTableProps, k as DataTableLabels, j as DataTableCopyActions, P as PasteMode, o as RowsPastePayload } from './types-CnsQ8GZb.js';
|
|
2
|
+
export { B as BuiltinCellKind, b as CellRenderFn, d as ColumnFreezeColumnInput, e as ColumnFreezeEdgeSide, f as ColumnFreezeMeta, h as ColumnFreezeSide, D as DEFAULT_DATA_TABLE_LABELS, I as INLINE_SEARCH_MAX_RESULTS, S as SearchCorpusRow, t as buildColumnFreezeOffsets, u as buildFlatSearchCorpus, v as buildSearchMatchKey, w as buildSearchMatchKeys, x as buildTreeSearchCorpus, y as cellValueToSearchText, z as collectAncestorKeysToExpand, A as collectSearchMatchesInRange, E as createSearchRegex, F as escapeSearchRegex, G as formatSearchResultLabel, H as getColumnFreezeEdgeAttr, J as getColumnFreezeStyle, K as mapSearchResultToVisibleItem, L as mapSearchResultsToVisibleKeys, M as nextSearchIndex, N as nextSearchStride, O as previousSearchIndex, Q as resolveColumnFreezeSide, U as resolveDataTableLabels, V as resolveHeaderFreezeOffset } from './types-CnsQ8GZb.js';
|
|
3
3
|
import { Row, ColumnDef, CellContext, Table, Cell, ColumnOrderState, Updater, RowSelectionState } from '@tanstack/react-table';
|
|
4
4
|
export { ColumnDef, ColumnOrderState, ColumnResizeMode, ColumnSizingState, RowSelectionState } from '@tanstack/react-table';
|
|
5
5
|
import { Virtualizer, VirtualItem } from '@tanstack/react-virtual';
|
|
@@ -340,11 +340,16 @@ declare function ResolvedTableCell<T extends Record<string, unknown>>({ info, }:
|
|
|
340
340
|
info: CellContext<T, unknown>;
|
|
341
341
|
}): react.ReactNode;
|
|
342
342
|
|
|
343
|
-
|
|
344
|
-
declare function getColumnSizeStyle(size: number, options?: {
|
|
343
|
+
type ColumnSizeStyleOptions = {
|
|
345
344
|
force?: boolean;
|
|
346
345
|
lockMax?: boolean;
|
|
347
|
-
|
|
346
|
+
/** CSS min-width for the cell. Ignored when `lockMax` is on. */
|
|
347
|
+
minWidth?: number;
|
|
348
|
+
/** CSS max-width for the cell. Ignored when `lockMax` is on. */
|
|
349
|
+
maxWidth?: number;
|
|
350
|
+
};
|
|
351
|
+
/** Width styles for header/body cells when column sizing is active. */
|
|
352
|
+
declare function getColumnSizeStyle(size: number, options?: ColumnSizeStyleOptions): CSSProperties | undefined;
|
|
348
353
|
|
|
349
354
|
type ColumnDropEdge = "before" | "after";
|
|
350
355
|
declare function collectLeafColumnIds<T>(columns: readonly ColumnDef<T, unknown>[]): string[];
|
package/dist/core.js
CHANGED
|
@@ -3036,15 +3036,29 @@ function ResolvedTableCell({
|
|
|
3036
3036
|
|
|
3037
3037
|
// src/components/ui/table/features/column-resize/columnResize.ts
|
|
3038
3038
|
function getColumnSizeStyle(size, options) {
|
|
3039
|
-
const { force = false, lockMax = false } = options ?? {};
|
|
3040
|
-
if (
|
|
3039
|
+
const { force = false, lockMax = false, minWidth, maxWidth } = options ?? {};
|
|
3040
|
+
if (lockMax) {
|
|
3041
|
+
return {
|
|
3042
|
+
width: size,
|
|
3043
|
+
minWidth: size,
|
|
3044
|
+
maxWidth: size
|
|
3045
|
+
};
|
|
3046
|
+
}
|
|
3047
|
+
const hasExplicitSize = force || size !== DATA_TABLE_COLUMN_SIZE;
|
|
3048
|
+
if (!hasExplicitSize && minWidth == null && maxWidth == null) {
|
|
3041
3049
|
return void 0;
|
|
3042
3050
|
}
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
}
|
|
3051
|
+
const style = {};
|
|
3052
|
+
if (hasExplicitSize) {
|
|
3053
|
+
style.width = size;
|
|
3054
|
+
style.minWidth = minWidth ?? size;
|
|
3055
|
+
} else if (minWidth != null) {
|
|
3056
|
+
style.minWidth = minWidth;
|
|
3057
|
+
}
|
|
3058
|
+
if (maxWidth != null) {
|
|
3059
|
+
style.maxWidth = maxWidth;
|
|
3060
|
+
}
|
|
3061
|
+
return style;
|
|
3048
3062
|
}
|
|
3049
3063
|
|
|
3050
3064
|
// src/components/ui/table/features/column-reorder/useColumnReorder.ts
|
package/dist/index.cjs
CHANGED
|
@@ -3146,15 +3146,29 @@ function ResolvedTableCell({
|
|
|
3146
3146
|
|
|
3147
3147
|
// src/components/ui/table/features/column-resize/columnResize.ts
|
|
3148
3148
|
function getColumnSizeStyle(size, options) {
|
|
3149
|
-
const { force = false, lockMax = false } = options ?? {};
|
|
3150
|
-
if (
|
|
3149
|
+
const { force = false, lockMax = false, minWidth, maxWidth } = options ?? {};
|
|
3150
|
+
if (lockMax) {
|
|
3151
|
+
return {
|
|
3152
|
+
width: size,
|
|
3153
|
+
minWidth: size,
|
|
3154
|
+
maxWidth: size
|
|
3155
|
+
};
|
|
3156
|
+
}
|
|
3157
|
+
const hasExplicitSize = force || size !== DATA_TABLE_COLUMN_SIZE;
|
|
3158
|
+
if (!hasExplicitSize && minWidth == null && maxWidth == null) {
|
|
3151
3159
|
return void 0;
|
|
3152
3160
|
}
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
}
|
|
3161
|
+
const style = {};
|
|
3162
|
+
if (hasExplicitSize) {
|
|
3163
|
+
style.width = size;
|
|
3164
|
+
style.minWidth = minWidth ?? size;
|
|
3165
|
+
} else if (minWidth != null) {
|
|
3166
|
+
style.minWidth = minWidth;
|
|
3167
|
+
}
|
|
3168
|
+
if (maxWidth != null) {
|
|
3169
|
+
style.maxWidth = maxWidth;
|
|
3170
|
+
}
|
|
3171
|
+
return style;
|
|
3158
3172
|
}
|
|
3159
3173
|
|
|
3160
3174
|
// src/components/ui/table/features/column-reorder/useColumnReorder.ts
|
|
@@ -3758,7 +3772,9 @@ function DataTableRow({
|
|
|
3758
3772
|
const hasSelectionEdges = hasCellSelectionEdges(selectionEdgeStyle);
|
|
3759
3773
|
const sizeStyle = getColumnSizeStyle(cell.column.getSize(), {
|
|
3760
3774
|
force: enableColumnResize,
|
|
3761
|
-
lockMax: enableColumnResize
|
|
3775
|
+
lockMax: enableColumnResize,
|
|
3776
|
+
minWidth: meta?.minWidth,
|
|
3777
|
+
maxWidth: meta?.maxWidth
|
|
3762
3778
|
});
|
|
3763
3779
|
const freezeOffset = enableColumnFreeze ? freezeOffsets.get(columnId) : void 0;
|
|
3764
3780
|
const freezeStyle = getColumnFreezeStyle(freezeOffset);
|
|
@@ -4379,7 +4395,9 @@ function DataTable({
|
|
|
4379
4395
|
const canResize = enableColumnResize && header.column.getCanResize();
|
|
4380
4396
|
const sizeStyle = getColumnSizeStyle(header.getSize(), {
|
|
4381
4397
|
force: enableColumnResize,
|
|
4382
|
-
lockMax: enableColumnResize
|
|
4398
|
+
lockMax: enableColumnResize,
|
|
4399
|
+
minWidth: header.column.columnDef.meta?.minWidth,
|
|
4400
|
+
maxWidth: header.column.columnDef.meta?.maxWidth
|
|
4383
4401
|
});
|
|
4384
4402
|
const freezeOffset = enableColumnFreeze ? resolveHeaderFreezeOffset(header.column, freezeOffsets) : void 0;
|
|
4385
4403
|
const freezeStyle = getColumnFreezeStyle(freezeOffset, {
|
|
@@ -4585,6 +4603,8 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
4585
4603
|
width,
|
|
4586
4604
|
minWidth,
|
|
4587
4605
|
maxWidth,
|
|
4606
|
+
minResizeWidth,
|
|
4607
|
+
maxResizeWidth,
|
|
4588
4608
|
resizable,
|
|
4589
4609
|
reorderable,
|
|
4590
4610
|
frozen,
|
|
@@ -4605,8 +4625,8 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
4605
4625
|
id: field,
|
|
4606
4626
|
...!virtual ? { accessorKey: field } : {},
|
|
4607
4627
|
size: width ?? DATA_TABLE_COLUMN_SIZE,
|
|
4608
|
-
...
|
|
4609
|
-
...
|
|
4628
|
+
...minResizeWidth != null ? { minSize: minResizeWidth } : {},
|
|
4629
|
+
...maxResizeWidth != null ? { maxSize: maxResizeWidth } : {},
|
|
4610
4630
|
...resizable === false ? { enableResizing: false } : {},
|
|
4611
4631
|
header: sortable ? () => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
4612
4632
|
SortableHeader,
|
|
@@ -4635,6 +4655,8 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
4635
4655
|
cellRender: render,
|
|
4636
4656
|
frozen,
|
|
4637
4657
|
reorderable,
|
|
4658
|
+
minWidth,
|
|
4659
|
+
maxWidth,
|
|
4638
4660
|
className,
|
|
4639
4661
|
headerClassName
|
|
4640
4662
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { B as BuiltinCellKind, C as CellKind, a as CellRenderContext, b as CellRenderFn, c as CellRenderer, d as ColumnFreezeColumnInput, e as ColumnFreezeEdgeSide, f as ColumnFreezeMeta, g as ColumnFreezeOffset, h as ColumnFreezeSide, D as DEFAULT_DATA_TABLE_LABELS, i as DataTableClassNames, j as DataTableCopyActions, k as DataTableLabels, l as DataTableProps, m as DataTableScrollSlotProps, n as DataTableSlots, I as INLINE_SEARCH_MAX_RESULTS, P as PasteMode, R as RowSelectionMode, o as RowsPastePayload, S as SearchCorpusRow, p as SearchResultItem, q as SearchStatus, T as TableColumnGroupProps, r as TableColumnProps, s as TableProps, t as buildColumnFreezeOffsets, u as buildFlatSearchCorpus, v as buildSearchMatchKey, w as buildSearchMatchKeys, x as buildTreeSearchCorpus, y as cellValueToSearchText, z as collectAncestorKeysToExpand, A as collectSearchMatchesInRange, E as createSearchRegex, F as escapeSearchRegex, G as formatSearchResultLabel, H as getColumnFreezeEdgeAttr, J as getColumnFreezeStyle, K as mapSearchResultToVisibleItem, L as mapSearchResultsToVisibleKeys, M as nextSearchIndex, N as nextSearchStride, O as previousSearchIndex, Q as resolveColumnFreezeSide, U as resolveDataTableLabels, V as resolveHeaderFreezeOffset } from './types-
|
|
1
|
+
export { B as BuiltinCellKind, C as CellKind, a as CellRenderContext, b as CellRenderFn, c as CellRenderer, d as ColumnFreezeColumnInput, e as ColumnFreezeEdgeSide, f as ColumnFreezeMeta, g as ColumnFreezeOffset, h as ColumnFreezeSide, D as DEFAULT_DATA_TABLE_LABELS, i as DataTableClassNames, j as DataTableCopyActions, k as DataTableLabels, l as DataTableProps, m as DataTableScrollSlotProps, n as DataTableSlots, I as INLINE_SEARCH_MAX_RESULTS, P as PasteMode, R as RowSelectionMode, o as RowsPastePayload, S as SearchCorpusRow, p as SearchResultItem, q as SearchStatus, T as TableColumnGroupProps, r as TableColumnProps, s as TableProps, t as buildColumnFreezeOffsets, u as buildFlatSearchCorpus, v as buildSearchMatchKey, w as buildSearchMatchKeys, x as buildTreeSearchCorpus, y as cellValueToSearchText, z as collectAncestorKeysToExpand, A as collectSearchMatchesInRange, E as createSearchRegex, F as escapeSearchRegex, G as formatSearchResultLabel, H as getColumnFreezeEdgeAttr, J as getColumnFreezeStyle, K as mapSearchResultToVisibleItem, L as mapSearchResultsToVisibleKeys, M as nextSearchIndex, N as nextSearchStride, O as previousSearchIndex, Q as resolveColumnFreezeSide, U as resolveDataTableLabels, V as resolveHeaderFreezeOffset } from './types-CnsQ8GZb.cjs';
|
|
2
2
|
export { BUILTIN_CELL_RENDERERS, CELL_SELECTION_EDGES_CLASS, CellContextWithUpdate, CellRendererRegistry, CellSelectionBounds, ColumnDropEdge, ColumnRowSpanMap, CopyRowEntry, CopySelectionMode, DEFAULT_TREE_CHILDREN_FIELD, DEFAULT_TREE_ID_FIELD, DEFAULT_TREE_PARENT_ID_FIELD, DEFAULT_TREE_QTY_FIELD, DragState, EditingCell, ResolvedTableCell, RowSpanColumnSpec, RowSpanInfo, TreeRow, UseConvertTreeDataParams, UseGlideTableOptions, UseGlideTableResult, UseInlineSearchOptions, UseInlineSearchResult, applyCellEdit, applyFillData, applyLeafColumnOrder, applySelectionUpdater, buildColumnRowSpanMap, buildRowsPastePayload, canExpandRow, collectCopyRowEntries, collectCopyRows, collectFillChanges, collectLeafColumnIds, collectRowSpanColumns, commitCellValue, createCellRendererRegistry, flattenSubtreeRows, formatCellValue, formatDefaultCellValue, getCellEditDraftValue, getCellSelectionEdgeStyle, getColumnEditType, getColumnSizeStyle, getRowIndexInMergedCell, hasCellSelectionEdges, isCellInSelection, isColumnEditable, isEditablePasteTarget, measureMergedSpanRowHeights, moveColumnIds, parseCellEditValue, parseClipboardTSV, parseClipboardTSVWithDepths, resolveCellRenderer, resolveDropEdge, resolveLeafColumnOrder, resolvePasteColumnIds, resolveRowSelection, resolveRowSpanAt, rowRangeToHeightRatios, serializeCopyRowsToTSV, serializeSelectionToTSV, toggleExpandedRowId, useCellEdit, useCellSelection, useColumnReorder, useConvertTreeData, useGlideTable, useInlineSearch, withCellUpdate, writeSelectionToClipboard } from './core.cjs';
|
|
3
3
|
export { DataTable, Table, TableCompoundComponent, createTable } from './compound.cjs';
|
|
4
4
|
export { ColumnDef, ColumnOrderState, ColumnResizeMode, ColumnSizingState, RowSelectionState } from '@tanstack/react-table';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { B as BuiltinCellKind, C as CellKind, a as CellRenderContext, b as CellRenderFn, c as CellRenderer, d as ColumnFreezeColumnInput, e as ColumnFreezeEdgeSide, f as ColumnFreezeMeta, g as ColumnFreezeOffset, h as ColumnFreezeSide, D as DEFAULT_DATA_TABLE_LABELS, i as DataTableClassNames, j as DataTableCopyActions, k as DataTableLabels, l as DataTableProps, m as DataTableScrollSlotProps, n as DataTableSlots, I as INLINE_SEARCH_MAX_RESULTS, P as PasteMode, R as RowSelectionMode, o as RowsPastePayload, S as SearchCorpusRow, p as SearchResultItem, q as SearchStatus, T as TableColumnGroupProps, r as TableColumnProps, s as TableProps, t as buildColumnFreezeOffsets, u as buildFlatSearchCorpus, v as buildSearchMatchKey, w as buildSearchMatchKeys, x as buildTreeSearchCorpus, y as cellValueToSearchText, z as collectAncestorKeysToExpand, A as collectSearchMatchesInRange, E as createSearchRegex, F as escapeSearchRegex, G as formatSearchResultLabel, H as getColumnFreezeEdgeAttr, J as getColumnFreezeStyle, K as mapSearchResultToVisibleItem, L as mapSearchResultsToVisibleKeys, M as nextSearchIndex, N as nextSearchStride, O as previousSearchIndex, Q as resolveColumnFreezeSide, U as resolveDataTableLabels, V as resolveHeaderFreezeOffset } from './types-
|
|
1
|
+
export { B as BuiltinCellKind, C as CellKind, a as CellRenderContext, b as CellRenderFn, c as CellRenderer, d as ColumnFreezeColumnInput, e as ColumnFreezeEdgeSide, f as ColumnFreezeMeta, g as ColumnFreezeOffset, h as ColumnFreezeSide, D as DEFAULT_DATA_TABLE_LABELS, i as DataTableClassNames, j as DataTableCopyActions, k as DataTableLabels, l as DataTableProps, m as DataTableScrollSlotProps, n as DataTableSlots, I as INLINE_SEARCH_MAX_RESULTS, P as PasteMode, R as RowSelectionMode, o as RowsPastePayload, S as SearchCorpusRow, p as SearchResultItem, q as SearchStatus, T as TableColumnGroupProps, r as TableColumnProps, s as TableProps, t as buildColumnFreezeOffsets, u as buildFlatSearchCorpus, v as buildSearchMatchKey, w as buildSearchMatchKeys, x as buildTreeSearchCorpus, y as cellValueToSearchText, z as collectAncestorKeysToExpand, A as collectSearchMatchesInRange, E as createSearchRegex, F as escapeSearchRegex, G as formatSearchResultLabel, H as getColumnFreezeEdgeAttr, J as getColumnFreezeStyle, K as mapSearchResultToVisibleItem, L as mapSearchResultsToVisibleKeys, M as nextSearchIndex, N as nextSearchStride, O as previousSearchIndex, Q as resolveColumnFreezeSide, U as resolveDataTableLabels, V as resolveHeaderFreezeOffset } from './types-CnsQ8GZb.js';
|
|
2
2
|
export { BUILTIN_CELL_RENDERERS, CELL_SELECTION_EDGES_CLASS, CellContextWithUpdate, CellRendererRegistry, CellSelectionBounds, ColumnDropEdge, ColumnRowSpanMap, CopyRowEntry, CopySelectionMode, DEFAULT_TREE_CHILDREN_FIELD, DEFAULT_TREE_ID_FIELD, DEFAULT_TREE_PARENT_ID_FIELD, DEFAULT_TREE_QTY_FIELD, DragState, EditingCell, ResolvedTableCell, RowSpanColumnSpec, RowSpanInfo, TreeRow, UseConvertTreeDataParams, UseGlideTableOptions, UseGlideTableResult, UseInlineSearchOptions, UseInlineSearchResult, applyCellEdit, applyFillData, applyLeafColumnOrder, applySelectionUpdater, buildColumnRowSpanMap, buildRowsPastePayload, canExpandRow, collectCopyRowEntries, collectCopyRows, collectFillChanges, collectLeafColumnIds, collectRowSpanColumns, commitCellValue, createCellRendererRegistry, flattenSubtreeRows, formatCellValue, formatDefaultCellValue, getCellEditDraftValue, getCellSelectionEdgeStyle, getColumnEditType, getColumnSizeStyle, getRowIndexInMergedCell, hasCellSelectionEdges, isCellInSelection, isColumnEditable, isEditablePasteTarget, measureMergedSpanRowHeights, moveColumnIds, parseCellEditValue, parseClipboardTSV, parseClipboardTSVWithDepths, resolveCellRenderer, resolveDropEdge, resolveLeafColumnOrder, resolvePasteColumnIds, resolveRowSelection, resolveRowSpanAt, rowRangeToHeightRatios, serializeCopyRowsToTSV, serializeSelectionToTSV, toggleExpandedRowId, useCellEdit, useCellSelection, useColumnReorder, useConvertTreeData, useGlideTable, useInlineSearch, withCellUpdate, writeSelectionToClipboard } from './core.js';
|
|
3
3
|
export { DataTable, Table, TableCompoundComponent, createTable } from './compound.js';
|
|
4
4
|
export { ColumnDef, ColumnOrderState, ColumnResizeMode, ColumnSizingState, RowSelectionState } from '@tanstack/react-table';
|
package/dist/index.js
CHANGED
|
@@ -3057,15 +3057,29 @@ function ResolvedTableCell({
|
|
|
3057
3057
|
|
|
3058
3058
|
// src/components/ui/table/features/column-resize/columnResize.ts
|
|
3059
3059
|
function getColumnSizeStyle(size, options) {
|
|
3060
|
-
const { force = false, lockMax = false } = options ?? {};
|
|
3061
|
-
if (
|
|
3060
|
+
const { force = false, lockMax = false, minWidth, maxWidth } = options ?? {};
|
|
3061
|
+
if (lockMax) {
|
|
3062
|
+
return {
|
|
3063
|
+
width: size,
|
|
3064
|
+
minWidth: size,
|
|
3065
|
+
maxWidth: size
|
|
3066
|
+
};
|
|
3067
|
+
}
|
|
3068
|
+
const hasExplicitSize = force || size !== DATA_TABLE_COLUMN_SIZE;
|
|
3069
|
+
if (!hasExplicitSize && minWidth == null && maxWidth == null) {
|
|
3062
3070
|
return void 0;
|
|
3063
3071
|
}
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
}
|
|
3072
|
+
const style = {};
|
|
3073
|
+
if (hasExplicitSize) {
|
|
3074
|
+
style.width = size;
|
|
3075
|
+
style.minWidth = minWidth ?? size;
|
|
3076
|
+
} else if (minWidth != null) {
|
|
3077
|
+
style.minWidth = minWidth;
|
|
3078
|
+
}
|
|
3079
|
+
if (maxWidth != null) {
|
|
3080
|
+
style.maxWidth = maxWidth;
|
|
3081
|
+
}
|
|
3082
|
+
return style;
|
|
3069
3083
|
}
|
|
3070
3084
|
|
|
3071
3085
|
// src/components/ui/table/features/column-reorder/useColumnReorder.ts
|
|
@@ -3674,7 +3688,9 @@ function DataTableRow({
|
|
|
3674
3688
|
const hasSelectionEdges = hasCellSelectionEdges(selectionEdgeStyle);
|
|
3675
3689
|
const sizeStyle = getColumnSizeStyle(cell.column.getSize(), {
|
|
3676
3690
|
force: enableColumnResize,
|
|
3677
|
-
lockMax: enableColumnResize
|
|
3691
|
+
lockMax: enableColumnResize,
|
|
3692
|
+
minWidth: meta?.minWidth,
|
|
3693
|
+
maxWidth: meta?.maxWidth
|
|
3678
3694
|
});
|
|
3679
3695
|
const freezeOffset = enableColumnFreeze ? freezeOffsets.get(columnId) : void 0;
|
|
3680
3696
|
const freezeStyle = getColumnFreezeStyle(freezeOffset);
|
|
@@ -4295,7 +4311,9 @@ function DataTable({
|
|
|
4295
4311
|
const canResize = enableColumnResize && header.column.getCanResize();
|
|
4296
4312
|
const sizeStyle = getColumnSizeStyle(header.getSize(), {
|
|
4297
4313
|
force: enableColumnResize,
|
|
4298
|
-
lockMax: enableColumnResize
|
|
4314
|
+
lockMax: enableColumnResize,
|
|
4315
|
+
minWidth: header.column.columnDef.meta?.minWidth,
|
|
4316
|
+
maxWidth: header.column.columnDef.meta?.maxWidth
|
|
4299
4317
|
});
|
|
4300
4318
|
const freezeOffset = enableColumnFreeze ? resolveHeaderFreezeOffset(header.column, freezeOffsets) : void 0;
|
|
4301
4319
|
const freezeStyle = getColumnFreezeStyle(freezeOffset, {
|
|
@@ -4501,6 +4519,8 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
4501
4519
|
width,
|
|
4502
4520
|
minWidth,
|
|
4503
4521
|
maxWidth,
|
|
4522
|
+
minResizeWidth,
|
|
4523
|
+
maxResizeWidth,
|
|
4504
4524
|
resizable,
|
|
4505
4525
|
reorderable,
|
|
4506
4526
|
frozen,
|
|
@@ -4521,8 +4541,8 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
4521
4541
|
id: field,
|
|
4522
4542
|
...!virtual ? { accessorKey: field } : {},
|
|
4523
4543
|
size: width ?? DATA_TABLE_COLUMN_SIZE,
|
|
4524
|
-
...
|
|
4525
|
-
...
|
|
4544
|
+
...minResizeWidth != null ? { minSize: minResizeWidth } : {},
|
|
4545
|
+
...maxResizeWidth != null ? { maxSize: maxResizeWidth } : {},
|
|
4526
4546
|
...resizable === false ? { enableResizing: false } : {},
|
|
4527
4547
|
header: sortable ? () => /* @__PURE__ */ jsx8(
|
|
4528
4548
|
SortableHeader,
|
|
@@ -4551,6 +4571,8 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
4551
4571
|
cellRender: render,
|
|
4552
4572
|
frozen,
|
|
4553
4573
|
reorderable,
|
|
4574
|
+
minWidth,
|
|
4575
|
+
maxWidth,
|
|
4554
4576
|
className,
|
|
4555
4577
|
headerClassName
|
|
4556
4578
|
}
|
|
@@ -220,6 +220,10 @@ declare module "@tanstack/react-table" {
|
|
|
220
220
|
* Defaults to true.
|
|
221
221
|
*/
|
|
222
222
|
reorderable?: boolean;
|
|
223
|
+
/** CSS min-width for header/body cells. Independent of column resize. */
|
|
224
|
+
minWidth?: number;
|
|
225
|
+
/** CSS max-width for header/body cells. Independent of column resize. */
|
|
226
|
+
maxWidth?: number;
|
|
223
227
|
}
|
|
224
228
|
interface CellContext<TData, TValue> {
|
|
225
229
|
/**
|
|
@@ -545,10 +549,20 @@ type TableColumnProps<T extends Record<string, unknown>, K extends string = keyo
|
|
|
545
549
|
sortable?: boolean;
|
|
546
550
|
/** Initial / default column width in px (TanStack `size`) */
|
|
547
551
|
width?: number;
|
|
548
|
-
/**
|
|
552
|
+
/**
|
|
553
|
+
* CSS min-width for this column's cells.
|
|
554
|
+
* Independent of `enableColumnResize` / `minResizeWidth`.
|
|
555
|
+
*/
|
|
549
556
|
minWidth?: number;
|
|
550
|
-
/**
|
|
557
|
+
/**
|
|
558
|
+
* CSS max-width for this column's cells.
|
|
559
|
+
* Independent of `enableColumnResize` / `maxResizeWidth`.
|
|
560
|
+
*/
|
|
551
561
|
maxWidth?: number;
|
|
562
|
+
/** Minimum drag-resize width in px. Defaults to the table min when omitted */
|
|
563
|
+
minResizeWidth?: number;
|
|
564
|
+
/** Maximum drag-resize width in px. Defaults to the table max when omitted */
|
|
565
|
+
maxResizeWidth?: number;
|
|
552
566
|
/**
|
|
553
567
|
* When false, this column cannot be resized even if `enableColumnResize` is on.
|
|
554
568
|
* Defaults to true.
|
|
@@ -220,6 +220,10 @@ declare module "@tanstack/react-table" {
|
|
|
220
220
|
* Defaults to true.
|
|
221
221
|
*/
|
|
222
222
|
reorderable?: boolean;
|
|
223
|
+
/** CSS min-width for header/body cells. Independent of column resize. */
|
|
224
|
+
minWidth?: number;
|
|
225
|
+
/** CSS max-width for header/body cells. Independent of column resize. */
|
|
226
|
+
maxWidth?: number;
|
|
223
227
|
}
|
|
224
228
|
interface CellContext<TData, TValue> {
|
|
225
229
|
/**
|
|
@@ -545,10 +549,20 @@ type TableColumnProps<T extends Record<string, unknown>, K extends string = keyo
|
|
|
545
549
|
sortable?: boolean;
|
|
546
550
|
/** Initial / default column width in px (TanStack `size`) */
|
|
547
551
|
width?: number;
|
|
548
|
-
/**
|
|
552
|
+
/**
|
|
553
|
+
* CSS min-width for this column's cells.
|
|
554
|
+
* Independent of `enableColumnResize` / `minResizeWidth`.
|
|
555
|
+
*/
|
|
549
556
|
minWidth?: number;
|
|
550
|
-
/**
|
|
557
|
+
/**
|
|
558
|
+
* CSS max-width for this column's cells.
|
|
559
|
+
* Independent of `enableColumnResize` / `maxResizeWidth`.
|
|
560
|
+
*/
|
|
551
561
|
maxWidth?: number;
|
|
562
|
+
/** Minimum drag-resize width in px. Defaults to the table min when omitted */
|
|
563
|
+
minResizeWidth?: number;
|
|
564
|
+
/** Maximum drag-resize width in px. Defaults to the table max when omitted */
|
|
565
|
+
maxResizeWidth?: number;
|
|
552
566
|
/**
|
|
553
567
|
* When false, this column cannot be resized even if `enableColumnResize` is on.
|
|
554
568
|
* Defaults to true.
|