@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.
Files changed (119) hide show
  1. package/CHANGELOG.md +149 -0
  2. package/DataGrid/DataGrid.js +0 -10
  3. package/DataGrid/useDataGridProps.js +9 -14
  4. package/colDef/gridActionsColDef.js +1 -2
  5. package/colDef/gridBooleanColDef.js +0 -1
  6. package/colDef/gridBooleanOperators.js +3 -4
  7. package/colDef/gridCheckboxSelectionColDef.js +0 -1
  8. package/colDef/gridDateOperators.js +10 -11
  9. package/colDef/gridNumericColDef.js +1 -3
  10. package/colDef/gridNumericOperators.d.ts +2 -2
  11. package/colDef/gridNumericOperators.js +13 -14
  12. package/colDef/gridSingleSelectOperators.js +5 -6
  13. package/colDef/gridStringColDef.js +1 -3
  14. package/colDef/gridStringOperators.d.ts +2 -2
  15. package/colDef/gridStringOperators.js +11 -12
  16. package/constants/defaultGridSlotsComponents.js +17 -17
  17. package/hooks/features/export/useGridPrintExport.js +7 -10
  18. package/hooks/features/filter/gridFilterUtils.js +14 -68
  19. package/hooks/features/rows/useGridRows.js +4 -1
  20. package/index.js +1 -1
  21. package/internals/index.d.ts +0 -1
  22. package/internals/index.js +0 -1
  23. package/internals/utils/computeSlots.d.ts +4 -6
  24. package/internals/utils/computeSlots.js +2 -8
  25. package/internals/utils/index.d.ts +0 -1
  26. package/internals/utils/index.js +0 -1
  27. package/internals/utils/useProps.d.ts +1 -8
  28. package/internals/utils/useProps.js +5 -8
  29. package/joy/icons.d.ts +1 -2
  30. package/joy/joySlots.d.ts +1 -2
  31. package/legacy/DataGrid/DataGrid.js +0 -10
  32. package/legacy/DataGrid/useDataGridProps.js +10 -18
  33. package/legacy/colDef/gridActionsColDef.js +1 -2
  34. package/legacy/colDef/gridBooleanColDef.js +0 -1
  35. package/legacy/colDef/gridBooleanOperators.js +3 -4
  36. package/legacy/colDef/gridCheckboxSelectionColDef.js +0 -1
  37. package/legacy/colDef/gridDateOperators.js +10 -11
  38. package/legacy/colDef/gridNumericColDef.js +1 -3
  39. package/legacy/colDef/gridNumericOperators.js +13 -14
  40. package/legacy/colDef/gridSingleSelectOperators.js +5 -6
  41. package/legacy/colDef/gridStringColDef.js +1 -3
  42. package/legacy/colDef/gridStringOperators.js +11 -12
  43. package/legacy/constants/defaultGridSlotsComponents.js +17 -17
  44. package/legacy/hooks/features/export/useGridPrintExport.js +7 -10
  45. package/legacy/hooks/features/filter/gridFilterUtils.js +14 -68
  46. package/legacy/hooks/features/rows/useGridRows.js +2 -1
  47. package/legacy/index.js +1 -1
  48. package/legacy/internals/index.js +0 -1
  49. package/legacy/internals/utils/computeSlots.js +2 -8
  50. package/legacy/internals/utils/index.js +0 -1
  51. package/legacy/internals/utils/useProps.js +5 -6
  52. package/legacy/locales/csCZ.js +2 -2
  53. package/legacy/material/index.js +48 -48
  54. package/locales/csCZ.js +2 -2
  55. package/material/index.js +48 -48
  56. package/models/colDef/gridColDef.d.ts +4 -14
  57. package/models/colDef/index.d.ts +1 -1
  58. package/models/gridFilterOperator.d.ts +4 -16
  59. package/models/gridIconSlotsComponent.d.ts +35 -36
  60. package/models/gridSlotsComponent.d.ts +31 -34
  61. package/models/index.d.ts +1 -1
  62. package/models/props/DataGridProps.d.ts +3 -14
  63. package/modern/DataGrid/DataGrid.js +0 -10
  64. package/modern/DataGrid/useDataGridProps.js +7 -9
  65. package/modern/colDef/gridActionsColDef.js +1 -2
  66. package/modern/colDef/gridBooleanColDef.js +0 -1
  67. package/modern/colDef/gridBooleanOperators.js +3 -4
  68. package/modern/colDef/gridCheckboxSelectionColDef.js +0 -1
  69. package/modern/colDef/gridDateOperators.js +10 -11
  70. package/modern/colDef/gridNumericColDef.js +1 -3
  71. package/modern/colDef/gridNumericOperators.js +13 -14
  72. package/modern/colDef/gridSingleSelectOperators.js +5 -6
  73. package/modern/colDef/gridStringColDef.js +1 -3
  74. package/modern/colDef/gridStringOperators.js +11 -12
  75. package/modern/constants/defaultGridSlotsComponents.js +17 -17
  76. package/modern/hooks/features/export/useGridPrintExport.js +6 -10
  77. package/modern/hooks/features/filter/gridFilterUtils.js +14 -67
  78. package/modern/hooks/features/rows/useGridRows.js +1 -1
  79. package/modern/index.js +1 -1
  80. package/modern/internals/index.js +0 -1
  81. package/modern/internals/utils/computeSlots.js +2 -8
  82. package/modern/internals/utils/index.js +0 -1
  83. package/modern/internals/utils/useProps.js +5 -8
  84. package/modern/locales/csCZ.js +2 -2
  85. package/modern/material/index.js +48 -48
  86. package/node/DataGrid/DataGrid.js +0 -10
  87. package/node/DataGrid/useDataGridProps.js +6 -8
  88. package/node/colDef/gridActionsColDef.js +1 -2
  89. package/node/colDef/gridBooleanColDef.js +0 -1
  90. package/node/colDef/gridBooleanOperators.js +3 -4
  91. package/node/colDef/gridCheckboxSelectionColDef.js +0 -1
  92. package/node/colDef/gridDateOperators.js +10 -11
  93. package/node/colDef/gridNumericColDef.js +1 -3
  94. package/node/colDef/gridNumericOperators.js +14 -14
  95. package/node/colDef/gridSingleSelectOperators.js +5 -6
  96. package/node/colDef/gridStringColDef.js +1 -3
  97. package/node/colDef/gridStringOperators.js +12 -12
  98. package/node/constants/defaultGridSlotsComponents.js +17 -17
  99. package/node/hooks/features/export/useGridPrintExport.js +5 -9
  100. package/node/hooks/features/filter/gridFilterUtils.js +14 -67
  101. package/node/hooks/features/rows/useGridRows.js +1 -1
  102. package/node/index.js +1 -1
  103. package/node/internals/index.js +1 -13
  104. package/node/internals/utils/computeSlots.js +2 -7
  105. package/node/internals/utils/index.js +0 -11
  106. package/node/internals/utils/useProps.js +4 -8
  107. package/node/locales/csCZ.js +2 -2
  108. package/node/material/index.js +48 -48
  109. package/package.json +1 -1
  110. package/colDef/utils.d.ts +0 -21
  111. package/colDef/utils.js +0 -51
  112. package/internals/utils/slotsMigration.d.ts +0 -4
  113. package/internals/utils/slotsMigration.js +0 -13
  114. package/legacy/colDef/utils.js +0 -51
  115. package/legacy/internals/utils/slotsMigration.js +0 -14
  116. package/modern/colDef/utils.js +0 -51
  117. package/modern/internals/utils/slotsMigration.js +0 -13
  118. package/node/colDef/utils.js +0 -63
  119. package/node/internals/utils/slotsMigration.js +0 -21
@@ -7,7 +7,7 @@ import { gridColumnDefinitionsSelector, gridColumnVisibilityModelSelector } from
7
7
  import { gridClasses } from '../../../constants/gridClasses';
8
8
  import { useGridApiMethod } from '../../utils/useGridApiMethod';
9
9
  import { gridRowsMetaSelector } from '../rows/gridRowsMetaSelector';
10
- import { getColumnsToExport } from './utils';
10
+ import { defaultGetRowsToExport, getColumnsToExport } from './utils';
11
11
  import { mergeStateWithPaginationModel } from '../pagination/useGridPagination';
12
12
  import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
13
13
  import { GridPrintExportMenuItem } from '../../../components/toolbar/GridToolbarExport';
@@ -121,12 +121,10 @@ export const useGridPrintExport = (apiRef, props) => {
121
121
  // the footer is always being placed at the bottom of the page as if all rows are exported
122
122
  // so if getRowsToExport is being used to only export a subset of rows then we need to
123
123
  // adjust the footer position to be correctly placed at the bottom of the grid
124
- if (options != null && options.getRowsToExport) {
125
- const gridFooterElement = gridClone.querySelector(`.${gridClasses.footerContainer}`);
126
- gridFooterElement.style.position = 'absolute';
127
- gridFooterElement.style.width = '100%';
128
- gridFooterElement.style.top = `${computedTotalHeight - gridFooterElementHeight}px`;
129
- }
124
+ const gridFooterElement = gridClone.querySelector(`.${gridClasses.footerContainer}`);
125
+ gridFooterElement.style.position = 'absolute';
126
+ gridFooterElement.style.width = '100%';
127
+ gridFooterElement.style.top = `${computedTotalHeight - gridFooterElementHeight}px`;
130
128
 
131
129
  // printDoc.body.appendChild(gridClone); should be enough but a clone isolation bug in Safari
132
130
  // prevents us to do it
@@ -210,6 +208,7 @@ export const useGridPrintExport = (apiRef, props) => {
210
208
  previousRows.current = [];
211
209
  }, [apiRef]);
212
210
  const exportDataAsPrint = React.useCallback(async options => {
211
+ var _options$getRowsToExp;
213
212
  logger.debug(`Export data as Print`);
214
213
  if (!apiRef.current.rootElementRef.current) {
215
214
  throw new Error('MUI: No grid root element available.');
@@ -230,9 +229,7 @@ export const useGridPrintExport = (apiRef, props) => {
230
229
  apiRef.current.forceUpdate();
231
230
  }
232
231
  await updateGridColumnsForPrint(options == null ? void 0 : options.fields, options == null ? void 0 : options.allColumns, options == null ? void 0 : options.includeCheckboxes);
233
- if (options != null && options.getRowsToExport) {
234
- updateGridRowsForPrint(options.getRowsToExport);
235
- }
232
+ updateGridRowsForPrint((_options$getRowsToExp = options == null ? void 0 : options.getRowsToExport) != null ? _options$getRowsToExp : defaultGetRowsToExport);
236
233
  apiRef.current.unstable_setVirtualization(false);
237
234
  await raf(); // wait for the state changes to take action
238
235
  const printWindow = buildPrintWindow(options == null ? void 0 : options.fileName);
@@ -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';
@@ -109,42 +108,19 @@ const getFilterCallbackFromItem = (filterItem, apiRef) => {
109
108
  if (!filterOperator) {
110
109
  throw new Error(`MUI: No filter operator found for column '${column.field}' and operator value '${newFilterItem.operator}'.`);
111
110
  }
112
- const hasUserFunctionLegacy = !isInternalFilter(filterOperator.getApplyFilterFn);
113
- const hasUserFunctionV7 = !isInternalFilter(filterOperator.getApplyFilterFnV7);
114
111
  const publicApiRef = getPublicApiRef(apiRef);
115
- if (filterOperator.getApplyFilterFnV7 && !(hasUserFunctionLegacy && !hasUserFunctionV7)) {
116
- const applyFilterOnRow = filterOperator.getApplyFilterFnV7(newFilterItem, column);
117
- if (typeof applyFilterOnRow !== 'function') {
118
- return null;
119
- }
120
- return {
121
- v7: true,
122
- item: newFilterItem,
123
- fn: row => {
124
- let value = apiRef.current.getRowValue(row, column);
125
- if (ignoreDiacritics) {
126
- value = removeDiacritics(value);
127
- }
128
- return applyFilterOnRow(value, row, column, publicApiRef);
129
- }
130
- };
131
- }
132
112
  const applyFilterOnRow = filterOperator.getApplyFilterFn(newFilterItem, column);
133
113
  if (typeof applyFilterOnRow !== 'function') {
134
114
  return null;
135
115
  }
136
116
  return {
137
- v7: false,
138
117
  item: newFilterItem,
139
- fn: rowId => {
140
- const params = apiRef.current.getCellParams(rowId, newFilterItem.field);
141
- GLOBAL_API_REF.current = publicApiRef;
118
+ fn: row => {
119
+ let value = apiRef.current.getRowValue(row, column);
142
120
  if (ignoreDiacritics) {
143
- params.value = removeDiacritics(params.value);
121
+ value = removeDiacritics(value);
144
122
  }
145
- const result = applyFilterOnRow(params);
146
- GLOBAL_API_REF.current = null;
147
- return result;
123
+ return applyFilterOnRow(value, row, column, publicApiRef);
148
124
  }
149
125
  };
150
126
  };
@@ -171,7 +147,7 @@ const buildAggregatedFilterItemsApplier = (filterModel, apiRef, disableEval) =>
171
147
  for (let i = 0; i < appliers.length; i += 1) {
172
148
  const applier = appliers[i];
173
149
  if (!shouldApplyFilter || shouldApplyFilter(applier.item.field)) {
174
- resultPerItemId[applier.item.id] = applier.v7 ? applier.fn(row) : applier.fn(apiRef.current.getRowId(row));
150
+ resultPerItemId[applier.item.id] = applier.fn(row);
175
151
  }
176
152
  }
177
153
  return resultPerItemId;
@@ -187,7 +163,7 @@ const buildAggregatedFilterItemsApplier = (filterModel, apiRef, disableEval) =>
187
163
  ${appliers.map((applier, i) => `${JSON.stringify(String(applier.item.id))}:
188
164
  !shouldApply${i} ?
189
165
  false :
190
- ${applier.v7 ? `appliers[${i}].fn(row)` : `appliers[${i}].fn(getRowId(row))`},
166
+ appliers[${i}].fn(row),
191
167
  `).join('\n')}};
192
168
 
193
169
  return result$$;
@@ -222,27 +198,12 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
222
198
  columnFields.forEach(field => {
223
199
  const column = apiRef.current.getColumn(field);
224
200
  const getApplyQuickFilterFn = column == null ? void 0 : column.getApplyQuickFilterFn;
225
- const getApplyQuickFilterFnV7 = column == null ? void 0 : column.getApplyQuickFilterFnV7;
226
- const hasUserFunctionLegacy = !isInternalFilter(getApplyQuickFilterFn);
227
- const hasUserFunctionV7 = !isInternalFilter(getApplyQuickFilterFnV7);
228
- if (getApplyQuickFilterFnV7 && !(hasUserFunctionLegacy && !hasUserFunctionV7)) {
201
+ if (getApplyQuickFilterFn) {
229
202
  appliersPerField.push({
230
203
  column,
231
204
  appliers: quickFilterValues.map(quickFilterValue => {
232
205
  const value = ignoreDiacritics ? removeDiacritics(quickFilterValue) : quickFilterValue;
233
206
  return {
234
- v7: true,
235
- fn: getApplyQuickFilterFnV7(value, column, publicApiRef)
236
- };
237
- })
238
- });
239
- } else if (getApplyQuickFilterFn) {
240
- appliersPerField.push({
241
- column,
242
- appliers: quickFilterValues.map(quickFilterValue => {
243
- const value = ignoreDiacritics ? removeDiacritics(quickFilterValue) : quickFilterValue;
244
- return {
245
- v7: false,
246
207
  fn: getApplyQuickFilterFn(value, column, publicApiRef)
247
208
  };
248
209
  })
@@ -251,7 +212,6 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
251
212
  });
252
213
  return function isRowMatchingQuickFilter(row, shouldApplyFilter) {
253
214
  const result = {};
254
- const usedCellParams = {};
255
215
 
256
216
  /* eslint-disable no-restricted-syntax, no-labels */
257
217
  outer: for (let v = 0; v < quickFilterValues.length; v += 1) {
@@ -272,27 +232,13 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
272
232
  if (applier.fn === null) {
273
233
  continue;
274
234
  }
275
- if (applier.v7) {
276
- if (ignoreDiacritics) {
277
- value = removeDiacritics(value);
278
- }
279
- const isMatching = applier.fn(value, row, column, publicApiRef);
280
- if (isMatching) {
281
- result[filterValue] = true;
282
- continue outer;
283
- }
284
- } else {
285
- var _usedCellParams$field;
286
- const cellParams = (_usedCellParams$field = usedCellParams[field]) != null ? _usedCellParams$field : apiRef.current.getCellParams(apiRef.current.getRowId(row), field);
287
- if (ignoreDiacritics) {
288
- cellParams.value = removeDiacritics(cellParams.value);
289
- }
290
- usedCellParams[field] = cellParams;
291
- const isMatching = applier.fn(cellParams);
292
- if (isMatching) {
293
- result[filterValue] = true;
294
- continue outer;
295
- }
235
+ if (ignoreDiacritics) {
236
+ value = removeDiacritics(value);
237
+ }
238
+ const isMatching = applier.fn(value, row, column, publicApiRef);
239
+ if (isMatching) {
240
+ result[filterValue] = true;
241
+ continue outer;
296
242
  }
297
243
  }
298
244
  result[filterValue] = false;
@@ -289,7 +289,10 @@ export const useGridRows = (apiRef, props) => {
289
289
  });
290
290
 
291
291
  // Removes potential remaining skeleton rows from the dataRowIds.
292
- const dataRowIds = rootGroupChildren.filter(childId => tree[childId].type === 'leaf');
292
+ const dataRowIds = rootGroupChildren.filter(childId => {
293
+ var _tree$childId;
294
+ return ((_tree$childId = tree[childId]) == null ? void 0 : _tree$childId.type) === 'leaf';
295
+ });
293
296
  apiRef.current.caches.rows.dataRowIdToModelLookup = dataRowIdToModelLookup;
294
297
  apiRef.current.caches.rows.dataRowIdToIdLookup = dataRowIdToIdLookup;
295
298
  apiRef.current.setState(state => _extends({}, state, {
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v6.18.1
2
+ * @mui/x-data-grid v7.0.0-alpha.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -79,5 +79,4 @@ export * from '../hooks/utils/useOnMount';
79
79
  export type { GridApiCommunity } from '../models/api/gridApiCommunity';
80
80
  export type { GridApiCaches } from '../models/gridApiCaches';
81
81
  export { serializeCellValue } from '../hooks/features/export/serializers/csvSerializer';
82
- export * from '../colDef/utils';
83
82
  export * from './utils';
@@ -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,6 +1,4 @@
1
- import { UncapitalizeObjectKeys } from './slotsMigration';
2
- export declare function computeSlots<SlotComponents extends object>({ defaultSlots, slots, components, }: {
3
- defaultSlots: UncapitalizeObjectKeys<SlotComponents>;
4
- slots?: UncapitalizeObjectKeys<Partial<SlotComponents>>;
5
- components?: Partial<SlotComponents>;
6
- }): UncapitalizeObjectKeys<SlotComponents>;
1
+ export declare function computeSlots<SlotComponents extends object>({ defaultSlots, slots, }: {
2
+ defaultSlots: SlotComponents;
3
+ slots?: Partial<SlotComponents>;
4
+ }): SlotComponents;
@@ -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 != null ? slots : components ? uncapitalizeObjectKeys(components) : null;
6
+ const overrides = slots;
13
7
  if (!overrides || Object.keys(overrides).length === 0) {
14
8
  return defaultSlots;
15
9
  }
@@ -1,3 +1,2 @@
1
1
  export * from './computeSlots';
2
- export * from './slotsMigration';
3
2
  export * from './useProps';
@@ -1,3 +1,2 @@
1
1
  export * from './computeSlots';
2
- export * from './slotsMigration';
3
2
  export * from './useProps';
@@ -1,8 +1 @@
1
- import { GridSlotsComponentsProps } from '../../models/gridSlotsComponentsProps';
2
- import { GridSlotsComponent } from '../../models';
3
- interface WithComponents {
4
- components?: Partial<GridSlotsComponent>;
5
- componentsProps?: GridSlotsComponentsProps;
6
- }
7
- export declare function useProps<T extends WithComponents>(allProps: T): readonly [Partial<GridSlotsComponent> | undefined, GridSlotsComponentsProps | undefined, Omit<T, "components" | "componentsProps">];
8
- export {};
1
+ export declare function useProps<T extends Record<string, any>>(allProps: T): T;
@@ -1,6 +1,7 @@
1
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
- const _excluded = ["components", "componentsProps"];
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
  var _props$forwardedProps;
@@ -23,11 +24,7 @@ function groupForwardedProps(props) {
23
24
  }
24
25
  export function useProps(allProps) {
25
26
  return React.useMemo(() => {
26
- const {
27
- components,
28
- componentsProps
29
- } = allProps,
30
- themedProps = _objectWithoutPropertiesLoose(allProps, _excluded);
31
- return [components, componentsProps, groupForwardedProps(themedProps)];
27
+ const themedProps = _extends({}, (_objectDestructuringEmpty(allProps), allProps));
28
+ return groupForwardedProps(themedProps);
32
29
  }, [allProps]);
33
30
  }
package/joy/icons.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { GridIconSlotsComponent } from '../models/gridIconSlotsComponent';
2
- import { UncapitalizeObjectKeys } from '../internals/utils';
3
2
  export declare const GridArrowUpwardIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
4
3
  export declare const GridArrowDownwardIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
5
4
  export declare const GridKeyboardArrowLeft: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
@@ -29,5 +28,5 @@ export declare const GridViewColumnIcon: import("@mui/types").OverridableCompone
29
28
  export declare const GridClearIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
30
29
  export declare const GridDeleteIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
31
30
  export declare const GridDeleteForeverIcon: import("@mui/types").OverridableComponent<import("@mui/joy/SvgIcon").SvgIconTypeMap<{}, "svg">>;
32
- declare const joyIconSlots: UncapitalizeObjectKeys<GridIconSlotsComponent>;
31
+ declare const joyIconSlots: GridIconSlotsComponent;
33
32
  export default joyIconSlots;
package/joy/joySlots.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import type { UncapitalizeObjectKeys } from '../internals/utils';
2
1
  import type { GridSlotsComponent } from '../models';
3
- declare const joySlots: UncapitalizeObjectKeys<Partial<GridSlotsComponent>>;
2
+ declare const joySlots: Partial<GridSlotsComponent>;
4
3
  export default joySlots;
@@ -127,16 +127,6 @@ DataGridRaw.propTypes = {
127
127
  * If defined, the grid will ignore the `hide` property in [[GridColDef]].
128
128
  */
129
129
  columnVisibilityModel: PropTypes.object,
130
- /**
131
- * Overridable components.
132
- * @deprecated Use `slots` instead.
133
- */
134
- components: PropTypes.object,
135
- /**
136
- * Overridable components props dynamically passed to the component at rendering.
137
- * @deprecated Use the `slotProps` prop instead.
138
- */
139
- componentsProps: PropTypes.object,
140
130
  /**
141
131
  * Set the density of the grid.
142
132
  * @default "standard"
@@ -1,11 +1,10 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
2
  import * as React from 'react';
4
3
  import { useThemeProps } from '@mui/material/styles';
5
4
  import { GRID_DEFAULT_LOCALE_TEXT } from '../constants';
6
5
  import { DATA_GRID_DEFAULT_SLOTS_COMPONENTS } from '../constants/defaultGridSlotsComponents';
7
6
  import { GridEditModes } from '../models';
8
- import { computeSlots, useProps, uncapitalizeObjectKeys } from '../internals/utils';
7
+ import { computeSlots, useProps } from '../internals/utils';
9
8
  var DATA_GRID_FORCED_PROPS = {
10
9
  disableMultipleColumnsFiltering: true,
11
10
  disableMultipleColumnsSorting: true,
@@ -73,32 +72,25 @@ export var DATA_GRID_PROPS_DEFAULT_VALUES = {
73
72
  clipboardCopyCellDelimiter: '\t',
74
73
  rowPositionsDebounceMs: 166
75
74
  };
76
- var defaultSlots = uncapitalizeObjectKeys(DATA_GRID_DEFAULT_SLOTS_COMPONENTS);
75
+ var defaultSlots = DATA_GRID_DEFAULT_SLOTS_COMPONENTS;
77
76
  export var useDataGridProps = function useDataGridProps(inProps) {
78
- var _useProps = useProps(useThemeProps({
79
- props: inProps,
80
- name: 'MuiDataGrid'
81
- })),
82
- _useProps2 = _slicedToArray(_useProps, 3),
83
- components = _useProps2[0],
84
- componentsProps = _useProps2[1],
85
- themedProps = _useProps2[2];
77
+ var themedProps = useProps(useThemeProps({
78
+ props: inProps,
79
+ name: 'MuiDataGrid'
80
+ }));
86
81
  var localeText = React.useMemo(function () {
87
82
  return _extends({}, GRID_DEFAULT_LOCALE_TEXT, themedProps.localeText);
88
83
  }, [themedProps.localeText]);
89
84
  var slots = React.useMemo(function () {
90
85
  return computeSlots({
91
86
  defaultSlots: defaultSlots,
92
- slots: themedProps.slots,
93
- components: components
87
+ slots: themedProps.slots
94
88
  });
95
- }, [components, themedProps.slots]);
89
+ }, [themedProps.slots]);
96
90
  return React.useMemo(function () {
97
- var _themedProps$slotProp;
98
91
  return _extends({}, DATA_GRID_PROPS_DEFAULT_VALUES, themedProps, {
99
92
  localeText: localeText,
100
- slots: slots,
101
- slotProps: (_themedProps$slotProp = themedProps.slotProps) != null ? _themedProps$slotProp : componentsProps
93
+ slots: slots
102
94
  }, DATA_GRID_FORCED_PROPS);
103
- }, [themedProps, localeText, slots, componentsProps]);
95
+ }, [themedProps, localeText, slots]);
104
96
  };
@@ -14,6 +14,5 @@ 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,
18
- getApplyQuickFilterFnV7: undefined
17
+ getApplyQuickFilterFn: undefined
19
18
  });
@@ -35,7 +35,6 @@ 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,
39
38
  // @ts-ignore
40
39
  aggregable: false,
41
40
  // @ts-ignore
@@ -1,9 +1,8 @@
1
1
  import { GridFilterInputBoolean } from '../components/panel/filterPanel/GridFilterInputBoolean';
2
- import { convertLegacyOperators } from './utils';
3
2
  export var getGridBooleanOperators = function getGridBooleanOperators() {
4
- return convertLegacyOperators([{
3
+ return [{
5
4
  value: 'is',
6
- getApplyFilterFnV7: function getApplyFilterFnV7(filterItem) {
5
+ getApplyFilterFn: function getApplyFilterFn(filterItem) {
7
6
  if (!filterItem.value) {
8
7
  return null;
9
8
  }
@@ -13,5 +12,5 @@ export var getGridBooleanOperators = function getGridBooleanOperators() {
13
12
  };
14
13
  },
15
14
  InputComponent: GridFilterInputBoolean
16
- }]);
15
+ }];
17
16
  };
@@ -19,7 +19,6 @@ export var GRID_CHECKBOX_SELECTION_COL_DEF = _extends({}, GRID_BOOLEAN_COL_DEF,
19
19
  disableReorder: true,
20
20
  disableExport: true,
21
21
  getApplyQuickFilterFn: undefined,
22
- getApplyQuickFilterFnV7: undefined,
23
22
  valueGetter: function valueGetter(params) {
24
23
  var selectionLookup = selectedIdsLookupSelector(params.api.state, params.api.instanceId);
25
24
  return selectionLookup[params.id] !== undefined;
@@ -1,6 +1,5 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
2
  import { GridFilterInputDate } from '../components/panel/filterPanel/GridFilterInputDate';
3
- import { convertLegacyOperators } from './utils';
4
3
  var dateRegex = /(\d+)-(\d+)-(\d+)/;
5
4
  var dateTimeRegex = /(\d+)-(\d+)-(\d+)T(\d+):(\d+)/;
6
5
  function buildApplyFilterFn(filterItem, compareFn, showTime, keepHours) {
@@ -30,9 +29,9 @@ function buildApplyFilterFn(filterItem, compareFn, showTime, keepHours) {
30
29
  };
31
30
  }
32
31
  export var getGridDateOperators = function getGridDateOperators(showTime) {
33
- return convertLegacyOperators([{
32
+ return [{
34
33
  value: 'is',
35
- getApplyFilterFnV7: function getApplyFilterFnV7(filterItem) {
34
+ getApplyFilterFn: function getApplyFilterFn(filterItem) {
36
35
  return buildApplyFilterFn(filterItem, function (value1, value2) {
37
36
  return value1 === value2;
38
37
  }, showTime);
@@ -43,7 +42,7 @@ export var getGridDateOperators = function getGridDateOperators(showTime) {
43
42
  }
44
43
  }, {
45
44
  value: 'not',
46
- getApplyFilterFnV7: function getApplyFilterFnV7(filterItem) {
45
+ getApplyFilterFn: function getApplyFilterFn(filterItem) {
47
46
  return buildApplyFilterFn(filterItem, function (value1, value2) {
48
47
  return value1 !== value2;
49
48
  }, showTime);
@@ -54,7 +53,7 @@ export var getGridDateOperators = function getGridDateOperators(showTime) {
54
53
  }
55
54
  }, {
56
55
  value: 'after',
57
- getApplyFilterFnV7: function getApplyFilterFnV7(filterItem) {
56
+ getApplyFilterFn: function getApplyFilterFn(filterItem) {
58
57
  return buildApplyFilterFn(filterItem, function (value1, value2) {
59
58
  return value1 > value2;
60
59
  }, showTime);
@@ -65,7 +64,7 @@ export var getGridDateOperators = function getGridDateOperators(showTime) {
65
64
  }
66
65
  }, {
67
66
  value: 'onOrAfter',
68
- getApplyFilterFnV7: function getApplyFilterFnV7(filterItem) {
67
+ getApplyFilterFn: function getApplyFilterFn(filterItem) {
69
68
  return buildApplyFilterFn(filterItem, function (value1, value2) {
70
69
  return value1 >= value2;
71
70
  }, showTime);
@@ -76,7 +75,7 @@ export var getGridDateOperators = function getGridDateOperators(showTime) {
76
75
  }
77
76
  }, {
78
77
  value: 'before',
79
- getApplyFilterFnV7: function getApplyFilterFnV7(filterItem) {
78
+ getApplyFilterFn: function getApplyFilterFn(filterItem) {
80
79
  return buildApplyFilterFn(filterItem, function (value1, value2) {
81
80
  return value1 < value2;
82
81
  }, showTime, !showTime);
@@ -87,7 +86,7 @@ export var getGridDateOperators = function getGridDateOperators(showTime) {
87
86
  }
88
87
  }, {
89
88
  value: 'onOrBefore',
90
- getApplyFilterFnV7: function getApplyFilterFnV7(filterItem) {
89
+ getApplyFilterFn: function getApplyFilterFn(filterItem) {
91
90
  return buildApplyFilterFn(filterItem, function (value1, value2) {
92
91
  return value1 <= value2;
93
92
  }, showTime);
@@ -98,7 +97,7 @@ export var getGridDateOperators = function getGridDateOperators(showTime) {
98
97
  }
99
98
  }, {
100
99
  value: 'isEmpty',
101
- getApplyFilterFnV7: function getApplyFilterFnV7() {
100
+ getApplyFilterFn: function getApplyFilterFn() {
102
101
  return function (value) {
103
102
  return value == null;
104
103
  };
@@ -106,11 +105,11 @@ export var getGridDateOperators = function getGridDateOperators(showTime) {
106
105
  requiresFilterValue: false
107
106
  }, {
108
107
  value: 'isNotEmpty',
109
- getApplyFilterFnV7: function getApplyFilterFnV7() {
108
+ getApplyFilterFn: function getApplyFilterFn() {
110
109
  return function (value) {
111
110
  return value != null;
112
111
  };
113
112
  },
114
113
  requiresFilterValue: false
115
- }]);
114
+ }];
116
115
  };
@@ -3,7 +3,6 @@ import { gridNumberComparator } from '../hooks/features/sorting/gridSortingUtils
3
3
  import { isNumber } from '../utils/utils';
4
4
  import { getGridNumericOperators, getGridNumericQuickFilterFn } from './gridNumericOperators';
5
5
  import { GRID_STRING_COL_DEF } from './gridStringColDef';
6
- import { convertQuickFilterV7ToLegacy } from './utils';
7
6
  export var GRID_NUMERIC_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
8
7
  type: 'number',
9
8
  align: 'right',
@@ -17,6 +16,5 @@ export var GRID_NUMERIC_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
17
16
  return isNumber(value) ? value.toLocaleString() : value || '';
18
17
  },
19
18
  filterOperators: getGridNumericOperators(),
20
- getApplyQuickFilterFn: convertQuickFilterV7ToLegacy(getGridNumericQuickFilterFn),
21
- getApplyQuickFilterFnV7: getGridNumericQuickFilterFn
19
+ getApplyQuickFilterFn: getGridNumericQuickFilterFn
22
20
  });
@@ -1,24 +1,23 @@
1
1
  import { GridFilterInputValue } from '../components/panel/filterPanel/GridFilterInputValue';
2
2
  import { GridFilterInputMultipleValue } from '../components/panel/filterPanel/GridFilterInputMultipleValue';
3
- import { convertLegacyOperators, tagInternalFilter } from './utils';
4
3
  var parseNumericValue = function parseNumericValue(value) {
5
4
  if (value == null) {
6
5
  return null;
7
6
  }
8
7
  return Number(value);
9
8
  };
10
- export var getGridNumericQuickFilterFn = tagInternalFilter(function (value) {
9
+ export var getGridNumericQuickFilterFn = function getGridNumericQuickFilterFn(value) {
11
10
  if (value == null || Number.isNaN(value) || value === '') {
12
11
  return null;
13
12
  }
14
13
  return function (columnValue) {
15
14
  return parseNumericValue(columnValue) === parseNumericValue(value);
16
15
  };
17
- });
16
+ };
18
17
  export var getGridNumericOperators = function getGridNumericOperators() {
19
- return convertLegacyOperators([{
18
+ return [{
20
19
  value: '=',
21
- getApplyFilterFnV7: function getApplyFilterFnV7(filterItem) {
20
+ getApplyFilterFn: function getApplyFilterFn(filterItem) {
22
21
  if (filterItem.value == null || Number.isNaN(filterItem.value)) {
23
22
  return null;
24
23
  }
@@ -32,7 +31,7 @@ export var getGridNumericOperators = function getGridNumericOperators() {
32
31
  }
33
32
  }, {
34
33
  value: '!=',
35
- getApplyFilterFnV7: function getApplyFilterFnV7(filterItem) {
34
+ getApplyFilterFn: function getApplyFilterFn(filterItem) {
36
35
  if (filterItem.value == null || Number.isNaN(filterItem.value)) {
37
36
  return null;
38
37
  }
@@ -46,7 +45,7 @@ export var getGridNumericOperators = function getGridNumericOperators() {
46
45
  }
47
46
  }, {
48
47
  value: '>',
49
- getApplyFilterFnV7: function getApplyFilterFnV7(filterItem) {
48
+ getApplyFilterFn: function getApplyFilterFn(filterItem) {
50
49
  if (filterItem.value == null || Number.isNaN(filterItem.value)) {
51
50
  return null;
52
51
  }
@@ -63,7 +62,7 @@ export var getGridNumericOperators = function getGridNumericOperators() {
63
62
  }
64
63
  }, {
65
64
  value: '>=',
66
- getApplyFilterFnV7: function getApplyFilterFnV7(filterItem) {
65
+ getApplyFilterFn: function getApplyFilterFn(filterItem) {
67
66
  if (filterItem.value == null || Number.isNaN(filterItem.value)) {
68
67
  return null;
69
68
  }
@@ -80,7 +79,7 @@ export var getGridNumericOperators = function getGridNumericOperators() {
80
79
  }
81
80
  }, {
82
81
  value: '<',
83
- getApplyFilterFnV7: function getApplyFilterFnV7(filterItem) {
82
+ getApplyFilterFn: function getApplyFilterFn(filterItem) {
84
83
  if (filterItem.value == null || Number.isNaN(filterItem.value)) {
85
84
  return null;
86
85
  }
@@ -97,7 +96,7 @@ export var getGridNumericOperators = function getGridNumericOperators() {
97
96
  }
98
97
  }, {
99
98
  value: '<=',
100
- getApplyFilterFnV7: function getApplyFilterFnV7(filterItem) {
99
+ getApplyFilterFn: function getApplyFilterFn(filterItem) {
101
100
  if (filterItem.value == null || Number.isNaN(filterItem.value)) {
102
101
  return null;
103
102
  }
@@ -114,7 +113,7 @@ export var getGridNumericOperators = function getGridNumericOperators() {
114
113
  }
115
114
  }, {
116
115
  value: 'isEmpty',
117
- getApplyFilterFnV7: function getApplyFilterFnV7() {
116
+ getApplyFilterFn: function getApplyFilterFn() {
118
117
  return function (value) {
119
118
  return value == null;
120
119
  };
@@ -122,7 +121,7 @@ export var getGridNumericOperators = function getGridNumericOperators() {
122
121
  requiresFilterValue: false
123
122
  }, {
124
123
  value: 'isNotEmpty',
125
- getApplyFilterFnV7: function getApplyFilterFnV7() {
124
+ getApplyFilterFn: function getApplyFilterFn() {
126
125
  return function (value) {
127
126
  return value != null;
128
127
  };
@@ -130,7 +129,7 @@ export var getGridNumericOperators = function getGridNumericOperators() {
130
129
  requiresFilterValue: false
131
130
  }, {
132
131
  value: 'isAnyOf',
133
- getApplyFilterFnV7: function getApplyFilterFnV7(filterItem) {
132
+ getApplyFilterFn: function getApplyFilterFn(filterItem) {
134
133
  if (!Array.isArray(filterItem.value) || filterItem.value.length === 0) {
135
134
  return null;
136
135
  }
@@ -142,5 +141,5 @@ export var getGridNumericOperators = function getGridNumericOperators() {
142
141
  InputComponentProps: {
143
142
  type: 'number'
144
143
  }
145
- }]);
144
+ }];
146
145
  };