@mui/x-data-grid 7.22.1 → 8.0.0-alpha.0
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 +143 -92
- package/README.md +2 -2
- package/colDef/gridBooleanOperators.js +4 -6
- package/components/GridDetailPanels.js +0 -1
- package/components/GridPinnedRows.js +0 -1
- package/components/GridRow.d.ts +2 -2
- package/components/GridRow.js +3 -28
- package/components/base/GridOverlays.js +10 -8
- package/components/cell/GridActionsCell.js +1 -2
- package/components/cell/GridActionsCellItem.js +1 -2
- package/components/cell/GridCell.d.ts +41 -3
- package/components/cell/GridCell.js +1 -9
- package/components/cell/GridEditInputCell.js +0 -67
- package/components/containers/GridRootStyles.js +1 -0
- package/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.js +1 -2
- package/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.js +1 -2
- package/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.js +1 -2
- package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +3 -4
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputBoolean.d.ts +1 -0
- package/components/panel/filterPanel/GridFilterInputBoolean.js +14 -5
- package/components/toolbar/GridToolbar.d.ts +2 -2
- package/components/toolbar/GridToolbar.js +12 -4
- package/components/toolbar/GridToolbarColumnsButton.js +1 -1
- package/components/toolbar/GridToolbarDensitySelector.js +2 -4
- package/components/toolbar/GridToolbarExport.d.ts +2 -2
- package/components/toolbar/GridToolbarExport.js +9 -6
- package/components/toolbar/GridToolbarExportContainer.js +1 -2
- package/components/toolbar/index.d.ts +1 -1
- package/components/virtualization/GridVirtualScrollbar.js +6 -0
- package/hooks/features/columnResize/useGridColumnResize.js +4 -2
- package/hooks/features/editing/useGridCellEditing.js +23 -4
- package/hooks/features/editing/useGridRowEditing.js +23 -2
- package/hooks/features/export/useGridCsvExport.js +1 -1
- package/hooks/features/export/useGridPrintExport.js +1 -1
- package/hooks/features/pagination/useGridPaginationModel.js +2 -2
- package/hooks/features/rowSelection/useGridRowSelection.d.ts +1 -1
- package/hooks/features/rowSelection/useGridRowSelection.js +30 -16
- package/hooks/features/rows/gridRowsUtils.d.ts +1 -1
- package/hooks/features/rows/gridRowsUtils.js +1 -5
- package/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
- package/hooks/utils/useGridSelector.d.ts +3 -2
- package/hooks/utils/useGridSelector.js +27 -2
- package/index.d.ts +0 -1
- package/index.js +1 -1
- package/locales/plPL.js +25 -28
- package/locales/trTR.js +2 -2
- package/material/index.js +4 -0
- package/models/gridSlotsComponent.d.ts +10 -0
- package/models/gridSlotsComponentsProps.d.ts +8 -0
- package/models/props/DataGridProps.d.ts +1 -1
- package/modern/colDef/gridBooleanOperators.js +4 -6
- package/modern/components/GridDetailPanels.js +0 -1
- package/modern/components/GridPinnedRows.js +0 -1
- package/modern/components/GridRow.js +3 -28
- package/modern/components/base/GridOverlays.js +10 -8
- package/modern/components/cell/GridActionsCell.js +1 -2
- package/modern/components/cell/GridActionsCellItem.js +1 -2
- package/modern/components/cell/GridCell.js +1 -9
- package/modern/components/cell/GridEditInputCell.js +0 -67
- package/modern/components/containers/GridRootStyles.js +1 -0
- package/modern/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.js +1 -2
- package/modern/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.js +1 -2
- package/modern/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.js +1 -2
- package/modern/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +3 -4
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +14 -5
- package/modern/components/toolbar/GridToolbar.js +12 -4
- package/modern/components/toolbar/GridToolbarColumnsButton.js +1 -1
- package/modern/components/toolbar/GridToolbarDensitySelector.js +2 -4
- package/modern/components/toolbar/GridToolbarExport.js +9 -6
- package/modern/components/toolbar/GridToolbarExportContainer.js +1 -2
- package/modern/components/virtualization/GridVirtualScrollbar.js +6 -0
- package/modern/hooks/features/columnResize/useGridColumnResize.js +4 -2
- package/modern/hooks/features/editing/useGridCellEditing.js +23 -4
- package/modern/hooks/features/editing/useGridRowEditing.js +23 -2
- package/modern/hooks/features/export/useGridCsvExport.js +1 -1
- package/modern/hooks/features/export/useGridPrintExport.js +1 -1
- package/modern/hooks/features/pagination/useGridPaginationModel.js +2 -2
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +30 -16
- package/modern/hooks/features/rows/gridRowsUtils.js +1 -5
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
- package/modern/hooks/utils/useGridSelector.js +27 -2
- package/modern/index.js +1 -1
- package/modern/locales/plPL.js +25 -28
- package/modern/locales/trTR.js +2 -2
- package/modern/material/index.js +4 -0
- package/modern/utils/createSelector.js +11 -1
- package/modern/utils/utils.js +1 -3
- package/node/colDef/gridBooleanOperators.js +3 -5
- package/node/components/GridDetailPanels.js +0 -1
- package/node/components/GridPinnedRows.js +0 -1
- package/node/components/GridRow.js +3 -28
- package/node/components/base/GridOverlays.js +10 -8
- package/node/components/cell/GridActionsCell.js +1 -2
- package/node/components/cell/GridActionsCellItem.js +1 -2
- package/node/components/cell/GridCell.js +1 -9
- package/node/components/cell/GridEditInputCell.js +0 -67
- package/node/components/containers/GridRootStyles.js +1 -0
- package/node/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.js +1 -2
- package/node/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.js +1 -2
- package/node/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.js +1 -2
- package/node/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +3 -4
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +16 -5
- package/node/components/toolbar/GridToolbar.js +12 -4
- package/node/components/toolbar/GridToolbarColumnsButton.js +3 -3
- package/node/components/toolbar/GridToolbarDensitySelector.js +2 -4
- package/node/components/toolbar/GridToolbarExport.js +9 -6
- package/node/components/toolbar/GridToolbarExportContainer.js +1 -2
- package/node/components/virtualization/GridVirtualScrollbar.js +6 -0
- package/node/hooks/features/columnResize/useGridColumnResize.js +4 -2
- package/node/hooks/features/editing/useGridCellEditing.js +23 -4
- package/node/hooks/features/editing/useGridRowEditing.js +23 -2
- package/node/hooks/features/export/useGridCsvExport.js +2 -2
- package/node/hooks/features/export/useGridPrintExport.js +2 -2
- package/node/hooks/features/pagination/useGridPaginationModel.js +2 -2
- package/node/hooks/features/rowSelection/useGridRowSelection.js +29 -15
- package/node/hooks/features/rows/gridRowsUtils.js +2 -8
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
- package/node/hooks/utils/useGridSelector.js +29 -3
- package/node/index.js +1 -1
- package/node/locales/plPL.js +25 -28
- package/node/locales/trTR.js +2 -2
- package/node/material/index.js +4 -0
- package/node/utils/createSelector.js +11 -1
- package/node/utils/utils.js +1 -3
- package/package.json +3 -3
- package/utils/createSelector.d.ts +1 -1
- package/utils/createSelector.js +11 -1
- package/utils/utils.js +1 -3
|
@@ -326,10 +326,11 @@ const useGridRowEditing = (apiRef, props) => {
|
|
|
326
326
|
if (!cellParams.isEditable) {
|
|
327
327
|
return acc;
|
|
328
328
|
}
|
|
329
|
+
const column = apiRef.current.getColumn(field);
|
|
329
330
|
let newValue = apiRef.current.getCellValue(id, field);
|
|
330
331
|
if (fieldToFocus === field && (deleteValue || initialValue)) {
|
|
331
332
|
if (deleteValue) {
|
|
332
|
-
newValue = (0, _utils3.getDefaultCellValue)(
|
|
333
|
+
newValue = (0, _utils3.getDefaultCellValue)(column);
|
|
333
334
|
} else if (initialValue) {
|
|
334
335
|
newValue = initialValue;
|
|
335
336
|
}
|
|
@@ -337,7 +338,7 @@ const useGridRowEditing = (apiRef, props) => {
|
|
|
337
338
|
acc[field] = {
|
|
338
339
|
value: newValue,
|
|
339
340
|
error: false,
|
|
340
|
-
isProcessingProps:
|
|
341
|
+
isProcessingProps: !!column.preProcessEditCellProps && deleteValue
|
|
341
342
|
};
|
|
342
343
|
return acc;
|
|
343
344
|
}, {});
|
|
@@ -345,6 +346,26 @@ const useGridRowEditing = (apiRef, props) => {
|
|
|
345
346
|
if (fieldToFocus) {
|
|
346
347
|
apiRef.current.setCellFocus(id, fieldToFocus);
|
|
347
348
|
}
|
|
349
|
+
columnFields.filter(field => !!apiRef.current.getColumn(field).preProcessEditCellProps && deleteValue).forEach(field => {
|
|
350
|
+
const column = apiRef.current.getColumn(field);
|
|
351
|
+
const value = apiRef.current.getCellValue(id, field);
|
|
352
|
+
const newValue = deleteValue ? (0, _utils3.getDefaultCellValue)(column) : initialValue ?? value;
|
|
353
|
+
Promise.resolve(column.preProcessEditCellProps({
|
|
354
|
+
id,
|
|
355
|
+
row: apiRef.current.getRow(id),
|
|
356
|
+
props: newProps[field],
|
|
357
|
+
hasChanged: newValue !== value
|
|
358
|
+
})).then(processedProps => {
|
|
359
|
+
// Check if still in edit mode before updating
|
|
360
|
+
if (apiRef.current.getRowMode(id) === _gridEditRowModel.GridRowModes.Edit) {
|
|
361
|
+
const editingState = (0, _gridEditingSelectors.gridEditRowsStateSelector)(apiRef.current.state);
|
|
362
|
+
updateOrDeleteFieldState(id, field, (0, _extends2.default)({}, processedProps, {
|
|
363
|
+
value: editingState[id][field].value,
|
|
364
|
+
isProcessingProps: false
|
|
365
|
+
}));
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
});
|
|
348
369
|
});
|
|
349
370
|
const stopRowEditMode = React.useCallback(params => {
|
|
350
371
|
const {
|
|
@@ -12,7 +12,7 @@ var _exportAs = require("../../../utils/exportAs");
|
|
|
12
12
|
var _csvSerializer = require("./serializers/csvSerializer");
|
|
13
13
|
var _utils = require("./utils");
|
|
14
14
|
var _pipeProcessing = require("../../core/pipeProcessing");
|
|
15
|
-
var
|
|
15
|
+
var _toolbar = require("../../../components/toolbar");
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
17
|
/**
|
|
18
18
|
* @requires useGridColumns (state)
|
|
@@ -71,7 +71,7 @@ const useGridCsvExport = (apiRef, props) => {
|
|
|
71
71
|
return initialValue;
|
|
72
72
|
}
|
|
73
73
|
return [...initialValue, {
|
|
74
|
-
component: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
74
|
+
component: /*#__PURE__*/(0, _jsxRuntime.jsx)(_toolbar.GridCsvExportMenuItem, {
|
|
75
75
|
options: options.csvOptions
|
|
76
76
|
}),
|
|
77
77
|
componentName: 'csvExport'
|
|
@@ -19,7 +19,7 @@ var _gridRowsUtils = require("../rows/gridRowsUtils");
|
|
|
19
19
|
var _utils2 = require("./utils");
|
|
20
20
|
var _useGridPaginationModel = require("../pagination/useGridPaginationModel");
|
|
21
21
|
var _pipeProcessing = require("../../core/pipeProcessing");
|
|
22
|
-
var
|
|
22
|
+
var _toolbar = require("../../../components/toolbar");
|
|
23
23
|
var _gridColumnsUtils = require("../columns/gridColumnsUtils");
|
|
24
24
|
var _gridCheckboxSelectionColDef = require("../../../colDef/gridCheckboxSelectionColDef");
|
|
25
25
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -288,7 +288,7 @@ const useGridPrintExport = (apiRef, props) => {
|
|
|
288
288
|
return initialValue;
|
|
289
289
|
}
|
|
290
290
|
return [...initialValue, {
|
|
291
|
-
component: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
291
|
+
component: /*#__PURE__*/(0, _jsxRuntime.jsx)(_toolbar.GridPrintExportMenuItem, {
|
|
292
292
|
options: options.printOptions
|
|
293
293
|
}),
|
|
294
294
|
componentName: 'printExport'
|
|
@@ -84,7 +84,7 @@ const useGridPaginationModel = (apiRef, props) => {
|
|
|
84
84
|
pagination: (0, _extends2.default)({}, state.pagination, {
|
|
85
85
|
paginationModel: getDerivedPaginationModel(state.pagination, props.signature, paginationModel)
|
|
86
86
|
})
|
|
87
|
-
}));
|
|
87
|
+
}), 'setPaginationModel');
|
|
88
88
|
}, [apiRef, logger, props.signature]);
|
|
89
89
|
const paginationModelApi = {
|
|
90
90
|
setPage,
|
|
@@ -122,7 +122,7 @@ const useGridPaginationModel = (apiRef, props) => {
|
|
|
122
122
|
pagination: (0, _extends2.default)({}, state.pagination, {
|
|
123
123
|
paginationModel: getDerivedPaginationModel(state.pagination, props.signature, paginationModel)
|
|
124
124
|
})
|
|
125
|
-
}));
|
|
125
|
+
}), 'stateRestorePreProcessing');
|
|
126
126
|
return params;
|
|
127
127
|
}, [apiRef, props.autoPageSize, props.signature]);
|
|
128
128
|
(0, _pipeProcessing.useGridRegisterPipeProcessor)(apiRef, 'exportState', stateExportPreProcessing);
|
|
@@ -180,30 +180,33 @@ const useGridRowSelection = (apiRef, props) => {
|
|
|
180
180
|
let newSelection;
|
|
181
181
|
if (resetSelection) {
|
|
182
182
|
if (isSelected) {
|
|
183
|
-
newSelection = selectableIds;
|
|
183
|
+
newSelection = new Set(selectableIds);
|
|
184
184
|
if (applyAutoSelection) {
|
|
185
185
|
const addRow = rowId => {
|
|
186
|
-
newSelection.
|
|
186
|
+
newSelection.add(rowId);
|
|
187
187
|
};
|
|
188
188
|
selectableIds.forEach(id => {
|
|
189
189
|
(0, _utils.findRowsToSelect)(apiRef, tree, id, props.rowSelectionPropagation?.descendants ?? false, props.rowSelectionPropagation?.parents ?? false, addRow);
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
192
|
} else {
|
|
193
|
-
newSelection =
|
|
193
|
+
newSelection = new Set();
|
|
194
|
+
}
|
|
195
|
+
const currentLookup = (0, _gridRowSelectionSelector.selectedIdsLookupSelector)(apiRef);
|
|
196
|
+
if (newSelection.size === Object.keys(currentLookup).length && Array.from(newSelection).every(id => currentLookup[id] === id)) {
|
|
197
|
+
return;
|
|
194
198
|
}
|
|
195
199
|
} else {
|
|
196
|
-
|
|
197
|
-
const selectionLookup = (0, _extends2.default)({}, (0, _gridRowSelectionSelector.selectedIdsLookupSelector)(apiRef));
|
|
200
|
+
newSelection = new Set(Object.values((0, _gridRowSelectionSelector.selectedIdsLookupSelector)(apiRef)));
|
|
198
201
|
const addRow = rowId => {
|
|
199
|
-
|
|
202
|
+
newSelection.add(rowId);
|
|
200
203
|
};
|
|
201
204
|
const removeRow = rowId => {
|
|
202
|
-
delete
|
|
205
|
+
newSelection.delete(rowId);
|
|
203
206
|
};
|
|
204
207
|
selectableIds.forEach(id => {
|
|
205
208
|
if (isSelected) {
|
|
206
|
-
|
|
209
|
+
newSelection.add(id);
|
|
207
210
|
if (applyAutoSelection) {
|
|
208
211
|
(0, _utils.findRowsToSelect)(apiRef, tree, id, props.rowSelectionPropagation?.descendants ?? false, props.rowSelectionPropagation?.parents ?? false, addRow);
|
|
209
212
|
}
|
|
@@ -214,11 +217,10 @@ const useGridRowSelection = (apiRef, props) => {
|
|
|
214
217
|
}
|
|
215
218
|
}
|
|
216
219
|
});
|
|
217
|
-
newSelection = Object.values(selectionLookup);
|
|
218
220
|
}
|
|
219
|
-
const isSelectionValid = newSelection.
|
|
221
|
+
const isSelectionValid = newSelection.size < 2 || canHaveMultipleSelection;
|
|
220
222
|
if (isSelectionValid) {
|
|
221
|
-
apiRef.current.setRowSelectionModel(newSelection);
|
|
223
|
+
apiRef.current.setRowSelectionModel(Array.from(newSelection));
|
|
222
224
|
}
|
|
223
225
|
}, [logger, applyAutoSelection, canHaveMultipleSelection, apiRef, tree, props.rowSelectionPropagation?.descendants, props.rowSelectionPropagation?.parents]);
|
|
224
226
|
const selectRowRange = React.useCallback(({
|
|
@@ -261,13 +263,20 @@ const useGridRowSelection = (apiRef, props) => {
|
|
|
261
263
|
return;
|
|
262
264
|
}
|
|
263
265
|
const currentSelection = (0, _gridRowSelectionSelector.gridRowSelectionStateSelector)(apiRef.current.state);
|
|
266
|
+
const rowsLookup = (0, _gridRowsSelector.gridRowsLookupSelector)(apiRef);
|
|
264
267
|
const filteredRowsLookup = (0, _gridFilterSelector.gridFilteredRowsLookupSelector)(apiRef);
|
|
265
268
|
|
|
266
269
|
// We clone the existing object to avoid mutating the same object returned by the selector to others part of the project
|
|
267
270
|
const selectionLookup = (0, _extends2.default)({}, (0, _gridRowSelectionSelector.selectedIdsLookupSelector)(apiRef));
|
|
271
|
+
const isNonExistent = id => {
|
|
272
|
+
if (props.filterMode === 'server') {
|
|
273
|
+
return !rowsLookup[id];
|
|
274
|
+
}
|
|
275
|
+
return filteredRowsLookup[id] !== true;
|
|
276
|
+
};
|
|
268
277
|
let hasChanged = false;
|
|
269
278
|
currentSelection.forEach(id => {
|
|
270
|
-
if (
|
|
279
|
+
if (isNonExistent(id)) {
|
|
271
280
|
if (props.keepNonExistentRowsSelected) {
|
|
272
281
|
return;
|
|
273
282
|
}
|
|
@@ -293,15 +302,20 @@ const useGridRowSelection = (apiRef, props) => {
|
|
|
293
302
|
}
|
|
294
303
|
}
|
|
295
304
|
});
|
|
296
|
-
|
|
305
|
+
|
|
306
|
+
// For nested data, on row tree updation (filtering, adding rows, etc.) when the selection is
|
|
307
|
+
// not empty, we need to re-run scanning of the tree to propagate the selection changes
|
|
308
|
+
// Example: A parent whose de-selected children are filtered out should now be selected
|
|
309
|
+
const shouldReapplyPropagation = isNestedData && props.rowSelectionPropagation?.parents && Object.keys(selectionLookup).length > 0;
|
|
310
|
+
if (hasChanged || shouldReapplyPropagation && !sortModelUpdated) {
|
|
297
311
|
const newSelection = Object.values(selectionLookup);
|
|
298
|
-
if (
|
|
312
|
+
if (shouldReapplyPropagation) {
|
|
299
313
|
apiRef.current.selectRows(newSelection, true, true);
|
|
300
314
|
} else {
|
|
301
315
|
apiRef.current.setRowSelectionModel(newSelection);
|
|
302
316
|
}
|
|
303
317
|
}
|
|
304
|
-
}, [apiRef, isNestedData, props.rowSelectionPropagation?.parents, props.keepNonExistentRowsSelected, tree]);
|
|
318
|
+
}, [apiRef, isNestedData, props.rowSelectionPropagation?.parents, props.keepNonExistentRowsSelected, props.filterMode, tree]);
|
|
305
319
|
const handleSingleRowSelection = React.useCallback((id, event) => {
|
|
306
320
|
const hasCtrlKey = event.metaKey || event.ctrlKey;
|
|
307
321
|
|
|
@@ -8,12 +8,9 @@ exports.buildRootGroup = exports.GRID_ROOT_GROUP_ID = exports.GRID_ID_AUTOGENERA
|
|
|
8
8
|
exports.calculatePinnedRowsHeight = calculatePinnedRowsHeight;
|
|
9
9
|
exports.checkGridRowIdIsValid = checkGridRowIdIsValid;
|
|
10
10
|
exports.computeRowsUpdates = computeRowsUpdates;
|
|
11
|
-
exports.createRowsInternalCache = void 0;
|
|
12
|
-
exports.getMinimalContentHeight = getMinimalContentHeight;
|
|
13
|
-
exports.updateCacheWithNewRows = exports.rowHeightWarning = exports.isAutogeneratedRowNode = exports.isAutogeneratedRow = exports.getValidRowHeight = exports.getTreeNodeDescendants = exports.getTopLevelRowCount = exports.getRowsStateFromCache = exports.getRowIdFromRowModel = exports.getRowHeightWarning = void 0;
|
|
11
|
+
exports.updateCacheWithNewRows = exports.rowHeightWarning = exports.minimalContentHeight = exports.isAutogeneratedRowNode = exports.isAutogeneratedRow = exports.getValidRowHeight = exports.getTreeNodeDescendants = exports.getTopLevelRowCount = exports.getRowsStateFromCache = exports.getRowIdFromRowModel = exports.getRowHeightWarning = exports.createRowsInternalCache = void 0;
|
|
14
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
13
|
var _gridRowsSelector = require("./gridRowsSelector");
|
|
16
|
-
var _gridDimensionsSelectors = require("../dimensions/gridDimensionsSelectors");
|
|
17
14
|
const GRID_ROOT_GROUP_ID = exports.GRID_ROOT_GROUP_ID = `auto-generated-group-node-root`;
|
|
18
15
|
const GRID_ID_AUTOGENERATED = exports.GRID_ID_AUTOGENERATED = Symbol('mui.id_autogenerated');
|
|
19
16
|
const buildRootGroup = () => ({
|
|
@@ -307,10 +304,7 @@ function calculatePinnedRowsHeight(apiRef) {
|
|
|
307
304
|
bottom: bottomPinnedRowsHeight
|
|
308
305
|
};
|
|
309
306
|
}
|
|
310
|
-
|
|
311
|
-
const dimensions = (0, _gridDimensionsSelectors.gridDimensionsSelector)(apiRef.current.state);
|
|
312
|
-
return `var(--DataGrid-overlayHeight, ${2 * dimensions.rowHeight}px)`;
|
|
313
|
-
}
|
|
307
|
+
const minimalContentHeight = exports.minimalContentHeight = 'var(--DataGrid-overlayHeight, calc(var(--height) * 2))';
|
|
314
308
|
function computeRowsUpdates(apiRef, updates, getRowId) {
|
|
315
309
|
const nonPinnedRowsUpdates = [];
|
|
316
310
|
updates.forEach(update => {
|
|
@@ -32,11 +32,11 @@ var _utils3 = require("../../../utils/utils");
|
|
|
32
32
|
var _gridRowSelectionSelector = require("../rowSelection/gridRowSelectionSelector");
|
|
33
33
|
var _gridRowsMetaSelector = require("../rows/gridRowsMetaSelector");
|
|
34
34
|
var _gridColumnsUtils = require("../columns/gridColumnsUtils");
|
|
35
|
-
var _gridRowsUtils = require("../rows/gridRowsUtils");
|
|
36
35
|
var _gridVirtualizationSelectors = require("./gridVirtualizationSelectors");
|
|
37
36
|
var _useGridVirtualization = require("./useGridVirtualization");
|
|
38
37
|
var _gridRowSpanningSelectors = require("../rows/gridRowSpanningSelectors");
|
|
39
38
|
var _gridListViewSelectors = require("../listView/gridListViewSelectors");
|
|
39
|
+
var _gridRowsUtils = require("../rows/gridRowsUtils");
|
|
40
40
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
41
41
|
const MINIMUM_COLUMN_WIDTH = 50;
|
|
42
42
|
var ScrollDirection = /*#__PURE__*/function (ScrollDirection) {
|
|
@@ -392,11 +392,11 @@ const useGridVirtualScroller = () => {
|
|
|
392
392
|
flexBasis: contentHeight,
|
|
393
393
|
flexShrink: 0
|
|
394
394
|
};
|
|
395
|
-
if (
|
|
396
|
-
size.flexBasis =
|
|
395
|
+
if (size.flexBasis === 0) {
|
|
396
|
+
size.flexBasis = _gridRowsUtils.minimalContentHeight; // Give room to show the overlay when there no rows.
|
|
397
397
|
}
|
|
398
398
|
return size;
|
|
399
|
-
}, [
|
|
399
|
+
}, [columnsTotalWidth, contentHeight, needsHorizontalScrollbar]);
|
|
400
400
|
React.useEffect(() => {
|
|
401
401
|
apiRef.current.publishEvent('virtualScrollerContentSizeChange');
|
|
402
402
|
}, [apiRef, contentSize]);
|
|
@@ -4,7 +4,7 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.useGridSelectorV8 = exports.useGridSelector = exports.objectShallowCompare = void 0;
|
|
7
|
+
exports.useGridSelectorV8 = exports.useGridSelector = exports.objectShallowCompare = exports.argsEqual = void 0;
|
|
8
8
|
var React = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _fastObjectShallowCompare = require("@mui/x-internals/fastObjectShallowCompare");
|
|
10
10
|
var _warning = require("@mui/x-internals/warning");
|
|
@@ -30,10 +30,27 @@ function applySelectorV8(apiRef, selector, args, instanceId) {
|
|
|
30
30
|
}
|
|
31
31
|
const defaultCompare = Object.is;
|
|
32
32
|
const objectShallowCompare = exports.objectShallowCompare = _fastObjectShallowCompare.fastObjectShallowCompare;
|
|
33
|
+
const arrayShallowCompare = (a, b) => {
|
|
34
|
+
if (a === b) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
return a.length === b.length && a.every((v, i) => v === b[i]);
|
|
38
|
+
};
|
|
39
|
+
const argsEqual = (prev, curr) => {
|
|
40
|
+
let fn = Object.is;
|
|
41
|
+
if (curr instanceof Array) {
|
|
42
|
+
fn = arrayShallowCompare;
|
|
43
|
+
} else if (curr instanceof Object) {
|
|
44
|
+
fn = objectShallowCompare;
|
|
45
|
+
}
|
|
46
|
+
return fn(prev, curr);
|
|
47
|
+
};
|
|
48
|
+
exports.argsEqual = argsEqual;
|
|
33
49
|
const createRefs = () => ({
|
|
34
50
|
state: null,
|
|
35
51
|
equals: null,
|
|
36
|
-
selector: null
|
|
52
|
+
selector: null,
|
|
53
|
+
args: null
|
|
37
54
|
});
|
|
38
55
|
|
|
39
56
|
// TODO v8: Remove this function
|
|
@@ -79,9 +96,18 @@ const useGridSelectorV8 = (apiRef, selector, args = undefined, equals = defaultC
|
|
|
79
96
|
refs.current.state = state;
|
|
80
97
|
refs.current.equals = equals;
|
|
81
98
|
refs.current.selector = selector;
|
|
99
|
+
const prevArgs = refs.current.args;
|
|
100
|
+
refs.current.args = args;
|
|
101
|
+
if (didInit && !argsEqual(prevArgs, args)) {
|
|
102
|
+
const newState = applySelectorV8(apiRef, refs.current.selector, refs.current.args, apiRef.current.instanceId);
|
|
103
|
+
if (!refs.current.equals(refs.current.state, newState)) {
|
|
104
|
+
refs.current.state = newState;
|
|
105
|
+
setState(newState);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
82
108
|
(0, _useOnMount.useOnMount)(() => {
|
|
83
109
|
return apiRef.current.store.subscribe(() => {
|
|
84
|
-
const newState = applySelectorV8(apiRef, refs.current.selector, args, apiRef.current.instanceId);
|
|
110
|
+
const newState = applySelectorV8(apiRef, refs.current.selector, refs.current.args, apiRef.current.instanceId);
|
|
85
111
|
if (!refs.current.equals(refs.current.state, newState)) {
|
|
86
112
|
refs.current.state = newState;
|
|
87
113
|
setState(newState);
|
package/node/index.js
CHANGED
package/node/locales/plPL.js
CHANGED
|
@@ -36,11 +36,10 @@ const plPLGrid = {
|
|
|
36
36
|
toolbarExportPrint: 'Drukuj',
|
|
37
37
|
toolbarExportExcel: 'Pobierz jako plik Excel',
|
|
38
38
|
// Columns management text
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
columnsManagementSearchTitle: 'Szukaj',
|
|
40
|
+
columnsManagementNoColumns: 'Brak kolumn',
|
|
41
|
+
columnsManagementShowHideAllText: 'Wyświetl/Ukryj wszystkie',
|
|
42
|
+
columnsManagementReset: 'Resetuj',
|
|
44
43
|
// Filter panel text
|
|
45
44
|
filterPanelAddFilter: 'Dodaj filtr',
|
|
46
45
|
filterPanelRemoveAll: 'Usuń wszystkie',
|
|
@@ -54,9 +53,9 @@ const plPLGrid = {
|
|
|
54
53
|
filterPanelInputPlaceholder: 'Filtrowana wartość',
|
|
55
54
|
// Filter operators text
|
|
56
55
|
filterOperatorContains: 'zawiera',
|
|
57
|
-
|
|
56
|
+
filterOperatorDoesNotContain: 'nie zawiera',
|
|
58
57
|
filterOperatorEquals: 'równa się',
|
|
59
|
-
|
|
58
|
+
filterOperatorDoesNotEqual: 'nie równa się',
|
|
60
59
|
filterOperatorStartsWith: 'zaczyna się od',
|
|
61
60
|
filterOperatorEndsWith: 'kończy się na',
|
|
62
61
|
filterOperatorIs: 'równa się',
|
|
@@ -77,27 +76,26 @@ const plPLGrid = {
|
|
|
77
76
|
|
|
78
77
|
// Header filter operators text
|
|
79
78
|
headerFilterOperatorContains: 'Zawiera',
|
|
80
|
-
|
|
79
|
+
headerFilterOperatorDoesNotContain: 'Nie zawiera',
|
|
81
80
|
headerFilterOperatorEquals: 'Równa się',
|
|
82
|
-
|
|
81
|
+
headerFilterOperatorDoesNotEqual: 'Nie równa się',
|
|
83
82
|
headerFilterOperatorStartsWith: 'Zaczyna się od',
|
|
84
83
|
headerFilterOperatorEndsWith: 'Kończy się na',
|
|
85
|
-
|
|
84
|
+
headerFilterOperatorIs: 'Jest',
|
|
86
85
|
headerFilterOperatorNot: 'Niepuste',
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
86
|
+
headerFilterOperatorAfter: 'Jest po',
|
|
87
|
+
headerFilterOperatorOnOrAfter: 'Jest w lub po',
|
|
88
|
+
headerFilterOperatorBefore: 'Jest przed',
|
|
89
|
+
headerFilterOperatorOnOrBefore: 'Jest w lub przed',
|
|
90
|
+
headerFilterOperatorIsEmpty: 'Jest pusty',
|
|
91
|
+
headerFilterOperatorIsNotEmpty: 'Nie jest pusty',
|
|
92
|
+
headerFilterOperatorIsAnyOf: 'Is any of',
|
|
93
|
+
'headerFilterOperator=': 'Równa się',
|
|
94
|
+
'headerFilterOperator!=': 'Nie równa się',
|
|
95
|
+
'headerFilterOperator>': 'Większy niż',
|
|
96
|
+
'headerFilterOperator>=': 'Większy lub równy',
|
|
97
|
+
'headerFilterOperator<': 'Mniejszy niż',
|
|
98
|
+
'headerFilterOperator<=': 'Mniejszy lub równe',
|
|
101
99
|
// Filter values text
|
|
102
100
|
filterValueAny: 'dowolny',
|
|
103
101
|
filterValueTrue: 'prawda',
|
|
@@ -145,14 +143,13 @@ const plPLGrid = {
|
|
|
145
143
|
groupColumn: name => `Grupuj według ${name}`,
|
|
146
144
|
unGroupColumn: name => `Rozgrupuj ${name}`,
|
|
147
145
|
// Master/detail
|
|
148
|
-
|
|
146
|
+
detailPanelToggle: 'Szczegóły',
|
|
149
147
|
expandDetailPanel: 'Rozwiń',
|
|
150
148
|
collapseDetailPanel: 'Zwiń',
|
|
151
149
|
// Row reordering text
|
|
152
|
-
rowReorderingHeaderName: 'Porządkowanie wierszy'
|
|
153
|
-
|
|
150
|
+
rowReorderingHeaderName: 'Porządkowanie wierszy',
|
|
154
151
|
// Aggregation
|
|
155
|
-
|
|
152
|
+
aggregationMenuItemHeader: 'Agregacja'
|
|
156
153
|
// aggregationFunctionLabelSum: 'sum',
|
|
157
154
|
// aggregationFunctionLabelAvg: 'avg',
|
|
158
155
|
// aggregationFunctionLabelMin: 'min',
|
package/node/locales/trTR.js
CHANGED
|
@@ -75,9 +75,9 @@ const trTRGrid = {
|
|
|
75
75
|
'filterOperator<=': '<=',
|
|
76
76
|
// Header filter operators text
|
|
77
77
|
headerFilterOperatorContains: 'Şunu içerir',
|
|
78
|
-
|
|
78
|
+
headerFilterOperatorDoesNotContain: 'İçermez',
|
|
79
79
|
headerFilterOperatorEquals: 'Şuna eşittir',
|
|
80
|
-
|
|
80
|
+
headerFilterOperatorDoesNotEqual: 'Eşit değildir',
|
|
81
81
|
headerFilterOperatorStartsWith: 'Şununla başlar',
|
|
82
82
|
headerFilterOperatorEndsWith: 'Şununla biter',
|
|
83
83
|
headerFilterOperatorIs: 'Eşittir',
|
package/node/material/index.js
CHANGED
|
@@ -9,6 +9,8 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var _Badge = _interopRequireDefault(require("@mui/material/Badge"));
|
|
10
10
|
var _Checkbox = _interopRequireDefault(require("@mui/material/Checkbox"));
|
|
11
11
|
var _Divider = _interopRequireDefault(require("@mui/material/Divider"));
|
|
12
|
+
var _MenuList = _interopRequireDefault(require("@mui/material/MenuList"));
|
|
13
|
+
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
12
14
|
var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
|
|
13
15
|
var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
|
|
14
16
|
var _Select = _interopRequireDefault(require("@mui/material/Select"));
|
|
@@ -63,6 +65,8 @@ const materialSlots = (0, _extends2.default)({}, iconSlots, {
|
|
|
63
65
|
baseBadge: _Badge.default,
|
|
64
66
|
baseCheckbox: _Checkbox.default,
|
|
65
67
|
baseDivider: _Divider.default,
|
|
68
|
+
baseMenuList: _MenuList.default,
|
|
69
|
+
baseMenuItem: _MenuItem.default,
|
|
66
70
|
baseTextField: _TextField.default,
|
|
67
71
|
baseFormControl: _FormControl.default,
|
|
68
72
|
baseSelect: _Select.default,
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.createSelectorV8 = exports.createSelectorMemoizedV8 = exports.createSelectorMemoized = exports.createSelector = void 0;
|
|
7
7
|
var _reselect = require("reselect");
|
|
8
8
|
var _warning = require("@mui/x-internals/warning");
|
|
9
|
+
var _useGridSelector = require("../hooks/utils/useGridSelector");
|
|
9
10
|
const reselectCreateSelector = (0, _reselect.createSelectorCreator)({
|
|
10
11
|
memoize: _reselect.lruMemoize,
|
|
11
12
|
memoizeOptions: {
|
|
@@ -223,11 +224,20 @@ const createSelectorMemoizedV8 = (...args) => {
|
|
|
223
224
|
const cacheArgs = cacheArgsInit ?? new Map();
|
|
224
225
|
const cacheFn = cacheArgs?.get(args);
|
|
225
226
|
if (cacheArgs && cacheFn) {
|
|
227
|
+
if (!(0, _useGridSelector.argsEqual)(cacheFn.selectorArgs, selectorArgs)) {
|
|
228
|
+
const reselectArgs = selectorArgs !== undefined ? [...args.slice(0, args.length - 1), () => selectorArgs, args[args.length - 1]] : args;
|
|
229
|
+
const fn = reselectCreateSelector(...reselectArgs);
|
|
230
|
+
fn.selectorArgs = selectorArgs;
|
|
231
|
+
cacheArgs.set(args, fn);
|
|
232
|
+
return fn(state, selectorArgs, cacheKey);
|
|
233
|
+
}
|
|
226
234
|
// We pass the cache key because the called selector might have as
|
|
227
235
|
// dependency another selector created with this `createSelector`.
|
|
228
236
|
return cacheFn(state, selectorArgs, cacheKey);
|
|
229
237
|
}
|
|
230
|
-
const
|
|
238
|
+
const reselectArgs = selectorArgs !== undefined ? [...args.slice(0, args.length - 1), () => selectorArgs, args[args.length - 1]] : args;
|
|
239
|
+
const fn = reselectCreateSelector(...reselectArgs);
|
|
240
|
+
fn.selectorArgs = selectorArgs;
|
|
231
241
|
if (!cacheArgsInit) {
|
|
232
242
|
cache.set(cacheKey, cacheArgs);
|
|
233
243
|
}
|
package/node/utils/utils.js
CHANGED
|
@@ -208,11 +208,9 @@ function deepClone(obj) {
|
|
|
208
208
|
return JSON.parse(JSON.stringify(obj));
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
212
211
|
/**
|
|
213
212
|
* Mark a value as used so eslint doesn't complain. Use this instead
|
|
214
213
|
* of a `eslint-disable-next-line react-hooks/exhaustive-deps` because
|
|
215
214
|
* that hint disables checks on all values instead of just one.
|
|
216
215
|
*/
|
|
217
|
-
function eslintUseValue(_) {}
|
|
218
|
-
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
216
|
+
function eslintUseValue(_) {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0-alpha.0",
|
|
4
4
|
"description": "The Community plan edition of the Data Grid components (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"directory": "packages/x-data-grid"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@babel/runtime": "^7.
|
|
40
|
+
"@babel/runtime": "^7.26.0",
|
|
41
41
|
"@mui/utils": "^5.16.6 || ^6.0.0",
|
|
42
42
|
"clsx": "^2.1.1",
|
|
43
43
|
"prop-types": "^15.8.1",
|
|
44
44
|
"reselect": "^5.1.1",
|
|
45
|
-
"@mui/x-internals": "
|
|
45
|
+
"@mui/x-internals": "8.0.0-alpha.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"@emotion/react": "^11.9.0",
|
|
@@ -13,7 +13,7 @@ export interface OutputSelectorV8<State, Args, Result> {
|
|
|
13
13
|
(apiRef: React.MutableRefObject<{
|
|
14
14
|
state: State;
|
|
15
15
|
instanceId: GridCoreApi['instanceId'];
|
|
16
|
-
}>, args
|
|
16
|
+
}>, args?: Args): Result;
|
|
17
17
|
(state: State, instanceId: GridCoreApi['instanceId']): Result;
|
|
18
18
|
acceptsApiRef: boolean;
|
|
19
19
|
}
|
package/utils/createSelector.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { lruMemoize, createSelectorCreator } from 'reselect';
|
|
2
2
|
import { warnOnce } from '@mui/x-internals/warning';
|
|
3
|
+
import { argsEqual } from "../hooks/utils/useGridSelector.js";
|
|
3
4
|
const reselectCreateSelector = createSelectorCreator({
|
|
4
5
|
memoize: lruMemoize,
|
|
5
6
|
memoizeOptions: {
|
|
@@ -214,11 +215,20 @@ export const createSelectorMemoizedV8 = (...args) => {
|
|
|
214
215
|
const cacheArgs = cacheArgsInit ?? new Map();
|
|
215
216
|
const cacheFn = cacheArgs?.get(args);
|
|
216
217
|
if (cacheArgs && cacheFn) {
|
|
218
|
+
if (!argsEqual(cacheFn.selectorArgs, selectorArgs)) {
|
|
219
|
+
const reselectArgs = selectorArgs !== undefined ? [...args.slice(0, args.length - 1), () => selectorArgs, args[args.length - 1]] : args;
|
|
220
|
+
const fn = reselectCreateSelector(...reselectArgs);
|
|
221
|
+
fn.selectorArgs = selectorArgs;
|
|
222
|
+
cacheArgs.set(args, fn);
|
|
223
|
+
return fn(state, selectorArgs, cacheKey);
|
|
224
|
+
}
|
|
217
225
|
// We pass the cache key because the called selector might have as
|
|
218
226
|
// dependency another selector created with this `createSelector`.
|
|
219
227
|
return cacheFn(state, selectorArgs, cacheKey);
|
|
220
228
|
}
|
|
221
|
-
const
|
|
229
|
+
const reselectArgs = selectorArgs !== undefined ? [...args.slice(0, args.length - 1), () => selectorArgs, args[args.length - 1]] : args;
|
|
230
|
+
const fn = reselectCreateSelector(...reselectArgs);
|
|
231
|
+
fn.selectorArgs = selectorArgs;
|
|
222
232
|
if (!cacheArgsInit) {
|
|
223
233
|
cache.set(cacheKey, cacheArgs);
|
|
224
234
|
}
|
package/utils/utils.js
CHANGED
|
@@ -191,11 +191,9 @@ export function deepClone(obj) {
|
|
|
191
191
|
return JSON.parse(JSON.stringify(obj));
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
195
194
|
/**
|
|
196
195
|
* Mark a value as used so eslint doesn't complain. Use this instead
|
|
197
196
|
* of a `eslint-disable-next-line react-hooks/exhaustive-deps` because
|
|
198
197
|
* that hint disables checks on all values instead of just one.
|
|
199
198
|
*/
|
|
200
|
-
export function eslintUseValue(_) {}
|
|
201
|
-
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
199
|
+
export function eslintUseValue(_) {}
|