@mui/x-data-grid 6.0.0 → 6.0.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 +45 -7
- package/DataGrid/DataGrid.js +6 -6
- package/components/cell/GridEditSingleSelectCell.js +10 -4
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -1
- package/constants/gridClasses.d.ts +1 -1
- package/hooks/features/columnGrouping/gridColumnGroupsUtils.js +5 -5
- package/hooks/features/columnMenu/columnMenuInterfaces.d.ts +2 -2
- package/hooks/features/editing/useGridCellEditing.js +1 -1
- package/hooks/features/editing/useGridEditing.js +1 -1
- package/hooks/features/editing/useGridRowEditing.js +1 -1
- package/hooks/features/export/useGridPrintExport.js +10 -11
- package/index.js +1 -1
- package/legacy/DataGrid/DataGrid.js +6 -6
- package/legacy/components/cell/GridEditSingleSelectCell.js +10 -6
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +2 -2
- package/legacy/hooks/features/columnGrouping/gridColumnGroupsUtils.js +5 -5
- package/legacy/hooks/features/editing/useGridCellEditing.js +1 -1
- package/legacy/hooks/features/editing/useGridEditing.js +1 -1
- package/legacy/hooks/features/editing/useGridRowEditing.js +1 -1
- package/legacy/hooks/features/export/useGridPrintExport.js +10 -11
- package/legacy/index.js +1 -1
- package/models/api/gridEditingApi.d.ts +1 -1
- package/models/gridSlotsComponentsProps.d.ts +1 -1
- package/models/props/DataGridProps.d.ts +6 -6
- package/modern/DataGrid/DataGrid.js +6 -6
- package/modern/components/cell/GridEditSingleSelectCell.js +10 -4
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -1
- package/modern/hooks/features/columnGrouping/gridColumnGroupsUtils.js +5 -5
- package/modern/hooks/features/editing/useGridCellEditing.js +1 -1
- package/modern/hooks/features/editing/useGridEditing.js +1 -1
- package/modern/hooks/features/editing/useGridRowEditing.js +1 -1
- package/modern/hooks/features/export/useGridPrintExport.js +10 -11
- package/modern/index.js +1 -1
- package/node/DataGrid/DataGrid.js +6 -6
- package/node/components/cell/GridEditSingleSelectCell.js +10 -4
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -1
- package/node/hooks/features/columnGrouping/gridColumnGroupsUtils.js +5 -5
- package/node/hooks/features/editing/useGridCellEditing.js +1 -1
- package/node/hooks/features/editing/useGridEditing.js +1 -1
- package/node/hooks/features/editing/useGridRowEditing.js +1 -1
- package/node/hooks/features/export/useGridPrintExport.js +10 -11
- package/node/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,44 @@
|
|
|
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
|
+
## 6.0.1
|
|
7
|
+
|
|
8
|
+
_Mar 9, 2023_
|
|
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
|
+
- 🌍 Improve French (fr-FR) locale (#8122) @MaherSamiGMC
|
|
13
|
+
- 📚 Documentation improvements
|
|
14
|
+
- 🐞 Bugfixes
|
|
15
|
+
|
|
16
|
+
### `@mui/x-data-grid@v6.0.1` / `@mui/x-data-grid-pro@v6.0.1` / `@mui/x-data-grid-premium@v6.0.1`
|
|
17
|
+
|
|
18
|
+
#### Changes
|
|
19
|
+
|
|
20
|
+
- [DataGrid] Fix `MenuProps.onClose` being overridden for single select edit component (#8174) @rohitnatesh
|
|
21
|
+
- [DataGrid] Simplify `buildPrintWindow` (#8142) @oliviertassinari
|
|
22
|
+
- [l10n] Improve French (fr-FR) locale (#8122) @MaherSamiGMC
|
|
23
|
+
|
|
24
|
+
### `@mui/x-date-pickers@v6.0.1` / `@mui/x-date-pickers-pro@v6.0.1`
|
|
25
|
+
|
|
26
|
+
#### Changes
|
|
27
|
+
|
|
28
|
+
- [pickers] Add a runtime warning when a `renderInput` prop is passed to a picker (#8183) @flaviendelangle
|
|
29
|
+
- [pickers] Don't pass `ownerState` to the `inputAdornment` slot (#8165) @flaviendelangle
|
|
30
|
+
|
|
31
|
+
### Docs
|
|
32
|
+
|
|
33
|
+
- [docs] Fix a typo in the migration guide (#8152) @flaviendelangle
|
|
34
|
+
- [docs] Fix package version used in CodeSandbox demos (#8125) @cherniavskii
|
|
35
|
+
- [docs] Fix typos across codebase (#8126) @stavares843
|
|
36
|
+
- [docs] Improve Data Grid quick filter documentation (#8109) @MBilalShafi
|
|
37
|
+
- [docs] Improve link from npm to docs (#8141) @oliviertassinari
|
|
38
|
+
- [docs] Remove test sections (#8177) @m4theushw
|
|
39
|
+
|
|
40
|
+
### Core
|
|
41
|
+
|
|
42
|
+
- [core] Upgrade monorepo (#8162) @m4theushw
|
|
43
|
+
|
|
6
44
|
## 6.0.0
|
|
7
45
|
|
|
8
46
|
_Mar 3, 2023_
|
|
@@ -3184,7 +3222,7 @@ We'd like to offer a big thanks to the 9 contributors who made this release poss
|
|
|
3184
3222
|
|
|
3185
3223
|
#### Changes
|
|
3186
3224
|
|
|
3187
|
-
- [DataGrid] Fix <kbd>Enter</kbd> causing Select to re-open when
|
|
3225
|
+
- [DataGrid] Fix <kbd>Enter</kbd> causing Select to re-open when committing value (#5756) @m4theushw
|
|
3188
3226
|
- [DataGrid] Fix `GridOverlays` bypassing pointer events (#5674) @philjones88
|
|
3189
3227
|
|
|
3190
3228
|
### `@mui/x-date-pickers@v5.0.0-beta.6` / `@mui/x-date-picker-pro@v5.0.0-beta.6`
|
|
@@ -3228,7 +3266,7 @@ We'd like to offer a big thanks to the 7 contributors who made this release poss
|
|
|
3228
3266
|
#### Changes
|
|
3229
3267
|
|
|
3230
3268
|
- [DataGrid] Catch errors if rows freezing is not supported (#5711) @cherniavskii
|
|
3231
|
-
- [DataGrid] Preserve cell mode when entering edit mode while
|
|
3269
|
+
- [DataGrid] Preserve cell mode when entering edit mode while committing (#5686) @m4theushw
|
|
3232
3270
|
- [DataGridPremium] Let quick filter search in row grouping children (#5701) @alexfauquette
|
|
3233
3271
|
|
|
3234
3272
|
### `@mui/x-date-pickers@v5.0.0-beta.5` / `@mui/x-date-picker-pro@5.0.0-beta.5`
|
|
@@ -4155,7 +4193,7 @@ We'd like to offer a big thanks to the 7 contributors who made this release poss
|
|
|
4155
4193
|
- [core] Remove dead code (#4283) @oliviertassinari
|
|
4156
4194
|
- [core] Rename the "pre-processing" concept "pipe-processing" (#4261) @flaviendelangle
|
|
4157
4195
|
- [core] Reuse previous state when updating the columns prop (#4229) @m4theushw
|
|
4158
|
-
- [core] Fix Argos
|
|
4196
|
+
- [core] Fix Argos flakiness for pickers tests (#4312) @flaviendelangle
|
|
4159
4197
|
|
|
4160
4198
|
## 5.7.0
|
|
4161
4199
|
|
|
@@ -5705,7 +5743,7 @@ A big thanks to the 5 contributors who made this release possible. Here are some
|
|
|
5705
5743
|
|
|
5706
5744
|
- [docs] Add section for controlled selection and server-side pagination (#2602) @DanailH
|
|
5707
5745
|
- [docs] Fix Algolia search (#2655) @oliviertassinari
|
|
5708
|
-
- [docs] Improve the
|
|
5746
|
+
- [docs] Improve the search results relevance (#2656) @oliviertassinari
|
|
5709
5747
|
- [docs] Update installation instructions (#2663) @m4theushw
|
|
5710
5748
|
|
|
5711
5749
|
### Core
|
|
@@ -7069,7 +7107,7 @@ Big thanks to the 5 contributors who made this release possible. Here are some h
|
|
|
7069
7107
|
}
|
|
7070
7108
|
```
|
|
7071
7109
|
|
|
7072
|
-
- [DataGrid] Upgrade
|
|
7110
|
+
- [DataGrid] Upgrade minimum supported version of React to 17.0.0 (#1410) @m4theushw
|
|
7073
7111
|
|
|
7074
7112
|
#### Changes
|
|
7075
7113
|
|
|
@@ -7199,7 +7237,7 @@ Big thanks to the 6 contributors who made this release possible. Here are some h
|
|
|
7199
7237
|
|
|
7200
7238
|
- [docs] Add demo page (#1147) @DanailH
|
|
7201
7239
|
- [docs] Fix typo in localization.md (#1155) @michael-martin-al
|
|
7202
|
-
- [docs] Improve the
|
|
7240
|
+
- [docs] Improve the description of the individual packages (#1139) @oliviertassinari
|
|
7203
7241
|
- [docs] Fix rendering docs to solve custom pagination issue (#1159) @consDev
|
|
7204
7242
|
|
|
7205
7243
|
### Core
|
|
@@ -7376,7 +7414,7 @@ Big thanks to the 5 contributors who made this release possible. Here are some h
|
|
|
7376
7414
|
- [DataGrid] Fix footer visual regression (#932) @dtassone
|
|
7377
7415
|
- [DataGrid] Fix strict mode issue with apiRef (#933) @dtassone
|
|
7378
7416
|
- [DataGrid] Work on the accessibility of the column menu (#900) @zj9495
|
|
7379
|
-
- [DataGrid] Fix timing
|
|
7417
|
+
- [DataGrid] Fix timing guarantee (#981) @oliviertassinari
|
|
7380
7418
|
- [DataGrid] Fix unstable footer height (#937) @oliviertassinari
|
|
7381
7419
|
- [DataGrid] Fix usage of the prop-types API (#955) @oliviertassinari
|
|
7382
7420
|
- [DataGrid] Fix duplicate aria-label (#953) @oliviertassinari
|
package/DataGrid/DataGrid.js
CHANGED
|
@@ -100,12 +100,12 @@ DataGridRaw.propTypes = {
|
|
|
100
100
|
*/
|
|
101
101
|
columnVisibilityModel: PropTypes.object,
|
|
102
102
|
/**
|
|
103
|
-
*
|
|
103
|
+
* Overridable components.
|
|
104
104
|
* @deprecated Use `slots` instead.
|
|
105
105
|
*/
|
|
106
106
|
components: PropTypes.object,
|
|
107
107
|
/**
|
|
108
|
-
*
|
|
108
|
+
* Overridable components props dynamically passed to the component at rendering.
|
|
109
109
|
* @deprecated Use the `slotProps` prop instead.
|
|
110
110
|
*/
|
|
111
111
|
componentsProps: PropTypes.object,
|
|
@@ -322,7 +322,7 @@ DataGridRaw.propTypes = {
|
|
|
322
322
|
onCellKeyDown: PropTypes.func,
|
|
323
323
|
/**
|
|
324
324
|
* Callback fired when the `cellModesModel` prop changes.
|
|
325
|
-
* @param {GridCellModesModel} cellModesModel Object
|
|
325
|
+
* @param {GridCellModesModel} cellModesModel Object containing which cells are in "edit" mode.
|
|
326
326
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
327
327
|
*/
|
|
328
328
|
onCellModesModelChange: PropTypes.func,
|
|
@@ -468,7 +468,7 @@ DataGridRaw.propTypes = {
|
|
|
468
468
|
onRowEditStop: PropTypes.func,
|
|
469
469
|
/**
|
|
470
470
|
* Callback fired when the `rowModesModel` prop changes.
|
|
471
|
-
* @param {GridRowModesModel} rowModesModel Object
|
|
471
|
+
* @param {GridRowModesModel} rowModesModel Object containing which rows are in "edit" mode.
|
|
472
472
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
473
473
|
*/
|
|
474
474
|
onRowModesModelChange: PropTypes.func,
|
|
@@ -582,11 +582,11 @@ DataGridRaw.propTypes = {
|
|
|
582
582
|
*/
|
|
583
583
|
showColumnVerticalBorder: PropTypes.bool,
|
|
584
584
|
/**
|
|
585
|
-
*
|
|
585
|
+
* Overridable components props dynamically passed to the component at rendering.
|
|
586
586
|
*/
|
|
587
587
|
slotProps: PropTypes.object,
|
|
588
588
|
/**
|
|
589
|
-
*
|
|
589
|
+
* Overridable components.
|
|
590
590
|
*/
|
|
591
591
|
slots: PropTypes.object,
|
|
592
592
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "className", "hasFocus", "isValidating", "isProcessingProps", "error", "onValueChange", "initialOpen", "getOptionLabel", "getOptionValue"]
|
|
3
|
+
const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "className", "hasFocus", "isValidating", "isProcessingProps", "error", "onValueChange", "initialOpen", "getOptionLabel", "getOptionValue"],
|
|
4
|
+
_excluded2 = ["MenuProps"];
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
6
7
|
import { unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
|
|
@@ -37,6 +38,11 @@ function GridEditSingleSelectCell(props) {
|
|
|
37
38
|
const [open, setOpen] = React.useState(initialOpen);
|
|
38
39
|
const baseSelectProps = ((_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.baseSelect) || {};
|
|
39
40
|
const isSelectNative = (_baseSelectProps$nati = baseSelectProps.native) != null ? _baseSelectProps$nati : false;
|
|
41
|
+
const _ref = ((_rootProps$slotProps2 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps2.baseSelect) || {},
|
|
42
|
+
{
|
|
43
|
+
MenuProps
|
|
44
|
+
} = _ref,
|
|
45
|
+
otherBaseSelectProps = _objectWithoutPropertiesLoose(_ref, _excluded2);
|
|
40
46
|
useEnhancedEffect(() => {
|
|
41
47
|
if (hasFocus) {
|
|
42
48
|
var _inputRef$current;
|
|
@@ -107,13 +113,13 @@ function GridEditSingleSelectCell(props) {
|
|
|
107
113
|
onChange: handleChange,
|
|
108
114
|
open: open,
|
|
109
115
|
onOpen: handleOpen,
|
|
110
|
-
MenuProps: {
|
|
116
|
+
MenuProps: _extends({
|
|
111
117
|
onClose: handleClose
|
|
112
|
-
},
|
|
118
|
+
}, MenuProps),
|
|
113
119
|
error: error,
|
|
114
120
|
native: isSelectNative,
|
|
115
121
|
fullWidth: true
|
|
116
|
-
}, other,
|
|
122
|
+
}, other, otherBaseSelectProps, {
|
|
117
123
|
children: valueOptions.map(valueOption => {
|
|
118
124
|
var _rootProps$slotProps3;
|
|
119
125
|
const value = getOptionValue(valueOption);
|
|
@@ -70,7 +70,7 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
70
70
|
if (resolvedValueOptions !== undefined) {
|
|
71
71
|
const itemValueIndexes = item.value.map(element => {
|
|
72
72
|
// Gets the index matching between values and valueOptions
|
|
73
|
-
return resolvedFormattedValueOptions == null ? void 0 : resolvedFormattedValueOptions.findIndex(
|
|
73
|
+
return resolvedFormattedValueOptions == null ? void 0 : resolvedFormattedValueOptions.findIndex(formattedOption => formattedOption === element);
|
|
74
74
|
});
|
|
75
75
|
return itemValueIndexes.filter(index => index >= 0).map(index => resolvedValueOptions[index]);
|
|
76
76
|
}
|
|
@@ -272,7 +272,7 @@ export interface GridClasses {
|
|
|
272
272
|
*/
|
|
273
273
|
filterFormDeleteIcon: string;
|
|
274
274
|
/**
|
|
275
|
-
* Styles applied to the link operator
|
|
275
|
+
* Styles applied to the link operator input of the filter form component.
|
|
276
276
|
*/
|
|
277
277
|
filterFormLogicOperatorInput: string;
|
|
278
278
|
/**
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { isLeaf } from '../../../models/gridColumnGrouping';
|
|
2
2
|
import { isDeepEqual } from '../../../utils/utils';
|
|
3
3
|
// This is the recurrence function that help writing `unwrapGroupingColumnModel()`
|
|
4
|
-
const recurrentUnwrapGroupingColumnModel = (columnGroupNode, parents,
|
|
4
|
+
const recurrentUnwrapGroupingColumnModel = (columnGroupNode, parents, unwrappedGroupingModelToComplete) => {
|
|
5
5
|
if (isLeaf(columnGroupNode)) {
|
|
6
|
-
if (
|
|
7
|
-
throw new Error([`MUI: columnGroupingModel contains duplicated field`, `column field ${columnGroupNode.field}
|
|
6
|
+
if (unwrappedGroupingModelToComplete[columnGroupNode.field] !== undefined) {
|
|
7
|
+
throw new Error([`MUI: columnGroupingModel contains duplicated field`, `column field ${columnGroupNode.field} occurs two times in the grouping model:`, `- ${unwrappedGroupingModelToComplete[columnGroupNode.field].join(' > ')}`, `- ${parents.join(' > ')}`].join('\n'));
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
unwrappedGroupingModelToComplete[columnGroupNode.field] = parents;
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
12
|
const {
|
|
@@ -14,7 +14,7 @@ const recurrentUnwrapGroupingColumnModel = (columnGroupNode, parents, unwrappedG
|
|
|
14
14
|
children
|
|
15
15
|
} = columnGroupNode;
|
|
16
16
|
children.forEach(child => {
|
|
17
|
-
recurrentUnwrapGroupingColumnModel(child, [...parents, groupId],
|
|
17
|
+
recurrentUnwrapGroupingColumnModel(child, [...parents, groupId], unwrappedGroupingModelToComplete);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -16,14 +16,14 @@ export interface GridColumnMenuComponentProps {
|
|
|
16
16
|
}
|
|
17
17
|
export interface GridColumnMenuRootProps {
|
|
18
18
|
/**
|
|
19
|
-
* Initial `components` - it is internal, to be
|
|
19
|
+
* Initial `components` - it is internal, to be overridden by Pro or Premium packages
|
|
20
20
|
* @ignore - do not document.
|
|
21
21
|
*/
|
|
22
22
|
defaultComponents: {
|
|
23
23
|
[key: string]: React.JSXElementConstructor<any>;
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
|
-
* Initial `componentsProps` - it is internal, to be
|
|
26
|
+
* Initial `componentsProps` - it is internal, to be overridden by Pro or Premium packages
|
|
27
27
|
* @ignore - do not document.
|
|
28
28
|
*/
|
|
29
29
|
defaultComponentsProps: {
|
|
@@ -68,7 +68,7 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
68
68
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
69
69
|
if (params.cellMode === GridCellModes.Edit) {
|
|
70
70
|
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
71
|
-
// TODO: `event.which` is
|
|
71
|
+
// TODO: `event.which` is deprecated but this is a temporary workaround
|
|
72
72
|
if (event.which === 229) {
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
@@ -47,7 +47,7 @@ export const useGridEditing = (apiRef, props) => {
|
|
|
47
47
|
clearTimeout(timeout);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
// To run the callback
|
|
50
|
+
// To run the callback immediately without waiting the timeout
|
|
51
51
|
const runImmediately = () => {
|
|
52
52
|
const [timeout] = debounceMap.current[id][field];
|
|
53
53
|
clearTimeout(timeout);
|
|
@@ -104,7 +104,7 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
104
104
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
105
105
|
if (params.cellMode === GridRowModes.Edit) {
|
|
106
106
|
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
107
|
-
// TODO: `event.which` is
|
|
107
|
+
// TODO: `event.which` is deprecated but this is a temporary workaround
|
|
108
108
|
if (event.which === 229) {
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
@@ -19,6 +19,15 @@ function raf() {
|
|
|
19
19
|
});
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
+
function buildPrintWindow(title) {
|
|
23
|
+
const iframeEl = document.createElement('iframe');
|
|
24
|
+
iframeEl.style.position = 'absolute';
|
|
25
|
+
iframeEl.style.width = '0px';
|
|
26
|
+
iframeEl.style.height = '0px';
|
|
27
|
+
iframeEl.title = title || document.title;
|
|
28
|
+
return iframeEl;
|
|
29
|
+
}
|
|
30
|
+
|
|
22
31
|
/**
|
|
23
32
|
* @requires useGridColumns (state)
|
|
24
33
|
* @requires useGridFilter (state)
|
|
@@ -57,16 +66,6 @@ export const useGridPrintExport = (apiRef, props) => {
|
|
|
57
66
|
apiRef.current.setColumnVisibilityModel(newColumnVisibilityModel);
|
|
58
67
|
resolve();
|
|
59
68
|
}), [apiRef]);
|
|
60
|
-
|
|
61
|
-
// TODO move outside of this scope and remove React.useCallback
|
|
62
|
-
const buildPrintWindow = React.useCallback(title => {
|
|
63
|
-
const iframeEl = document.createElement('iframe');
|
|
64
|
-
iframeEl.style.position = 'absolute';
|
|
65
|
-
iframeEl.style.width = '0px';
|
|
66
|
-
iframeEl.style.height = '0px';
|
|
67
|
-
iframeEl.title = title || document.title;
|
|
68
|
-
return iframeEl;
|
|
69
|
-
}, []);
|
|
70
69
|
const handlePrintWindowLoad = React.useCallback((printWindow, options) => {
|
|
71
70
|
var _querySelector, _querySelector2;
|
|
72
71
|
const normalizeOptions = _extends({
|
|
@@ -213,7 +212,7 @@ export const useGridPrintExport = (apiRef, props) => {
|
|
|
213
212
|
};
|
|
214
213
|
doc.current.body.appendChild(printWindow);
|
|
215
214
|
}
|
|
216
|
-
}, [props, logger, apiRef,
|
|
215
|
+
}, [props, logger, apiRef, handlePrintWindowLoad, handlePrintWindowAfterPrint, updateGridColumnsForPrint]);
|
|
217
216
|
const printExportApi = {
|
|
218
217
|
exportDataAsPrint
|
|
219
218
|
};
|
package/index.js
CHANGED
|
@@ -102,12 +102,12 @@ DataGridRaw.propTypes = {
|
|
|
102
102
|
*/
|
|
103
103
|
columnVisibilityModel: PropTypes.object,
|
|
104
104
|
/**
|
|
105
|
-
*
|
|
105
|
+
* Overridable components.
|
|
106
106
|
* @deprecated Use `slots` instead.
|
|
107
107
|
*/
|
|
108
108
|
components: PropTypes.object,
|
|
109
109
|
/**
|
|
110
|
-
*
|
|
110
|
+
* Overridable components props dynamically passed to the component at rendering.
|
|
111
111
|
* @deprecated Use the `slotProps` prop instead.
|
|
112
112
|
*/
|
|
113
113
|
componentsProps: PropTypes.object,
|
|
@@ -324,7 +324,7 @@ DataGridRaw.propTypes = {
|
|
|
324
324
|
onCellKeyDown: PropTypes.func,
|
|
325
325
|
/**
|
|
326
326
|
* Callback fired when the `cellModesModel` prop changes.
|
|
327
|
-
* @param {GridCellModesModel} cellModesModel Object
|
|
327
|
+
* @param {GridCellModesModel} cellModesModel Object containing which cells are in "edit" mode.
|
|
328
328
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
329
329
|
*/
|
|
330
330
|
onCellModesModelChange: PropTypes.func,
|
|
@@ -470,7 +470,7 @@ DataGridRaw.propTypes = {
|
|
|
470
470
|
onRowEditStop: PropTypes.func,
|
|
471
471
|
/**
|
|
472
472
|
* Callback fired when the `rowModesModel` prop changes.
|
|
473
|
-
* @param {GridRowModesModel} rowModesModel Object
|
|
473
|
+
* @param {GridRowModesModel} rowModesModel Object containing which rows are in "edit" mode.
|
|
474
474
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
475
475
|
*/
|
|
476
476
|
onRowModesModelChange: PropTypes.func,
|
|
@@ -584,11 +584,11 @@ DataGridRaw.propTypes = {
|
|
|
584
584
|
*/
|
|
585
585
|
showColumnVerticalBorder: PropTypes.bool,
|
|
586
586
|
/**
|
|
587
|
-
*
|
|
587
|
+
* Overridable components props dynamically passed to the component at rendering.
|
|
588
588
|
*/
|
|
589
589
|
slotProps: PropTypes.object,
|
|
590
590
|
/**
|
|
591
|
-
*
|
|
591
|
+
* Overridable components.
|
|
592
592
|
*/
|
|
593
593
|
slots: PropTypes.object,
|
|
594
594
|
/**
|
|
@@ -2,7 +2,8 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "className", "hasFocus", "isValidating", "isProcessingProps", "error", "onValueChange", "initialOpen", "getOptionLabel", "getOptionValue"]
|
|
5
|
+
var _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "className", "hasFocus", "isValidating", "isProcessingProps", "error", "onValueChange", "initialOpen", "getOptionLabel", "getOptionValue"],
|
|
6
|
+
_excluded2 = ["MenuProps"];
|
|
6
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
8
|
import * as React from 'react';
|
|
8
9
|
import PropTypes from 'prop-types';
|
|
@@ -51,6 +52,9 @@ function GridEditSingleSelectCell(props) {
|
|
|
51
52
|
setOpen = _React$useState2[1];
|
|
52
53
|
var baseSelectProps = ((_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.baseSelect) || {};
|
|
53
54
|
var isSelectNative = (_baseSelectProps$nati = baseSelectProps.native) != null ? _baseSelectProps$nati : false;
|
|
55
|
+
var _ref = ((_rootProps$slotProps2 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps2.baseSelect) || {},
|
|
56
|
+
MenuProps = _ref.MenuProps,
|
|
57
|
+
otherBaseSelectProps = _objectWithoutProperties(_ref, _excluded2);
|
|
54
58
|
useEnhancedEffect(function () {
|
|
55
59
|
if (hasFocus) {
|
|
56
60
|
var _inputRef$current;
|
|
@@ -76,7 +80,7 @@ function GridEditSingleSelectCell(props) {
|
|
|
76
80
|
var getOptionValue = getOptionValueProp || colDef.getOptionValue;
|
|
77
81
|
var getOptionLabel = getOptionLabelProp || colDef.getOptionLabel;
|
|
78
82
|
var handleChange = /*#__PURE__*/function () {
|
|
79
|
-
var
|
|
83
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(event) {
|
|
80
84
|
var target, formattedTargetValue;
|
|
81
85
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
82
86
|
while (1) {
|
|
@@ -112,7 +116,7 @@ function GridEditSingleSelectCell(props) {
|
|
|
112
116
|
}, _callee);
|
|
113
117
|
}));
|
|
114
118
|
return function handleChange(_x) {
|
|
115
|
-
return
|
|
119
|
+
return _ref2.apply(this, arguments);
|
|
116
120
|
};
|
|
117
121
|
}();
|
|
118
122
|
var handleClose = function handleClose(event, reason) {
|
|
@@ -144,13 +148,13 @@ function GridEditSingleSelectCell(props) {
|
|
|
144
148
|
onChange: handleChange,
|
|
145
149
|
open: open,
|
|
146
150
|
onOpen: handleOpen,
|
|
147
|
-
MenuProps: {
|
|
151
|
+
MenuProps: _extends({
|
|
148
152
|
onClose: handleClose
|
|
149
|
-
},
|
|
153
|
+
}, MenuProps),
|
|
150
154
|
error: error,
|
|
151
155
|
native: isSelectNative,
|
|
152
156
|
fullWidth: true
|
|
153
|
-
}, other,
|
|
157
|
+
}, other, otherBaseSelectProps, {
|
|
154
158
|
children: valueOptions.map(function (valueOption) {
|
|
155
159
|
var _rootProps$slotProps3;
|
|
156
160
|
var value = getOptionValue(valueOption);
|
|
@@ -72,8 +72,8 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
72
72
|
if (resolvedValueOptions !== undefined) {
|
|
73
73
|
var itemValueIndexes = item.value.map(function (element) {
|
|
74
74
|
// Gets the index matching between values and valueOptions
|
|
75
|
-
return resolvedFormattedValueOptions == null ? void 0 : resolvedFormattedValueOptions.findIndex(function (
|
|
76
|
-
return
|
|
75
|
+
return resolvedFormattedValueOptions == null ? void 0 : resolvedFormattedValueOptions.findIndex(function (formattedOption) {
|
|
76
|
+
return formattedOption === element;
|
|
77
77
|
});
|
|
78
78
|
});
|
|
79
79
|
return itemValueIndexes.filter(function (index) {
|
|
@@ -2,18 +2,18 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
|
2
2
|
import { isLeaf } from '../../../models/gridColumnGrouping';
|
|
3
3
|
import { isDeepEqual } from '../../../utils/utils';
|
|
4
4
|
// This is the recurrence function that help writing `unwrapGroupingColumnModel()`
|
|
5
|
-
var recurrentUnwrapGroupingColumnModel = function recurrentUnwrapGroupingColumnModel(columnGroupNode, parents,
|
|
5
|
+
var recurrentUnwrapGroupingColumnModel = function recurrentUnwrapGroupingColumnModel(columnGroupNode, parents, unwrappedGroupingModelToComplete) {
|
|
6
6
|
if (isLeaf(columnGroupNode)) {
|
|
7
|
-
if (
|
|
8
|
-
throw new Error(["MUI: columnGroupingModel contains duplicated field", "column field ".concat(columnGroupNode.field, "
|
|
7
|
+
if (unwrappedGroupingModelToComplete[columnGroupNode.field] !== undefined) {
|
|
8
|
+
throw new Error(["MUI: columnGroupingModel contains duplicated field", "column field ".concat(columnGroupNode.field, " occurs two times in the grouping model:"), "- ".concat(unwrappedGroupingModelToComplete[columnGroupNode.field].join(' > ')), "- ".concat(parents.join(' > '))].join('\n'));
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
unwrappedGroupingModelToComplete[columnGroupNode.field] = parents;
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
var groupId = columnGroupNode.groupId,
|
|
14
14
|
children = columnGroupNode.children;
|
|
15
15
|
children.forEach(function (child) {
|
|
16
|
-
recurrentUnwrapGroupingColumnModel(child, [].concat(_toConsumableArray(parents), [groupId]),
|
|
16
|
+
recurrentUnwrapGroupingColumnModel(child, [].concat(_toConsumableArray(parents), [groupId]), unwrappedGroupingModelToComplete);
|
|
17
17
|
});
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -75,7 +75,7 @@ export var useGridCellEditing = function useGridCellEditing(apiRef, props) {
|
|
|
75
75
|
var handleCellKeyDown = React.useCallback(function (params, event) {
|
|
76
76
|
if (params.cellMode === GridCellModes.Edit) {
|
|
77
77
|
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
78
|
-
// TODO: `event.which` is
|
|
78
|
+
// TODO: `event.which` is deprecated but this is a temporary workaround
|
|
79
79
|
if (event.which === 229) {
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
@@ -51,7 +51,7 @@ export var useGridEditing = function useGridEditing(apiRef, props) {
|
|
|
51
51
|
clearTimeout(_timeout);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
// To run the callback
|
|
54
|
+
// To run the callback immediately without waiting the timeout
|
|
55
55
|
var runImmediately = function runImmediately() {
|
|
56
56
|
var _debounceMap$current$2 = _slicedToArray(debounceMap.current[id][field], 1),
|
|
57
57
|
timeout = _debounceMap$current$2[0];
|
|
@@ -109,7 +109,7 @@ export var useGridRowEditing = function useGridRowEditing(apiRef, props) {
|
|
|
109
109
|
var handleCellKeyDown = React.useCallback(function (params, event) {
|
|
110
110
|
if (params.cellMode === GridRowModes.Edit) {
|
|
111
111
|
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
112
|
-
// TODO: `event.which` is
|
|
112
|
+
// TODO: `event.which` is deprecated but this is a temporary workaround
|
|
113
113
|
if (event.which === 229) {
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
@@ -22,6 +22,15 @@ function raf() {
|
|
|
22
22
|
});
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
+
function buildPrintWindow(title) {
|
|
26
|
+
var iframeEl = document.createElement('iframe');
|
|
27
|
+
iframeEl.style.position = 'absolute';
|
|
28
|
+
iframeEl.style.width = '0px';
|
|
29
|
+
iframeEl.style.height = '0px';
|
|
30
|
+
iframeEl.title = title || document.title;
|
|
31
|
+
return iframeEl;
|
|
32
|
+
}
|
|
33
|
+
|
|
25
34
|
/**
|
|
26
35
|
* @requires useGridColumns (state)
|
|
27
36
|
* @requires useGridFilter (state)
|
|
@@ -64,16 +73,6 @@ export var useGridPrintExport = function useGridPrintExport(apiRef, props) {
|
|
|
64
73
|
resolve();
|
|
65
74
|
});
|
|
66
75
|
}, [apiRef]);
|
|
67
|
-
|
|
68
|
-
// TODO move outside of this scope and remove React.useCallback
|
|
69
|
-
var buildPrintWindow = React.useCallback(function (title) {
|
|
70
|
-
var iframeEl = document.createElement('iframe');
|
|
71
|
-
iframeEl.style.position = 'absolute';
|
|
72
|
-
iframeEl.style.width = '0px';
|
|
73
|
-
iframeEl.style.height = '0px';
|
|
74
|
-
iframeEl.title = title || document.title;
|
|
75
|
-
return iframeEl;
|
|
76
|
-
}, []);
|
|
77
76
|
var handlePrintWindowLoad = React.useCallback(function (printWindow, options) {
|
|
78
77
|
var _querySelector, _querySelector2;
|
|
79
78
|
var normalizeOptions = _extends({
|
|
@@ -245,7 +244,7 @@ export var useGridPrintExport = function useGridPrintExport(apiRef, props) {
|
|
|
245
244
|
return function (_x) {
|
|
246
245
|
return _ref.apply(this, arguments);
|
|
247
246
|
};
|
|
248
|
-
}(), [props, logger, apiRef,
|
|
247
|
+
}(), [props, logger, apiRef, handlePrintWindowLoad, handlePrintWindowAfterPrint, updateGridColumnsForPrint]);
|
|
249
248
|
var printExportApi = {
|
|
250
249
|
exportDataAsPrint: exportDataAsPrint
|
|
251
250
|
};
|
package/legacy/index.js
CHANGED
|
@@ -52,7 +52,7 @@ export interface GridEditingSharedApi {
|
|
|
52
52
|
}
|
|
53
53
|
export interface GridEditingSharedPrivateApi {
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
55
|
+
* Immediately updates the value of the cell, without waiting for the debounce.
|
|
56
56
|
* @param {GridRowId} id The row id.
|
|
57
57
|
* @param {string} field The field to update. If not passed, updates all fields in the given row id.
|
|
58
58
|
*/
|
|
@@ -72,7 +72,7 @@ export interface RowPropsOverrides {
|
|
|
72
72
|
}
|
|
73
73
|
type SlotProps<Props, Overrides> = Partial<Props & Overrides>;
|
|
74
74
|
/**
|
|
75
|
-
*
|
|
75
|
+
* Overridable components props dynamically passed to the component at rendering.
|
|
76
76
|
*/
|
|
77
77
|
export interface GridSlotsComponentsProps {
|
|
78
78
|
baseCheckbox?: SlotProps<CheckboxProps, BaseCheckboxPropsOverrides>;
|
|
@@ -64,12 +64,12 @@ export interface DataGridPropsWithComplexDefaultValueAfterProcessing {
|
|
|
64
64
|
*/
|
|
65
65
|
export interface DataGridPropsWithComplexDefaultValueBeforeProcessing {
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
67
|
+
* Overridable components.
|
|
68
68
|
* @deprecated Use `slots` instead.
|
|
69
69
|
*/
|
|
70
70
|
components?: Partial<GridSlotsComponent>;
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
72
|
+
* Overridable components.
|
|
73
73
|
*/
|
|
74
74
|
slots?: UncapitalizeObjectKeys<Partial<GridSlotsComponent>>;
|
|
75
75
|
/**
|
|
@@ -558,7 +558,7 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
558
558
|
cellModesModel?: GridCellModesModel;
|
|
559
559
|
/**
|
|
560
560
|
* Callback fired when the `cellModesModel` prop changes.
|
|
561
|
-
* @param {GridCellModesModel} cellModesModel Object
|
|
561
|
+
* @param {GridCellModesModel} cellModesModel Object containing which cells are in "edit" mode.
|
|
562
562
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
563
563
|
*/
|
|
564
564
|
onCellModesModelChange?: (cellModesModel: GridCellModesModel, details: GridCallbackDetails) => void;
|
|
@@ -568,7 +568,7 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
568
568
|
rowModesModel?: GridRowModesModel;
|
|
569
569
|
/**
|
|
570
570
|
* Callback fired when the `rowModesModel` prop changes.
|
|
571
|
-
* @param {GridRowModesModel} rowModesModel Object
|
|
571
|
+
* @param {GridRowModesModel} rowModesModel Object containing which rows are in "edit" mode.
|
|
572
572
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
573
573
|
*/
|
|
574
574
|
onRowModesModelChange?: (rowModesModel: GridRowModesModel, details: GridCallbackDetails) => void;
|
|
@@ -648,11 +648,11 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
648
648
|
*/
|
|
649
649
|
initialState?: GridInitialStateCommunity;
|
|
650
650
|
/**
|
|
651
|
-
*
|
|
651
|
+
* Overridable components props dynamically passed to the component at rendering.
|
|
652
652
|
*/
|
|
653
653
|
slotProps?: GridSlotsComponentsProps;
|
|
654
654
|
/**
|
|
655
|
-
*
|
|
655
|
+
* Overridable components props dynamically passed to the component at rendering.
|
|
656
656
|
* @deprecated Use the `slotProps` prop instead.
|
|
657
657
|
*/
|
|
658
658
|
componentsProps?: GridSlotsComponentsProps;
|
|
@@ -100,12 +100,12 @@ DataGridRaw.propTypes = {
|
|
|
100
100
|
*/
|
|
101
101
|
columnVisibilityModel: PropTypes.object,
|
|
102
102
|
/**
|
|
103
|
-
*
|
|
103
|
+
* Overridable components.
|
|
104
104
|
* @deprecated Use `slots` instead.
|
|
105
105
|
*/
|
|
106
106
|
components: PropTypes.object,
|
|
107
107
|
/**
|
|
108
|
-
*
|
|
108
|
+
* Overridable components props dynamically passed to the component at rendering.
|
|
109
109
|
* @deprecated Use the `slotProps` prop instead.
|
|
110
110
|
*/
|
|
111
111
|
componentsProps: PropTypes.object,
|
|
@@ -322,7 +322,7 @@ DataGridRaw.propTypes = {
|
|
|
322
322
|
onCellKeyDown: PropTypes.func,
|
|
323
323
|
/**
|
|
324
324
|
* Callback fired when the `cellModesModel` prop changes.
|
|
325
|
-
* @param {GridCellModesModel} cellModesModel Object
|
|
325
|
+
* @param {GridCellModesModel} cellModesModel Object containing which cells are in "edit" mode.
|
|
326
326
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
327
327
|
*/
|
|
328
328
|
onCellModesModelChange: PropTypes.func,
|
|
@@ -468,7 +468,7 @@ DataGridRaw.propTypes = {
|
|
|
468
468
|
onRowEditStop: PropTypes.func,
|
|
469
469
|
/**
|
|
470
470
|
* Callback fired when the `rowModesModel` prop changes.
|
|
471
|
-
* @param {GridRowModesModel} rowModesModel Object
|
|
471
|
+
* @param {GridRowModesModel} rowModesModel Object containing which rows are in "edit" mode.
|
|
472
472
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
473
473
|
*/
|
|
474
474
|
onRowModesModelChange: PropTypes.func,
|
|
@@ -582,11 +582,11 @@ DataGridRaw.propTypes = {
|
|
|
582
582
|
*/
|
|
583
583
|
showColumnVerticalBorder: PropTypes.bool,
|
|
584
584
|
/**
|
|
585
|
-
*
|
|
585
|
+
* Overridable components props dynamically passed to the component at rendering.
|
|
586
586
|
*/
|
|
587
587
|
slotProps: PropTypes.object,
|
|
588
588
|
/**
|
|
589
|
-
*
|
|
589
|
+
* Overridable components.
|
|
590
590
|
*/
|
|
591
591
|
slots: PropTypes.object,
|
|
592
592
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "className", "hasFocus", "isValidating", "isProcessingProps", "error", "onValueChange", "initialOpen", "getOptionLabel", "getOptionValue"]
|
|
3
|
+
const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "className", "hasFocus", "isValidating", "isProcessingProps", "error", "onValueChange", "initialOpen", "getOptionLabel", "getOptionValue"],
|
|
4
|
+
_excluded2 = ["MenuProps"];
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
6
7
|
import { unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
|
|
@@ -36,6 +37,11 @@ function GridEditSingleSelectCell(props) {
|
|
|
36
37
|
const [open, setOpen] = React.useState(initialOpen);
|
|
37
38
|
const baseSelectProps = rootProps.slotProps?.baseSelect || {};
|
|
38
39
|
const isSelectNative = baseSelectProps.native ?? false;
|
|
40
|
+
const _ref = rootProps.slotProps?.baseSelect || {},
|
|
41
|
+
{
|
|
42
|
+
MenuProps
|
|
43
|
+
} = _ref,
|
|
44
|
+
otherBaseSelectProps = _objectWithoutPropertiesLoose(_ref, _excluded2);
|
|
39
45
|
useEnhancedEffect(() => {
|
|
40
46
|
if (hasFocus) {
|
|
41
47
|
inputRef.current?.focus();
|
|
@@ -105,13 +111,13 @@ function GridEditSingleSelectCell(props) {
|
|
|
105
111
|
onChange: handleChange,
|
|
106
112
|
open: open,
|
|
107
113
|
onOpen: handleOpen,
|
|
108
|
-
MenuProps: {
|
|
114
|
+
MenuProps: _extends({
|
|
109
115
|
onClose: handleClose
|
|
110
|
-
},
|
|
116
|
+
}, MenuProps),
|
|
111
117
|
error: error,
|
|
112
118
|
native: isSelectNative,
|
|
113
119
|
fullWidth: true
|
|
114
|
-
}, other,
|
|
120
|
+
}, other, otherBaseSelectProps, {
|
|
115
121
|
children: valueOptions.map(valueOption => {
|
|
116
122
|
const value = getOptionValue(valueOption);
|
|
117
123
|
return /*#__PURE__*/_createElement(rootProps.slots.baseSelectOption, _extends({}, rootProps.slotProps?.baseSelectOption || {}, {
|
|
@@ -68,7 +68,7 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
68
68
|
if (resolvedValueOptions !== undefined) {
|
|
69
69
|
const itemValueIndexes = item.value.map(element => {
|
|
70
70
|
// Gets the index matching between values and valueOptions
|
|
71
|
-
return resolvedFormattedValueOptions?.findIndex(
|
|
71
|
+
return resolvedFormattedValueOptions?.findIndex(formattedOption => formattedOption === element);
|
|
72
72
|
});
|
|
73
73
|
return itemValueIndexes.filter(index => index >= 0).map(index => resolvedValueOptions[index]);
|
|
74
74
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { isLeaf } from '../../../models/gridColumnGrouping';
|
|
2
2
|
import { isDeepEqual } from '../../../utils/utils';
|
|
3
3
|
// This is the recurrence function that help writing `unwrapGroupingColumnModel()`
|
|
4
|
-
const recurrentUnwrapGroupingColumnModel = (columnGroupNode, parents,
|
|
4
|
+
const recurrentUnwrapGroupingColumnModel = (columnGroupNode, parents, unwrappedGroupingModelToComplete) => {
|
|
5
5
|
if (isLeaf(columnGroupNode)) {
|
|
6
|
-
if (
|
|
7
|
-
throw new Error([`MUI: columnGroupingModel contains duplicated field`, `column field ${columnGroupNode.field}
|
|
6
|
+
if (unwrappedGroupingModelToComplete[columnGroupNode.field] !== undefined) {
|
|
7
|
+
throw new Error([`MUI: columnGroupingModel contains duplicated field`, `column field ${columnGroupNode.field} occurs two times in the grouping model:`, `- ${unwrappedGroupingModelToComplete[columnGroupNode.field].join(' > ')}`, `- ${parents.join(' > ')}`].join('\n'));
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
unwrappedGroupingModelToComplete[columnGroupNode.field] = parents;
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
12
|
const {
|
|
@@ -14,7 +14,7 @@ const recurrentUnwrapGroupingColumnModel = (columnGroupNode, parents, unwrappedG
|
|
|
14
14
|
children
|
|
15
15
|
} = columnGroupNode;
|
|
16
16
|
children.forEach(child => {
|
|
17
|
-
recurrentUnwrapGroupingColumnModel(child, [...parents, groupId],
|
|
17
|
+
recurrentUnwrapGroupingColumnModel(child, [...parents, groupId], unwrappedGroupingModelToComplete);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -68,7 +68,7 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
68
68
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
69
69
|
if (params.cellMode === GridCellModes.Edit) {
|
|
70
70
|
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
71
|
-
// TODO: `event.which` is
|
|
71
|
+
// TODO: `event.which` is deprecated but this is a temporary workaround
|
|
72
72
|
if (event.which === 229) {
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
@@ -47,7 +47,7 @@ export const useGridEditing = (apiRef, props) => {
|
|
|
47
47
|
clearTimeout(timeout);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
// To run the callback
|
|
50
|
+
// To run the callback immediately without waiting the timeout
|
|
51
51
|
const runImmediately = () => {
|
|
52
52
|
const [timeout] = debounceMap.current[id][field];
|
|
53
53
|
clearTimeout(timeout);
|
|
@@ -103,7 +103,7 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
103
103
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
104
104
|
if (params.cellMode === GridRowModes.Edit) {
|
|
105
105
|
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
106
|
-
// TODO: `event.which` is
|
|
106
|
+
// TODO: `event.which` is deprecated but this is a temporary workaround
|
|
107
107
|
if (event.which === 229) {
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
@@ -19,6 +19,15 @@ function raf() {
|
|
|
19
19
|
});
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
+
function buildPrintWindow(title) {
|
|
23
|
+
const iframeEl = document.createElement('iframe');
|
|
24
|
+
iframeEl.style.position = 'absolute';
|
|
25
|
+
iframeEl.style.width = '0px';
|
|
26
|
+
iframeEl.style.height = '0px';
|
|
27
|
+
iframeEl.title = title || document.title;
|
|
28
|
+
return iframeEl;
|
|
29
|
+
}
|
|
30
|
+
|
|
22
31
|
/**
|
|
23
32
|
* @requires useGridColumns (state)
|
|
24
33
|
* @requires useGridFilter (state)
|
|
@@ -57,16 +66,6 @@ export const useGridPrintExport = (apiRef, props) => {
|
|
|
57
66
|
apiRef.current.setColumnVisibilityModel(newColumnVisibilityModel);
|
|
58
67
|
resolve();
|
|
59
68
|
}), [apiRef]);
|
|
60
|
-
|
|
61
|
-
// TODO move outside of this scope and remove React.useCallback
|
|
62
|
-
const buildPrintWindow = React.useCallback(title => {
|
|
63
|
-
const iframeEl = document.createElement('iframe');
|
|
64
|
-
iframeEl.style.position = 'absolute';
|
|
65
|
-
iframeEl.style.width = '0px';
|
|
66
|
-
iframeEl.style.height = '0px';
|
|
67
|
-
iframeEl.title = title || document.title;
|
|
68
|
-
return iframeEl;
|
|
69
|
-
}, []);
|
|
70
69
|
const handlePrintWindowLoad = React.useCallback((printWindow, options) => {
|
|
71
70
|
const normalizeOptions = _extends({
|
|
72
71
|
copyStyles: true,
|
|
@@ -209,7 +208,7 @@ export const useGridPrintExport = (apiRef, props) => {
|
|
|
209
208
|
};
|
|
210
209
|
doc.current.body.appendChild(printWindow);
|
|
211
210
|
}
|
|
212
|
-
}, [props, logger, apiRef,
|
|
211
|
+
}, [props, logger, apiRef, handlePrintWindowLoad, handlePrintWindowAfterPrint, updateGridColumnsForPrint]);
|
|
213
212
|
const printExportApi = {
|
|
214
213
|
exportDataAsPrint
|
|
215
214
|
};
|
package/modern/index.js
CHANGED
|
@@ -109,12 +109,12 @@ DataGridRaw.propTypes = {
|
|
|
109
109
|
*/
|
|
110
110
|
columnVisibilityModel: _propTypes.default.object,
|
|
111
111
|
/**
|
|
112
|
-
*
|
|
112
|
+
* Overridable components.
|
|
113
113
|
* @deprecated Use `slots` instead.
|
|
114
114
|
*/
|
|
115
115
|
components: _propTypes.default.object,
|
|
116
116
|
/**
|
|
117
|
-
*
|
|
117
|
+
* Overridable components props dynamically passed to the component at rendering.
|
|
118
118
|
* @deprecated Use the `slotProps` prop instead.
|
|
119
119
|
*/
|
|
120
120
|
componentsProps: _propTypes.default.object,
|
|
@@ -331,7 +331,7 @@ DataGridRaw.propTypes = {
|
|
|
331
331
|
onCellKeyDown: _propTypes.default.func,
|
|
332
332
|
/**
|
|
333
333
|
* Callback fired when the `cellModesModel` prop changes.
|
|
334
|
-
* @param {GridCellModesModel} cellModesModel Object
|
|
334
|
+
* @param {GridCellModesModel} cellModesModel Object containing which cells are in "edit" mode.
|
|
335
335
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
336
336
|
*/
|
|
337
337
|
onCellModesModelChange: _propTypes.default.func,
|
|
@@ -477,7 +477,7 @@ DataGridRaw.propTypes = {
|
|
|
477
477
|
onRowEditStop: _propTypes.default.func,
|
|
478
478
|
/**
|
|
479
479
|
* Callback fired when the `rowModesModel` prop changes.
|
|
480
|
-
* @param {GridRowModesModel} rowModesModel Object
|
|
480
|
+
* @param {GridRowModesModel} rowModesModel Object containing which rows are in "edit" mode.
|
|
481
481
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
482
482
|
*/
|
|
483
483
|
onRowModesModelChange: _propTypes.default.func,
|
|
@@ -591,11 +591,11 @@ DataGridRaw.propTypes = {
|
|
|
591
591
|
*/
|
|
592
592
|
showColumnVerticalBorder: _propTypes.default.bool,
|
|
593
593
|
/**
|
|
594
|
-
*
|
|
594
|
+
* Overridable components props dynamically passed to the component at rendering.
|
|
595
595
|
*/
|
|
596
596
|
slotProps: _propTypes.default.object,
|
|
597
597
|
/**
|
|
598
|
-
*
|
|
598
|
+
* Overridable components.
|
|
599
599
|
*/
|
|
600
600
|
slots: _propTypes.default.object,
|
|
601
601
|
/**
|
|
@@ -17,7 +17,8 @@ var _gridEditRowModel = require("../../models/gridEditRowModel");
|
|
|
17
17
|
var _filterPanelUtils = require("../panel/filterPanel/filterPanelUtils");
|
|
18
18
|
var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
-
const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "className", "hasFocus", "isValidating", "isProcessingProps", "error", "onValueChange", "initialOpen", "getOptionLabel", "getOptionValue"]
|
|
20
|
+
const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "className", "hasFocus", "isValidating", "isProcessingProps", "error", "onValueChange", "initialOpen", "getOptionLabel", "getOptionValue"],
|
|
21
|
+
_excluded2 = ["MenuProps"];
|
|
21
22
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
22
23
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
24
|
function isKeyboardEvent(event) {
|
|
@@ -45,6 +46,11 @@ function GridEditSingleSelectCell(props) {
|
|
|
45
46
|
const [open, setOpen] = React.useState(initialOpen);
|
|
46
47
|
const baseSelectProps = rootProps.slotProps?.baseSelect || {};
|
|
47
48
|
const isSelectNative = baseSelectProps.native ?? false;
|
|
49
|
+
const _ref = rootProps.slotProps?.baseSelect || {},
|
|
50
|
+
{
|
|
51
|
+
MenuProps
|
|
52
|
+
} = _ref,
|
|
53
|
+
otherBaseSelectProps = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded2);
|
|
48
54
|
(0, _utils.unstable_useEnhancedEffect)(() => {
|
|
49
55
|
if (hasFocus) {
|
|
50
56
|
inputRef.current?.focus();
|
|
@@ -114,13 +120,13 @@ function GridEditSingleSelectCell(props) {
|
|
|
114
120
|
onChange: handleChange,
|
|
115
121
|
open: open,
|
|
116
122
|
onOpen: handleOpen,
|
|
117
|
-
MenuProps: {
|
|
123
|
+
MenuProps: (0, _extends2.default)({
|
|
118
124
|
onClose: handleClose
|
|
119
|
-
},
|
|
125
|
+
}, MenuProps),
|
|
120
126
|
error: error,
|
|
121
127
|
native: isSelectNative,
|
|
122
128
|
fullWidth: true
|
|
123
|
-
}, other,
|
|
129
|
+
}, other, otherBaseSelectProps, {
|
|
124
130
|
children: valueOptions.map(valueOption => {
|
|
125
131
|
const value = getOptionValue(valueOption);
|
|
126
132
|
return /*#__PURE__*/(0, React.createElement)(rootProps.slots.baseSelectOption, (0, _extends2.default)({}, rootProps.slotProps?.baseSelectOption || {}, {
|
|
@@ -77,7 +77,7 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
77
77
|
if (resolvedValueOptions !== undefined) {
|
|
78
78
|
const itemValueIndexes = item.value.map(element => {
|
|
79
79
|
// Gets the index matching between values and valueOptions
|
|
80
|
-
return resolvedFormattedValueOptions?.findIndex(
|
|
80
|
+
return resolvedFormattedValueOptions?.findIndex(formattedOption => formattedOption === element);
|
|
81
81
|
});
|
|
82
82
|
return itemValueIndexes.filter(index => index >= 0).map(index => resolvedValueOptions[index]);
|
|
83
83
|
}
|
|
@@ -7,12 +7,12 @@ exports.unwrapGroupingColumnModel = exports.getColumnGroupsHeaderStructure = voi
|
|
|
7
7
|
var _gridColumnGrouping = require("../../../models/gridColumnGrouping");
|
|
8
8
|
var _utils = require("../../../utils/utils");
|
|
9
9
|
// This is the recurrence function that help writing `unwrapGroupingColumnModel()`
|
|
10
|
-
const recurrentUnwrapGroupingColumnModel = (columnGroupNode, parents,
|
|
10
|
+
const recurrentUnwrapGroupingColumnModel = (columnGroupNode, parents, unwrappedGroupingModelToComplete) => {
|
|
11
11
|
if ((0, _gridColumnGrouping.isLeaf)(columnGroupNode)) {
|
|
12
|
-
if (
|
|
13
|
-
throw new Error([`MUI: columnGroupingModel contains duplicated field`, `column field ${columnGroupNode.field}
|
|
12
|
+
if (unwrappedGroupingModelToComplete[columnGroupNode.field] !== undefined) {
|
|
13
|
+
throw new Error([`MUI: columnGroupingModel contains duplicated field`, `column field ${columnGroupNode.field} occurs two times in the grouping model:`, `- ${unwrappedGroupingModelToComplete[columnGroupNode.field].join(' > ')}`, `- ${parents.join(' > ')}`].join('\n'));
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
unwrappedGroupingModelToComplete[columnGroupNode.field] = parents;
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
18
|
const {
|
|
@@ -20,7 +20,7 @@ const recurrentUnwrapGroupingColumnModel = (columnGroupNode, parents, unwrappedG
|
|
|
20
20
|
children
|
|
21
21
|
} = columnGroupNode;
|
|
22
22
|
children.forEach(child => {
|
|
23
|
-
recurrentUnwrapGroupingColumnModel(child, [...parents, groupId],
|
|
23
|
+
recurrentUnwrapGroupingColumnModel(child, [...parents, groupId], unwrappedGroupingModelToComplete);
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
26
|
|
|
@@ -77,7 +77,7 @@ const useGridCellEditing = (apiRef, props) => {
|
|
|
77
77
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
78
78
|
if (params.cellMode === _gridEditRowModel.GridCellModes.Edit) {
|
|
79
79
|
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
80
|
-
// TODO: `event.which` is
|
|
80
|
+
// TODO: `event.which` is deprecated but this is a temporary workaround
|
|
81
81
|
if (event.which === 229) {
|
|
82
82
|
return;
|
|
83
83
|
}
|
|
@@ -57,7 +57,7 @@ const useGridEditing = (apiRef, props) => {
|
|
|
57
57
|
clearTimeout(timeout);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
// To run the callback
|
|
60
|
+
// To run the callback immediately without waiting the timeout
|
|
61
61
|
const runImmediately = () => {
|
|
62
62
|
const [timeout] = debounceMap.current[id][field];
|
|
63
63
|
clearTimeout(timeout);
|
|
@@ -112,7 +112,7 @@ const useGridRowEditing = (apiRef, props) => {
|
|
|
112
112
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
113
113
|
if (params.cellMode === _gridEditRowModel.GridRowModes.Edit) {
|
|
114
114
|
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
115
|
-
// TODO: `event.which` is
|
|
115
|
+
// TODO: `event.which` is deprecated but this is a temporary workaround
|
|
116
116
|
if (event.which === 229) {
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
@@ -28,6 +28,15 @@ function raf() {
|
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
+
function buildPrintWindow(title) {
|
|
32
|
+
const iframeEl = document.createElement('iframe');
|
|
33
|
+
iframeEl.style.position = 'absolute';
|
|
34
|
+
iframeEl.style.width = '0px';
|
|
35
|
+
iframeEl.style.height = '0px';
|
|
36
|
+
iframeEl.title = title || document.title;
|
|
37
|
+
return iframeEl;
|
|
38
|
+
}
|
|
39
|
+
|
|
31
40
|
/**
|
|
32
41
|
* @requires useGridColumns (state)
|
|
33
42
|
* @requires useGridFilter (state)
|
|
@@ -66,16 +75,6 @@ const useGridPrintExport = (apiRef, props) => {
|
|
|
66
75
|
apiRef.current.setColumnVisibilityModel(newColumnVisibilityModel);
|
|
67
76
|
resolve();
|
|
68
77
|
}), [apiRef]);
|
|
69
|
-
|
|
70
|
-
// TODO move outside of this scope and remove React.useCallback
|
|
71
|
-
const buildPrintWindow = React.useCallback(title => {
|
|
72
|
-
const iframeEl = document.createElement('iframe');
|
|
73
|
-
iframeEl.style.position = 'absolute';
|
|
74
|
-
iframeEl.style.width = '0px';
|
|
75
|
-
iframeEl.style.height = '0px';
|
|
76
|
-
iframeEl.title = title || document.title;
|
|
77
|
-
return iframeEl;
|
|
78
|
-
}, []);
|
|
79
78
|
const handlePrintWindowLoad = React.useCallback((printWindow, options) => {
|
|
80
79
|
const normalizeOptions = (0, _extends2.default)({
|
|
81
80
|
copyStyles: true,
|
|
@@ -218,7 +217,7 @@ const useGridPrintExport = (apiRef, props) => {
|
|
|
218
217
|
};
|
|
219
218
|
doc.current.body.appendChild(printWindow);
|
|
220
219
|
}
|
|
221
|
-
}, [props, logger, apiRef,
|
|
220
|
+
}, [props, logger, apiRef, handlePrintWindowLoad, handlePrintWindowAfterPrint, updateGridColumnsForPrint]);
|
|
222
221
|
const printExportApi = {
|
|
223
222
|
exportDataAsPrint
|
|
224
223
|
};
|
package/node/index.js
CHANGED