@mui/x-data-grid 5.12.2 → 5.12.3
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 +57 -6
- 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/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +3 -2
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +12 -5
- package/hooks/features/filter/gridFilterUtils.js +8 -5
- package/hooks/features/rows/useGridRows.js +15 -2
- package/index.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/GridFilterInputMultipleSingleSelect.js +12 -5
- package/legacy/hooks/features/filter/gridFilterUtils.js +8 -5
- package/legacy/hooks/features/rows/useGridRows.js +17 -2
- package/legacy/index.js +1 -1
- package/legacy/locales/index.js +1 -0
- package/legacy/locales/svSE.js +128 -0
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/locales/svSE.d.ts +2 -0
- package/locales/svSE.js +116 -0
- 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/GridFilterInputMultipleSingleSelect.js +12 -5
- package/modern/hooks/features/filter/gridFilterUtils.js +8 -5
- package/modern/hooks/features/rows/useGridRows.js +15 -2
- package/modern/index.js +1 -1
- package/modern/locales/index.js +1 -0
- package/modern/locales/svSE.js +116 -0
- 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/GridFilterInputMultipleSingleSelect.js +12 -5
- package/node/hooks/features/filter/gridFilterUtils.js +7 -4
- package/node/hooks/features/rows/useGridRows.js +15 -2
- package/node/index.js +1 -1
- package/node/locales/index.js +13 -0
- package/node/locales/svSE.js +126 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,57 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## v5.12.3
|
|
7
|
+
|
|
8
|
+
_Jun 23, 2022_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 8 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🌍 Add Swedish (sv-SE) locale on the data grid and the pickers (#5210) @mrxdst
|
|
13
|
+
- 🌍 Add Dutch (nl-NL) locale on the pickers (#5237) @DDukers
|
|
14
|
+
- 📚 Documentation improvements
|
|
15
|
+
- 🐞 Bugfixes
|
|
16
|
+
|
|
17
|
+
### `@mui/x-data-grid@v5.12.3` / `@mui/x-data-grid-pro@v5.12.3` / `@mui/x-data-grid-premium@v5.12.3`
|
|
18
|
+
|
|
19
|
+
#### Changes
|
|
20
|
+
|
|
21
|
+
- [DataGrid] Do not hide non-hideable column when pressing Hide All button (#5298) @flaviendelangle
|
|
22
|
+
- [DataGrid] Do not regenerate the row tree when the `loading` prop changes (#5213) @flaviendelangle
|
|
23
|
+
- [DataGrid] Fix the default filter operator fallback on state initialization (#5266) @flaviendelangle
|
|
24
|
+
- [DataGrid] Stop using the deprecated `api` prop in the grid components (#5205) @flaviendelangle
|
|
25
|
+
- [DataGrid] Add Swedish (sv-SE) locale (#5210) @mrxdst
|
|
26
|
+
- [DataGridPremium] Fix detail panel on `DataGridPremium` (#5264) @flaviendelangle
|
|
27
|
+
- [DataGridPremium] Fix Excel import with Remix / Vite (#5207) @alexfauquette
|
|
28
|
+
- [DataGridPremium] Fix error with quick filter and grouping rows (#5238) @alexfauquette
|
|
29
|
+
|
|
30
|
+
### `@mui/x-date-pickers@v5.0.0-alpha.7` / `@mui/x-date-pickers-pro@v5.0.0-alpha.7`
|
|
31
|
+
|
|
32
|
+
#### Changes
|
|
33
|
+
|
|
34
|
+
- [pickers] Export adapters from both `@mui/x-date-pickers` and `@mui/x-date-pickers-pro` (#5204) @flaviendelangle
|
|
35
|
+
- [pickers] Add Dutch (nl-NL) locale (#5237) @DDukers
|
|
36
|
+
|
|
37
|
+
### Docs
|
|
38
|
+
|
|
39
|
+
- [docs] Add `DataGridPremium` to all API sections (#5196) @flaviendelangle
|
|
40
|
+
- [docs] Add plan badge next to event name in the Events page (#5200) @flaviendelangle
|
|
41
|
+
- [docs] Add section for theme augmentation in the picker docs (#5276) @flaviendelangle
|
|
42
|
+
- [docs] Add waiting for upvote section for row group panel (#5271) @flaviendelangle
|
|
43
|
+
- [docs] Disable ad on main demo page (#5301) @joserodolfofreitas
|
|
44
|
+
- [docs] Fix typo in the `DateRangePicker` documentation (#5259) @flaviendelangle
|
|
45
|
+
|
|
46
|
+
### Core
|
|
47
|
+
|
|
48
|
+
- [core] Allow having multiple playgrounds (#5288) @alexfauquette
|
|
49
|
+
- [core] Improve typing of `GridFilterInputMultipleSingleSelect` (#5206) @flaviendelangle
|
|
50
|
+
- [core] Remove arbitrary new lines (#5245) @oliviertassinari
|
|
51
|
+
- [core] Remove dead logic (#5282) @oliviertassinari
|
|
52
|
+
- [test] Fix `inputFormat` when testing with different date adapters (#5291) @cherniavskii
|
|
53
|
+
- [test] Fix date assertion in Safari 13 (#5221) @m4theushw
|
|
54
|
+
- [test] Throw if date adapter is not found (#5289) @cherniavskii
|
|
55
|
+
- [test] Use mock for `ResizeObserver` (#5215) @m4theushw
|
|
56
|
+
|
|
6
57
|
## v5.12.2
|
|
7
58
|
|
|
8
59
|
_Jun 16, 2022_
|
|
@@ -71,7 +122,7 @@ We'd like to offer a big thanks to the 10 contributors who made this release pos
|
|
|
71
122
|
- [l10n] Update Japanese (ja-JP) locale (#5122) @hikotq
|
|
72
123
|
- [l10n] Update Russian (ru-RU) locale (#5069) @Artboomy
|
|
73
124
|
|
|
74
|
-
### `@mui/x-date-pickers@
|
|
125
|
+
### `@mui/x-date-pickers@v5.0.0-alpha.6` / `@mui/x-date-pickers-pro@v5.0.0-alpha.6`
|
|
75
126
|
|
|
76
127
|
#### Changes
|
|
77
128
|
|
|
@@ -138,7 +189,7 @@ We'd like to offer a big thanks to the 15 contributors who made this release pos
|
|
|
138
189
|
- [l10n] Add Norwegian (Bokmål) (nb-NO) locale (#5001) @spiftire
|
|
139
190
|
- [l10n] Add Turkish (tr-TR) locale (#5026) @Rassilion
|
|
140
191
|
|
|
141
|
-
### `@mui/x-date-pickers@
|
|
192
|
+
### `@mui/x-date-pickers@v5.0.0-alpha.5` / `@mui/x-date-pickers-pro@v5.0.0-alpha.5`
|
|
142
193
|
|
|
143
194
|
#### Breaking changes
|
|
144
195
|
|
|
@@ -211,7 +262,7 @@ We'd like to offer a big thanks to the 6 contributors who made this release poss
|
|
|
211
262
|
- [DataGridPremium] Support column spanning in the Excel export (#4830) @cherniavskii
|
|
212
263
|
- [l10n] Improve Russian (ru-RU) locale (#4864) @arvkonstantin
|
|
213
264
|
|
|
214
|
-
### `@mui/x-date-pickers@
|
|
265
|
+
### `@mui/x-date-pickers@v5.0.0-alpha.4` / `@mui/x-date-pickers-pro@v5.0.0-alpha.4`
|
|
215
266
|
|
|
216
267
|
#### Breaking changes
|
|
217
268
|
|
|
@@ -336,7 +387,7 @@ We'd like to offer a big thanks to the 15 contributors who made this release pos
|
|
|
336
387
|
- [l10n] Improve German (de-DE) locale (#4748) @sebastianfrey
|
|
337
388
|
- [l10n] Improve German (de-DE) locale (#4668) @izu-co
|
|
338
389
|
|
|
339
|
-
### `@mui/x-date-pickers@
|
|
390
|
+
### `@mui/x-date-pickers@v5.0.0-alpha.3` / `@mui/x-date-pickers-pro@v5.0.0-alpha.3`
|
|
340
391
|
|
|
341
392
|
#### Breaking changes
|
|
342
393
|
|
|
@@ -437,7 +488,7 @@ We'd like to offer a big thanks to the 6 contributors who made this release poss
|
|
|
437
488
|
- [DataGrid] Don't close column menu when updating rows (#4498) @m4theushw
|
|
438
489
|
- [DataGridPro] Introduce row reorder (#4034) @DanailH
|
|
439
490
|
|
|
440
|
-
### `@mui/x-date-pickers@
|
|
491
|
+
### `@mui/x-date-pickers@v5.0.0-alpha.2` / `@mui/x-date-pickers-pro@v5.0.0-alpha.2`
|
|
441
492
|
|
|
442
493
|
- [pickers] Pass `PaperProps` to `DesktopWrapper` component (#4584) @alexfauquette
|
|
443
494
|
- [TimePicker] Fix bug when time picker clear value (#4582) @alexfauquette
|
|
@@ -498,7 +549,7 @@ We'd like to offer a big thanks to the 9 contributors who made this release poss
|
|
|
498
549
|
- [DataGridPro] Fix toggling detail panel using keyboard (#4409) @cherniavskii
|
|
499
550
|
- [l10n] Add Hungarian (hu-HU) locale (#4458) @x22tri
|
|
500
551
|
|
|
501
|
-
### `@mui/x-date-pickers@
|
|
552
|
+
### `@mui/x-date-pickers@v5.0.0-alpha.1` / `@mui/x-date-pickers-pro@v5.0.0-alpha.1`
|
|
502
553
|
|
|
503
554
|
- [ClockPicker] Should call `shouldDisableTime` with the hours with meridiem (#4404) @flaviendelangle
|
|
504
555
|
- [MonthPicker] Clicking on a `PickersMonth` button should not trigger the form submit (#4402) @flaviendelangle
|
|
@@ -5,6 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
6
6
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
7
7
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
8
|
+
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
8
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
10
|
|
|
10
11
|
const useUtilityClasses = ownerState => {
|
|
@@ -19,11 +20,11 @@ const useUtilityClasses = ownerState => {
|
|
|
19
20
|
|
|
20
21
|
export const GridBooleanCell = /*#__PURE__*/React.memo(props => {
|
|
21
22
|
const {
|
|
22
|
-
value
|
|
23
|
-
api
|
|
23
|
+
value
|
|
24
24
|
} = props,
|
|
25
25
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
26
26
|
|
|
27
|
+
const apiRef = useGridApiContext();
|
|
27
28
|
const rootProps = useGridRootProps();
|
|
28
29
|
const ownerState = {
|
|
29
30
|
classes: rootProps.classes
|
|
@@ -33,7 +34,7 @@ export const GridBooleanCell = /*#__PURE__*/React.memo(props => {
|
|
|
33
34
|
return /*#__PURE__*/_jsx(Icon, _extends({
|
|
34
35
|
fontSize: "small",
|
|
35
36
|
className: classes.root,
|
|
36
|
-
titleAccess:
|
|
37
|
+
titleAccess: apiRef.current.getLocaleText(value ? 'booleanCellTrueLabel' : 'booleanCellFalseLabel'),
|
|
37
38
|
"data-value": Boolean(value)
|
|
38
39
|
}, other));
|
|
39
40
|
});
|
|
@@ -8,6 +8,7 @@ import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
|
8
8
|
import { unstable_useId as useId, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/material/utils';
|
|
9
9
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
10
10
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
11
|
+
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
|
|
13
14
|
const useUtilityClasses = ownerState => {
|
|
@@ -26,7 +27,6 @@ function GridEditBooleanCell(props) {
|
|
|
26
27
|
const {
|
|
27
28
|
id: idProp,
|
|
28
29
|
value,
|
|
29
|
-
api,
|
|
30
30
|
field,
|
|
31
31
|
className,
|
|
32
32
|
hasFocus,
|
|
@@ -34,6 +34,7 @@ function GridEditBooleanCell(props) {
|
|
|
34
34
|
} = props,
|
|
35
35
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
36
36
|
|
|
37
|
+
const apiRef = useGridApiContext();
|
|
37
38
|
const inputRef = React.useRef(null);
|
|
38
39
|
const id = useId();
|
|
39
40
|
const [valueState, setValueState] = React.useState(value);
|
|
@@ -50,12 +51,12 @@ function GridEditBooleanCell(props) {
|
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
setValueState(newValue);
|
|
53
|
-
await
|
|
54
|
+
await apiRef.current.setEditCellValue({
|
|
54
55
|
id: idProp,
|
|
55
56
|
field,
|
|
56
57
|
value: newValue
|
|
57
58
|
}, event);
|
|
58
|
-
}, [
|
|
59
|
+
}, [apiRef, field, idProp, onValueChange]);
|
|
59
60
|
React.useEffect(() => {
|
|
60
61
|
setValueState(value);
|
|
61
62
|
}, [value]);
|
|
@@ -8,6 +8,7 @@ import { unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/material/u
|
|
|
8
8
|
import InputBase from '@mui/material/InputBase';
|
|
9
9
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
10
10
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
11
|
+
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
|
|
13
14
|
const useUtilityClasses = ownerState => {
|
|
@@ -24,7 +25,6 @@ function GridEditDateCell(props) {
|
|
|
24
25
|
const {
|
|
25
26
|
id,
|
|
26
27
|
value: valueProp,
|
|
27
|
-
api,
|
|
28
28
|
field,
|
|
29
29
|
colDef,
|
|
30
30
|
hasFocus,
|
|
@@ -34,6 +34,7 @@ function GridEditDateCell(props) {
|
|
|
34
34
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
35
35
|
|
|
36
36
|
const isDateTime = colDef.type === 'dateTime';
|
|
37
|
+
const apiRef = useGridApiContext();
|
|
37
38
|
const inputRef = React.useRef();
|
|
38
39
|
const valueTransformed = React.useMemo(() => {
|
|
39
40
|
let parsedDate;
|
|
@@ -93,12 +94,12 @@ function GridEditDateCell(props) {
|
|
|
93
94
|
parsed: newParsedDate,
|
|
94
95
|
formatted: newFormattedDate
|
|
95
96
|
});
|
|
96
|
-
|
|
97
|
+
apiRef.current.setEditCellValue({
|
|
97
98
|
id,
|
|
98
99
|
field,
|
|
99
100
|
value: newParsedDate
|
|
100
101
|
}, event);
|
|
101
|
-
}, [
|
|
102
|
+
}, [apiRef, field, id, onValueChange]);
|
|
102
103
|
React.useEffect(() => {
|
|
103
104
|
setValueState(state => {
|
|
104
105
|
var _valueTransformed$par, _state$parsed;
|
|
@@ -11,6 +11,7 @@ import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
|
11
11
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
12
12
|
import { GridLoadIcon } from '../icons/index';
|
|
13
13
|
import { SUBMIT_FILTER_STROKE_TIME } from '../panel/filterPanel/GridFilterInputValue';
|
|
14
|
+
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
16
|
|
|
16
17
|
const useUtilityClasses = ownerState => {
|
|
@@ -45,7 +46,6 @@ function GridEditInputCell(props) {
|
|
|
45
46
|
const {
|
|
46
47
|
id,
|
|
47
48
|
value,
|
|
48
|
-
api,
|
|
49
49
|
field,
|
|
50
50
|
colDef,
|
|
51
51
|
hasFocus,
|
|
@@ -55,6 +55,7 @@ function GridEditInputCell(props) {
|
|
|
55
55
|
} = props,
|
|
56
56
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
57
57
|
|
|
58
|
+
const apiRef = useGridApiContext();
|
|
58
59
|
const inputRef = React.useRef();
|
|
59
60
|
const [valueState, setValueState] = React.useState(value);
|
|
60
61
|
const ownerState = {
|
|
@@ -69,13 +70,13 @@ function GridEditInputCell(props) {
|
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
setValueState(newValue);
|
|
72
|
-
|
|
73
|
+
apiRef.current.setEditCellValue({
|
|
73
74
|
id,
|
|
74
75
|
field,
|
|
75
76
|
value: newValue,
|
|
76
77
|
debounceMs
|
|
77
78
|
}, event);
|
|
78
|
-
}, [
|
|
79
|
+
}, [apiRef, debounceMs, field, id, onValueChange]);
|
|
79
80
|
React.useEffect(() => {
|
|
80
81
|
setValueState(value);
|
|
81
82
|
}, [value]);
|
|
@@ -9,6 +9,7 @@ import { isEscapeKey } from '../../utils/keyboardUtils';
|
|
|
9
9
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
10
10
|
import { GridEditModes } from '../../models/gridEditRowModel';
|
|
11
11
|
import { getValueFromValueOptions } from '../panel/filterPanel/filterPanelUtils';
|
|
12
|
+
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
14
|
|
|
14
15
|
const renderSingleSelectOptions = (option, OptionComponent) => {
|
|
@@ -38,6 +39,7 @@ function GridEditSingleSelectCell(props) {
|
|
|
38
39
|
} = props,
|
|
39
40
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
40
41
|
|
|
42
|
+
const apiRef = useGridApiContext();
|
|
41
43
|
const ref = React.useRef();
|
|
42
44
|
const inputRef = React.useRef();
|
|
43
45
|
const rootProps = useGridRootProps();
|
|
@@ -86,7 +88,7 @@ function GridEditSingleSelectCell(props) {
|
|
|
86
88
|
await onValueChange(event, formattedTargetValue);
|
|
87
89
|
}
|
|
88
90
|
|
|
89
|
-
const isValid = await
|
|
91
|
+
const isValid = await apiRef.current.setEditCellValue({
|
|
90
92
|
id,
|
|
91
93
|
field,
|
|
92
94
|
value: formattedTargetValue
|
|
@@ -101,18 +103,18 @@ function GridEditSingleSelectCell(props) {
|
|
|
101
103
|
return;
|
|
102
104
|
}
|
|
103
105
|
|
|
104
|
-
const canCommit = await Promise.resolve(
|
|
106
|
+
const canCommit = await Promise.resolve(apiRef.current.commitCellChange({
|
|
105
107
|
id,
|
|
106
108
|
field
|
|
107
109
|
}, event));
|
|
108
110
|
|
|
109
111
|
if (canCommit) {
|
|
110
|
-
|
|
112
|
+
apiRef.current.setCellMode(id, field, 'view');
|
|
111
113
|
|
|
112
114
|
if (event.key) {
|
|
113
115
|
// TODO v6: remove once we stop ignoring events fired from portals
|
|
114
|
-
const params =
|
|
115
|
-
|
|
116
|
+
const params = apiRef.current.getCellParams(id, field);
|
|
117
|
+
apiRef.current.publishEvent('cellNavigationKeyDown', params, event);
|
|
116
118
|
}
|
|
117
119
|
}
|
|
118
120
|
};
|
|
@@ -127,13 +129,13 @@ function GridEditSingleSelectCell(props) {
|
|
|
127
129
|
var _rootProps$experiment2;
|
|
128
130
|
|
|
129
131
|
if ((_rootProps$experiment2 = rootProps.experimentalFeatures) != null && _rootProps$experiment2.newEditingApi) {
|
|
130
|
-
|
|
132
|
+
apiRef.current.stopCellEditMode({
|
|
131
133
|
id,
|
|
132
134
|
field,
|
|
133
135
|
ignoreModifications: true
|
|
134
136
|
});
|
|
135
137
|
} else {
|
|
136
|
-
|
|
138
|
+
apiRef.current.setCellMode(id, field, 'view');
|
|
137
139
|
}
|
|
138
140
|
}
|
|
139
141
|
};
|
|
@@ -81,7 +81,7 @@ export function GridColumnsPanel(props) {
|
|
|
81
81
|
return apiRef.current.setColumnVisibilityModel({});
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
return apiRef.current.setColumnVisibilityModel(Object.fromEntries(columns.map(col => [col.field, false])));
|
|
84
|
+
return apiRef.current.setColumnVisibilityModel(Object.fromEntries(columns.filter(col => col.hideable !== false).map(col => [col.field, false])));
|
|
85
85
|
} // TODO v6: Remove
|
|
86
86
|
|
|
87
87
|
|
|
@@ -2,13 +2,14 @@ import * as React from 'react';
|
|
|
2
2
|
import { AutocompleteProps } from '@mui/material/Autocomplete';
|
|
3
3
|
import { GridFilterItem } from '../../../models/gridFilterItem';
|
|
4
4
|
import type { GridApiCommon } from '../../../models/api/gridApiCommon';
|
|
5
|
-
|
|
5
|
+
import type { ValueOptions } from '../../../models/colDef/gridColDef';
|
|
6
|
+
export interface GridFilterInputMultipleSingleSelectProps extends Omit<AutocompleteProps<ValueOptions, true, false, true>, 'options' | 'renderInput' | 'onChange' | 'value' | 'id' | 'filterOptions' | 'isOptionEqualToValue' | 'limitTags' | 'multiple'> {
|
|
6
7
|
item: GridFilterItem;
|
|
7
8
|
applyValue: (value: GridFilterItem) => void;
|
|
8
9
|
apiRef: React.MutableRefObject<GridApiCommon>;
|
|
9
10
|
focusElementRef?: React.Ref<any>;
|
|
10
11
|
type?: 'singleSelect';
|
|
11
|
-
}
|
|
12
|
+
}
|
|
12
13
|
declare function GridFilterInputMultipleSingleSelect(props: GridFilterInputMultipleSingleSelectProps): JSX.Element;
|
|
13
14
|
declare namespace GridFilterInputMultipleSingleSelect {
|
|
14
15
|
var propTypes: any;
|
|
@@ -26,9 +26,17 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
26
26
|
const id = useId();
|
|
27
27
|
const resolvedColumn = item.columnField ? apiRef.current.getColumn(item.columnField) : null;
|
|
28
28
|
const resolvedValueOptions = React.useMemo(() => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
29
|
+
if (!(resolvedColumn != null && resolvedColumn.valueOptions)) {
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (typeof resolvedColumn.valueOptions === 'function') {
|
|
34
|
+
return resolvedColumn.valueOptions({
|
|
35
|
+
field: resolvedColumn.field
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return resolvedColumn.valueOptions;
|
|
32
40
|
}, [resolvedColumn]);
|
|
33
41
|
const resolvedFormattedValueOptions = React.useMemo(() => {
|
|
34
42
|
return resolvedValueOptions == null ? void 0 : resolvedValueOptions.map(getValueFromOption);
|
|
@@ -85,8 +93,7 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
85
93
|
return /*#__PURE__*/_jsx(Autocomplete, _extends({
|
|
86
94
|
multiple: true,
|
|
87
95
|
limitTags: 1,
|
|
88
|
-
options: resolvedValueOptions
|
|
89
|
-
,
|
|
96
|
+
options: resolvedValueOptions,
|
|
90
97
|
isOptionEqualToValue: isOptionEqualToValue,
|
|
91
98
|
filterOptions: filter,
|
|
92
99
|
id: id,
|
|
@@ -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
|
|
|
@@ -185,14 +186,16 @@ export const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
|
185
186
|
const sanitizedQuickFilterValues = quickFilterValues.filter((value, index) => Object.keys(appliersPerColumnField).some(field => appliersPerColumnField[field][index] != null));
|
|
186
187
|
return (rowId, shouldApplyFilter) => {
|
|
187
188
|
const usedCellParams = {};
|
|
189
|
+
const columnsFieldsToFilter = [];
|
|
188
190
|
Object.keys(appliersPerColumnField).forEach(columnField => {
|
|
189
191
|
if (!shouldApplyFilter || shouldApplyFilter(columnField)) {
|
|
190
192
|
usedCellParams[columnField] = apiRef.current.getCellParams(rowId, columnField);
|
|
193
|
+
columnsFieldsToFilter.push(columnField);
|
|
191
194
|
}
|
|
192
195
|
}); // Return `false` as soon as we have a quick filter value that does not match any column
|
|
193
196
|
|
|
194
197
|
if (quickFilterLogicOperator === GridLinkOperator.And) {
|
|
195
|
-
return sanitizedQuickFilterValues.every((value, index) =>
|
|
198
|
+
return sanitizedQuickFilterValues.every((value, index) => columnsFieldsToFilter.some(field => {
|
|
196
199
|
var _appliersPerColumnFie, _appliersPerColumnFie2;
|
|
197
200
|
|
|
198
201
|
if (appliersPerColumnField[field][index] == null) {
|
|
@@ -204,7 +207,7 @@ export const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
|
204
207
|
} // Return `true` as soon as we have have a quick filter value that match any column
|
|
205
208
|
|
|
206
209
|
|
|
207
|
-
return sanitizedQuickFilterValues.some((value, index) =>
|
|
210
|
+
return sanitizedQuickFilterValues.some((value, index) => columnsFieldsToFilter.some(field => {
|
|
208
211
|
var _appliersPerColumnFie3, _appliersPerColumnFie4;
|
|
209
212
|
|
|
210
213
|
if (appliersPerColumnField[field][index] == null) {
|
|
@@ -323,10 +323,23 @@ export const useGridRows = (apiRef, props) => {
|
|
|
323
323
|
if (isFirstRender.current) {
|
|
324
324
|
isFirstRender.current = false;
|
|
325
325
|
return;
|
|
326
|
-
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
const areNewRowsAlreadyInState = apiRef.current.unstable_caches.rows.rowsBeforePartialUpdates === props.rows;
|
|
329
|
+
const isNewLoadingAlreadyInState = apiRef.current.unstable_caches.rows.loadingPropBeforePartialUpdates === props.loading; // The new rows have already been applied (most likely in the `'rowGroupsPreProcessingChange'` listener)
|
|
327
330
|
|
|
331
|
+
if (areNewRowsAlreadyInState) {
|
|
332
|
+
// If the loading prop has changed, we need to update its value in the state because it won't be done by `throttledRowsChange`
|
|
333
|
+
if (!isNewLoadingAlreadyInState) {
|
|
334
|
+
apiRef.current.setState(state => _extends({}, state, {
|
|
335
|
+
rows: _extends({}, state.rows, {
|
|
336
|
+
loading: props.loading
|
|
337
|
+
})
|
|
338
|
+
}));
|
|
339
|
+
apiRef.current.unstable_caches.rows.loadingPropBeforePartialUpdates = props.loading;
|
|
340
|
+
apiRef.current.forceUpdate();
|
|
341
|
+
}
|
|
328
342
|
|
|
329
|
-
if (apiRef.current.unstable_caches.rows.rowsBeforePartialUpdates === props.rows && apiRef.current.unstable_caches.rows.loadingPropBeforePartialUpdates === props.loading) {
|
|
330
343
|
return;
|
|
331
344
|
}
|
|
332
345
|
|
package/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
6
6
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
7
7
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
8
|
+
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
8
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
10
|
|
|
10
11
|
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
@@ -31,6 +32,7 @@ export var GridBooleanCell = /*#__PURE__*/React.memo(function (props) {
|
|
|
31
32
|
getValue = props.getValue,
|
|
32
33
|
other = _objectWithoutProperties(props, _excluded);
|
|
33
34
|
|
|
35
|
+
var apiRef = useGridApiContext();
|
|
34
36
|
var rootProps = useGridRootProps();
|
|
35
37
|
var ownerState = {
|
|
36
38
|
classes: rootProps.classes
|
|
@@ -42,7 +44,7 @@ export var GridBooleanCell = /*#__PURE__*/React.memo(function (props) {
|
|
|
42
44
|
return /*#__PURE__*/_jsx(Icon, _extends({
|
|
43
45
|
fontSize: "small",
|
|
44
46
|
className: classes.root,
|
|
45
|
-
titleAccess:
|
|
47
|
+
titleAccess: apiRef.current.getLocaleText(value ? 'booleanCellTrueLabel' : 'booleanCellFalseLabel'),
|
|
46
48
|
"data-value": Boolean(value)
|
|
47
49
|
}, other));
|
|
48
50
|
});
|
|
@@ -11,6 +11,7 @@ import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
|
11
11
|
import { unstable_useId as useId, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/material/utils';
|
|
12
12
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
13
13
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
14
|
+
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
16
|
|
|
16
17
|
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
@@ -44,6 +45,7 @@ function GridEditBooleanCell(props) {
|
|
|
44
45
|
onValueChange = props.onValueChange,
|
|
45
46
|
other = _objectWithoutProperties(props, _excluded);
|
|
46
47
|
|
|
48
|
+
var apiRef = useGridApiContext();
|
|
47
49
|
var inputRef = React.useRef(null);
|
|
48
50
|
var id = useId();
|
|
49
51
|
|
|
@@ -77,7 +79,7 @@ function GridEditBooleanCell(props) {
|
|
|
77
79
|
case 4:
|
|
78
80
|
setValueState(newValue);
|
|
79
81
|
_context.next = 7;
|
|
80
|
-
return
|
|
82
|
+
return apiRef.current.setEditCellValue({
|
|
81
83
|
id: idProp,
|
|
82
84
|
field: field,
|
|
83
85
|
value: newValue
|
|
@@ -94,7 +96,7 @@ function GridEditBooleanCell(props) {
|
|
|
94
96
|
return function (_x) {
|
|
95
97
|
return _ref.apply(this, arguments);
|
|
96
98
|
};
|
|
97
|
-
}(), [
|
|
99
|
+
}(), [apiRef, field, idProp, onValueChange]);
|
|
98
100
|
React.useEffect(function () {
|
|
99
101
|
setValueState(value);
|
|
100
102
|
}, [value]);
|
|
@@ -11,6 +11,7 @@ import { unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/material/u
|
|
|
11
11
|
import InputBase from '@mui/material/InputBase';
|
|
12
12
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
13
13
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
14
|
+
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
16
|
|
|
16
17
|
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
@@ -42,6 +43,7 @@ function GridEditDateCell(props) {
|
|
|
42
43
|
other = _objectWithoutProperties(props, _excluded);
|
|
43
44
|
|
|
44
45
|
var isDateTime = colDef.type === 'dateTime';
|
|
46
|
+
var apiRef = useGridApiContext();
|
|
45
47
|
var inputRef = React.useRef();
|
|
46
48
|
var valueTransformed = React.useMemo(function () {
|
|
47
49
|
var parsedDate;
|
|
@@ -117,7 +119,7 @@ function GridEditDateCell(props) {
|
|
|
117
119
|
parsed: newParsedDate,
|
|
118
120
|
formatted: newFormattedDate
|
|
119
121
|
});
|
|
120
|
-
|
|
122
|
+
apiRef.current.setEditCellValue({
|
|
121
123
|
id: id,
|
|
122
124
|
field: field,
|
|
123
125
|
value: newParsedDate
|
|
@@ -134,7 +136,7 @@ function GridEditDateCell(props) {
|
|
|
134
136
|
return function (_x) {
|
|
135
137
|
return _ref.apply(this, arguments);
|
|
136
138
|
};
|
|
137
|
-
}(), [
|
|
139
|
+
}(), [apiRef, field, id, onValueChange]);
|
|
138
140
|
React.useEffect(function () {
|
|
139
141
|
setValueState(function (state) {
|
|
140
142
|
var _valueTransformed$par, _state$parsed;
|
|
@@ -14,6 +14,7 @@ import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
|
14
14
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
15
15
|
import { GridLoadIcon } from '../icons/index';
|
|
16
16
|
import { SUBMIT_FILTER_STROKE_TIME } from '../panel/filterPanel/GridFilterInputValue';
|
|
17
|
+
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
17
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
19
|
|
|
19
20
|
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
@@ -66,6 +67,7 @@ function GridEditInputCell(props) {
|
|
|
66
67
|
onValueChange = props.onValueChange,
|
|
67
68
|
other = _objectWithoutProperties(props, _excluded);
|
|
68
69
|
|
|
70
|
+
var apiRef = useGridApiContext();
|
|
69
71
|
var inputRef = React.useRef();
|
|
70
72
|
|
|
71
73
|
var _React$useState = React.useState(value),
|
|
@@ -96,7 +98,7 @@ function GridEditInputCell(props) {
|
|
|
96
98
|
|
|
97
99
|
case 4:
|
|
98
100
|
setValueState(newValue);
|
|
99
|
-
|
|
101
|
+
apiRef.current.setEditCellValue({
|
|
100
102
|
id: id,
|
|
101
103
|
field: field,
|
|
102
104
|
value: newValue,
|
|
@@ -114,7 +116,7 @@ function GridEditInputCell(props) {
|
|
|
114
116
|
return function (_x) {
|
|
115
117
|
return _ref2.apply(this, arguments);
|
|
116
118
|
};
|
|
117
|
-
}(), [
|
|
119
|
+
}(), [apiRef, debounceMs, field, id, onValueChange]);
|
|
118
120
|
React.useEffect(function () {
|
|
119
121
|
setValueState(value);
|
|
120
122
|
}, [value]);
|
|
@@ -13,6 +13,7 @@ import { isEscapeKey } from '../../utils/keyboardUtils';
|
|
|
13
13
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
14
14
|
import { GridEditModes } from '../../models/gridEditRowModel';
|
|
15
15
|
import { getValueFromValueOptions } from '../panel/filterPanel/filterPanelUtils';
|
|
16
|
+
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
16
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
18
|
|
|
18
19
|
var renderSingleSelectOptions = function renderSingleSelectOptions(option, OptionComponent) {
|
|
@@ -49,6 +50,7 @@ function GridEditSingleSelectCell(props) {
|
|
|
49
50
|
onValueChange = props.onValueChange,
|
|
50
51
|
other = _objectWithoutProperties(props, _excluded);
|
|
51
52
|
|
|
53
|
+
var apiRef = useGridApiContext();
|
|
52
54
|
var ref = React.useRef();
|
|
53
55
|
var inputRef = React.useRef();
|
|
54
56
|
var rootProps = useGridRootProps();
|
|
@@ -114,7 +116,7 @@ function GridEditSingleSelectCell(props) {
|
|
|
114
116
|
|
|
115
117
|
case 6:
|
|
116
118
|
_context.next = 8;
|
|
117
|
-
return
|
|
119
|
+
return apiRef.current.setEditCellValue({
|
|
118
120
|
id: id,
|
|
119
121
|
field: field,
|
|
120
122
|
value: formattedTargetValue
|
|
@@ -140,7 +142,7 @@ function GridEditSingleSelectCell(props) {
|
|
|
140
142
|
|
|
141
143
|
case 13:
|
|
142
144
|
_context.next = 15;
|
|
143
|
-
return Promise.resolve(
|
|
145
|
+
return Promise.resolve(apiRef.current.commitCellChange({
|
|
144
146
|
id: id,
|
|
145
147
|
field: field
|
|
146
148
|
}, event));
|
|
@@ -149,12 +151,12 @@ function GridEditSingleSelectCell(props) {
|
|
|
149
151
|
canCommit = _context.sent;
|
|
150
152
|
|
|
151
153
|
if (canCommit) {
|
|
152
|
-
|
|
154
|
+
apiRef.current.setCellMode(id, field, 'view');
|
|
153
155
|
|
|
154
156
|
if (event.key) {
|
|
155
157
|
// TODO v6: remove once we stop ignoring events fired from portals
|
|
156
|
-
params =
|
|
157
|
-
|
|
158
|
+
params = apiRef.current.getCellParams(id, field);
|
|
159
|
+
apiRef.current.publishEvent('cellNavigationKeyDown', params, event);
|
|
158
160
|
}
|
|
159
161
|
}
|
|
160
162
|
|
|
@@ -181,13 +183,13 @@ function GridEditSingleSelectCell(props) {
|
|
|
181
183
|
var _rootProps$experiment2;
|
|
182
184
|
|
|
183
185
|
if ((_rootProps$experiment2 = rootProps.experimentalFeatures) != null && _rootProps$experiment2.newEditingApi) {
|
|
184
|
-
|
|
186
|
+
apiRef.current.stopCellEditMode({
|
|
185
187
|
id: id,
|
|
186
188
|
field: field,
|
|
187
189
|
ignoreModifications: true
|
|
188
190
|
});
|
|
189
191
|
} else {
|
|
190
|
-
|
|
192
|
+
apiRef.current.setCellMode(id, field, 'view');
|
|
191
193
|
}
|
|
192
194
|
}
|
|
193
195
|
};
|