@mui/x-data-grid 8.0.0-alpha.3 → 8.0.0-alpha.4

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 (98) hide show
  1. package/CHANGELOG.md +274 -0
  2. package/DataGrid/DataGrid.js +5 -5
  3. package/README.md +1 -1
  4. package/components/GridRow.js +1 -1
  5. package/components/cell/GridActionsCell.js +8 -1
  6. package/components/cell/GridCell.js +1 -1
  7. package/components/panel/GridColumnsPanel.js +1 -2
  8. package/components/panel/GridPanelContent.js +7 -3
  9. package/components/panel/GridPanelFooter.d.ts +1 -1
  10. package/components/panel/GridPanelFooter.js +4 -3
  11. package/components/panel/filterPanel/GridFilterForm.js +15 -15
  12. package/constants/dataGridPropsDefaultValues.js +1 -1
  13. package/hooks/core/useGridStateInitialization.js +3 -3
  14. package/hooks/features/columnGrouping/gridColumnGroupsSelector.d.ts +4 -4
  15. package/hooks/features/columnResize/columnResizeSelector.d.ts +1 -1
  16. package/hooks/features/columns/gridColumnsSelector.d.ts +12 -12
  17. package/hooks/features/density/densitySelector.d.ts +1 -1
  18. package/hooks/features/filter/gridFilterSelector.d.ts +17 -17
  19. package/hooks/features/filter/useGridFilter.js +1 -1
  20. package/hooks/features/focus/gridFocusStateSelector.d.ts +8 -8
  21. package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +3 -3
  22. package/hooks/features/overlays/useGridOverlays.js +3 -1
  23. package/hooks/features/pagination/gridPaginationSelector.d.ts +15 -9
  24. package/hooks/features/rowSelection/gridRowSelectionSelector.d.ts +3 -3
  25. package/hooks/features/rowSelection/useGridRowSelection.js +5 -4
  26. package/hooks/features/rowSelection/utils.d.ts +1 -1
  27. package/hooks/features/rows/gridRowSpanningSelectors.d.ts +3 -3
  28. package/hooks/features/rows/gridRowsSelector.d.ts +23 -12
  29. package/hooks/features/rows/useGridRowSpanning.d.ts +1 -1
  30. package/hooks/features/rows/useGridRowSpanning.js +16 -8
  31. package/hooks/features/rows/useGridRows.js +5 -5
  32. package/hooks/features/sorting/gridSortingSelector.d.ts +10 -5
  33. package/hooks/features/sorting/gridSortingSelector.js +11 -0
  34. package/hooks/features/sorting/index.d.ts +2 -1
  35. package/hooks/features/sorting/index.js +1 -1
  36. package/hooks/features/sorting/useGridSorting.js +1 -1
  37. package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +5 -5
  38. package/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
  39. package/hooks/utils/useGridSelector.d.ts +4 -6
  40. package/hooks/utils/useGridSelector.js +6 -44
  41. package/index.js +1 -1
  42. package/internals/index.d.ts +2 -2
  43. package/internals/index.js +2 -2
  44. package/locales/roRO.js +18 -20
  45. package/models/api/gridStateApi.d.ts +1 -1
  46. package/models/controlStateItem.d.ts +2 -2
  47. package/models/props/DataGridProps.d.ts +1 -1
  48. package/modern/DataGrid/DataGrid.js +5 -5
  49. package/modern/components/GridRow.js +1 -1
  50. package/modern/components/cell/GridActionsCell.js +8 -1
  51. package/modern/components/cell/GridCell.js +1 -1
  52. package/modern/components/panel/GridColumnsPanel.js +1 -2
  53. package/modern/components/panel/GridPanelContent.js +7 -3
  54. package/modern/components/panel/GridPanelFooter.js +4 -3
  55. package/modern/components/panel/filterPanel/GridFilterForm.js +15 -15
  56. package/modern/constants/dataGridPropsDefaultValues.js +1 -1
  57. package/modern/hooks/core/useGridStateInitialization.js +3 -3
  58. package/modern/hooks/features/filter/useGridFilter.js +1 -1
  59. package/modern/hooks/features/overlays/useGridOverlays.js +3 -1
  60. package/modern/hooks/features/rowSelection/useGridRowSelection.js +5 -4
  61. package/modern/hooks/features/rows/useGridRowSpanning.js +16 -8
  62. package/modern/hooks/features/rows/useGridRows.js +5 -5
  63. package/modern/hooks/features/sorting/gridSortingSelector.js +11 -0
  64. package/modern/hooks/features/sorting/index.js +1 -1
  65. package/modern/hooks/features/sorting/useGridSorting.js +1 -1
  66. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
  67. package/modern/hooks/utils/useGridSelector.js +6 -44
  68. package/modern/index.js +1 -1
  69. package/modern/internals/index.js +2 -2
  70. package/modern/locales/roRO.js +18 -20
  71. package/modern/utils/createSelector.js +1 -120
  72. package/node/DataGrid/DataGrid.js +5 -5
  73. package/node/components/GridRow.js +1 -1
  74. package/node/components/cell/GridActionsCell.js +8 -1
  75. package/node/components/cell/GridCell.js +1 -1
  76. package/node/components/panel/GridColumnsPanel.js +1 -2
  77. package/node/components/panel/GridPanelContent.js +7 -3
  78. package/node/components/panel/GridPanelFooter.js +5 -4
  79. package/node/components/panel/filterPanel/GridFilterForm.js +15 -15
  80. package/node/constants/dataGridPropsDefaultValues.js +1 -1
  81. package/node/hooks/core/useGridStateInitialization.js +3 -3
  82. package/node/hooks/features/filter/useGridFilter.js +1 -1
  83. package/node/hooks/features/overlays/useGridOverlays.js +3 -1
  84. package/node/hooks/features/rowSelection/useGridRowSelection.js +5 -4
  85. package/node/hooks/features/rows/useGridRowSpanning.js +16 -8
  86. package/node/hooks/features/rows/useGridRows.js +5 -5
  87. package/node/hooks/features/sorting/gridSortingSelector.js +12 -1
  88. package/node/hooks/features/sorting/index.js +24 -16
  89. package/node/hooks/features/sorting/useGridSorting.js +1 -1
  90. package/node/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
  91. package/node/hooks/utils/useGridSelector.js +8 -47
  92. package/node/index.js +1 -1
  93. package/node/internals/index.js +8 -22
  94. package/node/locales/roRO.js +18 -20
  95. package/node/utils/createSelector.js +4 -125
  96. package/package.json +1 -1
  97. package/utils/createSelector.d.ts +4 -16
  98. package/utils/createSelector.js +1 -120
@@ -6,6 +6,7 @@ import { gridVisibleColumnDefinitionsSelector } from "../columns/gridColumnsSele
6
6
  import { useGridVisibleRows } from "../../utils/useGridVisibleRows.js";
7
7
  import { gridRenderContextSelector } from "../virtualization/gridVirtualizationSelectors.js";
8
8
  import { useGridSelector } from "../../utils/useGridSelector.js";
9
+ import { gridRowTreeSelector } from "./gridRowsSelector.js";
9
10
  import { getUnprocessedRange, isRowRangeUpdated, isRowContextInitialized, getCellValue } from "./gridRowSpanningUtils.js";
10
11
  import { GRID_CHECKBOX_SELECTION_FIELD } from "../../../colDef/gridCheckboxSelectionColDef.js";
11
12
  const EMPTY_STATE = {
@@ -35,7 +36,7 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
35
36
  if (skippedFields.has(colDef.field)) {
36
37
  return;
37
38
  }
38
- for (let index = rangeToProcess.firstRowIndex; index <= rangeToProcess.lastRowIndex; index += 1) {
39
+ for (let index = rangeToProcess.firstRowIndex; index < rangeToProcess.lastRowIndex; index += 1) {
39
40
  const row = visibleRows[index];
40
41
  if (hiddenCells[row.id]?.[colDef.field]) {
41
42
  continue;
@@ -129,7 +130,7 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
129
130
  * @requires filterStateInitializer (method) - should be initialized before
130
131
  */
131
132
  export const rowSpanningStateInitializer = (state, props, apiRef) => {
132
- if (props.unstable_rowSpanning) {
133
+ if (props.rowSpanning) {
133
134
  const rowIds = state.rows.dataRowIds || [];
134
135
  const orderedFields = state.columns.orderedFields || [];
135
136
  const dataRowIdToModelLookup = state.rows.dataRowIdToModelLookup;
@@ -142,7 +143,7 @@ export const rowSpanningStateInitializer = (state, props, apiRef) => {
142
143
  }
143
144
  const rangeToProcess = {
144
145
  firstRowIndex: 0,
145
- lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS - 1, Math.max(rowIds.length - 1, 0))
146
+ lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, Math.max(rowIds.length, 0))
146
147
  };
147
148
  const rows = rowIds.map(id => ({
148
149
  id,
@@ -173,10 +174,11 @@ export const useGridRowSpanning = (apiRef, props) => {
173
174
  } = useGridVisibleRows(apiRef, props);
174
175
  const renderContext = useGridSelector(apiRef, gridRenderContextSelector);
175
176
  const colDefs = useGridSelector(apiRef, gridVisibleColumnDefinitionsSelector);
177
+ const tree = useGridSelector(apiRef, gridRowTreeSelector);
176
178
  const processedRange = useLazyRef(() => {
177
179
  return Object.keys(apiRef.current.state.rowSpanning.spannedCells).length > 0 ? {
178
180
  firstRowIndex: 0,
179
- lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS - 1, Math.max(apiRef.current.state.rows.dataRowIds.length - 1, 0))
181
+ lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, Math.max(apiRef.current.state.rows.dataRowIds.length, 0))
180
182
  } : EMPTY_RANGE;
181
183
  });
182
184
  const lastRange = React.useRef(EMPTY_RANGE);
@@ -188,7 +190,7 @@ export const useGridRowSpanning = (apiRef, props) => {
188
190
  // - The `paginationModel` is updated
189
191
  // - The rows are updated
190
192
  (resetState = true) => {
191
- if (!props.unstable_rowSpanning) {
193
+ if (!props.rowSpanning) {
192
194
  if (apiRef.current.state.rowSpanning !== EMPTY_STATE) {
193
195
  apiRef.current.setState(state => _extends({}, state, {
194
196
  rowSpanning: EMPTY_STATE
@@ -204,7 +206,7 @@ export const useGridRowSpanning = (apiRef, props) => {
204
206
  }
205
207
  const rangeToProcess = getUnprocessedRange({
206
208
  firstRowIndex: renderContext.firstRowIndex,
207
- lastRowIndex: Math.min(renderContext.lastRowIndex - 1, range.lastRowIndex)
209
+ lastRowIndex: Math.min(renderContext.lastRowIndex, range.lastRowIndex + 1)
208
210
  }, processedRange.current);
209
211
  if (rangeToProcess === null) {
210
212
  return;
@@ -233,15 +235,21 @@ export const useGridRowSpanning = (apiRef, props) => {
233
235
  }
234
236
  });
235
237
  });
236
- }, [apiRef, props.unstable_rowSpanning, range, renderContext, visibleRows, colDefs, processedRange]);
238
+ }, [apiRef, props.rowSpanning, range, renderContext, visibleRows, colDefs, processedRange]);
237
239
  const prevRenderContext = React.useRef(renderContext);
238
240
  const isFirstRender = React.useRef(true);
239
241
  const shouldResetState = React.useRef(false);
242
+ const previousTree = React.useRef(tree);
240
243
  React.useEffect(() => {
241
244
  const firstRender = isFirstRender.current;
242
245
  if (isFirstRender.current) {
243
246
  isFirstRender.current = false;
244
247
  }
248
+ if (tree !== previousTree.current) {
249
+ previousTree.current = tree;
250
+ updateRowSpanningState(true);
251
+ return;
252
+ }
245
253
  if (range && lastRange.current && isRowRangeUpdated(range, lastRange.current)) {
246
254
  lastRange.current = range;
247
255
  shouldResetState.current = true;
@@ -255,5 +263,5 @@ export const useGridRowSpanning = (apiRef, props) => {
255
263
  return;
256
264
  }
257
265
  updateRowSpanningState();
258
- }, [updateRowSpanningState, renderContext, range, lastRange]);
266
+ }, [updateRowSpanningState, renderContext, range, lastRange, tree]);
259
267
  };
@@ -239,7 +239,7 @@ export const useGridRows = (apiRef, props) => {
239
239
  throw new Error(`MUI X: The row reordering do not support reordering of footer or grouping rows.`);
240
240
  }
241
241
  apiRef.current.setState(state => {
242
- const group = gridRowTreeSelector(state, apiRef.current.instanceId)[GRID_ROOT_GROUP_ID];
242
+ const group = gridRowTreeSelector(state, undefined, apiRef.current.instanceId)[GRID_ROOT_GROUP_ID];
243
243
  const allRows = group.children;
244
244
  const oldIndex = allRows.findIndex(row => row === rowId);
245
245
  if (oldIndex === -1 || oldIndex === targetIndex) {
@@ -392,10 +392,10 @@ export const useGridRows = (apiRef, props) => {
392
392
  const applyHydrateRowsProcessor = React.useCallback(() => {
393
393
  apiRef.current.setState(state => {
394
394
  const response = apiRef.current.unstable_applyPipeProcessors('hydrateRows', {
395
- tree: gridRowTreeSelector(state, apiRef.current.instanceId),
396
- treeDepths: gridRowTreeDepthsSelector(state, apiRef.current.instanceId),
397
- dataRowIds: gridDataRowIdsSelector(state, apiRef.current.instanceId),
398
- dataRowIdToModelLookup: gridRowsLookupSelector(state, apiRef.current.instanceId)
395
+ tree: gridRowTreeSelector(state, undefined, apiRef.current.instanceId),
396
+ treeDepths: gridRowTreeDepthsSelector(state, undefined, apiRef.current.instanceId),
397
+ dataRowIds: gridDataRowIdsSelector(state, undefined, apiRef.current.instanceId),
398
+ dataRowIdToModelLookup: gridRowsLookupSelector(state, undefined, apiRef.current.instanceId)
399
399
  });
400
400
  return _extends({}, state, {
401
401
  rows: _extends({}, state.rows, response, {
@@ -55,4 +55,15 @@ export const gridSortColumnLookupSelector = createSelectorMemoized(gridSortModel
55
55
  return res;
56
56
  }, {});
57
57
  return result;
58
+ });
59
+
60
+ /**
61
+ * @category Sorting
62
+ * @ignore - do not document.
63
+ */
64
+ export const gridSortedRowIndexLookupSelector = createSelectorMemoized(gridSortedRowIdsSelector, sortedIds => {
65
+ return sortedIds.reduce((acc, id, index) => {
66
+ acc[id] = index;
67
+ return acc;
68
+ }, Object.create(null));
58
69
  });
@@ -1,2 +1,2 @@
1
- export * from "./gridSortingSelector.js";
1
+ export { gridSortedRowIdsSelector, gridSortedRowEntriesSelector, gridSortModelSelector, gridSortColumnLookupSelector } from "./gridSortingSelector.js";
2
2
  export { gridDateComparator, gridNumberComparator, gridStringOrNumberComparator } from "./gridSortingUtils.js";
@@ -88,7 +88,7 @@ export const useGridSorting = (apiRef, props) => {
88
88
  })
89
89
  });
90
90
  }
91
- const sortModel = gridSortModelSelector(state, apiRef.current.instanceId);
91
+ const sortModel = gridSortModelSelector(state, undefined, apiRef.current.instanceId);
92
92
  const sortRowList = buildAggregatedSortingApplier(sortModel, apiRef);
93
93
  const sortedRows = apiRef.current.applyStrategyProcessor('sorting', {
94
94
  sortRowList
@@ -92,10 +92,7 @@ export const useGridVirtualScroller = () => {
92
92
  return undefined;
93
93
  }
94
94
  const initialRect = node.getBoundingClientRect();
95
- let lastSize = {
96
- width: initialRect.width,
97
- height: initialRect.height
98
- };
95
+ let lastSize = roundDimensions(initialRect);
99
96
  apiRef.current.publishEvent('resize', lastSize);
100
97
  if (typeof ResizeObserver === 'undefined') {
101
98
  return undefined;
@@ -105,10 +102,7 @@ export const useGridVirtualScroller = () => {
105
102
  if (!entry) {
106
103
  return;
107
104
  }
108
- const newSize = {
109
- width: entry.contentRect.width,
110
- height: entry.contentRect.height
111
- };
105
+ const newSize = roundDimensions(entry.contentRect);
112
106
  if (newSize.width === lastSize.width && newSize.height === lastSize.height) {
113
107
  return;
114
108
  }
@@ -784,4 +778,13 @@ function bufferForDirection(isRtl, direction, rowBufferPx, columnBufferPx, verti
784
778
  // eslint unable to figure out enum exhaustiveness
785
779
  throw new Error('unreachable');
786
780
  }
781
+ }
782
+
783
+ // Round to avoid issues with subpixel rendering
784
+ // https://github.com/mui/mui-x/issues/15721
785
+ function roundDimensions(dimensions) {
786
+ return {
787
+ width: Math.round(dimensions.width * 10) / 10,
788
+ height: Math.round(dimensions.height * 10) / 10
789
+ };
787
790
  }
@@ -6,20 +6,11 @@ import { useOnMount } from "./useOnMount.js";
6
6
  function isOutputSelector(selector) {
7
7
  return selector.acceptsApiRef;
8
8
  }
9
- // TODO v8: Remove this function
10
- function applySelector(apiRef, selector) {
11
- if (isOutputSelector(selector)) {
12
- return selector(apiRef);
13
- }
14
- return selector(apiRef.current.state);
15
- }
16
-
17
- // TODO v8: Rename this function to `applySelector`
18
- function applySelectorV8(apiRef, selector, args, instanceId) {
9
+ function applySelector(apiRef, selector, args, instanceId) {
19
10
  if (isOutputSelector(selector)) {
20
11
  return selector(apiRef, args);
21
12
  }
22
- return selector(apiRef.current.state, instanceId);
13
+ return selector(apiRef.current.state, args, instanceId);
23
14
  }
24
15
  const defaultCompare = Object.is;
25
16
  export const objectShallowCompare = fastObjectShallowCompare;
@@ -44,36 +35,7 @@ const createRefs = () => ({
44
35
  selector: null,
45
36
  args: null
46
37
  });
47
-
48
- // TODO v8: Remove this function
49
- export const useGridSelector = (apiRef, selector, equals = defaultCompare) => {
50
- if (process.env.NODE_ENV !== 'production') {
51
- if (!apiRef.current.state) {
52
- warnOnce(['MUI X: `useGridSelector` has been called before the initialization of the state.', 'This hook can only be used inside the context of the grid.']);
53
- }
54
- }
55
- const refs = useLazyRef(createRefs);
56
- const didInit = refs.current.selector !== null;
57
- const [state, setState] = React.useState(
58
- // We don't use an initialization function to avoid allocations
59
- didInit ? null : applySelector(apiRef, selector));
60
- refs.current.state = state;
61
- refs.current.equals = equals;
62
- refs.current.selector = selector;
63
- useOnMount(() => {
64
- return apiRef.current.store.subscribe(() => {
65
- const newState = applySelector(apiRef, refs.current.selector);
66
- if (!refs.current.equals(refs.current.state, newState)) {
67
- refs.current.state = newState;
68
- setState(newState);
69
- }
70
- });
71
- });
72
- return state;
73
- };
74
-
75
- // TODO v8: Rename this function to `useGridSelector`
76
- export const useGridSelectorV8 = (apiRef, selector, args = undefined, equals = defaultCompare) => {
38
+ export const useGridSelector = (apiRef, selector, args = undefined, equals = defaultCompare) => {
77
39
  if (process.env.NODE_ENV !== 'production') {
78
40
  if (!apiRef.current.state) {
79
41
  warnOnce(['MUI X: `useGridSelector` has been called before the initialization of the state.', 'This hook can only be used inside the context of the grid.']);
@@ -83,14 +45,14 @@ export const useGridSelectorV8 = (apiRef, selector, args = undefined, equals = d
83
45
  const didInit = refs.current.selector !== null;
84
46
  const [state, setState] = React.useState(
85
47
  // We don't use an initialization function to avoid allocations
86
- didInit ? null : applySelectorV8(apiRef, selector, args, apiRef.current.instanceId));
48
+ didInit ? null : applySelector(apiRef, selector, args, apiRef.current.instanceId));
87
49
  refs.current.state = state;
88
50
  refs.current.equals = equals;
89
51
  refs.current.selector = selector;
90
52
  const prevArgs = refs.current.args;
91
53
  refs.current.args = args;
92
54
  if (didInit && !argsEqual(prevArgs, args)) {
93
- const newState = applySelectorV8(apiRef, refs.current.selector, refs.current.args, apiRef.current.instanceId);
55
+ const newState = applySelector(apiRef, refs.current.selector, refs.current.args, apiRef.current.instanceId);
94
56
  if (!refs.current.equals(refs.current.state, newState)) {
95
57
  refs.current.state = newState;
96
58
  setState(newState);
@@ -98,7 +60,7 @@ export const useGridSelectorV8 = (apiRef, selector, args = undefined, equals = d
98
60
  }
99
61
  useOnMount(() => {
100
62
  return apiRef.current.store.subscribe(() => {
101
- const newState = applySelectorV8(apiRef, refs.current.selector, refs.current.args, apiRef.current.instanceId);
63
+ const newState = applySelector(apiRef, refs.current.selector, refs.current.args, apiRef.current.instanceId);
102
64
  if (!refs.current.equals(refs.current.state, newState)) {
103
65
  refs.current.state = newState;
104
66
  setState(newState);
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v8.0.0-alpha.3
2
+ * @mui/x-data-grid v8.0.0-alpha.4
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -47,6 +47,7 @@ export { calculatePinnedRowsHeight } from "../hooks/features/rows/gridRowsUtils.
47
47
  export { useGridRowSelection, rowSelectionStateInitializer } from "../hooks/features/rowSelection/useGridRowSelection.js";
48
48
  export { useGridRowSelectionPreProcessors } from "../hooks/features/rowSelection/useGridRowSelectionPreProcessors.js";
49
49
  export { useGridSorting, sortingStateInitializer } from "../hooks/features/sorting/useGridSorting.js";
50
+ export { gridSortedRowIndexLookupSelector } from "../hooks/features/sorting/gridSortingSelector.js";
50
51
  export { useGridScroll } from "../hooks/features/scroll/useGridScroll.js";
51
52
  export { useGridEvents } from "../hooks/features/events/useGridEvents.js";
52
53
  export { dimensionsStateInitializer, useGridDimensions } from "../hooks/features/dimensions/useGridDimensions.js";
@@ -61,8 +62,7 @@ export { useGridVisibleRows, getVisibleRows } from "../hooks/utils/useGridVisibl
61
62
  export { useGridInitializeState } from "../hooks/utils/useGridInitializeState.js";
62
63
  export { getColumnsToExport, defaultGetRowsToExport } from "../hooks/features/export/utils.js";
63
64
  export * from "../utils/createControllablePromise.js";
64
- export { createSelector, createSelectorV8, createSelectorMemoized, createSelectorMemoizedV8 } from "../utils/createSelector.js";
65
- export { useGridSelectorV8 } from "../hooks/utils/useGridSelector.js";
65
+ export { createSelector, createSelectorMemoized } from "../utils/createSelector.js";
66
66
  export { gridRowGroupsToFetchSelector } from "../hooks/features/rows/gridRowsSelector.js";
67
67
  export { findParentElementFromClassName, getActiveElement, isEventTargetInPortal } from "../utils/domUtils.js";
68
68
  export { isNavigationKey, isPasteShortcut, isCopyShortcut } from "../utils/keyboardUtils.js";
@@ -24,16 +24,15 @@ const roROGrid = {
24
24
  toolbarQuickFilterLabel: 'Căutare',
25
25
  toolbarQuickFilterDeleteIconLabel: 'Ștergere',
26
26
  // Prompt toolbar field
27
- // toolbarPromptControlPlaceholder: 'Type a prompt…',
28
- // toolbarPromptControlWithRecordingPlaceholder: 'Type or record a prompt…',
29
- // toolbarPromptControlRecordingPlaceholder: 'Listening for prompt…',
30
- // toolbarPromptControlLabel: 'Prompt input',
31
- // toolbarPromptControlRecordButtonDefaultLabel: 'Record',
32
- // toolbarPromptControlRecordButtonActiveLabel: 'Stop recording',
33
- // toolbarPromptControlSendActionLabel: 'Send',
34
- // toolbarPromptControlSendActionAriaLabel: 'Send prompt',
35
- // toolbarPromptControlErrorMessage: 'An error occurred while processing the request. Please try again with a different prompt.',
36
-
27
+ toolbarPromptControlPlaceholder: 'Scrie un prompt…',
28
+ toolbarPromptControlWithRecordingPlaceholder: 'Scrie sau înregistrează un prompt…',
29
+ toolbarPromptControlRecordingPlaceholder: 'Ascultare prompt…',
30
+ toolbarPromptControlLabel: 'Introducere prompt',
31
+ toolbarPromptControlRecordButtonDefaultLabel: 'Înregistrează',
32
+ toolbarPromptControlRecordButtonActiveLabel: 'Oprește înregistrare',
33
+ toolbarPromptControlSendActionLabel: 'Trimite',
34
+ toolbarPromptControlSendActionAriaLabel: 'Trimite prompt',
35
+ toolbarPromptControlErrorMessage: 'A apărut o eroare la procesare. Încercați din nou cu un alt prompt.',
37
36
  // Export selector toolbar button text
38
37
  toolbarExport: 'Export',
39
38
  toolbarExportLabel: 'Export',
@@ -41,12 +40,11 @@ const roROGrid = {
41
40
  toolbarExportPrint: 'Printare',
42
41
  toolbarExportExcel: 'Download în format Excel',
43
42
  // Columns management text
44
- // columnsManagementSearchTitle: 'Search',
45
- // columnsManagementNoColumns: 'No columns',
46
- // columnsManagementShowHideAllText: 'Show/Hide All',
47
- // columnsManagementReset: 'Reset',
48
- // columnsManagementDeleteIconLabel: 'Clear',
49
-
43
+ columnsManagementSearchTitle: 'Caută',
44
+ columnsManagementNoColumns: 'Nicio coloană',
45
+ columnsManagementShowHideAllText: 'Arată/Ascunde tot',
46
+ columnsManagementReset: 'Resetează',
47
+ columnsManagementDeleteIconLabel: 'Șterge',
50
48
  // Filter panel text
51
49
  filterPanelAddFilter: 'Adăugare filtru',
52
50
  filterPanelRemoveAll: 'Șterge tot',
@@ -60,9 +58,9 @@ const roROGrid = {
60
58
  filterPanelInputPlaceholder: 'Filtrare valoare',
61
59
  // Filter operators text
62
60
  filterOperatorContains: 'conține',
63
- // filterOperatorDoesNotContain: 'does not contain',
61
+ filterOperatorDoesNotContain: 'nu conține',
64
62
  filterOperatorEquals: 'este egal cu',
65
- // filterOperatorDoesNotEqual: 'does not equal',
63
+ filterOperatorDoesNotEqual: 'nu este egal cu',
66
64
  filterOperatorStartsWith: 'începe cu',
67
65
  filterOperatorEndsWith: 'se termină cu',
68
66
  filterOperatorIs: 'este',
@@ -82,9 +80,9 @@ const roROGrid = {
82
80
  'filterOperator<=': '<=',
83
81
  // Header filter operators text
84
82
  headerFilterOperatorContains: 'Conține',
85
- // headerFilterOperatorDoesNotContain: 'Does not contain',
83
+ headerFilterOperatorDoesNotContain: 'Nu conține',
86
84
  headerFilterOperatorEquals: 'Egal cu',
87
- // headerFilterOperatorDoesNotEqual: 'Does not equal',
85
+ headerFilterOperatorDoesNotEqual: 'Nu este egal cu',
88
86
  headerFilterOperatorStartsWith: 'Începe cu',
89
87
  headerFilterOperatorEndsWith: 'Se termină cu',
90
88
  headerFilterOperatorIs: 'Este',
@@ -8,19 +8,6 @@ const reselectCreateSelector = createSelectorCreator({
8
8
  equalityCheck: Object.is
9
9
  }
10
10
  });
11
-
12
- // TODO v8: Remove this type
13
-
14
- // TODO v8: Rename this type to `OutputSelector`
15
-
16
- // TODO v8: Remove this type
17
-
18
- // TODO v8: Rename this type to `SelectorArgs`
19
-
20
- // TODO v8: Remove this type
21
-
22
- // TODO v8: Rename this type to `CreateSelectorFunction`
23
-
24
11
  const cache = new WeakMap();
25
12
  function checkIsAPIRef(value) {
26
13
  return 'current' in value && 'instanceId' in value.current;
@@ -28,83 +15,12 @@ function checkIsAPIRef(value) {
28
15
  const DEFAULT_INSTANCE_ID = {
29
16
  id: 'default'
30
17
  };
31
-
32
- // TODO v8: Remove this function
33
18
  export const createSelector = (a, b, c, d, e, f, ...other) => {
34
19
  if (other.length > 0) {
35
20
  throw new Error('Unsupported number of selectors');
36
21
  }
37
22
  let selector;
38
23
 
39
- // eslint-disable-next-line id-denylist
40
- if (a && b && c && d && e && f) {
41
- selector = (stateOrApiRef, instanceIdParam) => {
42
- const isAPIRef = checkIsAPIRef(stateOrApiRef);
43
- const instanceId = instanceIdParam ?? (isAPIRef ? stateOrApiRef.current.instanceId : DEFAULT_INSTANCE_ID);
44
- const state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
45
- const va = a(state, instanceId);
46
- const vb = b(state, instanceId);
47
- const vc = c(state, instanceId);
48
- const vd = d(state, instanceId);
49
- const ve = e(state, instanceId);
50
- return f(va, vb, vc, vd, ve);
51
- };
52
- // eslint-disable-next-line id-denylist
53
- } else if (a && b && c && d && e) {
54
- selector = (stateOrApiRef, instanceIdParam) => {
55
- const isAPIRef = checkIsAPIRef(stateOrApiRef);
56
- const instanceId = instanceIdParam ?? (isAPIRef ? stateOrApiRef.current.instanceId : DEFAULT_INSTANCE_ID);
57
- const state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
58
- const va = a(state, instanceId);
59
- const vb = b(state, instanceId);
60
- const vc = c(state, instanceId);
61
- const vd = d(state, instanceId);
62
- return e(va, vb, vc, vd);
63
- };
64
- } else if (a && b && c && d) {
65
- selector = (stateOrApiRef, instanceIdParam) => {
66
- const isAPIRef = checkIsAPIRef(stateOrApiRef);
67
- const instanceId = instanceIdParam ?? (isAPIRef ? stateOrApiRef.current.instanceId : DEFAULT_INSTANCE_ID);
68
- const state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
69
- const va = a(state, instanceId);
70
- const vb = b(state, instanceId);
71
- const vc = c(state, instanceId);
72
- return d(va, vb, vc);
73
- };
74
- } else if (a && b && c) {
75
- selector = (stateOrApiRef, instanceIdParam) => {
76
- const isAPIRef = checkIsAPIRef(stateOrApiRef);
77
- const instanceId = instanceIdParam ?? (isAPIRef ? stateOrApiRef.current.instanceId : DEFAULT_INSTANCE_ID);
78
- const state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
79
- const va = a(state, instanceId);
80
- const vb = b(state, instanceId);
81
- return c(va, vb);
82
- };
83
- } else if (a && b) {
84
- selector = (stateOrApiRef, instanceIdParam) => {
85
- const isAPIRef = checkIsAPIRef(stateOrApiRef);
86
- const instanceId = instanceIdParam ?? (isAPIRef ? stateOrApiRef.current.instanceId : DEFAULT_INSTANCE_ID);
87
- const state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
88
- const va = a(state, instanceId);
89
- return b(va);
90
- };
91
- } else {
92
- throw new Error('Missing arguments');
93
- }
94
-
95
- // We use this property to detect if the selector was created with createSelector
96
- // or it's only a simple function the receives the state and returns part of it.
97
- selector.acceptsApiRef = true;
98
- return selector;
99
- };
100
-
101
- // TODO v8: Rename this function to `createSelector`
102
- export const createSelectorV8 = (a, b, c, d, e, f, ...other) => {
103
- if (other.length > 0) {
104
- throw new Error('Unsupported number of selectors');
105
- }
106
- let selector;
107
-
108
24
  // eslint-disable-next-line id-denylist
109
25
  if (a && b && c && d && e && f) {
110
26
  selector = (stateOrApiRef, args, instanceIdParam) => {
@@ -166,49 +82,14 @@ export const createSelectorV8 = (a, b, c, d, e, f, ...other) => {
166
82
  selector.acceptsApiRef = true;
167
83
  return selector;
168
84
  };
169
-
170
- // TODO v8: Remove this function
171
85
  export const createSelectorMemoized = (...args) => {
172
- const selector = (stateOrApiRef, instanceId) => {
173
- const isAPIRef = checkIsAPIRef(stateOrApiRef);
174
- const cacheKey = isAPIRef ? stateOrApiRef.current.instanceId : instanceId ?? DEFAULT_INSTANCE_ID;
175
- const state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
176
- if (process.env.NODE_ENV !== 'production') {
177
- if (cacheKey.id === 'default') {
178
- warnOnce(['MUI X: A selector was called without passing the instance ID, which may impact the performance of the grid.', 'To fix, call it with `apiRef`, for example `mySelector(apiRef)`, or pass the instance ID explicitly, for example `mySelector(state, apiRef.current.instanceId)`.']);
179
- }
180
- }
181
- const cacheArgsInit = cache.get(cacheKey);
182
- const cacheArgs = cacheArgsInit ?? new Map();
183
- const cacheFn = cacheArgs?.get(args);
184
- if (cacheArgs && cacheFn) {
185
- // We pass the cache key because the called selector might have as
186
- // dependency another selector created with this `createSelector`.
187
- return cacheFn(state, cacheKey);
188
- }
189
- const fn = reselectCreateSelector(...args);
190
- if (!cacheArgsInit) {
191
- cache.set(cacheKey, cacheArgs);
192
- }
193
- cacheArgs.set(args, fn);
194
- return fn(state, cacheKey);
195
- };
196
-
197
- // We use this property to detect if the selector was created with createSelector
198
- // or it's only a simple function the receives the state and returns part of it.
199
- selector.acceptsApiRef = true;
200
- return selector;
201
- };
202
-
203
- // TODO v8: Rename this function to `createSelectorMemoized`
204
- export const createSelectorMemoizedV8 = (...args) => {
205
86
  const selector = (stateOrApiRef, selectorArgs, instanceId) => {
206
87
  const isAPIRef = checkIsAPIRef(stateOrApiRef);
207
88
  const cacheKey = isAPIRef ? stateOrApiRef.current.instanceId : instanceId ?? DEFAULT_INSTANCE_ID;
208
89
  const state = isAPIRef ? stateOrApiRef.current.state : stateOrApiRef;
209
90
  if (process.env.NODE_ENV !== 'production') {
210
91
  if (cacheKey.id === 'default') {
211
- warnOnce(['MUI X: A selector was called without passing the instance ID, which may impact the performance of the grid.', 'To fix, call it with `apiRef`, for example `mySelector(apiRef)`, or pass the instance ID explicitly, for example `mySelector(state, apiRef.current.instanceId)`.']);
92
+ warnOnce(['MUI X: A selector was called without passing the instance ID, which may impact the performance of the grid.', 'To fix, call it with `apiRef`, for example `mySelector(apiRef)`, or pass the instance ID explicitly, for example `mySelector(state, args, apiRef.current.instanceId)`.']);
212
93
  }
213
94
  }
214
95
  const cacheArgsInit = cache.get(cacheKey);
@@ -708,6 +708,11 @@ DataGridRaw.propTypes = {
708
708
  * @default "margin"
709
709
  */
710
710
  rowSpacingType: _propTypes.default.oneOf(['border', 'margin']),
711
+ /**
712
+ * If `true`, the Data Grid will auto span the cells over the rows having the same value.
713
+ * @default false
714
+ */
715
+ rowSpanning: _propTypes.default.bool,
711
716
  /**
712
717
  * Override the height/width of the Data Grid inner scrollbar.
713
718
  */
@@ -753,11 +758,6 @@ DataGridRaw.propTypes = {
753
758
  * The system prop that allows defining system overrides as well as additional CSS styles.
754
759
  */
755
760
  sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
756
- /**
757
- * If `true`, the Data Grid will auto span the cells over the rows having the same value.
758
- * @default false
759
- */
760
- unstable_rowSpanning: _propTypes.default.bool,
761
761
  /**
762
762
  * If `true`, the Data Grid enables column virtualization when `getRowHeight` is set to `() => 'auto'`.
763
763
  * By default, column virtualization is disabled when dynamic row height is enabled to measure the row height correctly.
@@ -152,7 +152,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
152
152
  disableColumnReorder
153
153
  } = rootProps;
154
154
  const rowReordering = rootProps.rowReordering;
155
- const heightEntry = (0, _useGridSelector.useGridSelector)(apiRef, () => (0, _extends2.default)({}, apiRef.current.getRowHeightEntry(rowId)), _useGridSelector.objectShallowCompare);
155
+ const heightEntry = (0, _useGridSelector.useGridSelector)(apiRef, () => (0, _extends2.default)({}, apiRef.current.getRowHeightEntry(rowId)), undefined, _useGridSelector.objectShallowCompare);
156
156
  const style = React.useMemo(() => {
157
157
  if (isNotVisible) {
158
158
  return {
@@ -98,6 +98,13 @@ function GridActionsCell(props) {
98
98
  const hideMenu = () => {
99
99
  setOpen(false);
100
100
  };
101
+ const toggleMenu = () => {
102
+ if (open) {
103
+ hideMenu();
104
+ } else {
105
+ showMenu();
106
+ }
107
+ };
101
108
  const handleTouchRippleRef = index => instance => {
102
109
  touchRippleRefs.current[index] = instance;
103
110
  };
@@ -168,7 +175,7 @@ function GridActionsCell(props) {
168
175
  "aria-controls": open ? menuId : undefined,
169
176
  role: "menuitem",
170
177
  size: "small",
171
- onClick: showMenu,
178
+ onClick: toggleMenu,
172
179
  touchRippleRef: handleTouchRippleRef(buttonId),
173
180
  tabIndex: focusedButtonIndex === iconButtons.length ? tabIndex : -1
174
181
  }, rootProps.slotProps?.baseIconButton, {
@@ -128,7 +128,7 @@ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
128
128
  const result = apiRef.current.getCellParams(rowId, field);
129
129
  result.api = apiRef.current;
130
130
  return result;
131
- }, _useGridSelector.objectShallowCompare);
131
+ }, undefined, _useGridSelector.objectShallowCompare);
132
132
  const isSelected = (0, _useGridSelector.useGridSelector)(apiRef, () => apiRef.current.unstable_applyPipeProcessors('isCellSelected', false, {
133
133
  id: rowId,
134
134
  field
@@ -10,13 +10,12 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
10
10
  var React = _interopRequireWildcard(require("react"));
11
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
12
  var _GridPanelWrapper = require("./GridPanelWrapper");
13
- var _columnsManagement = require("../columnsManagement");
14
13
  var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
15
14
  var _jsxRuntime = require("react/jsx-runtime");
16
15
  function GridColumnsPanel(props) {
17
16
  const rootProps = (0, _useGridRootProps.useGridRootProps)();
18
17
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridPanelWrapper.GridPanelWrapper, (0, _extends2.default)({}, props, {
19
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_columnsManagement.GridColumnsManagement, (0, _extends2.default)({}, rootProps.slotProps?.columnsManagement))
18
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.columnsManagement, (0, _extends2.default)({}, rootProps.slotProps?.columnsManagement))
20
19
  }));
21
20
  }
22
21
  process.env.NODE_ENV !== "production" ? GridColumnsPanel.propTypes = {
@@ -30,13 +30,17 @@ const GridPanelContentRoot = (0, _system.styled)('div', {
30
30
  name: 'MuiDataGrid',
31
31
  slot: 'PanelContent',
32
32
  overridesResolver: (props, styles) => styles.panelContent
33
- })({
33
+ })(({
34
+ theme
35
+ }) => ({
34
36
  display: 'flex',
35
37
  flexDirection: 'column',
36
38
  overflow: 'auto',
37
39
  flex: '1 1',
38
- maxHeight: 400
39
- });
40
+ maxHeight: 400,
41
+ padding: theme.spacing(2.5, 1.5, 2, 1),
42
+ gap: theme.spacing(2.5)
43
+ }));
40
44
  function GridPanelContent(props) {
41
45
  const {
42
46
  className