react-glide-table 1.1.6 → 1.1.8
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 +27 -4
- package/dist/compound.d.cts +2 -2
- package/dist/compound.d.ts +2 -2
- package/dist/compound.js +27 -4
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/index.cjs +27 -4
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +27 -4
- package/dist/{types-DOLnknDe.d.cts → types-Ce4qepIU.d.cts} +6 -1
- package/dist/{types-DOLnknDe.d.ts → types-Ce4qepIU.d.ts} +6 -1
- package/package.json +1 -1
package/dist/compound.cjs
CHANGED
|
@@ -914,6 +914,7 @@ function DataTableRow({
|
|
|
914
914
|
const meta = cell.column.columnDef.meta;
|
|
915
915
|
const align = meta?.align ?? "center";
|
|
916
916
|
const cellClassName = meta?.className;
|
|
917
|
+
const editInputProps = meta?.editInputProps;
|
|
917
918
|
const isRowSpanColumn = Boolean(enableRowSpan && meta?.rowSpan);
|
|
918
919
|
const isExpandCell = cellIndex === expandCellIndex;
|
|
919
920
|
const editable = isColumnEditable(cell.column.columnDef);
|
|
@@ -1027,18 +1028,31 @@ function DataTableRow({
|
|
|
1027
1028
|
isEditing ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1028
1029
|
"input",
|
|
1029
1030
|
{
|
|
1031
|
+
...editInputProps,
|
|
1030
1032
|
ref: editInputRef,
|
|
1031
1033
|
type: editType === "number" ? "number" : "text",
|
|
1032
1034
|
defaultValue: draftValue,
|
|
1033
1035
|
className: cn(
|
|
1034
1036
|
"cell-edit-input",
|
|
1035
1037
|
CELL_ALIGN_CLASS[align],
|
|
1038
|
+
editInputProps?.className,
|
|
1036
1039
|
classNames?.cellEditInput
|
|
1037
1040
|
),
|
|
1038
|
-
onChange: (event) =>
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
+
onChange: (event) => {
|
|
1042
|
+
editInputProps?.onChange?.(event);
|
|
1043
|
+
onDraftValueChange(event.target.value);
|
|
1044
|
+
},
|
|
1045
|
+
onMouseDown: (event) => {
|
|
1046
|
+
editInputProps?.onMouseDown?.(event);
|
|
1047
|
+
event.stopPropagation();
|
|
1048
|
+
},
|
|
1049
|
+
onClick: (event) => {
|
|
1050
|
+
editInputProps?.onClick?.(event);
|
|
1051
|
+
event.stopPropagation();
|
|
1052
|
+
},
|
|
1041
1053
|
onKeyDown: (event) => {
|
|
1054
|
+
editInputProps?.onKeyDown?.(event);
|
|
1055
|
+
if (event.defaultPrevented) return;
|
|
1042
1056
|
if (event.key === "Enter") {
|
|
1043
1057
|
event.preventDefault();
|
|
1044
1058
|
onCommitEdit(event.currentTarget.value);
|
|
@@ -1049,6 +1063,8 @@ function DataTableRow({
|
|
|
1049
1063
|
}
|
|
1050
1064
|
},
|
|
1051
1065
|
onBlur: (event) => {
|
|
1066
|
+
editInputProps?.onBlur?.(event);
|
|
1067
|
+
if (event.defaultPrevented) return;
|
|
1052
1068
|
onCommitEdit(event.currentTarget.value);
|
|
1053
1069
|
}
|
|
1054
1070
|
}
|
|
@@ -2185,7 +2201,12 @@ function DataTable({
|
|
|
2185
2201
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2186
2202
|
"th",
|
|
2187
2203
|
{
|
|
2188
|
-
style: {
|
|
2204
|
+
style: {
|
|
2205
|
+
width: header.getSize() !== 150 ? header.getSize() : void 0,
|
|
2206
|
+
// Column sizing follows TanStack's `size`, but
|
|
2207
|
+
// ensure the column keeps its min width when the container shrinks.
|
|
2208
|
+
minWidth: header.getSize() !== 150 ? header.getSize() : void 0
|
|
2209
|
+
},
|
|
2189
2210
|
className: cn(
|
|
2190
2211
|
"data-table-head-cell",
|
|
2191
2212
|
CELL_ALIGN_CLASS[align],
|
|
@@ -2325,6 +2346,7 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
2325
2346
|
rowSpanKey,
|
|
2326
2347
|
editable,
|
|
2327
2348
|
editType,
|
|
2349
|
+
editInputProps,
|
|
2328
2350
|
className,
|
|
2329
2351
|
headerClassName,
|
|
2330
2352
|
render
|
|
@@ -2351,6 +2373,7 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
2351
2373
|
rowSpanKey,
|
|
2352
2374
|
editable,
|
|
2353
2375
|
editType,
|
|
2376
|
+
editInputProps,
|
|
2354
2377
|
className,
|
|
2355
2378
|
headerClassName
|
|
2356
2379
|
}
|
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 { d as DataTableProps, T as TableColumnProps, g as TableProps } from './types-
|
|
4
|
-
export { a as DataTableClassNames, c as DataTableLabels, e as DataTableSlots, P as PasteMode, R as RowSelectionMode, f as RowsPastePayload } from './types-
|
|
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';
|
|
5
5
|
export { ColumnDef, 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 { d as DataTableProps, T as TableColumnProps, g as TableProps } from './types-
|
|
4
|
-
export { a as DataTableClassNames, c as DataTableLabels, e as DataTableSlots, P as PasteMode, R as RowSelectionMode, f as RowsPastePayload } from './types-
|
|
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';
|
|
5
5
|
export { ColumnDef, RowSelectionState } from '@tanstack/react-table';
|
|
6
6
|
|
|
7
7
|
/**
|
package/dist/compound.js
CHANGED
|
@@ -886,6 +886,7 @@ function DataTableRow({
|
|
|
886
886
|
const meta = cell.column.columnDef.meta;
|
|
887
887
|
const align = meta?.align ?? "center";
|
|
888
888
|
const cellClassName = meta?.className;
|
|
889
|
+
const editInputProps = meta?.editInputProps;
|
|
889
890
|
const isRowSpanColumn = Boolean(enableRowSpan && meta?.rowSpan);
|
|
890
891
|
const isExpandCell = cellIndex === expandCellIndex;
|
|
891
892
|
const editable = isColumnEditable(cell.column.columnDef);
|
|
@@ -999,18 +1000,31 @@ function DataTableRow({
|
|
|
999
1000
|
isEditing ? /* @__PURE__ */ jsx3(
|
|
1000
1001
|
"input",
|
|
1001
1002
|
{
|
|
1003
|
+
...editInputProps,
|
|
1002
1004
|
ref: editInputRef,
|
|
1003
1005
|
type: editType === "number" ? "number" : "text",
|
|
1004
1006
|
defaultValue: draftValue,
|
|
1005
1007
|
className: cn(
|
|
1006
1008
|
"cell-edit-input",
|
|
1007
1009
|
CELL_ALIGN_CLASS[align],
|
|
1010
|
+
editInputProps?.className,
|
|
1008
1011
|
classNames?.cellEditInput
|
|
1009
1012
|
),
|
|
1010
|
-
onChange: (event) =>
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
+
onChange: (event) => {
|
|
1014
|
+
editInputProps?.onChange?.(event);
|
|
1015
|
+
onDraftValueChange(event.target.value);
|
|
1016
|
+
},
|
|
1017
|
+
onMouseDown: (event) => {
|
|
1018
|
+
editInputProps?.onMouseDown?.(event);
|
|
1019
|
+
event.stopPropagation();
|
|
1020
|
+
},
|
|
1021
|
+
onClick: (event) => {
|
|
1022
|
+
editInputProps?.onClick?.(event);
|
|
1023
|
+
event.stopPropagation();
|
|
1024
|
+
},
|
|
1013
1025
|
onKeyDown: (event) => {
|
|
1026
|
+
editInputProps?.onKeyDown?.(event);
|
|
1027
|
+
if (event.defaultPrevented) return;
|
|
1014
1028
|
if (event.key === "Enter") {
|
|
1015
1029
|
event.preventDefault();
|
|
1016
1030
|
onCommitEdit(event.currentTarget.value);
|
|
@@ -1021,6 +1035,8 @@ function DataTableRow({
|
|
|
1021
1035
|
}
|
|
1022
1036
|
},
|
|
1023
1037
|
onBlur: (event) => {
|
|
1038
|
+
editInputProps?.onBlur?.(event);
|
|
1039
|
+
if (event.defaultPrevented) return;
|
|
1024
1040
|
onCommitEdit(event.currentTarget.value);
|
|
1025
1041
|
}
|
|
1026
1042
|
}
|
|
@@ -2168,7 +2184,12 @@ function DataTable({
|
|
|
2168
2184
|
return /* @__PURE__ */ jsx5(
|
|
2169
2185
|
"th",
|
|
2170
2186
|
{
|
|
2171
|
-
style: {
|
|
2187
|
+
style: {
|
|
2188
|
+
width: header.getSize() !== 150 ? header.getSize() : void 0,
|
|
2189
|
+
// Column sizing follows TanStack's `size`, but
|
|
2190
|
+
// ensure the column keeps its min width when the container shrinks.
|
|
2191
|
+
minWidth: header.getSize() !== 150 ? header.getSize() : void 0
|
|
2192
|
+
},
|
|
2172
2193
|
className: cn(
|
|
2173
2194
|
"data-table-head-cell",
|
|
2174
2195
|
CELL_ALIGN_CLASS[align],
|
|
@@ -2308,6 +2329,7 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
2308
2329
|
rowSpanKey,
|
|
2309
2330
|
editable,
|
|
2310
2331
|
editType,
|
|
2332
|
+
editInputProps,
|
|
2311
2333
|
className,
|
|
2312
2334
|
headerClassName,
|
|
2313
2335
|
render
|
|
@@ -2334,6 +2356,7 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
2334
2356
|
rowSpanKey,
|
|
2335
2357
|
editable,
|
|
2336
2358
|
editType,
|
|
2359
|
+
editInputProps,
|
|
2337
2360
|
className,
|
|
2338
2361
|
headerClassName
|
|
2339
2362
|
}
|
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-
|
|
2
|
-
export { D as DEFAULT_DATA_TABLE_LABELS, r as resolveDataTableLabels } from './types-
|
|
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';
|
|
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-
|
|
2
|
-
export { D as DEFAULT_DATA_TABLE_LABELS, r as resolveDataTableLabels } from './types-
|
|
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';
|
|
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
|
@@ -1865,6 +1865,7 @@ function DataTableRow({
|
|
|
1865
1865
|
const meta = cell.column.columnDef.meta;
|
|
1866
1866
|
const align = meta?.align ?? "center";
|
|
1867
1867
|
const cellClassName = meta?.className;
|
|
1868
|
+
const editInputProps = meta?.editInputProps;
|
|
1868
1869
|
const isRowSpanColumn = Boolean(enableRowSpan && meta?.rowSpan);
|
|
1869
1870
|
const isExpandCell = cellIndex === expandCellIndex;
|
|
1870
1871
|
const editable = isColumnEditable(cell.column.columnDef);
|
|
@@ -1978,18 +1979,31 @@ function DataTableRow({
|
|
|
1978
1979
|
isEditing ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1979
1980
|
"input",
|
|
1980
1981
|
{
|
|
1982
|
+
...editInputProps,
|
|
1981
1983
|
ref: editInputRef,
|
|
1982
1984
|
type: editType === "number" ? "number" : "text",
|
|
1983
1985
|
defaultValue: draftValue,
|
|
1984
1986
|
className: cn(
|
|
1985
1987
|
"cell-edit-input",
|
|
1986
1988
|
CELL_ALIGN_CLASS[align],
|
|
1989
|
+
editInputProps?.className,
|
|
1987
1990
|
classNames?.cellEditInput
|
|
1988
1991
|
),
|
|
1989
|
-
onChange: (event) =>
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
+
onChange: (event) => {
|
|
1993
|
+
editInputProps?.onChange?.(event);
|
|
1994
|
+
onDraftValueChange(event.target.value);
|
|
1995
|
+
},
|
|
1996
|
+
onMouseDown: (event) => {
|
|
1997
|
+
editInputProps?.onMouseDown?.(event);
|
|
1998
|
+
event.stopPropagation();
|
|
1999
|
+
},
|
|
2000
|
+
onClick: (event) => {
|
|
2001
|
+
editInputProps?.onClick?.(event);
|
|
2002
|
+
event.stopPropagation();
|
|
2003
|
+
},
|
|
1992
2004
|
onKeyDown: (event) => {
|
|
2005
|
+
editInputProps?.onKeyDown?.(event);
|
|
2006
|
+
if (event.defaultPrevented) return;
|
|
1993
2007
|
if (event.key === "Enter") {
|
|
1994
2008
|
event.preventDefault();
|
|
1995
2009
|
onCommitEdit(event.currentTarget.value);
|
|
@@ -2000,6 +2014,8 @@ function DataTableRow({
|
|
|
2000
2014
|
}
|
|
2001
2015
|
},
|
|
2002
2016
|
onBlur: (event) => {
|
|
2017
|
+
editInputProps?.onBlur?.(event);
|
|
2018
|
+
if (event.defaultPrevented) return;
|
|
2003
2019
|
onCommitEdit(event.currentTarget.value);
|
|
2004
2020
|
}
|
|
2005
2021
|
}
|
|
@@ -2249,7 +2265,12 @@ function DataTable({
|
|
|
2249
2265
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2250
2266
|
"th",
|
|
2251
2267
|
{
|
|
2252
|
-
style: {
|
|
2268
|
+
style: {
|
|
2269
|
+
width: header.getSize() !== 150 ? header.getSize() : void 0,
|
|
2270
|
+
// Column sizing follows TanStack's `size`, but
|
|
2271
|
+
// ensure the column keeps its min width when the container shrinks.
|
|
2272
|
+
minWidth: header.getSize() !== 150 ? header.getSize() : void 0
|
|
2273
|
+
},
|
|
2253
2274
|
className: cn(
|
|
2254
2275
|
"data-table-head-cell",
|
|
2255
2276
|
CELL_ALIGN_CLASS[align],
|
|
@@ -2389,6 +2410,7 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
2389
2410
|
rowSpanKey,
|
|
2390
2411
|
editable,
|
|
2391
2412
|
editType,
|
|
2413
|
+
editInputProps,
|
|
2392
2414
|
className,
|
|
2393
2415
|
headerClassName,
|
|
2394
2416
|
render
|
|
@@ -2415,6 +2437,7 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
2415
2437
|
rowSpanKey,
|
|
2416
2438
|
editable,
|
|
2417
2439
|
editType,
|
|
2440
|
+
editInputProps,
|
|
2418
2441
|
className,
|
|
2419
2442
|
headerClassName
|
|
2420
2443
|
}
|
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-
|
|
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';
|
|
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-
|
|
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';
|
|
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
|
@@ -1806,6 +1806,7 @@ function DataTableRow({
|
|
|
1806
1806
|
const meta = cell.column.columnDef.meta;
|
|
1807
1807
|
const align = meta?.align ?? "center";
|
|
1808
1808
|
const cellClassName = meta?.className;
|
|
1809
|
+
const editInputProps = meta?.editInputProps;
|
|
1809
1810
|
const isRowSpanColumn = Boolean(enableRowSpan && meta?.rowSpan);
|
|
1810
1811
|
const isExpandCell = cellIndex === expandCellIndex;
|
|
1811
1812
|
const editable = isColumnEditable(cell.column.columnDef);
|
|
@@ -1919,18 +1920,31 @@ function DataTableRow({
|
|
|
1919
1920
|
isEditing ? /* @__PURE__ */ jsx3(
|
|
1920
1921
|
"input",
|
|
1921
1922
|
{
|
|
1923
|
+
...editInputProps,
|
|
1922
1924
|
ref: editInputRef,
|
|
1923
1925
|
type: editType === "number" ? "number" : "text",
|
|
1924
1926
|
defaultValue: draftValue,
|
|
1925
1927
|
className: cn(
|
|
1926
1928
|
"cell-edit-input",
|
|
1927
1929
|
CELL_ALIGN_CLASS[align],
|
|
1930
|
+
editInputProps?.className,
|
|
1928
1931
|
classNames?.cellEditInput
|
|
1929
1932
|
),
|
|
1930
|
-
onChange: (event) =>
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
+
onChange: (event) => {
|
|
1934
|
+
editInputProps?.onChange?.(event);
|
|
1935
|
+
onDraftValueChange(event.target.value);
|
|
1936
|
+
},
|
|
1937
|
+
onMouseDown: (event) => {
|
|
1938
|
+
editInputProps?.onMouseDown?.(event);
|
|
1939
|
+
event.stopPropagation();
|
|
1940
|
+
},
|
|
1941
|
+
onClick: (event) => {
|
|
1942
|
+
editInputProps?.onClick?.(event);
|
|
1943
|
+
event.stopPropagation();
|
|
1944
|
+
},
|
|
1933
1945
|
onKeyDown: (event) => {
|
|
1946
|
+
editInputProps?.onKeyDown?.(event);
|
|
1947
|
+
if (event.defaultPrevented) return;
|
|
1934
1948
|
if (event.key === "Enter") {
|
|
1935
1949
|
event.preventDefault();
|
|
1936
1950
|
onCommitEdit(event.currentTarget.value);
|
|
@@ -1941,6 +1955,8 @@ function DataTableRow({
|
|
|
1941
1955
|
}
|
|
1942
1956
|
},
|
|
1943
1957
|
onBlur: (event) => {
|
|
1958
|
+
editInputProps?.onBlur?.(event);
|
|
1959
|
+
if (event.defaultPrevented) return;
|
|
1944
1960
|
onCommitEdit(event.currentTarget.value);
|
|
1945
1961
|
}
|
|
1946
1962
|
}
|
|
@@ -2190,7 +2206,12 @@ function DataTable({
|
|
|
2190
2206
|
return /* @__PURE__ */ jsx5(
|
|
2191
2207
|
"th",
|
|
2192
2208
|
{
|
|
2193
|
-
style: {
|
|
2209
|
+
style: {
|
|
2210
|
+
width: header.getSize() !== 150 ? header.getSize() : void 0,
|
|
2211
|
+
// Column sizing follows TanStack's `size`, but
|
|
2212
|
+
// ensure the column keeps its min width when the container shrinks.
|
|
2213
|
+
minWidth: header.getSize() !== 150 ? header.getSize() : void 0
|
|
2214
|
+
},
|
|
2194
2215
|
className: cn(
|
|
2195
2216
|
"data-table-head-cell",
|
|
2196
2217
|
CELL_ALIGN_CLASS[align],
|
|
@@ -2330,6 +2351,7 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
2330
2351
|
rowSpanKey,
|
|
2331
2352
|
editable,
|
|
2332
2353
|
editType,
|
|
2354
|
+
editInputProps,
|
|
2333
2355
|
className,
|
|
2334
2356
|
headerClassName,
|
|
2335
2357
|
render
|
|
@@ -2356,6 +2378,7 @@ function buildColumnDef(props, sort, onSort) {
|
|
|
2356
2378
|
rowSpanKey,
|
|
2357
2379
|
editable,
|
|
2358
2380
|
editType,
|
|
2381
|
+
editInputProps,
|
|
2359
2382
|
className,
|
|
2360
2383
|
headerClassName
|
|
2361
2384
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ColumnDef, RowSelectionState, Updater, Row } from '@tanstack/react-table';
|
|
2
|
-
import { ReactNode, ComponentType } from 'react';
|
|
2
|
+
import { ReactNode, InputHTMLAttributes, ComponentType } from 'react';
|
|
3
3
|
|
|
4
4
|
type DataTableLabels = {
|
|
5
5
|
empty: string;
|
|
@@ -14,6 +14,7 @@ declare function resolveDataTableLabels(partial?: Partial<DataTableLabels>): Dat
|
|
|
14
14
|
|
|
15
15
|
type RowSelectionMode = "none" | "single" | "multi";
|
|
16
16
|
type CellEditType = "text" | "number";
|
|
17
|
+
type DataTableEditInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "defaultValue">;
|
|
17
18
|
|
|
18
19
|
declare module "@tanstack/react-table" {
|
|
19
20
|
interface ColumnMeta<TData, TValue> {
|
|
@@ -28,6 +29,8 @@ declare module "@tanstack/react-table" {
|
|
|
28
29
|
editable?: boolean;
|
|
29
30
|
/** Inline editor input type. Defaults to text */
|
|
30
31
|
editType?: CellEditType;
|
|
32
|
+
/** Inline editor input attribute overrides */
|
|
33
|
+
editInputProps?: DataTableEditInputProps;
|
|
31
34
|
}
|
|
32
35
|
}
|
|
33
36
|
type DataTableCopyActions = {
|
|
@@ -260,6 +263,8 @@ type TableColumnProps<T extends Record<string, unknown>, K extends string = keyo
|
|
|
260
263
|
rowSpanKey?: string;
|
|
261
264
|
editable?: boolean;
|
|
262
265
|
editType?: CellEditType;
|
|
266
|
+
/** Inline editor input attribute overrides */
|
|
267
|
+
editInputProps?: DataTableEditInputProps;
|
|
263
268
|
className?: string;
|
|
264
269
|
headerClassName?: string;
|
|
265
270
|
render?: (value: K extends keyof T ? T[K] : unknown, row: Row<T>, index: number) => ReactNode;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ColumnDef, RowSelectionState, Updater, Row } from '@tanstack/react-table';
|
|
2
|
-
import { ReactNode, ComponentType } from 'react';
|
|
2
|
+
import { ReactNode, InputHTMLAttributes, ComponentType } from 'react';
|
|
3
3
|
|
|
4
4
|
type DataTableLabels = {
|
|
5
5
|
empty: string;
|
|
@@ -14,6 +14,7 @@ declare function resolveDataTableLabels(partial?: Partial<DataTableLabels>): Dat
|
|
|
14
14
|
|
|
15
15
|
type RowSelectionMode = "none" | "single" | "multi";
|
|
16
16
|
type CellEditType = "text" | "number";
|
|
17
|
+
type DataTableEditInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "defaultValue">;
|
|
17
18
|
|
|
18
19
|
declare module "@tanstack/react-table" {
|
|
19
20
|
interface ColumnMeta<TData, TValue> {
|
|
@@ -28,6 +29,8 @@ declare module "@tanstack/react-table" {
|
|
|
28
29
|
editable?: boolean;
|
|
29
30
|
/** Inline editor input type. Defaults to text */
|
|
30
31
|
editType?: CellEditType;
|
|
32
|
+
/** Inline editor input attribute overrides */
|
|
33
|
+
editInputProps?: DataTableEditInputProps;
|
|
31
34
|
}
|
|
32
35
|
}
|
|
33
36
|
type DataTableCopyActions = {
|
|
@@ -260,6 +263,8 @@ type TableColumnProps<T extends Record<string, unknown>, K extends string = keyo
|
|
|
260
263
|
rowSpanKey?: string;
|
|
261
264
|
editable?: boolean;
|
|
262
265
|
editType?: CellEditType;
|
|
266
|
+
/** Inline editor input attribute overrides */
|
|
267
|
+
editInputProps?: DataTableEditInputProps;
|
|
263
268
|
className?: string;
|
|
264
269
|
headerClassName?: string;
|
|
265
270
|
render?: (value: K extends keyof T ? T[K] : unknown, row: Row<T>, index: number) => ReactNode;
|