@mui/x-data-grid 6.18.0 → 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 (139) hide show
  1. package/CHANGELOG.md +212 -5
  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 +17 -13
  16. package/components/cell/GridActionsCell.js +19 -12
  17. package/components/cell/GridCell.js +4 -4
  18. package/constants/defaultGridSlotsComponents.js +17 -17
  19. package/hooks/features/export/useGridPrintExport.js +7 -10
  20. package/hooks/features/filter/gridFilterUtils.d.ts +1 -0
  21. package/hooks/features/filter/gridFilterUtils.js +20 -71
  22. package/hooks/features/filter/useGridFilter.d.ts +1 -1
  23. package/hooks/features/filter/useGridFilter.js +2 -1
  24. package/hooks/features/rows/useGridRows.js +4 -1
  25. package/index.js +1 -1
  26. package/internals/index.d.ts +1 -1
  27. package/internals/index.js +1 -1
  28. package/internals/utils/computeSlots.d.ts +4 -6
  29. package/internals/utils/computeSlots.js +10 -9
  30. package/internals/utils/index.d.ts +0 -1
  31. package/internals/utils/index.js +0 -1
  32. package/internals/utils/useProps.d.ts +1 -8
  33. package/internals/utils/useProps.js +5 -8
  34. package/joy/icons.d.ts +1 -2
  35. package/joy/joySlots.d.ts +1 -2
  36. package/legacy/DataGrid/DataGrid.js +0 -10
  37. package/legacy/DataGrid/useDataGridProps.js +10 -18
  38. package/legacy/colDef/gridActionsColDef.js +1 -2
  39. package/legacy/colDef/gridBooleanColDef.js +0 -1
  40. package/legacy/colDef/gridBooleanOperators.js +3 -4
  41. package/legacy/colDef/gridCheckboxSelectionColDef.js +0 -1
  42. package/legacy/colDef/gridDateOperators.js +10 -11
  43. package/legacy/colDef/gridNumericColDef.js +1 -3
  44. package/legacy/colDef/gridNumericOperators.js +13 -14
  45. package/legacy/colDef/gridSingleSelectOperators.js +5 -6
  46. package/legacy/colDef/gridStringColDef.js +1 -3
  47. package/legacy/colDef/gridStringOperators.js +17 -13
  48. package/legacy/components/cell/GridActionsCell.js +21 -12
  49. package/legacy/components/cell/GridCell.js +6 -4
  50. package/legacy/constants/defaultGridSlotsComponents.js +17 -17
  51. package/legacy/hooks/features/export/useGridPrintExport.js +7 -10
  52. package/legacy/hooks/features/filter/gridFilterUtils.js +20 -71
  53. package/legacy/hooks/features/filter/useGridFilter.js +2 -1
  54. package/legacy/hooks/features/rows/useGridRows.js +2 -1
  55. package/legacy/index.js +1 -1
  56. package/legacy/internals/index.js +1 -1
  57. package/legacy/internals/utils/computeSlots.js +10 -9
  58. package/legacy/internals/utils/index.js +0 -1
  59. package/legacy/internals/utils/useProps.js +5 -6
  60. package/legacy/locales/csCZ.js +2 -2
  61. package/legacy/material/index.js +48 -48
  62. package/legacy/utils/getPublicApiRef.js +5 -0
  63. package/locales/csCZ.js +2 -2
  64. package/material/index.js +48 -48
  65. package/models/api/gridFilterApi.d.ts +5 -0
  66. package/models/colDef/gridColDef.d.ts +4 -14
  67. package/models/colDef/index.d.ts +1 -1
  68. package/models/gridFilterOperator.d.ts +4 -16
  69. package/models/gridIconSlotsComponent.d.ts +35 -36
  70. package/models/gridSlotsComponent.d.ts +31 -34
  71. package/models/index.d.ts +1 -1
  72. package/models/props/DataGridProps.d.ts +3 -14
  73. package/modern/DataGrid/DataGrid.js +0 -10
  74. package/modern/DataGrid/useDataGridProps.js +7 -9
  75. package/modern/colDef/gridActionsColDef.js +1 -2
  76. package/modern/colDef/gridBooleanColDef.js +0 -1
  77. package/modern/colDef/gridBooleanOperators.js +3 -4
  78. package/modern/colDef/gridCheckboxSelectionColDef.js +0 -1
  79. package/modern/colDef/gridDateOperators.js +10 -11
  80. package/modern/colDef/gridNumericColDef.js +1 -3
  81. package/modern/colDef/gridNumericOperators.js +13 -14
  82. package/modern/colDef/gridSingleSelectOperators.js +5 -6
  83. package/modern/colDef/gridStringColDef.js +1 -3
  84. package/modern/colDef/gridStringOperators.js +17 -13
  85. package/modern/components/cell/GridActionsCell.js +18 -12
  86. package/modern/components/cell/GridCell.js +3 -3
  87. package/modern/constants/defaultGridSlotsComponents.js +17 -17
  88. package/modern/hooks/features/export/useGridPrintExport.js +6 -10
  89. package/modern/hooks/features/filter/gridFilterUtils.js +20 -70
  90. package/modern/hooks/features/filter/useGridFilter.js +2 -1
  91. package/modern/hooks/features/rows/useGridRows.js +1 -1
  92. package/modern/index.js +1 -1
  93. package/modern/internals/index.js +1 -1
  94. package/modern/internals/utils/computeSlots.js +10 -9
  95. package/modern/internals/utils/index.js +0 -1
  96. package/modern/internals/utils/useProps.js +5 -8
  97. package/modern/locales/csCZ.js +2 -2
  98. package/modern/material/index.js +48 -48
  99. package/modern/utils/getPublicApiRef.js +5 -0
  100. package/node/DataGrid/DataGrid.js +0 -10
  101. package/node/DataGrid/useDataGridProps.js +6 -8
  102. package/node/colDef/gridActionsColDef.js +1 -2
  103. package/node/colDef/gridBooleanColDef.js +0 -1
  104. package/node/colDef/gridBooleanOperators.js +3 -4
  105. package/node/colDef/gridCheckboxSelectionColDef.js +0 -1
  106. package/node/colDef/gridDateOperators.js +10 -11
  107. package/node/colDef/gridNumericColDef.js +1 -3
  108. package/node/colDef/gridNumericOperators.js +14 -14
  109. package/node/colDef/gridSingleSelectOperators.js +5 -6
  110. package/node/colDef/gridStringColDef.js +1 -3
  111. package/node/colDef/gridStringOperators.js +18 -13
  112. package/node/components/cell/GridActionsCell.js +18 -12
  113. package/node/components/cell/GridCell.js +3 -3
  114. package/node/constants/defaultGridSlotsComponents.js +17 -17
  115. package/node/hooks/features/export/useGridPrintExport.js +5 -9
  116. package/node/hooks/features/filter/gridFilterUtils.js +21 -70
  117. package/node/hooks/features/filter/useGridFilter.js +2 -1
  118. package/node/hooks/features/rows/useGridRows.js +1 -1
  119. package/node/index.js +1 -1
  120. package/node/internals/index.js +13 -13
  121. package/node/internals/utils/computeSlots.js +10 -8
  122. package/node/internals/utils/index.js +0 -11
  123. package/node/internals/utils/useProps.js +4 -8
  124. package/node/locales/csCZ.js +2 -2
  125. package/node/material/index.js +48 -48
  126. package/node/utils/getPublicApiRef.js +11 -0
  127. package/package.json +1 -1
  128. package/utils/getPublicApiRef.d.ts +3 -0
  129. package/utils/getPublicApiRef.js +5 -0
  130. package/colDef/utils.d.ts +0 -21
  131. package/colDef/utils.js +0 -51
  132. package/internals/utils/slotsMigration.d.ts +0 -4
  133. package/internals/utils/slotsMigration.js +0 -13
  134. package/legacy/colDef/utils.js +0 -51
  135. package/legacy/internals/utils/slotsMigration.js +0 -14
  136. package/modern/colDef/utils.js +0 -51
  137. package/modern/internals/utils/slotsMigration.js +0 -13
  138. package/node/colDef/utils.js +0 -63
  139. package/node/internals/utils/slotsMigration.js +0 -21
@@ -447,8 +447,8 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
447
447
  value,
448
448
  formattedValue
449
449
  } = cellParamsWithAPI;
450
- const managesOwnFocus = column.type === 'actions';
451
- const tabIndex = (cellMode === 'view' || !isEditable) && !managesOwnFocus ? cellParamsWithAPI.tabIndex : -1;
450
+ const canManageOwnFocus = column.type === 'actions' && column.getActions?.(apiRef.current.getRowParams(rowId)).some(action => !action.props.disabled);
451
+ const tabIndex = (cellMode === 'view' || !isEditable) && !canManageOwnFocus ? cellParamsWithAPI.tabIndex : -1;
452
452
  const {
453
453
  classes: rootClasses,
454
454
  getCellClassName
@@ -586,7 +586,7 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
586
586
  children: valueString
587
587
  });
588
588
  }
589
- if ( /*#__PURE__*/React.isValidElement(children) && managesOwnFocus) {
589
+ if ( /*#__PURE__*/React.isValidElement(children) && canManageOwnFocus) {
590
590
  children = /*#__PURE__*/React.cloneElement(children, {
591
591
  focusElementRef
592
592
  });
@@ -15,21 +15,21 @@ var _material = _interopRequireDefault(require("../material"));
15
15
  // TODO: camelCase these key. It's a private helper now.
16
16
  // Remove then need to call `uncapitalizeObjectKeys`.
17
17
  const DATA_GRID_DEFAULT_SLOTS_COMPONENTS = exports.DATA_GRID_DEFAULT_SLOTS_COMPONENTS = (0, _extends2.default)({}, _material.default, {
18
- Cell: _GridCell.GridCellV7,
19
- SkeletonCell: _components.GridSkeletonCell,
20
- ColumnHeaderFilterIconButton: _components.GridColumnHeaderFilterIconButton,
21
- ColumnMenu: _GridColumnMenu.GridColumnMenu,
22
- ColumnHeaders: _GridColumnHeaders.GridColumnHeaders,
23
- Footer: _components.GridFooter,
24
- FooterRowCount: _components.GridRowCount,
25
- Toolbar: null,
26
- PreferencesPanel: _components.GridPreferencesPanel,
27
- LoadingOverlay: _components.GridLoadingOverlay,
28
- NoResultsOverlay: _GridNoResultsOverlay.GridNoResultsOverlay,
29
- NoRowsOverlay: _components.GridNoRowsOverlay,
30
- Pagination: _components.GridPagination,
31
- FilterPanel: _components.GridFilterPanel,
32
- ColumnsPanel: _components.GridColumnsPanel,
33
- Panel: _components.GridPanel,
34
- Row: _components.GridRow
18
+ cell: _GridCell.GridCellV7,
19
+ skeletonCell: _components.GridSkeletonCell,
20
+ columnHeaderFilterIconButton: _components.GridColumnHeaderFilterIconButton,
21
+ columnMenu: _GridColumnMenu.GridColumnMenu,
22
+ columnHeaders: _GridColumnHeaders.GridColumnHeaders,
23
+ footer: _components.GridFooter,
24
+ footerRowCount: _components.GridRowCount,
25
+ toolbar: null,
26
+ preferencesPanel: _components.GridPreferencesPanel,
27
+ loadingOverlay: _components.GridLoadingOverlay,
28
+ noResultsOverlay: _GridNoResultsOverlay.GridNoResultsOverlay,
29
+ noRowsOverlay: _components.GridNoRowsOverlay,
30
+ pagination: _components.GridPagination,
31
+ filterPanel: _components.GridFilterPanel,
32
+ columnsPanel: _components.GridColumnsPanel,
33
+ panel: _components.GridPanel,
34
+ row: _components.GridRow
35
35
  });
@@ -127,12 +127,10 @@ const useGridPrintExport = (apiRef, props) => {
127
127
  // the footer is always being placed at the bottom of the page as if all rows are exported
128
128
  // so if getRowsToExport is being used to only export a subset of rows then we need to
129
129
  // adjust the footer position to be correctly placed at the bottom of the grid
130
- if (options?.getRowsToExport) {
131
- const gridFooterElement = gridClone.querySelector(`.${_gridClasses.gridClasses.footerContainer}`);
132
- gridFooterElement.style.position = 'absolute';
133
- gridFooterElement.style.width = '100%';
134
- gridFooterElement.style.top = `${computedTotalHeight - gridFooterElementHeight}px`;
135
- }
130
+ const gridFooterElement = gridClone.querySelector(`.${_gridClasses.gridClasses.footerContainer}`);
131
+ gridFooterElement.style.position = 'absolute';
132
+ gridFooterElement.style.width = '100%';
133
+ gridFooterElement.style.top = `${computedTotalHeight - gridFooterElementHeight}px`;
136
134
 
137
135
  // printDoc.body.appendChild(gridClone); should be enough but a clone isolation bug in Safari
138
136
  // prevents us to do it
@@ -235,9 +233,7 @@ const useGridPrintExport = (apiRef, props) => {
235
233
  apiRef.current.forceUpdate();
236
234
  }
237
235
  await updateGridColumnsForPrint(options?.fields, options?.allColumns, options?.includeCheckboxes);
238
- if (options?.getRowsToExport) {
239
- updateGridRowsForPrint(options.getRowsToExport);
240
- }
236
+ updateGridRowsForPrint(options?.getRowsToExport ?? _utils2.defaultGetRowsToExport);
241
237
  apiRef.current.unstable_setVirtualization(false);
242
238
  await raf(); // wait for the state changes to take action
243
239
  const printWindow = buildPrintWindow(options?.fileName);
@@ -4,12 +4,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.sanitizeFilterModel = exports.passFilterLogic = exports.mergeStateWithFilterModel = exports.cleanFilterItem = exports.buildAggregatedFilterApplier = void 0;
7
+ exports.sanitizeFilterModel = exports.removeDiacritics = exports.passFilterLogic = exports.mergeStateWithFilterModel = exports.cleanFilterItem = exports.buildAggregatedFilterApplier = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _models = require("../../../models");
10
- var _utils = require("../../../colDef/utils");
11
10
  var _gridFilterState = require("./gridFilterState");
12
11
  var _warning = require("../../../utils/warning");
12
+ var _getPublicApiRef = require("../../../utils/getPublicApiRef");
13
13
  var _columns = require("../columns");
14
14
  // Fixes https://github.com/mui/mui-x/issues/10056
15
15
  const globalScope = typeof window === 'undefined' ? globalThis : window;
@@ -84,6 +84,7 @@ const removeDiacritics = value => {
84
84
  }
85
85
  return value;
86
86
  };
87
+ exports.removeDiacritics = removeDiacritics;
87
88
  const getFilterCallbackFromItem = (filterItem, apiRef) => {
88
89
  if (!filterItem.field || !filterItem.operator) {
89
90
  return null;
@@ -116,41 +117,19 @@ const getFilterCallbackFromItem = (filterItem, apiRef) => {
116
117
  if (!filterOperator) {
117
118
  throw new Error(`MUI: No filter operator found for column '${column.field}' and operator value '${newFilterItem.operator}'.`);
118
119
  }
119
- const hasUserFunctionLegacy = !(0, _utils.isInternalFilter)(filterOperator.getApplyFilterFn);
120
- const hasUserFunctionV7 = !(0, _utils.isInternalFilter)(filterOperator.getApplyFilterFnV7);
121
- if (filterOperator.getApplyFilterFnV7 && !(hasUserFunctionLegacy && !hasUserFunctionV7)) {
122
- const applyFilterOnRow = filterOperator.getApplyFilterFnV7(newFilterItem, column);
123
- if (typeof applyFilterOnRow !== 'function') {
124
- return null;
125
- }
126
- return {
127
- v7: true,
128
- item: newFilterItem,
129
- fn: row => {
130
- let value = apiRef.current.getRowValue(row, column);
131
- if (ignoreDiacritics) {
132
- value = removeDiacritics(value);
133
- }
134
- return applyFilterOnRow(value, row, column, apiRef);
135
- }
136
- };
137
- }
120
+ const publicApiRef = (0, _getPublicApiRef.getPublicApiRef)(apiRef);
138
121
  const applyFilterOnRow = filterOperator.getApplyFilterFn(newFilterItem, column);
139
122
  if (typeof applyFilterOnRow !== 'function') {
140
123
  return null;
141
124
  }
142
125
  return {
143
- v7: false,
144
126
  item: newFilterItem,
145
- fn: rowId => {
146
- const params = apiRef.current.getCellParams(rowId, newFilterItem.field);
147
- _utils.GLOBAL_API_REF.current = apiRef;
127
+ fn: row => {
128
+ let value = apiRef.current.getRowValue(row, column);
148
129
  if (ignoreDiacritics) {
149
- params.value = removeDiacritics(params.value);
130
+ value = removeDiacritics(value);
150
131
  }
151
- const result = applyFilterOnRow(params);
152
- _utils.GLOBAL_API_REF.current = null;
153
- return result;
132
+ return applyFilterOnRow(value, row, column, publicApiRef);
154
133
  }
155
134
  };
156
135
  };
@@ -177,7 +156,7 @@ const buildAggregatedFilterItemsApplier = (filterModel, apiRef, disableEval) =>
177
156
  for (let i = 0; i < appliers.length; i += 1) {
178
157
  const applier = appliers[i];
179
158
  if (!shouldApplyFilter || shouldApplyFilter(applier.item.field)) {
180
- resultPerItemId[applier.item.id] = applier.v7 ? applier.fn(row) : applier.fn(apiRef.current.getRowId(row));
159
+ resultPerItemId[applier.item.id] = applier.fn(row);
181
160
  }
182
161
  }
183
162
  return resultPerItemId;
@@ -193,7 +172,7 @@ const buildAggregatedFilterItemsApplier = (filterModel, apiRef, disableEval) =>
193
172
  ${appliers.map((applier, i) => `${JSON.stringify(String(applier.item.id))}:
194
173
  !shouldApply${i} ?
195
174
  false :
196
- ${applier.v7 ? `appliers[${i}].fn(row)` : `appliers[${i}].fn(getRowId(row))`},
175
+ appliers[${i}].fn(row),
197
176
  `).join('\n')}};
198
177
 
199
178
  return result$$;
@@ -223,31 +202,17 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
223
202
  const {
224
203
  ignoreDiacritics
225
204
  } = apiRef.current.rootProps;
205
+ const publicApiRef = (0, _getPublicApiRef.getPublicApiRef)(apiRef);
226
206
  columnFields.forEach(field => {
227
207
  const column = apiRef.current.getColumn(field);
228
208
  const getApplyQuickFilterFn = column?.getApplyQuickFilterFn;
229
- const getApplyQuickFilterFnV7 = column?.getApplyQuickFilterFnV7;
230
- const hasUserFunctionLegacy = !(0, _utils.isInternalFilter)(getApplyQuickFilterFn);
231
- const hasUserFunctionV7 = !(0, _utils.isInternalFilter)(getApplyQuickFilterFnV7);
232
- if (getApplyQuickFilterFnV7 && !(hasUserFunctionLegacy && !hasUserFunctionV7)) {
233
- appliersPerField.push({
234
- column,
235
- appliers: quickFilterValues.map(quickFilterValue => {
236
- const value = ignoreDiacritics ? removeDiacritics(quickFilterValue) : quickFilterValue;
237
- return {
238
- v7: true,
239
- fn: getApplyQuickFilterFnV7(value, column, apiRef)
240
- };
241
- })
242
- });
243
- } else if (getApplyQuickFilterFn) {
209
+ if (getApplyQuickFilterFn) {
244
210
  appliersPerField.push({
245
211
  column,
246
212
  appliers: quickFilterValues.map(quickFilterValue => {
247
213
  const value = ignoreDiacritics ? removeDiacritics(quickFilterValue) : quickFilterValue;
248
214
  return {
249
- v7: false,
250
- fn: getApplyQuickFilterFn(value, column, apiRef)
215
+ fn: getApplyQuickFilterFn(value, column, publicApiRef)
251
216
  };
252
217
  })
253
218
  });
@@ -255,7 +220,6 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
255
220
  });
256
221
  return function isRowMatchingQuickFilter(row, shouldApplyFilter) {
257
222
  const result = {};
258
- const usedCellParams = {};
259
223
 
260
224
  /* eslint-disable no-restricted-syntax, no-labels */
261
225
  outer: for (let v = 0; v < quickFilterValues.length; v += 1) {
@@ -272,30 +236,17 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
272
236
  continue;
273
237
  }
274
238
  const applier = appliers[v];
275
- let value = apiRef.current.getRowFormattedValue(row, column);
239
+ let value = apiRef.current.getRowValue(row, column);
276
240
  if (applier.fn === null) {
277
241
  continue;
278
242
  }
279
- if (applier.v7) {
280
- if (ignoreDiacritics) {
281
- value = removeDiacritics(value);
282
- }
283
- const isMatching = applier.fn(value, row, column, apiRef);
284
- if (isMatching) {
285
- result[filterValue] = true;
286
- continue outer;
287
- }
288
- } else {
289
- const cellParams = usedCellParams[field] ?? apiRef.current.getCellParams(apiRef.current.getRowId(row), field);
290
- if (ignoreDiacritics) {
291
- cellParams.value = removeDiacritics(cellParams.value);
292
- }
293
- usedCellParams[field] = cellParams;
294
- const isMatching = applier.fn(cellParams);
295
- if (isMatching) {
296
- result[filterValue] = true;
297
- continue outer;
298
- }
243
+ if (ignoreDiacritics) {
244
+ value = removeDiacritics(value);
245
+ }
246
+ const isMatching = applier.fn(value, row, column, publicApiRef);
247
+ if (isMatching) {
248
+ result[filterValue] = true;
249
+ continue outer;
299
250
  }
300
251
  }
301
252
  result[filterValue] = false;
@@ -222,7 +222,8 @@ const useGridFilter = (apiRef, props) => {
222
222
  setFilterModel,
223
223
  showFilterPanel,
224
224
  hideFilterPanel,
225
- setQuickFilterValues
225
+ setQuickFilterValues,
226
+ ignoreDiacritics: props.ignoreDiacritics
226
227
  };
227
228
  (0, _useGridApiMethod.useGridApiMethod)(apiRef, filterApi, 'public');
228
229
 
@@ -293,7 +293,7 @@ const useGridRows = (apiRef, props) => {
293
293
  });
294
294
 
295
295
  // Removes potential remaining skeleton rows from the dataRowIds.
296
- const dataRowIds = rootGroupChildren.filter(childId => tree[childId].type === 'leaf');
296
+ const dataRowIds = rootGroupChildren.filter(childId => tree[childId]?.type === 'leaf');
297
297
  apiRef.current.caches.rows.dataRowIdToModelLookup = dataRowIdToModelLookup;
298
298
  apiRef.current.caches.rows.dataRowIdToIdLookup = dataRowIdToIdLookup;
299
299
  apiRef.current.setState(state => (0, _extends2.default)({}, state, {
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v6.18.0
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
@@ -716,6 +716,18 @@ var _keyboardUtils = require("../utils/keyboardUtils");
716
716
  var _utils2 = require("../utils/utils");
717
717
  var _warning = require("../utils/warning");
718
718
  var _exportAs = require("../utils/exportAs");
719
+ var _getPublicApiRef = require("../utils/getPublicApiRef");
720
+ Object.keys(_getPublicApiRef).forEach(function (key) {
721
+ if (key === "default" || key === "__esModule") return;
722
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
723
+ if (key in exports && exports[key] === _getPublicApiRef[key]) return;
724
+ Object.defineProperty(exports, key, {
725
+ enumerable: true,
726
+ get: function () {
727
+ return _getPublicApiRef[key];
728
+ }
729
+ });
730
+ });
719
731
  var _useGridPrivateApiContext = require("../hooks/utils/useGridPrivateApiContext");
720
732
  var _useOnMount = require("../hooks/utils/useOnMount");
721
733
  Object.keys(_useOnMount).forEach(function (key) {
@@ -730,7 +742,7 @@ Object.keys(_useOnMount).forEach(function (key) {
730
742
  });
731
743
  });
732
744
  var _csvSerializer = require("../hooks/features/export/serializers/csvSerializer");
733
- var _utils3 = require("../colDef/utils");
745
+ var _utils3 = require("./utils");
734
746
  Object.keys(_utils3).forEach(function (key) {
735
747
  if (key === "default" || key === "__esModule") return;
736
748
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -741,16 +753,4 @@ Object.keys(_utils3).forEach(function (key) {
741
753
  return _utils3[key];
742
754
  }
743
755
  });
744
- });
745
- var _utils4 = require("./utils");
746
- Object.keys(_utils4).forEach(function (key) {
747
- if (key === "default" || key === "__esModule") return;
748
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
749
- if (key in exports && exports[key] === _utils4[key]) return;
750
- Object.defineProperty(exports, key, {
751
- enumerable: true,
752
- get: function () {
753
- return _utils4[key];
754
- }
755
- });
756
756
  });
@@ -6,18 +6,20 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.computeSlots = computeSlots;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
- var _slotsMigration = require("./slotsMigration");
10
- // TODO v7: Remove `components` and usages of `UncapitalizeObjectKeys` type
11
- // after converting keys in Grid(Pro|Premium)SlotsComponent to camelCase.
12
- // https://github.com/mui/mui-x/issues/7940
13
9
  function computeSlots({
14
10
  defaultSlots,
15
- slots,
16
- components
11
+ slots
17
12
  }) {
18
- const overrides = slots ?? (components ? (0, _slotsMigration.uncapitalizeObjectKeys)(components) : null);
13
+ const overrides = slots;
19
14
  if (!overrides || Object.keys(overrides).length === 0) {
20
15
  return defaultSlots;
21
16
  }
22
- return (0, _extends2.default)({}, defaultSlots, overrides);
17
+ const result = (0, _extends2.default)({}, defaultSlots);
18
+ Object.keys(overrides).forEach(key => {
19
+ const k = key;
20
+ if (overrides[k] !== undefined) {
21
+ result[k] = overrides[k];
22
+ }
23
+ });
24
+ return result;
23
25
  }
@@ -14,17 +14,6 @@ Object.keys(_computeSlots).forEach(function (key) {
14
14
  }
15
15
  });
16
16
  });
17
- var _slotsMigration = require("./slotsMigration");
18
- Object.keys(_slotsMigration).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _slotsMigration[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function () {
24
- return _slotsMigration[key];
25
- }
26
- });
27
- });
28
17
  var _useProps = require("./useProps");
29
18
  Object.keys(_useProps).forEach(function (key) {
30
19
  if (key === "default" || key === "__esModule") return;
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.useProps = useProps;
8
- var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
8
+ var _objectDestructuringEmpty2 = _interopRequireDefault(require("@babel/runtime/helpers/objectDestructuringEmpty"));
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
10
  var React = _interopRequireWildcard(require("react"));
10
- const _excluded = ["components", "componentsProps"];
11
11
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
12
12
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
13
13
  /** Gathers props for the root element into a single `.forwardedProps` field */
@@ -31,11 +31,7 @@ function groupForwardedProps(props) {
31
31
  }
32
32
  function useProps(allProps) {
33
33
  return React.useMemo(() => {
34
- const {
35
- components,
36
- componentsProps
37
- } = allProps,
38
- themedProps = (0, _objectWithoutPropertiesLoose2.default)(allProps, _excluded);
39
- return [components, componentsProps, groupForwardedProps(themedProps)];
34
+ const themedProps = (0, _extends2.default)({}, ((0, _objectDestructuringEmpty2.default)(allProps), allProps));
35
+ return groupForwardedProps(themedProps);
40
36
  }, [allProps]);
41
37
  }
@@ -156,8 +156,8 @@ const csCZGrid = {
156
156
  // Actions cell more text
157
157
  actionsCellMore: 'více',
158
158
  // Column pinning text
159
- pinToLeft: 'Připnout na levo',
160
- pinToRight: 'Připnout na pravo',
159
+ pinToLeft: 'Připnout vlevo',
160
+ pinToRight: 'Připnout vpravo',
161
161
  unpin: 'Odepnout',
162
162
  // Tree Data
163
163
  treeDataGroupingHeaderName: 'Skupina',
@@ -22,55 +22,55 @@ var _GridColumnUnsortedIcon = require("./icons/GridColumnUnsortedIcon");
22
22
  var _icons = require("./icons");
23
23
  var _MUISelectOption = _interopRequireDefault(require("./components/MUISelectOption"));
24
24
  const iconSlots = {
25
- BooleanCellTrueIcon: _icons.GridCheckIcon,
26
- BooleanCellFalseIcon: _icons.GridCloseIcon,
27
- ColumnMenuIcon: _icons.GridTripleDotsVerticalIcon,
28
- OpenFilterButtonIcon: _icons.GridFilterListIcon,
29
- FilterPanelDeleteIcon: _icons.GridCloseIcon,
30
- ColumnFilteredIcon: _icons.GridFilterAltIcon,
31
- ColumnSelectorIcon: _icons.GridColumnIcon,
32
- ColumnUnsortedIcon: _GridColumnUnsortedIcon.GridColumnUnsortedIcon,
33
- ColumnSortedAscendingIcon: _icons.GridArrowUpwardIcon,
34
- ColumnSortedDescendingIcon: _icons.GridArrowDownwardIcon,
35
- ColumnResizeIcon: _icons.GridSeparatorIcon,
36
- DensityCompactIcon: _icons.GridViewHeadlineIcon,
37
- DensityStandardIcon: _icons.GridTableRowsIcon,
38
- DensityComfortableIcon: _icons.GridViewStreamIcon,
39
- ExportIcon: _icons.GridSaveAltIcon,
40
- MoreActionsIcon: _icons.GridMoreVertIcon,
41
- TreeDataCollapseIcon: _icons.GridExpandMoreIcon,
42
- TreeDataExpandIcon: _icons.GridKeyboardArrowRight,
43
- GroupingCriteriaCollapseIcon: _icons.GridExpandMoreIcon,
44
- GroupingCriteriaExpandIcon: _icons.GridKeyboardArrowRight,
45
- DetailPanelExpandIcon: _icons.GridAddIcon,
46
- DetailPanelCollapseIcon: _icons.GridRemoveIcon,
47
- RowReorderIcon: _icons.GridDragIcon,
48
- QuickFilterIcon: _icons.GridSearchIcon,
49
- QuickFilterClearIcon: _icons.GridCloseIcon,
50
- ColumnMenuHideIcon: _icons.GridVisibilityOffIcon,
51
- ColumnMenuSortAscendingIcon: _icons.GridArrowUpwardIcon,
52
- ColumnMenuSortDescendingIcon: _icons.GridArrowDownwardIcon,
53
- ColumnMenuFilterIcon: _icons.GridFilterAltIcon,
54
- ColumnMenuManageColumnsIcon: _icons.GridViewColumnIcon,
55
- ColumnMenuClearIcon: _icons.GridClearIcon,
56
- LoadIcon: _icons.GridLoadIcon,
57
- FilterPanelAddIcon: _icons.GridAddIcon,
58
- FilterPanelRemoveAllIcon: _icons.GridDeleteForeverIcon,
59
- ColumnReorderIcon: _icons.GridDragIcon
25
+ booleanCellTrueIcon: _icons.GridCheckIcon,
26
+ booleanCellFalseIcon: _icons.GridCloseIcon,
27
+ columnMenuIcon: _icons.GridTripleDotsVerticalIcon,
28
+ openFilterButtonIcon: _icons.GridFilterListIcon,
29
+ filterPanelDeleteIcon: _icons.GridCloseIcon,
30
+ columnFilteredIcon: _icons.GridFilterAltIcon,
31
+ columnSelectorIcon: _icons.GridColumnIcon,
32
+ columnUnsortedIcon: _GridColumnUnsortedIcon.GridColumnUnsortedIcon,
33
+ columnSortedAscendingIcon: _icons.GridArrowUpwardIcon,
34
+ columnSortedDescendingIcon: _icons.GridArrowDownwardIcon,
35
+ columnResizeIcon: _icons.GridSeparatorIcon,
36
+ densityCompactIcon: _icons.GridViewHeadlineIcon,
37
+ densityStandardIcon: _icons.GridTableRowsIcon,
38
+ densityComfortableIcon: _icons.GridViewStreamIcon,
39
+ exportIcon: _icons.GridSaveAltIcon,
40
+ moreActionsIcon: _icons.GridMoreVertIcon,
41
+ treeDataCollapseIcon: _icons.GridExpandMoreIcon,
42
+ treeDataExpandIcon: _icons.GridKeyboardArrowRight,
43
+ groupingCriteriaCollapseIcon: _icons.GridExpandMoreIcon,
44
+ groupingCriteriaExpandIcon: _icons.GridKeyboardArrowRight,
45
+ detailPanelExpandIcon: _icons.GridAddIcon,
46
+ detailPanelCollapseIcon: _icons.GridRemoveIcon,
47
+ rowReorderIcon: _icons.GridDragIcon,
48
+ quickFilterIcon: _icons.GridSearchIcon,
49
+ quickFilterClearIcon: _icons.GridCloseIcon,
50
+ columnMenuHideIcon: _icons.GridVisibilityOffIcon,
51
+ columnMenuSortAscendingIcon: _icons.GridArrowUpwardIcon,
52
+ columnMenuSortDescendingIcon: _icons.GridArrowDownwardIcon,
53
+ columnMenuFilterIcon: _icons.GridFilterAltIcon,
54
+ columnMenuManageColumnsIcon: _icons.GridViewColumnIcon,
55
+ columnMenuClearIcon: _icons.GridClearIcon,
56
+ loadIcon: _icons.GridLoadIcon,
57
+ filterPanelAddIcon: _icons.GridAddIcon,
58
+ filterPanelRemoveAllIcon: _icons.GridDeleteForeverIcon,
59
+ columnReorderIcon: _icons.GridDragIcon
60
60
  };
61
61
  const materialSlots = (0, _extends2.default)({}, iconSlots, {
62
- BaseCheckbox: _Checkbox.default,
63
- BaseTextField: _TextField.default,
64
- BaseFormControl: _FormControl.default,
65
- BaseSelect: _Select.default,
66
- BaseSwitch: _Switch.default,
67
- BaseButton: _Button.default,
68
- BaseIconButton: _IconButton.default,
69
- BaseInputAdornment: _InputAdornment.default,
70
- BaseTooltip: _Tooltip.default,
71
- BasePopper: _Popper.default,
72
- BaseInputLabel: _InputLabel.default,
73
- BaseSelectOption: _MUISelectOption.default,
74
- BaseChip: _Chip.default
62
+ baseCheckbox: _Checkbox.default,
63
+ baseTextField: _TextField.default,
64
+ baseFormControl: _FormControl.default,
65
+ baseSelect: _Select.default,
66
+ baseSwitch: _Switch.default,
67
+ baseButton: _Button.default,
68
+ baseIconButton: _IconButton.default,
69
+ baseInputAdornment: _InputAdornment.default,
70
+ baseTooltip: _Tooltip.default,
71
+ basePopper: _Popper.default,
72
+ baseInputLabel: _InputLabel.default,
73
+ baseSelectOption: _MUISelectOption.default,
74
+ baseChip: _Chip.default
75
75
  });
76
76
  var _default = exports.default = materialSlots;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getPublicApiRef = getPublicApiRef;
7
+ function getPublicApiRef(apiRef) {
8
+ return {
9
+ current: apiRef.current.getPublicApi()
10
+ };
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid",
3
- "version": "6.18.0",
3
+ "version": "7.0.0-alpha.0",
4
4
  "description": "The community edition of the data grid component (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import type { GridPrivateApiCommunity } from '../models/api/gridApiCommunity';
3
+ export declare function getPublicApiRef<PrivateApi extends GridPrivateApiCommunity>(apiRef: React.MutableRefObject<PrivateApi>): import("react").MutableRefObject<ReturnType<PrivateApi["getPublicApi"]>>;
@@ -0,0 +1,5 @@
1
+ export function getPublicApiRef(apiRef) {
2
+ return {
3
+ current: apiRef.current.getPublicApi()
4
+ };
5
+ }
package/colDef/utils.d.ts DELETED
@@ -1,21 +0,0 @@
1
- import * as React from 'react';
2
- import { GridApiCommunity } from '../models/api/gridApiCommunity';
3
- import { GetApplyFilterFnV7, GetApplyFilterFnLegacy, GridFilterOperator } from '../models';
4
- import { GetApplyQuickFilterFnV7, GetApplyQuickFilterFnLegacy } from '../models/colDef/gridColDef';
5
- /**
6
- * A global API ref, for v7-to-legacy converter
7
- */
8
- export declare const GLOBAL_API_REF: {
9
- current: React.MutableRefObject<GridApiCommunity> | null;
10
- };
11
- /**
12
- * A tagger to determine if the filter is internal or custom user-supplied.
13
- * To be a valid internal filter, the v7 function *must* be defined/redefined at
14
- * the same time as the legacy one.
15
- * https://github.com/mui/mui-x/pull/9254#discussion_r1231095551
16
- */
17
- export declare function tagInternalFilter<T>(fn: T): T;
18
- export declare function isInternalFilter(fn: Function | undefined): boolean;
19
- export declare function convertFilterV7ToLegacy(fn: GetApplyFilterFnV7): GetApplyFilterFnLegacy;
20
- export declare function convertLegacyOperators(ops: Omit<GridFilterOperator, 'getApplyFilterFn'>[]): GridFilterOperator[];
21
- export declare function convertQuickFilterV7ToLegacy(fn: GetApplyQuickFilterFnV7): GetApplyQuickFilterFnLegacy<any, any, any>;
package/colDef/utils.js DELETED
@@ -1,51 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- /**
3
- * A global API ref, for v7-to-legacy converter
4
- */
5
- export const GLOBAL_API_REF = {
6
- current: null
7
- };
8
-
9
- /**
10
- * A tagger to determine if the filter is internal or custom user-supplied.
11
- * To be a valid internal filter, the v7 function *must* be defined/redefined at
12
- * the same time as the legacy one.
13
- * https://github.com/mui/mui-x/pull/9254#discussion_r1231095551
14
- */
15
- export function tagInternalFilter(fn) {
16
- fn.isInternal = true;
17
- return fn;
18
- }
19
- export function isInternalFilter(fn) {
20
- return fn !== undefined && fn.isInternal === true;
21
- }
22
- export function convertFilterV7ToLegacy(fn) {
23
- return tagInternalFilter((filterItem, column) => {
24
- const filterFn = fn(filterItem, column);
25
- if (!filterFn) {
26
- return filterFn;
27
- }
28
- return cellParams => {
29
- return filterFn(cellParams.value, cellParams.row, column, GLOBAL_API_REF.current);
30
- };
31
- });
32
- }
33
- export function convertLegacyOperators(ops) {
34
- return ops.map(op => {
35
- return _extends({}, op, {
36
- getApplyFilterFn: convertFilterV7ToLegacy(op.getApplyFilterFnV7),
37
- getApplyFilterFnV7: tagInternalFilter(op.getApplyFilterFnV7)
38
- });
39
- });
40
- }
41
- export function convertQuickFilterV7ToLegacy(fn) {
42
- return tagInternalFilter((filterItem, column, apiRef) => {
43
- const filterFn = fn(filterItem, column, apiRef);
44
- if (!filterFn) {
45
- return filterFn;
46
- }
47
- return cellParams => {
48
- return filterFn(cellParams.value, cellParams.row, column, apiRef);
49
- };
50
- });
51
- }
@@ -1,4 +0,0 @@
1
- export type UncapitalizeObjectKeys<T extends object> = {
2
- [K in keyof T as K extends string ? Uncapitalize<K> : K]: T[K];
3
- };
4
- export declare const uncapitalizeObjectKeys: <TInputType extends object>(capitalizedObject: TInputType) => UncapitalizeObjectKeys<TInputType> | undefined;