@mui/x-data-grid 7.0.0-alpha.6 → 7.0.0-alpha.7
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 +185 -3
- package/DataGrid/DataGrid.js +6 -2
- package/components/GridPagination.d.ts +2 -2
- package/hooks/features/filter/gridFilterUtils.js +21 -24
- package/index.js +1 -1
- package/legacy/DataGrid/DataGrid.js +6 -2
- package/legacy/hooks/features/filter/gridFilterUtils.js +20 -17
- package/legacy/index.js +1 -1
- package/legacy/locales/csCZ.js +2 -2
- package/locales/csCZ.js +2 -2
- package/models/props/DataGridProps.d.ts +0 -1
- package/modern/DataGrid/DataGrid.js +6 -2
- package/modern/hooks/features/filter/gridFilterUtils.js +21 -24
- package/modern/index.js +1 -1
- package/modern/locales/csCZ.js +2 -2
- package/node/DataGrid/DataGrid.js +6 -2
- package/node/hooks/features/filter/gridFilterUtils.js +21 -23
- package/node/index.js +1 -1
- package/node/locales/csCZ.js +2 -2
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,146 @@
|
|
|
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
|
+
## 7.0.0-alpha.7
|
|
7
|
+
|
|
8
|
+
_Jan 5, 2024_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🎁 New component to create a Tree View from a structured data source:
|
|
13
|
+
|
|
14
|
+
You can now directly pass your data to the `RichTreeView` component instead of manually converting it into JSX `TreeItem` components:
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
const ITEMS = [
|
|
18
|
+
{
|
|
19
|
+
id: 'node-1',
|
|
20
|
+
label: 'Node 1',
|
|
21
|
+
children: [
|
|
22
|
+
{ id: 'node-1-1', label: Node 1.1' },
|
|
23
|
+
{ id: 'node-1-2', label: Node 1.2' },
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: 'node-2',
|
|
28
|
+
label: 'Node 2',
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
<RichTreeView
|
|
33
|
+
items={MUI_X_PRODUCTS}
|
|
34
|
+
defaultCollapseIcon={<ExpandMoreIcon />}
|
|
35
|
+
defaultExpandIcon={<ChevronRightIcon />}
|
|
36
|
+
/>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
- 🌍 Improve Czech (cs-CZ) locale on the Data Grid
|
|
40
|
+
- 🐞 Bugfixes
|
|
41
|
+
|
|
42
|
+
### Data Grid
|
|
43
|
+
|
|
44
|
+
#### `@mui/x-data-grid@7.0.0-alpha.7`
|
|
45
|
+
|
|
46
|
+
- [DataGrid] Don't evaluate `hasEval` when `disableEval` is set (#11516) @reihwald
|
|
47
|
+
- [DataGrid] follow warning message guideline for `autoPageSize` and `autoHeight` (#11585) @Sboonny
|
|
48
|
+
- [DataGrid] Replace `eval` with `new Function` (#11557) @oliviertassinari
|
|
49
|
+
- [DataGrid] Warn devs when `autoPageSize` is used with `autoHeight` (#11554) @Sboonny
|
|
50
|
+
- [l10n] Improve Czech (cs-CZ) locale (#11526) @fdebef
|
|
51
|
+
|
|
52
|
+
#### `@mui/x-data-grid-pro@7.0.0-alpha.7` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
53
|
+
|
|
54
|
+
Same changes as in `@mui/x-data-grid@7.0.0-alpha.7`.
|
|
55
|
+
|
|
56
|
+
#### `@mui/x-data-grid-premium@7.0.0-alpha.7` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
57
|
+
|
|
58
|
+
Same changes as in `@mui/x-data-grid-pro@7.0.0-alpha.7`.
|
|
59
|
+
|
|
60
|
+
### Date Pickers
|
|
61
|
+
|
|
62
|
+
#### `@mui/x-date-pickers@7.0.0-alpha.7`
|
|
63
|
+
|
|
64
|
+
- [pickers] Fix views management (#11419) @LukasTy
|
|
65
|
+
|
|
66
|
+
#### `@mui/x-date-pickers-pro@7.0.0-alpha.7` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
67
|
+
|
|
68
|
+
Same changes as in `@mui/x-date-pickers@7.0.0-alpha.7`.
|
|
69
|
+
|
|
70
|
+
### Charts / `@mui/x-charts@7.0.0-alpha.7`
|
|
71
|
+
|
|
72
|
+
- [charts] Add `arcLabelRadius` property (#11487) @alexfauquette
|
|
73
|
+
- [charts] Fix `null` in line chart using dataset (#11550) @alexfauquette
|
|
74
|
+
|
|
75
|
+
### Tree View
|
|
76
|
+
|
|
77
|
+
#### Breaking changes
|
|
78
|
+
|
|
79
|
+
- The expansion props have been renamed to better describe their behaviors:
|
|
80
|
+
|
|
81
|
+
| Old name | New name |
|
|
82
|
+
| :---------------- | :---------------------- |
|
|
83
|
+
| `onNodeToggle` | `onExpandedNodesChange` |
|
|
84
|
+
| `expanded` | `expandedNodes` |
|
|
85
|
+
| `defaultExpanded` | `defaultExpandedNodes` |
|
|
86
|
+
|
|
87
|
+
```diff
|
|
88
|
+
<TreeView
|
|
89
|
+
- onNodeToggle={handleExpansionChange}
|
|
90
|
+
+ onExpandedNodesChange={handleExpansionChange}
|
|
91
|
+
|
|
92
|
+
- expanded={expandedNodes}
|
|
93
|
+
+ expandedNodes={expandedNodes}
|
|
94
|
+
|
|
95
|
+
- defaultExpanded={defaultExpandedNodes}
|
|
96
|
+
+ defaultExpandedNodes={defaultExpandedNodes}
|
|
97
|
+
/>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
- The selection props have been renamed to better describe their behaviors:
|
|
101
|
+
|
|
102
|
+
| Old name | New name |
|
|
103
|
+
| :---------------- | :---------------------- |
|
|
104
|
+
| `onNodeSelect` | `onSelectedNodesChange` |
|
|
105
|
+
| `selected` | `selectedNodes` |
|
|
106
|
+
| `defaultSelected` | `defaultSelectedNodes` |
|
|
107
|
+
|
|
108
|
+
```diff
|
|
109
|
+
<TreeView
|
|
110
|
+
- onNodeSelect={handleSelectionChange}
|
|
111
|
+
+ onSelectedNodesChange={handleSelectionChange}
|
|
112
|
+
|
|
113
|
+
- selected={selectedNodes}
|
|
114
|
+
+ selectedNodes={selectedNodes}
|
|
115
|
+
|
|
116
|
+
- defaultSelected={defaultSelectedNodes}
|
|
117
|
+
+ defaultSelectedNodes={defaultSelectedNodes}
|
|
118
|
+
/>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
#### `@mui/x-tree-view@7.0.0-alpha.7`
|
|
122
|
+
|
|
123
|
+
- [TreeView] Improve the expansion API (#11476) @flaviendelangle
|
|
124
|
+
- [TreeView] Improve the selection API (#11560) @flaviendelangle
|
|
125
|
+
- [TreeView] Introduce the `items` prop (#11059) @flaviendelangle
|
|
126
|
+
|
|
127
|
+
### Docs
|
|
128
|
+
|
|
129
|
+
- [docs] Add example for TreeView `onNodeExpansionToggle` prop (#11547) @flaviendelangle
|
|
130
|
+
- [docs] Clarify Pickers usage with Luxon (#11545) @LukasTy
|
|
131
|
+
- [docs] Complete transition to next branch (#11521) @oliviertassinari
|
|
132
|
+
- [docs] Fix 404 links in the docs @oliviertassinari
|
|
133
|
+
- [docs] Fix over page fetching @oliviertassinari
|
|
134
|
+
- [docs] Lint `next.config.js` (#11514) @oliviertassinari
|
|
135
|
+
|
|
136
|
+
### Core
|
|
137
|
+
|
|
138
|
+
- [core] Fix release changelog (#11496) @romgrk
|
|
139
|
+
- [core] Fix use of ::before & ::after (#11515) @oliviertassinari
|
|
140
|
+
- [core] Localize the issue template to MUI X (#11511) @oliviertassinari
|
|
141
|
+
- [core] Regen api files (#11542) @flaviendelangle
|
|
142
|
+
- [core] Remove issue emoji @oliviertassinari
|
|
143
|
+
- [core] Sync the release instructions with MUI Core @oliviertassinari
|
|
144
|
+
- [core] Yaml format match most common convention @oliviertassinari
|
|
145
|
+
|
|
6
146
|
## 7.0.0-alpha.6
|
|
7
147
|
|
|
8
148
|
_Dec 22, 2023_
|
|
@@ -65,7 +205,6 @@ Same changes as in `@mui/x-data-grid-pro@7.0.0-alpha.6`.
|
|
|
65
205
|
- [fields] Adjust `PickersInput` sizing styles (#11392) @noraleonte
|
|
66
206
|
- [fields] Fix section pasting (#11447) @LukasTy
|
|
67
207
|
- [pickers] Add `PickersTextField` `standard` and `filled` variants (#11250) @noraleonte
|
|
68
|
-
- [pickers] Add missing breaking changes to changelog (#11420) @MBilalShafi
|
|
69
208
|
- [pickers] Cleanup error messages in `PickersSectionList` (#11449) @flaviendelangle
|
|
70
209
|
- [pickers] Create new component `PickersSectionList` (#11352) @flaviendelangle
|
|
71
210
|
|
|
@@ -73,7 +212,7 @@ Same changes as in `@mui/x-data-grid-pro@7.0.0-alpha.6`.
|
|
|
73
212
|
|
|
74
213
|
Same changes as in `@mui/x-date-pickers@7.0.0-alpha.6`.
|
|
75
214
|
|
|
76
|
-
### Charts / `@mui/x-charts@7.0.0-alpha.
|
|
215
|
+
### Charts / `@mui/x-charts@7.0.0-alpha.5`
|
|
77
216
|
|
|
78
217
|
- [charts] Allow percentage values for pie chart center and radius (#11464) @alexfauquette
|
|
79
218
|
- [charts] Improve dataset typing (#11372) @alexfauquette
|
|
@@ -88,6 +227,7 @@ Same changes as in `@mui/x-date-pickers@7.0.0-alpha.6`.
|
|
|
88
227
|
|
|
89
228
|
### Core
|
|
90
229
|
|
|
230
|
+
- [core] Add missing breaking changes to changelog (#11420) @MBilalShafi
|
|
91
231
|
- [core] Cherry pick follow up (#11469) @LukasTy
|
|
92
232
|
- [core] Fix `cherry-pick` action (#11446) @LukasTy
|
|
93
233
|
- [core] Fix security regressions in cherry-pick-next-to-master.yml (#11482) @MBilalShafi
|
|
@@ -1200,6 +1340,48 @@ Here is an example of the renaming for the `<ChartsTooltip />` component.
|
|
|
1200
1340
|
- [core] Update release instructions as per v7 configuration (#10962) @MBilalShafi
|
|
1201
1341
|
- [license] Correctly throw errors (#10924) @oliviertassinari
|
|
1202
1342
|
|
|
1343
|
+
## 6.18.7
|
|
1344
|
+
|
|
1345
|
+
_Jan 5, 2024_
|
|
1346
|
+
|
|
1347
|
+
We'd like to offer a big thanks to the 4 contributors who made this release possible. Here are some highlights ✨:
|
|
1348
|
+
|
|
1349
|
+
- 🌍 Improve Czech (cs-CZ) locale on Data Grid (#11429) @wensiet
|
|
1350
|
+
- 🐞 Bugfixes
|
|
1351
|
+
|
|
1352
|
+
### Data Grid
|
|
1353
|
+
|
|
1354
|
+
#### `@mui/x-data-grid@6.18.7`
|
|
1355
|
+
|
|
1356
|
+
- [DataGrid] Don't evaluate `hasEval` when `disableEval` is set (#11553) @reihwald
|
|
1357
|
+
- [l10n] Update Czech (cs-CZ) locale (#11498) @fdebef
|
|
1358
|
+
|
|
1359
|
+
#### `@mui/x-data-grid-pro@6.18.7` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
1360
|
+
|
|
1361
|
+
Same changes as in `@mui/x-data-grid@6.18.7`.
|
|
1362
|
+
|
|
1363
|
+
#### `@mui/x-data-grid-premium@6.18.7` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
1364
|
+
|
|
1365
|
+
Same changes as in `@mui/x-data-grid-pro@6.18.7`.
|
|
1366
|
+
|
|
1367
|
+
### Date Pickers
|
|
1368
|
+
|
|
1369
|
+
#### `@mui/x-date-pickers@6.18.7`
|
|
1370
|
+
|
|
1371
|
+
- [pickers] Fix views management (@LukasTy) (#11572)
|
|
1372
|
+
|
|
1373
|
+
#### `@mui/x-date-pickers-pro@6.18.7` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
1374
|
+
|
|
1375
|
+
Same changes as in `@mui/x-date-pickers@6.18.7`.
|
|
1376
|
+
|
|
1377
|
+
### Charts / `@mui/x-charts@6.18.7`
|
|
1378
|
+
|
|
1379
|
+
- [charts] Fix `null` in line chart using dataset (@alexfauquette) (#11561)
|
|
1380
|
+
|
|
1381
|
+
### Docs
|
|
1382
|
+
|
|
1383
|
+
- [docs] Clarify Pickers usage with Luxon (#11566) @LukasTy
|
|
1384
|
+
|
|
1203
1385
|
## 6.18.6
|
|
1204
1386
|
|
|
1205
1387
|
_Dec 22, 2023_
|
|
@@ -1234,7 +1416,7 @@ Same changes as in `@mui/x-data-grid-pro@6.18.6`.
|
|
|
1234
1416
|
|
|
1235
1417
|
Same changes as in `@mui/x-date-pickers@6.18.6`.
|
|
1236
1418
|
|
|
1237
|
-
### Charts / `@mui/x-charts@6.18.
|
|
1419
|
+
### Charts / `@mui/x-charts@6.18.4`
|
|
1238
1420
|
|
|
1239
1421
|
- [charts] Allow percentage values for pie chart center and radius (#11464) @alexfauquette
|
|
1240
1422
|
- [charts] Make error message more explicit (#11457) @alexfauquette
|
package/DataGrid/DataGrid.js
CHANGED
|
@@ -63,7 +63,12 @@ DataGridRaw.propTypes = {
|
|
|
63
63
|
* If `true`, the pageSize is calculated according to the container size and the max number of rows to avoid rendering a vertical scroll bar.
|
|
64
64
|
* @default false
|
|
65
65
|
*/
|
|
66
|
-
autoPageSize: PropTypes.bool,
|
|
66
|
+
autoPageSize: chainPropTypes(PropTypes.bool, props => {
|
|
67
|
+
if (props.autoHeight && props.autoPageSize) {
|
|
68
|
+
return new Error(['MUI: `<DataGrid autoPageSize={true} autoHeight={true} />` are not valid props.', 'You can not use both the `autoPageSize` and `autoHeight` props at the same time because `autoHeight` scales the height of the Data Grid according to the `pageSize`.', '', 'Please remove one of these two props.'].join('\n'));
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}),
|
|
67
72
|
/**
|
|
68
73
|
* Controls the modes of the cells.
|
|
69
74
|
*/
|
|
@@ -141,7 +146,6 @@ DataGridRaw.propTypes = {
|
|
|
141
146
|
/**
|
|
142
147
|
* If `true`, `eval()` is not used for performance optimization.
|
|
143
148
|
* @default false
|
|
144
|
-
* @ignore - do not document
|
|
145
149
|
*/
|
|
146
150
|
disableEval: PropTypes.bool,
|
|
147
151
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export declare const GridPagination: React.ForwardRefExoticComponent<(Omit<Partial<import("@mui/material/TablePagination").TablePaginationOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<import("@mui/material/TablePagination").TablePaginationBaseProps, "hidden" | "color" | "page" | "content" | "size" | "style" | "height" | "translate" | "width" | "padding" | "disabled" | "abbr" | "slot" | "title" | "ref" | "colSpan" | "headers" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "rowSpan" | "scope" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "align" | "valign" | "sx" | "classes" | "variant" | "slotProps" | "count" | "getItemAriaLabel" | "onPageChange" | "rowsPerPage" | "showFirstButton" | "showLastButton" | "labelDisplayedRows" | "labelRowsPerPage" | "onRowsPerPageChange" | "rowsPerPageOptions" | "backIconButtonProps" | "nextIconButtonProps" | "sortDirection" | "ActionsComponent" | "SelectProps"> & {
|
|
2
|
+
export declare const GridPagination: React.ForwardRefExoticComponent<(Omit<Partial<import("@mui/material/TablePagination").TablePaginationOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<import("@mui/material/TablePagination").TablePaginationBaseProps, "hidden" | "color" | "page" | "content" | "size" | "style" | "height" | "translate" | "width" | "padding" | "disabled" | "abbr" | "slot" | "title" | "ref" | "colSpan" | "headers" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "rowSpan" | "scope" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "align" | "valign" | "sx" | "classes" | "variant" | "slotProps" | "slots" | "count" | "getItemAriaLabel" | "onPageChange" | "rowsPerPage" | "showFirstButton" | "showLastButton" | "labelDisplayedRows" | "labelRowsPerPage" | "onRowsPerPageChange" | "rowsPerPageOptions" | "backIconButtonProps" | "nextIconButtonProps" | "sortDirection" | "ActionsComponent" | "SelectProps"> & {
|
|
3
3
|
component?: React.ElementType<any> | undefined;
|
|
4
|
-
}>, "ref"> | Omit<Partial<import("@mui/material/TablePagination").TablePaginationOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("@mui/material/TablePagination").TablePaginationBaseProps, "ref"> & React.RefAttributes<React.Component<any, any, any>>, "hidden" | "color" | "page" | "content" | "size" | "style" | "height" | "translate" | "width" | "padding" | "disabled" | "abbr" | "slot" | "title" | "ref" | "colSpan" | "headers" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "rowSpan" | "scope" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "align" | "valign" | "sx" | "classes" | "variant" | "slotProps" | "count" | "getItemAriaLabel" | "onPageChange" | "rowsPerPage" | "showFirstButton" | "showLastButton" | "labelDisplayedRows" | "labelRowsPerPage" | "onRowsPerPageChange" | "rowsPerPageOptions" | "backIconButtonProps" | "nextIconButtonProps" | "sortDirection" | "ActionsComponent" | "SelectProps"> & {
|
|
4
|
+
}>, "ref"> | Omit<Partial<import("@mui/material/TablePagination").TablePaginationOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("@mui/material/TablePagination").TablePaginationBaseProps, "ref"> & React.RefAttributes<React.Component<any, any, any>>, "hidden" | "color" | "page" | "content" | "size" | "style" | "height" | "translate" | "width" | "padding" | "disabled" | "abbr" | "slot" | "title" | "ref" | "colSpan" | "headers" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "rowSpan" | "scope" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "align" | "valign" | "sx" | "classes" | "variant" | "slotProps" | "slots" | "count" | "getItemAriaLabel" | "onPageChange" | "rowsPerPage" | "showFirstButton" | "showLastButton" | "labelDisplayedRows" | "labelRowsPerPage" | "onRowsPerPageChange" | "rowsPerPageOptions" | "backIconButtonProps" | "nextIconButtonProps" | "sortDirection" | "ActionsComponent" | "SelectProps"> & {
|
|
5
5
|
component?: React.ElementType<any> | undefined;
|
|
6
6
|
}>, "ref">) & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -4,15 +4,17 @@ import { getDefaultGridFilterModel } from './gridFilterState';
|
|
|
4
4
|
import { buildWarning } from '../../../utils/warning';
|
|
5
5
|
import { getPublicApiRef } from '../../../utils/getPublicApiRef';
|
|
6
6
|
import { gridColumnFieldsSelector, gridColumnLookupSelector, gridVisibleColumnFieldsSelector } from '../columns';
|
|
7
|
-
|
|
8
|
-
// Fixes https://github.com/mui/mui-x/issues/10056
|
|
9
|
-
const globalScope = typeof window === 'undefined' ? globalThis : window;
|
|
10
|
-
const evalCode = globalScope[atob('ZXZhbA==')];
|
|
11
7
|
let hasEval;
|
|
12
|
-
|
|
13
|
-
hasEval
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
function getHasEval() {
|
|
9
|
+
if (hasEval !== undefined) {
|
|
10
|
+
return hasEval;
|
|
11
|
+
}
|
|
12
|
+
try {
|
|
13
|
+
hasEval = new Function('return true')();
|
|
14
|
+
} catch (_) {
|
|
15
|
+
hasEval = false;
|
|
16
|
+
}
|
|
17
|
+
return hasEval;
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
20
|
* Adds default values to the optional fields of a filter items.
|
|
@@ -140,7 +142,7 @@ const buildAggregatedFilterItemsApplier = (filterModel, apiRef, disableEval) =>
|
|
|
140
142
|
if (appliers.length === 0) {
|
|
141
143
|
return null;
|
|
142
144
|
}
|
|
143
|
-
if (
|
|
145
|
+
if (disableEval || !getHasEval()) {
|
|
144
146
|
// This is the original logic, which is used if `eval()` is not supported (aka prevented by CSP).
|
|
145
147
|
return (row, shouldApplyFilter) => {
|
|
146
148
|
const resultPerItemId = {};
|
|
@@ -154,25 +156,20 @@ const buildAggregatedFilterItemsApplier = (filterModel, apiRef, disableEval) =>
|
|
|
154
156
|
};
|
|
155
157
|
}
|
|
156
158
|
|
|
157
|
-
// We generate a new function with `
|
|
159
|
+
// We generate a new function with `new Function()` to avoid expensive patterns for JS engines
|
|
158
160
|
// such as a dynamic object assignment, e.g. `{ [dynamicKey]: value }`.
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
+
const filterItemCore = new Function('appliers', 'row', 'shouldApplyFilter', `"use strict";
|
|
162
|
+
${appliers.map((applier, i) => `const shouldApply${i} = !shouldApplyFilter || shouldApplyFilter(${JSON.stringify(applier.item.field)});`).join('\n')}
|
|
161
163
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
false :
|
|
166
|
-
appliers[${i}].fn(row),
|
|
167
|
-
`).join('\n')}};
|
|
164
|
+
const result$$ = {
|
|
165
|
+
${appliers.map((applier, i) => ` ${JSON.stringify(String(applier.item.id))}: !shouldApply${i} ? false : appliers[${i}].fn(row),`).join('\n')}
|
|
166
|
+
};
|
|
168
167
|
|
|
169
|
-
|
|
170
|
-
})`;
|
|
171
|
-
const filterItemCore = evalCode(filterItemTemplate.replaceAll('$$', String(filterItemsApplierId)));
|
|
172
|
-
const filterItem = (row, shouldApplyItem) => {
|
|
173
|
-
return filterItemCore(apiRef.current.getRowId, appliers, row, shouldApplyItem);
|
|
174
|
-
};
|
|
168
|
+
return result$$;`.replaceAll('$$', String(filterItemsApplierId)));
|
|
175
169
|
filterItemsApplierId += 1;
|
|
170
|
+
|
|
171
|
+
// Assign to the arrow function a name to help debugging
|
|
172
|
+
const filterItem = (row, shouldApplyItem) => filterItemCore(appliers, row, shouldApplyItem);
|
|
176
173
|
return filterItem;
|
|
177
174
|
};
|
|
178
175
|
export const shouldQuickFilterExcludeHiddenColumns = filterModel => {
|
package/index.js
CHANGED
|
@@ -63,7 +63,12 @@ DataGridRaw.propTypes = {
|
|
|
63
63
|
* If `true`, the pageSize is calculated according to the container size and the max number of rows to avoid rendering a vertical scroll bar.
|
|
64
64
|
* @default false
|
|
65
65
|
*/
|
|
66
|
-
autoPageSize: PropTypes.bool,
|
|
66
|
+
autoPageSize: chainPropTypes(PropTypes.bool, function (props) {
|
|
67
|
+
if (props.autoHeight && props.autoPageSize) {
|
|
68
|
+
return new Error(['MUI: `<DataGrid autoPageSize={true} autoHeight={true} />` are not valid props.', 'You can not use both the `autoPageSize` and `autoHeight` props at the same time because `autoHeight` scales the height of the Data Grid according to the `pageSize`.', '', 'Please remove one of these two props.'].join('\n'));
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}),
|
|
67
72
|
/**
|
|
68
73
|
* Controls the modes of the cells.
|
|
69
74
|
*/
|
|
@@ -143,7 +148,6 @@ DataGridRaw.propTypes = {
|
|
|
143
148
|
/**
|
|
144
149
|
* If `true`, `eval()` is not used for performance optimization.
|
|
145
150
|
* @default false
|
|
146
|
-
* @ignore - do not document
|
|
147
151
|
*/
|
|
148
152
|
disableEval: PropTypes.bool,
|
|
149
153
|
/**
|
|
@@ -4,15 +4,17 @@ import { getDefaultGridFilterModel } from './gridFilterState';
|
|
|
4
4
|
import { buildWarning } from '../../../utils/warning';
|
|
5
5
|
import { getPublicApiRef } from '../../../utils/getPublicApiRef';
|
|
6
6
|
import { gridColumnFieldsSelector, gridColumnLookupSelector, gridVisibleColumnFieldsSelector } from '../columns';
|
|
7
|
-
|
|
8
|
-
// Fixes https://github.com/mui/mui-x/issues/10056
|
|
9
|
-
var globalScope = typeof window === 'undefined' ? globalThis : window;
|
|
10
|
-
var evalCode = globalScope[atob('ZXZhbA==')];
|
|
11
7
|
var hasEval;
|
|
12
|
-
|
|
13
|
-
hasEval
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
function getHasEval() {
|
|
9
|
+
if (hasEval !== undefined) {
|
|
10
|
+
return hasEval;
|
|
11
|
+
}
|
|
12
|
+
try {
|
|
13
|
+
hasEval = new Function('return true')();
|
|
14
|
+
} catch (_) {
|
|
15
|
+
hasEval = false;
|
|
16
|
+
}
|
|
17
|
+
return hasEval;
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
20
|
* Adds default values to the optional fields of a filter items.
|
|
@@ -154,7 +156,7 @@ var buildAggregatedFilterItemsApplier = function buildAggregatedFilterItemsAppli
|
|
|
154
156
|
if (appliers.length === 0) {
|
|
155
157
|
return null;
|
|
156
158
|
}
|
|
157
|
-
if (
|
|
159
|
+
if (disableEval || !getHasEval()) {
|
|
158
160
|
// This is the original logic, which is used if `eval()` is not supported (aka prevented by CSP).
|
|
159
161
|
return function (row, shouldApplyFilter) {
|
|
160
162
|
var resultPerItemId = {};
|
|
@@ -168,18 +170,19 @@ var buildAggregatedFilterItemsApplier = function buildAggregatedFilterItemsAppli
|
|
|
168
170
|
};
|
|
169
171
|
}
|
|
170
172
|
|
|
171
|
-
// We generate a new function with `
|
|
173
|
+
// We generate a new function with `new Function()` to avoid expensive patterns for JS engines
|
|
172
174
|
// such as a dynamic object assignment, e.g. `{ [dynamicKey]: value }`.
|
|
173
|
-
var
|
|
175
|
+
var filterItemCore = new Function('appliers', 'row', 'shouldApplyFilter', "\"use strict\";\n".concat(appliers.map(function (applier, i) {
|
|
174
176
|
return "const shouldApply".concat(i, " = !shouldApplyFilter || shouldApplyFilter(").concat(JSON.stringify(applier.item.field), ");");
|
|
175
|
-
}).join('\n'), "\n\
|
|
176
|
-
return "".concat(JSON.stringify(String(applier.item.id)), "
|
|
177
|
-
}).join('\n'), "};\n\
|
|
178
|
-
|
|
177
|
+
}).join('\n'), "\n\nconst result$$ = {\n").concat(appliers.map(function (applier, i) {
|
|
178
|
+
return " ".concat(JSON.stringify(String(applier.item.id)), ": !shouldApply").concat(i, " ? false : appliers[").concat(i, "].fn(row),");
|
|
179
|
+
}).join('\n'), "\n};\n\nreturn result$$;").replaceAll('$$', String(filterItemsApplierId)));
|
|
180
|
+
filterItemsApplierId += 1;
|
|
181
|
+
|
|
182
|
+
// Assign to the arrow function a name to help debugging
|
|
179
183
|
var filterItem = function filterItem(row, shouldApplyItem) {
|
|
180
|
-
return filterItemCore(
|
|
184
|
+
return filterItemCore(appliers, row, shouldApplyItem);
|
|
181
185
|
};
|
|
182
|
-
filterItemsApplierId += 1;
|
|
183
186
|
return filterItem;
|
|
184
187
|
};
|
|
185
188
|
export var shouldQuickFilterExcludeHiddenColumns = function shouldQuickFilterExcludeHiddenColumns(filterModel) {
|
package/legacy/index.js
CHANGED
package/legacy/locales/csCZ.js
CHANGED
|
@@ -160,10 +160,10 @@ var csCZGrid = {
|
|
|
160
160
|
// Grouping columns
|
|
161
161
|
groupingColumnHeaderName: 'Skupina',
|
|
162
162
|
groupColumn: function groupColumn(name) {
|
|
163
|
-
return "
|
|
163
|
+
return "Seskupit podle ".concat(name);
|
|
164
164
|
},
|
|
165
165
|
unGroupColumn: function unGroupColumn(name) {
|
|
166
|
-
return "P\u0159estat
|
|
166
|
+
return "P\u0159estat seskupovat podle ".concat(name);
|
|
167
167
|
},
|
|
168
168
|
// Master/detail
|
|
169
169
|
detailPanelToggle: 'Přepnout detail panelu',
|
package/locales/csCZ.js
CHANGED
|
@@ -159,8 +159,8 @@ const csCZGrid = {
|
|
|
159
159
|
treeDataCollapse: 'skrýt potomky',
|
|
160
160
|
// Grouping columns
|
|
161
161
|
groupingColumnHeaderName: 'Skupina',
|
|
162
|
-
groupColumn: name => `
|
|
163
|
-
unGroupColumn: name => `Přestat
|
|
162
|
+
groupColumn: name => `Seskupit podle ${name}`,
|
|
163
|
+
unGroupColumn: name => `Přestat seskupovat podle ${name}`,
|
|
164
164
|
// Master/detail
|
|
165
165
|
detailPanelToggle: 'Přepnout detail panelu',
|
|
166
166
|
expandDetailPanel: 'Rozbalit',
|
|
@@ -63,7 +63,12 @@ DataGridRaw.propTypes = {
|
|
|
63
63
|
* If `true`, the pageSize is calculated according to the container size and the max number of rows to avoid rendering a vertical scroll bar.
|
|
64
64
|
* @default false
|
|
65
65
|
*/
|
|
66
|
-
autoPageSize: PropTypes.bool,
|
|
66
|
+
autoPageSize: chainPropTypes(PropTypes.bool, props => {
|
|
67
|
+
if (props.autoHeight && props.autoPageSize) {
|
|
68
|
+
return new Error(['MUI: `<DataGrid autoPageSize={true} autoHeight={true} />` are not valid props.', 'You can not use both the `autoPageSize` and `autoHeight` props at the same time because `autoHeight` scales the height of the Data Grid according to the `pageSize`.', '', 'Please remove one of these two props.'].join('\n'));
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}),
|
|
67
72
|
/**
|
|
68
73
|
* Controls the modes of the cells.
|
|
69
74
|
*/
|
|
@@ -141,7 +146,6 @@ DataGridRaw.propTypes = {
|
|
|
141
146
|
/**
|
|
142
147
|
* If `true`, `eval()` is not used for performance optimization.
|
|
143
148
|
* @default false
|
|
144
|
-
* @ignore - do not document
|
|
145
149
|
*/
|
|
146
150
|
disableEval: PropTypes.bool,
|
|
147
151
|
/**
|
|
@@ -4,15 +4,17 @@ import { getDefaultGridFilterModel } from './gridFilterState';
|
|
|
4
4
|
import { buildWarning } from '../../../utils/warning';
|
|
5
5
|
import { getPublicApiRef } from '../../../utils/getPublicApiRef';
|
|
6
6
|
import { gridColumnFieldsSelector, gridColumnLookupSelector, gridVisibleColumnFieldsSelector } from '../columns';
|
|
7
|
-
|
|
8
|
-
// Fixes https://github.com/mui/mui-x/issues/10056
|
|
9
|
-
const globalScope = typeof window === 'undefined' ? globalThis : window;
|
|
10
|
-
const evalCode = globalScope[atob('ZXZhbA==')];
|
|
11
7
|
let hasEval;
|
|
12
|
-
|
|
13
|
-
hasEval
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
function getHasEval() {
|
|
9
|
+
if (hasEval !== undefined) {
|
|
10
|
+
return hasEval;
|
|
11
|
+
}
|
|
12
|
+
try {
|
|
13
|
+
hasEval = new Function('return true')();
|
|
14
|
+
} catch (_) {
|
|
15
|
+
hasEval = false;
|
|
16
|
+
}
|
|
17
|
+
return hasEval;
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
20
|
* Adds default values to the optional fields of a filter items.
|
|
@@ -139,7 +141,7 @@ const buildAggregatedFilterItemsApplier = (filterModel, apiRef, disableEval) =>
|
|
|
139
141
|
if (appliers.length === 0) {
|
|
140
142
|
return null;
|
|
141
143
|
}
|
|
142
|
-
if (
|
|
144
|
+
if (disableEval || !getHasEval()) {
|
|
143
145
|
// This is the original logic, which is used if `eval()` is not supported (aka prevented by CSP).
|
|
144
146
|
return (row, shouldApplyFilter) => {
|
|
145
147
|
const resultPerItemId = {};
|
|
@@ -153,25 +155,20 @@ const buildAggregatedFilterItemsApplier = (filterModel, apiRef, disableEval) =>
|
|
|
153
155
|
};
|
|
154
156
|
}
|
|
155
157
|
|
|
156
|
-
// We generate a new function with `
|
|
158
|
+
// We generate a new function with `new Function()` to avoid expensive patterns for JS engines
|
|
157
159
|
// such as a dynamic object assignment, e.g. `{ [dynamicKey]: value }`.
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
+
const filterItemCore = new Function('appliers', 'row', 'shouldApplyFilter', `"use strict";
|
|
161
|
+
${appliers.map((applier, i) => `const shouldApply${i} = !shouldApplyFilter || shouldApplyFilter(${JSON.stringify(applier.item.field)});`).join('\n')}
|
|
160
162
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
false :
|
|
165
|
-
appliers[${i}].fn(row),
|
|
166
|
-
`).join('\n')}};
|
|
163
|
+
const result$$ = {
|
|
164
|
+
${appliers.map((applier, i) => ` ${JSON.stringify(String(applier.item.id))}: !shouldApply${i} ? false : appliers[${i}].fn(row),`).join('\n')}
|
|
165
|
+
};
|
|
167
166
|
|
|
168
|
-
|
|
169
|
-
})`;
|
|
170
|
-
const filterItemCore = evalCode(filterItemTemplate.replaceAll('$$', String(filterItemsApplierId)));
|
|
171
|
-
const filterItem = (row, shouldApplyItem) => {
|
|
172
|
-
return filterItemCore(apiRef.current.getRowId, appliers, row, shouldApplyItem);
|
|
173
|
-
};
|
|
167
|
+
return result$$;`.replaceAll('$$', String(filterItemsApplierId)));
|
|
174
168
|
filterItemsApplierId += 1;
|
|
169
|
+
|
|
170
|
+
// Assign to the arrow function a name to help debugging
|
|
171
|
+
const filterItem = (row, shouldApplyItem) => filterItemCore(appliers, row, shouldApplyItem);
|
|
175
172
|
return filterItem;
|
|
176
173
|
};
|
|
177
174
|
export const shouldQuickFilterExcludeHiddenColumns = filterModel => {
|
package/modern/index.js
CHANGED
package/modern/locales/csCZ.js
CHANGED
|
@@ -159,8 +159,8 @@ const csCZGrid = {
|
|
|
159
159
|
treeDataCollapse: 'skrýt potomky',
|
|
160
160
|
// Grouping columns
|
|
161
161
|
groupingColumnHeaderName: 'Skupina',
|
|
162
|
-
groupColumn: name => `
|
|
163
|
-
unGroupColumn: name => `Přestat
|
|
162
|
+
groupColumn: name => `Seskupit podle ${name}`,
|
|
163
|
+
unGroupColumn: name => `Přestat seskupovat podle ${name}`,
|
|
164
164
|
// Master/detail
|
|
165
165
|
detailPanelToggle: 'Přepnout detail panelu',
|
|
166
166
|
expandDetailPanel: 'Rozbalit',
|
|
@@ -71,7 +71,12 @@ DataGridRaw.propTypes = {
|
|
|
71
71
|
* If `true`, the pageSize is calculated according to the container size and the max number of rows to avoid rendering a vertical scroll bar.
|
|
72
72
|
* @default false
|
|
73
73
|
*/
|
|
74
|
-
autoPageSize: _propTypes.default.bool,
|
|
74
|
+
autoPageSize: (0, _utils.chainPropTypes)(_propTypes.default.bool, props => {
|
|
75
|
+
if (props.autoHeight && props.autoPageSize) {
|
|
76
|
+
return new Error(['MUI: `<DataGrid autoPageSize={true} autoHeight={true} />` are not valid props.', 'You can not use both the `autoPageSize` and `autoHeight` props at the same time because `autoHeight` scales the height of the Data Grid according to the `pageSize`.', '', 'Please remove one of these two props.'].join('\n'));
|
|
77
|
+
}
|
|
78
|
+
return null;
|
|
79
|
+
}),
|
|
75
80
|
/**
|
|
76
81
|
* Controls the modes of the cells.
|
|
77
82
|
*/
|
|
@@ -149,7 +154,6 @@ DataGridRaw.propTypes = {
|
|
|
149
154
|
/**
|
|
150
155
|
* If `true`, `eval()` is not used for performance optimization.
|
|
151
156
|
* @default false
|
|
152
|
-
* @ignore - do not document
|
|
153
157
|
*/
|
|
154
158
|
disableEval: _propTypes.default.bool,
|
|
155
159
|
/**
|
|
@@ -11,14 +11,17 @@ var _gridFilterState = require("./gridFilterState");
|
|
|
11
11
|
var _warning = require("../../../utils/warning");
|
|
12
12
|
var _getPublicApiRef = require("../../../utils/getPublicApiRef");
|
|
13
13
|
var _columns = require("../columns");
|
|
14
|
-
// Fixes https://github.com/mui/mui-x/issues/10056
|
|
15
|
-
const globalScope = typeof window === 'undefined' ? globalThis : window;
|
|
16
|
-
const evalCode = globalScope[atob('ZXZhbA==')];
|
|
17
14
|
let hasEval;
|
|
18
|
-
|
|
19
|
-
hasEval
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
function getHasEval() {
|
|
16
|
+
if (hasEval !== undefined) {
|
|
17
|
+
return hasEval;
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
hasEval = new Function('return true')();
|
|
21
|
+
} catch (_) {
|
|
22
|
+
hasEval = false;
|
|
23
|
+
}
|
|
24
|
+
return hasEval;
|
|
22
25
|
}
|
|
23
26
|
/**
|
|
24
27
|
* Adds default values to the optional fields of a filter items.
|
|
@@ -149,7 +152,7 @@ const buildAggregatedFilterItemsApplier = (filterModel, apiRef, disableEval) =>
|
|
|
149
152
|
if (appliers.length === 0) {
|
|
150
153
|
return null;
|
|
151
154
|
}
|
|
152
|
-
if (
|
|
155
|
+
if (disableEval || !getHasEval()) {
|
|
153
156
|
// This is the original logic, which is used if `eval()` is not supported (aka prevented by CSP).
|
|
154
157
|
return (row, shouldApplyFilter) => {
|
|
155
158
|
const resultPerItemId = {};
|
|
@@ -163,25 +166,20 @@ const buildAggregatedFilterItemsApplier = (filterModel, apiRef, disableEval) =>
|
|
|
163
166
|
};
|
|
164
167
|
}
|
|
165
168
|
|
|
166
|
-
// We generate a new function with `
|
|
169
|
+
// We generate a new function with `new Function()` to avoid expensive patterns for JS engines
|
|
167
170
|
// such as a dynamic object assignment, e.g. `{ [dynamicKey]: value }`.
|
|
168
|
-
const
|
|
169
|
-
|
|
171
|
+
const filterItemCore = new Function('appliers', 'row', 'shouldApplyFilter', `"use strict";
|
|
172
|
+
${appliers.map((applier, i) => `const shouldApply${i} = !shouldApplyFilter || shouldApplyFilter(${JSON.stringify(applier.item.field)});`).join('\n')}
|
|
170
173
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
false :
|
|
175
|
-
appliers[${i}].fn(row),
|
|
176
|
-
`).join('\n')}};
|
|
174
|
+
const result$$ = {
|
|
175
|
+
${appliers.map((applier, i) => ` ${JSON.stringify(String(applier.item.id))}: !shouldApply${i} ? false : appliers[${i}].fn(row),`).join('\n')}
|
|
176
|
+
};
|
|
177
177
|
|
|
178
|
-
|
|
179
|
-
})`;
|
|
180
|
-
const filterItemCore = evalCode(filterItemTemplate.replaceAll('$$', String(filterItemsApplierId)));
|
|
181
|
-
const filterItem = (row, shouldApplyItem) => {
|
|
182
|
-
return filterItemCore(apiRef.current.getRowId, appliers, row, shouldApplyItem);
|
|
183
|
-
};
|
|
178
|
+
return result$$;`.replaceAll('$$', String(filterItemsApplierId)));
|
|
184
179
|
filterItemsApplierId += 1;
|
|
180
|
+
|
|
181
|
+
// Assign to the arrow function a name to help debugging
|
|
182
|
+
const filterItem = (row, shouldApplyItem) => filterItemCore(appliers, row, shouldApplyItem);
|
|
185
183
|
return filterItem;
|
|
186
184
|
};
|
|
187
185
|
const shouldQuickFilterExcludeHiddenColumns = filterModel => {
|
package/node/index.js
CHANGED
package/node/locales/csCZ.js
CHANGED
|
@@ -165,8 +165,8 @@ const csCZGrid = {
|
|
|
165
165
|
treeDataCollapse: 'skrýt potomky',
|
|
166
166
|
// Grouping columns
|
|
167
167
|
groupingColumnHeaderName: 'Skupina',
|
|
168
|
-
groupColumn: name => `
|
|
169
|
-
unGroupColumn: name => `Přestat
|
|
168
|
+
groupColumn: name => `Seskupit podle ${name}`,
|
|
169
|
+
unGroupColumn: name => `Přestat seskupovat podle ${name}`,
|
|
170
170
|
// Master/detail
|
|
171
171
|
detailPanelToggle: 'Přepnout detail panelu',
|
|
172
172
|
expandDetailPanel: 'Rozbalit',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.7",
|
|
4
4
|
"description": "The community edition of the data grid component (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"directory": "packages/grid/x-data-grid"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@babel/runtime": "^7.23.
|
|
40
|
-
"@mui/system": "^5.15.
|
|
41
|
-
"@mui/utils": "^5.15.
|
|
39
|
+
"@babel/runtime": "^7.23.7",
|
|
40
|
+
"@mui/system": "^5.15.2",
|
|
41
|
+
"@mui/utils": "^5.15.2",
|
|
42
42
|
"clsx": "^2.0.0",
|
|
43
43
|
"prop-types": "^15.8.1",
|
|
44
44
|
"reselect": "^4.1.8"
|