@mui/x-data-grid 5.12.2 → 5.13.1
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 +160 -6
- package/DataGrid/DataGrid.js +4 -4
- package/colDef/gridDateOperators.js +4 -2
- package/colDef/gridNumericOperators.js +4 -2
- package/colDef/gridStringOperators.d.ts +1 -1
- package/colDef/gridStringOperators.js +15 -8
- package/components/GridRow.js +1 -1
- package/components/cell/GridActionsCellItem.d.ts +2 -2
- package/components/cell/GridBooleanCell.js +4 -3
- package/components/cell/GridEditBooleanCell.js +4 -3
- package/components/cell/GridEditDateCell.js +4 -3
- package/components/cell/GridEditInputCell.js +4 -3
- package/components/cell/GridEditSingleSelectCell.js +9 -7
- package/components/panel/GridColumnsPanel.js +1 -1
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterForm.js +11 -4
- package/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/components/panel/filterPanel/GridFilterInputDate.js +4 -2
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +5 -9
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +42 -19
- package/components/panel/filterPanel/GridFilterInputMultipleValue.d.ts +3 -7
- package/components/panel/filterPanel/GridFilterInputMultipleValue.js +32 -14
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -2
- package/components/panel/filterPanel/GridFilterInputValue.js +4 -2
- package/components/panel/filterPanel/GridFilterInputValueProps.d.ts +6 -3
- package/components/panel/filterPanel/filterPanelUtils.d.ts +1 -1
- 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/components/toolbar/GridToolbarFilterButton.d.ts +1 -1
- package/hooks/features/dimensions/useGridDimensions.js +28 -15
- package/hooks/features/editRows/useGridCellEditing.new.js +7 -1
- package/hooks/features/editRows/useGridCellEditing.old.js +6 -0
- package/hooks/features/editRows/useGridRowEditing.new.js +7 -1
- package/hooks/features/editRows/useGridRowEditing.old.js +6 -0
- package/hooks/features/filter/gridFilterUtils.js +8 -5
- package/hooks/features/filter/useGridFilter.js +19 -1
- package/hooks/features/rows/useGridRows.js +16 -3
- package/hooks/features/rows/useGridRowsPreProcessors.js +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +14 -3
- package/hooks/utils/useGridApiContext.js +1 -1
- package/hooks/utils/useGridRootProps.js +1 -1
- package/index.js +1 -1
- package/legacy/DataGrid/DataGrid.js +4 -4
- package/legacy/colDef/gridDateOperators.js +4 -2
- package/legacy/colDef/gridNumericOperators.js +4 -2
- package/legacy/colDef/gridStringOperators.js +17 -7
- package/legacy/components/GridRow.js +1 -1
- package/legacy/components/cell/GridBooleanCell.js +3 -1
- package/legacy/components/cell/GridEditBooleanCell.js +4 -2
- package/legacy/components/cell/GridEditDateCell.js +4 -2
- package/legacy/components/cell/GridEditInputCell.js +4 -2
- package/legacy/components/cell/GridEditSingleSelectCell.js +9 -7
- package/legacy/components/panel/GridColumnsPanel.js +3 -1
- package/legacy/components/panel/filterPanel/GridFilterForm.js +9 -4
- package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/legacy/components/panel/filterPanel/GridFilterInputDate.js +4 -2
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +34 -12
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleValue.js +24 -7
- package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -2
- package/legacy/components/panel/filterPanel/GridFilterInputValue.js +4 -2
- package/legacy/hooks/features/dimensions/useGridDimensions.js +27 -15
- package/legacy/hooks/features/editRows/useGridCellEditing.new.js +7 -1
- package/legacy/hooks/features/editRows/useGridCellEditing.old.js +16 -8
- package/legacy/hooks/features/editRows/useGridRowEditing.new.js +7 -1
- package/legacy/hooks/features/editRows/useGridRowEditing.old.js +22 -14
- package/legacy/hooks/features/filter/gridFilterUtils.js +8 -5
- package/legacy/hooks/features/filter/useGridFilter.js +19 -1
- package/legacy/hooks/features/rows/useGridRows.js +18 -3
- package/legacy/hooks/features/rows/useGridRowsPreProcessors.js +1 -1
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +19 -8
- package/legacy/hooks/utils/useGridApiContext.js +1 -1
- package/legacy/hooks/utils/useGridRootProps.js +1 -1
- package/legacy/index.js +1 -1
- package/legacy/locales/deDE.js +4 -4
- package/legacy/locales/frFR.js +11 -11
- package/legacy/locales/index.js +3 -0
- package/legacy/locales/nlNL.js +15 -15
- package/legacy/locales/ptBR.js +11 -11
- package/legacy/locales/roRO.js +128 -0
- package/legacy/locales/skSK.js +16 -16
- package/legacy/locales/svSE.js +128 -0
- package/legacy/utils/keyboardUtils.js +4 -3
- package/locales/deDE.js +4 -4
- package/locales/frFR.js +11 -11
- package/locales/index.d.ts +3 -0
- package/locales/index.js +3 -0
- package/locales/nlNL.js +15 -15
- package/locales/ptBR.js +11 -11
- package/locales/roRO.d.ts +2 -0
- package/locales/roRO.js +116 -0
- package/locales/skSK.js +16 -16
- package/locales/svSE.d.ts +2 -0
- package/locales/svSE.js +116 -0
- package/models/gridFilterOperator.d.ts +6 -0
- package/modern/DataGrid/DataGrid.js +4 -4
- package/modern/colDef/gridDateOperators.js +4 -2
- package/modern/colDef/gridNumericOperators.js +4 -2
- package/modern/colDef/gridStringOperators.js +15 -8
- package/modern/components/GridRow.js +1 -1
- package/modern/components/cell/GridBooleanCell.js +4 -3
- package/modern/components/cell/GridEditBooleanCell.js +4 -3
- package/modern/components/cell/GridEditDateCell.js +4 -3
- package/modern/components/cell/GridEditInputCell.js +4 -3
- package/modern/components/cell/GridEditSingleSelectCell.js +9 -7
- package/modern/components/panel/GridColumnsPanel.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterForm.js +11 -4
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputDate.js +4 -2
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +32 -13
- package/modern/components/panel/filterPanel/GridFilterInputMultipleValue.js +22 -8
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -2
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +4 -2
- package/modern/hooks/features/dimensions/useGridDimensions.js +28 -15
- package/modern/hooks/features/editRows/useGridCellEditing.new.js +7 -1
- package/modern/hooks/features/editRows/useGridCellEditing.old.js +6 -0
- package/modern/hooks/features/editRows/useGridRowEditing.new.js +7 -1
- package/modern/hooks/features/editRows/useGridRowEditing.old.js +6 -0
- package/modern/hooks/features/filter/gridFilterUtils.js +8 -5
- package/modern/hooks/features/filter/useGridFilter.js +17 -1
- package/modern/hooks/features/rows/useGridRows.js +16 -3
- package/modern/hooks/features/rows/useGridRowsPreProcessors.js +1 -1
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +10 -3
- package/modern/hooks/utils/useGridApiContext.js +1 -1
- package/modern/hooks/utils/useGridRootProps.js +1 -1
- package/modern/index.js +1 -1
- package/modern/locales/deDE.js +4 -4
- package/modern/locales/frFR.js +11 -11
- package/modern/locales/index.js +3 -0
- package/modern/locales/nlNL.js +15 -15
- package/modern/locales/ptBR.js +11 -11
- package/modern/locales/roRO.js +116 -0
- package/modern/locales/skSK.js +16 -16
- package/modern/locales/svSE.js +116 -0
- package/modern/utils/keyboardUtils.js +4 -3
- package/node/DataGrid/DataGrid.js +4 -4
- package/node/colDef/gridDateOperators.js +4 -2
- package/node/colDef/gridNumericOperators.js +4 -2
- package/node/colDef/gridStringOperators.js +15 -8
- package/node/components/GridRow.js +1 -1
- package/node/components/cell/GridBooleanCell.js +5 -3
- package/node/components/cell/GridEditBooleanCell.js +5 -3
- package/node/components/cell/GridEditDateCell.js +5 -3
- package/node/components/cell/GridEditInputCell.js +5 -3
- package/node/components/cell/GridEditSingleSelectCell.js +10 -7
- package/node/components/panel/GridColumnsPanel.js +1 -1
- package/node/components/panel/filterPanel/GridFilterForm.js +9 -4
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputDate.js +4 -2
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +43 -20
- package/node/components/panel/filterPanel/GridFilterInputMultipleValue.js +33 -15
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -2
- package/node/components/panel/filterPanel/GridFilterInputValue.js +4 -2
- package/node/hooks/features/dimensions/useGridDimensions.js +28 -15
- package/node/hooks/features/editRows/useGridCellEditing.new.js +7 -1
- package/node/hooks/features/editRows/useGridCellEditing.old.js +6 -0
- package/node/hooks/features/editRows/useGridRowEditing.new.js +7 -1
- package/node/hooks/features/editRows/useGridRowEditing.old.js +6 -0
- package/node/hooks/features/filter/gridFilterUtils.js +7 -4
- package/node/hooks/features/filter/useGridFilter.js +19 -1
- package/node/hooks/features/rows/useGridRows.js +16 -3
- package/node/hooks/features/rows/useGridRowsPreProcessors.js +1 -1
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +14 -3
- package/node/hooks/utils/useGridApiContext.js +1 -1
- package/node/hooks/utils/useGridRootProps.js +1 -1
- package/node/index.js +1 -1
- package/node/locales/deDE.js +4 -4
- package/node/locales/frFR.js +11 -11
- package/node/locales/index.js +39 -0
- package/node/locales/nlNL.js +15 -15
- package/node/locales/ptBR.js +11 -11
- package/node/locales/roRO.js +126 -0
- package/node/locales/skSK.js +16 -16
- package/node/locales/svSE.js +126 -0
- package/node/utils/keyboardUtils.js +4 -3
- package/package.json +4 -4
- package/utils/keyboardUtils.js +4 -3
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef"];
|
|
3
|
+
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "color", "error", "helperText", "size", "variant"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete';
|
|
7
7
|
import Chip from '@mui/material/Chip';
|
|
8
|
-
import TextField from '@mui/material/TextField';
|
|
9
8
|
import { unstable_useId as useId } from '@mui/material/utils';
|
|
10
9
|
import { getValueFromOption } from './filterPanelUtils';
|
|
10
|
+
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
|
|
13
13
|
const isOptionEqualToValue = (option, value) => getValueFromOption(option) === getValueFromOption(value);
|
|
@@ -19,16 +19,37 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
19
19
|
item,
|
|
20
20
|
applyValue,
|
|
21
21
|
apiRef,
|
|
22
|
-
focusElementRef
|
|
22
|
+
focusElementRef,
|
|
23
|
+
color,
|
|
24
|
+
error,
|
|
25
|
+
helperText,
|
|
26
|
+
size,
|
|
27
|
+
variant = 'standard'
|
|
23
28
|
} = props,
|
|
24
29
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
25
30
|
|
|
31
|
+
const TextFieldProps = {
|
|
32
|
+
color,
|
|
33
|
+
error,
|
|
34
|
+
helperText,
|
|
35
|
+
size,
|
|
36
|
+
variant
|
|
37
|
+
};
|
|
26
38
|
const id = useId();
|
|
39
|
+
const rootProps = useGridRootProps();
|
|
27
40
|
const resolvedColumn = item.columnField ? apiRef.current.getColumn(item.columnField) : null;
|
|
28
41
|
const resolvedValueOptions = React.useMemo(() => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
42
|
+
if (!resolvedColumn?.valueOptions) {
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (typeof resolvedColumn.valueOptions === 'function') {
|
|
47
|
+
return resolvedColumn.valueOptions({
|
|
48
|
+
field: resolvedColumn.field
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return resolvedColumn.valueOptions;
|
|
32
53
|
}, [resolvedColumn]);
|
|
33
54
|
const resolvedFormattedValueOptions = React.useMemo(() => {
|
|
34
55
|
return resolvedValueOptions?.map(getValueFromOption);
|
|
@@ -59,7 +80,7 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
59
80
|
|
|
60
81
|
if (resolvedValueOptions !== undefined) {
|
|
61
82
|
const itemValueIndexes = item.value.map(element => {
|
|
62
|
-
// get the index matching between values and
|
|
83
|
+
// get the index matching between values and valueOptions
|
|
63
84
|
const formattedElement = getValueFromOption(element);
|
|
64
85
|
const index = resolvedFormattedValueOptions?.findIndex(formatedOption => formatedOption === formattedElement) || 0;
|
|
65
86
|
return index;
|
|
@@ -85,8 +106,7 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
85
106
|
return /*#__PURE__*/_jsx(Autocomplete, _extends({
|
|
86
107
|
multiple: true,
|
|
87
108
|
limitTags: 1,
|
|
88
|
-
options: resolvedValueOptions
|
|
89
|
-
,
|
|
109
|
+
options: resolvedValueOptions,
|
|
90
110
|
isOptionEqualToValue: isOptionEqualToValue,
|
|
91
111
|
filterOptions: filter,
|
|
92
112
|
id: id,
|
|
@@ -99,16 +119,15 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
99
119
|
}, getTagProps({
|
|
100
120
|
index
|
|
101
121
|
})))),
|
|
102
|
-
renderInput: params => /*#__PURE__*/_jsx(
|
|
122
|
+
renderInput: params => /*#__PURE__*/_jsx(rootProps.components.BaseTextField, _extends({}, params, {
|
|
103
123
|
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
104
124
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
105
125
|
InputLabelProps: _extends({}, params.InputLabelProps, {
|
|
106
126
|
shrink: true
|
|
107
127
|
}),
|
|
108
128
|
inputRef: focusElementRef,
|
|
109
|
-
type:
|
|
110
|
-
|
|
111
|
-
}))
|
|
129
|
+
type: "singleSelect"
|
|
130
|
+
}, TextFieldProps, rootProps.componentsProps?.baseTextField))
|
|
112
131
|
}, other));
|
|
113
132
|
}
|
|
114
133
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef"];
|
|
3
|
+
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "color", "error", "helperText", "size", "variant"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import Autocomplete from '@mui/material/Autocomplete';
|
|
7
7
|
import Chip from '@mui/material/Chip';
|
|
8
|
-
import TextField from '@mui/material/TextField';
|
|
9
8
|
import { unstable_useId as useId } from '@mui/material/utils';
|
|
9
|
+
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
|
|
12
12
|
function GridFilterInputMultipleValue(props) {
|
|
@@ -15,12 +15,25 @@ function GridFilterInputMultipleValue(props) {
|
|
|
15
15
|
applyValue,
|
|
16
16
|
type,
|
|
17
17
|
apiRef,
|
|
18
|
-
focusElementRef
|
|
18
|
+
focusElementRef,
|
|
19
|
+
color,
|
|
20
|
+
error,
|
|
21
|
+
helperText,
|
|
22
|
+
size,
|
|
23
|
+
variant
|
|
19
24
|
} = props,
|
|
20
25
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
21
26
|
|
|
27
|
+
const TextFieldProps = {
|
|
28
|
+
color,
|
|
29
|
+
error,
|
|
30
|
+
helperText,
|
|
31
|
+
size,
|
|
32
|
+
variant
|
|
33
|
+
};
|
|
22
34
|
const [filterValueState, setFilterValueState] = React.useState(item.value || []);
|
|
23
35
|
const id = useId();
|
|
36
|
+
const rootProps = useGridRootProps();
|
|
24
37
|
React.useEffect(() => {
|
|
25
38
|
const itemValue = item.value ?? [];
|
|
26
39
|
setFilterValueState(itemValue.map(String));
|
|
@@ -52,16 +65,15 @@ function GridFilterInputMultipleValue(props) {
|
|
|
52
65
|
}, getTagProps({
|
|
53
66
|
index
|
|
54
67
|
})))),
|
|
55
|
-
renderInput: params => /*#__PURE__*/_jsx(
|
|
68
|
+
renderInput: params => /*#__PURE__*/_jsx(rootProps.components.BaseTextField, _extends({}, params, {
|
|
56
69
|
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
57
70
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
58
71
|
InputLabelProps: _extends({}, params.InputLabelProps, {
|
|
59
72
|
shrink: true
|
|
60
73
|
}),
|
|
61
74
|
inputRef: focusElementRef,
|
|
62
|
-
type: type || 'text'
|
|
63
|
-
|
|
64
|
-
}))
|
|
75
|
+
type: type || 'text'
|
|
76
|
+
}, TextFieldProps, rootProps.componentsProps?.baseTextField))
|
|
65
77
|
}, other));
|
|
66
78
|
}
|
|
67
79
|
|
|
@@ -70,7 +82,9 @@ process.env.NODE_ENV !== "production" ? GridFilterInputMultipleValue.propTypes =
|
|
|
70
82
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
71
83
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
72
84
|
// ----------------------------------------------------------------------
|
|
73
|
-
apiRef: PropTypes.
|
|
85
|
+
apiRef: PropTypes.shape({
|
|
86
|
+
current: PropTypes.object.isRequired
|
|
87
|
+
}).isRequired,
|
|
74
88
|
applyValue: PropTypes.func.isRequired,
|
|
75
89
|
focusElementRef: PropTypes
|
|
76
90
|
/* @typescript-to-proptypes-ignore */
|
|
@@ -51,6 +51,10 @@ function GridFilterInputSingleSelect(props) {
|
|
|
51
51
|
const isSelectNative = baseSelectProps.native ?? true;
|
|
52
52
|
const currentColumn = item.columnField ? apiRef.current.getColumn(item.columnField) : null;
|
|
53
53
|
const currentValueOptions = React.useMemo(() => {
|
|
54
|
+
if (currentColumn === null) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
|
|
54
58
|
return typeof currentColumn.valueOptions === 'function' ? currentColumn.valueOptions({
|
|
55
59
|
field: currentColumn.field
|
|
56
60
|
}) : currentColumn.valueOptions;
|
|
@@ -90,8 +94,8 @@ function GridFilterInputSingleSelect(props) {
|
|
|
90
94
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
91
95
|
value: filterValueState,
|
|
92
96
|
onChange: onFilterChange,
|
|
93
|
-
type: type || 'text',
|
|
94
97
|
variant: "standard",
|
|
98
|
+
type: type || 'text',
|
|
95
99
|
InputLabelProps: {
|
|
96
100
|
shrink: true
|
|
97
101
|
},
|
|
@@ -110,7 +114,9 @@ process.env.NODE_ENV !== "production" ? GridFilterInputSingleSelect.propTypes =
|
|
|
110
114
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
111
115
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
112
116
|
// ----------------------------------------------------------------------
|
|
113
|
-
apiRef: PropTypes.
|
|
117
|
+
apiRef: PropTypes.shape({
|
|
118
|
+
current: PropTypes.object.isRequired
|
|
119
|
+
}).isRequired,
|
|
114
120
|
applyValue: PropTypes.func.isRequired,
|
|
115
121
|
focusElementRef: PropTypes
|
|
116
122
|
/* @typescript-to-proptypes-ignore */
|
|
@@ -111,8 +111,8 @@ function GridFilterInputValue(props) {
|
|
|
111
111
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
112
112
|
value: filterValueState,
|
|
113
113
|
onChange: onFilterChange,
|
|
114
|
-
type: type || 'text',
|
|
115
114
|
variant: "standard",
|
|
115
|
+
type: type || 'text',
|
|
116
116
|
InputProps: InputProps,
|
|
117
117
|
InputLabelProps: {
|
|
118
118
|
shrink: true
|
|
@@ -126,7 +126,9 @@ process.env.NODE_ENV !== "production" ? GridFilterInputValue.propTypes = {
|
|
|
126
126
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
127
127
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
128
128
|
// ----------------------------------------------------------------------
|
|
129
|
-
apiRef: PropTypes.
|
|
129
|
+
apiRef: PropTypes.shape({
|
|
130
|
+
current: PropTypes.object.isRequired
|
|
131
|
+
}).isRequired,
|
|
130
132
|
applyValue: PropTypes.func.isRequired,
|
|
131
133
|
focusElementRef: PropTypes
|
|
132
134
|
/* @typescript-to-proptypes-ignore */
|
|
@@ -69,21 +69,34 @@ export function useGridDimensions(apiRef, props) {
|
|
|
69
69
|
rootElement.removeChild(scrollDiv);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
72
|
+
let viewportOuterSize;
|
|
73
|
+
let hasScrollX;
|
|
74
|
+
let hasScrollY;
|
|
75
|
+
|
|
76
|
+
if (props.autoHeight) {
|
|
77
|
+
hasScrollY = false;
|
|
78
|
+
hasScrollX = Math.round(columnsTotalWidth) > rootDimensionsRef.current.width;
|
|
79
|
+
viewportOuterSize = {
|
|
80
|
+
width: rootDimensionsRef.current.width,
|
|
81
|
+
height: rowsMeta.currentPageTotalHeight + (hasScrollX ? scrollBarSize : 0)
|
|
82
|
+
};
|
|
83
|
+
} else {
|
|
84
|
+
viewportOuterSize = {
|
|
85
|
+
width: rootDimensionsRef.current.width,
|
|
86
|
+
height: rootDimensionsRef.current.height - headerHeight
|
|
87
|
+
};
|
|
88
|
+
const scrollInformation = hasScroll({
|
|
89
|
+
content: {
|
|
90
|
+
width: Math.round(columnsTotalWidth),
|
|
91
|
+
height: rowsMeta.currentPageTotalHeight
|
|
92
|
+
},
|
|
93
|
+
container: viewportOuterSize,
|
|
94
|
+
scrollBarSize
|
|
95
|
+
});
|
|
96
|
+
hasScrollY = scrollInformation.hasScrollY;
|
|
97
|
+
hasScrollX = scrollInformation.hasScrollX;
|
|
98
|
+
}
|
|
99
|
+
|
|
87
100
|
const viewportInnerSize = {
|
|
88
101
|
width: viewportOuterSize.width - (hasScrollY ? scrollBarSize : 0),
|
|
89
102
|
height: viewportOuterSize.height - (hasScrollX ? scrollBarSize : 0)
|
|
@@ -70,6 +70,12 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
70
70
|
}, [apiRef]);
|
|
71
71
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
72
72
|
if (params.cellMode === GridCellModes.Edit) {
|
|
73
|
+
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
74
|
+
// TODO: `event.which` is depricated but this is a temporary workaround
|
|
75
|
+
if (event.which === 229) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
73
79
|
let reason;
|
|
74
80
|
|
|
75
81
|
if (event.key === 'Escape') {
|
|
@@ -92,7 +98,7 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
92
98
|
let reason;
|
|
93
99
|
|
|
94
100
|
if (isPrintableKey(event.key)) {
|
|
95
|
-
if (event.
|
|
101
|
+
if (event.ctrlKey && event.key !== 'v' || event.metaKey && event.key !== 'v' || event.altKey) {
|
|
96
102
|
return;
|
|
97
103
|
}
|
|
98
104
|
|
|
@@ -175,6 +175,12 @@ export const useCellEditing = (apiRef, props) => {
|
|
|
175
175
|
};
|
|
176
176
|
useGridApiMethod(apiRef, cellEditingApi, 'EditRowApi');
|
|
177
177
|
const handleCellKeyDown = React.useCallback(async (params, event) => {
|
|
178
|
+
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
179
|
+
// TODO: `event.which` is depricated but this is a temporary workaround
|
|
180
|
+
if (event.which === 229) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
|
|
178
184
|
const {
|
|
179
185
|
id,
|
|
180
186
|
field,
|
|
@@ -108,6 +108,12 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
108
108
|
}, []);
|
|
109
109
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
110
110
|
if (params.cellMode === GridRowModes.Edit) {
|
|
111
|
+
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
112
|
+
// TODO: `event.which` is depricated but this is a temporary workaround
|
|
113
|
+
if (event.which === 229) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
|
|
111
117
|
let reason;
|
|
112
118
|
|
|
113
119
|
if (event.key === 'Escape') {
|
|
@@ -146,7 +152,7 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
146
152
|
let reason;
|
|
147
153
|
|
|
148
154
|
if (isPrintableKey(event.key)) {
|
|
149
|
-
if (event.
|
|
155
|
+
if (event.ctrlKey && event.key !== 'v' || event.metaKey && event.key !== 'v' || event.altKey) {
|
|
150
156
|
return;
|
|
151
157
|
}
|
|
152
158
|
|
|
@@ -172,6 +172,12 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
172
172
|
};
|
|
173
173
|
useGridApiMethod(apiRef, rowEditingApi, 'EditRowApi');
|
|
174
174
|
const handleCellKeyDown = React.useCallback(async (params, event) => {
|
|
175
|
+
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
176
|
+
// TODO: `event.which` is depricated but this is a temporary workaround
|
|
177
|
+
if (event.which === 229) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
|
|
175
181
|
const {
|
|
176
182
|
cellMode,
|
|
177
183
|
isEditable
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import { GridLinkOperator } from '../../../models';
|
|
3
3
|
import { buildWarning } from '../../../utils/warning';
|
|
4
|
-
import { gridColumnFieldsSelector } from '../columns';
|
|
4
|
+
import { gridColumnFieldsSelector, gridColumnLookupSelector } from '../columns';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Adds default values to the optional fields of a filter items.
|
|
@@ -18,8 +18,9 @@ export const cleanFilterItem = (item, apiRef) => {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
if (cleanItem.operatorValue == null) {
|
|
21
|
-
//
|
|
22
|
-
|
|
21
|
+
// Selects a default operator
|
|
22
|
+
// We don't use `apiRef.current.getColumn` because it is not ready during state initialization
|
|
23
|
+
const column = gridColumnLookupSelector(apiRef)[cleanItem.columnField];
|
|
23
24
|
cleanItem.operatorValue = column && column.filterOperators[0].value;
|
|
24
25
|
}
|
|
25
26
|
|
|
@@ -183,14 +184,16 @@ export const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
|
183
184
|
const sanitizedQuickFilterValues = quickFilterValues.filter((value, index) => Object.keys(appliersPerColumnField).some(field => appliersPerColumnField[field][index] != null));
|
|
184
185
|
return (rowId, shouldApplyFilter) => {
|
|
185
186
|
const usedCellParams = {};
|
|
187
|
+
const columnsFieldsToFilter = [];
|
|
186
188
|
Object.keys(appliersPerColumnField).forEach(columnField => {
|
|
187
189
|
if (!shouldApplyFilter || shouldApplyFilter(columnField)) {
|
|
188
190
|
usedCellParams[columnField] = apiRef.current.getCellParams(rowId, columnField);
|
|
191
|
+
columnsFieldsToFilter.push(columnField);
|
|
189
192
|
}
|
|
190
193
|
}); // Return `false` as soon as we have a quick filter value that does not match any column
|
|
191
194
|
|
|
192
195
|
if (quickFilterLogicOperator === GridLinkOperator.And) {
|
|
193
|
-
return sanitizedQuickFilterValues.every((value, index) =>
|
|
196
|
+
return sanitizedQuickFilterValues.every((value, index) => columnsFieldsToFilter.some(field => {
|
|
194
197
|
if (appliersPerColumnField[field][index] == null) {
|
|
195
198
|
return false;
|
|
196
199
|
}
|
|
@@ -200,7 +203,7 @@ export const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
|
200
203
|
} // Return `true` as soon as we have have a quick filter value that match any column
|
|
201
204
|
|
|
202
205
|
|
|
203
|
-
return sanitizedQuickFilterValues.some((value, index) =>
|
|
206
|
+
return sanitizedQuickFilterValues.some((value, index) => columnsFieldsToFilter.some(field => {
|
|
204
207
|
if (appliersPerColumnField[field][index] == null) {
|
|
205
208
|
return false;
|
|
206
209
|
}
|
|
@@ -109,7 +109,23 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
109
109
|
|
|
110
110
|
if (targetColumnField) {
|
|
111
111
|
const filterModel = gridFilterModelSelector(apiRef);
|
|
112
|
-
const filterItemsWithValue = filterModel.items.filter(item =>
|
|
112
|
+
const filterItemsWithValue = filterModel.items.filter(item => {
|
|
113
|
+
if (item.value !== undefined) {
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const column = apiRef.current.getColumn(item.columnField);
|
|
118
|
+
const filterOperator = column.filterOperators?.find(operator => operator.value === item.operatorValue);
|
|
119
|
+
const requiresFilterValue = typeof filterOperator?.requiresFilterValue === 'undefined' ? true : filterOperator?.requiresFilterValue; // Operators like `isEmpty` don't have and don't require `item.value`.
|
|
120
|
+
// So we don't want to remove them from the filter model if `item.value === undefined`.
|
|
121
|
+
// See https://github.com/mui/mui-x/issues/5402
|
|
122
|
+
|
|
123
|
+
if (requiresFilterValue) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return true;
|
|
128
|
+
});
|
|
113
129
|
let newFilterItems;
|
|
114
130
|
const filterItemOnTarget = filterItemsWithValue.find(item => item.columnField === targetColumnField);
|
|
115
131
|
|
|
@@ -93,7 +93,7 @@ export const useGridRows = (apiRef, props) => {
|
|
|
93
93
|
const updateRows = React.useCallback(updates => {
|
|
94
94
|
if (props.signature === GridSignature.DataGrid && updates.length > 1) {
|
|
95
95
|
// TODO: Add test with direct call to `apiRef.current.updateRows` in DataGrid after enabling the `apiRef` on the free plan.
|
|
96
|
-
throw new Error(["MUI: You can't update several rows at once in `apiRef.current.updateRows` on the DataGrid.", 'You need to upgrade to
|
|
96
|
+
throw new Error(["MUI: You can't update several rows at once in `apiRef.current.updateRows` on the DataGrid.", 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
|
|
97
97
|
} // we remove duplicate updates. A server can batch updates, and send several updates for the same row in one fn call.
|
|
98
98
|
|
|
99
99
|
|
|
@@ -315,10 +315,23 @@ export const useGridRows = (apiRef, props) => {
|
|
|
315
315
|
if (isFirstRender.current) {
|
|
316
316
|
isFirstRender.current = false;
|
|
317
317
|
return;
|
|
318
|
-
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
const areNewRowsAlreadyInState = apiRef.current.unstable_caches.rows.rowsBeforePartialUpdates === props.rows;
|
|
321
|
+
const isNewLoadingAlreadyInState = apiRef.current.unstable_caches.rows.loadingPropBeforePartialUpdates === props.loading; // The new rows have already been applied (most likely in the `'rowGroupsPreProcessingChange'` listener)
|
|
319
322
|
|
|
323
|
+
if (areNewRowsAlreadyInState) {
|
|
324
|
+
// If the loading prop has changed, we need to update its value in the state because it won't be done by `throttledRowsChange`
|
|
325
|
+
if (!isNewLoadingAlreadyInState) {
|
|
326
|
+
apiRef.current.setState(state => _extends({}, state, {
|
|
327
|
+
rows: _extends({}, state.rows, {
|
|
328
|
+
loading: props.loading
|
|
329
|
+
})
|
|
330
|
+
}));
|
|
331
|
+
apiRef.current.unstable_caches.rows.loadingPropBeforePartialUpdates = props.loading;
|
|
332
|
+
apiRef.current.forceUpdate();
|
|
333
|
+
}
|
|
320
334
|
|
|
321
|
-
if (apiRef.current.unstable_caches.rows.rowsBeforePartialUpdates === props.rows && apiRef.current.unstable_caches.rows.loadingPropBeforePartialUpdates === props.loading) {
|
|
322
335
|
return;
|
|
323
336
|
}
|
|
324
337
|
|
|
@@ -11,7 +11,7 @@ const flatRowTreeCreationMethod = ({
|
|
|
11
11
|
for (let i = 0; i < ids.length; i += 1) {
|
|
12
12
|
const rowId = ids[i];
|
|
13
13
|
|
|
14
|
-
if (previousTree && previousTree[rowId]) {
|
|
14
|
+
if (previousTree && previousTree[rowId] && previousTree[rowId].depth === 0 && previousTree[rowId].parent == null) {
|
|
15
15
|
tree[rowId] = previousTree[rowId];
|
|
16
16
|
} else {
|
|
17
17
|
tree[rowId] = {
|
|
@@ -86,8 +86,15 @@ export const useGridVirtualScroller = props => {
|
|
|
86
86
|
const [containerWidth, setContainerWidth] = React.useState(null);
|
|
87
87
|
const prevTotalWidth = React.useRef(columnsTotalWidth);
|
|
88
88
|
const getNearestIndexToRender = React.useCallback(offset => {
|
|
89
|
-
const
|
|
90
|
-
const
|
|
89
|
+
const lastMeasuredIndexRelativeToAllRows = apiRef.current.unstable_getLastMeasuredRowIndex();
|
|
90
|
+
const lastMeasuredIndexRelativeToCurrentPage = lastMeasuredIndexRelativeToAllRows - (currentPage.range?.firstRowIndex || 0);
|
|
91
|
+
const lastMeasuredIndex = Math.max(0, lastMeasuredIndexRelativeToCurrentPage);
|
|
92
|
+
let allRowsMeasured = lastMeasuredIndex === Infinity;
|
|
93
|
+
|
|
94
|
+
if (currentPage.range?.lastRowIndex && !allRowsMeasured) {
|
|
95
|
+
// Check if all rows in this page are already measured
|
|
96
|
+
allRowsMeasured = lastMeasuredIndex >= currentPage.range.lastRowIndex;
|
|
97
|
+
}
|
|
91
98
|
|
|
92
99
|
if (allRowsMeasured || rowsMeta.positions[lastMeasuredIndex] >= offset) {
|
|
93
100
|
// If all rows were measured (when no row has "auto" as height) or all rows before the offset
|
|
@@ -100,7 +107,7 @@ export const useGridVirtualScroller = props => {
|
|
|
100
107
|
|
|
101
108
|
|
|
102
109
|
return exponentialSearch(offset, rowsMeta.positions, lastMeasuredIndex);
|
|
103
|
-
}, [apiRef, rowsMeta.positions]);
|
|
110
|
+
}, [apiRef, currentPage.range?.firstRowIndex, currentPage.range?.lastRowIndex, rowsMeta.positions]);
|
|
104
111
|
const computeRenderContext = React.useCallback(() => {
|
|
105
112
|
if (disableVirtualization) {
|
|
106
113
|
return {
|
|
@@ -4,7 +4,7 @@ export function useGridApiContext() {
|
|
|
4
4
|
const apiRef = React.useContext(GridApiContext);
|
|
5
5
|
|
|
6
6
|
if (apiRef === undefined) {
|
|
7
|
-
throw new Error(['MUI: Could not find the data grid context.', 'It looks like you rendered your component outside of a DataGrid or
|
|
7
|
+
throw new Error(['MUI: Could not find the data grid context.', 'It looks like you rendered your component outside of a DataGrid, DataGridPro or DataGridPremium parent component.', 'This can also happen if you are bundling multiple versions of the data grid.'].join('\n'));
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
return apiRef;
|
|
@@ -4,7 +4,7 @@ export const useGridRootProps = () => {
|
|
|
4
4
|
const contextValue = React.useContext(GridRootPropsContext);
|
|
5
5
|
|
|
6
6
|
if (!contextValue) {
|
|
7
|
-
throw new Error('MUI: useGridRootProps should only be used inside the DataGrid
|
|
7
|
+
throw new Error('MUI: useGridRootProps should only be used inside the DataGrid, DataGridPro or DataGridPremium component.');
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
return contextValue;
|
package/modern/index.js
CHANGED
package/modern/locales/deDE.js
CHANGED
|
@@ -21,9 +21,9 @@ const deDEGrid = {
|
|
|
21
21
|
toolbarFiltersTooltipShow: 'Zeige Filter',
|
|
22
22
|
toolbarFiltersTooltipActive: count => count !== 1 ? `${count} aktive Filter` : `${count} aktiver Filter`,
|
|
23
23
|
// Quick filter toolbar field
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
toolbarQuickFilterPlaceholder: 'Suchen...',
|
|
25
|
+
toolbarQuickFilterLabel: 'Suchen',
|
|
26
|
+
toolbarQuickFilterDeleteIconLabel: 'Löschen',
|
|
27
27
|
// Export selector toolbar button text
|
|
28
28
|
toolbarExport: 'Exportieren',
|
|
29
29
|
toolbarExportLabel: 'Exportieren',
|
|
@@ -107,7 +107,7 @@ const deDEGrid = {
|
|
|
107
107
|
groupColumn: name => `Gruppieren nach ${name}`,
|
|
108
108
|
unGroupColumn: name => `Gruppierung nach ${name} aufheben`,
|
|
109
109
|
// Master/detail
|
|
110
|
-
|
|
110
|
+
detailPanelToggle: 'Detailansicht Kippschalter',
|
|
111
111
|
expandDetailPanel: 'Aufklappen',
|
|
112
112
|
collapseDetailPanel: 'Zuklappen',
|
|
113
113
|
// Row reordering text
|
package/modern/locales/frFR.js
CHANGED
|
@@ -29,7 +29,7 @@ const frFRGrid = {
|
|
|
29
29
|
toolbarExportLabel: 'Exporter',
|
|
30
30
|
toolbarExportCSV: 'Télécharger en CSV',
|
|
31
31
|
toolbarExportPrint: 'Imprimer',
|
|
32
|
-
|
|
32
|
+
toolbarExportExcel: 'Télécharger pour Excel',
|
|
33
33
|
// Columns panel text
|
|
34
34
|
columnsPanelTextFieldLabel: 'Chercher colonne',
|
|
35
35
|
columnsPanelTextFieldPlaceholder: 'Titre de la colonne',
|
|
@@ -85,10 +85,10 @@ const frFRGrid = {
|
|
|
85
85
|
footerTotalVisibleRows: (visibleCount, totalCount) => `${visibleCount.toLocaleString()} sur ${totalCount.toLocaleString()}`,
|
|
86
86
|
// Checkbox selection text
|
|
87
87
|
checkboxSelectionHeaderName: 'Sélection',
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
checkboxSelectionSelectAllRows: 'Sélectionner toutes les lignes',
|
|
89
|
+
checkboxSelectionUnselectAllRows: 'Désélectionner toutes les lignes',
|
|
90
|
+
checkboxSelectionSelectRow: 'Sélectionner la ligne',
|
|
91
|
+
checkboxSelectionUnselectRow: 'Désélectionner la ligne',
|
|
92
92
|
// Boolean cell text
|
|
93
93
|
booleanCellTrueLabel: 'vrai',
|
|
94
94
|
booleanCellFalseLabel: 'faux',
|
|
@@ -105,12 +105,12 @@ const frFRGrid = {
|
|
|
105
105
|
// Grouping columns
|
|
106
106
|
groupingColumnHeaderName: 'Groupe',
|
|
107
107
|
groupColumn: name => `Grouper par ${name}`,
|
|
108
|
-
unGroupColumn: name => `Arrêter de grouper par ${name}
|
|
109
|
-
//
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
unGroupColumn: name => `Arrêter de grouper par ${name}`,
|
|
109
|
+
// Master/detail
|
|
110
|
+
detailPanelToggle: 'Afficher/masquer les détails',
|
|
111
|
+
expandDetailPanel: 'Afficher',
|
|
112
|
+
collapseDetailPanel: 'Masquer',
|
|
112
113
|
// Row reordering text
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
rowReorderingHeaderName: 'Positionnement des lignes'
|
|
115
115
|
};
|
|
116
116
|
export const frFR = getGridLocalization(frFRGrid, frFRCore);
|
package/modern/locales/index.js
CHANGED
|
@@ -15,11 +15,14 @@ export * from './huHU';
|
|
|
15
15
|
export * from './itIT';
|
|
16
16
|
export * from './jaJP';
|
|
17
17
|
export * from './koKR';
|
|
18
|
+
export * from './nbNO';
|
|
18
19
|
export * from './nlNL';
|
|
19
20
|
export * from './plPL';
|
|
20
21
|
export * from './ptBR';
|
|
22
|
+
export * from './roRO';
|
|
21
23
|
export * from './ruRU';
|
|
22
24
|
export * from './skSK';
|
|
25
|
+
export * from './svSE';
|
|
23
26
|
export * from './trTR';
|
|
24
27
|
export * from './ukUA';
|
|
25
28
|
export * from './viVN';
|