@mui/x-data-grid 5.16.0 → 5.17.2
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/CHANGELOG.md +138 -1
- package/components/GridRow.d.ts +2 -1
- package/components/GridRow.js +132 -83
- package/components/cell/GridBooleanCell.js +2 -1
- package/components/cell/GridCell.js +9 -1
- package/components/cell/GridEditBooleanCell.js +2 -1
- package/components/cell/GridEditDateCell.js +2 -1
- package/components/cell/GridEditInputCell.js +2 -1
- package/components/cell/GridEditSingleSelectCell.js +2 -1
- package/components/cell/GridSkeletonCell.d.ts +12 -0
- package/components/cell/GridSkeletonCell.js +60 -0
- package/components/cell/index.d.ts +1 -0
- package/components/cell/index.js +2 -1
- package/components/columnSelection/GridCellCheckboxRenderer.js +2 -1
- package/components/containers/GridRootStyles.js +2 -0
- package/components/panel/GridColumnsPanel.d.ts +6 -1
- package/components/panel/GridColumnsPanel.js +38 -6
- package/constants/defaultGridSlotsComponents.js +2 -1
- package/constants/gridClasses.d.ts +8 -0
- package/constants/gridClasses.js +1 -1
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +5 -1
- package/hooks/features/editRows/useGridCellEditing.new.js +8 -2
- package/hooks/features/editRows/useGridRowEditing.new.js +8 -2
- package/hooks/features/filter/gridFilterUtils.d.ts +1 -1
- package/hooks/features/filter/gridFilterUtils.js +55 -54
- package/hooks/features/filter/useGridFilter.js +1 -1
- package/hooks/features/focus/useGridFocus.js +13 -3
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -0
- package/hooks/features/rows/useGridParamsApi.js +1 -1
- package/hooks/features/rows/useGridRows.js +65 -8
- package/hooks/features/rows/useGridRowsMeta.js +36 -16
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +17 -5
- package/index.js +1 -1
- package/internals/index.d.ts +1 -1
- package/internals/index.js +1 -1
- package/legacy/components/GridRow.js +135 -83
- package/legacy/components/cell/GridBooleanCell.js +2 -1
- package/legacy/components/cell/GridCell.js +11 -1
- package/legacy/components/cell/GridEditBooleanCell.js +2 -1
- package/legacy/components/cell/GridEditDateCell.js +2 -1
- package/legacy/components/cell/GridEditInputCell.js +2 -1
- package/legacy/components/cell/GridEditSingleSelectCell.js +2 -1
- package/legacy/components/cell/GridSkeletonCell.js +57 -0
- package/legacy/components/cell/index.js +2 -1
- package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +2 -1
- package/legacy/components/containers/GridRootStyles.js +3 -3
- package/legacy/components/panel/GridColumnsPanel.js +41 -6
- package/legacy/constants/defaultGridSlotsComponents.js +2 -1
- package/legacy/constants/gridClasses.js +1 -1
- package/legacy/hooks/features/editRows/useGridCellEditing.new.js +11 -5
- package/legacy/hooks/features/editRows/useGridRowEditing.new.js +8 -2
- package/legacy/hooks/features/filter/gridFilterUtils.js +61 -56
- package/legacy/hooks/features/filter/useGridFilter.js +1 -1
- package/legacy/hooks/features/focus/useGridFocus.js +13 -3
- package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -0
- package/legacy/hooks/features/rows/useGridParamsApi.js +1 -1
- package/legacy/hooks/features/rows/useGridRows.js +73 -8
- package/legacy/hooks/features/rows/useGridRowsMeta.js +45 -18
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +31 -13
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +1 -1
- package/legacy/models/events/gridEvents.js +2 -0
- package/legacy/models/params/gridRenderedRowsIntervalChangeParams.js +1 -0
- package/legacy/models/params/index.js +2 -1
- package/legacy/utils/utils.js +25 -0
- package/models/api/gridParamsApi.d.ts +1 -1
- package/models/api/gridRowApi.d.ts +6 -0
- package/models/api/gridRowsMetaApi.d.ts +6 -1
- package/models/events/gridEventLookup.d.ts +7 -1
- package/models/events/gridEvents.d.ts +3 -1
- package/models/events/gridEvents.js +2 -0
- package/models/gridSlotsComponent.d.ts +5 -0
- package/models/params/gridCellParams.d.ts +7 -2
- package/models/params/gridRenderedRowsIntervalChangeParams.d.ts +10 -0
- package/models/params/gridRenderedRowsIntervalChangeParams.js +1 -0
- package/models/params/index.d.ts +1 -0
- package/models/params/index.js +2 -1
- package/modern/components/GridRow.js +129 -82
- package/modern/components/cell/GridBooleanCell.js +2 -1
- package/modern/components/cell/GridCell.js +9 -1
- package/modern/components/cell/GridEditBooleanCell.js +2 -1
- package/modern/components/cell/GridEditDateCell.js +2 -1
- package/modern/components/cell/GridEditInputCell.js +2 -1
- package/modern/components/cell/GridEditSingleSelectCell.js +2 -1
- package/modern/components/cell/GridSkeletonCell.js +60 -0
- package/modern/components/cell/index.js +2 -1
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +2 -1
- package/modern/components/containers/GridRootStyles.js +2 -0
- package/modern/components/panel/GridColumnsPanel.js +38 -6
- package/modern/constants/defaultGridSlotsComponents.js +2 -1
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/features/editRows/useGridCellEditing.new.js +8 -2
- package/modern/hooks/features/editRows/useGridRowEditing.new.js +8 -2
- package/modern/hooks/features/filter/gridFilterUtils.js +54 -53
- package/modern/hooks/features/filter/useGridFilter.js +1 -1
- package/modern/hooks/features/focus/useGridFocus.js +13 -3
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -0
- package/modern/hooks/features/rows/useGridParamsApi.js +1 -1
- package/modern/hooks/features/rows/useGridRows.js +65 -8
- package/modern/hooks/features/rows/useGridRowsMeta.js +36 -16
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +17 -5
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -1
- package/modern/models/events/gridEvents.js +2 -0
- package/modern/models/params/gridRenderedRowsIntervalChangeParams.js +1 -0
- package/modern/models/params/index.js +2 -1
- package/modern/utils/utils.js +23 -0
- package/node/components/GridRow.js +131 -75
- package/node/components/cell/GridBooleanCell.js +2 -1
- package/node/components/cell/GridCell.js +9 -1
- package/node/components/cell/GridEditBooleanCell.js +2 -1
- package/node/components/cell/GridEditDateCell.js +2 -1
- package/node/components/cell/GridEditInputCell.js +2 -1
- package/node/components/cell/GridEditSingleSelectCell.js +2 -1
- package/node/components/cell/GridSkeletonCell.js +81 -0
- package/node/components/cell/index.js +13 -0
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +2 -1
- package/node/components/containers/GridRootStyles.js +2 -0
- package/node/components/panel/GridColumnsPanel.js +36 -5
- package/node/constants/defaultGridSlotsComponents.js +1 -0
- package/node/constants/gridClasses.js +1 -1
- package/node/hooks/features/editRows/useGridCellEditing.new.js +9 -2
- package/node/hooks/features/editRows/useGridRowEditing.new.js +9 -2
- package/node/hooks/features/filter/gridFilterUtils.js +55 -55
- package/node/hooks/features/filter/useGridFilter.js +1 -1
- package/node/hooks/features/focus/useGridFocus.js +13 -3
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -0
- package/node/hooks/features/rows/useGridParamsApi.js +1 -1
- package/node/hooks/features/rows/useGridRows.js +60 -7
- package/node/hooks/features/rows/useGridRowsMeta.js +35 -15
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +17 -5
- package/node/index.js +1 -1
- package/node/internals/index.js +6 -0
- package/node/models/events/gridEvents.js +2 -0
- package/node/models/params/gridRenderedRowsIntervalChangeParams.js +5 -0
- package/node/models/params/index.js +13 -0
- package/node/utils/utils.js +27 -0
- package/package.json +1 -1
- package/utils/utils.d.ts +2 -0
- package/utils/utils.js +23 -0
|
@@ -47,9 +47,11 @@ var _gridRowsSelector = require("../hooks/features/rows/gridRowsSelector");
|
|
|
47
47
|
|
|
48
48
|
var _densitySelector = require("../hooks/features/density/densitySelector");
|
|
49
49
|
|
|
50
|
+
var _utils = require("../utils/utils");
|
|
51
|
+
|
|
50
52
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
51
53
|
|
|
52
|
-
const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "renderedColumns", "containerWidth", "firstColumnToRender", "lastColumnToRender", "cellFocus", "cellTabIndex", "editRowsState", "isLastVisible", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave"];
|
|
54
|
+
const _excluded = ["selected", "rowId", "row", "index", "style", "position", "rowHeight", "className", "visibleColumns", "renderedColumns", "containerWidth", "firstColumnToRender", "lastColumnToRender", "cellFocus", "cellTabIndex", "editRowsState", "isLastVisible", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave"];
|
|
53
55
|
|
|
54
56
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
55
57
|
|
|
@@ -95,6 +97,7 @@ function GridRow(props) {
|
|
|
95
97
|
row,
|
|
96
98
|
index,
|
|
97
99
|
style: styleProp,
|
|
100
|
+
position,
|
|
98
101
|
rowHeight,
|
|
99
102
|
className,
|
|
100
103
|
visibleColumns,
|
|
@@ -140,9 +143,9 @@ function GridRow(props) {
|
|
|
140
143
|
React.useLayoutEffect(() => {
|
|
141
144
|
if (rowHeight === 'auto' && ref.current && typeof ResizeObserver === 'undefined') {
|
|
142
145
|
// Fallback for IE
|
|
143
|
-
apiRef.current.unstable_storeRowHeightMeasurement(rowId, ref.current.clientHeight);
|
|
146
|
+
apiRef.current.unstable_storeRowHeightMeasurement(rowId, ref.current.clientHeight, position);
|
|
144
147
|
}
|
|
145
|
-
}, [apiRef, rowHeight, rowId]);
|
|
148
|
+
}, [apiRef, rowHeight, rowId, position]);
|
|
146
149
|
React.useLayoutEffect(() => {
|
|
147
150
|
if (currentPage.range) {
|
|
148
151
|
// The index prop is relative to the rows from all pages. As example, the index prop of the
|
|
@@ -167,11 +170,11 @@ function GridRow(props) {
|
|
|
167
170
|
const resizeObserver = new ResizeObserver(entries => {
|
|
168
171
|
const [entry] = entries;
|
|
169
172
|
const height = entry.borderBoxSize && entry.borderBoxSize.length > 0 ? entry.borderBoxSize[0].blockSize : entry.contentRect.height;
|
|
170
|
-
apiRef.current.unstable_storeRowHeightMeasurement(rowId, height);
|
|
173
|
+
apiRef.current.unstable_storeRowHeightMeasurement(rowId, height, position);
|
|
171
174
|
});
|
|
172
175
|
resizeObserver.observe(rootElement);
|
|
173
176
|
return () => resizeObserver.disconnect();
|
|
174
|
-
}, [apiRef, currentPage.range, index, rowHeight, rowId]);
|
|
177
|
+
}, [apiRef, currentPage.range, index, rowHeight, rowId, position]);
|
|
175
178
|
const publish = React.useCallback((eventName, propHandler) => event => {
|
|
176
179
|
// Ignore portal
|
|
177
180
|
// The target is not an element when triggered by a Select inside the cell
|
|
@@ -227,43 +230,9 @@ function GridRow(props) {
|
|
|
227
230
|
|
|
228
231
|
publish('rowClick', onClick)(event);
|
|
229
232
|
}, [apiRef, onClick, publish, rowId]);
|
|
230
|
-
const
|
|
231
|
-
|
|
232
|
-
// max-height doesn't support "auto"
|
|
233
|
-
minHeight: rowHeight
|
|
234
|
-
});
|
|
235
|
-
const sizes = apiRef.current.unstable_getRowInternalSizes(rowId);
|
|
236
|
-
|
|
237
|
-
if (sizes != null && sizes.spacingTop) {
|
|
238
|
-
const property = rootProps.rowSpacingType === 'border' ? 'borderTopWidth' : 'marginTop';
|
|
239
|
-
style[property] = sizes.spacingTop;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
if (sizes != null && sizes.spacingBottom) {
|
|
243
|
-
const property = rootProps.rowSpacingType === 'border' ? 'borderBottomWidth' : 'marginBottom';
|
|
244
|
-
style[property] = sizes.spacingBottom;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
let rowClassName = null;
|
|
248
|
-
|
|
249
|
-
if (typeof rootProps.getRowClassName === 'function') {
|
|
250
|
-
const indexRelativeToCurrentPage = index - currentPage.range.firstRowIndex;
|
|
251
|
-
const rowParams = (0, _extends2.default)({}, apiRef.current.getRowParams(rowId), {
|
|
252
|
-
isFirstVisible: indexRelativeToCurrentPage === 0,
|
|
253
|
-
isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1,
|
|
254
|
-
indexRelativeToCurrentPage
|
|
255
|
-
});
|
|
256
|
-
rowClassName = rootProps.getRowClassName(rowParams);
|
|
257
|
-
}
|
|
233
|
+
const getCell = React.useCallback((column, cellProps) => {
|
|
234
|
+
var _rootProps$components;
|
|
258
235
|
|
|
259
|
-
const cells = [];
|
|
260
|
-
|
|
261
|
-
for (let i = 0; i < renderedColumns.length; i += 1) {
|
|
262
|
-
const column = renderedColumns[i];
|
|
263
|
-
const indexRelativeToAllColumns = firstColumnToRender + i;
|
|
264
|
-
const isLastColumn = indexRelativeToAllColumns === visibleColumns.length - 1;
|
|
265
|
-
const removeLastBorderRight = isLastColumn && hasScrollX && !hasScrollY;
|
|
266
|
-
const showRightBorder = !isLastColumn ? rootProps.showCellRightBorder : !removeLastBorderRight && rootProps.disableExtendRowFullWidth;
|
|
267
236
|
const cellParams = apiRef.current.getCellParams(rowId, column.field);
|
|
268
237
|
const classNames = [];
|
|
269
238
|
const disableDragEvents = rootProps.disableColumnReorder && column.disableReorder || !rootProps.rowReordering && !!sortModel.length && treeDepth > 1 && Object.keys(editRowsState).length > 0;
|
|
@@ -312,53 +281,139 @@ function GridRow(props) {
|
|
|
312
281
|
|
|
313
282
|
const hasFocus = cellFocus !== null && cellFocus.id === rowId && cellFocus.field === column.field;
|
|
314
283
|
const tabIndex = cellTabIndex !== null && cellTabIndex.id === rowId && cellTabIndex.field === column.field && cellParams.cellMode === 'view' ? 0 : -1;
|
|
284
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.components.Cell, (0, _extends2.default)({
|
|
285
|
+
value: cellParams.value,
|
|
286
|
+
field: column.field,
|
|
287
|
+
width: cellProps.width,
|
|
288
|
+
rowId: rowId,
|
|
289
|
+
height: rowHeight,
|
|
290
|
+
showRightBorder: cellProps.showRightBorder,
|
|
291
|
+
formattedValue: cellParams.formattedValue,
|
|
292
|
+
align: column.align || 'left',
|
|
293
|
+
cellMode: cellParams.cellMode,
|
|
294
|
+
colIndex: cellProps.indexRelativeToAllColumns,
|
|
295
|
+
isEditable: cellParams.isEditable,
|
|
296
|
+
hasFocus: hasFocus,
|
|
297
|
+
tabIndex: tabIndex,
|
|
298
|
+
className: (0, _clsx.default)(classNames),
|
|
299
|
+
colSpan: cellProps.colSpan,
|
|
300
|
+
disableDragEvents: disableDragEvents
|
|
301
|
+
}, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.cell, {
|
|
302
|
+
children: content
|
|
303
|
+
}), column.field);
|
|
304
|
+
}, [apiRef, cellTabIndex, editRowsState, cellFocus, rootProps, row, rowHeight, rowId, treeDepth, sortModel.length]);
|
|
305
|
+
const sizes = apiRef.current.unstable_getRowInternalSizes(rowId);
|
|
306
|
+
let minHeight = rowHeight;
|
|
307
|
+
|
|
308
|
+
if (minHeight === 'auto' && sizes) {
|
|
309
|
+
let numberOfBaseSizes = 0;
|
|
310
|
+
const maximumSize = Object.entries(sizes).reduce((acc, [key, size]) => {
|
|
311
|
+
const isBaseHeight = /^base[A-Z]/.test(key);
|
|
312
|
+
|
|
313
|
+
if (!isBaseHeight) {
|
|
314
|
+
return acc;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
numberOfBaseSizes += 1;
|
|
318
|
+
|
|
319
|
+
if (size > acc) {
|
|
320
|
+
return size;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
return acc;
|
|
324
|
+
}, 0);
|
|
325
|
+
|
|
326
|
+
if (maximumSize > 0 && numberOfBaseSizes > 1) {
|
|
327
|
+
minHeight = maximumSize;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
const style = (0, _extends2.default)({}, styleProp, {
|
|
332
|
+
maxHeight: rowHeight === 'auto' ? 'none' : rowHeight,
|
|
333
|
+
// max-height doesn't support "auto"
|
|
334
|
+
minHeight
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
if (sizes != null && sizes.spacingTop) {
|
|
338
|
+
const property = rootProps.rowSpacingType === 'border' ? 'borderTopWidth' : 'marginTop';
|
|
339
|
+
style[property] = sizes.spacingTop;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
if (sizes != null && sizes.spacingBottom) {
|
|
343
|
+
const property = rootProps.rowSpacingType === 'border' ? 'borderBottomWidth' : 'marginBottom';
|
|
344
|
+
style[property] = sizes.spacingBottom;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
const rowClassNames = apiRef.current.unstable_applyPipeProcessors('rowClassName', [], rowId);
|
|
348
|
+
|
|
349
|
+
if (typeof rootProps.getRowClassName === 'function') {
|
|
350
|
+
var _currentPage$range;
|
|
351
|
+
|
|
352
|
+
const indexRelativeToCurrentPage = index - (((_currentPage$range = currentPage.range) == null ? void 0 : _currentPage$range.firstRowIndex) || 0);
|
|
353
|
+
const rowParams = (0, _extends2.default)({}, apiRef.current.getRowParams(rowId), {
|
|
354
|
+
isFirstVisible: indexRelativeToCurrentPage === 0,
|
|
355
|
+
isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1,
|
|
356
|
+
indexRelativeToCurrentPage
|
|
357
|
+
});
|
|
358
|
+
rowClassNames.push(rootProps.getRowClassName(rowParams));
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
const randomNumber = (0, _utils.randomNumberBetween)(10000, 20, 80);
|
|
362
|
+
const cells = [];
|
|
363
|
+
|
|
364
|
+
for (let i = 0; i < renderedColumns.length; i += 1) {
|
|
365
|
+
const column = renderedColumns[i];
|
|
366
|
+
const indexRelativeToAllColumns = firstColumnToRender + i;
|
|
367
|
+
const isLastColumn = indexRelativeToAllColumns === visibleColumns.length - 1;
|
|
368
|
+
const removeLastBorderRight = isLastColumn && hasScrollX && !hasScrollY;
|
|
369
|
+
const showRightBorder = !isLastColumn ? rootProps.showCellRightBorder : !removeLastBorderRight && rootProps.disableExtendRowFullWidth;
|
|
315
370
|
const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
|
|
316
371
|
|
|
317
372
|
if (cellColSpanInfo && !cellColSpanInfo.spannedByColSpan) {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
}
|
|
342
|
-
children: content
|
|
343
|
-
}), column.field));
|
|
373
|
+
if (row) {
|
|
374
|
+
const {
|
|
375
|
+
colSpan,
|
|
376
|
+
width
|
|
377
|
+
} = cellColSpanInfo.cellProps;
|
|
378
|
+
const cellProps = {
|
|
379
|
+
width,
|
|
380
|
+
colSpan,
|
|
381
|
+
showRightBorder,
|
|
382
|
+
indexRelativeToAllColumns
|
|
383
|
+
};
|
|
384
|
+
cells.push(getCell(column, cellProps));
|
|
385
|
+
} else {
|
|
386
|
+
const {
|
|
387
|
+
width
|
|
388
|
+
} = cellColSpanInfo.cellProps;
|
|
389
|
+
const contentWidth = Math.round(randomNumber());
|
|
390
|
+
cells.push( /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.components.SkeletonCell, {
|
|
391
|
+
width: width,
|
|
392
|
+
contentWidth: contentWidth,
|
|
393
|
+
field: column.field,
|
|
394
|
+
align: column.align
|
|
395
|
+
}, column.field));
|
|
396
|
+
}
|
|
344
397
|
}
|
|
345
398
|
}
|
|
346
399
|
|
|
347
400
|
const emptyCellWidth = containerWidth - columnsTotalWidth;
|
|
401
|
+
const eventHandlers = row ? {
|
|
402
|
+
onClick: publishClick,
|
|
403
|
+
onDoubleClick: publish('rowDoubleClick', onDoubleClick),
|
|
404
|
+
onMouseEnter: publish('rowMouseEnter', onMouseEnter),
|
|
405
|
+
onMouseLeave: publish('rowMouseLeave', onMouseLeave)
|
|
406
|
+
} : null;
|
|
348
407
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _extends2.default)({
|
|
349
408
|
ref: ref,
|
|
350
409
|
"data-id": rowId,
|
|
351
410
|
"data-rowindex": index,
|
|
352
411
|
role: "row",
|
|
353
|
-
className: (0, _clsx.default)(
|
|
412
|
+
className: (0, _clsx.default)(...rowClassNames, classes.root, className),
|
|
354
413
|
"aria-rowindex": ariaRowIndex,
|
|
355
414
|
"aria-selected": selected,
|
|
356
|
-
style: style
|
|
357
|
-
|
|
358
|
-
onDoubleClick: publish('rowDoubleClick', onDoubleClick),
|
|
359
|
-
onMouseEnter: publish('rowMouseEnter', onMouseEnter),
|
|
360
|
-
onMouseLeave: publish('rowMouseLeave', onMouseLeave)
|
|
361
|
-
}, other, {
|
|
415
|
+
style: style
|
|
416
|
+
}, eventHandlers, other, {
|
|
362
417
|
children: [cells, emptyCellWidth > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(EmptyCell, {
|
|
363
418
|
width: emptyCellWidth
|
|
364
419
|
})]
|
|
@@ -383,8 +438,9 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
|
|
|
383
438
|
index: _propTypes.default.number.isRequired,
|
|
384
439
|
isLastVisible: _propTypes.default.bool,
|
|
385
440
|
lastColumnToRender: _propTypes.default.number.isRequired,
|
|
441
|
+
position: _propTypes.default.oneOf(['center', 'left', 'right']).isRequired,
|
|
386
442
|
renderedColumns: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
|
|
387
|
-
row: _propTypes.default.object
|
|
443
|
+
row: _propTypes.default.object,
|
|
388
444
|
rowHeight: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number]).isRequired,
|
|
389
445
|
rowId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
390
446
|
selected: _propTypes.default.bool.isRequired,
|
|
@@ -144,7 +144,8 @@ process.env.NODE_ENV !== "production" ? GridBooleanCellRaw.propTypes = {
|
|
|
144
144
|
tabIndex: _propTypes.default.oneOf([-1, 0]).isRequired,
|
|
145
145
|
|
|
146
146
|
/**
|
|
147
|
-
* The cell value
|
|
147
|
+
* The cell value.
|
|
148
|
+
* If the column has `valueGetter`, use `params.row` to directly access the fields.
|
|
148
149
|
*/
|
|
149
150
|
value: _propTypes.default.any
|
|
150
151
|
} : void 0;
|
|
@@ -122,6 +122,14 @@ function GridCell(props) {
|
|
|
122
122
|
onMouseUp(event);
|
|
123
123
|
}
|
|
124
124
|
}, [apiRef, field, onMouseUp, rowId]);
|
|
125
|
+
const publishMouseDown = React.useCallback(eventName => event => {
|
|
126
|
+
const params = apiRef.current.getCellParams(rowId, field || '');
|
|
127
|
+
apiRef.current.publishEvent(eventName, params, event);
|
|
128
|
+
|
|
129
|
+
if (onMouseDown) {
|
|
130
|
+
onMouseDown(event);
|
|
131
|
+
}
|
|
132
|
+
}, [apiRef, field, onMouseDown, rowId]);
|
|
125
133
|
const publish = React.useCallback((eventName, propHandler) => event => {
|
|
126
134
|
// Ignore portal
|
|
127
135
|
if (!event.currentTarget.contains(event.target)) {
|
|
@@ -226,7 +234,7 @@ function GridCell(props) {
|
|
|
226
234
|
tabIndex: (cellMode === 'view' || !isEditable) && !managesOwnFocus ? tabIndex : -1,
|
|
227
235
|
onClick: publish('cellClick', onClick),
|
|
228
236
|
onDoubleClick: publish('cellDoubleClick', onDoubleClick),
|
|
229
|
-
onMouseDown:
|
|
237
|
+
onMouseDown: publishMouseDown('cellMouseDown'),
|
|
230
238
|
onMouseUp: publishMouseUp('cellMouseUp'),
|
|
231
239
|
onKeyDown: publish('cellKeyDown', onKeyDown)
|
|
232
240
|
}, draggableEventHandlers, other, {
|
|
@@ -185,7 +185,8 @@ process.env.NODE_ENV !== "production" ? GridEditBooleanCell.propTypes = {
|
|
|
185
185
|
tabIndex: _propTypes.default.oneOf([-1, 0]).isRequired,
|
|
186
186
|
|
|
187
187
|
/**
|
|
188
|
-
* The cell value
|
|
188
|
+
* The cell value.
|
|
189
|
+
* If the column has `valueGetter`, use `params.row` to directly access the fields.
|
|
189
190
|
*/
|
|
190
191
|
value: _propTypes.default.any
|
|
191
192
|
} : void 0;
|
|
@@ -241,7 +241,8 @@ process.env.NODE_ENV !== "production" ? GridEditDateCell.propTypes = {
|
|
|
241
241
|
tabIndex: _propTypes.default.oneOf([-1, 0]).isRequired,
|
|
242
242
|
|
|
243
243
|
/**
|
|
244
|
-
* The cell value
|
|
244
|
+
* The cell value.
|
|
245
|
+
* If the column has `valueGetter`, use `params.row` to directly access the fields.
|
|
245
246
|
*/
|
|
246
247
|
value: _propTypes.default.any
|
|
247
248
|
} : void 0;
|
|
@@ -204,7 +204,8 @@ process.env.NODE_ENV !== "production" ? GridEditInputCell.propTypes = {
|
|
|
204
204
|
tabIndex: _propTypes.default.oneOf([-1, 0]),
|
|
205
205
|
|
|
206
206
|
/**
|
|
207
|
-
* The cell value
|
|
207
|
+
* The cell value.
|
|
208
|
+
* If the column has `valueGetter`, use `params.row` to directly access the fields.
|
|
208
209
|
*/
|
|
209
210
|
value: _propTypes.default.any
|
|
210
211
|
} : void 0;
|
|
@@ -288,7 +288,8 @@ process.env.NODE_ENV !== "production" ? GridEditSingleSelectCell.propTypes = {
|
|
|
288
288
|
tabIndex: _propTypes.default.oneOf([-1, 0]).isRequired,
|
|
289
289
|
|
|
290
290
|
/**
|
|
291
|
-
* The cell value
|
|
291
|
+
* The cell value.
|
|
292
|
+
* If the column has `valueGetter`, use `params.row` to directly access the fields.
|
|
292
293
|
*/
|
|
293
294
|
value: _propTypes.default.any
|
|
294
295
|
} : void 0;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.GridSkeletonCell = GridSkeletonCell;
|
|
9
|
+
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
12
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
13
|
+
|
|
14
|
+
var React = _interopRequireWildcard(require("react"));
|
|
15
|
+
|
|
16
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
+
|
|
18
|
+
var _Skeleton = _interopRequireDefault(require("@mui/material/Skeleton"));
|
|
19
|
+
|
|
20
|
+
var _utils = require("@mui/material/utils");
|
|
21
|
+
|
|
22
|
+
var _material = require("@mui/material");
|
|
23
|
+
|
|
24
|
+
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
25
|
+
|
|
26
|
+
var _gridClasses = require("../../constants/gridClasses");
|
|
27
|
+
|
|
28
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
|
+
|
|
30
|
+
const _excluded = ["field", "align", "width", "contentWidth"];
|
|
31
|
+
|
|
32
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
|
+
|
|
34
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
35
|
+
|
|
36
|
+
const useUtilityClasses = ownerState => {
|
|
37
|
+
const {
|
|
38
|
+
align,
|
|
39
|
+
classes
|
|
40
|
+
} = ownerState;
|
|
41
|
+
const slots = {
|
|
42
|
+
root: ['cell', 'cellSkeleton', `cell--text${(0, _utils.capitalize)(align)}`]
|
|
43
|
+
};
|
|
44
|
+
return (0, _material.unstable_composeClasses)(slots, _gridClasses.getDataGridUtilityClass, classes);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
function GridSkeletonCell(props) {
|
|
48
|
+
const {
|
|
49
|
+
align,
|
|
50
|
+
width,
|
|
51
|
+
contentWidth
|
|
52
|
+
} = props,
|
|
53
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
54
|
+
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
55
|
+
const ownerState = {
|
|
56
|
+
classes: rootProps.classes,
|
|
57
|
+
align
|
|
58
|
+
};
|
|
59
|
+
const classes = useUtilityClasses(ownerState);
|
|
60
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", (0, _extends2.default)({
|
|
61
|
+
className: classes.root,
|
|
62
|
+
style: {
|
|
63
|
+
width
|
|
64
|
+
}
|
|
65
|
+
}, other, {
|
|
66
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Skeleton.default, {
|
|
67
|
+
width: `${contentWidth}%`
|
|
68
|
+
})
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
process.env.NODE_ENV !== "production" ? GridSkeletonCell.propTypes = {
|
|
73
|
+
// ----------------------------- Warning --------------------------------
|
|
74
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
75
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
76
|
+
// ----------------------------------------------------------------------
|
|
77
|
+
align: _propTypes.default.string.isRequired,
|
|
78
|
+
contentWidth: _propTypes.default.number.isRequired,
|
|
79
|
+
field: _propTypes.default.string.isRequired,
|
|
80
|
+
width: _propTypes.default.number.isRequired
|
|
81
|
+
} : void 0;
|
|
@@ -106,4 +106,17 @@ Object.keys(_GridActionsCellItem).forEach(function (key) {
|
|
|
106
106
|
return _GridActionsCellItem[key];
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
var _GridSkeletonCell = require("./GridSkeletonCell");
|
|
112
|
+
|
|
113
|
+
Object.keys(_GridSkeletonCell).forEach(function (key) {
|
|
114
|
+
if (key === "default" || key === "__esModule") return;
|
|
115
|
+
if (key in exports && exports[key] === _GridSkeletonCell[key]) return;
|
|
116
|
+
Object.defineProperty(exports, key, {
|
|
117
|
+
enumerable: true,
|
|
118
|
+
get: function () {
|
|
119
|
+
return _GridSkeletonCell[key];
|
|
120
|
+
}
|
|
121
|
+
});
|
|
109
122
|
});
|
|
@@ -211,7 +211,8 @@ process.env.NODE_ENV !== "production" ? GridCellCheckboxForwardRef.propTypes = {
|
|
|
211
211
|
tabIndex: _propTypes.default.oneOf([-1, 0]).isRequired,
|
|
212
212
|
|
|
213
213
|
/**
|
|
214
|
-
* The cell value
|
|
214
|
+
* The cell value.
|
|
215
|
+
* If the column has `valueGetter`, use `params.row` to directly access the fields.
|
|
215
216
|
*/
|
|
216
217
|
value: _propTypes.default.any
|
|
217
218
|
} : void 0;
|
|
@@ -47,6 +47,8 @@ const GridRootStyles = (0, _styles.styled)('div', {
|
|
|
47
47
|
[`& .${_gridClasses.gridClasses.cellContent}`]: styles.cellContent
|
|
48
48
|
}, {
|
|
49
49
|
[`& .${_gridClasses.gridClasses.cellCheckbox}`]: styles.cellCheckbox
|
|
50
|
+
}, {
|
|
51
|
+
[`& .${_gridClasses.gridClasses.cellSkeleton}`]: styles.cellSkeleton
|
|
50
52
|
}, {
|
|
51
53
|
[`& .${_gridClasses.gridClasses.checkboxInput}`]: styles.checkboxInput
|
|
52
54
|
}, {
|
|
@@ -9,8 +9,12 @@ exports.GridColumnsPanel = GridColumnsPanel;
|
|
|
9
9
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
|
|
12
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
13
|
+
|
|
12
14
|
var React = _interopRequireWildcard(require("react"));
|
|
13
15
|
|
|
16
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
+
|
|
14
18
|
var _material = require("@mui/material");
|
|
15
19
|
|
|
16
20
|
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
@@ -45,6 +49,8 @@ var _gridClasses = require("../../constants/gridClasses");
|
|
|
45
49
|
|
|
46
50
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
47
51
|
|
|
52
|
+
const _excluded = ["sort"];
|
|
53
|
+
|
|
48
54
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
49
55
|
|
|
50
56
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -84,6 +90,7 @@ const GridColumnsPanelRowRoot = (0, _styles.styled)('div', {
|
|
|
84
90
|
const GridIconButtonRoot = (0, _styles.styled)(_IconButton.default)({
|
|
85
91
|
justifyContent: 'flex-end'
|
|
86
92
|
});
|
|
93
|
+
const collator = new Intl.Collator();
|
|
87
94
|
|
|
88
95
|
function GridColumnsPanel(props) {
|
|
89
96
|
var _rootProps$components, _rootProps$components3, _rootProps$components4;
|
|
@@ -98,6 +105,22 @@ function GridColumnsPanel(props) {
|
|
|
98
105
|
classes: rootProps.classes
|
|
99
106
|
};
|
|
100
107
|
const classes = useUtilityClasses(ownerState);
|
|
108
|
+
const {
|
|
109
|
+
sort
|
|
110
|
+
} = props,
|
|
111
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
112
|
+
const sortedColumns = React.useMemo(() => {
|
|
113
|
+
switch (sort) {
|
|
114
|
+
case 'asc':
|
|
115
|
+
return [...columns].sort((a, b) => collator.compare(a.headerName || a.field, b.headerName || b.field));
|
|
116
|
+
|
|
117
|
+
case 'desc':
|
|
118
|
+
return [...columns].sort((a, b) => -collator.compare(a.headerName || a.field, b.headerName || b.field));
|
|
119
|
+
|
|
120
|
+
default:
|
|
121
|
+
return columns;
|
|
122
|
+
}
|
|
123
|
+
}, [columns, sort]);
|
|
101
124
|
|
|
102
125
|
const toggleColumn = event => {
|
|
103
126
|
const {
|
|
@@ -132,16 +155,16 @@ function GridColumnsPanel(props) {
|
|
|
132
155
|
}, []);
|
|
133
156
|
const currentColumns = React.useMemo(() => {
|
|
134
157
|
if (!searchValue) {
|
|
135
|
-
return
|
|
158
|
+
return sortedColumns;
|
|
136
159
|
}
|
|
137
160
|
|
|
138
161
|
const searchValueToCheck = searchValue.toLowerCase();
|
|
139
|
-
return
|
|
140
|
-
}, [
|
|
162
|
+
return sortedColumns.filter(column => (column.headerName || column.field).toLowerCase().indexOf(searchValueToCheck) > -1);
|
|
163
|
+
}, [sortedColumns, searchValue]);
|
|
141
164
|
React.useEffect(() => {
|
|
142
165
|
searchInputRef.current.focus();
|
|
143
166
|
}, []);
|
|
144
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_GridPanelWrapper.GridPanelWrapper, (0, _extends2.default)({},
|
|
167
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_GridPanelWrapper.GridPanelWrapper, (0, _extends2.default)({}, other, {
|
|
145
168
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_GridPanelHeader.GridPanelHeader, {
|
|
146
169
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.components.BaseTextField, (0, _extends2.default)({
|
|
147
170
|
label: apiRef.current.getLocaleText('columnsPanelTextFieldLabel'),
|
|
@@ -192,4 +215,12 @@ function GridColumnsPanel(props) {
|
|
|
192
215
|
}))]
|
|
193
216
|
})]
|
|
194
217
|
}));
|
|
195
|
-
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
process.env.NODE_ENV !== "production" ? GridColumnsPanel.propTypes = {
|
|
221
|
+
// ----------------------------- Warning --------------------------------
|
|
222
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
223
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
224
|
+
// ----------------------------------------------------------------------
|
|
225
|
+
sort: _propTypes.default.oneOf(['asc', 'desc'])
|
|
226
|
+
} : void 0;
|
|
@@ -74,6 +74,7 @@ const DATA_GRID_DEFAULT_SLOTS_COMPONENTS = (0, _extends2.default)({}, DEFAULT_GR
|
|
|
74
74
|
BaseTooltip: _Tooltip.default,
|
|
75
75
|
BasePopper: _Popper.default,
|
|
76
76
|
Cell: _components.GridCell,
|
|
77
|
+
SkeletonCell: _components.GridSkeletonCell,
|
|
77
78
|
ColumnHeaderFilterIconButton: _components.GridColumnHeaderFilterIconButton,
|
|
78
79
|
ColumnMenu: _components.GridColumnMenu,
|
|
79
80
|
ErrorOverlay: _ErrorOverlay.ErrorOverlay,
|
|
@@ -12,5 +12,5 @@ function getDataGridUtilityClass(slot) {
|
|
|
12
12
|
return (0, _material.generateUtilityClass)('MuiDataGrid', slot);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const gridClasses = (0, _material.generateUtilityClasses)('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'autoHeight', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--withRenderer', 'cell', 'cellContent', 'cellCheckbox', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderDropZone', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnGroupHeader', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeader--showColumnBorder', 'columnHeaders', 'columnHeadersInner', 'columnHeadersInner--scrollable', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsPanel', 'columnsPanelRow', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filterForm', 'filterFormDeleteIcon', 'filterFormLinkOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'iconButtonContainer', 'iconSeparator', 'main', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'row', 'row--editable', 'row--editing', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'pinnedColumns--left', 'pinnedColumns--right', 'pinnedColumnHeaders', 'pinnedColumnHeaders--left', 'pinnedColumnHeaders--right', 'withBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pinnedRowsRenderZone']);
|
|
15
|
+
const gridClasses = (0, _material.generateUtilityClasses)('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'autoHeight', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--withRenderer', 'cell', 'cellContent', 'cellCheckbox', 'cellSkeleton', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderDropZone', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnGroupHeader', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeader--showColumnBorder', 'columnHeaders', 'columnHeadersInner', 'columnHeadersInner--scrollable', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsPanel', 'columnsPanelRow', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filterForm', 'filterFormDeleteIcon', 'filterFormLinkOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'iconButtonContainer', 'iconSeparator', 'main', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'row', 'row--editable', 'row--editing', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'pinnedColumns--left', 'pinnedColumns--right', 'pinnedColumnHeaders', 'pinnedColumnHeaders--left', 'pinnedColumnHeaders--right', 'withBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pinnedRowsRenderZone']);
|
|
16
16
|
exports.gridClasses = gridClasses;
|
|
@@ -29,6 +29,8 @@ var _warning = require("../../../utils/warning");
|
|
|
29
29
|
|
|
30
30
|
var _gridRowsSelector = require("../rows/gridRowsSelector");
|
|
31
31
|
|
|
32
|
+
var _utils = require("../../../utils/utils");
|
|
33
|
+
|
|
32
34
|
var _gridEditCellParams = require("../../../models/params/gridEditCellParams");
|
|
33
35
|
|
|
34
36
|
const _excluded = ["id", "field"],
|
|
@@ -339,7 +341,11 @@ const useGridCellEditing = (apiRef, props) => {
|
|
|
339
341
|
if (error || isProcessingProps) {
|
|
340
342
|
// Attempt to change cell mode to "view" was not successful
|
|
341
343
|
// Update previous mode to allow another attempt
|
|
342
|
-
prevCellModesModel.current[id][field].mode = _gridEditRowModel.GridCellModes.Edit;
|
|
344
|
+
prevCellModesModel.current[id][field].mode = _gridEditRowModel.GridCellModes.Edit; // Revert the mode in the cellModesModel prop back to "edit"
|
|
345
|
+
|
|
346
|
+
updateFieldInCellModesModel(id, field, {
|
|
347
|
+
mode: _gridEditRowModel.GridCellModes.Edit
|
|
348
|
+
});
|
|
343
349
|
return;
|
|
344
350
|
}
|
|
345
351
|
|
|
@@ -456,7 +462,8 @@ const useGridCellEditing = (apiRef, props) => {
|
|
|
456
462
|
const idToIdLookup = (0, _gridRowsSelector.gridRowsIdToIdLookupSelector)(apiRef); // Update the ref here because updateStateToStopCellEditMode may change it later
|
|
457
463
|
|
|
458
464
|
const copyOfPrevCellModes = prevCellModesModel.current;
|
|
459
|
-
prevCellModesModel.current = cellModesModel;
|
|
465
|
+
prevCellModesModel.current = (0, _utils.deepClone)(cellModesModel); // Do a deep-clone because the attributes might be changed later
|
|
466
|
+
|
|
460
467
|
Object.entries(cellModesModel).forEach(([id, fields]) => {
|
|
461
468
|
Object.entries(fields).forEach(([field, params]) => {
|
|
462
469
|
var _copyOfPrevCellModes$, _copyOfPrevCellModes$2, _idToIdLookup$id;
|