@mui/x-data-grid 6.18.1 → 7.0.0-alpha.0
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 +149 -0
- package/DataGrid/DataGrid.js +0 -10
- package/DataGrid/useDataGridProps.js +9 -14
- package/colDef/gridActionsColDef.js +1 -2
- package/colDef/gridBooleanColDef.js +0 -1
- package/colDef/gridBooleanOperators.js +3 -4
- package/colDef/gridCheckboxSelectionColDef.js +0 -1
- package/colDef/gridDateOperators.js +10 -11
- package/colDef/gridNumericColDef.js +1 -3
- package/colDef/gridNumericOperators.d.ts +2 -2
- package/colDef/gridNumericOperators.js +13 -14
- package/colDef/gridSingleSelectOperators.js +5 -6
- package/colDef/gridStringColDef.js +1 -3
- package/colDef/gridStringOperators.d.ts +2 -2
- package/colDef/gridStringOperators.js +11 -12
- package/constants/defaultGridSlotsComponents.js +17 -17
- package/hooks/features/export/useGridPrintExport.js +7 -10
- package/hooks/features/filter/gridFilterUtils.js +14 -68
- package/hooks/features/rows/useGridRows.js +4 -1
- package/index.js +1 -1
- package/internals/index.d.ts +0 -1
- package/internals/index.js +0 -1
- package/internals/utils/computeSlots.d.ts +4 -6
- package/internals/utils/computeSlots.js +2 -8
- package/internals/utils/index.d.ts +0 -1
- package/internals/utils/index.js +0 -1
- package/internals/utils/useProps.d.ts +1 -8
- package/internals/utils/useProps.js +5 -8
- package/joy/icons.d.ts +1 -2
- package/joy/joySlots.d.ts +1 -2
- package/legacy/DataGrid/DataGrid.js +0 -10
- package/legacy/DataGrid/useDataGridProps.js +10 -18
- package/legacy/colDef/gridActionsColDef.js +1 -2
- package/legacy/colDef/gridBooleanColDef.js +0 -1
- package/legacy/colDef/gridBooleanOperators.js +3 -4
- package/legacy/colDef/gridCheckboxSelectionColDef.js +0 -1
- package/legacy/colDef/gridDateOperators.js +10 -11
- package/legacy/colDef/gridNumericColDef.js +1 -3
- package/legacy/colDef/gridNumericOperators.js +13 -14
- package/legacy/colDef/gridSingleSelectOperators.js +5 -6
- package/legacy/colDef/gridStringColDef.js +1 -3
- package/legacy/colDef/gridStringOperators.js +11 -12
- package/legacy/constants/defaultGridSlotsComponents.js +17 -17
- package/legacy/hooks/features/export/useGridPrintExport.js +7 -10
- package/legacy/hooks/features/filter/gridFilterUtils.js +14 -68
- package/legacy/hooks/features/rows/useGridRows.js +2 -1
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +0 -1
- package/legacy/internals/utils/computeSlots.js +2 -8
- package/legacy/internals/utils/index.js +0 -1
- package/legacy/internals/utils/useProps.js +5 -6
- package/legacy/locales/csCZ.js +2 -2
- package/legacy/material/index.js +48 -48
- package/locales/csCZ.js +2 -2
- package/material/index.js +48 -48
- package/models/colDef/gridColDef.d.ts +4 -14
- package/models/colDef/index.d.ts +1 -1
- package/models/gridFilterOperator.d.ts +4 -16
- package/models/gridIconSlotsComponent.d.ts +35 -36
- package/models/gridSlotsComponent.d.ts +31 -34
- package/models/index.d.ts +1 -1
- package/models/props/DataGridProps.d.ts +3 -14
- package/modern/DataGrid/DataGrid.js +0 -10
- package/modern/DataGrid/useDataGridProps.js +7 -9
- package/modern/colDef/gridActionsColDef.js +1 -2
- package/modern/colDef/gridBooleanColDef.js +0 -1
- package/modern/colDef/gridBooleanOperators.js +3 -4
- package/modern/colDef/gridCheckboxSelectionColDef.js +0 -1
- package/modern/colDef/gridDateOperators.js +10 -11
- package/modern/colDef/gridNumericColDef.js +1 -3
- package/modern/colDef/gridNumericOperators.js +13 -14
- package/modern/colDef/gridSingleSelectOperators.js +5 -6
- package/modern/colDef/gridStringColDef.js +1 -3
- package/modern/colDef/gridStringOperators.js +11 -12
- package/modern/constants/defaultGridSlotsComponents.js +17 -17
- package/modern/hooks/features/export/useGridPrintExport.js +6 -10
- package/modern/hooks/features/filter/gridFilterUtils.js +14 -67
- package/modern/hooks/features/rows/useGridRows.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/index.js +0 -1
- package/modern/internals/utils/computeSlots.js +2 -8
- package/modern/internals/utils/index.js +0 -1
- package/modern/internals/utils/useProps.js +5 -8
- package/modern/locales/csCZ.js +2 -2
- package/modern/material/index.js +48 -48
- package/node/DataGrid/DataGrid.js +0 -10
- package/node/DataGrid/useDataGridProps.js +6 -8
- package/node/colDef/gridActionsColDef.js +1 -2
- package/node/colDef/gridBooleanColDef.js +0 -1
- package/node/colDef/gridBooleanOperators.js +3 -4
- package/node/colDef/gridCheckboxSelectionColDef.js +0 -1
- package/node/colDef/gridDateOperators.js +10 -11
- package/node/colDef/gridNumericColDef.js +1 -3
- package/node/colDef/gridNumericOperators.js +14 -14
- package/node/colDef/gridSingleSelectOperators.js +5 -6
- package/node/colDef/gridStringColDef.js +1 -3
- package/node/colDef/gridStringOperators.js +12 -12
- package/node/constants/defaultGridSlotsComponents.js +17 -17
- package/node/hooks/features/export/useGridPrintExport.js +5 -9
- package/node/hooks/features/filter/gridFilterUtils.js +14 -67
- package/node/hooks/features/rows/useGridRows.js +1 -1
- package/node/index.js +1 -1
- package/node/internals/index.js +1 -13
- package/node/internals/utils/computeSlots.js +2 -7
- package/node/internals/utils/index.js +0 -11
- package/node/internals/utils/useProps.js +4 -8
- package/node/locales/csCZ.js +2 -2
- package/node/material/index.js +48 -48
- package/package.json +1 -1
- package/colDef/utils.d.ts +0 -21
- package/colDef/utils.js +0 -51
- package/internals/utils/slotsMigration.d.ts +0 -4
- package/internals/utils/slotsMigration.js +0 -13
- package/legacy/colDef/utils.js +0 -51
- package/legacy/internals/utils/slotsMigration.js +0 -14
- package/modern/colDef/utils.js +0 -51
- package/modern/internals/utils/slotsMigration.js +0 -13
- package/node/colDef/utils.js +0 -63
- package/node/internals/utils/slotsMigration.js +0 -21
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import { GridLogicOperator } from '../../../models';
|
|
3
|
-
import { GLOBAL_API_REF, isInternalFilter } from '../../../colDef/utils';
|
|
4
3
|
import { getDefaultGridFilterModel } from './gridFilterState';
|
|
5
4
|
import { buildWarning } from '../../../utils/warning';
|
|
6
5
|
import { getPublicApiRef } from '../../../utils/getPublicApiRef';
|
|
@@ -108,42 +107,19 @@ const getFilterCallbackFromItem = (filterItem, apiRef) => {
|
|
|
108
107
|
if (!filterOperator) {
|
|
109
108
|
throw new Error(`MUI: No filter operator found for column '${column.field}' and operator value '${newFilterItem.operator}'.`);
|
|
110
109
|
}
|
|
111
|
-
const hasUserFunctionLegacy = !isInternalFilter(filterOperator.getApplyFilterFn);
|
|
112
|
-
const hasUserFunctionV7 = !isInternalFilter(filterOperator.getApplyFilterFnV7);
|
|
113
110
|
const publicApiRef = getPublicApiRef(apiRef);
|
|
114
|
-
if (filterOperator.getApplyFilterFnV7 && !(hasUserFunctionLegacy && !hasUserFunctionV7)) {
|
|
115
|
-
const applyFilterOnRow = filterOperator.getApplyFilterFnV7(newFilterItem, column);
|
|
116
|
-
if (typeof applyFilterOnRow !== 'function') {
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
|
-
return {
|
|
120
|
-
v7: true,
|
|
121
|
-
item: newFilterItem,
|
|
122
|
-
fn: row => {
|
|
123
|
-
let value = apiRef.current.getRowValue(row, column);
|
|
124
|
-
if (ignoreDiacritics) {
|
|
125
|
-
value = removeDiacritics(value);
|
|
126
|
-
}
|
|
127
|
-
return applyFilterOnRow(value, row, column, publicApiRef);
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
111
|
const applyFilterOnRow = filterOperator.getApplyFilterFn(newFilterItem, column);
|
|
132
112
|
if (typeof applyFilterOnRow !== 'function') {
|
|
133
113
|
return null;
|
|
134
114
|
}
|
|
135
115
|
return {
|
|
136
|
-
v7: false,
|
|
137
116
|
item: newFilterItem,
|
|
138
|
-
fn:
|
|
139
|
-
|
|
140
|
-
GLOBAL_API_REF.current = publicApiRef;
|
|
117
|
+
fn: row => {
|
|
118
|
+
let value = apiRef.current.getRowValue(row, column);
|
|
141
119
|
if (ignoreDiacritics) {
|
|
142
|
-
|
|
120
|
+
value = removeDiacritics(value);
|
|
143
121
|
}
|
|
144
|
-
|
|
145
|
-
GLOBAL_API_REF.current = null;
|
|
146
|
-
return result;
|
|
122
|
+
return applyFilterOnRow(value, row, column, publicApiRef);
|
|
147
123
|
}
|
|
148
124
|
};
|
|
149
125
|
};
|
|
@@ -170,7 +146,7 @@ const buildAggregatedFilterItemsApplier = (filterModel, apiRef, disableEval) =>
|
|
|
170
146
|
for (let i = 0; i < appliers.length; i += 1) {
|
|
171
147
|
const applier = appliers[i];
|
|
172
148
|
if (!shouldApplyFilter || shouldApplyFilter(applier.item.field)) {
|
|
173
|
-
resultPerItemId[applier.item.id] = applier.
|
|
149
|
+
resultPerItemId[applier.item.id] = applier.fn(row);
|
|
174
150
|
}
|
|
175
151
|
}
|
|
176
152
|
return resultPerItemId;
|
|
@@ -186,7 +162,7 @@ const buildAggregatedFilterItemsApplier = (filterModel, apiRef, disableEval) =>
|
|
|
186
162
|
${appliers.map((applier, i) => `${JSON.stringify(String(applier.item.id))}:
|
|
187
163
|
!shouldApply${i} ?
|
|
188
164
|
false :
|
|
189
|
-
|
|
165
|
+
appliers[${i}].fn(row),
|
|
190
166
|
`).join('\n')}};
|
|
191
167
|
|
|
192
168
|
return result$$;
|
|
@@ -220,27 +196,12 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
|
220
196
|
columnFields.forEach(field => {
|
|
221
197
|
const column = apiRef.current.getColumn(field);
|
|
222
198
|
const getApplyQuickFilterFn = column?.getApplyQuickFilterFn;
|
|
223
|
-
|
|
224
|
-
const hasUserFunctionLegacy = !isInternalFilter(getApplyQuickFilterFn);
|
|
225
|
-
const hasUserFunctionV7 = !isInternalFilter(getApplyQuickFilterFnV7);
|
|
226
|
-
if (getApplyQuickFilterFnV7 && !(hasUserFunctionLegacy && !hasUserFunctionV7)) {
|
|
199
|
+
if (getApplyQuickFilterFn) {
|
|
227
200
|
appliersPerField.push({
|
|
228
201
|
column,
|
|
229
202
|
appliers: quickFilterValues.map(quickFilterValue => {
|
|
230
203
|
const value = ignoreDiacritics ? removeDiacritics(quickFilterValue) : quickFilterValue;
|
|
231
204
|
return {
|
|
232
|
-
v7: true,
|
|
233
|
-
fn: getApplyQuickFilterFnV7(value, column, publicApiRef)
|
|
234
|
-
};
|
|
235
|
-
})
|
|
236
|
-
});
|
|
237
|
-
} else if (getApplyQuickFilterFn) {
|
|
238
|
-
appliersPerField.push({
|
|
239
|
-
column,
|
|
240
|
-
appliers: quickFilterValues.map(quickFilterValue => {
|
|
241
|
-
const value = ignoreDiacritics ? removeDiacritics(quickFilterValue) : quickFilterValue;
|
|
242
|
-
return {
|
|
243
|
-
v7: false,
|
|
244
205
|
fn: getApplyQuickFilterFn(value, column, publicApiRef)
|
|
245
206
|
};
|
|
246
207
|
})
|
|
@@ -249,7 +210,6 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
|
249
210
|
});
|
|
250
211
|
return function isRowMatchingQuickFilter(row, shouldApplyFilter) {
|
|
251
212
|
const result = {};
|
|
252
|
-
const usedCellParams = {};
|
|
253
213
|
|
|
254
214
|
/* eslint-disable no-restricted-syntax, no-labels */
|
|
255
215
|
outer: for (let v = 0; v < quickFilterValues.length; v += 1) {
|
|
@@ -270,26 +230,13 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
|
270
230
|
if (applier.fn === null) {
|
|
271
231
|
continue;
|
|
272
232
|
}
|
|
273
|
-
if (
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
continue outer;
|
|
281
|
-
}
|
|
282
|
-
} else {
|
|
283
|
-
const cellParams = usedCellParams[field] ?? apiRef.current.getCellParams(apiRef.current.getRowId(row), field);
|
|
284
|
-
if (ignoreDiacritics) {
|
|
285
|
-
cellParams.value = removeDiacritics(cellParams.value);
|
|
286
|
-
}
|
|
287
|
-
usedCellParams[field] = cellParams;
|
|
288
|
-
const isMatching = applier.fn(cellParams);
|
|
289
|
-
if (isMatching) {
|
|
290
|
-
result[filterValue] = true;
|
|
291
|
-
continue outer;
|
|
292
|
-
}
|
|
233
|
+
if (ignoreDiacritics) {
|
|
234
|
+
value = removeDiacritics(value);
|
|
235
|
+
}
|
|
236
|
+
const isMatching = applier.fn(value, row, column, publicApiRef);
|
|
237
|
+
if (isMatching) {
|
|
238
|
+
result[filterValue] = true;
|
|
239
|
+
continue outer;
|
|
293
240
|
}
|
|
294
241
|
}
|
|
295
242
|
result[filterValue] = false;
|
|
@@ -283,7 +283,7 @@ export const useGridRows = (apiRef, props) => {
|
|
|
283
283
|
});
|
|
284
284
|
|
|
285
285
|
// Removes potential remaining skeleton rows from the dataRowIds.
|
|
286
|
-
const dataRowIds = rootGroupChildren.filter(childId => tree[childId]
|
|
286
|
+
const dataRowIds = rootGroupChildren.filter(childId => tree[childId]?.type === 'leaf');
|
|
287
287
|
apiRef.current.caches.rows.dataRowIdToModelLookup = dataRowIdToModelLookup;
|
|
288
288
|
apiRef.current.caches.rows.dataRowIdToIdLookup = dataRowIdToIdLookup;
|
|
289
289
|
apiRef.current.setState(state => _extends({}, state, {
|
package/modern/index.js
CHANGED
|
@@ -63,5 +63,4 @@ export * from '../utils/getPublicApiRef';
|
|
|
63
63
|
export { useGridPrivateApiContext } from '../hooks/utils/useGridPrivateApiContext';
|
|
64
64
|
export * from '../hooks/utils/useOnMount';
|
|
65
65
|
export { serializeCellValue } from '../hooks/features/export/serializers/csvSerializer';
|
|
66
|
-
export * from '../colDef/utils';
|
|
67
66
|
export * from './utils';
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { uncapitalizeObjectKeys } from './slotsMigration';
|
|
3
|
-
|
|
4
|
-
// TODO v7: Remove `components` and usages of `UncapitalizeObjectKeys` type
|
|
5
|
-
// after converting keys in Grid(Pro|Premium)SlotsComponent to camelCase.
|
|
6
|
-
// https://github.com/mui/mui-x/issues/7940
|
|
7
2
|
export function computeSlots({
|
|
8
3
|
defaultSlots,
|
|
9
|
-
slots
|
|
10
|
-
components
|
|
4
|
+
slots
|
|
11
5
|
}) {
|
|
12
|
-
const overrides = slots
|
|
6
|
+
const overrides = slots;
|
|
13
7
|
if (!overrides || Object.keys(overrides).length === 0) {
|
|
14
8
|
return defaultSlots;
|
|
15
9
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import _objectDestructuringEmpty from "@babel/runtime/helpers/esm/objectDestructuringEmpty";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
import * as React from 'react';
|
|
4
|
+
|
|
4
5
|
/** Gathers props for the root element into a single `.forwardedProps` field */
|
|
5
6
|
function groupForwardedProps(props) {
|
|
6
7
|
const keys = Object.keys(props);
|
|
@@ -22,11 +23,7 @@ function groupForwardedProps(props) {
|
|
|
22
23
|
}
|
|
23
24
|
export function useProps(allProps) {
|
|
24
25
|
return React.useMemo(() => {
|
|
25
|
-
const {
|
|
26
|
-
|
|
27
|
-
componentsProps
|
|
28
|
-
} = allProps,
|
|
29
|
-
themedProps = _objectWithoutPropertiesLoose(allProps, _excluded);
|
|
30
|
-
return [components, componentsProps, groupForwardedProps(themedProps)];
|
|
26
|
+
const themedProps = _extends({}, (_objectDestructuringEmpty(allProps), allProps));
|
|
27
|
+
return groupForwardedProps(themedProps);
|
|
31
28
|
}, [allProps]);
|
|
32
29
|
}
|
package/modern/locales/csCZ.js
CHANGED
|
@@ -150,8 +150,8 @@ const csCZGrid = {
|
|
|
150
150
|
// Actions cell more text
|
|
151
151
|
actionsCellMore: 'více',
|
|
152
152
|
// Column pinning text
|
|
153
|
-
pinToLeft: 'Připnout
|
|
154
|
-
pinToRight: 'Připnout
|
|
153
|
+
pinToLeft: 'Připnout vlevo',
|
|
154
|
+
pinToRight: 'Připnout vpravo',
|
|
155
155
|
unpin: 'Odepnout',
|
|
156
156
|
// Tree Data
|
|
157
157
|
treeDataGroupingHeaderName: 'Skupina',
|
package/modern/material/index.js
CHANGED
|
@@ -15,55 +15,55 @@ import { GridColumnUnsortedIcon } from './icons/GridColumnUnsortedIcon';
|
|
|
15
15
|
import { GridAddIcon, GridArrowDownwardIcon, GridArrowUpwardIcon, GridCheckIcon, GridCloseIcon, GridColumnIcon, GridDragIcon, GridExpandMoreIcon, GridFilterAltIcon, GridFilterListIcon, GridKeyboardArrowRight, GridMoreVertIcon, GridRemoveIcon, GridSaveAltIcon, GridSearchIcon, GridSeparatorIcon, GridTableRowsIcon, GridTripleDotsVerticalIcon, GridViewHeadlineIcon, GridViewStreamIcon, GridVisibilityOffIcon, GridViewColumnIcon, GridClearIcon, GridLoadIcon, GridDeleteForeverIcon } from './icons';
|
|
16
16
|
import MUISelectOption from './components/MUISelectOption';
|
|
17
17
|
const iconSlots = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
18
|
+
booleanCellTrueIcon: GridCheckIcon,
|
|
19
|
+
booleanCellFalseIcon: GridCloseIcon,
|
|
20
|
+
columnMenuIcon: GridTripleDotsVerticalIcon,
|
|
21
|
+
openFilterButtonIcon: GridFilterListIcon,
|
|
22
|
+
filterPanelDeleteIcon: GridCloseIcon,
|
|
23
|
+
columnFilteredIcon: GridFilterAltIcon,
|
|
24
|
+
columnSelectorIcon: GridColumnIcon,
|
|
25
|
+
columnUnsortedIcon: GridColumnUnsortedIcon,
|
|
26
|
+
columnSortedAscendingIcon: GridArrowUpwardIcon,
|
|
27
|
+
columnSortedDescendingIcon: GridArrowDownwardIcon,
|
|
28
|
+
columnResizeIcon: GridSeparatorIcon,
|
|
29
|
+
densityCompactIcon: GridViewHeadlineIcon,
|
|
30
|
+
densityStandardIcon: GridTableRowsIcon,
|
|
31
|
+
densityComfortableIcon: GridViewStreamIcon,
|
|
32
|
+
exportIcon: GridSaveAltIcon,
|
|
33
|
+
moreActionsIcon: GridMoreVertIcon,
|
|
34
|
+
treeDataCollapseIcon: GridExpandMoreIcon,
|
|
35
|
+
treeDataExpandIcon: GridKeyboardArrowRight,
|
|
36
|
+
groupingCriteriaCollapseIcon: GridExpandMoreIcon,
|
|
37
|
+
groupingCriteriaExpandIcon: GridKeyboardArrowRight,
|
|
38
|
+
detailPanelExpandIcon: GridAddIcon,
|
|
39
|
+
detailPanelCollapseIcon: GridRemoveIcon,
|
|
40
|
+
rowReorderIcon: GridDragIcon,
|
|
41
|
+
quickFilterIcon: GridSearchIcon,
|
|
42
|
+
quickFilterClearIcon: GridCloseIcon,
|
|
43
|
+
columnMenuHideIcon: GridVisibilityOffIcon,
|
|
44
|
+
columnMenuSortAscendingIcon: GridArrowUpwardIcon,
|
|
45
|
+
columnMenuSortDescendingIcon: GridArrowDownwardIcon,
|
|
46
|
+
columnMenuFilterIcon: GridFilterAltIcon,
|
|
47
|
+
columnMenuManageColumnsIcon: GridViewColumnIcon,
|
|
48
|
+
columnMenuClearIcon: GridClearIcon,
|
|
49
|
+
loadIcon: GridLoadIcon,
|
|
50
|
+
filterPanelAddIcon: GridAddIcon,
|
|
51
|
+
filterPanelRemoveAllIcon: GridDeleteForeverIcon,
|
|
52
|
+
columnReorderIcon: GridDragIcon
|
|
53
53
|
};
|
|
54
54
|
const materialSlots = _extends({}, iconSlots, {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
55
|
+
baseCheckbox: MUICheckbox,
|
|
56
|
+
baseTextField: MUITextField,
|
|
57
|
+
baseFormControl: MUIFormControl,
|
|
58
|
+
baseSelect: MUISelect,
|
|
59
|
+
baseSwitch: MUISwitch,
|
|
60
|
+
baseButton: MUIButton,
|
|
61
|
+
baseIconButton: MUIIconButton,
|
|
62
|
+
baseInputAdornment: MUIInputAdornment,
|
|
63
|
+
baseTooltip: MUITooltip,
|
|
64
|
+
basePopper: MUIPopper,
|
|
65
|
+
baseInputLabel: MUIInputLabel,
|
|
66
|
+
baseSelectOption: MUISelectOption,
|
|
67
|
+
baseChip: MUIChip
|
|
68
68
|
});
|
|
69
69
|
export default materialSlots;
|
|
@@ -133,16 +133,6 @@ DataGridRaw.propTypes = {
|
|
|
133
133
|
* If defined, the grid will ignore the `hide` property in [[GridColDef]].
|
|
134
134
|
*/
|
|
135
135
|
columnVisibilityModel: _propTypes.default.object,
|
|
136
|
-
/**
|
|
137
|
-
* Overridable components.
|
|
138
|
-
* @deprecated Use `slots` instead.
|
|
139
|
-
*/
|
|
140
|
-
components: _propTypes.default.object,
|
|
141
|
-
/**
|
|
142
|
-
* Overridable components props dynamically passed to the component at rendering.
|
|
143
|
-
* @deprecated Use the `slotProps` prop instead.
|
|
144
|
-
*/
|
|
145
|
-
componentsProps: _propTypes.default.object,
|
|
146
136
|
/**
|
|
147
137
|
* Set the density of the grid.
|
|
148
138
|
* @default "standard"
|
|
@@ -81,22 +81,20 @@ const DATA_GRID_PROPS_DEFAULT_VALUES = exports.DATA_GRID_PROPS_DEFAULT_VALUES =
|
|
|
81
81
|
clipboardCopyCellDelimiter: '\t',
|
|
82
82
|
rowPositionsDebounceMs: 166
|
|
83
83
|
};
|
|
84
|
-
const defaultSlots =
|
|
84
|
+
const defaultSlots = _defaultGridSlotsComponents.DATA_GRID_DEFAULT_SLOTS_COMPONENTS;
|
|
85
85
|
const useDataGridProps = inProps => {
|
|
86
|
-
const
|
|
86
|
+
const themedProps = (0, _utils.useProps)((0, _styles.useThemeProps)({
|
|
87
87
|
props: inProps,
|
|
88
88
|
name: 'MuiDataGrid'
|
|
89
89
|
}));
|
|
90
90
|
const localeText = React.useMemo(() => (0, _extends2.default)({}, _constants.GRID_DEFAULT_LOCALE_TEXT, themedProps.localeText), [themedProps.localeText]);
|
|
91
91
|
const slots = React.useMemo(() => (0, _utils.computeSlots)({
|
|
92
92
|
defaultSlots,
|
|
93
|
-
slots: themedProps.slots
|
|
94
|
-
|
|
95
|
-
}), [components, themedProps.slots]);
|
|
93
|
+
slots: themedProps.slots
|
|
94
|
+
}), [themedProps.slots]);
|
|
96
95
|
return React.useMemo(() => (0, _extends2.default)({}, DATA_GRID_PROPS_DEFAULT_VALUES, themedProps, {
|
|
97
96
|
localeText,
|
|
98
|
-
slots
|
|
99
|
-
|
|
100
|
-
}, DATA_GRID_FORCED_PROPS), [themedProps, localeText, slots, componentsProps]);
|
|
97
|
+
slots
|
|
98
|
+
}, DATA_GRID_FORCED_PROPS), [themedProps, localeText, slots]);
|
|
101
99
|
};
|
|
102
100
|
exports.useDataGridProps = useDataGridProps;
|
|
@@ -21,6 +21,5 @@ const GRID_ACTIONS_COL_DEF = exports.GRID_ACTIONS_COL_DEF = (0, _extends2.defaul
|
|
|
21
21
|
disableColumnMenu: true,
|
|
22
22
|
disableExport: true,
|
|
23
23
|
renderCell: _GridActionsCell.renderActionsCell,
|
|
24
|
-
getApplyQuickFilterFn: undefined
|
|
25
|
-
getApplyQuickFilterFnV7: undefined
|
|
24
|
+
getApplyQuickFilterFn: undefined
|
|
26
25
|
});
|
|
@@ -43,7 +43,6 @@ const GRID_BOOLEAN_COL_DEF = exports.GRID_BOOLEAN_COL_DEF = (0, _extends2.defaul
|
|
|
43
43
|
valueFormatter: gridBooleanFormatter,
|
|
44
44
|
filterOperators: (0, _gridBooleanOperators.getGridBooleanOperators)(),
|
|
45
45
|
getApplyQuickFilterFn: undefined,
|
|
46
|
-
getApplyQuickFilterFnV7: undefined,
|
|
47
46
|
// @ts-ignore
|
|
48
47
|
aggregable: false,
|
|
49
48
|
// @ts-ignore
|
|
@@ -5,10 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getGridBooleanOperators = void 0;
|
|
7
7
|
var _GridFilterInputBoolean = require("../components/panel/filterPanel/GridFilterInputBoolean");
|
|
8
|
-
|
|
9
|
-
const getGridBooleanOperators = () => (0, _utils.convertLegacyOperators)([{
|
|
8
|
+
const getGridBooleanOperators = () => [{
|
|
10
9
|
value: 'is',
|
|
11
|
-
|
|
10
|
+
getApplyFilterFn: filterItem => {
|
|
12
11
|
if (!filterItem.value) {
|
|
13
12
|
return null;
|
|
14
13
|
}
|
|
@@ -18,5 +17,5 @@ const getGridBooleanOperators = () => (0, _utils.convertLegacyOperators)([{
|
|
|
18
17
|
};
|
|
19
18
|
},
|
|
20
19
|
InputComponent: _GridFilterInputBoolean.GridFilterInputBoolean
|
|
21
|
-
}]
|
|
20
|
+
}];
|
|
22
21
|
exports.getGridBooleanOperators = getGridBooleanOperators;
|
|
@@ -28,7 +28,6 @@ const GRID_CHECKBOX_SELECTION_COL_DEF = exports.GRID_CHECKBOX_SELECTION_COL_DEF
|
|
|
28
28
|
disableReorder: true,
|
|
29
29
|
disableExport: true,
|
|
30
30
|
getApplyQuickFilterFn: undefined,
|
|
31
|
-
getApplyQuickFilterFnV7: undefined,
|
|
32
31
|
valueGetter: params => {
|
|
33
32
|
const selectionLookup = (0, _gridRowSelectionSelector.selectedIdsLookupSelector)(params.api.state, params.api.instanceId);
|
|
34
33
|
return selectionLookup[params.id] !== undefined;
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getGridDateOperators = void 0;
|
|
7
7
|
var _GridFilterInputDate = require("../components/panel/filterPanel/GridFilterInputDate");
|
|
8
|
-
var _utils = require("./utils");
|
|
9
8
|
const dateRegex = /(\d+)-(\d+)-(\d+)/;
|
|
10
9
|
const dateTimeRegex = /(\d+)-(\d+)-(\d+)T(\d+):(\d+)/;
|
|
11
10
|
function buildApplyFilterFn(filterItem, compareFn, showTime, keepHours) {
|
|
@@ -28,9 +27,9 @@ function buildApplyFilterFn(filterItem, compareFn, showTime, keepHours) {
|
|
|
28
27
|
return compareFn(timeToCompare, time);
|
|
29
28
|
};
|
|
30
29
|
}
|
|
31
|
-
const getGridDateOperators = showTime =>
|
|
30
|
+
const getGridDateOperators = showTime => [{
|
|
32
31
|
value: 'is',
|
|
33
|
-
|
|
32
|
+
getApplyFilterFn: filterItem => {
|
|
34
33
|
return buildApplyFilterFn(filterItem, (value1, value2) => value1 === value2, showTime);
|
|
35
34
|
},
|
|
36
35
|
InputComponent: _GridFilterInputDate.GridFilterInputDate,
|
|
@@ -39,7 +38,7 @@ const getGridDateOperators = showTime => (0, _utils.convertLegacyOperators)([{
|
|
|
39
38
|
}
|
|
40
39
|
}, {
|
|
41
40
|
value: 'not',
|
|
42
|
-
|
|
41
|
+
getApplyFilterFn: filterItem => {
|
|
43
42
|
return buildApplyFilterFn(filterItem, (value1, value2) => value1 !== value2, showTime);
|
|
44
43
|
},
|
|
45
44
|
InputComponent: _GridFilterInputDate.GridFilterInputDate,
|
|
@@ -48,7 +47,7 @@ const getGridDateOperators = showTime => (0, _utils.convertLegacyOperators)([{
|
|
|
48
47
|
}
|
|
49
48
|
}, {
|
|
50
49
|
value: 'after',
|
|
51
|
-
|
|
50
|
+
getApplyFilterFn: filterItem => {
|
|
52
51
|
return buildApplyFilterFn(filterItem, (value1, value2) => value1 > value2, showTime);
|
|
53
52
|
},
|
|
54
53
|
InputComponent: _GridFilterInputDate.GridFilterInputDate,
|
|
@@ -57,7 +56,7 @@ const getGridDateOperators = showTime => (0, _utils.convertLegacyOperators)([{
|
|
|
57
56
|
}
|
|
58
57
|
}, {
|
|
59
58
|
value: 'onOrAfter',
|
|
60
|
-
|
|
59
|
+
getApplyFilterFn: filterItem => {
|
|
61
60
|
return buildApplyFilterFn(filterItem, (value1, value2) => value1 >= value2, showTime);
|
|
62
61
|
},
|
|
63
62
|
InputComponent: _GridFilterInputDate.GridFilterInputDate,
|
|
@@ -66,7 +65,7 @@ const getGridDateOperators = showTime => (0, _utils.convertLegacyOperators)([{
|
|
|
66
65
|
}
|
|
67
66
|
}, {
|
|
68
67
|
value: 'before',
|
|
69
|
-
|
|
68
|
+
getApplyFilterFn: filterItem => {
|
|
70
69
|
return buildApplyFilterFn(filterItem, (value1, value2) => value1 < value2, showTime, !showTime);
|
|
71
70
|
},
|
|
72
71
|
InputComponent: _GridFilterInputDate.GridFilterInputDate,
|
|
@@ -75,7 +74,7 @@ const getGridDateOperators = showTime => (0, _utils.convertLegacyOperators)([{
|
|
|
75
74
|
}
|
|
76
75
|
}, {
|
|
77
76
|
value: 'onOrBefore',
|
|
78
|
-
|
|
77
|
+
getApplyFilterFn: filterItem => {
|
|
79
78
|
return buildApplyFilterFn(filterItem, (value1, value2) => value1 <= value2, showTime);
|
|
80
79
|
},
|
|
81
80
|
InputComponent: _GridFilterInputDate.GridFilterInputDate,
|
|
@@ -84,7 +83,7 @@ const getGridDateOperators = showTime => (0, _utils.convertLegacyOperators)([{
|
|
|
84
83
|
}
|
|
85
84
|
}, {
|
|
86
85
|
value: 'isEmpty',
|
|
87
|
-
|
|
86
|
+
getApplyFilterFn: () => {
|
|
88
87
|
return value => {
|
|
89
88
|
return value == null;
|
|
90
89
|
};
|
|
@@ -92,11 +91,11 @@ const getGridDateOperators = showTime => (0, _utils.convertLegacyOperators)([{
|
|
|
92
91
|
requiresFilterValue: false
|
|
93
92
|
}, {
|
|
94
93
|
value: 'isNotEmpty',
|
|
95
|
-
|
|
94
|
+
getApplyFilterFn: () => {
|
|
96
95
|
return value => {
|
|
97
96
|
return value != null;
|
|
98
97
|
};
|
|
99
98
|
},
|
|
100
99
|
requiresFilterValue: false
|
|
101
|
-
}]
|
|
100
|
+
}];
|
|
102
101
|
exports.getGridDateOperators = getGridDateOperators;
|
|
@@ -10,7 +10,6 @@ var _gridSortingUtils = require("../hooks/features/sorting/gridSortingUtils");
|
|
|
10
10
|
var _utils = require("../utils/utils");
|
|
11
11
|
var _gridNumericOperators = require("./gridNumericOperators");
|
|
12
12
|
var _gridStringColDef = require("./gridStringColDef");
|
|
13
|
-
var _utils2 = require("./utils");
|
|
14
13
|
const GRID_NUMERIC_COL_DEF = exports.GRID_NUMERIC_COL_DEF = (0, _extends2.default)({}, _gridStringColDef.GRID_STRING_COL_DEF, {
|
|
15
14
|
type: 'number',
|
|
16
15
|
align: 'right',
|
|
@@ -21,6 +20,5 @@ const GRID_NUMERIC_COL_DEF = exports.GRID_NUMERIC_COL_DEF = (0, _extends2.defaul
|
|
|
21
20
|
value
|
|
22
21
|
}) => (0, _utils.isNumber)(value) ? value.toLocaleString() : value || '',
|
|
23
22
|
filterOperators: (0, _gridNumericOperators.getGridNumericOperators)(),
|
|
24
|
-
getApplyQuickFilterFn:
|
|
25
|
-
getApplyQuickFilterFnV7: _gridNumericOperators.getGridNumericQuickFilterFn
|
|
23
|
+
getApplyQuickFilterFn: _gridNumericOperators.getGridNumericQuickFilterFn
|
|
26
24
|
});
|
|
@@ -6,24 +6,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getGridNumericQuickFilterFn = exports.getGridNumericOperators = void 0;
|
|
7
7
|
var _GridFilterInputValue = require("../components/panel/filterPanel/GridFilterInputValue");
|
|
8
8
|
var _GridFilterInputMultipleValue = require("../components/panel/filterPanel/GridFilterInputMultipleValue");
|
|
9
|
-
var _utils = require("./utils");
|
|
10
9
|
const parseNumericValue = value => {
|
|
11
10
|
if (value == null) {
|
|
12
11
|
return null;
|
|
13
12
|
}
|
|
14
13
|
return Number(value);
|
|
15
14
|
};
|
|
16
|
-
const getGridNumericQuickFilterFn =
|
|
15
|
+
const getGridNumericQuickFilterFn = value => {
|
|
17
16
|
if (value == null || Number.isNaN(value) || value === '') {
|
|
18
17
|
return null;
|
|
19
18
|
}
|
|
20
19
|
return columnValue => {
|
|
21
20
|
return parseNumericValue(columnValue) === parseNumericValue(value);
|
|
22
21
|
};
|
|
23
|
-
}
|
|
24
|
-
|
|
22
|
+
};
|
|
23
|
+
exports.getGridNumericQuickFilterFn = getGridNumericQuickFilterFn;
|
|
24
|
+
const getGridNumericOperators = () => [{
|
|
25
25
|
value: '=',
|
|
26
|
-
|
|
26
|
+
getApplyFilterFn: filterItem => {
|
|
27
27
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
28
28
|
return null;
|
|
29
29
|
}
|
|
@@ -37,7 +37,7 @@ const getGridNumericOperators = () => (0, _utils.convertLegacyOperators)([{
|
|
|
37
37
|
}
|
|
38
38
|
}, {
|
|
39
39
|
value: '!=',
|
|
40
|
-
|
|
40
|
+
getApplyFilterFn: filterItem => {
|
|
41
41
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
42
42
|
return null;
|
|
43
43
|
}
|
|
@@ -51,7 +51,7 @@ const getGridNumericOperators = () => (0, _utils.convertLegacyOperators)([{
|
|
|
51
51
|
}
|
|
52
52
|
}, {
|
|
53
53
|
value: '>',
|
|
54
|
-
|
|
54
|
+
getApplyFilterFn: filterItem => {
|
|
55
55
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
56
56
|
return null;
|
|
57
57
|
}
|
|
@@ -68,7 +68,7 @@ const getGridNumericOperators = () => (0, _utils.convertLegacyOperators)([{
|
|
|
68
68
|
}
|
|
69
69
|
}, {
|
|
70
70
|
value: '>=',
|
|
71
|
-
|
|
71
|
+
getApplyFilterFn: filterItem => {
|
|
72
72
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
73
73
|
return null;
|
|
74
74
|
}
|
|
@@ -85,7 +85,7 @@ const getGridNumericOperators = () => (0, _utils.convertLegacyOperators)([{
|
|
|
85
85
|
}
|
|
86
86
|
}, {
|
|
87
87
|
value: '<',
|
|
88
|
-
|
|
88
|
+
getApplyFilterFn: filterItem => {
|
|
89
89
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
90
90
|
return null;
|
|
91
91
|
}
|
|
@@ -102,7 +102,7 @@ const getGridNumericOperators = () => (0, _utils.convertLegacyOperators)([{
|
|
|
102
102
|
}
|
|
103
103
|
}, {
|
|
104
104
|
value: '<=',
|
|
105
|
-
|
|
105
|
+
getApplyFilterFn: filterItem => {
|
|
106
106
|
if (filterItem.value == null || Number.isNaN(filterItem.value)) {
|
|
107
107
|
return null;
|
|
108
108
|
}
|
|
@@ -119,7 +119,7 @@ const getGridNumericOperators = () => (0, _utils.convertLegacyOperators)([{
|
|
|
119
119
|
}
|
|
120
120
|
}, {
|
|
121
121
|
value: 'isEmpty',
|
|
122
|
-
|
|
122
|
+
getApplyFilterFn: () => {
|
|
123
123
|
return value => {
|
|
124
124
|
return value == null;
|
|
125
125
|
};
|
|
@@ -127,7 +127,7 @@ const getGridNumericOperators = () => (0, _utils.convertLegacyOperators)([{
|
|
|
127
127
|
requiresFilterValue: false
|
|
128
128
|
}, {
|
|
129
129
|
value: 'isNotEmpty',
|
|
130
|
-
|
|
130
|
+
getApplyFilterFn: () => {
|
|
131
131
|
return value => {
|
|
132
132
|
return value != null;
|
|
133
133
|
};
|
|
@@ -135,7 +135,7 @@ const getGridNumericOperators = () => (0, _utils.convertLegacyOperators)([{
|
|
|
135
135
|
requiresFilterValue: false
|
|
136
136
|
}, {
|
|
137
137
|
value: 'isAnyOf',
|
|
138
|
-
|
|
138
|
+
getApplyFilterFn: filterItem => {
|
|
139
139
|
if (!Array.isArray(filterItem.value) || filterItem.value.length === 0) {
|
|
140
140
|
return null;
|
|
141
141
|
}
|
|
@@ -147,5 +147,5 @@ const getGridNumericOperators = () => (0, _utils.convertLegacyOperators)([{
|
|
|
147
147
|
InputComponentProps: {
|
|
148
148
|
type: 'number'
|
|
149
149
|
}
|
|
150
|
-
}]
|
|
150
|
+
}];
|
|
151
151
|
exports.getGridNumericOperators = getGridNumericOperators;
|