material-react-table 0.7.2 → 0.7.3
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/MaterialReactTable.d.ts +21 -2
- package/dist/material-react-table.cjs.development.js +88 -37
- package/dist/material-react-table.cjs.development.js.map +1 -1
- package/dist/material-react-table.cjs.production.min.js +1 -1
- package/dist/material-react-table.cjs.production.min.js.map +1 -1
- package/dist/material-react-table.esm.js +88 -37
- package/dist/material-react-table.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/MaterialReactTable.tsx +34 -0
- package/src/body/MRT_TableBodyCell.tsx +36 -5
- package/src/buttons/MRT_CopyButton.tsx +1 -0
- package/src/inputs/MRT_EditCellTextField.tsx +12 -1
- package/src/table/MRT_TableRoot.tsx +20 -4
|
@@ -37,6 +37,7 @@ export declare type MRT_TableInstance<D extends Record<string, any> = {}> = Omit
|
|
|
37
37
|
};
|
|
38
38
|
localization: MRT_Localization;
|
|
39
39
|
};
|
|
40
|
+
setCurrentEditingCell: Dispatch<SetStateAction<MRT_Cell<D> | null>>;
|
|
40
41
|
setCurrentEditingRow: Dispatch<SetStateAction<MRT_Row<D> | null>>;
|
|
41
42
|
setCurrentFilterTypes: Dispatch<SetStateAction<{
|
|
42
43
|
[key: string]: MRT_FilterType;
|
|
@@ -48,6 +49,7 @@ export declare type MRT_TableInstance<D extends Record<string, any> = {}> = Omit
|
|
|
48
49
|
setShowGlobalFilter: Dispatch<SetStateAction<boolean>>;
|
|
49
50
|
};
|
|
50
51
|
export declare type MRT_TableState<D extends Record<string, any> = {}> = Omit<TableState, 'pagination'> & {
|
|
52
|
+
currentEditingCell: MRT_Cell<D> | null;
|
|
51
53
|
currentEditingRow: MRT_Row<D> | null;
|
|
52
54
|
currentFilterTypes: Record<string, string | Function>;
|
|
53
55
|
currentGlobalFilterType: Record<string, string | Function>;
|
|
@@ -129,7 +131,8 @@ export declare type MRT_ColumnDef<D extends Record<string, any> = {}> = Omit<Col
|
|
|
129
131
|
cell: MRT_Cell<D>;
|
|
130
132
|
tableInstance: MRT_TableInstance<D>;
|
|
131
133
|
}) => void;
|
|
132
|
-
onColumnFilterValueChange?: ({ event, filterValue, }: {
|
|
134
|
+
onColumnFilterValueChange?: ({ column, event, filterValue, }: {
|
|
135
|
+
column: MRT_Column<D>;
|
|
133
136
|
event: ChangeEvent<HTMLInputElement>;
|
|
134
137
|
filterValue: any;
|
|
135
138
|
}) => void;
|
|
@@ -158,6 +161,7 @@ export declare type MRT_Cell<D extends Record<string, any> = {}> = Omit<Cell<D>,
|
|
|
158
161
|
};
|
|
159
162
|
export declare type MRT_FilterType = MRT_FILTER_TYPE | Function;
|
|
160
163
|
export declare type MaterialReactTableProps<D extends Record<string, any> = {}> = MRT_TableOptions<D> & {
|
|
164
|
+
editingMode?: 'table' | 'row' | 'cell';
|
|
161
165
|
enableClickToCopy?: boolean;
|
|
162
166
|
enableColumnActions?: boolean;
|
|
163
167
|
enableDensePaddingToggle?: boolean;
|
|
@@ -277,6 +281,21 @@ export declare type MaterialReactTableProps<D extends Record<string, any> = {}>
|
|
|
277
281
|
tableInstance: MRT_TableInstance<D>;
|
|
278
282
|
event: MouseEvent<HTMLTableCellElement>;
|
|
279
283
|
}) => void;
|
|
284
|
+
onCellEditBlur?: ({ cell, event, tableInstance, }: {
|
|
285
|
+
event: FocusEvent<HTMLInputElement>;
|
|
286
|
+
cell: MRT_Cell<D>;
|
|
287
|
+
tableInstance: MRT_TableInstance<D>;
|
|
288
|
+
}) => void;
|
|
289
|
+
onCellEditChange?: ({ cell, event, tableInstance, }: {
|
|
290
|
+
event: ChangeEvent<HTMLInputElement>;
|
|
291
|
+
cell: MRT_Cell<D>;
|
|
292
|
+
tableInstance: MRT_TableInstance<D>;
|
|
293
|
+
}) => void;
|
|
294
|
+
onColumnFilterValueChange?: ({ column, event, filterValue, }: {
|
|
295
|
+
column: MRT_Column<D>;
|
|
296
|
+
event: ChangeEvent<HTMLInputElement>;
|
|
297
|
+
filterValue: any;
|
|
298
|
+
}) => void;
|
|
280
299
|
onDetailPanelClick?: ({ event, row, tableInstance, }: {
|
|
281
300
|
event: MouseEvent<HTMLTableCellElement>;
|
|
282
301
|
row: MRT_Row<D>;
|
|
@@ -375,5 +394,5 @@ export declare type MaterialReactTableProps<D extends Record<string, any> = {}>
|
|
|
375
394
|
}>;
|
|
376
395
|
}) => ReactNode;
|
|
377
396
|
};
|
|
378
|
-
declare const _default: <D extends Record<string, any> = {}>({ autoResetExpanded, columnResizeMode, enableColumnActions, enableColumnFilters, enableColumnResizing, enableDensePaddingToggle, enableExpandAll, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding, enableMultiRowSelection, enablePagination, enableSelectAll, enableSorting, enableStickyHeader, enableTableFooter, enableTableHead, enableToolbarBottom, enableToolbarInternalActions, enableToolbarTop, icons, localization, positionActionsColumn, positionPagination, positionToolbarActions, positionToolbarAlertBanner, ...rest }: MaterialReactTableProps<D>) => JSX.Element;
|
|
397
|
+
declare const _default: <D extends Record<string, any> = {}>({ autoResetExpanded, columnResizeMode, editingMode, enableColumnActions, enableColumnFilters, enableColumnResizing, enableDensePaddingToggle, enableExpandAll, enableFilters, enableFullScreenToggle, enableGlobalFilter, enableHiding, enableMultiRowSelection, enablePagination, enableSelectAll, enableSorting, enableStickyHeader, enableTableFooter, enableTableHead, enableToolbarBottom, enableToolbarInternalActions, enableToolbarTop, icons, localization, positionActionsColumn, positionPagination, positionToolbarActions, positionToolbarAlertBanner, ...rest }: MaterialReactTableProps<D>) => JSX.Element;
|
|
379
398
|
export default _default;
|
|
@@ -2197,8 +2197,12 @@ var MRT_EditCellTextField = function MRT_EditCellTextField(_ref) {
|
|
|
2197
2197
|
tableInstance = _ref.tableInstance;
|
|
2198
2198
|
var getState = tableInstance.getState,
|
|
2199
2199
|
_tableInstance$option = tableInstance.options,
|
|
2200
|
+
idPrefix = _tableInstance$option.idPrefix,
|
|
2200
2201
|
enableEditing = _tableInstance$option.enableEditing,
|
|
2201
2202
|
muiTableBodyCellEditTextFieldProps = _tableInstance$option.muiTableBodyCellEditTextFieldProps,
|
|
2203
|
+
onCellEditBlur = _tableInstance$option.onCellEditBlur,
|
|
2204
|
+
onCellEditChange = _tableInstance$option.onCellEditChange,
|
|
2205
|
+
setCurrentEditingCell = tableInstance.setCurrentEditingCell,
|
|
2202
2206
|
setCurrentEditingRow = tableInstance.setCurrentEditingRow;
|
|
2203
2207
|
|
|
2204
2208
|
var _useState = React.useState(cell.value),
|
|
@@ -2215,6 +2219,11 @@ var MRT_EditCellTextField = function MRT_EditCellTextField(_ref) {
|
|
|
2215
2219
|
cell: cell,
|
|
2216
2220
|
tableInstance: tableInstance
|
|
2217
2221
|
});
|
|
2222
|
+
onCellEditChange == null ? void 0 : onCellEditChange({
|
|
2223
|
+
event: event,
|
|
2224
|
+
cell: cell,
|
|
2225
|
+
tableInstance: tableInstance
|
|
2226
|
+
});
|
|
2218
2227
|
};
|
|
2219
2228
|
|
|
2220
2229
|
var handleBlur = function handleBlur(event) {
|
|
@@ -2223,11 +2232,17 @@ var MRT_EditCellTextField = function MRT_EditCellTextField(_ref) {
|
|
|
2223
2232
|
setCurrentEditingRow(_extends({}, getState().currentEditingRow));
|
|
2224
2233
|
}
|
|
2225
2234
|
|
|
2235
|
+
setCurrentEditingCell(null);
|
|
2226
2236
|
column.onCellEditBlur == null ? void 0 : column.onCellEditBlur({
|
|
2227
2237
|
event: event,
|
|
2228
2238
|
cell: cell,
|
|
2229
2239
|
tableInstance: tableInstance
|
|
2230
2240
|
});
|
|
2241
|
+
onCellEditBlur == null ? void 0 : onCellEditBlur({
|
|
2242
|
+
event: event,
|
|
2243
|
+
cell: cell,
|
|
2244
|
+
tableInstance: tableInstance
|
|
2245
|
+
});
|
|
2231
2246
|
};
|
|
2232
2247
|
|
|
2233
2248
|
var mTableBodyCellEditTextFieldProps = muiTableBodyCellEditTextFieldProps instanceof Function ? muiTableBodyCellEditTextFieldProps({
|
|
@@ -2249,6 +2264,7 @@ var MRT_EditCellTextField = function MRT_EditCellTextField(_ref) {
|
|
|
2249
2264
|
}
|
|
2250
2265
|
|
|
2251
2266
|
return React__default.createElement(material.TextField, Object.assign({
|
|
2267
|
+
id: "mrt-" + idPrefix + "-edit-cell-text-field-" + cell.id,
|
|
2252
2268
|
margin: "dense",
|
|
2253
2269
|
onBlur: handleBlur,
|
|
2254
2270
|
onChange: handleChange,
|
|
@@ -2309,6 +2325,7 @@ var MRT_CopyButton = function MRT_CopyButton(_ref) {
|
|
|
2309
2325
|
backgroundColor: 'transparent',
|
|
2310
2326
|
border: 'none',
|
|
2311
2327
|
color: 'inherit',
|
|
2328
|
+
cursor: 'copy',
|
|
2312
2329
|
fontFamily: 'inherit',
|
|
2313
2330
|
fontSize: 'inherit',
|
|
2314
2331
|
letterSpacing: 'inherit',
|
|
@@ -2329,15 +2346,19 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
|
|
|
2329
2346
|
var getIsSomeColumnsPinned = tableInstance.getIsSomeColumnsPinned,
|
|
2330
2347
|
getState = tableInstance.getState,
|
|
2331
2348
|
_tableInstance$option = tableInstance.options,
|
|
2349
|
+
editingMode = _tableInstance$option.editingMode,
|
|
2332
2350
|
enableClickToCopy = _tableInstance$option.enableClickToCopy,
|
|
2333
|
-
enablePinning = _tableInstance$option.enablePinning,
|
|
2334
2351
|
enableEditing = _tableInstance$option.enableEditing,
|
|
2352
|
+
enablePinning = _tableInstance$option.enablePinning,
|
|
2353
|
+
idPrefix = _tableInstance$option.idPrefix,
|
|
2335
2354
|
isLoading = _tableInstance$option.isLoading,
|
|
2336
2355
|
muiTableBodyCellProps = _tableInstance$option.muiTableBodyCellProps,
|
|
2337
2356
|
muiTableBodyCellSkeletonProps = _tableInstance$option.muiTableBodyCellSkeletonProps,
|
|
2338
|
-
onCellClick = _tableInstance$option.onCellClick
|
|
2357
|
+
onCellClick = _tableInstance$option.onCellClick,
|
|
2358
|
+
setCurrentEditingCell = tableInstance.setCurrentEditingCell;
|
|
2339
2359
|
|
|
2340
2360
|
var _getState = getState(),
|
|
2361
|
+
currentEditingCell = _getState.currentEditingCell,
|
|
2341
2362
|
currentEditingRow = _getState.currentEditingRow,
|
|
2342
2363
|
isDensePadding = _getState.isDensePadding;
|
|
2343
2364
|
|
|
@@ -2357,6 +2378,23 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
|
|
|
2357
2378
|
var skeletonWidth = React.useMemo(function () {
|
|
2358
2379
|
return column.columnDefType === 'display' ? column.getWidth() / 2 : Math.random() * (column.getWidth() - column.getWidth() / 3) + column.getWidth() / 3;
|
|
2359
2380
|
}, [column.columnDefType, column.getWidth()]);
|
|
2381
|
+
var isEditable = (enableEditing || column.enableEditing) && column.enableEditing !== false;
|
|
2382
|
+
var isEditing = isEditable && (editingMode === 'table' || (currentEditingRow == null ? void 0 : currentEditingRow.id) === row.id || (currentEditingCell == null ? void 0 : currentEditingCell.id) === cell.id);
|
|
2383
|
+
|
|
2384
|
+
var handleDoubleClick = function handleDoubleClick(_event) {
|
|
2385
|
+
if ((enableEditing || column.enableEditing) && column.enableEditing !== false && editingMode === 'cell') {
|
|
2386
|
+
setCurrentEditingCell(cell);
|
|
2387
|
+
setTimeout(function () {
|
|
2388
|
+
var textField = document.getElementById("mrt-" + idPrefix + "-edit-cell-text-field-" + cell.id);
|
|
2389
|
+
|
|
2390
|
+
if (textField) {
|
|
2391
|
+
textField.focus();
|
|
2392
|
+
textField.select();
|
|
2393
|
+
}
|
|
2394
|
+
}, 200);
|
|
2395
|
+
}
|
|
2396
|
+
};
|
|
2397
|
+
|
|
2360
2398
|
return React__default.createElement(material.TableCell, Object.assign({
|
|
2361
2399
|
onClick: function onClick(event) {
|
|
2362
2400
|
return onCellClick == null ? void 0 : onCellClick({
|
|
@@ -2364,9 +2402,11 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
|
|
|
2364
2402
|
cell: cell,
|
|
2365
2403
|
tableInstance: tableInstance
|
|
2366
2404
|
});
|
|
2367
|
-
}
|
|
2405
|
+
},
|
|
2406
|
+
onDoubleClick: handleDoubleClick
|
|
2368
2407
|
}, tableCellProps, {
|
|
2369
2408
|
sx: _extends({
|
|
2409
|
+
cursor: isEditable && editingMode === 'cell' ? 'pointer' : 'text',
|
|
2370
2410
|
maxWidth: "min(" + column.getWidth() + "px, fit-content)",
|
|
2371
2411
|
minWidth: "max(" + column.getWidth() + "px, " + column.minWidth + "px)",
|
|
2372
2412
|
p: isDensePadding ? column.columnDefType === 'display' ? '0 0.5rem' : '0.5rem' : column.columnDefType === 'display' ? '0.5rem 0.75rem' : '1rem',
|
|
@@ -2382,7 +2422,7 @@ var MRT_TableBodyCell = function MRT_TableBodyCell(_ref) {
|
|
|
2382
2422
|
}, muiTableBodyCellSkeletonProps)) : column.columnDefType === 'display' ? column.Cell == null ? void 0 : column.Cell({
|
|
2383
2423
|
cell: cell,
|
|
2384
2424
|
tableInstance: tableInstance
|
|
2385
|
-
}) : cell.getIsPlaceholder() || row.getIsGrouped() && column.id !== row.groupingColumnId ? null : cell.getIsAggregated() ? cell.renderAggregatedCell() :
|
|
2425
|
+
}) : cell.getIsPlaceholder() || row.getIsGrouped() && column.id !== row.groupingColumnId ? null : cell.getIsAggregated() ? cell.renderAggregatedCell() : isEditing ? React__default.createElement(MRT_EditCellTextField, {
|
|
2386
2426
|
cell: cell,
|
|
2387
2427
|
tableInstance: tableInstance
|
|
2388
2428
|
}) : (enableClickToCopy || column.enableClickToCopy) && column.enableClickToCopy !== false ? React__default.createElement(React__default.Fragment, null, React__default.createElement(MRT_CopyButton, {
|
|
@@ -2839,7 +2879,7 @@ var createDisplayColumn = function createDisplayColumn(table, column) {
|
|
|
2839
2879
|
};
|
|
2840
2880
|
|
|
2841
2881
|
var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
2842
|
-
var _props$initialState$
|
|
2882
|
+
var _props$initialState$c, _props$initialState, _props$initialState$c2, _props$initialState2, _props$initialState$i, _props$initialState3, _props$initialState$i2, _props$initialState4, _props$initialState$s, _props$initialState5, _props$initialState$s2, _props$initialState6, _props$initialState$p, _props$initialState7, _props$initialState7$, _props$initialState$p2, _props$initialState8, _props$initialState8$, _props$initialState$p3, _props$initialState9, _props$initialState9$, _props$globalFilterTy;
|
|
2843
2883
|
|
|
2844
2884
|
var _useState = React.useState(props.idPrefix),
|
|
2845
2885
|
idPrefix = _useState[0],
|
|
@@ -2851,49 +2891,53 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
|
2851
2891
|
return setIdPrefix((_props$idPrefix = props.idPrefix) != null ? _props$idPrefix : Math.random().toString(36).substring(2, 9));
|
|
2852
2892
|
}, [props.idPrefix]);
|
|
2853
2893
|
|
|
2854
|
-
var _useState2 = React.useState(null),
|
|
2855
|
-
|
|
2856
|
-
|
|
2894
|
+
var _useState2 = React.useState((_props$initialState$c = (_props$initialState = props.initialState) == null ? void 0 : _props$initialState.currentEditingCell) != null ? _props$initialState$c : null),
|
|
2895
|
+
currentEditingCell = _useState2[0],
|
|
2896
|
+
setCurrentEditingCell = _useState2[1];
|
|
2897
|
+
|
|
2898
|
+
var _useState3 = React.useState((_props$initialState$c2 = (_props$initialState2 = props.initialState) == null ? void 0 : _props$initialState2.currentEditingRow) != null ? _props$initialState$c2 : null),
|
|
2899
|
+
currentEditingRow = _useState3[0],
|
|
2900
|
+
setCurrentEditingRow = _useState3[1];
|
|
2857
2901
|
|
|
2858
|
-
var
|
|
2859
|
-
isDensePadding =
|
|
2860
|
-
setIsDensePadding =
|
|
2902
|
+
var _useState4 = React.useState((_props$initialState$i = (_props$initialState3 = props.initialState) == null ? void 0 : _props$initialState3.isDensePadding) != null ? _props$initialState$i : false),
|
|
2903
|
+
isDensePadding = _useState4[0],
|
|
2904
|
+
setIsDensePadding = _useState4[1];
|
|
2861
2905
|
|
|
2862
|
-
var
|
|
2863
|
-
isFullScreen =
|
|
2864
|
-
setIsFullScreen =
|
|
2906
|
+
var _useState5 = React.useState((_props$initialState$i2 = (_props$initialState4 = props.initialState) == null ? void 0 : _props$initialState4.isFullScreen) != null ? _props$initialState$i2 : false),
|
|
2907
|
+
isFullScreen = _useState5[0],
|
|
2908
|
+
setIsFullScreen = _useState5[1];
|
|
2865
2909
|
|
|
2866
|
-
var
|
|
2867
|
-
showFilters =
|
|
2868
|
-
setShowFilters =
|
|
2910
|
+
var _useState6 = React.useState((_props$initialState$s = (_props$initialState5 = props.initialState) == null ? void 0 : _props$initialState5.showFilters) != null ? _props$initialState$s : false),
|
|
2911
|
+
showFilters = _useState6[0],
|
|
2912
|
+
setShowFilters = _useState6[1];
|
|
2869
2913
|
|
|
2870
|
-
var
|
|
2871
|
-
showGlobalFilter =
|
|
2872
|
-
setShowGlobalFilter =
|
|
2914
|
+
var _useState7 = React.useState((_props$initialState$s2 = (_props$initialState6 = props.initialState) == null ? void 0 : _props$initialState6.showGlobalFilter) != null ? _props$initialState$s2 : false),
|
|
2915
|
+
showGlobalFilter = _useState7[0],
|
|
2916
|
+
setShowGlobalFilter = _useState7[1];
|
|
2873
2917
|
|
|
2874
|
-
var
|
|
2875
|
-
pageIndex: (_props$initialState$p = (_props$
|
|
2876
|
-
pageSize: (_props$initialState$p2 = (_props$
|
|
2877
|
-
pageCount: (_props$initialState$p3 = (_props$
|
|
2918
|
+
var _useState8 = React.useState({
|
|
2919
|
+
pageIndex: (_props$initialState$p = (_props$initialState7 = props.initialState) == null ? void 0 : (_props$initialState7$ = _props$initialState7.pagination) == null ? void 0 : _props$initialState7$.pageIndex) != null ? _props$initialState$p : 0,
|
|
2920
|
+
pageSize: (_props$initialState$p2 = (_props$initialState8 = props.initialState) == null ? void 0 : (_props$initialState8$ = _props$initialState8.pagination) == null ? void 0 : _props$initialState8$.pageSize) != null ? _props$initialState$p2 : 10,
|
|
2921
|
+
pageCount: (_props$initialState$p3 = (_props$initialState9 = props.initialState) == null ? void 0 : (_props$initialState9$ = _props$initialState9.pagination) == null ? void 0 : _props$initialState9$.pageCount) != null ? _props$initialState$p3 : -1
|
|
2878
2922
|
}),
|
|
2879
|
-
pagination =
|
|
2880
|
-
setPagination =
|
|
2923
|
+
pagination = _useState8[0],
|
|
2924
|
+
setPagination = _useState8[1];
|
|
2881
2925
|
|
|
2882
|
-
var
|
|
2926
|
+
var _useState9 = React.useState(function () {
|
|
2883
2927
|
return Object.assign.apply(Object, [{}].concat(getAllLeafColumnDefs(props.columns).map(function (c) {
|
|
2884
|
-
var _ref, _c$filter, _props$
|
|
2928
|
+
var _ref, _c$filter, _props$initialState10, _props$initialState11, _c$filterSelectOption, _ref2;
|
|
2885
2929
|
|
|
2886
|
-
return _ref2 = {}, _ref2[c.id] = (_ref = (_c$filter = c.filter) != null ? _c$filter : props == null ? void 0 : (_props$
|
|
2930
|
+
return _ref2 = {}, _ref2[c.id] = (_ref = (_c$filter = c.filter) != null ? _c$filter : props == null ? void 0 : (_props$initialState10 = props.initialState) == null ? void 0 : (_props$initialState11 = _props$initialState10.columnFilters) == null ? void 0 : _props$initialState11.find(function (cf) {
|
|
2887
2931
|
return cf.id === c.id;
|
|
2888
2932
|
})) != null ? _ref : !!((_c$filterSelectOption = c.filterSelectOptions) != null && _c$filterSelectOption.length) ? MRT_FILTER_TYPE.EQUALS : MRT_FILTER_TYPE.BEST_MATCH, _ref2;
|
|
2889
2933
|
})));
|
|
2890
2934
|
}),
|
|
2891
|
-
currentFilterTypes =
|
|
2892
|
-
setCurrentFilterTypes =
|
|
2935
|
+
currentFilterTypes = _useState9[0],
|
|
2936
|
+
setCurrentFilterTypes = _useState9[1];
|
|
2893
2937
|
|
|
2894
|
-
var
|
|
2895
|
-
currentGlobalFilterType =
|
|
2896
|
-
setCurrentGlobalFilterType =
|
|
2938
|
+
var _useState10 = React.useState((_props$globalFilterTy = props.globalFilterType) != null ? _props$globalFilterTy : MRT_FILTER_TYPE.BEST_MATCH_FIRST),
|
|
2939
|
+
currentGlobalFilterType = _useState10[0],
|
|
2940
|
+
setCurrentGlobalFilterType = _useState10[1];
|
|
2897
2941
|
|
|
2898
2942
|
var table = React.useMemo(function () {
|
|
2899
2943
|
return reactTable.createTable();
|
|
@@ -2901,7 +2945,7 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
|
2901
2945
|
var displayColumns = React.useMemo(function () {
|
|
2902
2946
|
var _props$localization, _props$localization2, _props$localization3, _props$localization5;
|
|
2903
2947
|
|
|
2904
|
-
return [(props.enableRowActions || props.enableEditing) && createDisplayColumn(table, {
|
|
2948
|
+
return [(props.enableRowActions || props.enableEditing && props.editingMode === 'row') && createDisplayColumn(table, {
|
|
2905
2949
|
Cell: function Cell(_ref3) {
|
|
2906
2950
|
var cell = _ref3.cell;
|
|
2907
2951
|
return React__default.createElement(MRT_ToggleRowActionMenuButton, {
|
|
@@ -2964,7 +3008,7 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
|
2964
3008
|
width: 40,
|
|
2965
3009
|
minWidth: 40
|
|
2966
3010
|
})].filter(Boolean);
|
|
2967
|
-
}, [props.enableEditing, props.enableExpandAll, props.enableExpanded, props.enableGrouping, props.enableRowActions, props.enableRowNumbers, props.enableRowSelection, props.enableSelectAll, props.localization, table]);
|
|
3011
|
+
}, [props.editingMode, props.enableEditing, props.enableExpandAll, props.enableExpanded, props.enableGrouping, props.enableRowActions, props.enableRowNumbers, props.enableRowSelection, props.enableSelectAll, props.localization, table]);
|
|
2968
3012
|
var columns = React.useMemo(function () {
|
|
2969
3013
|
return table.createColumns([].concat(displayColumns, props.columns.map(function (column) {
|
|
2970
3014
|
return column.columns ? createGroup(table, column, currentFilterTypes) : createDataColumn(table, column, currentFilterTypes);
|
|
@@ -3004,6 +3048,7 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
|
3004
3048
|
columns: columns,
|
|
3005
3049
|
data: data,
|
|
3006
3050
|
state: _extends({
|
|
3051
|
+
currentEditingCell: currentEditingCell,
|
|
3007
3052
|
currentEditingRow: currentEditingRow,
|
|
3008
3053
|
currentFilterTypes: currentFilterTypes,
|
|
3009
3054
|
currentGlobalFilterType: currentGlobalFilterType,
|
|
@@ -3015,6 +3060,9 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
|
3015
3060
|
showGlobalFilter: showGlobalFilter
|
|
3016
3061
|
}, props.state)
|
|
3017
3062
|
})), {
|
|
3063
|
+
//@ts-ignore
|
|
3064
|
+
setCurrentEditingCell: setCurrentEditingCell,
|
|
3065
|
+
//@ts-ignore
|
|
3018
3066
|
setCurrentEditingRow: setCurrentEditingRow,
|
|
3019
3067
|
setCurrentFilterTypes: setCurrentFilterTypes,
|
|
3020
3068
|
setCurrentGlobalFilterType: setCurrentGlobalFilterType,
|
|
@@ -3042,12 +3090,14 @@ var MRT_TableRoot = function MRT_TableRoot(props) {
|
|
|
3042
3090
|
}));
|
|
3043
3091
|
};
|
|
3044
3092
|
|
|
3045
|
-
var _excluded$5 = ["autoResetExpanded", "columnResizeMode", "enableColumnActions", "enableColumnFilters", "enableColumnResizing", "enableDensePaddingToggle", "enableExpandAll", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableHiding", "enableMultiRowSelection", "enablePagination", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarBottom", "enableToolbarInternalActions", "enableToolbarTop", "icons", "localization", "positionActionsColumn", "positionPagination", "positionToolbarActions", "positionToolbarAlertBanner"];
|
|
3093
|
+
var _excluded$5 = ["autoResetExpanded", "columnResizeMode", "editingMode", "enableColumnActions", "enableColumnFilters", "enableColumnResizing", "enableDensePaddingToggle", "enableExpandAll", "enableFilters", "enableFullScreenToggle", "enableGlobalFilter", "enableHiding", "enableMultiRowSelection", "enablePagination", "enableSelectAll", "enableSorting", "enableStickyHeader", "enableTableFooter", "enableTableHead", "enableToolbarBottom", "enableToolbarInternalActions", "enableToolbarTop", "icons", "localization", "positionActionsColumn", "positionPagination", "positionToolbarActions", "positionToolbarAlertBanner"];
|
|
3046
3094
|
var MaterialReactTable = (function (_ref) {
|
|
3047
3095
|
var _ref$autoResetExpande = _ref.autoResetExpanded,
|
|
3048
3096
|
autoResetExpanded = _ref$autoResetExpande === void 0 ? false : _ref$autoResetExpande,
|
|
3049
3097
|
_ref$columnResizeMode = _ref.columnResizeMode,
|
|
3050
3098
|
columnResizeMode = _ref$columnResizeMode === void 0 ? 'onEnd' : _ref$columnResizeMode,
|
|
3099
|
+
_ref$editingMode = _ref.editingMode,
|
|
3100
|
+
editingMode = _ref$editingMode === void 0 ? 'row' : _ref$editingMode,
|
|
3051
3101
|
_ref$enableColumnActi = _ref.enableColumnActions,
|
|
3052
3102
|
enableColumnActions = _ref$enableColumnActi === void 0 ? true : _ref$enableColumnActi,
|
|
3053
3103
|
_ref$enableColumnFilt = _ref.enableColumnFilters,
|
|
@@ -3101,6 +3151,7 @@ var MaterialReactTable = (function (_ref) {
|
|
|
3101
3151
|
return React__default.createElement(MRT_TableRoot, Object.assign({
|
|
3102
3152
|
autoResetExpanded: autoResetExpanded,
|
|
3103
3153
|
columnResizeMode: columnResizeMode,
|
|
3154
|
+
editingMode: editingMode,
|
|
3104
3155
|
enableColumnActions: enableColumnActions,
|
|
3105
3156
|
enableColumnResizing: enableColumnResizing,
|
|
3106
3157
|
enableColumnFilters: enableColumnFilters,
|