@mui/x-data-grid 7.0.0-beta.1 → 7.0.0-beta.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.
Files changed (100) hide show
  1. package/CHANGELOG.md +159 -1
  2. package/DataGrid/DataGrid.d.ts +1 -1
  3. package/DataGrid/DataGrid.js +1 -1
  4. package/DataGrid/useDataGridProps.js +3 -1
  5. package/components/GridPagination.d.ts +1 -1
  6. package/components/GridPagination.js +12 -2
  7. package/components/GridRow.js +7 -5
  8. package/components/GridScrollbarFillerCell.js +0 -3
  9. package/components/base/GridFooterPlaceholder.js +1 -1
  10. package/components/cell/GridActionsCell.js +3 -3
  11. package/components/cell/GridActionsCellItem.d.ts +13 -1
  12. package/components/cell/GridActionsCellItem.js +27 -15
  13. package/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
  14. package/components/columnSelection/GridHeaderCheckbox.d.ts +1 -1
  15. package/components/columnsManagement/utils.d.ts +1 -1
  16. package/components/containers/GridRootStyles.js +10 -2
  17. package/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
  18. package/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
  19. package/components/panel/filterPanel/GridFilterPanel.js +1 -1
  20. package/constants/gridClasses.d.ts +5 -0
  21. package/constants/gridClasses.js +1 -1
  22. package/hooks/features/rows/gridRowsUtils.js +1 -1
  23. package/hooks/features/rows/useGridRows.js +2 -2
  24. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +0 -1
  25. package/hooks/features/virtualization/useGridVirtualScroller.js +9 -10
  26. package/index.js +1 -1
  27. package/internals/utils/propValidation.js +1 -1
  28. package/joy/joySlots.js +2 -2
  29. package/legacy/DataGrid/DataGrid.js +1 -1
  30. package/legacy/DataGrid/useDataGridProps.js +3 -1
  31. package/legacy/components/GridPagination.js +10 -2
  32. package/legacy/components/GridRow.js +7 -5
  33. package/legacy/components/GridScrollbarFillerCell.js +1 -3
  34. package/legacy/components/base/GridFooterPlaceholder.js +1 -1
  35. package/legacy/components/cell/GridActionsCell.js +3 -3
  36. package/legacy/components/cell/GridActionsCellItem.js +30 -17
  37. package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
  38. package/legacy/components/containers/GridRootStyles.js +9 -3
  39. package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
  40. package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
  41. package/legacy/components/panel/filterPanel/GridFilterPanel.js +1 -1
  42. package/legacy/constants/gridClasses.js +1 -1
  43. package/legacy/hooks/features/rows/gridRowsUtils.js +1 -1
  44. package/legacy/hooks/features/rows/useGridRows.js +2 -2
  45. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +9 -10
  46. package/legacy/index.js +1 -1
  47. package/legacy/internals/utils/propValidation.js +1 -1
  48. package/legacy/joy/joySlots.js +2 -2
  49. package/legacy/locales/daDK.js +12 -12
  50. package/locales/daDK.js +12 -12
  51. package/models/api/gridApiCommon.d.ts +1 -1
  52. package/models/api/gridFilterApi.d.ts +1 -1
  53. package/models/api/gridLocaleTextApi.d.ts +3 -3
  54. package/models/events/gridEventLookup.d.ts +1 -1
  55. package/models/gridSlotsComponent.d.ts +34 -36
  56. package/models/gridSlotsComponentsProps.d.ts +73 -54
  57. package/models/props/DataGridProps.d.ts +2 -2
  58. package/modern/DataGrid/DataGrid.js +1 -1
  59. package/modern/DataGrid/useDataGridProps.js +3 -1
  60. package/modern/components/GridPagination.js +12 -2
  61. package/modern/components/GridRow.js +6 -5
  62. package/modern/components/GridScrollbarFillerCell.js +0 -3
  63. package/modern/components/base/GridFooterPlaceholder.js +1 -1
  64. package/modern/components/cell/GridActionsCell.js +3 -3
  65. package/modern/components/cell/GridActionsCellItem.js +27 -15
  66. package/modern/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
  67. package/modern/components/containers/GridRootStyles.js +10 -2
  68. package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
  69. package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
  70. package/modern/components/panel/filterPanel/GridFilterPanel.js +1 -1
  71. package/modern/constants/gridClasses.js +1 -1
  72. package/modern/hooks/features/rows/gridRowsUtils.js +1 -1
  73. package/modern/hooks/features/rows/useGridRows.js +2 -2
  74. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +9 -10
  75. package/modern/index.js +1 -1
  76. package/modern/internals/utils/propValidation.js +1 -1
  77. package/modern/joy/joySlots.js +2 -2
  78. package/modern/locales/daDK.js +12 -12
  79. package/node/DataGrid/DataGrid.js +1 -1
  80. package/node/DataGrid/useDataGridProps.js +3 -1
  81. package/node/components/GridPagination.js +12 -2
  82. package/node/components/GridRow.js +6 -5
  83. package/node/components/GridScrollbarFillerCell.js +0 -3
  84. package/node/components/base/GridFooterPlaceholder.js +1 -1
  85. package/node/components/cell/GridActionsCell.js +3 -3
  86. package/node/components/cell/GridActionsCellItem.js +27 -15
  87. package/node/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
  88. package/node/components/containers/GridRootStyles.js +10 -2
  89. package/node/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
  90. package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
  91. package/node/components/panel/filterPanel/GridFilterPanel.js +1 -1
  92. package/node/constants/gridClasses.js +1 -1
  93. package/node/hooks/features/rows/gridRowsUtils.js +2 -2
  94. package/node/hooks/features/rows/useGridRows.js +2 -2
  95. package/node/hooks/features/virtualization/useGridVirtualScroller.js +9 -10
  96. package/node/index.js +1 -1
  97. package/node/internals/utils/propValidation.js +1 -1
  98. package/node/joy/joySlots.js +2 -2
  99. package/node/locales/daDK.js +12 -12
  100. package/package.json +2 -2
@@ -12,7 +12,7 @@ exports.getMinimalContentHeight = getMinimalContentHeight;
12
12
  exports.updateCacheWithNewRows = exports.isAutoGeneratedRow = exports.getTreeNodeDescendants = exports.getTopLevelRowCount = exports.getRowsStateFromCache = exports.getRowIdFromRowModel = void 0;
13
13
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
14
14
  var _gridRowsSelector = require("./gridRowsSelector");
15
- var _dimensions = require("../dimensions");
15
+ var _gridDimensionsSelectors = require("../dimensions/gridDimensionsSelectors");
16
16
  const GRID_ROOT_GROUP_ID = exports.GRID_ROOT_GROUP_ID = `auto-generated-group-node-root`;
17
17
  const GRID_ID_AUTOGENERATED = exports.GRID_ID_AUTOGENERATED = Symbol('mui.id_autogenerated');
18
18
  const buildRootGroup = () => ({
@@ -299,6 +299,6 @@ function calculatePinnedRowsHeight(apiRef) {
299
299
  };
300
300
  }
301
301
  function getMinimalContentHeight(apiRef) {
302
- const dimensions = (0, _dimensions.gridDimensionsSelector)(apiRef.current.state);
302
+ const dimensions = (0, _gridDimensionsSelectors.gridDimensionsSelector)(apiRef.current.state);
303
303
  return `var(--DataGrid-overlayHeight, ${2 * dimensions.rowHeight}px)`;
304
304
  }
@@ -131,7 +131,7 @@ const useGridRows = (apiRef, props) => {
131
131
  }, [logger, props.getRowId, props.loading, props.rowCount, throttledRowsChange, apiRef]);
132
132
  const updateRows = React.useCallback(updates => {
133
133
  if (props.signature === _useGridApiEventHandler.GridSignature.DataGrid && updates.length > 1) {
134
- throw new Error(["MUI X: You can't update several rows at once in `apiRef.current.updateRows` on the DataGrid.", 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
134
+ throw new Error(['MUI X: You cannot update several rows at once in `apiRef.current.updateRows` on the DataGrid.', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
135
135
  }
136
136
  const nonPinnedRowsUpdates = [];
137
137
  updates.forEach(update => {
@@ -256,7 +256,7 @@ const useGridRows = (apiRef, props) => {
256
256
  }, [apiRef, logger]);
257
257
  const replaceRows = React.useCallback((firstRowToRender, newRows) => {
258
258
  if (props.signature === _useGridApiEventHandler.GridSignature.DataGrid && newRows.length > 1) {
259
- throw new Error(["MUI X: You can't replace rows using `apiRef.current.unstable_replaceRows` on the DataGrid.", 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
259
+ throw new Error(['MUI X: You cannot replace rows using `apiRef.current.unstable_replaceRows` on the DataGrid.', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
260
260
  }
261
261
  if (newRows.length === 0) {
262
262
  return;
@@ -57,7 +57,6 @@ const useGridVirtualScroller = () => {
57
57
  const gridRootRef = apiRef.current.rootElementRef;
58
58
  const mainRef = apiRef.current.mainElementRef;
59
59
  const scrollerRef = apiRef.current.virtualScrollerRef;
60
- const renderZoneRef = React.useRef(null);
61
60
  const scrollbarVerticalRef = React.useRef(null);
62
61
  const scrollbarHorizontalRef = React.useRef(null);
63
62
  const contentHeight = dimensions.contentSize.height;
@@ -255,6 +254,14 @@ const useGridVirtualScroller = () => {
255
254
  id,
256
255
  model
257
256
  } = renderedRows[i];
257
+ const rowIndexInPage = (currentPage?.range?.firstRowIndex || 0) + firstRowToRender + i;
258
+ let index = rowIndexOffset + rowIndexInPage;
259
+ if (isRowWithFocusedCellNotInRange && cellFocus?.id === id) {
260
+ index = indexOfRowWithFocusedCell;
261
+ isRowWithFocusedCellRendered = true;
262
+ } else if (isRowWithFocusedCellRendered) {
263
+ index -= 1;
264
+ }
258
265
  const isRowNotVisible = isRowWithFocusedCellNotInRange && cellFocus.id === id;
259
266
  const baseRowHeight = !apiRef.current.rowHasAutoHeight(id) ? apiRef.current.unstable_getRowHeight(id) : 'auto';
260
267
  let isSelected;
@@ -265,7 +272,7 @@ const useGridVirtualScroller = () => {
265
272
  }
266
273
  let isFirstVisible = false;
267
274
  if (params.position === undefined) {
268
- isFirstVisible = i === 0;
275
+ isFirstVisible = rowIndexInPage === 0;
269
276
  }
270
277
  let isLastVisible = false;
271
278
  if (isLastSection) {
@@ -287,13 +294,6 @@ const useGridVirtualScroller = () => {
287
294
  const cellParams = apiRef.current.getCellParams(id, cellTabIndex.field);
288
295
  tabbableCell = cellParams.cellMode === 'view' ? cellTabIndex.field : null;
289
296
  }
290
- let index = rowIndexOffset + (currentPage?.range?.firstRowIndex || 0) + firstRowToRender + i;
291
- if (isRowWithFocusedCellNotInRange && cellFocus?.id === id) {
292
- index = indexOfRowWithFocusedCell;
293
- isRowWithFocusedCellRendered = true;
294
- } else if (isRowWithFocusedCellRendered) {
295
- index -= 1;
296
- }
297
297
  rows.push( /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.row, (0, _extends2.default)({
298
298
  row: model,
299
299
  rowId: id,
@@ -394,7 +394,6 @@ const useGridVirtualScroller = () => {
394
394
  role: 'presentation'
395
395
  }),
396
396
  getRenderZoneProps: () => ({
397
- ref: renderZoneRef,
398
397
  role: 'rowgroup'
399
398
  }),
400
399
  getScrollbarVerticalProps: () => ({
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v7.0.0-beta.1
2
+ * @mui/x-data-grid v7.0.0-beta.2
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.validateProps = exports.propValidatorsDataGrid = void 0;
7
- const propValidatorsDataGrid = exports.propValidatorsDataGrid = [props => props.autoPageSize && props.autoHeight && ['MUI X: `<DataGrid autoPageSize={true} autoHeight={true} />` are not valid props.', 'You can not use both the `autoPageSize` and `autoHeight` props at the same time because `autoHeight` scales the height of the Data Grid according to the `pageSize`.', '', 'Please remove one of these two props.'].join('\n') || undefined];
7
+ const propValidatorsDataGrid = exports.propValidatorsDataGrid = [props => props.autoPageSize && props.autoHeight && ['MUI X: `<DataGrid autoPageSize={true} autoHeight={true} />` are not valid props.', 'You cannot use both the `autoPageSize` and `autoHeight` props at the same time because `autoHeight` scales the height of the Data Grid according to the `pageSize`.', '', 'Please remove one of these two props.'].join('\n') || undefined];
8
8
  const warnedOnceMap = new Set();
9
9
  const warnOnce = message => {
10
10
  if (!warnedOnceMap.has(message)) {
@@ -406,8 +406,8 @@ const joySlots = (0, _extends2.default)({}, _icons.default, {
406
406
  baseSelect: Select,
407
407
  baseSelectOption: Option,
408
408
  baseInputLabel: InputLabel,
409
- baseFormControl: _FormControl.default,
410
- baseTooltip: _Tooltip.default,
409
+ baseFormControl: _FormControl.default /* FIXME: typing error */,
410
+ baseTooltip: _Tooltip.default /* FIXME: typing error */,
411
411
  pagination: Pagination,
412
412
  loadingOverlay: LoadingOverlay
413
413
  });
@@ -17,8 +17,8 @@ const daDKGrid = {
17
17
  toolbarDensityStandard: 'Standard',
18
18
  toolbarDensityComfortable: 'Luftig',
19
19
  // Columns selector toolbar button text
20
- toolbarColumns: 'Kolonne',
21
- toolbarColumnsLabel: 'Vælg kolonne',
20
+ toolbarColumns: 'Kolonner',
21
+ toolbarColumnsLabel: 'Vælg kolonner',
22
22
  // Filters toolbar button text
23
23
  toolbarFilters: 'Filtre',
24
24
  toolbarFiltersLabel: 'Vis filtre',
@@ -45,12 +45,12 @@ const daDKGrid = {
45
45
  filterPanelRemoveAll: 'Fjern alle',
46
46
  filterPanelDeleteIconLabel: 'Slet',
47
47
  filterPanelLogicOperator: 'Logisk operator',
48
- filterPanelOperator: 'Operatorer',
48
+ filterPanelOperator: 'Operator',
49
49
  filterPanelOperatorAnd: 'Og',
50
50
  filterPanelOperatorOr: 'Eller',
51
- filterPanelColumns: 'Kolonne',
51
+ filterPanelColumns: 'Kolonner',
52
52
  filterPanelInputLabel: 'Værdi',
53
- filterPanelInputPlaceholder: 'Filter værdi',
53
+ filterPanelInputPlaceholder: 'Filterværdi',
54
54
  // Filter operators text
55
55
  filterOperatorContains: 'indeholder',
56
56
  filterOperatorEquals: 'lig med',
@@ -97,10 +97,10 @@ const daDKGrid = {
97
97
  filterValueFalse: 'negativ',
98
98
  // Column menu text
99
99
  columnMenuLabel: 'Menu',
100
- columnMenuShowColumns: 'Vis Kolonner',
100
+ columnMenuShowColumns: 'Vis kolonner',
101
101
  columnMenuManageColumns: 'Administrer kolonner',
102
- columnMenuFilter: 'Filtre',
103
- columnMenuHideColumn: 'Skjul',
102
+ columnMenuFilter: 'Filtrer',
103
+ columnMenuHideColumn: 'Skjul kolonne',
104
104
  columnMenuUnsort: 'Fjern sortering',
105
105
  columnMenuSortAsc: 'Sorter stigende',
106
106
  columnMenuSortDesc: 'Sorter faldende',
@@ -130,13 +130,13 @@ const daDKGrid = {
130
130
  pinToRight: 'Fastgør til højre',
131
131
  unpin: 'Frigiv',
132
132
  // Tree Data
133
- treeDataGroupingHeaderName: 'Gruppering',
133
+ treeDataGroupingHeaderName: 'Gruppe',
134
134
  treeDataExpand: 'Vis underelementer',
135
135
  treeDataCollapse: 'Skjul underelementer',
136
136
  // Grouping columns
137
- groupingColumnHeaderName: 'Gruppér',
137
+ groupingColumnHeaderName: 'Gruppe',
138
138
  groupColumn: name => `Gruppér efter ${name}`,
139
- unGroupColumn: name => `Fjern gruppéring efter ${name}`,
139
+ unGroupColumn: name => `Fjern gruppering efter ${name}`,
140
140
  // Master/detail
141
141
  detailPanelToggle: 'Udvid/kollaps detaljepanel',
142
142
  expandDetailPanel: 'Udvid',
@@ -144,7 +144,7 @@ const daDKGrid = {
144
144
  // Row reordering text
145
145
  rowReorderingHeaderName: 'Omarrangering af rækker',
146
146
  // Aggregation
147
- aggregationMenuItemHeader: 'Aggregation',
147
+ aggregationMenuItemHeader: 'Aggregering',
148
148
  aggregationFunctionLabelSum: 'sum',
149
149
  aggregationFunctionLabelAvg: 'gns',
150
150
  aggregationFunctionLabelMin: 'min',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid",
3
- "version": "7.0.0-beta.1",
3
+ "version": "7.0.0-beta.2",
4
4
  "description": "The community edition of the data grid component (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",
@@ -33,7 +33,7 @@
33
33
  "repository": {
34
34
  "type": "git",
35
35
  "url": "https://github.com/mui/mui-x.git",
36
- "directory": "packages/grid/x-data-grid"
36
+ "directory": "packages/x-data-grid"
37
37
  },
38
38
  "dependencies": {
39
39
  "@babel/runtime": "^7.23.9",