@mui/x-data-grid 6.0.0-alpha.13 → 6.0.0-alpha.14
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 +134 -0
- package/DataGrid/DataGrid.js +0 -10
- package/colDef/gridSingleSelectOperators.js +6 -3
- package/components/GridRow.d.ts +2 -2
- package/components/columnSelection/GridHeaderCheckbox.d.ts +1 -1
- package/components/panel/GridPanel.d.ts +2 -2
- package/components/panel/filterPanel/GridFilterInputValue.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputValue.js +6 -56
- package/components/toolbar/GridToolbarFilterButton.d.ts +1 -1
- package/hooks/features/clipboard/useGridClipboard.js +14 -2
- package/hooks/features/editing/gridEditingSelectors.d.ts +1 -1
- package/hooks/features/export/useGridPrintExport.js +2 -0
- package/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
- package/index.js +1 -1
- package/legacy/DataGrid/DataGrid.js +0 -10
- package/legacy/colDef/gridSingleSelectOperators.js +6 -3
- package/legacy/components/panel/filterPanel/GridFilterInputValue.js +3 -56
- package/legacy/hooks/features/clipboard/useGridClipboard.js +14 -2
- package/legacy/hooks/features/export/useGridPrintExport.js +2 -0
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
- package/legacy/index.js +1 -1
- package/legacy/models/gridEditRowModel.js +0 -1
- package/models/api/gridParamsApi.d.ts +1 -1
- package/models/colDef/gridColDef.d.ts +14 -14
- package/models/events/gridEventLookup.d.ts +12 -19
- package/models/gridCellClass.d.ts +3 -2
- package/models/gridEditRowModel.d.ts +1 -2
- package/models/gridEditRowModel.js +0 -1
- package/models/gridFilterOperator.d.ts +1 -1
- package/models/gridStateCommunity.d.ts +2 -2
- package/models/params/gridCellParams.d.ts +5 -5
- package/models/params/gridColumnHeaderParams.d.ts +1 -1
- package/models/params/gridEditCellParams.d.ts +2 -2
- package/models/props/DataGridProps.d.ts +1 -11
- package/modern/DataGrid/DataGrid.js +0 -10
- package/modern/colDef/gridSingleSelectOperators.js +4 -3
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +5 -55
- package/modern/hooks/features/clipboard/useGridClipboard.js +13 -1
- package/modern/hooks/features/export/useGridPrintExport.js +2 -0
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
- package/modern/index.js +1 -1
- package/modern/models/gridEditRowModel.js +0 -1
- package/node/DataGrid/DataGrid.js +0 -10
- package/node/colDef/gridSingleSelectOperators.js +4 -3
- package/node/components/panel/filterPanel/GridFilterInputValue.js +5 -55
- package/node/hooks/features/clipboard/useGridClipboard.js +13 -1
- package/node/hooks/features/export/useGridPrintExport.js +2 -0
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +3 -3
- package/node/index.js +1 -1
- package/node/models/gridEditRowModel.js +0 -1
- package/package.json +3 -3
- package/utils/utils.d.ts +1 -1
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
2
2
|
import { GridFilterInputSingleSelect } from '../components/panel/filterPanel/GridFilterInputSingleSelect';
|
|
3
3
|
import { GridFilterInputMultipleSingleSelect } from '../components/panel/filterPanel/GridFilterInputMultipleSingleSelect';
|
|
4
|
+
import { isObject } from '../utils/utils';
|
|
4
5
|
var parseObjectValue = function parseObjectValue(value) {
|
|
5
|
-
if (value == null ||
|
|
6
|
+
if (value == null || !isObject(value)) {
|
|
6
7
|
return value;
|
|
7
8
|
}
|
|
8
9
|
return value.value;
|
|
9
10
|
};
|
|
10
11
|
export var getGridSingleSelectQuickFilterFn = function getGridSingleSelectQuickFilterFn(value, column, apiRef) {
|
|
12
|
+
var _parseObjectValue;
|
|
11
13
|
if (!value) {
|
|
12
14
|
return null;
|
|
13
15
|
}
|
|
14
16
|
var valueOptions = column.valueOptions,
|
|
15
17
|
valueFormatter = column.valueFormatter,
|
|
16
18
|
field = column.field;
|
|
17
|
-
var potentialValues = [parseObjectValue(value).toString()];
|
|
19
|
+
var potentialValues = [(_parseObjectValue = parseObjectValue(value)) == null ? void 0 : _parseObjectValue.toString()];
|
|
18
20
|
var iterableColumnValues = typeof valueOptions === 'function' ? valueOptions({
|
|
19
21
|
field: field
|
|
20
22
|
}) : valueOptions || [];
|
|
@@ -46,8 +48,9 @@ export var getGridSingleSelectQuickFilterFn = function getGridSingleSelectQuickF
|
|
|
46
48
|
});
|
|
47
49
|
}
|
|
48
50
|
return function (_ref) {
|
|
51
|
+
var _parseObjectValue2;
|
|
49
52
|
var columnValue = _ref.value;
|
|
50
|
-
return columnValue != null ? potentialValues.includes(parseObjectValue(columnValue).toString()) : false;
|
|
53
|
+
return columnValue != null ? potentialValues.includes((_parseObjectValue2 = parseObjectValue(columnValue)) == null ? void 0 : _parseObjectValue2.toString()) : false;
|
|
51
54
|
};
|
|
52
55
|
};
|
|
53
56
|
export var getGridSingleSelectOperators = function getGridSingleSelectOperators() {
|
|
@@ -1,57 +1,22 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
5
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
6
4
|
var _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef"];
|
|
7
5
|
import * as React from 'react';
|
|
8
6
|
import PropTypes from 'prop-types';
|
|
9
7
|
import { unstable_useId as useId } from '@mui/utils';
|
|
10
|
-
import MenuItem from '@mui/material/MenuItem';
|
|
11
8
|
import { GridLoadIcon } from '../../icons';
|
|
12
9
|
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
13
|
-
import { getValueFromValueOptions } from './filterPanelUtils';
|
|
14
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
-
var warnedOnce = {};
|
|
16
|
-
function warnDeprecatedTypeSupport(type) {
|
|
17
|
-
console.warn(["MUI: Using GridFilterInputValue with a \"".concat(type, "\" column is deprecated."), 'Use GridFilterInputSingleSelect instead.'].join('\n'));
|
|
18
|
-
warnedOnce[type] = true;
|
|
19
|
-
}
|
|
20
|
-
var renderSingleSelectOptions = function renderSingleSelectOptions(_ref, api, OptionComponent) {
|
|
21
|
-
var valueOptions = _ref.valueOptions,
|
|
22
|
-
valueFormatter = _ref.valueFormatter,
|
|
23
|
-
field = _ref.field;
|
|
24
|
-
var iterableColumnValues = typeof valueOptions === 'function' ? [''].concat(_toConsumableArray(valueOptions({
|
|
25
|
-
field: field
|
|
26
|
-
}))) : [''].concat(_toConsumableArray(valueOptions || []));
|
|
27
|
-
return iterableColumnValues.map(function (option) {
|
|
28
|
-
var isOptionTypeObject = _typeof(option) === 'object';
|
|
29
|
-
var key = isOptionTypeObject ? option.value : option;
|
|
30
|
-
var value = isOptionTypeObject ? option.value : option;
|
|
31
|
-
var formattedValue = valueFormatter && option !== '' ? valueFormatter({
|
|
32
|
-
value: option,
|
|
33
|
-
field: field,
|
|
34
|
-
api: api
|
|
35
|
-
}) : option;
|
|
36
|
-
var content = isOptionTypeObject ? option.label : formattedValue;
|
|
37
|
-
return /*#__PURE__*/_jsx(OptionComponent, {
|
|
38
|
-
value: value,
|
|
39
|
-
children: content
|
|
40
|
-
}, key);
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
11
|
export var SUBMIT_FILTER_STROKE_TIME = 500;
|
|
44
12
|
function GridFilterInputValue(props) {
|
|
45
|
-
var _item$value, _rootProps$components
|
|
13
|
+
var _item$value, _rootProps$components;
|
|
46
14
|
var item = props.item,
|
|
47
15
|
applyValue = props.applyValue,
|
|
48
16
|
type = props.type,
|
|
49
17
|
apiRef = props.apiRef,
|
|
50
18
|
focusElementRef = props.focusElementRef,
|
|
51
19
|
others = _objectWithoutProperties(props, _excluded);
|
|
52
|
-
if (process.env.NODE_ENV !== 'production' && ['date', 'datetime-local', 'singleSelect'].includes(type) && !warnedOnce[type]) {
|
|
53
|
-
warnDeprecatedTypeSupport(type);
|
|
54
|
-
}
|
|
55
20
|
var filterTimeout = React.useRef();
|
|
56
21
|
var _React$useState = React.useState((_item$value = item.value) != null ? _item$value : ''),
|
|
57
22
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -63,36 +28,18 @@ function GridFilterInputValue(props) {
|
|
|
63
28
|
setIsApplying = _React$useState4[1];
|
|
64
29
|
var id = useId();
|
|
65
30
|
var rootProps = useGridRootProps();
|
|
66
|
-
var baseSelectProps = ((_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseSelect) || {};
|
|
67
|
-
var isSelectNative = (_baseSelectProps$nati = baseSelectProps.native) != null ? _baseSelectProps$nati : true;
|
|
68
|
-
var singleSelectProps = type === 'singleSelect' ? {
|
|
69
|
-
select: true,
|
|
70
|
-
SelectProps: _extends({
|
|
71
|
-
native: isSelectNative
|
|
72
|
-
}, (_rootProps$components2 = rootProps.componentsProps) == null ? void 0 : _rootProps$components2.baseSelect),
|
|
73
|
-
children: renderSingleSelectOptions(apiRef.current.getColumn(item.field), apiRef.current, isSelectNative ? 'option' : MenuItem)
|
|
74
|
-
} : {};
|
|
75
31
|
var onFilterChange = React.useCallback(function (event) {
|
|
76
32
|
var value = event.target.value;
|
|
77
|
-
// NativeSelect casts the value to a string.
|
|
78
|
-
if (type === 'singleSelect') {
|
|
79
|
-
var column = apiRef.current.getColumn(item.field);
|
|
80
|
-
var columnValueOptions = typeof column.valueOptions === 'function' ? column.valueOptions({
|
|
81
|
-
field: column.field
|
|
82
|
-
}) : column.valueOptions;
|
|
83
|
-
value = getValueFromValueOptions(value, columnValueOptions);
|
|
84
|
-
}
|
|
85
33
|
clearTimeout(filterTimeout.current);
|
|
86
34
|
setFilterValueState(String(value));
|
|
87
35
|
setIsApplying(true);
|
|
88
|
-
// TODO singleSelect doesn't debounce
|
|
89
36
|
filterTimeout.current = setTimeout(function () {
|
|
90
37
|
applyValue(_extends({}, item, {
|
|
91
38
|
value: value
|
|
92
39
|
}));
|
|
93
40
|
setIsApplying(false);
|
|
94
41
|
}, SUBMIT_FILTER_STROKE_TIME);
|
|
95
|
-
}, [
|
|
42
|
+
}, [applyValue, item]);
|
|
96
43
|
React.useEffect(function () {
|
|
97
44
|
return function () {
|
|
98
45
|
clearTimeout(filterTimeout.current);
|
|
@@ -119,7 +66,7 @@ function GridFilterInputValue(props) {
|
|
|
119
66
|
shrink: true
|
|
120
67
|
},
|
|
121
68
|
inputRef: focusElementRef
|
|
122
|
-
},
|
|
69
|
+
}, others, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseTextField));
|
|
123
70
|
}
|
|
124
71
|
process.env.NODE_ENV !== "production" ? GridFilterInputValue.propTypes = {
|
|
125
72
|
// ----------------------------- Warning --------------------------------
|
|
@@ -18,6 +18,19 @@ function writeToClipboardPolyfill(data) {
|
|
|
18
18
|
document.body.removeChild(span);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
+
function hasNativeSelection(element) {
|
|
22
|
+
var _window$getSelection;
|
|
23
|
+
if (((_window$getSelection = window.getSelection()) == null ? void 0 : _window$getSelection.toString()) !== '') {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
if (!element) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
if ((element.selectionEnd || 0) - (element.selectionStart || 0) > 0) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
21
34
|
|
|
22
35
|
/**
|
|
23
36
|
* @requires useGridCsvExport (method)
|
|
@@ -42,7 +55,6 @@ export var useGridClipboard = function useGridClipboard(apiRef) {
|
|
|
42
55
|
}
|
|
43
56
|
}, [apiRef]);
|
|
44
57
|
var handleKeydown = React.useCallback(function (event) {
|
|
45
|
-
var _window$getSelection;
|
|
46
58
|
var isModifierKeyPressed = event.ctrlKey || event.metaKey || event.altKey;
|
|
47
59
|
// event.key === 'c' is not enough as alt+c can lead to ©, ç, or other characters on macOS.
|
|
48
60
|
// event.code === 'KeyC' is not enough as event.code assume a QWERTY keyboard layout which would
|
|
@@ -52,7 +64,7 @@ export var useGridClipboard = function useGridClipboard(apiRef) {
|
|
|
52
64
|
}
|
|
53
65
|
|
|
54
66
|
// Do nothing if there's a native selection
|
|
55
|
-
if ((
|
|
67
|
+
if (hasNativeSelection(event.target)) {
|
|
56
68
|
return;
|
|
57
69
|
}
|
|
58
70
|
apiRef.current.unstable_copySelectedRowsToClipboard(event.altKey);
|
|
@@ -98,6 +98,8 @@ export var useGridPrintExport = function useGridPrintExport(apiRef, props) {
|
|
|
98
98
|
// Allow to overflow to not hide the border of the last row
|
|
99
99
|
var gridMain = gridClone.querySelector(".".concat(gridClasses.main));
|
|
100
100
|
gridMain.style.overflow = 'visible';
|
|
101
|
+
// See https://support.google.com/chrome/thread/191619088?hl=en&msgid=193009642
|
|
102
|
+
gridMain.style.contain = 'size';
|
|
101
103
|
var columnHeaders = gridClone.querySelector(".".concat(gridClasses.columnHeaders));
|
|
102
104
|
var columnHeadersInner = columnHeaders.querySelector(".".concat(gridClasses.columnHeadersInner));
|
|
103
105
|
columnHeadersInner.style.width = '100%';
|
|
@@ -4,7 +4,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
4
4
|
var _excluded = ["style"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import * as ReactDOM from 'react-dom';
|
|
7
|
-
import { unstable_useForkRef as useForkRef } from '@mui/utils';
|
|
7
|
+
import { unstable_useForkRef as useForkRef, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
|
|
8
8
|
import { useGridPrivateApiContext } from '../../utils/useGridPrivateApiContext';
|
|
9
9
|
import { useGridRootProps } from '../../utils/useGridRootProps';
|
|
10
10
|
import { useGridSelector } from '../../utils/useGridSelector';
|
|
@@ -157,7 +157,7 @@ export var useGridVirtualScroller = function useGridVirtualScroller(props) {
|
|
|
157
157
|
lastColumnIndex: lastColumnIndex
|
|
158
158
|
};
|
|
159
159
|
}, [disableVirtualization, getNearestIndexToRender, rowsMeta.positions.length, rootProps.autoHeight, rootProps.rowBuffer, currentPage.rows, columnPositions, visibleColumns.length, apiRef, containerDimensions]);
|
|
160
|
-
|
|
160
|
+
useEnhancedEffect(function () {
|
|
161
161
|
if (disableVirtualization) {
|
|
162
162
|
renderZoneRef.current.style.transform = "translate3d(0px, 0px, 0px)";
|
|
163
163
|
} else {
|
|
@@ -166,7 +166,7 @@ export var useGridVirtualScroller = function useGridVirtualScroller(props) {
|
|
|
166
166
|
rootRef.current.scrollTop = 0;
|
|
167
167
|
}
|
|
168
168
|
}, [disableVirtualization]);
|
|
169
|
-
|
|
169
|
+
useEnhancedEffect(function () {
|
|
170
170
|
setContainerDimensions({
|
|
171
171
|
width: rootRef.current.clientWidth,
|
|
172
172
|
height: rootRef.current.clientHeight
|
|
@@ -239,7 +239,7 @@ export var useGridVirtualScroller = function useGridVirtualScroller(props) {
|
|
|
239
239
|
});
|
|
240
240
|
prevRenderContext.current = nextRenderContext;
|
|
241
241
|
}, [apiRef, setRenderContext, prevRenderContext, currentPage.rows.length, rootProps.rowBuffer]);
|
|
242
|
-
|
|
242
|
+
useEnhancedEffect(function () {
|
|
243
243
|
if (containerDimensions.width == null) {
|
|
244
244
|
return;
|
|
245
245
|
}
|
package/legacy/index.js
CHANGED
|
@@ -24,7 +24,7 @@ export interface GridParamsApi {
|
|
|
24
24
|
* @param {string} field The column field.
|
|
25
25
|
* @returns {GridCellParams} The cell params.
|
|
26
26
|
*/
|
|
27
|
-
getCellParams: <
|
|
27
|
+
getCellParams: <R extends GridValidRowModel = any, V = any, F = V, N extends GridTreeNode = GridTreeNode>(id: GridRowId, field: string) => GridCellParams<R, V, F, N>;
|
|
28
28
|
/**
|
|
29
29
|
* Gets the [[GridRowParams]] object that is passed as argument in events.
|
|
30
30
|
* @param {GridRowId} id The id of the row.
|
|
@@ -27,7 +27,7 @@ export type GridKeyValue = string | number | boolean;
|
|
|
27
27
|
/**
|
|
28
28
|
* Column Definition base interface.
|
|
29
29
|
*/
|
|
30
|
-
export interface GridBaseColDef<R extends GridValidRowModel =
|
|
30
|
+
export interface GridBaseColDef<R extends GridValidRowModel = GridValidRowModel, V = any, F = V> {
|
|
31
31
|
/**
|
|
32
32
|
* The column identifier. It's used to map with [[GridRowModel]] values.
|
|
33
33
|
*/
|
|
@@ -117,10 +117,10 @@ export interface GridBaseColDef<R extends GridValidRowModel = any, V = any, F =
|
|
|
117
117
|
/**
|
|
118
118
|
* Function that allows to get a specific data instead of field to render in the cell.
|
|
119
119
|
* @template R, V
|
|
120
|
-
* @param {GridValueGetterParams<
|
|
120
|
+
* @param {GridValueGetterParams<R, any>} params Object containing parameters for the getter.
|
|
121
121
|
* @returns {V} The cell value.
|
|
122
122
|
*/
|
|
123
|
-
valueGetter?: (params: GridValueGetterParams<
|
|
123
|
+
valueGetter?: (params: GridValueGetterParams<R, any>) => V;
|
|
124
124
|
/**
|
|
125
125
|
* Function that allows to customize how the entered value is stored in the row.
|
|
126
126
|
* It only works with cell/row editing.
|
|
@@ -140,27 +140,27 @@ export interface GridBaseColDef<R extends GridValidRowModel = any, V = any, F =
|
|
|
140
140
|
* Function that takes the user-entered value and converts it to a value used internally.
|
|
141
141
|
* @template R, V, F
|
|
142
142
|
* @param {F | undefined} value The user-entered value.
|
|
143
|
-
* @param {GridCellParams<
|
|
143
|
+
* @param {GridCellParams<R, V, F>} params The params when called before saving the value.
|
|
144
144
|
* @returns {V} The converted value to use internally.
|
|
145
145
|
*/
|
|
146
|
-
valueParser?: (value: F | undefined, params?: GridCellParams<
|
|
146
|
+
valueParser?: (value: F | undefined, params?: GridCellParams<R, V, F>) => V;
|
|
147
147
|
/**
|
|
148
148
|
* Class name that will be added in cells for that column.
|
|
149
149
|
*/
|
|
150
|
-
cellClassName?: GridCellClassNamePropType
|
|
150
|
+
cellClassName?: GridCellClassNamePropType<R, V>;
|
|
151
151
|
/**
|
|
152
152
|
* Allows to override the component rendered as cell for this column.
|
|
153
153
|
* @template R, V, F
|
|
154
|
-
* @param {GridRenderCellParams<
|
|
154
|
+
* @param {GridRenderCellParams<R, V, F>} params Object containing parameters for the renderer.
|
|
155
155
|
* @returns {React.ReactNode} The element to be rendered.
|
|
156
156
|
*/
|
|
157
|
-
renderCell?: (params: GridRenderCellParams<
|
|
157
|
+
renderCell?: (params: GridRenderCellParams<R, V, F>) => React.ReactNode;
|
|
158
158
|
/**
|
|
159
159
|
* Allows to override the component rendered in edit cell mode for this column.
|
|
160
160
|
* @param {GridRenderEditCellParams} params Object containing parameters for the renderer.
|
|
161
161
|
* @returns {React.ReactNode} The element to be rendered.
|
|
162
162
|
*/
|
|
163
|
-
renderEditCell?: (params: GridRenderEditCellParams<V>) => React.ReactNode;
|
|
163
|
+
renderEditCell?: (params: GridRenderEditCellParams<R, V, F>) => React.ReactNode;
|
|
164
164
|
/**
|
|
165
165
|
* Callback fired when the edit props of the cell changes.
|
|
166
166
|
* It allows to process the props that saved into the state.
|
|
@@ -174,11 +174,11 @@ export interface GridBaseColDef<R extends GridValidRowModel = any, V = any, F =
|
|
|
174
174
|
headerClassName?: GridColumnHeaderClassNamePropType;
|
|
175
175
|
/**
|
|
176
176
|
* Allows to render a component in the column header cell.
|
|
177
|
-
* @template
|
|
178
|
-
* @param {GridColumnHeaderParams<
|
|
177
|
+
* @template R, V, F
|
|
178
|
+
* @param {GridColumnHeaderParams<R, V, F>} params Object containing parameters for the renderer.
|
|
179
179
|
* @returns {React.ReactNode} The element to be rendered.
|
|
180
180
|
*/
|
|
181
|
-
renderHeader?: (params: GridColumnHeaderParams<
|
|
181
|
+
renderHeader?: (params: GridColumnHeaderParams<R, V, F>) => React.ReactNode;
|
|
182
182
|
/**
|
|
183
183
|
* Header cell element alignment.
|
|
184
184
|
*/
|
|
@@ -210,7 +210,7 @@ export interface GridBaseColDef<R extends GridValidRowModel = any, V = any, F =
|
|
|
210
210
|
* @param {React.MutableRefObject<GridApiCommunity>} apiRef Deprecated: The API of the grid.
|
|
211
211
|
* @returns {null | ((params: GridCellParams) => boolean)} The function to call to check if a row pass this filter value or not.
|
|
212
212
|
*/
|
|
213
|
-
getApplyQuickFilterFn?: (value: any, colDef: GridStateColDef, apiRef: React.MutableRefObject<GridApiCommunity>) => null | ((params: GridCellParams<
|
|
213
|
+
getApplyQuickFilterFn?: (value: any, colDef: GridStateColDef, apiRef: React.MutableRefObject<GridApiCommunity>) => null | ((params: GridCellParams<R, V, F>) => boolean);
|
|
214
214
|
/**
|
|
215
215
|
* If `true`, this column cannot be reordered.
|
|
216
216
|
* @default false
|
|
@@ -225,7 +225,7 @@ export interface GridBaseColDef<R extends GridValidRowModel = any, V = any, F =
|
|
|
225
225
|
* Number of columns a cell should span.
|
|
226
226
|
* @default 1
|
|
227
227
|
*/
|
|
228
|
-
colSpan?: number | ((params: GridCellParams<
|
|
228
|
+
colSpan?: number | ((params: GridCellParams<R, V, F>) => number | undefined);
|
|
229
229
|
}
|
|
230
230
|
export interface GridActionsColDef<R extends GridValidRowModel = any, V = any, F = V> extends GridBaseColDef<R, V, F> {
|
|
231
231
|
/**
|
|
@@ -4,7 +4,6 @@ import { GridCellEditStartParams, GridCellEditStopParams } from '../params/gridE
|
|
|
4
4
|
import { GridCellParams } from '../params/gridCellParams';
|
|
5
5
|
import type { GridFilterModel } from '../gridFilterModel';
|
|
6
6
|
import type { GridSortModel } from '../gridSortModel';
|
|
7
|
-
import type { GridEditRowsModel } from '../gridEditRowModel';
|
|
8
7
|
import type { GridRowSelectionModel } from '../gridRowSelectionModel';
|
|
9
8
|
import type { ElementSize } from '../elementSize';
|
|
10
9
|
import type { MuiBaseEvent } from '../muiEvent';
|
|
@@ -212,49 +211,49 @@ export interface GridCellEventLookup {
|
|
|
212
211
|
* Fired when a cell is clicked.
|
|
213
212
|
*/
|
|
214
213
|
cellClick: {
|
|
215
|
-
params: GridCellParams
|
|
214
|
+
params: GridCellParams<any>;
|
|
216
215
|
event: React.MouseEvent<HTMLElement>;
|
|
217
216
|
};
|
|
218
217
|
/**
|
|
219
218
|
* Fired when a cell is double-clicked.
|
|
220
219
|
*/
|
|
221
220
|
cellDoubleClick: {
|
|
222
|
-
params: GridCellParams
|
|
221
|
+
params: GridCellParams<any>;
|
|
223
222
|
event: React.MouseEvent<HTMLElement>;
|
|
224
223
|
};
|
|
225
224
|
/**
|
|
226
225
|
* Fired when a `mousedown` event happens in a cell.
|
|
227
226
|
*/
|
|
228
227
|
cellMouseDown: {
|
|
229
|
-
params: GridCellParams
|
|
228
|
+
params: GridCellParams<any>;
|
|
230
229
|
event: React.MouseEvent<HTMLElement>;
|
|
231
230
|
};
|
|
232
231
|
/**
|
|
233
232
|
* Fired when a `mouseup` event happens in a cell.
|
|
234
233
|
*/
|
|
235
234
|
cellMouseUp: {
|
|
236
|
-
params: GridCellParams
|
|
235
|
+
params: GridCellParams<any>;
|
|
237
236
|
event: React.MouseEvent<HTMLElement>;
|
|
238
237
|
};
|
|
239
238
|
/**
|
|
240
239
|
* Fired when a `mouseover` event happens in a cell.
|
|
241
240
|
*/
|
|
242
241
|
cellMouseOver: {
|
|
243
|
-
params: GridCellParams
|
|
242
|
+
params: GridCellParams<any>;
|
|
244
243
|
event: React.MouseEvent<HTMLElement>;
|
|
245
244
|
};
|
|
246
245
|
/**
|
|
247
246
|
* Fired when a `keydown` event happens in a cell.
|
|
248
247
|
*/
|
|
249
248
|
cellKeyDown: {
|
|
250
|
-
params: GridCellParams
|
|
249
|
+
params: GridCellParams<any>;
|
|
251
250
|
event: React.KeyboardEvent<HTMLElement>;
|
|
252
251
|
};
|
|
253
252
|
/**
|
|
254
253
|
* Fired when a `keyup` event happens in a cell.
|
|
255
254
|
*/
|
|
256
255
|
cellKeyUp: {
|
|
257
|
-
params: GridCellParams
|
|
256
|
+
params: GridCellParams<any>;
|
|
258
257
|
event: React.KeyboardEvent<HTMLElement>;
|
|
259
258
|
};
|
|
260
259
|
/**
|
|
@@ -262,7 +261,7 @@ export interface GridCellEventLookup {
|
|
|
262
261
|
* @ignore - do not document.
|
|
263
262
|
*/
|
|
264
263
|
cellDragEnter: {
|
|
265
|
-
params: GridCellParams
|
|
264
|
+
params: GridCellParams<any>;
|
|
266
265
|
event: React.DragEvent<HTMLElement>;
|
|
267
266
|
};
|
|
268
267
|
/**
|
|
@@ -271,7 +270,7 @@ export interface GridCellEventLookup {
|
|
|
271
270
|
* @ignore - do not document.
|
|
272
271
|
*/
|
|
273
272
|
cellDragOver: {
|
|
274
|
-
params: GridCellParams
|
|
273
|
+
params: GridCellParams<any>;
|
|
275
274
|
event: React.DragEvent<HTMLElement>;
|
|
276
275
|
};
|
|
277
276
|
}
|
|
@@ -300,12 +299,6 @@ export interface GridControlledStateEventLookup {
|
|
|
300
299
|
sortModelChange: {
|
|
301
300
|
params: GridSortModel;
|
|
302
301
|
};
|
|
303
|
-
/**
|
|
304
|
-
* Fired when the row editing model changes.
|
|
305
|
-
*/
|
|
306
|
-
editRowsModelChange: {
|
|
307
|
-
params: GridEditRowsModel;
|
|
308
|
-
};
|
|
309
302
|
/**
|
|
310
303
|
* Fired when the selection state of one or multiple rows changes.
|
|
311
304
|
*/
|
|
@@ -444,7 +437,7 @@ export interface GridEventLookup extends GridRowEventLookup, GridColumnHeaderEve
|
|
|
444
437
|
* @ignore - do not document
|
|
445
438
|
*/
|
|
446
439
|
cellModeChange: {
|
|
447
|
-
params: GridCellParams
|
|
440
|
+
params: GridCellParams<any>;
|
|
448
441
|
};
|
|
449
442
|
/**
|
|
450
443
|
* Fired when the model that controls the cell modes changes.
|
|
@@ -497,13 +490,13 @@ export interface GridEventLookup extends GridRowEventLookup, GridColumnHeaderEve
|
|
|
497
490
|
* Fired when a cell gains focus.
|
|
498
491
|
*/
|
|
499
492
|
cellFocusIn: {
|
|
500
|
-
params: GridCellParams
|
|
493
|
+
params: GridCellParams<any>;
|
|
501
494
|
};
|
|
502
495
|
/**
|
|
503
496
|
* Fired when a cell loses focus.
|
|
504
497
|
*/
|
|
505
498
|
cellFocusOut: {
|
|
506
|
-
params: GridCellParams
|
|
499
|
+
params: GridCellParams<any>;
|
|
507
500
|
event: MuiBaseEvent;
|
|
508
501
|
};
|
|
509
502
|
/**
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { GridValidRowModel } from './gridRows';
|
|
1
2
|
import { GridCellParams } from './params/gridCellParams';
|
|
2
3
|
/**
|
|
3
4
|
* A function used to process cellClassName params.
|
|
4
5
|
*/
|
|
5
|
-
export type GridCellClassFn = (params: GridCellParams) => string;
|
|
6
|
+
export type GridCellClassFn<R extends GridValidRowModel = any, V = unknown> = (params: GridCellParams<R, V>) => string;
|
|
6
7
|
/**
|
|
7
8
|
* The union type representing the [[GridColDef]] cell class type.
|
|
8
9
|
*/
|
|
9
|
-
export type GridCellClassNamePropType = string | GridCellClassFn
|
|
10
|
+
export type GridCellClassNamePropType<R extends GridValidRowModel = any, V = unknown> = string | GridCellClassFn<R, V>;
|
|
@@ -9,10 +9,9 @@ export interface GridEditCellProps<V = any> {
|
|
|
9
9
|
export type GridEditRowProps = {
|
|
10
10
|
[field: string]: GridEditCellProps;
|
|
11
11
|
};
|
|
12
|
-
export type
|
|
12
|
+
export type GridEditingState = {
|
|
13
13
|
[rowId: string]: GridEditRowProps;
|
|
14
14
|
};
|
|
15
|
-
export type GridEditingState = GridEditRowsModel;
|
|
16
15
|
export type GridEditMode = 'cell' | 'row';
|
|
17
16
|
declare enum GridEditModes {
|
|
18
17
|
Cell = "cell",
|
|
@@ -26,7 +26,7 @@ export interface GridFilterOperator<R extends GridValidRowModel = any, V = any,
|
|
|
26
26
|
* @param {GridColDef} column The column from which we want to filter the rows.
|
|
27
27
|
* @returns {null | ((params: GridCellParams) => boolean)} The function to call to check if a row pass this filter item or not.
|
|
28
28
|
*/
|
|
29
|
-
getApplyFilterFn: (filterItem: GridFilterItem, column: GridColDef<R, V, F>) => null | ((params: GridCellParams<
|
|
29
|
+
getApplyFilterFn: (filterItem: GridFilterItem, column: GridColDef<R, V, F>) => null | ((params: GridCellParams<R, V, F>) => boolean);
|
|
30
30
|
/**
|
|
31
31
|
* The input component to render in the filter panel for this filter operator.
|
|
32
32
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GridColumnMenuState, GridColumnsInitialState, GridColumnsState, GridColumnsGroupingState, GridDensityState, GridFilterInitialState, GridFilterState, GridFocusState, GridPaginationInitialState, GridPaginationState, GridPreferencePanelInitialState, GridPreferencePanelState, GridRowsState, GridSortingInitialState, GridSortingState, GridTabIndexState } from '../hooks';
|
|
2
2
|
import type { GridRowsMetaState } from '../hooks/features/rows/gridRowsMetaState';
|
|
3
|
-
import type {
|
|
3
|
+
import type { GridEditingState } from './gridEditRowModel';
|
|
4
4
|
import type { GridRowSelectionModel } from './gridRowSelectionModel';
|
|
5
5
|
/**
|
|
6
6
|
* The state of `DataGrid`.
|
|
@@ -8,7 +8,7 @@ import type { GridRowSelectionModel } from './gridRowSelectionModel';
|
|
|
8
8
|
export interface GridStateCommunity {
|
|
9
9
|
rows: GridRowsState;
|
|
10
10
|
rowsMeta: GridRowsMetaState;
|
|
11
|
-
editRows:
|
|
11
|
+
editRows: GridEditingState;
|
|
12
12
|
pagination: GridPaginationState;
|
|
13
13
|
columns: GridColumnsState;
|
|
14
14
|
columnGrouping: GridColumnsGroupingState;
|
|
@@ -7,7 +7,7 @@ import { GridApiCommunity } from '../api/gridApiCommunity';
|
|
|
7
7
|
/**
|
|
8
8
|
* Object passed as parameter in the column [[GridColDef]] cell renderer.
|
|
9
9
|
*/
|
|
10
|
-
export interface GridCellParams<
|
|
10
|
+
export interface GridCellParams<R extends GridValidRowModel = any, V = unknown, F = V, N extends GridTreeNode = GridTreeNode> {
|
|
11
11
|
/**
|
|
12
12
|
* The grid row id.
|
|
13
13
|
*/
|
|
@@ -60,7 +60,7 @@ export interface FocusElement {
|
|
|
60
60
|
/**
|
|
61
61
|
* GridCellParams containing api.
|
|
62
62
|
*/
|
|
63
|
-
export interface GridRenderCellParams<
|
|
63
|
+
export interface GridRenderCellParams<R extends GridValidRowModel = any, V = any, F = V, N extends GridTreeNodeWithRender = GridTreeNodeWithRender> extends GridCellParams<R, V, F, N> {
|
|
64
64
|
/**
|
|
65
65
|
* GridApi that let you manipulate the grid.
|
|
66
66
|
*/
|
|
@@ -75,7 +75,7 @@ export interface GridRenderCellParams<V = any, R extends GridValidRowModel = any
|
|
|
75
75
|
/**
|
|
76
76
|
* GridEditCellProps containing api.
|
|
77
77
|
*/
|
|
78
|
-
export interface GridRenderEditCellParams<
|
|
78
|
+
export interface GridRenderEditCellParams<R extends GridValidRowModel = any, V = any, F = V, N extends GridTreeNodeWithRender = GridTreeNodeWithRender> extends GridCellParams<R, V, F, N>, GridEditCellProps<V> {
|
|
79
79
|
/**
|
|
80
80
|
* GridApi that let you manipulate the grid.
|
|
81
81
|
*/
|
|
@@ -84,7 +84,7 @@ export interface GridRenderEditCellParams<V = any, R extends GridValidRowModel =
|
|
|
84
84
|
/**
|
|
85
85
|
* Parameters passed to `colDef.valueGetter`.
|
|
86
86
|
*/
|
|
87
|
-
export interface GridValueGetterParams<
|
|
87
|
+
export interface GridValueGetterParams<R extends GridValidRowModel = any, V = any, N extends GridTreeNodeWithRender = GridTreeNodeWithRender> extends Omit<GridCellParams<R, V, any, N>, 'formattedValue' | 'isEditable'> {
|
|
88
88
|
/**
|
|
89
89
|
* GridApi that let you manipulate the grid.
|
|
90
90
|
*/
|
|
@@ -92,7 +92,7 @@ export interface GridValueGetterParams<V = any, R extends GridValidRowModel = Gr
|
|
|
92
92
|
/**
|
|
93
93
|
* The default value for the cell that the `valueGetter` is overriding.
|
|
94
94
|
*/
|
|
95
|
-
value: GridCellParams<
|
|
95
|
+
value: GridCellParams<R, V, any>['value'];
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
98
|
* Object passed as parameter in the column [[GridColDef]] value setter callback.
|
|
@@ -3,7 +3,7 @@ import { GridValidRowModel } from '../gridRows';
|
|
|
3
3
|
/**
|
|
4
4
|
* Object passed as parameter in the column [[GridColDef]] header renderer.
|
|
5
5
|
*/
|
|
6
|
-
export interface GridColumnHeaderParams<
|
|
6
|
+
export interface GridColumnHeaderParams<R extends GridValidRowModel = GridValidRowModel, V = any, F = V> {
|
|
7
7
|
/**
|
|
8
8
|
* The column field of the column that triggered the event
|
|
9
9
|
*/
|
|
@@ -34,7 +34,7 @@ declare enum GridCellEditStartReasons {
|
|
|
34
34
|
/**
|
|
35
35
|
* Params passed to the `cellEditStart` event.
|
|
36
36
|
*/
|
|
37
|
-
export interface GridCellEditStartParams<
|
|
37
|
+
export interface GridCellEditStartParams<R extends GridValidRowModel = any, V = any, F = V> extends GridCellParams<R, V, F> {
|
|
38
38
|
/**
|
|
39
39
|
* The reason for this event to be triggered.
|
|
40
40
|
*/
|
|
@@ -54,7 +54,7 @@ declare enum GridCellEditStopReasons {
|
|
|
54
54
|
/**
|
|
55
55
|
* Params passed to the `cellEditStop event.
|
|
56
56
|
*/
|
|
57
|
-
export interface GridCellEditStopParams<
|
|
57
|
+
export interface GridCellEditStopParams<R extends GridValidRowModel = any, V = any, F = V> extends GridCellParams<R, V, F> {
|
|
58
58
|
/**
|
|
59
59
|
* The reason for this event to be triggered.
|
|
60
60
|
*/
|
|
@@ -3,7 +3,7 @@ import { SxProps } from '@mui/system';
|
|
|
3
3
|
import { Theme } from '@mui/material/styles';
|
|
4
4
|
import { CommonProps } from '@mui/material/OverridableComponent';
|
|
5
5
|
import { GridDensity } from '../gridDensity';
|
|
6
|
-
import { GridEditMode
|
|
6
|
+
import { GridEditMode } from '../gridEditRowModel';
|
|
7
7
|
import { GridFeatureMode } from '../gridFeatureMode';
|
|
8
8
|
import { Logger } from '../logger';
|
|
9
9
|
import { GridSortDirection, GridSortModel } from '../gridSortModel';
|
|
@@ -582,16 +582,6 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
582
582
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
583
583
|
*/
|
|
584
584
|
onMenuClose?: GridEventListener<'menuClose'>;
|
|
585
|
-
/**
|
|
586
|
-
* Set the edit rows model of the grid.
|
|
587
|
-
*/
|
|
588
|
-
editRowsModel?: GridEditRowsModel;
|
|
589
|
-
/**
|
|
590
|
-
* Callback fired when the `editRowsModel` changes.
|
|
591
|
-
* @param {GridEditRowsModel} editRowsModel With all properties from [[GridEditRowsModel]].
|
|
592
|
-
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
593
|
-
*/
|
|
594
|
-
onEditRowsModelChange?: (editRowsModel: GridEditRowsModel, details: GridCallbackDetails) => void;
|
|
595
585
|
/**
|
|
596
586
|
* Controls the modes of the cells.
|
|
597
587
|
*/
|
|
@@ -155,10 +155,6 @@ DataGridRaw.propTypes = {
|
|
|
155
155
|
* @default "cell"
|
|
156
156
|
*/
|
|
157
157
|
editMode: PropTypes.oneOf(['cell', 'row']),
|
|
158
|
-
/**
|
|
159
|
-
* Set the edit rows model of the grid.
|
|
160
|
-
*/
|
|
161
|
-
editRowsModel: PropTypes.object,
|
|
162
158
|
/**
|
|
163
159
|
* An error that will turn the grid into its error state and display the error component.
|
|
164
160
|
*/
|
|
@@ -407,12 +403,6 @@ DataGridRaw.propTypes = {
|
|
|
407
403
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
408
404
|
*/
|
|
409
405
|
onColumnVisibilityModelChange: PropTypes.func,
|
|
410
|
-
/**
|
|
411
|
-
* Callback fired when the `editRowsModel` changes.
|
|
412
|
-
* @param {GridEditRowsModel} editRowsModel With all properties from [[GridEditRowsModel]].
|
|
413
|
-
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
414
|
-
*/
|
|
415
|
-
onEditRowsModelChange: PropTypes.func,
|
|
416
406
|
/**
|
|
417
407
|
* Callback fired when an exception is thrown in the grid.
|
|
418
408
|
* @param {any} args The arguments passed to the `showError` call.
|