@mui/x-data-grid 6.0.4 → 6.2.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 +110 -0
- package/components/GridAutoSizer.js +3 -0
- package/components/GridPagination.d.ts +6 -6
- package/components/GridRow.js +3 -1
- package/components/cell/GridActionsCellItem.d.ts +2 -2
- package/components/cell/GridEditDateCell.js +37 -16
- package/components/columnHeaders/ColumnHeaderMenuIcon.js +20 -16
- package/components/panel/GridColumnsPanel.d.ts +8 -0
- package/components/panel/GridColumnsPanel.js +18 -6
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputBoolean.js +37 -29
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +34 -30
- package/components/toolbar/GridToolbarColumnsButton.d.ts +1 -1
- package/components/toolbar/GridToolbarDensitySelector.d.ts +1 -1
- package/components/toolbar/GridToolbarExportContainer.d.ts +1 -1
- package/hooks/core/useGridApiInitialization.js +3 -3
- package/hooks/features/columns/gridColumnsSelector.d.ts +3 -3
- package/hooks/features/editing/useGridCellEditing.js +5 -1
- package/hooks/features/editing/useGridEditing.js +1 -3
- package/hooks/features/editing/useGridRowEditing.js +5 -1
- package/hooks/features/filter/gridFilterState.js +6 -1
- package/hooks/features/filter/useGridFilter.js +5 -0
- package/hooks/features/rowSelection/useGridRowSelection.js +5 -26
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +36 -16
- package/index.js +9 -1
- package/legacy/components/GridAutoSizer.js +3 -0
- package/legacy/components/GridRow.js +4 -1
- package/legacy/components/cell/GridEditBooleanCell.js +19 -21
- package/legacy/components/cell/GridEditDateCell.js +69 -39
- package/legacy/components/cell/GridEditInputCell.js +25 -27
- package/legacy/components/cell/GridEditSingleSelectCell.js +26 -28
- package/legacy/components/columnHeaders/ColumnHeaderMenuIcon.js +20 -16
- package/legacy/components/panel/GridColumnsPanel.js +19 -6
- package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +37 -29
- package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +34 -30
- package/legacy/hooks/core/useGridApiInitialization.js +3 -3
- package/legacy/hooks/features/columns/gridColumnsUtils.js +2 -2
- package/legacy/hooks/features/editing/useGridCellEditing.js +120 -120
- package/legacy/hooks/features/editing/useGridEditing.js +17 -21
- package/legacy/hooks/features/editing/useGridRowEditing.js +5 -1
- package/legacy/hooks/features/export/useGridPrintExport.js +45 -47
- package/legacy/hooks/features/filter/gridFilterState.js +6 -1
- package/legacy/hooks/features/filter/useGridFilter.js +5 -0
- package/legacy/hooks/features/rowSelection/useGridRowSelection.js +5 -24
- package/legacy/hooks/features/rows/gridRowsUtils.js +2 -2
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +6 -6
- package/legacy/index.js +9 -1
- package/legacy/locales/coreLocales.js +0 -1
- package/legacy/locales/frFR.js +7 -9
- package/legacy/locales/huHU.js +15 -20
- package/legacy/locales/jaJP.js +1 -1
- package/legacy/locales/nlNL.js +3 -3
- package/legacy/locales/ptBR.js +7 -9
- package/legacy/locales/ruRU.js +1 -1
- package/legacy/locales/urPK.js +6 -6
- package/legacy/models/gridColumnGrouping.js +4 -0
- package/legacy/models/params/gridRowParams.js +8 -0
- package/legacy/utils/createSelector.js +14 -22
- package/legacy/utils/utils.js +1 -1
- package/locales/coreLocales.js +0 -1
- package/locales/frFR.js +7 -9
- package/locales/huHU.js +15 -20
- package/locales/jaJP.js +1 -1
- package/locales/nlNL.js +3 -3
- package/locales/ptBR.js +7 -9
- package/locales/ruRU.js +1 -1
- package/locales/urPK.js +6 -6
- package/models/api/gridCoreApi.d.ts +3 -1
- package/models/api/gridEditingApi.d.ts +4 -0
- package/models/gridColumnGrouping.js +4 -0
- package/models/params/gridRowParams.js +8 -0
- package/modern/components/GridAutoSizer.js +3 -0
- package/modern/components/GridRow.js +3 -1
- package/modern/components/cell/GridEditDateCell.js +37 -16
- package/modern/components/columnHeaders/ColumnHeaderMenuIcon.js +19 -15
- package/modern/components/panel/GridColumnsPanel.js +18 -6
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +36 -28
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +33 -29
- package/modern/hooks/core/useGridApiInitialization.js +3 -3
- package/modern/hooks/features/editing/useGridCellEditing.js +5 -1
- package/modern/hooks/features/editing/useGridEditing.js +1 -3
- package/modern/hooks/features/editing/useGridRowEditing.js +5 -1
- package/modern/hooks/features/filter/gridFilterState.js +6 -1
- package/modern/hooks/features/filter/useGridFilter.js +5 -0
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +5 -26
- package/modern/index.js +9 -1
- package/modern/locales/coreLocales.js +0 -1
- package/modern/locales/frFR.js +7 -9
- package/modern/locales/huHU.js +15 -20
- package/modern/locales/jaJP.js +1 -1
- package/modern/locales/nlNL.js +3 -3
- package/modern/locales/ptBR.js +7 -9
- package/modern/locales/ruRU.js +1 -1
- package/modern/locales/urPK.js +6 -6
- package/modern/models/gridColumnGrouping.js +4 -0
- package/modern/models/params/gridRowParams.js +8 -0
- package/modern/utils/createSelector.js +12 -22
- package/modern/utils/utils.js +1 -1
- package/node/components/GridAutoSizer.js +3 -1
- package/node/components/GridRow.js +3 -1
- package/node/components/cell/GridCell.js +1 -0
- package/node/components/cell/GridEditDateCell.js +37 -16
- package/node/components/columnHeaders/ColumnHeaderMenuIcon.js +19 -15
- package/node/components/panel/GridColumnsPanel.js +18 -6
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +36 -28
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +32 -29
- package/node/hooks/core/useGridApiInitialization.js +3 -3
- package/node/hooks/features/editing/useGridCellEditing.js +5 -1
- package/node/hooks/features/editing/useGridEditing.js +1 -3
- package/node/hooks/features/editing/useGridRowEditing.js +5 -1
- package/node/hooks/features/filter/gridFilterState.js +5 -0
- package/node/hooks/features/filter/useGridFilter.js +5 -0
- package/node/hooks/features/rowSelection/useGridRowSelection.js +4 -25
- package/node/index.js +1 -1
- package/node/locales/frFR.js +7 -9
- package/node/locales/huHU.js +15 -20
- package/node/locales/jaJP.js +1 -1
- package/node/locales/nlNL.js +3 -3
- package/node/locales/ptBR.js +7 -9
- package/node/locales/ruRU.js +1 -1
- package/node/locales/urPK.js +6 -6
- package/node/models/gridColumnGrouping.js +4 -0
- package/node/models/params/gridEditCellParams.js +1 -0
- package/node/models/params/gridRowParams.js +9 -0
- package/node/utils/createSelector.js +12 -22
- package/node/utils/utils.js +1 -1
- package/package.json +1 -1
- package/utils/createSelector.d.ts +4 -4
- package/utils/createSelector.js +14 -22
- package/utils/utils.d.ts +1 -1
- package/utils/utils.js +1 -1
|
@@ -8,6 +8,7 @@ import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
|
8
8
|
import { getValueFromValueOptions, isSingleSelectColDef } from './filterPanelUtils';
|
|
9
9
|
import { createElement as _createElement } from "react";
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
12
|
const renderSingleSelectOptions = ({
|
|
12
13
|
column: {
|
|
13
14
|
valueOptions,
|
|
@@ -33,7 +34,7 @@ const renderSingleSelectOptions = ({
|
|
|
33
34
|
});
|
|
34
35
|
};
|
|
35
36
|
function GridFilterInputSingleSelect(props) {
|
|
36
|
-
var _item$value, _rootProps$slotProps
|
|
37
|
+
var _item$value, _rootProps$slotProps$, _rootProps$slotProps, _rootProps$slotProps$2, _resolvedColumn, _resolvedColumn2, _rootProps$slotProps2, _rootProps$slotProps3, _rootProps$slotProps4;
|
|
37
38
|
const {
|
|
38
39
|
item,
|
|
39
40
|
applyValue,
|
|
@@ -46,10 +47,9 @@ function GridFilterInputSingleSelect(props) {
|
|
|
46
47
|
others = _objectWithoutPropertiesLoose(props, _excluded);
|
|
47
48
|
const [filterValueState, setFilterValueState] = React.useState((_item$value = item.value) != null ? _item$value : '');
|
|
48
49
|
const id = useId();
|
|
50
|
+
const labelId = useId();
|
|
49
51
|
const rootProps = useGridRootProps();
|
|
50
|
-
const
|
|
51
|
-
const isSelectNative = (_baseSelectProps$nati = baseSelectProps.native) != null ? _baseSelectProps$nati : true;
|
|
52
|
-
const baseSelectOptionProps = ((_rootProps$slotProps2 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps2.baseSelectOption) || {};
|
|
52
|
+
const isSelectNative = (_rootProps$slotProps$ = (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : (_rootProps$slotProps$2 = _rootProps$slotProps.baseSelect) == null ? void 0 : _rootProps$slotProps$2.native) != null ? _rootProps$slotProps$ : true;
|
|
53
53
|
let resolvedColumn = null;
|
|
54
54
|
if (item.field) {
|
|
55
55
|
const column = apiRef.current.getColumn(item.field);
|
|
@@ -101,33 +101,37 @@ function GridFilterInputSingleSelect(props) {
|
|
|
101
101
|
if (!isSingleSelectColDef(resolvedColumn)) {
|
|
102
102
|
return null;
|
|
103
103
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
104
|
+
const label = apiRef.current.getLocaleText('filterPanelInputLabel');
|
|
105
|
+
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
106
|
+
children: [/*#__PURE__*/_jsx(rootProps.slots.baseInputLabel, _extends({}, (_rootProps$slotProps2 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps2.baseInputLabel, {
|
|
107
|
+
id: labelId,
|
|
108
|
+
shrink: true,
|
|
109
|
+
variant: "standard",
|
|
110
|
+
children: label
|
|
111
|
+
})), /*#__PURE__*/_jsx(rootProps.slots.baseSelect, _extends({
|
|
112
|
+
id: id,
|
|
113
|
+
label: label,
|
|
114
|
+
labelId: labelId,
|
|
115
|
+
value: filterValueState,
|
|
116
|
+
onChange: onFilterChange,
|
|
117
|
+
variant: "standard",
|
|
118
|
+
type: type || 'text',
|
|
119
|
+
inputProps: {
|
|
120
|
+
ref: focusElementRef,
|
|
121
|
+
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder')
|
|
122
|
+
},
|
|
119
123
|
native: isSelectNative
|
|
120
|
-
}, (_rootProps$slotProps3 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps3.baseSelect
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
})
|
|
130
|
-
})
|
|
124
|
+
}, others, (_rootProps$slotProps3 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps3.baseSelect, {
|
|
125
|
+
children: renderSingleSelectOptions({
|
|
126
|
+
column: resolvedColumn,
|
|
127
|
+
OptionComponent: rootProps.slots.baseSelectOption,
|
|
128
|
+
getOptionLabel,
|
|
129
|
+
getOptionValue,
|
|
130
|
+
isSelectNative,
|
|
131
|
+
baseSelectOptionProps: (_rootProps$slotProps4 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps4.baseSelectOption
|
|
132
|
+
})
|
|
133
|
+
}))]
|
|
134
|
+
});
|
|
131
135
|
}
|
|
132
136
|
process.env.NODE_ENV !== "production" ? GridFilterInputSingleSelect.propTypes = {
|
|
133
137
|
// ----------------------------- Warning --------------------------------
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ButtonProps } from '@mui/material/Button';
|
|
3
|
-
export declare const GridToolbarColumnsButton: React.ForwardRefExoticComponent<Omit<ButtonProps
|
|
3
|
+
export declare const GridToolbarColumnsButton: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ButtonProps } from '@mui/material/Button';
|
|
3
|
-
export declare const GridToolbarDensitySelector: React.ForwardRefExoticComponent<Omit<ButtonProps
|
|
3
|
+
export declare const GridToolbarDensitySelector: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ButtonProps } from '@mui/material/Button';
|
|
3
|
-
export declare const GridToolbarExportContainer: React.ForwardRefExoticComponent<Omit<ButtonProps
|
|
3
|
+
export declare const GridToolbarExportContainer: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -2,7 +2,6 @@ import * as React from 'react';
|
|
|
2
2
|
import { useGridApiMethod } from '../utils/useGridApiMethod';
|
|
3
3
|
import { GridSignature } from '../utils/useGridApiEventHandler';
|
|
4
4
|
import { EventManager } from '../../utils/EventManager';
|
|
5
|
-
import { unstable_resetCreateSelectorCache } from '../../utils/createSelector';
|
|
6
5
|
const isSyntheticEvent = event => {
|
|
7
6
|
return event.isPropagationStopped !== undefined;
|
|
8
7
|
};
|
|
@@ -38,7 +37,9 @@ export function useGridApiInitialization(inputApiRef, props) {
|
|
|
38
37
|
if (!publicApiRef.current) {
|
|
39
38
|
publicApiRef.current = {
|
|
40
39
|
state: {},
|
|
41
|
-
instanceId:
|
|
40
|
+
instanceId: {
|
|
41
|
+
id: globalId
|
|
42
|
+
}
|
|
42
43
|
};
|
|
43
44
|
globalId += 1;
|
|
44
45
|
}
|
|
@@ -76,7 +77,6 @@ export function useGridApiInitialization(inputApiRef, props) {
|
|
|
76
77
|
React.useEffect(() => {
|
|
77
78
|
const api = privateApiRef.current;
|
|
78
79
|
return () => {
|
|
79
|
-
unstable_resetCreateSelectorCache(api.instanceId);
|
|
80
80
|
api.publishEvent('unmount');
|
|
81
81
|
};
|
|
82
82
|
}, [privateApiRef]);
|
|
@@ -19,7 +19,7 @@ export declare const gridColumnLookupSelector: import("../../../utils/createSele
|
|
|
19
19
|
* Get an array of column definitions in the order rendered on screen..
|
|
20
20
|
* @category Columns
|
|
21
21
|
*/
|
|
22
|
-
export declare const gridColumnDefinitionsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../../internals").GridStateColDef
|
|
22
|
+
export declare const gridColumnDefinitionsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../../internals").GridStateColDef[]>;
|
|
23
23
|
/**
|
|
24
24
|
* Get the column visibility model, containing the visibility status of each column.
|
|
25
25
|
* If a column is not registered in the model, it is visible.
|
|
@@ -30,7 +30,7 @@ export declare const gridColumnVisibilityModelSelector: import("../../../utils/c
|
|
|
30
30
|
* Get the visible columns as a lookup (an object containing the field for keys and the definition for values).
|
|
31
31
|
* @category Visible Columns
|
|
32
32
|
*/
|
|
33
|
-
export declare const gridVisibleColumnDefinitionsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../../internals").GridStateColDef
|
|
33
|
+
export declare const gridVisibleColumnDefinitionsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../../internals").GridStateColDef[]>;
|
|
34
34
|
/**
|
|
35
35
|
* Get the field of each visible column.
|
|
36
36
|
* @category Visible Columns
|
|
@@ -50,7 +50,7 @@ export declare const gridColumnsTotalWidthSelector: import("../../../utils/creat
|
|
|
50
50
|
* Get the filterable columns as an array.
|
|
51
51
|
* @category Columns
|
|
52
52
|
*/
|
|
53
|
-
export declare const gridFilterableColumnDefinitionsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../../internals").GridStateColDef
|
|
53
|
+
export declare const gridFilterableColumnDefinitionsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../../internals").GridStateColDef[]>;
|
|
54
54
|
/**
|
|
55
55
|
* Get the filterable columns as a lookup (an object containing the field for keys and the definition for values).
|
|
56
56
|
* @category Columns
|
|
@@ -242,13 +242,17 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
242
242
|
initialValue
|
|
243
243
|
} = params;
|
|
244
244
|
let newValue = apiRef.current.getCellValue(id, field);
|
|
245
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
246
|
+
let unstable_updateValueOnRender = false;
|
|
245
247
|
if (deleteValue || initialValue) {
|
|
246
248
|
newValue = deleteValue ? '' : initialValue;
|
|
249
|
+
unstable_updateValueOnRender = true;
|
|
247
250
|
}
|
|
248
251
|
const newProps = {
|
|
249
252
|
value: newValue,
|
|
250
253
|
error: false,
|
|
251
|
-
isProcessingProps: false
|
|
254
|
+
isProcessingProps: false,
|
|
255
|
+
unstable_updateValueOnRender
|
|
252
256
|
};
|
|
253
257
|
updateOrDeleteFieldState(id, field, newProps);
|
|
254
258
|
apiRef.current.setCellFocus(id, field);
|
|
@@ -110,9 +110,7 @@ export const useGridEditing = (apiRef, props) => {
|
|
|
110
110
|
}, [apiRef, props.editMode]);
|
|
111
111
|
const getEditCellMeta = React.useCallback((id, field) => {
|
|
112
112
|
const editingState = gridEditRowsStateSelector(apiRef.current.state);
|
|
113
|
-
return
|
|
114
|
-
changeReason: editingState[id][field].changeReason
|
|
115
|
-
};
|
|
113
|
+
return editingState[id][field];
|
|
116
114
|
}, [apiRef]);
|
|
117
115
|
const editingSharedApi = {
|
|
118
116
|
isCellEditable,
|
|
@@ -311,13 +311,17 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
311
311
|
return acc;
|
|
312
312
|
}
|
|
313
313
|
let newValue = apiRef.current.getCellValue(id, field);
|
|
314
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
315
|
+
let unstable_updateValueOnRender = false;
|
|
314
316
|
if (fieldToFocus === field && (deleteValue || initialValue)) {
|
|
315
317
|
newValue = deleteValue ? '' : initialValue;
|
|
318
|
+
unstable_updateValueOnRender = true;
|
|
316
319
|
}
|
|
317
320
|
acc[field] = {
|
|
318
321
|
value: newValue,
|
|
319
322
|
error: false,
|
|
320
|
-
isProcessingProps: false
|
|
323
|
+
isProcessingProps: false,
|
|
324
|
+
unstable_updateValueOnRender
|
|
321
325
|
};
|
|
322
326
|
return acc;
|
|
323
327
|
}, {});
|
|
@@ -4,4 +4,9 @@ export const getDefaultGridFilterModel = () => ({
|
|
|
4
4
|
logicOperator: GridLogicOperator.And,
|
|
5
5
|
quickFilterValues: [],
|
|
6
6
|
quickFilterLogicOperator: GridLogicOperator.And
|
|
7
|
-
});
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @param {GridRowId} rowId The id of the row we want to filter.
|
|
11
|
+
* @param {(filterItem: GridFilterItem) => boolean} shouldApplyItem An optional callback to allow the filtering engine to only apply some items.
|
|
12
|
+
*/
|
|
@@ -114,6 +114,11 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
114
114
|
const filterItemsWithValue = filterModel.items.filter(item => {
|
|
115
115
|
var _column$filterOperato;
|
|
116
116
|
if (item.value !== undefined) {
|
|
117
|
+
// Some filters like `isAnyOf` support array as `item.value`.
|
|
118
|
+
// If array is empty, we want to remove it from the filter model.
|
|
119
|
+
if (Array.isArray(item.value) && item.value.length === 0) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
117
122
|
return true;
|
|
118
123
|
}
|
|
119
124
|
const column = apiRef.current.getColumn(item.field);
|
|
@@ -11,7 +11,7 @@ import { gridExpandedSortedRowIdsSelector } from '../filter/gridFilterSelector';
|
|
|
11
11
|
import { GRID_CHECKBOX_SELECTION_COL_DEF, GRID_ACTIONS_COLUMN_TYPE } from '../../../colDef';
|
|
12
12
|
import { GridCellModes } from '../../../models/gridEditRowModel';
|
|
13
13
|
import { isKeyboardEvent, isNavigationKey } from '../../../utils/keyboardUtils';
|
|
14
|
-
import {
|
|
14
|
+
import { useGridVisibleRows } from '../../utils/useGridVisibleRows';
|
|
15
15
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../../../constants/gridDetailPanelToggleField';
|
|
16
16
|
import { gridClasses } from '../../../constants/gridClasses';
|
|
17
17
|
const getSelectionModelPropValue = (selectionModelProp, prevSelectionModel) => {
|
|
@@ -61,8 +61,6 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
61
61
|
checkboxSelection,
|
|
62
62
|
disableMultipleRowSelection,
|
|
63
63
|
disableRowSelectionOnClick,
|
|
64
|
-
pagination,
|
|
65
|
-
paginationMode,
|
|
66
64
|
isRowSelectable: propIsRowSelectable
|
|
67
65
|
} = props;
|
|
68
66
|
const canHaveMultipleSelection = !disableMultipleRowSelection || checkboxSelection;
|
|
@@ -381,32 +379,13 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
381
379
|
}
|
|
382
380
|
}, [apiRef, isRowSelectable, isStateControlled, props.rowSelection]);
|
|
383
381
|
React.useEffect(() => {
|
|
384
|
-
if (!props.rowSelection) {
|
|
382
|
+
if (!props.rowSelection || isStateControlled) {
|
|
385
383
|
return;
|
|
386
384
|
}
|
|
387
385
|
const currentSelection = gridRowSelectionStateSelector(apiRef.current.state);
|
|
388
386
|
if (!canHaveMultipleSelection && currentSelection.length > 1) {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
} = getVisibleRows(apiRef, {
|
|
392
|
-
pagination,
|
|
393
|
-
paginationMode
|
|
394
|
-
});
|
|
395
|
-
const currentPageRowsLookup = currentPageRows.reduce((acc, {
|
|
396
|
-
id
|
|
397
|
-
}) => {
|
|
398
|
-
acc[id] = true;
|
|
399
|
-
return acc;
|
|
400
|
-
}, {});
|
|
401
|
-
const firstSelectableRow = currentSelection.find(id => {
|
|
402
|
-
let isSelectable = true;
|
|
403
|
-
if (isRowSelectable) {
|
|
404
|
-
isSelectable = isRowSelectable(id);
|
|
405
|
-
}
|
|
406
|
-
return isSelectable && currentPageRowsLookup[id]; // Check if the row is in the current page
|
|
407
|
-
});
|
|
408
|
-
|
|
409
|
-
apiRef.current.setRowSelectionModel(firstSelectableRow !== undefined ? [firstSelectableRow] : []);
|
|
387
|
+
// See https://github.com/mui/mui-x/issues/8455
|
|
388
|
+
apiRef.current.setRowSelectionModel([]);
|
|
410
389
|
}
|
|
411
|
-
}, [apiRef, canHaveMultipleSelection, checkboxSelection,
|
|
390
|
+
}, [apiRef, canHaveMultipleSelection, checkboxSelection, isStateControlled, props.rowSelection]);
|
|
412
391
|
};
|
|
@@ -125,6 +125,7 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
|
|
|
125
125
|
breakInside?: import("csstype").Property.BreakInside | undefined;
|
|
126
126
|
captionSide?: import("csstype").Property.CaptionSide | undefined;
|
|
127
127
|
caretColor?: import("csstype").Property.CaretColor | undefined;
|
|
128
|
+
caretShape?: import("csstype").Property.CaretShape | undefined;
|
|
128
129
|
clear?: import("csstype").Property.Clear | undefined;
|
|
129
130
|
clipPath?: import("csstype").Property.ClipPath | undefined;
|
|
130
131
|
color?: import("csstype").Property.Color | undefined;
|
|
@@ -139,6 +140,12 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
|
|
|
139
140
|
columnSpan?: import("csstype").Property.ColumnSpan | undefined;
|
|
140
141
|
columnWidth?: import("csstype").Property.ColumnWidth<string | number> | undefined;
|
|
141
142
|
contain?: import("csstype").Property.Contain | undefined;
|
|
143
|
+
containIntrinsicBlockSize?: import("csstype").Property.ContainIntrinsicBlockSize<string | number> | undefined;
|
|
144
|
+
containIntrinsicHeight?: import("csstype").Property.ContainIntrinsicHeight<string | number> | undefined;
|
|
145
|
+
containIntrinsicInlineSize?: import("csstype").Property.ContainIntrinsicInlineSize<string | number> | undefined;
|
|
146
|
+
containIntrinsicWidth?: import("csstype").Property.ContainIntrinsicWidth<string | number> | undefined;
|
|
147
|
+
containerName?: import("csstype").Property.ContainerName | undefined;
|
|
148
|
+
containerType?: import("csstype").Property.ContainerType | undefined;
|
|
142
149
|
content?: import("csstype").Property.Content | undefined;
|
|
143
150
|
contentVisibility?: import("csstype").Property.ContentVisibility | undefined;
|
|
144
151
|
counterIncrement?: import("csstype").Property.CounterIncrement | undefined;
|
|
@@ -160,6 +167,7 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
|
|
|
160
167
|
fontKerning?: import("csstype").Property.FontKerning | undefined;
|
|
161
168
|
fontLanguageOverride?: import("csstype").Property.FontLanguageOverride | undefined;
|
|
162
169
|
fontOpticalSizing?: import("csstype").Property.FontOpticalSizing | undefined;
|
|
170
|
+
fontPalette?: import("csstype").Property.FontPalette | undefined;
|
|
163
171
|
fontSize?: import("csstype").Property.FontSize<string | number> | undefined;
|
|
164
172
|
fontSizeAdjust?: import("csstype").Property.FontSizeAdjust | undefined;
|
|
165
173
|
fontSmooth?: import("csstype").Property.FontSmooth<string | number> | undefined;
|
|
@@ -170,6 +178,7 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
|
|
|
170
178
|
fontVariantAlternates?: import("csstype").Property.FontVariantAlternates | undefined;
|
|
171
179
|
fontVariantCaps?: import("csstype").Property.FontVariantCaps | undefined;
|
|
172
180
|
fontVariantEastAsian?: import("csstype").Property.FontVariantEastAsian | undefined;
|
|
181
|
+
fontVariantEmoji?: import("csstype").Property.FontVariantEmoji | undefined;
|
|
173
182
|
fontVariantLigatures?: import("csstype").Property.FontVariantLigatures | undefined;
|
|
174
183
|
fontVariantNumeric?: import("csstype").Property.FontVariantNumeric | undefined;
|
|
175
184
|
fontVariantPosition?: import("csstype").Property.FontVariantPosition | undefined;
|
|
@@ -189,6 +198,7 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
|
|
|
189
198
|
hangingPunctuation?: import("csstype").Property.HangingPunctuation | undefined;
|
|
190
199
|
height?: import("csstype").Property.Height<string | number> | undefined;
|
|
191
200
|
hyphenateCharacter?: import("csstype").Property.HyphenateCharacter | undefined;
|
|
201
|
+
hyphenateLimitChars?: import("csstype").Property.HyphenateLimitChars | undefined;
|
|
192
202
|
hyphens?: import("csstype").Property.Hyphens | undefined;
|
|
193
203
|
imageOrientation?: import("csstype").Property.ImageOrientation | undefined;
|
|
194
204
|
imageRendering?: import("csstype").Property.ImageRendering | undefined;
|
|
@@ -196,11 +206,8 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
|
|
|
196
206
|
initialLetter?: import("csstype").Property.InitialLetter | undefined;
|
|
197
207
|
inlineSize?: import("csstype").Property.InlineSize<string | number> | undefined;
|
|
198
208
|
inputSecurity?: import("csstype").Property.InputSecurity | undefined;
|
|
199
|
-
inset?: import("csstype").Property.Inset<string | number> | undefined;
|
|
200
|
-
insetBlock?: import("csstype").Property.InsetBlock<string | number> | undefined;
|
|
201
209
|
insetBlockEnd?: import("csstype").Property.InsetBlockEnd<string | number> | undefined;
|
|
202
210
|
insetBlockStart?: import("csstype").Property.InsetBlockStart<string | number> | undefined;
|
|
203
|
-
insetInline?: import("csstype").Property.InsetInline<string | number> | undefined;
|
|
204
211
|
insetInlineEnd?: import("csstype").Property.InsetInlineEnd<string | number> | undefined;
|
|
205
212
|
insetInlineStart?: import("csstype").Property.InsetInlineStart<string | number> | undefined;
|
|
206
213
|
isolation?: import("csstype").Property.Isolation | undefined;
|
|
@@ -216,16 +223,15 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
|
|
|
216
223
|
listStyleImage?: import("csstype").Property.ListStyleImage | undefined;
|
|
217
224
|
listStylePosition?: import("csstype").Property.ListStylePosition | undefined;
|
|
218
225
|
listStyleType?: import("csstype").Property.ListStyleType | undefined;
|
|
219
|
-
marginBlock?: import("csstype").Property.MarginBlock<string | number> | undefined;
|
|
220
226
|
marginBlockEnd?: import("csstype").Property.MarginBlockEnd<string | number> | undefined;
|
|
221
227
|
marginBlockStart?: import("csstype").Property.MarginBlockStart<string | number> | undefined;
|
|
222
228
|
marginBottom?: import("csstype").Property.MarginBottom<string | number> | undefined;
|
|
223
|
-
marginInline?: import("csstype").Property.MarginInline<string | number> | undefined;
|
|
224
229
|
marginInlineEnd?: import("csstype").Property.MarginInlineEnd<string | number> | undefined;
|
|
225
230
|
marginInlineStart?: import("csstype").Property.MarginInlineStart<string | number> | undefined;
|
|
226
231
|
marginLeft?: import("csstype").Property.MarginLeft<string | number> | undefined;
|
|
227
232
|
marginRight?: import("csstype").Property.MarginRight<string | number> | undefined;
|
|
228
233
|
marginTop?: import("csstype").Property.MarginTop<string | number> | undefined;
|
|
234
|
+
marginTrim?: import("csstype").Property.MarginTrim | undefined;
|
|
229
235
|
maskBorderMode?: import("csstype").Property.MaskBorderMode | undefined;
|
|
230
236
|
maskBorderOutset?: import("csstype").Property.MaskBorderOutset<string | number> | undefined;
|
|
231
237
|
maskBorderRepeat?: import("csstype").Property.MaskBorderRepeat | undefined;
|
|
@@ -262,6 +268,7 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
|
|
|
262
268
|
offsetAnchor?: import("csstype").Property.OffsetAnchor<string | number> | undefined;
|
|
263
269
|
offsetDistance?: import("csstype").Property.OffsetDistance<string | number> | undefined;
|
|
264
270
|
offsetPath?: import("csstype").Property.OffsetPath | undefined;
|
|
271
|
+
offsetPosition?: import("csstype").Property.OffsetPosition<string | number> | undefined;
|
|
265
272
|
offsetRotate?: import("csstype").Property.OffsetRotate | undefined;
|
|
266
273
|
offsetRotation?: import("csstype").Property.OffsetRotate | undefined;
|
|
267
274
|
opacity?: import("csstype").Property.Opacity | undefined;
|
|
@@ -283,23 +290,21 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
|
|
|
283
290
|
overscrollBehaviorInline?: import("csstype").Property.OverscrollBehaviorInline | undefined;
|
|
284
291
|
overscrollBehaviorX?: import("csstype").Property.OverscrollBehaviorX | undefined;
|
|
285
292
|
overscrollBehaviorY?: import("csstype").Property.OverscrollBehaviorY | undefined;
|
|
286
|
-
paddingBlock?: import("csstype").Property.PaddingBlock<string | number> | undefined;
|
|
287
293
|
paddingBlockEnd?: import("csstype").Property.PaddingBlockEnd<string | number> | undefined;
|
|
288
294
|
paddingBlockStart?: import("csstype").Property.PaddingBlockStart<string | number> | undefined;
|
|
289
295
|
paddingBottom?: import("csstype").Property.PaddingBottom<string | number> | undefined;
|
|
290
|
-
paddingInline?: import("csstype").Property.PaddingInline<string | number> | undefined;
|
|
291
296
|
paddingInlineEnd?: import("csstype").Property.PaddingInlineEnd<string | number> | undefined;
|
|
292
297
|
paddingInlineStart?: import("csstype").Property.PaddingInlineStart<string | number> | undefined;
|
|
293
298
|
paddingLeft?: import("csstype").Property.PaddingLeft<string | number> | undefined;
|
|
294
299
|
paddingRight?: import("csstype").Property.PaddingRight<string | number> | undefined;
|
|
295
300
|
paddingTop?: import("csstype").Property.PaddingTop<string | number> | undefined;
|
|
301
|
+
page?: import("csstype").Property.Page | undefined;
|
|
296
302
|
pageBreakAfter?: import("csstype").Property.PageBreakAfter | undefined;
|
|
297
303
|
pageBreakBefore?: import("csstype").Property.PageBreakBefore | undefined;
|
|
298
304
|
pageBreakInside?: import("csstype").Property.PageBreakInside | undefined;
|
|
299
305
|
paintOrder?: import("csstype").Property.PaintOrder | undefined;
|
|
300
306
|
perspective?: import("csstype").Property.Perspective<string | number> | undefined;
|
|
301
307
|
perspectiveOrigin?: import("csstype").Property.PerspectiveOrigin<string | number> | undefined;
|
|
302
|
-
placeContent?: import("csstype").Property.PlaceContent | undefined;
|
|
303
308
|
pointerEvents?: import("csstype").Property.PointerEvents | undefined;
|
|
304
309
|
position?: import("csstype").Property.Position | undefined;
|
|
305
310
|
printColorAdjust?: import("csstype").Property.PrintColorAdjust | undefined;
|
|
@@ -313,36 +318,31 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
|
|
|
313
318
|
rubyPosition?: import("csstype").Property.RubyPosition | undefined;
|
|
314
319
|
scale?: import("csstype").Property.Scale | undefined;
|
|
315
320
|
scrollBehavior?: import("csstype").Property.ScrollBehavior | undefined;
|
|
316
|
-
scrollMargin?: import("csstype").Property.ScrollMargin<string | number> | undefined;
|
|
317
|
-
scrollMarginBlock?: import("csstype").Property.ScrollMarginBlock<string | number> | undefined;
|
|
318
321
|
scrollMarginBlockEnd?: import("csstype").Property.ScrollMarginBlockEnd<string | number> | undefined;
|
|
319
322
|
scrollMarginBlockStart?: import("csstype").Property.ScrollMarginBlockStart<string | number> | undefined;
|
|
320
323
|
scrollMarginBottom?: import("csstype").Property.ScrollMarginBottom<string | number> | undefined;
|
|
321
|
-
scrollMarginInline?: import("csstype").Property.ScrollMarginInline<string | number> | undefined;
|
|
322
324
|
scrollMarginInlineEnd?: import("csstype").Property.ScrollMarginInlineEnd<string | number> | undefined;
|
|
323
325
|
scrollMarginInlineStart?: import("csstype").Property.ScrollMarginInlineStart<string | number> | undefined;
|
|
324
326
|
scrollMarginLeft?: import("csstype").Property.ScrollMarginLeft<string | number> | undefined;
|
|
325
327
|
scrollMarginRight?: import("csstype").Property.ScrollMarginRight<string | number> | undefined;
|
|
326
328
|
scrollMarginTop?: import("csstype").Property.ScrollMarginTop<string | number> | undefined;
|
|
327
|
-
scrollPadding?: import("csstype").Property.ScrollPadding<string | number> | undefined;
|
|
328
|
-
scrollPaddingBlock?: import("csstype").Property.ScrollPaddingBlock<string | number> | undefined;
|
|
329
329
|
scrollPaddingBlockEnd?: import("csstype").Property.ScrollPaddingBlockEnd<string | number> | undefined;
|
|
330
330
|
scrollPaddingBlockStart?: import("csstype").Property.ScrollPaddingBlockStart<string | number> | undefined;
|
|
331
331
|
scrollPaddingBottom?: import("csstype").Property.ScrollPaddingBottom<string | number> | undefined;
|
|
332
|
-
scrollPaddingInline?: import("csstype").Property.ScrollPaddingInline<string | number> | undefined;
|
|
333
332
|
scrollPaddingInlineEnd?: import("csstype").Property.ScrollPaddingInlineEnd<string | number> | undefined;
|
|
334
333
|
scrollPaddingInlineStart?: import("csstype").Property.ScrollPaddingInlineStart<string | number> | undefined;
|
|
335
334
|
scrollPaddingLeft?: import("csstype").Property.ScrollPaddingLeft<string | number> | undefined;
|
|
336
335
|
scrollPaddingRight?: import("csstype").Property.ScrollPaddingRight<string | number> | undefined;
|
|
337
336
|
scrollPaddingTop?: import("csstype").Property.ScrollPaddingTop<string | number> | undefined;
|
|
338
337
|
scrollSnapAlign?: import("csstype").Property.ScrollSnapAlign | undefined;
|
|
339
|
-
scrollSnapMargin?: import("csstype").Property.ScrollMargin<string | number> | undefined;
|
|
340
338
|
scrollSnapMarginBottom?: import("csstype").Property.ScrollMarginBottom<string | number> | undefined;
|
|
341
339
|
scrollSnapMarginLeft?: import("csstype").Property.ScrollMarginLeft<string | number> | undefined;
|
|
342
340
|
scrollSnapMarginRight?: import("csstype").Property.ScrollMarginRight<string | number> | undefined;
|
|
343
341
|
scrollSnapMarginTop?: import("csstype").Property.ScrollMarginTop<string | number> | undefined;
|
|
344
342
|
scrollSnapStop?: import("csstype").Property.ScrollSnapStop | undefined;
|
|
345
343
|
scrollSnapType?: import("csstype").Property.ScrollSnapType | undefined;
|
|
344
|
+
scrollTimelineAxis?: import("csstype").Property.ScrollTimelineAxis | undefined;
|
|
345
|
+
scrollTimelineName?: import("csstype").Property.ScrollTimelineName | undefined;
|
|
346
346
|
scrollbarColor?: import("csstype").Property.ScrollbarColor | undefined;
|
|
347
347
|
scrollbarGutter?: import("csstype").Property.ScrollbarGutter | undefined;
|
|
348
348
|
scrollbarWidth?: import("csstype").Property.ScrollbarWidth | undefined;
|
|
@@ -387,6 +387,7 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
|
|
|
387
387
|
unicodeBidi?: import("csstype").Property.UnicodeBidi | undefined;
|
|
388
388
|
userSelect?: import("csstype").Property.UserSelect | undefined;
|
|
389
389
|
verticalAlign?: import("csstype").Property.VerticalAlign<string | number> | undefined;
|
|
390
|
+
viewTransitionName?: import("csstype").Property.ViewTransitionName | undefined;
|
|
390
391
|
visibility?: import("csstype").Property.Visibility | undefined;
|
|
391
392
|
whiteSpace?: import("csstype").Property.WhiteSpace | undefined;
|
|
392
393
|
widows?: import("csstype").Property.Widows | undefined;
|
|
@@ -418,8 +419,11 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
|
|
|
418
419
|
borderStyle?: import("csstype").Property.BorderStyle | undefined;
|
|
419
420
|
borderTop?: import("csstype").Property.BorderTop<string | number> | undefined;
|
|
420
421
|
borderWidth?: import("csstype").Property.BorderWidth<string | number> | undefined;
|
|
422
|
+
caret?: import("csstype").Property.Caret | undefined;
|
|
421
423
|
columnRule?: import("csstype").Property.ColumnRule<string | number> | undefined;
|
|
422
424
|
columns?: import("csstype").Property.Columns<string | number> | undefined;
|
|
425
|
+
containIntrinsicSize?: import("csstype").Property.ContainIntrinsicSize<string | number> | undefined;
|
|
426
|
+
container?: import("csstype").Property.Container | undefined;
|
|
423
427
|
flex?: import("csstype").Property.Flex<string | number> | undefined;
|
|
424
428
|
flexFlow?: import("csstype").Property.FlexFlow | undefined;
|
|
425
429
|
font?: import("csstype").Property.Font | undefined;
|
|
@@ -429,9 +433,14 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
|
|
|
429
433
|
gridColumn?: import("csstype").Property.GridColumn | undefined;
|
|
430
434
|
gridRow?: import("csstype").Property.GridRow | undefined;
|
|
431
435
|
gridTemplate?: import("csstype").Property.GridTemplate | undefined;
|
|
436
|
+
inset?: import("csstype").Property.Inset<string | number> | undefined;
|
|
437
|
+
insetBlock?: import("csstype").Property.InsetBlock<string | number> | undefined;
|
|
438
|
+
insetInline?: import("csstype").Property.InsetInline<string | number> | undefined;
|
|
432
439
|
lineClamp?: import("csstype").Property.LineClamp | undefined;
|
|
433
440
|
listStyle?: import("csstype").Property.ListStyle | undefined;
|
|
434
441
|
margin?: import("csstype").Property.Margin<string | number> | undefined;
|
|
442
|
+
marginBlock?: import("csstype").Property.MarginBlock<string | number> | undefined;
|
|
443
|
+
marginInline?: import("csstype").Property.MarginInline<string | number> | undefined;
|
|
435
444
|
mask?: import("csstype").Property.Mask<string | number> | undefined;
|
|
436
445
|
maskBorder?: import("csstype").Property.MaskBorder | undefined;
|
|
437
446
|
motion?: import("csstype").Property.Offset<string | number> | undefined;
|
|
@@ -440,8 +449,19 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
|
|
|
440
449
|
overflow?: import("csstype").Property.Overflow | undefined;
|
|
441
450
|
overscrollBehavior?: import("csstype").Property.OverscrollBehavior | undefined;
|
|
442
451
|
padding?: import("csstype").Property.Padding<string | number> | undefined;
|
|
452
|
+
paddingBlock?: import("csstype").Property.PaddingBlock<string | number> | undefined;
|
|
453
|
+
paddingInline?: import("csstype").Property.PaddingInline<string | number> | undefined;
|
|
454
|
+
placeContent?: import("csstype").Property.PlaceContent | undefined;
|
|
443
455
|
placeItems?: import("csstype").Property.PlaceItems | undefined;
|
|
444
456
|
placeSelf?: import("csstype").Property.PlaceSelf | undefined;
|
|
457
|
+
scrollMargin?: import("csstype").Property.ScrollMargin<string | number> | undefined;
|
|
458
|
+
scrollMarginBlock?: import("csstype").Property.ScrollMarginBlock<string | number> | undefined;
|
|
459
|
+
scrollMarginInline?: import("csstype").Property.ScrollMarginInline<string | number> | undefined;
|
|
460
|
+
scrollPadding?: import("csstype").Property.ScrollPadding<string | number> | undefined;
|
|
461
|
+
scrollPaddingBlock?: import("csstype").Property.ScrollPaddingBlock<string | number> | undefined;
|
|
462
|
+
scrollPaddingInline?: import("csstype").Property.ScrollPaddingInline<string | number> | undefined;
|
|
463
|
+
scrollSnapMargin?: import("csstype").Property.ScrollMargin<string | number> | undefined;
|
|
464
|
+
scrollTimeline?: import("csstype").Property.ScrollTimeline | undefined;
|
|
445
465
|
textDecoration?: import("csstype").Property.TextDecoration<string | number> | undefined;
|
|
446
466
|
textEmphasis?: import("csstype").Property.TextEmphasis | undefined;
|
|
447
467
|
transition?: import("csstype").Property.Transition<string & {}> | undefined;
|
|
@@ -455,6 +475,7 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
|
|
|
455
475
|
MozAnimationTimingFunction?: import("csstype").Property.AnimationTimingFunction | undefined;
|
|
456
476
|
MozAppearance?: import("csstype").Property.MozAppearance | undefined;
|
|
457
477
|
MozBackfaceVisibility?: import("csstype").Property.BackfaceVisibility | undefined;
|
|
478
|
+
MozBinding?: import("csstype").Property.MozBinding | undefined;
|
|
458
479
|
MozBorderBottomColors?: import("csstype").Property.MozBorderBottomColors | undefined;
|
|
459
480
|
MozBorderEndColor?: import("csstype").Property.BorderInlineEndColor | undefined;
|
|
460
481
|
MozBorderEndStyle?: import("csstype").Property.BorderInlineEndStyle | undefined;
|
|
@@ -735,7 +756,6 @@ export declare const useGridVirtualScroller: (props: UseGridVirtualScrollerProps
|
|
|
735
756
|
MozBackgroundInlinePolicy?: import("csstype").Property.BoxDecorationBreak | undefined;
|
|
736
757
|
MozBackgroundOrigin?: import("csstype").Property.BackgroundOrigin | undefined;
|
|
737
758
|
MozBackgroundSize?: import("csstype").Property.BackgroundSize<string | number> | undefined;
|
|
738
|
-
MozBinding?: import("csstype").Property.MozBinding | undefined;
|
|
739
759
|
MozBorderRadius?: import("csstype").Property.BorderRadius<string | number> | undefined;
|
|
740
760
|
MozBorderRadiusBottomleft?: import("csstype").Property.BorderBottomLeftRadius<string | number> | undefined;
|
|
741
761
|
MozBorderRadiusBottomright?: import("csstype").Property.BorderBottomRightRadius<string | number> | undefined;
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-data-grid v6.0
|
|
2
|
+
* @mui/x-data-grid v6.2.0
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -28,4 +28,12 @@ export { GridColumnMenu, GRID_COLUMN_MENU_SLOTS, GRID_COLUMN_MENU_SLOT_PROPS } f
|
|
|
28
28
|
* The full grid API.
|
|
29
29
|
* @demos
|
|
30
30
|
* - [API object](/x/react-data-grid/api-object/)
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The state of `DataGrid`.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The initial state of `DataGrid`.
|
|
31
39
|
*/
|
|
@@ -7,6 +7,9 @@ import PropTypes from 'prop-types';
|
|
|
7
7
|
import { unstable_useForkRef as useForkRef, unstable_ownerWindow as ownerWindow, unstable_useEventCallback as useEventCallback, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
|
|
8
8
|
import createDetectElementResize from '../lib/createDetectElementResize';
|
|
9
9
|
// TODO replace with https://caniuse.com/resizeobserver.
|
|
10
|
+
|
|
11
|
+
// Credit to https://github.com/bvaughn/react-virtualized/blob/master/source/AutoSizer/AutoSizer.js
|
|
12
|
+
// for the sources.
|
|
10
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
14
|
var GridAutoSizer = /*#__PURE__*/React.forwardRef(function AutoSizer(props, ref) {
|
|
12
15
|
var children = props.children,
|
|
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
5
|
var _excluded = ["selected", "rowId", "row", "index", "style", "position", "rowHeight", "className", "visibleColumns", "renderedColumns", "containerWidth", "firstColumnToRender", "lastColumnToRender", "isLastVisible", "focusedCell", "tabbableCell", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave"],
|
|
6
|
-
_excluded2 = ["changeReason"];
|
|
6
|
+
_excluded2 = ["changeReason", "unstable_updateValueOnRender"];
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import clsx from 'clsx';
|
|
@@ -213,7 +213,10 @@ var GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
213
213
|
}
|
|
214
214
|
if (editCellState != null && column.renderEditCell) {
|
|
215
215
|
var updatedRow = apiRef.current.getRowWithUpdatedValues(rowId, column.field);
|
|
216
|
+
|
|
217
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
216
218
|
var changeReason = editCellState.changeReason,
|
|
219
|
+
unstable_updateValueOnRender = editCellState.unstable_updateValueOnRender,
|
|
217
220
|
editCellStateRest = _objectWithoutProperties(editCellState, _excluded2);
|
|
218
221
|
var params = _extends({}, cellParams, {
|
|
219
222
|
row: updatedRow
|
|
@@ -55,28 +55,26 @@ function GridEditBooleanCell(props) {
|
|
|
55
55
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(event) {
|
|
56
56
|
var newValue;
|
|
57
57
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
58
|
-
while (1) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (!onValueChange) {
|
|
63
|
-
_context.next = 4;
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
58
|
+
while (1) switch (_context.prev = _context.next) {
|
|
59
|
+
case 0:
|
|
60
|
+
newValue = event.target.checked;
|
|
61
|
+
if (!onValueChange) {
|
|
66
62
|
_context.next = 4;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
_context.next = 4;
|
|
66
|
+
return onValueChange(event, newValue);
|
|
67
|
+
case 4:
|
|
68
|
+
setValueState(newValue);
|
|
69
|
+
_context.next = 7;
|
|
70
|
+
return apiRef.current.setEditCellValue({
|
|
71
|
+
id: idProp,
|
|
72
|
+
field: field,
|
|
73
|
+
value: newValue
|
|
74
|
+
}, event);
|
|
75
|
+
case 7:
|
|
76
|
+
case "end":
|
|
77
|
+
return _context.stop();
|
|
80
78
|
}
|
|
81
79
|
}, _callee);
|
|
82
80
|
}));
|