@mui/x-data-grid 6.9.0 → 6.9.2
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 +136 -8
- package/DataGrid/DataGrid.js +4 -1
- package/DataGrid/useDataGridComponent.js +1 -1
- package/README.md +1 -1
- package/colDef/gridActionsColDef.js +2 -1
- package/colDef/gridBooleanColDef.js +1 -0
- package/colDef/gridBooleanOperators.js +5 -6
- package/colDef/gridCheckboxSelectionColDef.js +1 -0
- package/colDef/gridDateColDef.js +2 -0
- package/colDef/gridDateOperators.js +14 -19
- package/colDef/gridNumericColDef.js +3 -1
- package/colDef/gridNumericOperators.d.ts +2 -2
- package/colDef/gridNumericOperators.js +24 -43
- package/colDef/gridSingleSelectOperators.js +9 -14
- package/colDef/gridStringColDef.js +3 -1
- package/colDef/gridStringOperators.d.ts +2 -2
- package/colDef/gridStringOperators.js +22 -36
- package/colDef/utils.d.ts +21 -0
- package/colDef/utils.js +51 -0
- package/components/GridPagination.js +16 -3
- package/components/cell/GridCell.js +1 -1
- package/components/cell/GridEditDateCell.js +1 -1
- package/components/cell/GridEditInputCell.js +3 -3
- package/hooks/features/columns/gridColumnsUtils.js +2 -1
- package/hooks/features/dimensions/useGridDimensions.js +2 -2
- package/hooks/features/editing/useGridEditing.js +2 -1
- package/hooks/features/editing/useGridRowEditing.js +2 -2
- package/hooks/features/filter/gridFilterState.d.ts +6 -5
- package/hooks/features/filter/gridFilterUtils.d.ts +8 -6
- package/hooks/features/filter/gridFilterUtils.js +115 -57
- package/hooks/features/filter/useGridFilter.d.ts +1 -1
- package/hooks/features/filter/useGridFilter.js +34 -25
- package/hooks/features/pagination/gridPaginationSelector.js +10 -5
- package/hooks/features/rows/gridRowsUtils.d.ts +1 -0
- package/hooks/features/rows/gridRowsUtils.js +1 -0
- package/hooks/features/rows/useGridParamsApi.d.ts +2 -1
- package/hooks/features/rows/useGridParamsApi.js +31 -1
- package/hooks/features/rows/useGridRows.js +4 -3
- package/index.js +1 -1
- package/internals/index.d.ts +2 -1
- package/internals/index.js +1 -0
- package/joy/joySlots.js +29 -8
- package/legacy/DataGrid/DataGrid.js +4 -1
- package/legacy/DataGrid/useDataGridComponent.js +1 -1
- package/legacy/colDef/gridActionsColDef.js +2 -1
- package/legacy/colDef/gridBooleanColDef.js +1 -0
- package/legacy/colDef/gridBooleanOperators.js +5 -5
- package/legacy/colDef/gridCheckboxSelectionColDef.js +1 -0
- package/legacy/colDef/gridDateColDef.js +2 -0
- package/legacy/colDef/gridDateOperators.js +14 -16
- package/legacy/colDef/gridNumericColDef.js +3 -1
- package/legacy/colDef/gridNumericOperators.js +24 -33
- package/legacy/colDef/gridSingleSelectOperators.js +9 -11
- package/legacy/colDef/gridStringColDef.js +3 -1
- package/legacy/colDef/gridStringOperators.js +22 -28
- package/legacy/colDef/utils.js +51 -0
- package/legacy/components/GridPagination.js +16 -3
- package/legacy/components/cell/GridCell.js +2 -1
- package/legacy/components/cell/GridEditDateCell.js +1 -1
- package/legacy/components/cell/GridEditInputCell.js +3 -3
- package/legacy/hooks/features/columns/gridColumnsUtils.js +4 -1
- package/legacy/hooks/features/dimensions/useGridDimensions.js +2 -2
- package/legacy/hooks/features/editing/useGridEditing.js +2 -1
- package/legacy/hooks/features/editing/useGridRowEditing.js +2 -2
- package/legacy/hooks/features/filter/gridFilterUtils.js +115 -65
- package/legacy/hooks/features/filter/useGridFilter.js +32 -24
- package/legacy/hooks/features/pagination/gridPaginationSelector.js +10 -5
- package/legacy/hooks/features/rows/gridRowsUtils.js +1 -0
- package/legacy/hooks/features/rows/useGridParamsApi.js +29 -1
- package/legacy/hooks/features/rows/useGridRows.js +15 -16
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +1 -0
- package/legacy/joy/joySlots.js +29 -8
- package/legacy/locales/esES.js +3 -3
- package/legacy/locales/huHU.js +23 -25
- package/legacy/locales/roRO.js +34 -38
- package/locales/esES.js +3 -3
- package/locales/huHU.js +23 -25
- package/locales/roRO.js +34 -38
- package/models/api/gridEditingApi.d.ts +1 -1
- package/models/api/gridParamsApi.d.ts +22 -1
- package/models/colDef/gridColDef.d.ts +13 -1
- package/models/gridFilterOperator.d.ts +17 -2
- package/models/gridRows.d.ts +1 -1
- package/models/props/DataGridProps.d.ts +4 -1
- package/modern/DataGrid/DataGrid.js +4 -1
- package/modern/DataGrid/useDataGridComponent.js +1 -1
- package/modern/colDef/gridActionsColDef.js +2 -1
- package/modern/colDef/gridBooleanColDef.js +1 -0
- package/modern/colDef/gridBooleanOperators.js +5 -6
- package/modern/colDef/gridCheckboxSelectionColDef.js +1 -0
- package/modern/colDef/gridDateColDef.js +2 -0
- package/modern/colDef/gridDateOperators.js +14 -19
- package/modern/colDef/gridNumericColDef.js +3 -1
- package/modern/colDef/gridNumericOperators.js +24 -43
- package/modern/colDef/gridSingleSelectOperators.js +9 -14
- package/modern/colDef/gridStringColDef.js +3 -1
- package/modern/colDef/gridStringOperators.js +22 -36
- package/modern/colDef/utils.js +51 -0
- package/modern/components/GridPagination.js +16 -2
- package/modern/components/cell/GridCell.js +1 -1
- package/modern/components/cell/GridEditDateCell.js +1 -1
- package/modern/components/cell/GridEditInputCell.js +3 -3
- package/modern/hooks/features/columns/gridColumnsUtils.js +2 -1
- package/modern/hooks/features/dimensions/useGridDimensions.js +2 -2
- package/modern/hooks/features/editing/useGridEditing.js +1 -1
- package/modern/hooks/features/editing/useGridRowEditing.js +2 -2
- package/modern/hooks/features/filter/gridFilterUtils.js +110 -54
- package/modern/hooks/features/filter/useGridFilter.js +34 -25
- package/modern/hooks/features/pagination/gridPaginationSelector.js +9 -5
- package/modern/hooks/features/rows/gridRowsUtils.js +1 -0
- package/modern/hooks/features/rows/useGridParamsApi.js +29 -1
- package/modern/hooks/features/rows/useGridRows.js +4 -3
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -0
- package/modern/joy/joySlots.js +29 -7
- package/modern/locales/esES.js +3 -3
- package/modern/locales/huHU.js +23 -25
- package/modern/locales/roRO.js +34 -38
- package/node/DataGrid/DataGrid.js +4 -1
- package/node/DataGrid/useDataGridComponent.js +1 -1
- package/node/colDef/gridActionsColDef.js +2 -1
- package/node/colDef/gridBooleanColDef.js +1 -0
- package/node/colDef/gridBooleanOperators.js +5 -6
- package/node/colDef/gridCheckboxSelectionColDef.js +1 -0
- package/node/colDef/gridDateColDef.js +2 -0
- package/node/colDef/gridDateOperators.js +14 -19
- package/node/colDef/gridNumericColDef.js +3 -1
- package/node/colDef/gridNumericOperators.js +24 -43
- package/node/colDef/gridSingleSelectOperators.js +9 -14
- package/node/colDef/gridStringColDef.js +3 -1
- package/node/colDef/gridStringOperators.js +22 -36
- package/node/colDef/utils.js +64 -0
- package/node/components/GridPagination.js +16 -2
- package/node/components/cell/GridCell.js +1 -1
- package/node/components/cell/GridEditDateCell.js +1 -1
- package/node/components/cell/GridEditInputCell.js +3 -3
- package/node/hooks/features/columns/gridColumnsUtils.js +2 -1
- package/node/hooks/features/dimensions/useGridDimensions.js +2 -2
- package/node/hooks/features/editing/useGridEditing.js +1 -1
- package/node/hooks/features/editing/useGridRowEditing.js +1 -1
- package/node/hooks/features/filter/gridFilterUtils.js +110 -54
- package/node/hooks/features/filter/useGridFilter.js +33 -24
- package/node/hooks/features/pagination/gridPaginationSelector.js +9 -5
- package/node/hooks/features/rows/gridRowsUtils.js +3 -1
- package/node/hooks/features/rows/useGridParamsApi.js +29 -1
- package/node/hooks/features/rows/useGridRows.js +3 -2
- package/node/index.js +1 -1
- package/node/internals/index.js +13 -1
- package/node/joy/joySlots.js +29 -7
- package/node/locales/esES.js +3 -3
- package/node/locales/huHU.js +23 -25
- package/node/locales/roRO.js +34 -38
- package/package.json +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
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';
|
|
3
4
|
import { getDefaultGridFilterModel } from './gridFilterState';
|
|
4
5
|
import { buildWarning } from '../../../utils/warning';
|
|
5
6
|
import { gridColumnFieldsSelector, gridColumnLookupSelector } from '../columns';
|
|
@@ -85,27 +86,47 @@ const getFilterCallbackFromItem = (filterItem, apiRef) => {
|
|
|
85
86
|
if (!filterOperator) {
|
|
86
87
|
throw new Error(`MUI: No filter operator found for column '${column.field}' and operator value '${newFilterItem.operator}'.`);
|
|
87
88
|
}
|
|
89
|
+
const hasUserFunctionLegacy = !isInternalFilter(filterOperator.getApplyFilterFn);
|
|
90
|
+
const hasUserFunctionV7 = !isInternalFilter(filterOperator.getApplyFilterFnV7);
|
|
91
|
+
if (filterOperator.getApplyFilterFnV7 && !(hasUserFunctionLegacy && !hasUserFunctionV7)) {
|
|
92
|
+
const applyFilterOnRow = filterOperator.getApplyFilterFnV7(newFilterItem, column);
|
|
93
|
+
if (typeof applyFilterOnRow !== 'function') {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
v7: true,
|
|
98
|
+
item: newFilterItem,
|
|
99
|
+
fn: row => {
|
|
100
|
+
const value = apiRef.current.getRowValue(row, column);
|
|
101
|
+
return applyFilterOnRow(value, row, column, apiRef);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
}
|
|
88
105
|
const applyFilterOnRow = filterOperator.getApplyFilterFn(newFilterItem, column);
|
|
89
106
|
if (typeof applyFilterOnRow !== 'function') {
|
|
90
107
|
return null;
|
|
91
108
|
}
|
|
92
|
-
const fn = rowId => {
|
|
93
|
-
const cellParams = apiRef.current.getCellParams(rowId, newFilterItem.field);
|
|
94
|
-
return applyFilterOnRow(cellParams);
|
|
95
|
-
};
|
|
96
109
|
return {
|
|
97
|
-
|
|
98
|
-
item: newFilterItem
|
|
110
|
+
v7: false,
|
|
111
|
+
item: newFilterItem,
|
|
112
|
+
fn: rowId => {
|
|
113
|
+
const params = apiRef.current.getCellParams(rowId, newFilterItem.field);
|
|
114
|
+
GLOBAL_API_REF.current = apiRef;
|
|
115
|
+
const result = applyFilterOnRow(params);
|
|
116
|
+
GLOBAL_API_REF.current = null;
|
|
117
|
+
return result;
|
|
118
|
+
}
|
|
99
119
|
};
|
|
100
120
|
};
|
|
101
121
|
|
|
102
122
|
/**
|
|
103
123
|
* Generates a method to easily check if a row is matching the current filter model.
|
|
124
|
+
* @param {GridRowIdGetter | undefined} getRowId The getter for row's id.
|
|
104
125
|
* @param {GridFilterModel} filterModel The model with which we want to filter the rows.
|
|
105
126
|
* @param {React.MutableRefObject<GridApiCommunity>} apiRef The API of the grid.
|
|
106
127
|
* @returns {GridAggregatedFilterItemApplier | null} A method that checks if a row is matching the current filter model. If `null`, we consider that all the rows are matching the filters.
|
|
107
128
|
*/
|
|
108
|
-
export const buildAggregatedFilterItemsApplier = (filterModel, apiRef) => {
|
|
129
|
+
export const buildAggregatedFilterItemsApplier = (getRowId, filterModel, apiRef) => {
|
|
109
130
|
const {
|
|
110
131
|
items
|
|
111
132
|
} = filterModel;
|
|
@@ -113,75 +134,112 @@ export const buildAggregatedFilterItemsApplier = (filterModel, apiRef) => {
|
|
|
113
134
|
if (appliers.length === 0) {
|
|
114
135
|
return null;
|
|
115
136
|
}
|
|
116
|
-
return (
|
|
137
|
+
return (row, shouldApplyFilter) => {
|
|
117
138
|
const resultPerItemId = {};
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
139
|
+
for (let i = 0; i < appliers.length; i += 1) {
|
|
140
|
+
const applier = appliers[i];
|
|
141
|
+
if (!shouldApplyFilter || shouldApplyFilter(applier.item.field)) {
|
|
142
|
+
resultPerItemId[applier.item.id] = applier.v7 ? applier.fn(row) : applier.fn(getRowId ? getRowId(row) : row.id);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
122
145
|
return resultPerItemId;
|
|
123
146
|
};
|
|
124
147
|
};
|
|
125
148
|
|
|
126
149
|
/**
|
|
127
150
|
* Generates a method to easily check if a row is matching the current quick filter.
|
|
128
|
-
* @param {
|
|
151
|
+
* @param {GridRowIdGetter | undefined} getRowId The getter for row's id.
|
|
152
|
+
* @param {any[]} filterModel The model with which we want to filter the rows.
|
|
129
153
|
* @param {React.MutableRefObject<GridApiCommunity>} apiRef The API of the grid.
|
|
130
154
|
* @returns {GridAggregatedFilterItemApplier | null} A method that checks if a row is matching the current filter model. If `null`, we consider that all the rows are matching the filters.
|
|
131
155
|
*/
|
|
132
|
-
export const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
} = filterModel;
|
|
156
|
+
export const buildAggregatedQuickFilterApplier = (getRowId, filterModel, apiRef) => {
|
|
157
|
+
var _filterModel$quickFil, _filterModel$quickFil2;
|
|
158
|
+
const quickFilterValues = (_filterModel$quickFil = (_filterModel$quickFil2 = filterModel.quickFilterValues) == null ? void 0 : _filterModel$quickFil2.filter(Boolean)) != null ? _filterModel$quickFil : [];
|
|
136
159
|
if (quickFilterValues.length === 0) {
|
|
137
160
|
return null;
|
|
138
161
|
}
|
|
139
|
-
const
|
|
140
|
-
const appliersPerField =
|
|
141
|
-
|
|
162
|
+
const columnFields = gridColumnFieldsSelector(apiRef);
|
|
163
|
+
const appliersPerField = [];
|
|
164
|
+
columnFields.forEach(field => {
|
|
142
165
|
const column = apiRef.current.getColumn(field);
|
|
143
166
|
const getApplyQuickFilterFn = column == null ? void 0 : column.getApplyQuickFilterFn;
|
|
144
|
-
|
|
145
|
-
|
|
167
|
+
const getApplyQuickFilterFnV7 = column == null ? void 0 : column.getApplyQuickFilterFnV7;
|
|
168
|
+
const hasUserFunctionLegacy = !isInternalFilter(getApplyQuickFilterFn);
|
|
169
|
+
const hasUserFunctionV7 = !isInternalFilter(getApplyQuickFilterFnV7);
|
|
170
|
+
if (getApplyQuickFilterFnV7 && !(hasUserFunctionLegacy && !hasUserFunctionV7)) {
|
|
171
|
+
appliersPerField.push({
|
|
172
|
+
column,
|
|
173
|
+
appliers: quickFilterValues.map(value => ({
|
|
174
|
+
v7: true,
|
|
175
|
+
fn: getApplyQuickFilterFnV7(value, column, apiRef)
|
|
176
|
+
}))
|
|
177
|
+
});
|
|
178
|
+
} else if (getApplyQuickFilterFn) {
|
|
179
|
+
appliersPerField.push({
|
|
180
|
+
column,
|
|
181
|
+
appliers: quickFilterValues.map(value => ({
|
|
182
|
+
v7: false,
|
|
183
|
+
fn: getApplyQuickFilterFn(value, column, apiRef)
|
|
184
|
+
}))
|
|
185
|
+
});
|
|
146
186
|
}
|
|
147
|
-
appliersPerField[field] = quickFilterValues.map(value => getApplyQuickFilterFn(value, column, apiRef));
|
|
148
187
|
});
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
const sanitizedQuickFilterValues = quickFilterValues.filter((value, index) => Object.keys(appliersPerField).some(field => appliersPerField[field][index] != null));
|
|
152
|
-
if (sanitizedQuickFilterValues.length === 0) {
|
|
153
|
-
return null;
|
|
154
|
-
}
|
|
155
|
-
return (rowId, shouldApplyFilter) => {
|
|
188
|
+
return function isRowMatchingQuickFilter(row, shouldApplyFilter) {
|
|
189
|
+
const result = {};
|
|
156
190
|
const usedCellParams = {};
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
191
|
+
|
|
192
|
+
/* eslint-disable no-restricted-syntax, no-labels, no-continue */
|
|
193
|
+
outer: for (let v = 0; v < quickFilterValues.length; v += 1) {
|
|
194
|
+
const filterValue = quickFilterValues[v];
|
|
195
|
+
for (let i = 0; i < appliersPerField.length; i += 1) {
|
|
196
|
+
const {
|
|
197
|
+
column,
|
|
198
|
+
appliers
|
|
199
|
+
} = appliersPerField[i];
|
|
200
|
+
const {
|
|
201
|
+
field
|
|
202
|
+
} = column;
|
|
203
|
+
if (shouldApplyFilter && !shouldApplyFilter(field)) {
|
|
204
|
+
continue;
|
|
170
205
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
206
|
+
const applier = appliers[v];
|
|
207
|
+
const value = apiRef.current.getRowValue(row, column);
|
|
208
|
+
if (applier.fn === null) {
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
if (applier.v7) {
|
|
212
|
+
const isMatching = applier.fn(value, row, column, apiRef);
|
|
213
|
+
if (isMatching) {
|
|
214
|
+
result[filterValue] = true;
|
|
215
|
+
continue outer;
|
|
216
|
+
}
|
|
217
|
+
} else {
|
|
218
|
+
var _usedCellParams$field;
|
|
219
|
+
const cellParams = (_usedCellParams$field = usedCellParams[field]) != null ? _usedCellParams$field : apiRef.current.getCellParams(getRowId ? getRowId(row) : row.id, field);
|
|
220
|
+
usedCellParams[field] = cellParams;
|
|
221
|
+
const isMatching = applier.fn(cellParams);
|
|
222
|
+
if (isMatching) {
|
|
223
|
+
result[filterValue] = true;
|
|
224
|
+
continue outer;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
result[filterValue] = false;
|
|
229
|
+
}
|
|
230
|
+
/* eslint-enable no-restricted-syntax, no-labels, no-continue */
|
|
231
|
+
|
|
232
|
+
return result;
|
|
176
233
|
};
|
|
177
234
|
};
|
|
178
|
-
export const buildAggregatedFilterApplier = (filterModel, apiRef) => {
|
|
179
|
-
const isRowMatchingFilterItems = buildAggregatedFilterItemsApplier(filterModel, apiRef);
|
|
180
|
-
const isRowMatchingQuickFilter = buildAggregatedQuickFilterApplier(filterModel, apiRef);
|
|
181
|
-
return (
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
235
|
+
export const buildAggregatedFilterApplier = (getRowId, filterModel, apiRef) => {
|
|
236
|
+
const isRowMatchingFilterItems = buildAggregatedFilterItemsApplier(getRowId, filterModel, apiRef);
|
|
237
|
+
const isRowMatchingQuickFilter = buildAggregatedQuickFilterApplier(getRowId, filterModel, apiRef);
|
|
238
|
+
return function isRowMatchingFilters(row, shouldApplyFilter, result) {
|
|
239
|
+
var _isRowMatchingFilterI, _isRowMatchingQuickFi;
|
|
240
|
+
result.passingFilterItems = (_isRowMatchingFilterI = isRowMatchingFilterItems == null ? void 0 : isRowMatchingFilterItems(row, shouldApplyFilter)) != null ? _isRowMatchingFilterI : null;
|
|
241
|
+
result.passingQuickFilterValues = (_isRowMatchingQuickFi = isRowMatchingQuickFilter == null ? void 0 : isRowMatchingQuickFilter(row, shouldApplyFilter)) != null ? _isRowMatchingQuickFi : null;
|
|
242
|
+
};
|
|
185
243
|
};
|
|
186
244
|
const isNotNull = result => result != null;
|
|
187
245
|
const filterModelItems = (cache, apiRef, items) => {
|
|
@@ -218,12 +276,12 @@ export const passFilterLogic = (allFilterItemResults, allQuickFilterResults, fil
|
|
|
218
276
|
|
|
219
277
|
// get result for quick filter model
|
|
220
278
|
if (cleanedQuickFilterResults.length > 0 && filterModel.quickFilterValues != null) {
|
|
221
|
-
var _filterModel$
|
|
279
|
+
var _filterModel$quickFil3;
|
|
222
280
|
// Return true if the item pass with one of the rows
|
|
223
281
|
const quickFilterValuePredicate = value => {
|
|
224
282
|
return cleanedQuickFilterResults.some(quickFilterValueResult => quickFilterValueResult[value]);
|
|
225
283
|
};
|
|
226
|
-
const quickFilterLogicOperator = (_filterModel$
|
|
284
|
+
const quickFilterLogicOperator = (_filterModel$quickFil3 = filterModel.quickFilterLogicOperator) != null ? _filterModel$quickFil3 : getDefaultGridFilterModel().quickFilterLogicOperator;
|
|
227
285
|
if (quickFilterLogicOperator === GridLogicOperator.And) {
|
|
228
286
|
const passesAllQuickFilterValues = filterModel.quickFilterValues.every(quickFilterValuePredicate);
|
|
229
287
|
if (!passesAllQuickFilterValues) {
|
|
@@ -8,4 +8,4 @@ export declare const filterStateInitializer: GridStateInitializer<Pick<DataGridP
|
|
|
8
8
|
* @requires useGridParamsApi (method)
|
|
9
9
|
* @requires useGridRows (event)
|
|
10
10
|
*/
|
|
11
|
-
export declare const useGridFilter: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, 'initialState' | 'filterModel' | 'onFilterModelChange' | 'filterMode' | 'disableMultipleColumnsFiltering' | 'slots' | 'slotProps' | 'disableColumnFilter'>) => void;
|
|
11
|
+
export declare const useGridFilter: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, 'rows' | 'initialState' | 'filterModel' | 'getRowId' | 'onFilterModelChange' | 'filterMode' | 'disableMultipleColumnsFiltering' | 'slots' | 'slotProps' | 'disableColumnFilter'>) => void;
|
|
@@ -9,7 +9,7 @@ import { GridPreferencePanelsValue } from '../preferencesPanel/gridPreferencePan
|
|
|
9
9
|
import { getDefaultGridFilterModel } from './gridFilterState';
|
|
10
10
|
import { gridFilterModelSelector } from './gridFilterSelector';
|
|
11
11
|
import { useFirstRender } from '../../utils/useFirstRender';
|
|
12
|
-
import {
|
|
12
|
+
import { gridRowsLookupSelector } from '../rows';
|
|
13
13
|
import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
|
|
14
14
|
import { GRID_DEFAULT_STRATEGY, useGridRegisterStrategyProcessor } from '../../core/strategyProcessing';
|
|
15
15
|
import { buildAggregatedFilterApplier, sanitizeFilterModel, mergeStateWithFilterModel, cleanFilterItem, passFilterLogic } from './gridFilterUtils';
|
|
@@ -55,7 +55,7 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
55
55
|
const updateFilteredRows = React.useCallback(() => {
|
|
56
56
|
apiRef.current.setState(state => {
|
|
57
57
|
const filterModel = gridFilterModelSelector(state, apiRef.current.instanceId);
|
|
58
|
-
const isRowMatchingFilters = props.filterMode === 'client' ? buildAggregatedFilterApplier(filterModel, apiRef) : null;
|
|
58
|
+
const isRowMatchingFilters = props.filterMode === 'client' ? buildAggregatedFilterApplier(props.getRowId, filterModel, apiRef) : null;
|
|
59
59
|
const filteringResult = apiRef.current.applyStrategyProcessor('filtering', {
|
|
60
60
|
isRowMatchingFilters,
|
|
61
61
|
filterModel: filterModel != null ? filterModel : getDefaultGridFilterModel()
|
|
@@ -69,7 +69,7 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
69
69
|
});
|
|
70
70
|
});
|
|
71
71
|
apiRef.current.publishEvent('filteredRowsSet');
|
|
72
|
-
}, [props.filterMode,
|
|
72
|
+
}, [apiRef, props.filterMode, props.getRowId]);
|
|
73
73
|
const addColumnMenuItem = React.useCallback((columnMenuItems, colDef) => {
|
|
74
74
|
if (colDef == null || colDef.filterable === false || props.disableColumnFilter) {
|
|
75
75
|
return columnMenuItems;
|
|
@@ -256,36 +256,45 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
256
256
|
}
|
|
257
257
|
return initialValue;
|
|
258
258
|
}, [props.slots.filterPanel, (_props$slotProps2 = props.slotProps) == null ? void 0 : _props$slotProps2.filterPanel]);
|
|
259
|
+
const dataRowIdToIdLookup = apiRef.current.state.rows.dataRowIdToModelLookup;
|
|
260
|
+
const rows = React.useMemo(() => Object.values(dataRowIdToIdLookup), [dataRowIdToIdLookup]);
|
|
261
|
+
const {
|
|
262
|
+
getRowId
|
|
263
|
+
} = props;
|
|
259
264
|
const flatFilteringMethod = React.useCallback(params => {
|
|
260
|
-
if (props.filterMode
|
|
261
|
-
const tree = gridRowTreeSelector(apiRef);
|
|
262
|
-
const rowIds = tree[GRID_ROOT_GROUP_ID].children;
|
|
263
|
-
const filteredRowsLookup = {};
|
|
264
|
-
const filterCache = {};
|
|
265
|
-
for (let i = 0; i < rowIds.length; i += 1) {
|
|
266
|
-
const rowId = rowIds[i];
|
|
267
|
-
let isRowPassing;
|
|
268
|
-
if (typeof rowId === 'string' && rowId.startsWith('auto-generated-group-footer')) {
|
|
269
|
-
isRowPassing = true;
|
|
270
|
-
} else {
|
|
271
|
-
const {
|
|
272
|
-
passingFilterItems,
|
|
273
|
-
passingQuickFilterValues
|
|
274
|
-
} = params.isRowMatchingFilters(rowId);
|
|
275
|
-
isRowPassing = passFilterLogic([passingFilterItems], [passingQuickFilterValues], params.filterModel, apiRef, filterCache);
|
|
276
|
-
}
|
|
277
|
-
filteredRowsLookup[rowId] = isRowPassing;
|
|
278
|
-
}
|
|
265
|
+
if (props.filterMode !== 'client' || !params.isRowMatchingFilters) {
|
|
279
266
|
return {
|
|
280
|
-
filteredRowsLookup,
|
|
267
|
+
filteredRowsLookup: {},
|
|
281
268
|
filteredDescendantCountLookup: {}
|
|
282
269
|
};
|
|
283
270
|
}
|
|
271
|
+
const dataRowIdToModelLookup = gridRowsLookupSelector(apiRef);
|
|
272
|
+
const filteredRowsLookup = {};
|
|
273
|
+
const {
|
|
274
|
+
isRowMatchingFilters
|
|
275
|
+
} = params;
|
|
276
|
+
const filterCache = {};
|
|
277
|
+
const result = {
|
|
278
|
+
passingFilterItems: null,
|
|
279
|
+
passingQuickFilterValues: null
|
|
280
|
+
};
|
|
281
|
+
for (let i = 0; i < rows.length; i += 1) {
|
|
282
|
+
const row = rows[i];
|
|
283
|
+
const id = getRowId ? getRowId(row) : row.id;
|
|
284
|
+
isRowMatchingFilters(row, undefined, result);
|
|
285
|
+
const isRowPassing = passFilterLogic([result.passingFilterItems], [result.passingQuickFilterValues], params.filterModel, apiRef, filterCache);
|
|
286
|
+
filteredRowsLookup[id] = isRowPassing;
|
|
287
|
+
}
|
|
288
|
+
const footerId = 'auto-generated-group-footer-root';
|
|
289
|
+
const footer = dataRowIdToModelLookup[footerId];
|
|
290
|
+
if (footer) {
|
|
291
|
+
filteredRowsLookup[footerId] = true;
|
|
292
|
+
}
|
|
284
293
|
return {
|
|
285
|
-
filteredRowsLookup
|
|
294
|
+
filteredRowsLookup,
|
|
286
295
|
filteredDescendantCountLookup: {}
|
|
287
296
|
};
|
|
288
|
-
}, [apiRef, props.filterMode]);
|
|
297
|
+
}, [apiRef, rows, props.filterMode, getRowId]);
|
|
289
298
|
useGridRegisterPipeProcessor(apiRef, 'columnMenu', addColumnMenuItem);
|
|
290
299
|
useGridRegisterPipeProcessor(apiRef, 'exportState', stateExportPreProcessing);
|
|
291
300
|
useGridRegisterPipeProcessor(apiRef, 'restoreState', stateRestorePreProcessing);
|
|
@@ -60,13 +60,18 @@ export const gridPaginationRowRangeSelector = createSelectorMemoized(gridPaginat
|
|
|
60
60
|
let lastRowIndex = firstRowIndex;
|
|
61
61
|
let topLevelRowAdded = 0;
|
|
62
62
|
while (lastRowIndex < visibleSortedRowEntries.length && topLevelRowAdded <= topLevelRowsInCurrentPageCount) {
|
|
63
|
+
var _rowTree$row$id;
|
|
63
64
|
const row = visibleSortedRowEntries[lastRowIndex];
|
|
64
|
-
const depth = rowTree[row.id].depth;
|
|
65
|
-
if (
|
|
65
|
+
const depth = (_rowTree$row$id = rowTree[row.id]) == null ? void 0 : _rowTree$row$id.depth;
|
|
66
|
+
if (depth === undefined) {
|
|
66
67
|
lastRowIndex += 1;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
} else {
|
|
69
|
+
if (topLevelRowAdded < topLevelRowsInCurrentPageCount || depth > 0) {
|
|
70
|
+
lastRowIndex += 1;
|
|
71
|
+
}
|
|
72
|
+
if (depth === 0) {
|
|
73
|
+
topLevelRowAdded += 1;
|
|
74
|
+
}
|
|
70
75
|
}
|
|
71
76
|
}
|
|
72
77
|
return {
|
|
@@ -4,6 +4,7 @@ import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
|
|
|
4
4
|
import { GridApiCommunity, GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
5
5
|
import { GridRowsInternalCache, GridRowsState, GridRowTreeCreationParams } from './gridRowsInterfaces';
|
|
6
6
|
export declare const GRID_ROOT_GROUP_ID: GridRowId;
|
|
7
|
+
export declare const GRID_ID_AUTOGENERATED: unique symbol;
|
|
7
8
|
export declare const buildRootGroup: () => GridGroupNode;
|
|
8
9
|
/**
|
|
9
10
|
* A helper function to check if the id provided is valid.
|
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import { gridPinnedRowsSelector } from './gridRowsSelector';
|
|
3
3
|
import { gridDensityFactorSelector } from '../density/densitySelector';
|
|
4
4
|
export const GRID_ROOT_GROUP_ID = `auto-generated-group-node-root`;
|
|
5
|
+
export const GRID_ID_AUTOGENERATED = Symbol('mui-autogenerated-id');
|
|
5
6
|
export const buildRootGroup = () => ({
|
|
6
7
|
type: 'group',
|
|
7
8
|
id: GRID_ROOT_GROUP_ID,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
3
|
+
import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
|
|
3
4
|
export declare class MissingRowIdError extends Error {
|
|
4
5
|
}
|
|
5
6
|
/**
|
|
@@ -10,4 +11,4 @@ export declare class MissingRowIdError extends Error {
|
|
|
10
11
|
* TODO: Impossible priority - useGridEditing also needs to be after useGridParamsApi
|
|
11
12
|
* TODO: Impossible priority - useGridFocus also needs to be after useGridParamsApi
|
|
12
13
|
*/
|
|
13
|
-
export declare function useGridParamsApi(apiRef: React.MutableRefObject<GridPrivateApiCommunity>): void;
|
|
14
|
+
export declare function useGridParamsApi(apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, 'getRowId'>): void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { getGridCellElement, getGridColumnHeaderElement, getGridRowElement } from '../../../utils/domUtils';
|
|
3
|
+
import { GRID_ID_AUTOGENERATED } from './gridRowsUtils';
|
|
3
4
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
4
5
|
import { gridFocusCellSelector, gridTabIndexCellSelector } from '../focus/gridFocusStateSelector';
|
|
5
6
|
export class MissingRowIdError extends Error {}
|
|
@@ -12,7 +13,10 @@ export class MissingRowIdError extends Error {}
|
|
|
12
13
|
* TODO: Impossible priority - useGridEditing also needs to be after useGridParamsApi
|
|
13
14
|
* TODO: Impossible priority - useGridFocus also needs to be after useGridParamsApi
|
|
14
15
|
*/
|
|
15
|
-
export function useGridParamsApi(apiRef) {
|
|
16
|
+
export function useGridParamsApi(apiRef, props) {
|
|
17
|
+
const {
|
|
18
|
+
getRowId
|
|
19
|
+
} = props;
|
|
16
20
|
const getColumnHeaderParams = React.useCallback(field => ({
|
|
17
21
|
field,
|
|
18
22
|
colDef: apiRef.current.getColumn(field)
|
|
@@ -96,6 +100,30 @@ export function useGridParamsApi(apiRef) {
|
|
|
96
100
|
}
|
|
97
101
|
return colDef.valueGetter(getBaseCellParams(id, field));
|
|
98
102
|
}, [apiRef, getBaseCellParams]);
|
|
103
|
+
const getRowValue = React.useCallback((row, colDef) => {
|
|
104
|
+
var _getRowId;
|
|
105
|
+
const id = GRID_ID_AUTOGENERATED in row ? row[GRID_ID_AUTOGENERATED] : (_getRowId = getRowId == null ? void 0 : getRowId(row)) != null ? _getRowId : row.id;
|
|
106
|
+
const field = colDef.field;
|
|
107
|
+
if (!colDef || !colDef.valueGetter) {
|
|
108
|
+
return row[field];
|
|
109
|
+
}
|
|
110
|
+
return colDef.valueGetter(getBaseCellParams(id, field));
|
|
111
|
+
}, [getBaseCellParams, getRowId]);
|
|
112
|
+
const getRowFormattedValue = React.useCallback((row, colDef) => {
|
|
113
|
+
var _ref;
|
|
114
|
+
const value = getRowValue(row, colDef);
|
|
115
|
+
if (!colDef || !colDef.valueFormatter) {
|
|
116
|
+
return value;
|
|
117
|
+
}
|
|
118
|
+
const id = (_ref = getRowId ? getRowId(row) : row.id) != null ? _ref : row[GRID_ID_AUTOGENERATED];
|
|
119
|
+
const field = colDef.field;
|
|
120
|
+
return colDef.valueFormatter({
|
|
121
|
+
id,
|
|
122
|
+
field,
|
|
123
|
+
value,
|
|
124
|
+
api: apiRef.current
|
|
125
|
+
});
|
|
126
|
+
}, [apiRef, getRowId, getRowValue]);
|
|
99
127
|
const getColumnHeaderElement = React.useCallback(field => {
|
|
100
128
|
if (!apiRef.current.rootElementRef.current) {
|
|
101
129
|
return null;
|
|
@@ -121,6 +149,8 @@ export function useGridParamsApi(apiRef) {
|
|
|
121
149
|
getCellValue,
|
|
122
150
|
getCellParams,
|
|
123
151
|
getCellElement,
|
|
152
|
+
getRowValue,
|
|
153
|
+
getRowFormattedValue,
|
|
124
154
|
getRowParams,
|
|
125
155
|
getRowElement,
|
|
126
156
|
getColumnHeaderParams,
|
|
@@ -7,7 +7,7 @@ import { GridSignature, useGridApiEventHandler } from '../../utils/useGridApiEve
|
|
|
7
7
|
import { useGridVisibleRows } from '../../utils/useGridVisibleRows';
|
|
8
8
|
import { gridSortedRowIdsSelector } from '../sorting/gridSortingSelector';
|
|
9
9
|
import { gridFilteredRowsLookupSelector } from '../filter/gridFilterSelector';
|
|
10
|
-
import { getTreeNodeDescendants, createRowsInternalCache, getRowsStateFromCache, isAutoGeneratedRow, GRID_ROOT_GROUP_ID, updateCacheWithNewRows, getTopLevelRowCount, getRowIdFromRowModel } from './gridRowsUtils';
|
|
10
|
+
import { getTreeNodeDescendants, createRowsInternalCache, getRowsStateFromCache, isAutoGeneratedRow, GRID_ROOT_GROUP_ID, GRID_ID_AUTOGENERATED, updateCacheWithNewRows, getTopLevelRowCount, getRowIdFromRowModel } from './gridRowsUtils';
|
|
11
11
|
import { useGridRegisterPipeApplier } from '../../core/pipeProcessing';
|
|
12
12
|
export const rowsStateInitializer = (state, props, apiRef) => {
|
|
13
13
|
apiRef.current.caches.rows = createRowsInternalCache({
|
|
@@ -46,8 +46,9 @@ export const useGridRows = (apiRef, props) => {
|
|
|
46
46
|
}
|
|
47
47
|
const node = apiRef.current.getRowNode(id);
|
|
48
48
|
if (node && isAutoGeneratedRow(node)) {
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
return {
|
|
50
|
+
[GRID_ID_AUTOGENERATED]: id
|
|
51
|
+
};
|
|
51
52
|
}
|
|
52
53
|
return null;
|
|
53
54
|
}, [apiRef]);
|
package/index.js
CHANGED
package/internals/index.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export { useGridPrintExport } from '../hooks/features/export/useGridPrintExport'
|
|
|
29
29
|
export { useGridFilter, filterStateInitializer } from '../hooks/features/filter/useGridFilter';
|
|
30
30
|
export { passFilterLogic } from '../hooks/features/filter/gridFilterUtils';
|
|
31
31
|
export { isSingleSelectColDef } from '../components/panel/filterPanel/filterPanelUtils';
|
|
32
|
-
export type { GridAggregatedFilterItemApplier } from '../hooks/features/filter/gridFilterState';
|
|
32
|
+
export type { GridAggregatedFilterItemApplier, GridAggregatedFilterItemApplierResult, } from '../hooks/features/filter/gridFilterState';
|
|
33
33
|
export { useGridFocus, focusStateInitializer } from '../hooks/features/focus/useGridFocus';
|
|
34
34
|
export { useGridKeyboardNavigation } from '../hooks/features/keyboardNavigation/useGridKeyboardNavigation';
|
|
35
35
|
export { useGridPagination, paginationStateInitializer, } from '../hooks/features/pagination/useGridPagination';
|
|
@@ -72,4 +72,5 @@ export { useGridPrivateApiContext } from '../hooks/utils/useGridPrivateApiContex
|
|
|
72
72
|
export type { GridApiCommunity } from '../models/api/gridApiCommunity';
|
|
73
73
|
export type { GridApiCaches } from '../models/gridApiCaches';
|
|
74
74
|
export { serializeCellValue } from '../hooks/features/export/serializers/csvSerializer';
|
|
75
|
+
export * from '../colDef/utils';
|
|
75
76
|
export * from './utils';
|
package/internals/index.js
CHANGED
|
@@ -56,4 +56,5 @@ export { buildWarning } from '../utils/warning';
|
|
|
56
56
|
export { exportAs } from '../utils/exportAs';
|
|
57
57
|
export { useGridPrivateApiContext } from '../hooks/utils/useGridPrivateApiContext';
|
|
58
58
|
export { serializeCellValue } from '../hooks/features/export/serializers/csvSerializer';
|
|
59
|
+
export * from '../colDef/utils';
|
|
59
60
|
export * from './utils';
|
package/joy/joySlots.js
CHANGED
|
@@ -20,11 +20,14 @@ import JoySelect from '@mui/joy/Select';
|
|
|
20
20
|
import JoyOption from '@mui/joy/Option';
|
|
21
21
|
import JoyBox from '@mui/joy/Box';
|
|
22
22
|
import JoyTypography from '@mui/joy/Typography';
|
|
23
|
+
import JoyCircularProgress from '@mui/joy/CircularProgress';
|
|
24
|
+
import JoyTooltip from '@mui/joy/Tooltip';
|
|
23
25
|
import { unstable_useForkRef as useForkRef } from '@mui/utils';
|
|
24
26
|
import joyIconSlots, { GridKeyboardArrowRight, GridKeyboardArrowLeft } from './icons';
|
|
25
27
|
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
|
|
26
28
|
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
27
29
|
import { gridFilteredTopLevelRowCountSelector, gridPaginationModelSelector } from '../hooks';
|
|
30
|
+
import { GridOverlay } from '../components/containers/GridOverlay';
|
|
28
31
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
29
32
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
30
33
|
function convertColor(color) {
|
|
@@ -288,7 +291,6 @@ const getLabelDisplayedRowsTo = ({
|
|
|
288
291
|
return pageSize === -1 ? rowCount : Math.min(rowCount, (page + 1) * pageSize);
|
|
289
292
|
};
|
|
290
293
|
const Pagination = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
291
|
-
var _rootProps$pageSizeOp;
|
|
292
294
|
const apiRef = useGridApiContext();
|
|
293
295
|
const rootProps = useGridRootProps();
|
|
294
296
|
const paginationModel = gridPaginationModelSelector(apiRef);
|
|
@@ -303,7 +305,20 @@ const Pagination = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
303
305
|
}, [apiRef]);
|
|
304
306
|
const page = paginationModel.page <= lastPage ? paginationModel.page : lastPage;
|
|
305
307
|
const pageSize = paginationModel.pageSize;
|
|
306
|
-
const
|
|
308
|
+
const isPageSizeIncludedInPageSizeOptions = () => {
|
|
309
|
+
for (let i = 0; i < rootProps.pageSizeOptions.length; i += 1) {
|
|
310
|
+
const option = rootProps.pageSizeOptions[i];
|
|
311
|
+
if (typeof option === 'number') {
|
|
312
|
+
if (option === pageSize) {
|
|
313
|
+
return true;
|
|
314
|
+
}
|
|
315
|
+
} else if (option.value === pageSize) {
|
|
316
|
+
return true;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return false;
|
|
320
|
+
};
|
|
321
|
+
const pageSizeOptions = isPageSizeIncludedInPageSizeOptions() ? rootProps.pageSizeOptions : [];
|
|
307
322
|
const handleChangeRowsPerPage = (event, newValue) => {
|
|
308
323
|
const newPageSize = Number(newValue);
|
|
309
324
|
apiRef.current.setPageSize(newPageSize);
|
|
@@ -327,9 +342,9 @@ const Pagination = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
327
342
|
value: pageSize,
|
|
328
343
|
children: pageSizeOptions.map(option => {
|
|
329
344
|
return /*#__PURE__*/_jsx(Option, {
|
|
330
|
-
value: option,
|
|
331
|
-
children: option
|
|
332
|
-
}, option);
|
|
345
|
+
value: typeof option !== 'number' && option.value ? option.value : option,
|
|
346
|
+
children: typeof option !== 'number' && option.label ? option.label : `${option}`
|
|
347
|
+
}, typeof option !== 'number' && option.label ? option.label : `${option}`);
|
|
333
348
|
})
|
|
334
349
|
})]
|
|
335
350
|
}), /*#__PURE__*/_jsx(JoyTypography, {
|
|
@@ -374,6 +389,12 @@ const Pagination = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
374
389
|
})]
|
|
375
390
|
});
|
|
376
391
|
});
|
|
392
|
+
const LoadingOverlay = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
393
|
+
return /*#__PURE__*/_jsx(GridOverlay, _extends({}, props, {
|
|
394
|
+
ref: ref,
|
|
395
|
+
children: /*#__PURE__*/_jsx(JoyCircularProgress, {})
|
|
396
|
+
}));
|
|
397
|
+
});
|
|
377
398
|
const joySlots = _extends({}, joyIconSlots, {
|
|
378
399
|
baseCheckbox: Checkbox,
|
|
379
400
|
baseTextField: TextField,
|
|
@@ -384,8 +405,8 @@ const joySlots = _extends({}, joyIconSlots, {
|
|
|
384
405
|
baseSelectOption: Option,
|
|
385
406
|
baseInputLabel: InputLabel,
|
|
386
407
|
baseFormControl: JoyFormControl,
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
408
|
+
baseTooltip: JoyTooltip,
|
|
409
|
+
pagination: Pagination,
|
|
410
|
+
loadingOverlay: LoadingOverlay
|
|
390
411
|
});
|
|
391
412
|
export default joySlots;
|
|
@@ -515,7 +515,10 @@ DataGridRaw.propTypes = {
|
|
|
515
515
|
* Select the pageSize dynamically using the component UI.
|
|
516
516
|
* @default [25, 50, 100]
|
|
517
517
|
*/
|
|
518
|
-
pageSizeOptions: PropTypes.arrayOf(PropTypes.number
|
|
518
|
+
pageSizeOptions: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
519
|
+
label: PropTypes.string.isRequired,
|
|
520
|
+
value: PropTypes.number.isRequired
|
|
521
|
+
})]).isRequired),
|
|
519
522
|
pagination: function pagination(props) {
|
|
520
523
|
if (props.pagination === false) {
|
|
521
524
|
return new Error(['MUI: `<DataGrid pagination={false} />` is not a valid prop.', 'Infinite scrolling is not available in the MIT version.', '', 'You need to upgrade to DataGridPro or DataGridPremium component to disable the pagination.'].join('\n'));
|
|
@@ -54,7 +54,7 @@ export var useDataGridComponent = function useDataGridComponent(inputApiRef, pro
|
|
|
54
54
|
useGridRowSelection(privateApiRef, props);
|
|
55
55
|
useGridColumns(privateApiRef, props);
|
|
56
56
|
useGridRows(privateApiRef, props);
|
|
57
|
-
useGridParamsApi(privateApiRef);
|
|
57
|
+
useGridParamsApi(privateApiRef, props);
|
|
58
58
|
useGridColumnSpanning(privateApiRef);
|
|
59
59
|
useGridColumnGrouping(privateApiRef, props);
|
|
60
60
|
useGridEditing(privateApiRef, props);
|
|
@@ -14,5 +14,6 @@ export var GRID_ACTIONS_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
|
14
14
|
disableColumnMenu: true,
|
|
15
15
|
disableExport: true,
|
|
16
16
|
renderCell: renderActionsCell,
|
|
17
|
-
getApplyQuickFilterFn: undefined
|
|
17
|
+
getApplyQuickFilterFn: undefined,
|
|
18
|
+
getApplyQuickFilterFnV7: undefined
|
|
18
19
|
});
|
|
@@ -35,6 +35,7 @@ export var GRID_BOOLEAN_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
|
35
35
|
valueFormatter: gridBooleanFormatter,
|
|
36
36
|
filterOperators: getGridBooleanOperators(),
|
|
37
37
|
getApplyQuickFilterFn: undefined,
|
|
38
|
+
getApplyQuickFilterFnV7: undefined,
|
|
38
39
|
// @ts-ignore
|
|
39
40
|
aggregable: false,
|
|
40
41
|
// @ts-ignore
|