@mui/x-data-grid 6.0.4 → 6.1.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 (104) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/components/GridAutoSizer.js +3 -0
  3. package/components/GridPagination.d.ts +6 -6
  4. package/components/GridRow.js +3 -1
  5. package/components/cell/GridActionsCellItem.d.ts +2 -2
  6. package/components/cell/GridEditDateCell.js +37 -16
  7. package/components/columnHeaders/ColumnHeaderMenuIcon.js +20 -16
  8. package/components/panel/GridColumnsPanel.d.ts +8 -0
  9. package/components/panel/GridColumnsPanel.js +18 -6
  10. package/components/toolbar/GridToolbarColumnsButton.d.ts +1 -1
  11. package/components/toolbar/GridToolbarDensitySelector.d.ts +1 -1
  12. package/components/toolbar/GridToolbarExportContainer.d.ts +1 -1
  13. package/hooks/core/useGridApiInitialization.js +3 -3
  14. package/hooks/features/columns/gridColumnsSelector.d.ts +3 -3
  15. package/hooks/features/editing/useGridCellEditing.js +5 -1
  16. package/hooks/features/editing/useGridEditing.js +1 -3
  17. package/hooks/features/editing/useGridRowEditing.js +5 -1
  18. package/hooks/features/filter/gridFilterState.js +6 -1
  19. package/hooks/features/filter/useGridFilter.js +5 -0
  20. package/index.js +9 -1
  21. package/legacy/components/GridAutoSizer.js +3 -0
  22. package/legacy/components/GridRow.js +4 -1
  23. package/legacy/components/cell/GridEditBooleanCell.js +19 -21
  24. package/legacy/components/cell/GridEditDateCell.js +69 -39
  25. package/legacy/components/cell/GridEditInputCell.js +25 -27
  26. package/legacy/components/cell/GridEditSingleSelectCell.js +26 -28
  27. package/legacy/components/columnHeaders/ColumnHeaderMenuIcon.js +20 -16
  28. package/legacy/components/panel/GridColumnsPanel.js +19 -6
  29. package/legacy/hooks/core/useGridApiInitialization.js +3 -3
  30. package/legacy/hooks/features/columns/gridColumnsUtils.js +2 -2
  31. package/legacy/hooks/features/editing/useGridCellEditing.js +120 -120
  32. package/legacy/hooks/features/editing/useGridEditing.js +17 -21
  33. package/legacy/hooks/features/editing/useGridRowEditing.js +5 -1
  34. package/legacy/hooks/features/export/useGridPrintExport.js +45 -47
  35. package/legacy/hooks/features/filter/gridFilterState.js +6 -1
  36. package/legacy/hooks/features/filter/useGridFilter.js +5 -0
  37. package/legacy/hooks/features/rows/gridRowsUtils.js +2 -2
  38. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +6 -6
  39. package/legacy/index.js +9 -1
  40. package/legacy/locales/coreLocales.js +0 -1
  41. package/legacy/locales/huHU.js +15 -20
  42. package/legacy/locales/jaJP.js +1 -1
  43. package/legacy/locales/nlNL.js +3 -3
  44. package/legacy/locales/ptBR.js +7 -9
  45. package/legacy/locales/ruRU.js +1 -1
  46. package/legacy/models/gridColumnGrouping.js +4 -0
  47. package/legacy/models/params/gridRowParams.js +8 -0
  48. package/legacy/utils/createSelector.js +14 -22
  49. package/locales/coreLocales.js +0 -1
  50. package/locales/huHU.js +15 -20
  51. package/locales/jaJP.js +1 -1
  52. package/locales/nlNL.js +3 -3
  53. package/locales/ptBR.js +7 -9
  54. package/locales/ruRU.js +1 -1
  55. package/models/api/gridCoreApi.d.ts +3 -1
  56. package/models/api/gridEditingApi.d.ts +4 -0
  57. package/models/gridColumnGrouping.js +4 -0
  58. package/models/params/gridRowParams.js +8 -0
  59. package/modern/components/GridAutoSizer.js +3 -0
  60. package/modern/components/GridRow.js +3 -1
  61. package/modern/components/cell/GridEditDateCell.js +37 -16
  62. package/modern/components/columnHeaders/ColumnHeaderMenuIcon.js +19 -15
  63. package/modern/components/panel/GridColumnsPanel.js +18 -6
  64. package/modern/hooks/core/useGridApiInitialization.js +3 -3
  65. package/modern/hooks/features/editing/useGridCellEditing.js +5 -1
  66. package/modern/hooks/features/editing/useGridEditing.js +1 -3
  67. package/modern/hooks/features/editing/useGridRowEditing.js +5 -1
  68. package/modern/hooks/features/filter/gridFilterState.js +6 -1
  69. package/modern/hooks/features/filter/useGridFilter.js +5 -0
  70. package/modern/index.js +9 -1
  71. package/modern/locales/coreLocales.js +0 -1
  72. package/modern/locales/huHU.js +15 -20
  73. package/modern/locales/jaJP.js +1 -1
  74. package/modern/locales/nlNL.js +3 -3
  75. package/modern/locales/ptBR.js +7 -9
  76. package/modern/locales/ruRU.js +1 -1
  77. package/modern/models/gridColumnGrouping.js +4 -0
  78. package/modern/models/params/gridRowParams.js +8 -0
  79. package/modern/utils/createSelector.js +12 -22
  80. package/node/components/GridAutoSizer.js +3 -1
  81. package/node/components/GridRow.js +3 -1
  82. package/node/components/cell/GridCell.js +1 -0
  83. package/node/components/cell/GridEditDateCell.js +37 -16
  84. package/node/components/columnHeaders/ColumnHeaderMenuIcon.js +19 -15
  85. package/node/components/panel/GridColumnsPanel.js +18 -6
  86. package/node/hooks/core/useGridApiInitialization.js +3 -3
  87. package/node/hooks/features/editing/useGridCellEditing.js +5 -1
  88. package/node/hooks/features/editing/useGridEditing.js +1 -3
  89. package/node/hooks/features/editing/useGridRowEditing.js +5 -1
  90. package/node/hooks/features/filter/gridFilterState.js +5 -0
  91. package/node/hooks/features/filter/useGridFilter.js +5 -0
  92. package/node/index.js +1 -1
  93. package/node/locales/huHU.js +15 -20
  94. package/node/locales/jaJP.js +1 -1
  95. package/node/locales/nlNL.js +3 -3
  96. package/node/locales/ptBR.js +7 -9
  97. package/node/locales/ruRU.js +1 -1
  98. package/node/models/gridColumnGrouping.js +4 -0
  99. package/node/models/params/gridEditCellParams.js +1 -0
  100. package/node/models/params/gridRowParams.js +9 -0
  101. package/node/utils/createSelector.js +12 -22
  102. package/package.json +1 -1
  103. package/utils/createSelector.d.ts +4 -4
  104. package/utils/createSelector.js +14 -22
@@ -39,7 +39,7 @@ var nlNLGrid = {
39
39
  columnsPanelHideAllButton: 'Alles verbergen',
40
40
  // Filter panel text
41
41
  filterPanelAddFilter: 'Filter toevoegen',
42
- // filterPanelRemoveAll: 'Remove all',
42
+ filterPanelRemoveAll: 'Alles verwijderen',
43
43
  filterPanelDeleteIconLabel: 'Verwijderen',
44
44
  filterPanelLogicOperator: 'Logische operator',
45
45
  filterPanelOperator: 'Operatoren',
@@ -69,7 +69,7 @@ var nlNLGrid = {
69
69
  // Column menu text
70
70
  columnMenuLabel: 'Menu',
71
71
  columnMenuShowColumns: 'Toon kolommen',
72
- // columnMenuManageColumns: 'Manage columns',
72
+ columnMenuManageColumns: 'Kolommen beheren',
73
73
  columnMenuFilter: 'Filteren',
74
74
  columnMenuHideColumn: 'Verbergen',
75
75
  columnMenuUnsort: 'Annuleer sortering',
@@ -119,7 +119,7 @@ var nlNLGrid = {
119
119
  return "Stop groeperen op ".concat(name);
120
120
  },
121
121
  // Master/detail
122
- // detailPanelToggle: 'Detail panel toggle',
122
+ detailPanelToggle: 'Detailmenu in- of uitklappen',
123
123
  expandDetailPanel: 'Uitklappen',
124
124
  collapseDetailPanel: 'Inklappen',
125
125
  // Row reordering text
@@ -123,15 +123,13 @@ var ptBRGrid = {
123
123
  expandDetailPanel: 'Expandir',
124
124
  collapseDetailPanel: 'Esconder',
125
125
  // Row reordering text
126
- rowReorderingHeaderName: 'Reorganizar linhas'
127
-
126
+ rowReorderingHeaderName: 'Reorganizar linhas',
128
127
  // Aggregation
129
- // aggregationMenuItemHeader: 'Aggregation',
130
- // aggregationFunctionLabelSum: 'sum',
131
- // aggregationFunctionLabelAvg: 'avg',
132
- // aggregationFunctionLabelMin: 'min',
133
- // aggregationFunctionLabelMax: 'max',
134
- // aggregationFunctionLabelSize: 'size',
128
+ aggregationMenuItemHeader: 'Agrupar',
129
+ aggregationFunctionLabelSum: 'soma',
130
+ aggregationFunctionLabelAvg: 'média',
131
+ aggregationFunctionLabelMin: 'mín',
132
+ aggregationFunctionLabelMax: 'máx',
133
+ aggregationFunctionLabelSize: 'tamanho'
135
134
  };
136
-
137
135
  export var ptBR = getGridLocalization(ptBRGrid, ptBRCore);
@@ -76,7 +76,7 @@ var ruRUGrid = {
76
76
  // Column menu text
77
77
  columnMenuLabel: 'Меню',
78
78
  columnMenuShowColumns: 'Показать столбцы',
79
- // columnMenuManageColumns: 'Manage columns',
79
+ columnMenuManageColumns: 'Управление колонками',
80
80
  columnMenuFilter: 'Фильтр',
81
81
  columnMenuHideColumn: 'Скрыть',
82
82
  columnMenuUnsort: 'Отменить сортировку',
@@ -4,4 +4,8 @@ export function isLeaf(node) {
4
4
 
5
5
  /**
6
6
  * A function used to process headerClassName params.
7
+ */
8
+
9
+ /**
10
+ * The union type representing the [[GridColDef]] column header class type.
7
11
  */
@@ -32,5 +32,13 @@ var GridRowEditStopReasons = /*#__PURE__*/function (GridRowEditStopReasons) {
32
32
  GridRowEditStopReasons["shiftTabKeyDown"] = "shiftTabKeyDown";
33
33
  return GridRowEditStopReasons;
34
34
  }(GridRowEditStopReasons || {});
35
+ /**
36
+ * Object passed as parameter in the row `getRowSpacing` callback prop.
37
+ * @demos
38
+ * - [Row spacing](/x/react-data-grid/row-height/#row-spacing)
39
+ */
40
+ /**
41
+ * The getRowSpacing return value.
42
+ */
35
43
  // https://github.com/mui/mui-x/pull/3738#discussion_r798504277
36
44
  export { GridRowEditStartReasons, GridRowEditStopReasons };
@@ -1,44 +1,42 @@
1
1
  import { createSelector as reselectCreateSelector } from 'reselect';
2
2
  import { buildWarning } from './warning';
3
3
  var cacheContainer = {
4
- cache: null
4
+ cache: new WeakMap()
5
5
  };
6
6
  var missingInstanceIdWarning = buildWarning(['MUI: A selector was called without passing the instance ID, which may impact the performance of the grid.', 'To fix, call it with `apiRef`, e.g. `mySelector(apiRef)`, or pass the instance ID explicitly, e.g `mySelector(state, apiRef.current.instanceId)`.']);
7
7
  export var createSelector = function createSelector() {
8
8
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
9
9
  args[_key] = arguments[_key];
10
10
  }
11
- if (cacheContainer.cache === null) {
12
- cacheContainer.cache = {};
13
- }
14
11
  var selector = function selector() {
12
+ var _cache$get, _cache$get3;
15
13
  for (var _len2 = arguments.length, selectorArgs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
16
14
  selectorArgs[_key2] = arguments[_key2];
17
15
  }
18
16
  var stateOrApiRef = selectorArgs[0],
19
17
  instanceId = selectorArgs[1];
20
18
  var isApiRef = !!stateOrApiRef.current;
21
- var cacheKey = isApiRef ? stateOrApiRef.current.instanceId : instanceId != null ? instanceId : 'default';
19
+ var cacheKey = isApiRef ? stateOrApiRef.current.instanceId : instanceId != null ? instanceId : {
20
+ id: 'default'
21
+ };
22
22
  var state = isApiRef ? stateOrApiRef.current.state : stateOrApiRef;
23
23
  if (process.env.NODE_ENV !== 'production') {
24
- if (cacheKey === 'default') {
24
+ if (cacheKey.id === 'default') {
25
25
  missingInstanceIdWarning();
26
26
  }
27
27
  }
28
- if (cacheContainer.cache === null) {
29
- cacheContainer.cache = {};
30
- }
31
28
  var cache = cacheContainer.cache;
32
- if (cache[cacheKey] && cache[cacheKey].get(args)) {
29
+ if (cache.get(cacheKey) && (_cache$get = cache.get(cacheKey)) != null && _cache$get.get(args)) {
30
+ var _cache$get2;
33
31
  // We pass the cache key because the called selector might have as
34
32
  // dependency another selector created with this `createSelector`.
35
- return cache[cacheKey].get(args)(state, cacheKey);
33
+ return (_cache$get2 = cache.get(cacheKey)) == null ? void 0 : _cache$get2.get(args)(state, cacheKey);
36
34
  }
37
35
  var newSelector = reselectCreateSelector.apply(void 0, args);
38
- if (!cache[cacheKey]) {
39
- cache[cacheKey] = new Map();
36
+ if (!cache.get(cacheKey)) {
37
+ cache.set(cacheKey, new Map());
40
38
  }
41
- cache[cacheKey].set(args, newSelector);
39
+ (_cache$get3 = cache.get(cacheKey)) == null ? void 0 : _cache$get3.set(args, newSelector);
42
40
  return newSelector(state, cacheKey);
43
41
  };
44
42
 
@@ -49,12 +47,6 @@ export var createSelector = function createSelector() {
49
47
  };
50
48
 
51
49
  // eslint-disable-next-line @typescript-eslint/naming-convention
52
- export var unstable_resetCreateSelectorCache = function unstable_resetCreateSelectorCache(cacheKey) {
53
- if (typeof cacheKey !== 'undefined') {
54
- if (cacheContainer.cache && cacheContainer.cache[cacheKey]) {
55
- delete cacheContainer.cache[cacheKey];
56
- }
57
- } else {
58
- cacheContainer.cache = null;
59
- }
50
+ export var unstable_resetCreateSelectorCache = function unstable_resetCreateSelectorCache() {
51
+ cacheContainer.cache = new WeakMap();
60
52
  };
@@ -3,7 +3,6 @@
3
3
  // This allows not to bump the minimal version of `@mui/material` in peerDependencies which results
4
4
  // in broader compatibility between the packages.
5
5
  // See https://github.com/mui/mui-x/pull/7646#issuecomment-1404605556 for additional context.
6
-
7
6
  export const beBYCore = {
8
7
  components: {
9
8
  MuiTablePagination: {
package/locales/huHU.js CHANGED
@@ -20,17 +20,15 @@ const huHUGrid = {
20
20
  toolbarFiltersTooltipShow: 'Szűrők megjelenítése',
21
21
  toolbarFiltersTooltipActive: count => `${count} aktív szűrő`,
22
22
  // Quick filter toolbar field
23
- // toolbarQuickFilterPlaceholder: 'Search…',
24
- // toolbarQuickFilterLabel: 'Search',
25
- // toolbarQuickFilterDeleteIconLabel: 'Clear',
26
-
23
+ toolbarQuickFilterPlaceholder: 'Keresés…',
24
+ toolbarQuickFilterLabel: 'Keresés',
25
+ toolbarQuickFilterDeleteIconLabel: 'Törlés',
27
26
  // Export selector toolbar button text
28
27
  toolbarExport: 'Exportálás',
29
28
  toolbarExportLabel: 'Exportálás',
30
29
  toolbarExportCSV: 'Mentés CSV fájlként',
31
30
  toolbarExportPrint: 'Nyomtatás',
32
- // toolbarExportExcel: 'Download as Excel',
33
-
31
+ toolbarExportExcel: 'Mentés Excel fájlként',
34
32
  // Columns panel text
35
33
  columnsPanelTextFieldLabel: 'Oszlop keresése',
36
34
  columnsPanelTextFieldPlaceholder: 'Oszlop neve',
@@ -39,7 +37,7 @@ const huHUGrid = {
39
37
  columnsPanelHideAllButton: 'Összes elrejtése',
40
38
  // Filter panel text
41
39
  filterPanelAddFilter: 'Szűrő hozzáadása',
42
- // filterPanelRemoveAll: 'Remove all',
40
+ filterPanelRemoveAll: 'Összes törlése',
43
41
  filterPanelDeleteIconLabel: 'Törlés',
44
42
  filterPanelLogicOperator: 'Logikai operátor',
45
43
  filterPanelOperator: 'Operátorok',
@@ -69,7 +67,7 @@ const huHUGrid = {
69
67
  // Column menu text
70
68
  columnMenuLabel: 'Menü',
71
69
  columnMenuShowColumns: 'Oszlopok megjelenítése',
72
- // columnMenuManageColumns: 'Manage columns',
70
+ columnMenuManageColumns: 'Oszlopok kezelése',
73
71
  columnMenuFilter: 'Szűrők',
74
72
  columnMenuHideColumn: 'Elrejtés',
75
73
  columnMenuUnsort: 'Sorrend visszaállítása',
@@ -109,20 +107,17 @@ const huHUGrid = {
109
107
  groupColumn: name => `Csoportosítás ${name} szerint`,
110
108
  unGroupColumn: name => `${name} szerinti csoportosítás törlése`,
111
109
  // Master/detail
112
- // detailPanelToggle: 'Detail panel toggle',
110
+ detailPanelToggle: 'Részletek panel váltása',
113
111
  expandDetailPanel: 'Kibontás',
114
- collapseDetailPanel: 'Összecsukás'
115
-
112
+ collapseDetailPanel: 'Összecsukás',
116
113
  // Row reordering text
117
- // rowReorderingHeaderName: 'Row reordering',
118
-
114
+ rowReorderingHeaderName: 'Sorok újrarendezése',
119
115
  // Aggregation
120
- // aggregationMenuItemHeader: 'Aggregation',
121
- // aggregationFunctionLabelSum: 'sum',
122
- // aggregationFunctionLabelAvg: 'avg',
123
- // aggregationFunctionLabelMin: 'min',
124
- // aggregationFunctionLabelMax: 'max',
125
- // aggregationFunctionLabelSize: 'size',
116
+ aggregationMenuItemHeader: 'Összesítés',
117
+ aggregationFunctionLabelSum: 'Összeg',
118
+ aggregationFunctionLabelAvg: 'Átlag',
119
+ aggregationFunctionLabelMin: 'Minimum',
120
+ aggregationFunctionLabelMax: 'Maximum',
121
+ aggregationFunctionLabelSize: 'Darabszám'
126
122
  };
127
-
128
123
  export const huHU = getGridLocalization(huHUGrid, huHUCore);
package/locales/jaJP.js CHANGED
@@ -37,7 +37,7 @@ const jaJPGrid = {
37
37
  columnsPanelHideAllButton: 'すべて非表示',
38
38
  // Filter panel text
39
39
  filterPanelAddFilter: 'フィルター追加',
40
- // filterPanelRemoveAll: 'Remove all',
40
+ filterPanelRemoveAll: 'すべて削除',
41
41
  filterPanelDeleteIconLabel: '削除',
42
42
  filterPanelLogicOperator: '論理演算子',
43
43
  filterPanelOperator: '演算子',
package/locales/nlNL.js CHANGED
@@ -37,7 +37,7 @@ const nlNLGrid = {
37
37
  columnsPanelHideAllButton: 'Alles verbergen',
38
38
  // Filter panel text
39
39
  filterPanelAddFilter: 'Filter toevoegen',
40
- // filterPanelRemoveAll: 'Remove all',
40
+ filterPanelRemoveAll: 'Alles verwijderen',
41
41
  filterPanelDeleteIconLabel: 'Verwijderen',
42
42
  filterPanelLogicOperator: 'Logische operator',
43
43
  filterPanelOperator: 'Operatoren',
@@ -67,7 +67,7 @@ const nlNLGrid = {
67
67
  // Column menu text
68
68
  columnMenuLabel: 'Menu',
69
69
  columnMenuShowColumns: 'Toon kolommen',
70
- // columnMenuManageColumns: 'Manage columns',
70
+ columnMenuManageColumns: 'Kolommen beheren',
71
71
  columnMenuFilter: 'Filteren',
72
72
  columnMenuHideColumn: 'Verbergen',
73
73
  columnMenuUnsort: 'Annuleer sortering',
@@ -107,7 +107,7 @@ const nlNLGrid = {
107
107
  groupColumn: name => `Groepeer op ${name}`,
108
108
  unGroupColumn: name => `Stop groeperen op ${name}`,
109
109
  // Master/detail
110
- // detailPanelToggle: 'Detail panel toggle',
110
+ detailPanelToggle: 'Detailmenu in- of uitklappen',
111
111
  expandDetailPanel: 'Uitklappen',
112
112
  collapseDetailPanel: 'Inklappen',
113
113
  // Row reordering text
package/locales/ptBR.js CHANGED
@@ -111,15 +111,13 @@ const ptBRGrid = {
111
111
  expandDetailPanel: 'Expandir',
112
112
  collapseDetailPanel: 'Esconder',
113
113
  // Row reordering text
114
- rowReorderingHeaderName: 'Reorganizar linhas'
115
-
114
+ rowReorderingHeaderName: 'Reorganizar linhas',
116
115
  // Aggregation
117
- // aggregationMenuItemHeader: 'Aggregation',
118
- // aggregationFunctionLabelSum: 'sum',
119
- // aggregationFunctionLabelAvg: 'avg',
120
- // aggregationFunctionLabelMin: 'min',
121
- // aggregationFunctionLabelMax: 'max',
122
- // aggregationFunctionLabelSize: 'size',
116
+ aggregationMenuItemHeader: 'Agrupar',
117
+ aggregationFunctionLabelSum: 'soma',
118
+ aggregationFunctionLabelAvg: 'média',
119
+ aggregationFunctionLabelMin: 'mín',
120
+ aggregationFunctionLabelMax: 'máx',
121
+ aggregationFunctionLabelSize: 'tamanho'
123
122
  };
124
-
125
123
  export const ptBR = getGridLocalization(ptBRGrid, ptBRCore);
package/locales/ruRU.js CHANGED
@@ -76,7 +76,7 @@ const ruRUGrid = {
76
76
  // Column menu text
77
77
  columnMenuLabel: 'Меню',
78
78
  columnMenuShowColumns: 'Показать столбцы',
79
- // columnMenuManageColumns: 'Manage columns',
79
+ columnMenuManageColumns: 'Управление колонками',
80
80
  columnMenuFilter: 'Фильтр',
81
81
  columnMenuHideColumn: 'Скрыть',
82
82
  columnMenuUnsort: 'Отменить сортировку',
@@ -31,7 +31,9 @@ export interface GridCoreApi {
31
31
  * Unique identifier for each component instance in a page.
32
32
  * @ignore - do not document.
33
33
  */
34
- instanceId: number;
34
+ instanceId: {
35
+ id: number;
36
+ };
35
37
  }
36
38
  export interface GridCorePrivateApi<GridPublicApi extends GridApiCommon, GridPrivateApi extends GridPrivateApiCommon> {
37
39
  /**
@@ -18,6 +18,10 @@ export type GridRowModesModelProps = ({
18
18
  export type GridRowModesModel = Record<GridRowId, GridRowModesModelProps>;
19
19
  export interface GridEditCellMeta {
20
20
  changeReason?: 'debouncedSetEditCellValue' | 'setEditCellValue';
21
+ /**
22
+ * Determines if `setEditCellValue` should be called on the first render to sync the value.
23
+ */
24
+ unstable_updateValueOnRender?: boolean;
21
25
  }
22
26
  export interface GridEditingSharedApi {
23
27
  /**
@@ -4,4 +4,8 @@ export function isLeaf(node) {
4
4
 
5
5
  /**
6
6
  * A function used to process headerClassName params.
7
+ */
8
+
9
+ /**
10
+ * The union type representing the [[GridColDef]] column header class type.
7
11
  */
@@ -32,5 +32,13 @@ var GridRowEditStopReasons = /*#__PURE__*/function (GridRowEditStopReasons) {
32
32
  GridRowEditStopReasons["shiftTabKeyDown"] = "shiftTabKeyDown";
33
33
  return GridRowEditStopReasons;
34
34
  }(GridRowEditStopReasons || {});
35
+ /**
36
+ * Object passed as parameter in the row `getRowSpacing` callback prop.
37
+ * @demos
38
+ * - [Row spacing](/x/react-data-grid/row-height/#row-spacing)
39
+ */
40
+ /**
41
+ * The getRowSpacing return value.
42
+ */
35
43
  // https://github.com/mui/mui-x/pull/3738#discussion_r798504277
36
44
  export { GridRowEditStartReasons, GridRowEditStopReasons };
@@ -6,6 +6,9 @@ import PropTypes from 'prop-types';
6
6
  import { unstable_useForkRef as useForkRef, unstable_ownerWindow as ownerWindow, unstable_useEventCallback as useEventCallback, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
7
7
  import createDetectElementResize from '../lib/createDetectElementResize';
8
8
  // TODO replace with https://caniuse.com/resizeobserver.
9
+
10
+ // Credit to https://github.com/bvaughn/react-virtualized/blob/master/source/AutoSizer/AutoSizer.js
11
+ // for the sources.
9
12
  import { jsx as _jsx } from "react/jsx-runtime";
10
13
  const GridAutoSizer = /*#__PURE__*/React.forwardRef(function AutoSizer(props, ref) {
11
14
  const {
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["selected", "rowId", "row", "index", "style", "position", "rowHeight", "className", "visibleColumns", "renderedColumns", "containerWidth", "firstColumnToRender", "lastColumnToRender", "isLastVisible", "focusedCell", "tabbableCell", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave"],
4
- _excluded2 = ["changeReason"];
4
+ _excluded2 = ["changeReason", "unstable_updateValueOnRender"];
5
5
  import * as React from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import clsx from 'clsx';
@@ -210,6 +210,8 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
210
210
  }
211
211
  if (editCellState != null && column.renderEditCell) {
212
212
  const updatedRow = apiRef.current.getRowWithUpdatedValues(rowId, column.field);
213
+
214
+ // eslint-disable-next-line @typescript-eslint/naming-convention
213
215
  const editCellStateRest = _objectWithoutPropertiesLoose(editCellState, _excluded2);
214
216
  const params = _extends({}, cellParams, {
215
217
  row: updatedRow
@@ -63,22 +63,25 @@ function GridEditDateCell(props) {
63
63
  classes: rootProps.classes
64
64
  };
65
65
  const classes = useUtilityClasses(ownerState);
66
+ const hasUpdatedEditValueOnMount = React.useRef(false);
67
+ const parseValueToDate = React.useCallback(value => {
68
+ if (value === '') {
69
+ return null;
70
+ }
71
+ const [date, time] = value.split('T');
72
+ const [year, month, day] = date.split('-');
73
+ const parsedDate = new Date();
74
+ parsedDate.setFullYear(Number(year), Number(month) - 1, Number(day));
75
+ parsedDate.setHours(0, 0, 0, 0);
76
+ if (time) {
77
+ const [hours, minutes] = time.split(':');
78
+ parsedDate.setHours(Number(hours), Number(minutes), 0, 0);
79
+ }
80
+ return parsedDate;
81
+ }, []);
66
82
  const handleChange = React.useCallback(async event => {
67
83
  const newFormattedDate = event.target.value;
68
- let newParsedDate;
69
- if (newFormattedDate === '') {
70
- newParsedDate = null;
71
- } else {
72
- const [date, time] = newFormattedDate.split('T');
73
- const [year, month, day] = date.split('-');
74
- newParsedDate = new Date();
75
- newParsedDate.setFullYear(Number(year), Number(month) - 1, Number(day));
76
- newParsedDate.setHours(0, 0, 0, 0);
77
- if (time) {
78
- const [hours, minutes] = time.split(':');
79
- newParsedDate.setHours(Number(hours), Number(minutes), 0, 0);
80
- }
81
- }
84
+ const newParsedDate = parseValueToDate(newFormattedDate);
82
85
  if (onValueChange) {
83
86
  await onValueChange(event, newParsedDate);
84
87
  }
@@ -91,7 +94,7 @@ function GridEditDateCell(props) {
91
94
  field,
92
95
  value: newParsedDate
93
96
  }, event);
94
- }, [apiRef, field, id, onValueChange]);
97
+ }, [apiRef, field, id, onValueChange, parseValueToDate]);
95
98
  React.useEffect(() => {
96
99
  setValueState(state => {
97
100
  if (valueTransformed.parsed !== state.parsed && valueTransformed.parsed?.getTime() !== state.parsed?.getTime()) {
@@ -105,8 +108,26 @@ function GridEditDateCell(props) {
105
108
  inputRef.current.focus();
106
109
  }
107
110
  }, [hasFocus]);
111
+ const meta = apiRef.current.unstable_getEditCellMeta(id, field);
112
+ const handleInputRef = el => {
113
+ inputRef.current = el;
114
+ if (meta.unstable_updateValueOnRender && !hasUpdatedEditValueOnMount.current) {
115
+ const inputValue = inputRef.current.value;
116
+ const parsedDate = parseValueToDate(inputValue);
117
+ setValueState({
118
+ parsed: parsedDate,
119
+ formatted: inputValue
120
+ });
121
+ apiRef.current.setEditCellValue({
122
+ id,
123
+ field,
124
+ value: parsedDate
125
+ });
126
+ hasUpdatedEditValueOnMount.current = true;
127
+ }
128
+ };
108
129
  return /*#__PURE__*/_jsx(StyledInputBase, _extends({
109
- inputRef: inputRef,
130
+ inputRef: handleInputRef,
110
131
  fullWidth: true,
111
132
  className: classes.root,
112
133
  type: isDateTime ? 'datetime-local' : 'date',
@@ -37,22 +37,26 @@ export const ColumnHeaderMenuIcon = /*#__PURE__*/React.memo(props => {
37
37
  }, [apiRef, colDef.field]);
38
38
  return /*#__PURE__*/_jsx("div", {
39
39
  className: classes.root,
40
- children: /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
41
- ref: iconButtonRef,
42
- tabIndex: -1,
43
- className: classes.button,
44
- "aria-label": apiRef.current.getLocaleText('columnMenuLabel'),
40
+ children: /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, _extends({
45
41
  title: apiRef.current.getLocaleText('columnMenuLabel'),
46
- size: "small",
47
- onClick: handleMenuIconClick,
48
- "aria-expanded": open ? 'true' : undefined,
49
- "aria-haspopup": "true",
50
- "aria-controls": columnMenuId,
51
- id: columnMenuButtonId
52
- }, rootProps.slotProps?.baseIconButton, {
53
- children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuIcon, {
54
- fontSize: "small"
55
- })
42
+ enterDelay: 1000
43
+ }, rootProps.slotProps?.baseTooltip, {
44
+ children: /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
45
+ ref: iconButtonRef,
46
+ tabIndex: -1,
47
+ className: classes.button,
48
+ "aria-label": apiRef.current.getLocaleText('columnMenuLabel'),
49
+ size: "small",
50
+ onClick: handleMenuIconClick,
51
+ "aria-expanded": open ? 'true' : undefined,
52
+ "aria-haspopup": "true",
53
+ "aria-controls": columnMenuId,
54
+ id: columnMenuButtonId
55
+ }, rootProps.slotProps?.baseIconButton, {
56
+ children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuIcon, {
57
+ fontSize: "small"
58
+ })
59
+ }))
56
60
  }))
57
61
  });
58
62
  });
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["sort", "searchPredicate", "autoFocusSearchField", "disableHideAllButton", "disableShowAllButton"];
3
+ const _excluded = ["sort", "searchPredicate", "autoFocusSearchField", "disableHideAllButton", "disableShowAllButton", "getTogglableColumns"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { unstable_composeClasses as composeClasses } from '@mui/utils';
@@ -71,7 +71,8 @@ function GridColumnsPanel(props) {
71
71
  searchPredicate = defaultSearchPredicate,
72
72
  autoFocusSearchField = true,
73
73
  disableHideAllButton = false,
74
- disableShowAllButton = false
74
+ disableShowAllButton = false,
75
+ getTogglableColumns
75
76
  } = props,
76
77
  other = _objectWithoutPropertiesLoose(props, _excluded);
77
78
  const sortedColumns = React.useMemo(() => {
@@ -109,12 +110,15 @@ function GridColumnsPanel(props) {
109
110
  setSearchValue(event.target.value);
110
111
  }, []);
111
112
  const currentColumns = React.useMemo(() => {
113
+ const togglableColumns = getTogglableColumns ? getTogglableColumns(sortedColumns) : null;
114
+ const togglableSortedColumns = togglableColumns ? sortedColumns.filter(({
115
+ field
116
+ }) => togglableColumns.includes(field)) : sortedColumns;
112
117
  if (!searchValue) {
113
- return sortedColumns;
118
+ return togglableSortedColumns;
114
119
  }
115
- const searchValueToCheck = searchValue.toLowerCase();
116
- return sortedColumns.filter(column => searchPredicate(column, searchValueToCheck));
117
- }, [sortedColumns, searchValue, searchPredicate]);
120
+ return togglableSortedColumns.filter(column => searchPredicate(column, searchValue.toLowerCase()));
121
+ }, [sortedColumns, searchValue, searchPredicate, getTogglableColumns]);
118
122
  const firstSwitchRef = React.useRef(null);
119
123
  React.useEffect(() => {
120
124
  if (autoFocusSearchField) {
@@ -192,6 +196,14 @@ process.env.NODE_ENV !== "production" ? GridColumnsPanel.propTypes = {
192
196
  autoFocusSearchField: PropTypes.bool,
193
197
  disableHideAllButton: PropTypes.bool,
194
198
  disableShowAllButton: PropTypes.bool,
199
+ /**
200
+ * Returns the list of togglable columns.
201
+ * If used, only those columns will be displayed in the panel
202
+ * which are passed as the return value of the function.
203
+ * @param {GridColDef[]} columns The `ColDef` list of all columns.
204
+ * @returns {GridColDef['field'][]} The list of togglable columns' field names.
205
+ */
206
+ getTogglableColumns: PropTypes.func,
195
207
  searchPredicate: PropTypes.func,
196
208
  slotProps: PropTypes.object,
197
209
  sort: PropTypes.oneOf(['asc', 'desc'])
@@ -2,7 +2,6 @@ import * as React from 'react';
2
2
  import { useGridApiMethod } from '../utils/useGridApiMethod';
3
3
  import { GridSignature } from '../utils/useGridApiEventHandler';
4
4
  import { EventManager } from '../../utils/EventManager';
5
- import { unstable_resetCreateSelectorCache } from '../../utils/createSelector';
6
5
  const isSyntheticEvent = event => {
7
6
  return event.isPropagationStopped !== undefined;
8
7
  };
@@ -38,7 +37,9 @@ export function useGridApiInitialization(inputApiRef, props) {
38
37
  if (!publicApiRef.current) {
39
38
  publicApiRef.current = {
40
39
  state: {},
41
- instanceId: globalId
40
+ instanceId: {
41
+ id: globalId
42
+ }
42
43
  };
43
44
  globalId += 1;
44
45
  }
@@ -76,7 +77,6 @@ export function useGridApiInitialization(inputApiRef, props) {
76
77
  React.useEffect(() => {
77
78
  const api = privateApiRef.current;
78
79
  return () => {
79
- unstable_resetCreateSelectorCache(api.instanceId);
80
80
  api.publishEvent('unmount');
81
81
  };
82
82
  }, [privateApiRef]);
@@ -242,13 +242,17 @@ export const useGridCellEditing = (apiRef, props) => {
242
242
  initialValue
243
243
  } = params;
244
244
  let newValue = apiRef.current.getCellValue(id, field);
245
+ // eslint-disable-next-line @typescript-eslint/naming-convention
246
+ let unstable_updateValueOnRender = false;
245
247
  if (deleteValue || initialValue) {
246
248
  newValue = deleteValue ? '' : initialValue;
249
+ unstable_updateValueOnRender = true;
247
250
  }
248
251
  const newProps = {
249
252
  value: newValue,
250
253
  error: false,
251
- isProcessingProps: false
254
+ isProcessingProps: false,
255
+ unstable_updateValueOnRender
252
256
  };
253
257
  updateOrDeleteFieldState(id, field, newProps);
254
258
  apiRef.current.setCellFocus(id, field);
@@ -110,9 +110,7 @@ export const useGridEditing = (apiRef, props) => {
110
110
  }, [apiRef, props.editMode]);
111
111
  const getEditCellMeta = React.useCallback((id, field) => {
112
112
  const editingState = gridEditRowsStateSelector(apiRef.current.state);
113
- return {
114
- changeReason: editingState[id][field].changeReason
115
- };
113
+ return editingState[id][field];
116
114
  }, [apiRef]);
117
115
  const editingSharedApi = {
118
116
  isCellEditable,
@@ -310,13 +310,17 @@ export const useGridRowEditing = (apiRef, props) => {
310
310
  return acc;
311
311
  }
312
312
  let newValue = apiRef.current.getCellValue(id, field);
313
+ // eslint-disable-next-line @typescript-eslint/naming-convention
314
+ let unstable_updateValueOnRender = false;
313
315
  if (fieldToFocus === field && (deleteValue || initialValue)) {
314
316
  newValue = deleteValue ? '' : initialValue;
317
+ unstable_updateValueOnRender = true;
315
318
  }
316
319
  acc[field] = {
317
320
  value: newValue,
318
321
  error: false,
319
- isProcessingProps: false
322
+ isProcessingProps: false,
323
+ unstable_updateValueOnRender
320
324
  };
321
325
  return acc;
322
326
  }, {});