@mui/x-data-grid 8.0.0-alpha.3 → 8.0.0-alpha.5
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 +377 -0
- package/DataGrid/DataGrid.js +7 -11
- package/DataGrid/useDataGridProps.js +3 -3
- package/README.md +1 -1
- package/components/GridRow.js +13 -2
- package/components/cell/GridActionsCell.js +8 -1
- package/components/cell/GridActionsCellItem.js +4 -6
- package/components/cell/GridCell.js +1 -1
- package/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.js +6 -11
- package/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.js +6 -11
- package/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.js +6 -11
- package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +13 -22
- package/components/panel/GridColumnsPanel.js +1 -2
- package/components/panel/GridPanelContent.js +7 -3
- package/components/panel/GridPanelFooter.d.ts +1 -1
- package/components/panel/GridPanelFooter.js +4 -3
- package/components/panel/filterPanel/GridFilterForm.js +15 -15
- package/components/toolbar/GridToolbarDensitySelector.js +3 -5
- package/components/toolbar/GridToolbarFilterButton.d.ts +1 -1
- package/components/toolbar/GridToolbarFilterButton.js +3 -0
- package/components/toolbar/GridToolbarQuickFilter.js +27 -23
- package/components/virtualization/GridMainContainer.js +1 -1
- package/constants/dataGridPropsDefaultValues.js +1 -1
- package/hooks/core/useGridStateInitialization.js +3 -3
- package/hooks/features/columnGrouping/gridColumnGroupsSelector.d.ts +4 -4
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -3
- package/hooks/features/columnResize/columnResizeSelector.d.ts +1 -1
- package/hooks/features/columnResize/gridColumnResizeApi.d.ts +6 -0
- package/hooks/features/columnResize/gridColumnResizeApi.js +2 -1
- package/hooks/features/columnResize/useGridColumnResize.d.ts +1 -1
- package/hooks/features/columnResize/useGridColumnResize.js +9 -4
- package/hooks/features/columns/gridColumnsSelector.d.ts +12 -12
- package/hooks/features/columns/gridColumnsUtils.d.ts +1 -1
- package/hooks/features/columns/gridColumnsUtils.js +2 -1
- package/hooks/features/density/densitySelector.d.ts +1 -1
- package/hooks/features/filter/gridFilterSelector.d.ts +17 -17
- package/hooks/features/filter/useGridFilter.js +1 -1
- package/hooks/features/focus/gridFocusStateSelector.d.ts +8 -8
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +3 -3
- package/hooks/features/overlays/useGridOverlays.js +3 -1
- package/hooks/features/pagination/gridPaginationSelector.d.ts +15 -9
- package/hooks/features/rowSelection/gridRowSelectionSelector.d.ts +3 -3
- package/hooks/features/rowSelection/useGridRowSelection.js +5 -4
- package/hooks/features/rowSelection/utils.d.ts +1 -1
- package/hooks/features/rows/gridRowSpanningSelectors.d.ts +3 -3
- package/hooks/features/rows/gridRowsSelector.d.ts +23 -12
- package/hooks/features/rows/useGridRowSpanning.d.ts +1 -1
- package/hooks/features/rows/useGridRowSpanning.js +16 -8
- package/hooks/features/rows/useGridRows.js +5 -5
- package/hooks/features/sorting/gridSortingSelector.d.ts +10 -5
- package/hooks/features/sorting/gridSortingSelector.js +11 -0
- package/hooks/features/sorting/index.d.ts +2 -1
- package/hooks/features/sorting/index.js +1 -1
- package/hooks/features/sorting/useGridSorting.js +1 -1
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +5 -5
- package/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
- package/hooks/utils/useGridSelector.d.ts +4 -6
- package/hooks/utils/useGridSelector.js +6 -44
- package/index.js +1 -1
- package/internals/index.d.ts +2 -2
- package/internals/index.js +2 -2
- package/internals/utils/index.d.ts +0 -1
- package/internals/utils/index.js +0 -1
- package/locales/koKR.js +45 -49
- package/locales/roRO.js +18 -20
- package/material/index.js +30 -4
- package/models/api/gridStateApi.d.ts +1 -1
- package/models/controlStateItem.d.ts +2 -2
- package/models/gridBaseSlots.d.ts +21 -0
- package/models/gridBaseSlots.js +1 -0
- package/models/gridSlotsComponentsProps.d.ts +25 -5
- package/models/props/DataGridProps.d.ts +1 -6
- package/modern/DataGrid/DataGrid.js +7 -11
- package/modern/DataGrid/useDataGridProps.js +3 -3
- package/modern/components/GridRow.js +13 -2
- package/modern/components/cell/GridActionsCell.js +8 -1
- package/modern/components/cell/GridActionsCellItem.js +4 -6
- package/modern/components/cell/GridCell.js +1 -1
- package/modern/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.js +6 -11
- package/modern/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.js +6 -11
- package/modern/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.js +6 -11
- package/modern/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +13 -22
- package/modern/components/panel/GridColumnsPanel.js +1 -2
- package/modern/components/panel/GridPanelContent.js +7 -3
- package/modern/components/panel/GridPanelFooter.js +4 -3
- package/modern/components/panel/filterPanel/GridFilterForm.js +15 -15
- package/modern/components/toolbar/GridToolbarDensitySelector.js +3 -5
- package/modern/components/toolbar/GridToolbarFilterButton.js +3 -0
- package/modern/components/toolbar/GridToolbarQuickFilter.js +27 -23
- package/modern/components/virtualization/GridMainContainer.js +1 -1
- package/modern/constants/dataGridPropsDefaultValues.js +1 -1
- package/modern/hooks/core/useGridStateInitialization.js +3 -3
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -3
- package/modern/hooks/features/columnResize/gridColumnResizeApi.js +2 -1
- package/modern/hooks/features/columnResize/useGridColumnResize.js +9 -4
- package/modern/hooks/features/columns/gridColumnsUtils.js +2 -1
- package/modern/hooks/features/filter/useGridFilter.js +1 -1
- package/modern/hooks/features/overlays/useGridOverlays.js +3 -1
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +5 -4
- package/modern/hooks/features/rows/useGridRowSpanning.js +16 -8
- package/modern/hooks/features/rows/useGridRows.js +5 -5
- package/modern/hooks/features/sorting/gridSortingSelector.js +11 -0
- package/modern/hooks/features/sorting/index.js +1 -1
- package/modern/hooks/features/sorting/useGridSorting.js +1 -1
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
- package/modern/hooks/utils/useGridSelector.js +6 -44
- package/modern/index.js +1 -1
- package/modern/internals/index.js +2 -2
- package/modern/internals/utils/index.js +0 -1
- package/modern/locales/koKR.js +45 -49
- package/modern/locales/roRO.js +18 -20
- package/modern/material/index.js +30 -4
- package/modern/models/gridBaseSlots.js +1 -0
- package/modern/utils/createSelector.js +1 -120
- package/node/DataGrid/DataGrid.js +7 -11
- package/node/DataGrid/useDataGridProps.js +2 -2
- package/node/components/GridRow.js +13 -2
- package/node/components/cell/GridActionsCell.js +8 -1
- package/node/components/cell/GridActionsCellItem.js +3 -5
- package/node/components/cell/GridCell.js +1 -1
- package/node/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.js +5 -10
- package/node/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.js +5 -10
- package/node/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.js +5 -10
- package/node/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +13 -22
- package/node/components/panel/GridColumnsPanel.js +1 -2
- package/node/components/panel/GridPanelContent.js +7 -3
- package/node/components/panel/GridPanelFooter.js +5 -4
- package/node/components/panel/filterPanel/GridFilterForm.js +15 -15
- package/node/components/toolbar/GridToolbarDensitySelector.js +3 -5
- package/node/components/toolbar/GridToolbarFilterButton.js +3 -0
- package/node/components/toolbar/GridToolbarQuickFilter.js +27 -23
- package/node/components/virtualization/GridMainContainer.js +1 -1
- package/node/constants/dataGridPropsDefaultValues.js +1 -1
- package/node/hooks/core/useGridStateInitialization.js +3 -3
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -3
- package/node/hooks/features/columnResize/gridColumnResizeApi.js +2 -1
- package/node/hooks/features/columnResize/useGridColumnResize.js +9 -4
- package/node/hooks/features/columns/gridColumnsUtils.js +2 -1
- package/node/hooks/features/filter/useGridFilter.js +1 -1
- package/node/hooks/features/overlays/useGridOverlays.js +3 -1
- package/node/hooks/features/rowSelection/useGridRowSelection.js +5 -4
- package/node/hooks/features/rows/useGridRowSpanning.js +16 -8
- package/node/hooks/features/rows/useGridRows.js +5 -5
- package/node/hooks/features/sorting/gridSortingSelector.js +12 -1
- package/node/hooks/features/sorting/index.js +24 -16
- package/node/hooks/features/sorting/useGridSorting.js +1 -1
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
- package/node/hooks/utils/useGridSelector.js +8 -47
- package/node/index.js +1 -1
- package/node/internals/index.js +8 -22
- package/node/internals/utils/index.js +0 -11
- package/node/locales/koKR.js +45 -49
- package/node/locales/roRO.js +18 -20
- package/node/material/index.js +31 -4
- package/node/models/gridBaseSlots.js +5 -0
- package/node/utils/createSelector.js +4 -125
- package/package.json +2 -2
- package/utils/createSelector.d.ts +4 -16
- package/utils/createSelector.js +1 -120
- package/internals/utils/useProps.d.ts +0 -1
- package/internals/utils/useProps.js +0 -24
- package/joy/icons.d.ts +0 -32
- package/joy/icons.js +0 -431
- package/joy/index.d.ts +0 -2
- package/joy/index.js +0 -2
- package/joy/joySlots.d.ts +0 -3
- package/joy/joySlots.js +0 -389
- package/joy/package.json +0 -6
- package/modern/internals/utils/useProps.js +0 -24
- package/modern/joy/icons.js +0 -431
- package/modern/joy/index.js +0 -2
- package/modern/joy/joySlots.js +0 -389
- package/node/internals/utils/useProps.js +0 -30
- package/node/joy/icons.js +0 -439
- package/node/joy/index.js +0 -13
- package/node/joy/joySlots.js +0 -397
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.createSelectorMemoized = exports.createSelector = void 0;
|
|
7
7
|
var _reselect = require("reselect");
|
|
8
8
|
var _warning = require("@mui/x-internals/warning");
|
|
9
9
|
var _useGridSelector = require("../hooks/utils/useGridSelector");
|
|
@@ -14,19 +14,6 @@ const reselectCreateSelector = (0, _reselect.createSelectorCreator)({
|
|
|
14
14
|
equalityCheck: Object.is
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
// TODO v8: Remove this type
|
|
19
|
-
|
|
20
|
-
// TODO v8: Rename this type to `OutputSelector`
|
|
21
|
-
|
|
22
|
-
// TODO v8: Remove this type
|
|
23
|
-
|
|
24
|
-
// TODO v8: Rename this type to `SelectorArgs`
|
|
25
|
-
|
|
26
|
-
// TODO v8: Remove this type
|
|
27
|
-
|
|
28
|
-
// TODO v8: Rename this type to `CreateSelectorFunction`
|
|
29
|
-
|
|
30
17
|
const cache = new WeakMap();
|
|
31
18
|
function checkIsAPIRef(value) {
|
|
32
19
|
return 'current' in value && 'instanceId' in value.current;
|
|
@@ -34,84 +21,12 @@ function checkIsAPIRef(value) {
|
|
|
34
21
|
const DEFAULT_INSTANCE_ID = {
|
|
35
22
|
id: 'default'
|
|
36
23
|
};
|
|
37
|
-
|
|
38
|
-
// TODO v8: Remove this function
|
|
39
24
|
const createSelector = (a, b, c, d, e, f, ...other) => {
|
|
40
25
|
if (other.length > 0) {
|
|
41
26
|
throw new Error('Unsupported number of selectors');
|
|
42
27
|
}
|
|
43
28
|
let selector;
|
|
44
29
|
|
|
45
|
-
// eslint-disable-next-line id-denylist
|
|
46
|
-
if (a && b && c && d && e && f) {
|
|
47
|
-
selector = (stateOrApiRef, instanceIdParam) => {
|
|
48
|
-
const isAPIRef = checkIsAPIRef(stateOrApiRef);
|
|
49
|
-
const instanceId = instanceIdParam ?? (isAPIRef ? stateOrApiRef.current.instanceId : DEFAULT_INSTANCE_ID);
|
|
50
|
-
const state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
|
|
51
|
-
const va = a(state, instanceId);
|
|
52
|
-
const vb = b(state, instanceId);
|
|
53
|
-
const vc = c(state, instanceId);
|
|
54
|
-
const vd = d(state, instanceId);
|
|
55
|
-
const ve = e(state, instanceId);
|
|
56
|
-
return f(va, vb, vc, vd, ve);
|
|
57
|
-
};
|
|
58
|
-
// eslint-disable-next-line id-denylist
|
|
59
|
-
} else if (a && b && c && d && e) {
|
|
60
|
-
selector = (stateOrApiRef, instanceIdParam) => {
|
|
61
|
-
const isAPIRef = checkIsAPIRef(stateOrApiRef);
|
|
62
|
-
const instanceId = instanceIdParam ?? (isAPIRef ? stateOrApiRef.current.instanceId : DEFAULT_INSTANCE_ID);
|
|
63
|
-
const state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
|
|
64
|
-
const va = a(state, instanceId);
|
|
65
|
-
const vb = b(state, instanceId);
|
|
66
|
-
const vc = c(state, instanceId);
|
|
67
|
-
const vd = d(state, instanceId);
|
|
68
|
-
return e(va, vb, vc, vd);
|
|
69
|
-
};
|
|
70
|
-
} else if (a && b && c && d) {
|
|
71
|
-
selector = (stateOrApiRef, instanceIdParam) => {
|
|
72
|
-
const isAPIRef = checkIsAPIRef(stateOrApiRef);
|
|
73
|
-
const instanceId = instanceIdParam ?? (isAPIRef ? stateOrApiRef.current.instanceId : DEFAULT_INSTANCE_ID);
|
|
74
|
-
const state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
|
|
75
|
-
const va = a(state, instanceId);
|
|
76
|
-
const vb = b(state, instanceId);
|
|
77
|
-
const vc = c(state, instanceId);
|
|
78
|
-
return d(va, vb, vc);
|
|
79
|
-
};
|
|
80
|
-
} else if (a && b && c) {
|
|
81
|
-
selector = (stateOrApiRef, instanceIdParam) => {
|
|
82
|
-
const isAPIRef = checkIsAPIRef(stateOrApiRef);
|
|
83
|
-
const instanceId = instanceIdParam ?? (isAPIRef ? stateOrApiRef.current.instanceId : DEFAULT_INSTANCE_ID);
|
|
84
|
-
const state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
|
|
85
|
-
const va = a(state, instanceId);
|
|
86
|
-
const vb = b(state, instanceId);
|
|
87
|
-
return c(va, vb);
|
|
88
|
-
};
|
|
89
|
-
} else if (a && b) {
|
|
90
|
-
selector = (stateOrApiRef, instanceIdParam) => {
|
|
91
|
-
const isAPIRef = checkIsAPIRef(stateOrApiRef);
|
|
92
|
-
const instanceId = instanceIdParam ?? (isAPIRef ? stateOrApiRef.current.instanceId : DEFAULT_INSTANCE_ID);
|
|
93
|
-
const state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
|
|
94
|
-
const va = a(state, instanceId);
|
|
95
|
-
return b(va);
|
|
96
|
-
};
|
|
97
|
-
} else {
|
|
98
|
-
throw new Error('Missing arguments');
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// We use this property to detect if the selector was created with createSelector
|
|
102
|
-
// or it's only a simple function the receives the state and returns part of it.
|
|
103
|
-
selector.acceptsApiRef = true;
|
|
104
|
-
return selector;
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
// TODO v8: Rename this function to `createSelector`
|
|
108
|
-
exports.createSelector = createSelector;
|
|
109
|
-
const createSelectorV8 = (a, b, c, d, e, f, ...other) => {
|
|
110
|
-
if (other.length > 0) {
|
|
111
|
-
throw new Error('Unsupported number of selectors');
|
|
112
|
-
}
|
|
113
|
-
let selector;
|
|
114
|
-
|
|
115
30
|
// eslint-disable-next-line id-denylist
|
|
116
31
|
if (a && b && c && d && e && f) {
|
|
117
32
|
selector = (stateOrApiRef, args, instanceIdParam) => {
|
|
@@ -173,51 +88,15 @@ const createSelectorV8 = (a, b, c, d, e, f, ...other) => {
|
|
|
173
88
|
selector.acceptsApiRef = true;
|
|
174
89
|
return selector;
|
|
175
90
|
};
|
|
176
|
-
|
|
177
|
-
// TODO v8: Remove this function
|
|
178
|
-
exports.createSelectorV8 = createSelectorV8;
|
|
91
|
+
exports.createSelector = createSelector;
|
|
179
92
|
const createSelectorMemoized = (...args) => {
|
|
180
|
-
const selector = (stateOrApiRef, instanceId) => {
|
|
181
|
-
const isAPIRef = checkIsAPIRef(stateOrApiRef);
|
|
182
|
-
const cacheKey = isAPIRef ? stateOrApiRef.current.instanceId : instanceId ?? DEFAULT_INSTANCE_ID;
|
|
183
|
-
const state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
|
|
184
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
185
|
-
if (cacheKey.id === 'default') {
|
|
186
|
-
(0, _warning.warnOnce)(['MUI X: A selector was called without passing the instance ID, which may impact the performance of the grid.', 'To fix, call it with `apiRef`, for example `mySelector(apiRef)`, or pass the instance ID explicitly, for example `mySelector(state, apiRef.current.instanceId)`.']);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
const cacheArgsInit = cache.get(cacheKey);
|
|
190
|
-
const cacheArgs = cacheArgsInit ?? new Map();
|
|
191
|
-
const cacheFn = cacheArgs?.get(args);
|
|
192
|
-
if (cacheArgs && cacheFn) {
|
|
193
|
-
// We pass the cache key because the called selector might have as
|
|
194
|
-
// dependency another selector created with this `createSelector`.
|
|
195
|
-
return cacheFn(state, cacheKey);
|
|
196
|
-
}
|
|
197
|
-
const fn = reselectCreateSelector(...args);
|
|
198
|
-
if (!cacheArgsInit) {
|
|
199
|
-
cache.set(cacheKey, cacheArgs);
|
|
200
|
-
}
|
|
201
|
-
cacheArgs.set(args, fn);
|
|
202
|
-
return fn(state, cacheKey);
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
// We use this property to detect if the selector was created with createSelector
|
|
206
|
-
// or it's only a simple function the receives the state and returns part of it.
|
|
207
|
-
selector.acceptsApiRef = true;
|
|
208
|
-
return selector;
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
// TODO v8: Rename this function to `createSelectorMemoized`
|
|
212
|
-
exports.createSelectorMemoized = createSelectorMemoized;
|
|
213
|
-
const createSelectorMemoizedV8 = (...args) => {
|
|
214
93
|
const selector = (stateOrApiRef, selectorArgs, instanceId) => {
|
|
215
94
|
const isAPIRef = checkIsAPIRef(stateOrApiRef);
|
|
216
95
|
const cacheKey = isAPIRef ? stateOrApiRef.current.instanceId : instanceId ?? DEFAULT_INSTANCE_ID;
|
|
217
96
|
const state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
|
|
218
97
|
if (process.env.NODE_ENV !== 'production') {
|
|
219
98
|
if (cacheKey.id === 'default') {
|
|
220
|
-
(0, _warning.warnOnce)(['MUI X: A selector was called without passing the instance ID, which may impact the performance of the grid.', 'To fix, call it with `apiRef`, for example `mySelector(apiRef)`, or pass the instance ID explicitly, for example `mySelector(state, apiRef.current.instanceId)`.']);
|
|
99
|
+
(0, _warning.warnOnce)(['MUI X: A selector was called without passing the instance ID, which may impact the performance of the grid.', 'To fix, call it with `apiRef`, for example `mySelector(apiRef)`, or pass the instance ID explicitly, for example `mySelector(state, args, apiRef.current.instanceId)`.']);
|
|
221
100
|
}
|
|
222
101
|
}
|
|
223
102
|
const cacheArgsInit = cache.get(cacheKey);
|
|
@@ -250,4 +129,4 @@ const createSelectorMemoizedV8 = (...args) => {
|
|
|
250
129
|
selector.acceptsApiRef = true;
|
|
251
130
|
return selector;
|
|
252
131
|
};
|
|
253
|
-
exports.
|
|
132
|
+
exports.createSelectorMemoized = createSelectorMemoized;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid",
|
|
3
|
-
"version": "8.0.0-alpha.
|
|
3
|
+
"version": "8.0.0-alpha.5",
|
|
4
4
|
"description": "The Community plan edition of the Data Grid components (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"clsx": "^2.1.1",
|
|
43
43
|
"prop-types": "^15.8.1",
|
|
44
44
|
"reselect": "^5.1.1",
|
|
45
|
-
"@mui/x-internals": "8.0.0-alpha.
|
|
45
|
+
"@mui/x-internals": "8.0.0-alpha.5"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"@emotion/react": "^11.9.0",
|
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Selector, SelectorResultArray } from 'reselect';
|
|
3
3
|
import type { GridCoreApi } from '../models/api/gridCoreApi';
|
|
4
|
-
export interface OutputSelector<State, Result> {
|
|
5
|
-
(apiRef: React.MutableRefObject<{
|
|
6
|
-
state: State;
|
|
7
|
-
instanceId: GridCoreApi['instanceId'];
|
|
8
|
-
}>): Result;
|
|
9
|
-
(state: State, instanceId: GridCoreApi['instanceId']): Result;
|
|
10
|
-
acceptsApiRef: boolean;
|
|
11
|
-
}
|
|
12
|
-
export interface OutputSelectorV8<State, Args, Result> {
|
|
4
|
+
export interface OutputSelector<State, Args, Result> {
|
|
13
5
|
(apiRef: React.MutableRefObject<{
|
|
14
6
|
state: State;
|
|
15
7
|
instanceId: GridCoreApi['instanceId'];
|
|
16
8
|
}>, args?: Args): Result;
|
|
17
|
-
(state: State, instanceId
|
|
9
|
+
(state: State, args?: Args, instanceId?: GridCoreApi['instanceId']): Result;
|
|
18
10
|
acceptsApiRef: boolean;
|
|
19
11
|
}
|
|
20
12
|
type StateFromSelector<T> = T extends (first: infer F, ...args: any[]) => any ? F extends {
|
|
@@ -24,19 +16,15 @@ type StateFromSelectorList<Selectors extends readonly any[]> = Selectors extends
|
|
|
24
16
|
f: infer F,
|
|
25
17
|
...other: infer R
|
|
26
18
|
] ? StateFromSelector<F> extends StateFromSelectorList<R> ? StateFromSelector<F> : StateFromSelectorList<R> : {};
|
|
27
|
-
type SelectorArgs<Selectors extends ReadonlyArray<Selector<any>>, Result> = [selectors: [...Selectors], combiner: (...args: SelectorResultArray<Selectors>) => Result] | [...Selectors, (...args: SelectorResultArray<Selectors>) => Result];
|
|
28
19
|
type SelectorResultArrayWithArgs<Selectors extends ReadonlyArray<Selector<any>>, Args> = [
|
|
29
20
|
...SelectorResultArray<Selectors>,
|
|
30
21
|
Args
|
|
31
22
|
];
|
|
32
|
-
type
|
|
23
|
+
type SelectorArgs<Selectors extends ReadonlyArray<Selector<any>>, Args, Result> = [
|
|
33
24
|
selectors: [...Selectors],
|
|
34
25
|
combiner: (...args: SelectorResultArrayWithArgs<Selectors, Args>) => Result
|
|
35
26
|
] | [...Selectors, (...args: SelectorResultArrayWithArgs<Selectors, Args>) => Result];
|
|
36
|
-
type CreateSelectorFunction = <Selectors extends ReadonlyArray<Selector<any>>, Result>(...items: SelectorArgs<Selectors, Result>) => OutputSelector<StateFromSelectorList<Selectors>, Result>;
|
|
37
|
-
type CreateSelectorFunctionV8 = <Selectors extends ReadonlyArray<Selector<any>>, Args, Result>(...items: SelectorArgsV8<Selectors, Args, Result>) => OutputSelectorV8<StateFromSelectorList<Selectors>, Args, Result>;
|
|
27
|
+
type CreateSelectorFunction = <Selectors extends ReadonlyArray<Selector<any>>, Args, Result>(...items: SelectorArgs<Selectors, Args, Result>) => OutputSelector<StateFromSelectorList<Selectors>, Args, Result>;
|
|
38
28
|
export declare const createSelector: CreateSelectorFunction;
|
|
39
|
-
export declare const createSelectorV8: CreateSelectorFunctionV8;
|
|
40
29
|
export declare const createSelectorMemoized: CreateSelectorFunction;
|
|
41
|
-
export declare const createSelectorMemoizedV8: CreateSelectorFunctionV8;
|
|
42
30
|
export {};
|
package/utils/createSelector.js
CHANGED
|
@@ -8,19 +8,6 @@ const reselectCreateSelector = createSelectorCreator({
|
|
|
8
8
|
equalityCheck: Object.is
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
12
|
-
// TODO v8: Remove this type
|
|
13
|
-
|
|
14
|
-
// TODO v8: Rename this type to `OutputSelector`
|
|
15
|
-
|
|
16
|
-
// TODO v8: Remove this type
|
|
17
|
-
|
|
18
|
-
// TODO v8: Rename this type to `SelectorArgs`
|
|
19
|
-
|
|
20
|
-
// TODO v8: Remove this type
|
|
21
|
-
|
|
22
|
-
// TODO v8: Rename this type to `CreateSelectorFunction`
|
|
23
|
-
|
|
24
11
|
const cache = new WeakMap();
|
|
25
12
|
function checkIsAPIRef(value) {
|
|
26
13
|
return 'current' in value && 'instanceId' in value.current;
|
|
@@ -28,83 +15,12 @@ function checkIsAPIRef(value) {
|
|
|
28
15
|
const DEFAULT_INSTANCE_ID = {
|
|
29
16
|
id: 'default'
|
|
30
17
|
};
|
|
31
|
-
|
|
32
|
-
// TODO v8: Remove this function
|
|
33
18
|
export const createSelector = (a, b, c, d, e, f, ...other) => {
|
|
34
19
|
if (other.length > 0) {
|
|
35
20
|
throw new Error('Unsupported number of selectors');
|
|
36
21
|
}
|
|
37
22
|
let selector;
|
|
38
23
|
|
|
39
|
-
// eslint-disable-next-line id-denylist
|
|
40
|
-
if (a && b && c && d && e && f) {
|
|
41
|
-
selector = (stateOrApiRef, instanceIdParam) => {
|
|
42
|
-
const isAPIRef = checkIsAPIRef(stateOrApiRef);
|
|
43
|
-
const instanceId = instanceIdParam ?? (isAPIRef ? stateOrApiRef.current.instanceId : DEFAULT_INSTANCE_ID);
|
|
44
|
-
const state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
|
|
45
|
-
const va = a(state, instanceId);
|
|
46
|
-
const vb = b(state, instanceId);
|
|
47
|
-
const vc = c(state, instanceId);
|
|
48
|
-
const vd = d(state, instanceId);
|
|
49
|
-
const ve = e(state, instanceId);
|
|
50
|
-
return f(va, vb, vc, vd, ve);
|
|
51
|
-
};
|
|
52
|
-
// eslint-disable-next-line id-denylist
|
|
53
|
-
} else if (a && b && c && d && e) {
|
|
54
|
-
selector = (stateOrApiRef, instanceIdParam) => {
|
|
55
|
-
const isAPIRef = checkIsAPIRef(stateOrApiRef);
|
|
56
|
-
const instanceId = instanceIdParam ?? (isAPIRef ? stateOrApiRef.current.instanceId : DEFAULT_INSTANCE_ID);
|
|
57
|
-
const state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
|
|
58
|
-
const va = a(state, instanceId);
|
|
59
|
-
const vb = b(state, instanceId);
|
|
60
|
-
const vc = c(state, instanceId);
|
|
61
|
-
const vd = d(state, instanceId);
|
|
62
|
-
return e(va, vb, vc, vd);
|
|
63
|
-
};
|
|
64
|
-
} else if (a && b && c && d) {
|
|
65
|
-
selector = (stateOrApiRef, instanceIdParam) => {
|
|
66
|
-
const isAPIRef = checkIsAPIRef(stateOrApiRef);
|
|
67
|
-
const instanceId = instanceIdParam ?? (isAPIRef ? stateOrApiRef.current.instanceId : DEFAULT_INSTANCE_ID);
|
|
68
|
-
const state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
|
|
69
|
-
const va = a(state, instanceId);
|
|
70
|
-
const vb = b(state, instanceId);
|
|
71
|
-
const vc = c(state, instanceId);
|
|
72
|
-
return d(va, vb, vc);
|
|
73
|
-
};
|
|
74
|
-
} else if (a && b && c) {
|
|
75
|
-
selector = (stateOrApiRef, instanceIdParam) => {
|
|
76
|
-
const isAPIRef = checkIsAPIRef(stateOrApiRef);
|
|
77
|
-
const instanceId = instanceIdParam ?? (isAPIRef ? stateOrApiRef.current.instanceId : DEFAULT_INSTANCE_ID);
|
|
78
|
-
const state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
|
|
79
|
-
const va = a(state, instanceId);
|
|
80
|
-
const vb = b(state, instanceId);
|
|
81
|
-
return c(va, vb);
|
|
82
|
-
};
|
|
83
|
-
} else if (a && b) {
|
|
84
|
-
selector = (stateOrApiRef, instanceIdParam) => {
|
|
85
|
-
const isAPIRef = checkIsAPIRef(stateOrApiRef);
|
|
86
|
-
const instanceId = instanceIdParam ?? (isAPIRef ? stateOrApiRef.current.instanceId : DEFAULT_INSTANCE_ID);
|
|
87
|
-
const state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
|
|
88
|
-
const va = a(state, instanceId);
|
|
89
|
-
return b(va);
|
|
90
|
-
};
|
|
91
|
-
} else {
|
|
92
|
-
throw new Error('Missing arguments');
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// We use this property to detect if the selector was created with createSelector
|
|
96
|
-
// or it's only a simple function the receives the state and returns part of it.
|
|
97
|
-
selector.acceptsApiRef = true;
|
|
98
|
-
return selector;
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
// TODO v8: Rename this function to `createSelector`
|
|
102
|
-
export const createSelectorV8 = (a, b, c, d, e, f, ...other) => {
|
|
103
|
-
if (other.length > 0) {
|
|
104
|
-
throw new Error('Unsupported number of selectors');
|
|
105
|
-
}
|
|
106
|
-
let selector;
|
|
107
|
-
|
|
108
24
|
// eslint-disable-next-line id-denylist
|
|
109
25
|
if (a && b && c && d && e && f) {
|
|
110
26
|
selector = (stateOrApiRef, args, instanceIdParam) => {
|
|
@@ -166,49 +82,14 @@ export const createSelectorV8 = (a, b, c, d, e, f, ...other) => {
|
|
|
166
82
|
selector.acceptsApiRef = true;
|
|
167
83
|
return selector;
|
|
168
84
|
};
|
|
169
|
-
|
|
170
|
-
// TODO v8: Remove this function
|
|
171
85
|
export const createSelectorMemoized = (...args) => {
|
|
172
|
-
const selector = (stateOrApiRef, instanceId) => {
|
|
173
|
-
const isAPIRef = checkIsAPIRef(stateOrApiRef);
|
|
174
|
-
const cacheKey = isAPIRef ? stateOrApiRef.current.instanceId : instanceId ?? DEFAULT_INSTANCE_ID;
|
|
175
|
-
const state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
|
|
176
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
177
|
-
if (cacheKey.id === 'default') {
|
|
178
|
-
warnOnce(['MUI X: A selector was called without passing the instance ID, which may impact the performance of the grid.', 'To fix, call it with `apiRef`, for example `mySelector(apiRef)`, or pass the instance ID explicitly, for example `mySelector(state, apiRef.current.instanceId)`.']);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
const cacheArgsInit = cache.get(cacheKey);
|
|
182
|
-
const cacheArgs = cacheArgsInit ?? new Map();
|
|
183
|
-
const cacheFn = cacheArgs?.get(args);
|
|
184
|
-
if (cacheArgs && cacheFn) {
|
|
185
|
-
// We pass the cache key because the called selector might have as
|
|
186
|
-
// dependency another selector created with this `createSelector`.
|
|
187
|
-
return cacheFn(state, cacheKey);
|
|
188
|
-
}
|
|
189
|
-
const fn = reselectCreateSelector(...args);
|
|
190
|
-
if (!cacheArgsInit) {
|
|
191
|
-
cache.set(cacheKey, cacheArgs);
|
|
192
|
-
}
|
|
193
|
-
cacheArgs.set(args, fn);
|
|
194
|
-
return fn(state, cacheKey);
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
// We use this property to detect if the selector was created with createSelector
|
|
198
|
-
// or it's only a simple function the receives the state and returns part of it.
|
|
199
|
-
selector.acceptsApiRef = true;
|
|
200
|
-
return selector;
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
// TODO v8: Rename this function to `createSelectorMemoized`
|
|
204
|
-
export const createSelectorMemoizedV8 = (...args) => {
|
|
205
86
|
const selector = (stateOrApiRef, selectorArgs, instanceId) => {
|
|
206
87
|
const isAPIRef = checkIsAPIRef(stateOrApiRef);
|
|
207
88
|
const cacheKey = isAPIRef ? stateOrApiRef.current.instanceId : instanceId ?? DEFAULT_INSTANCE_ID;
|
|
208
89
|
const state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
|
|
209
90
|
if (process.env.NODE_ENV !== 'production') {
|
|
210
91
|
if (cacheKey.id === 'default') {
|
|
211
|
-
warnOnce(['MUI X: A selector was called without passing the instance ID, which may impact the performance of the grid.', 'To fix, call it with `apiRef`, for example `mySelector(apiRef)`, or pass the instance ID explicitly, for example `mySelector(state, apiRef.current.instanceId)`.']);
|
|
92
|
+
warnOnce(['MUI X: A selector was called without passing the instance ID, which may impact the performance of the grid.', 'To fix, call it with `apiRef`, for example `mySelector(apiRef)`, or pass the instance ID explicitly, for example `mySelector(state, args, apiRef.current.instanceId)`.']);
|
|
212
93
|
}
|
|
213
94
|
}
|
|
214
95
|
const cacheArgsInit = cache.get(cacheKey);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function useProps<T extends Record<string, any>>(allProps: T): T;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
/** Gathers props for the root element into a single `.forwardedProps` field */
|
|
4
|
-
function groupForwardedProps(props) {
|
|
5
|
-
const keys = Object.keys(props);
|
|
6
|
-
if (!keys.some(key => key.startsWith('aria-') || key.startsWith('data-'))) {
|
|
7
|
-
return props;
|
|
8
|
-
}
|
|
9
|
-
const newProps = {};
|
|
10
|
-
const forwardedProps = props.forwardedProps ?? {};
|
|
11
|
-
for (let i = 0; i < keys.length; i += 1) {
|
|
12
|
-
const key = keys[i];
|
|
13
|
-
if (key.startsWith('aria-') || key.startsWith('data-')) {
|
|
14
|
-
forwardedProps[key] = props[key];
|
|
15
|
-
} else {
|
|
16
|
-
newProps[key] = props[key];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
newProps.forwardedProps = forwardedProps;
|
|
20
|
-
return newProps;
|
|
21
|
-
}
|
|
22
|
-
export function useProps(allProps) {
|
|
23
|
-
return React.useMemo(() => groupForwardedProps(allProps), [allProps]);
|
|
24
|
-
}
|
package/joy/icons.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { GridIconSlotsComponent } from '../models/gridIconSlotsComponent';
|
|
2
|
-
export declare const GridArrowUpwardIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
3
|
-
export declare const GridArrowDownwardIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
4
|
-
export declare const GridKeyboardArrowLeft: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
5
|
-
export declare const GridKeyboardArrowRight: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
6
|
-
export declare const GridExpandMoreIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
7
|
-
export declare const GridFilterListIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
8
|
-
export declare const GridFilterAltIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
9
|
-
export declare const GridSearchIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
10
|
-
export declare const GridMenuIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
11
|
-
export declare const GridCheckCircleIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
12
|
-
export declare const GridColumnIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
13
|
-
export declare const GridSeparatorIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
14
|
-
export declare const GridViewHeadlineIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
15
|
-
export declare const GridTableRowsIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
16
|
-
export declare const GridViewStreamIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
17
|
-
export declare const GridTripleDotsVerticalIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
18
|
-
export declare const GridCloseIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
19
|
-
export declare const GridAddIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
20
|
-
export declare const GridRemoveIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
21
|
-
export declare const GridLoadIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
22
|
-
export declare const GridDragIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
23
|
-
export declare const GridSaveAltIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
24
|
-
export declare const GridCheckIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
25
|
-
export declare const GridMoreVertIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
26
|
-
export declare const GridVisibilityOffIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
27
|
-
export declare const GridViewColumnIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
28
|
-
export declare const GridClearIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
29
|
-
export declare const GridDeleteIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
30
|
-
export declare const GridDeleteForeverIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
|
|
31
|
-
declare const joyIconSlots: GridIconSlotsComponent;
|
|
32
|
-
export default joyIconSlots;
|