@mui/x-data-grid 6.7.0 → 6.8.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 (153) hide show
  1. package/CHANGELOG.md +77 -15
  2. package/components/GridColumnHeaders.d.ts +2 -2
  3. package/components/GridColumnHeaders.js +3 -1
  4. package/components/GridRow.d.ts +2 -2
  5. package/components/GridRow.js +23 -69
  6. package/components/cell/GridCell.d.ts +24 -15
  7. package/components/cell/GridCell.js +422 -45
  8. package/components/cell/index.d.ts +2 -1
  9. package/components/cell/index.js +1 -1
  10. package/components/containers/GridRootStyles.js +30 -16
  11. package/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
  12. package/components/toolbar/GridToolbar.js +2 -2
  13. package/components/virtualization/GridVirtualScroller.js +4 -9
  14. package/components/virtualization/GridVirtualScrollerContent.js +11 -20
  15. package/constants/defaultGridSlotsComponents.js +6 -2
  16. package/hooks/core/useGridApiInitialization.js +4 -1
  17. package/hooks/core/useGridStateInitialization.js +2 -9
  18. package/hooks/features/clipboard/useGridClipboard.js +1 -4
  19. package/hooks/features/columnHeaders/useGridColumnHeaders.js +9 -3
  20. package/hooks/features/editing/useGridCellEditing.js +5 -3
  21. package/hooks/features/editing/useGridRowEditing.js +14 -6
  22. package/hooks/features/filter/gridFilterUtils.d.ts +4 -1
  23. package/hooks/features/filter/gridFilterUtils.js +19 -13
  24. package/hooks/features/filter/useGridFilter.js +2 -1
  25. package/hooks/features/focus/useGridFocus.js +9 -4
  26. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -3
  27. package/hooks/features/rows/useGridParamsApi.d.ts +2 -0
  28. package/hooks/features/rows/useGridParamsApi.js +7 -15
  29. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +8 -816
  30. package/hooks/features/virtualization/useGridVirtualScroller.js +40 -38
  31. package/hooks/utils/index.d.ts +1 -1
  32. package/hooks/utils/index.js +1 -1
  33. package/hooks/utils/useGridSelector.d.ts +3 -1
  34. package/hooks/utils/useGridSelector.js +37 -6
  35. package/hooks/utils/useLazyRef.d.ts +2 -0
  36. package/hooks/utils/useLazyRef.js +9 -0
  37. package/hooks/utils/useOnMount.d.ts +2 -0
  38. package/hooks/utils/useOnMount.js +7 -0
  39. package/index.js +1 -1
  40. package/legacy/components/GridColumnHeaders.js +3 -1
  41. package/legacy/components/GridRow.js +25 -69
  42. package/legacy/components/cell/GridCell.js +425 -46
  43. package/legacy/components/cell/index.js +1 -1
  44. package/legacy/components/containers/GridRootStyles.js +20 -17
  45. package/legacy/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
  46. package/legacy/components/toolbar/GridToolbar.js +2 -2
  47. package/legacy/components/virtualization/GridVirtualScroller.js +4 -7
  48. package/legacy/components/virtualization/GridVirtualScrollerContent.js +10 -17
  49. package/legacy/constants/defaultGridSlotsComponents.js +6 -2
  50. package/legacy/hooks/core/useGridApiInitialization.js +4 -1
  51. package/legacy/hooks/core/useGridStateInitialization.js +2 -7
  52. package/legacy/hooks/features/clipboard/useGridClipboard.js +1 -4
  53. package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +9 -3
  54. package/legacy/hooks/features/editing/useGridCellEditing.js +5 -3
  55. package/legacy/hooks/features/editing/useGridRowEditing.js +15 -7
  56. package/legacy/hooks/features/filter/gridFilterUtils.js +23 -19
  57. package/legacy/hooks/features/filter/useGridFilter.js +2 -1
  58. package/legacy/hooks/features/focus/useGridFocus.js +9 -4
  59. package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -3
  60. package/legacy/hooks/features/rows/useGridParamsApi.js +23 -15
  61. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +38 -34
  62. package/legacy/hooks/utils/index.js +1 -1
  63. package/legacy/hooks/utils/useGridSelector.js +43 -5
  64. package/legacy/hooks/utils/useLazyRef.js +9 -0
  65. package/legacy/hooks/utils/useOnMount.js +7 -0
  66. package/legacy/index.js +1 -1
  67. package/legacy/locales/elGR.js +70 -79
  68. package/legacy/utils/Store.js +34 -0
  69. package/legacy/utils/doesSupportPreventScroll.js +13 -0
  70. package/legacy/utils/fastMemo.js +5 -0
  71. package/legacy/utils/fastObjectShallowCompare.js +32 -0
  72. package/legacy/utils/keyboardUtils.js +4 -2
  73. package/locales/elGR.js +66 -79
  74. package/models/api/gridCoreApi.d.ts +6 -0
  75. package/models/colDef/gridColDef.d.ts +4 -3
  76. package/models/colDef/gridColType.d.ts +3 -1
  77. package/models/events/gridEventLookup.d.ts +3 -3
  78. package/modern/components/GridColumnHeaders.js +3 -1
  79. package/modern/components/GridRow.js +22 -69
  80. package/modern/components/cell/GridCell.js +421 -45
  81. package/modern/components/cell/index.js +1 -1
  82. package/modern/components/containers/GridRootStyles.js +30 -16
  83. package/modern/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
  84. package/modern/components/toolbar/GridToolbar.js +2 -2
  85. package/modern/components/virtualization/GridVirtualScroller.js +4 -9
  86. package/modern/components/virtualization/GridVirtualScrollerContent.js +10 -20
  87. package/modern/constants/defaultGridSlotsComponents.js +6 -2
  88. package/modern/hooks/core/useGridApiInitialization.js +4 -1
  89. package/modern/hooks/core/useGridStateInitialization.js +2 -9
  90. package/modern/hooks/features/clipboard/useGridClipboard.js +1 -4
  91. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +9 -3
  92. package/modern/hooks/features/editing/useGridCellEditing.js +5 -3
  93. package/modern/hooks/features/editing/useGridRowEditing.js +14 -6
  94. package/modern/hooks/features/filter/gridFilterUtils.js +17 -12
  95. package/modern/hooks/features/filter/useGridFilter.js +2 -1
  96. package/modern/hooks/features/focus/useGridFocus.js +8 -4
  97. package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -3
  98. package/modern/hooks/features/rows/useGridParamsApi.js +7 -15
  99. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +40 -38
  100. package/modern/hooks/utils/index.js +1 -1
  101. package/modern/hooks/utils/useGridSelector.js +37 -6
  102. package/modern/hooks/utils/useLazyRef.js +9 -0
  103. package/modern/hooks/utils/useOnMount.js +7 -0
  104. package/modern/index.js +1 -1
  105. package/modern/locales/elGR.js +66 -79
  106. package/modern/utils/Store.js +24 -0
  107. package/modern/utils/doesSupportPreventScroll.js +13 -0
  108. package/modern/utils/fastMemo.js +5 -0
  109. package/modern/utils/fastObjectShallowCompare.js +32 -0
  110. package/modern/utils/keyboardUtils.js +4 -2
  111. package/node/components/GridColumnHeaders.js +4 -2
  112. package/node/components/GridRow.js +22 -69
  113. package/node/components/cell/GridCell.js +424 -47
  114. package/node/components/cell/index.js +17 -10
  115. package/node/components/containers/GridRootStyles.js +30 -16
  116. package/node/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
  117. package/node/components/toolbar/GridToolbar.js +2 -2
  118. package/node/components/virtualization/GridVirtualScroller.js +4 -9
  119. package/node/components/virtualization/GridVirtualScrollerContent.js +10 -20
  120. package/node/constants/defaultGridSlotsComponents.js +4 -1
  121. package/node/hooks/core/useGridApiInitialization.js +4 -1
  122. package/node/hooks/core/useGridStateInitialization.js +2 -9
  123. package/node/hooks/features/clipboard/useGridClipboard.js +1 -4
  124. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +8 -2
  125. package/node/hooks/features/editing/useGridCellEditing.js +5 -3
  126. package/node/hooks/features/editing/useGridRowEditing.js +14 -6
  127. package/node/hooks/features/filter/gridFilterUtils.js +17 -12
  128. package/node/hooks/features/filter/useGridFilter.js +2 -1
  129. package/node/hooks/features/focus/useGridFocus.js +8 -4
  130. package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -3
  131. package/node/hooks/features/rows/useGridParamsApi.js +9 -15
  132. package/node/hooks/features/virtualization/useGridVirtualScroller.js +40 -36
  133. package/node/hooks/utils/index.js +14 -10
  134. package/node/hooks/utils/useGridSelector.js +41 -7
  135. package/node/hooks/utils/useLazyRef.js +17 -0
  136. package/node/hooks/utils/useOnMount.js +15 -0
  137. package/node/index.js +1 -1
  138. package/node/locales/elGR.js +66 -79
  139. package/node/utils/Store.js +31 -0
  140. package/node/utils/doesSupportPreventScroll.js +19 -0
  141. package/node/utils/fastMemo.js +13 -0
  142. package/node/utils/fastObjectShallowCompare.js +38 -0
  143. package/node/utils/keyboardUtils.js +4 -2
  144. package/package.json +1 -1
  145. package/utils/Store.d.ts +11 -0
  146. package/utils/Store.js +24 -0
  147. package/utils/doesSupportPreventScroll.d.ts +1 -0
  148. package/utils/doesSupportPreventScroll.js +13 -0
  149. package/utils/fastMemo.d.ts +1 -0
  150. package/utils/fastMemo.js +5 -0
  151. package/utils/fastObjectShallowCompare.d.ts +1 -0
  152. package/utils/fastObjectShallowCompare.js +32 -0
  153. package/utils/keyboardUtils.js +4 -2
package/locales/elGR.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { elGR as elGRCore } from '@mui/material/locale';
1
2
  import { getGridLocalization } from '../utils/getGridLocalization';
2
3
  const elGRGrid = {
3
4
  // Root
@@ -19,17 +20,15 @@ const elGRGrid = {
19
20
  toolbarFiltersTooltipShow: 'Εμφάνιση φίλτρων',
20
21
  toolbarFiltersTooltipActive: count => count !== 1 ? `${count} ενεργά φίλτρα` : `${count} ενεργό φίλτρο`,
21
22
  // Quick filter toolbar field
22
- // toolbarQuickFilterPlaceholder: 'Search…',
23
- // toolbarQuickFilterLabel: 'Search',
24
- // toolbarQuickFilterDeleteIconLabel: 'Clear',
25
-
23
+ toolbarQuickFilterPlaceholder: 'Αναζήτηση…',
24
+ toolbarQuickFilterLabel: 'Αναζήτηση',
25
+ toolbarQuickFilterDeleteIconLabel: 'Καθαρισμός',
26
26
  // Export selector toolbar button text
27
27
  toolbarExport: 'Εξαγωγή',
28
28
  toolbarExportLabel: 'Εξαγωγή',
29
29
  toolbarExportCSV: 'Λήψη ως CSV',
30
- // toolbarExportPrint: 'Print',
31
- // toolbarExportExcel: 'Download as Excel',
32
-
30
+ toolbarExportPrint: 'Εκτύπωση',
31
+ toolbarExportExcel: 'Λήψη ως Excel',
33
32
  // Columns panel text
34
33
  columnsPanelTextFieldLabel: 'Εύρεση στήλης',
35
34
  columnsPanelTextFieldPlaceholder: 'Επικεφαλίδα στήλης',
@@ -38,9 +37,9 @@ const elGRGrid = {
38
37
  columnsPanelHideAllButton: 'Απόκρυψη όλων',
39
38
  // Filter panel text
40
39
  filterPanelAddFilter: 'Προσθήκη φίλτρου',
41
- // filterPanelRemoveAll: 'Remove all',
40
+ filterPanelRemoveAll: 'Αφαίρεση όλων',
42
41
  filterPanelDeleteIconLabel: 'Διαγραφή',
43
- // filterPanelLogicOperator: 'Logic operator',
42
+ filterPanelLogicOperator: 'Λογικός τελεστής',
44
43
  filterPanelOperator: 'Τελεστές',
45
44
  filterPanelOperatorAnd: 'Καί',
46
45
  filterPanelOperatorOr: 'Ή',
@@ -60,44 +59,41 @@ const elGRGrid = {
60
59
  filterOperatorOnOrBefore: 'είναι ίσο ή πριν',
61
60
  filterOperatorIsEmpty: 'είναι κενό',
62
61
  filterOperatorIsNotEmpty: 'δεν είναι κενό',
63
- // filterOperatorIsAnyOf: 'is any of',
64
- // 'filterOperator=': '=',
65
- // 'filterOperator!=': '!=',
66
- // 'filterOperator>': '>',
67
- // 'filterOperator>=': '>=',
68
- // 'filterOperator<': '<',
69
- // 'filterOperator<=': '<=',
70
-
62
+ filterOperatorIsAnyOf: 'είναι οποιοδήποτε από',
63
+ 'filterOperator=': '=',
64
+ 'filterOperator!=': '!=',
65
+ 'filterOperator>': '>',
66
+ 'filterOperator>=': '>=',
67
+ 'filterOperator<': '<',
68
+ 'filterOperator<=': '<=',
71
69
  // Header filter operators text
72
- // headerFilterOperatorContains: 'Contains',
73
- // headerFilterOperatorEquals: 'Equals',
74
- // headerFilterOperatorStartsWith: 'Starts with',
75
- // headerFilterOperatorEndsWith: 'Ends with',
76
- // headerFilterOperatorIs: 'Is',
77
- // headerFilterOperatorNot: 'Is not',
78
- // headerFilterOperatorAfter: 'Is after',
79
- // headerFilterOperatorOnOrAfter: 'Is on or after',
80
- // headerFilterOperatorBefore: 'Is before',
81
- // headerFilterOperatorOnOrBefore: 'Is on or before',
82
- // headerFilterOperatorIsEmpty: 'Is empty',
83
- // headerFilterOperatorIsNotEmpty: 'Is not empty',
84
- // headerFilterOperatorIsAnyOf: 'Is any of',
85
- // 'headerFilterOperator=': 'Equals',
86
- // 'headerFilterOperator!=': 'Not equals',
87
- // 'headerFilterOperator>': 'Greater than',
88
- // 'headerFilterOperator>=': 'Greater than or equal to',
89
- // 'headerFilterOperator<': 'Less than',
90
- // 'headerFilterOperator<=': 'Less than or equal to',
91
-
70
+ headerFilterOperatorContains: 'Περιέχει',
71
+ headerFilterOperatorEquals: 'Ισούται',
72
+ headerFilterOperatorStartsWith: 'Ξεκινάει με',
73
+ headerFilterOperatorEndsWith: 'Τελειώνει με',
74
+ headerFilterOperatorIs: 'Είναι',
75
+ headerFilterOperatorNot: 'Δεν είναι',
76
+ headerFilterOperatorAfter: 'Είναι μετά',
77
+ headerFilterOperatorOnOrAfter: 'Είναι ίσο ή μετά',
78
+ headerFilterOperatorBefore: 'Είναι πριν',
79
+ headerFilterOperatorOnOrBefore: 'Είναι ίσο ή πριν',
80
+ headerFilterOperatorIsEmpty: 'Είναι κενό',
81
+ headerFilterOperatorIsNotEmpty: 'Δεν είναι κενό',
82
+ headerFilterOperatorIsAnyOf: 'Είναι οποιοδήποτε από',
83
+ 'headerFilterOperator=': 'Ισούται',
84
+ 'headerFilterOperator!=': 'Δεν ισούται',
85
+ 'headerFilterOperator>': 'Μεγαλύτερο από',
86
+ 'headerFilterOperator>=': 'Μεγαλύτερο ή ίσο με',
87
+ 'headerFilterOperator<': 'Μικρότερο από',
88
+ 'headerFilterOperator<=': 'Μικρότερο ή ίσο με',
92
89
  // Filter values text
93
- // filterValueAny: 'any',
94
- // filterValueTrue: 'true',
95
- // filterValueFalse: 'false',
96
-
90
+ filterValueAny: 'οποιοδήποτε',
91
+ filterValueTrue: 'αληθές',
92
+ filterValueFalse: 'ψευδές',
97
93
  // Column menu text
98
94
  columnMenuLabel: 'Μενού',
99
95
  columnMenuShowColumns: 'Εμφάνιση στηλών',
100
- // columnMenuManageColumns: 'Manage columns',
96
+ columnMenuManageColumns: 'Διαχείριση στηλών',
101
97
  columnMenuFilter: 'Φίλτρο',
102
98
  columnMenuHideColumn: 'Απόκρυψη',
103
99
  columnMenuUnsort: 'Απενεργοποίηση ταξινόμησης',
@@ -114,49 +110,40 @@ const elGRGrid = {
114
110
  // Total visible row amount footer text
115
111
  footerTotalVisibleRows: (visibleCount, totalCount) => `${visibleCount.toLocaleString()} από ${totalCount.toLocaleString()}`,
116
112
  // Checkbox selection text
117
- // checkboxSelectionHeaderName: 'Checkbox selection',
118
- // checkboxSelectionSelectAllRows: 'Select all rows',
119
- // checkboxSelectionUnselectAllRows: 'Unselect all rows',
120
- // checkboxSelectionSelectRow: 'Select row',
121
- // checkboxSelectionUnselectRow: 'Unselect row',
122
-
113
+ checkboxSelectionHeaderName: 'Επιλογή πλαισίου ελέγχου',
114
+ checkboxSelectionSelectAllRows: 'Επιλέξτε όλες τις σειρές',
115
+ checkboxSelectionUnselectAllRows: 'Καταργήση επιλογής όλων των σειρών',
116
+ checkboxSelectionSelectRow: 'Επιλογή γραμμής',
117
+ checkboxSelectionUnselectRow: 'Καταργήση επιλογής γραμμής',
123
118
  // Boolean cell text
124
- // booleanCellTrueLabel: 'yes',
125
- // booleanCellFalseLabel: 'no',
126
-
119
+ booleanCellTrueLabel: 'ναί',
120
+ booleanCellFalseLabel: 'όχι',
127
121
  // Actions cell more text
128
- actionsCellMore: 'περισσότερα'
129
-
122
+ actionsCellMore: 'περισσότερα',
130
123
  // Column pinning text
131
- // pinToLeft: 'Pin to left',
132
- // pinToRight: 'Pin to right',
133
- // unpin: 'Unpin',
134
-
124
+ pinToLeft: 'Καρφιτσώμα στα αριστερά',
125
+ pinToRight: 'Καρφιτσώμα στα δεξιά',
126
+ unpin: 'Ξεκαρφίτσωμα',
135
127
  // Tree Data
136
- // treeDataGroupingHeaderName: 'Group',
137
- // treeDataExpand: 'see children',
138
- // treeDataCollapse: 'hide children',
139
-
128
+ treeDataGroupingHeaderName: 'Ομαδοποίηση',
129
+ treeDataExpand: 'εμφάνιση περιεχομένων',
130
+ treeDataCollapse: 'απόκρυψη περιεχομένων',
140
131
  // Grouping columns
141
- // groupingColumnHeaderName: 'Group',
142
- // groupColumn: name => `Group by ${name}`,
143
- // unGroupColumn: name => `Stop grouping by ${name}`,
144
-
132
+ groupingColumnHeaderName: 'Ομαδοποίηση',
133
+ groupColumn: name => `Ομαδοποίηση κατά ${name}`,
134
+ unGroupColumn: name => `Διακοπή ομαδοποίησης κατά ${name}`,
145
135
  // Master/detail
146
- // detailPanelToggle: 'Detail panel toggle',
147
- // expandDetailPanel: 'Expand',
148
- // collapseDetailPanel: 'Collapse',
149
-
136
+ detailPanelToggle: 'Εναλλαγή πίνακα λεπτομερειών',
137
+ expandDetailPanel: 'Ανάπτυξη',
138
+ collapseDetailPanel: 'Σύμπτυξη',
150
139
  // Row reordering text
151
- // rowReorderingHeaderName: 'Row reordering',
152
-
140
+ rowReorderingHeaderName: 'Αναδιάταξη γραμμών',
153
141
  // Aggregation
154
- // aggregationMenuItemHeader: 'Aggregation',
155
- // aggregationFunctionLabelSum: 'sum',
156
- // aggregationFunctionLabelAvg: 'avg',
157
- // aggregationFunctionLabelMin: 'min',
158
- // aggregationFunctionLabelMax: 'max',
159
- // aggregationFunctionLabelSize: 'size',
142
+ aggregationMenuItemHeader: 'Συσσωμάτωση',
143
+ aggregationFunctionLabelSum: 'άθροισμα',
144
+ aggregationFunctionLabelAvg: 'μέση τιμή',
145
+ aggregationFunctionLabelMin: 'ελάχιστο',
146
+ aggregationFunctionLabelMax: 'μέγιστο',
147
+ aggregationFunctionLabelSize: 'μέγεθος'
160
148
  };
161
-
162
- export const elGR = getGridLocalization(elGRGrid);
149
+ export const elGR = getGridLocalization(elGRGrid, elGRCore);
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { GridEventPublisher, GridEventListener, GridEvents } from '../events';
3
+ import { Store } from '../../utils/Store';
3
4
  import { EventManager, EventListenerOptions } from '../../utils/EventManager';
4
5
  import { GridApiCaches } from '../gridApiCaches';
5
6
  import type { GridApiCommon, GridPrivateApiCommon } from './gridApiCommon';
@@ -34,6 +35,11 @@ export interface GridCoreApi {
34
35
  instanceId: {
35
36
  id: number;
36
37
  };
38
+ /**
39
+ * The pub/sub store containing a reference to the public state.
40
+ * @ignore - do not document.
41
+ */
42
+ store: Store<GridApiCommon['state']>;
37
43
  }
38
44
  export interface GridCorePrivateApi<GridPublicApi extends GridApiCommon, GridPrivateApi extends GridPrivateApiCommon> {
39
45
  /**
@@ -102,8 +102,9 @@ export interface GridBaseColDef<R extends GridValidRowModel = GridValidRowModel,
102
102
  */
103
103
  sortComparator?: GridComparatorFn<V>;
104
104
  /**
105
- * Type allows to merge this object with a default definition [[GridColDef]].
105
+ * The type of the column.
106
106
  * @default 'string'
107
+ * @see See {@link https://mui.com/x/react-data-grid/column-definition/#column-types column types docs} for more details.
107
108
  */
108
109
  type?: GridColType;
109
110
  /**
@@ -230,7 +231,7 @@ export interface GridBaseColDef<R extends GridValidRowModel = GridValidRowModel,
230
231
  */
231
232
  export interface GridActionsColDef<R extends GridValidRowModel = any, V = any, F = V> extends GridBaseColDef<R, V, F> {
232
233
  /**
233
- * Type allows to merge this object with a default definition [[GridColDef]].
234
+ * The type of the column.
234
235
  * @default 'actions'
235
236
  */
236
237
  type: 'actions';
@@ -248,7 +249,7 @@ export interface GridActionsColDef<R extends GridValidRowModel = any, V = any, F
248
249
  */
249
250
  export interface GridSingleSelectColDef<R extends GridValidRowModel = any, V = any, F = V> extends GridBaseColDef<R, V, F> {
250
251
  /**
251
- * Type allows to merge this object with a default definition [[GridColDef]].
252
+ * The type of the column.
252
253
  * @default 'singleSelect'
253
254
  */
254
255
  type: 'singleSelect';
@@ -1,2 +1,4 @@
1
+ type LiteralUnion<LiteralType, BaseType> = LiteralType | (BaseType & Record<never, never>);
1
2
  export type GridNativeColTypes = 'string' | 'number' | 'date' | 'dateTime' | 'boolean' | 'singleSelect' | 'actions';
2
- export type GridColType = GridNativeColTypes | string;
3
+ export type GridColType = LiteralUnion<GridNativeColTypes, string>;
4
+ export {};
@@ -563,20 +563,20 @@ export interface GridEventLookup extends GridRowEventLookup, GridColumnHeaderEve
563
563
  event: React.TouchEvent;
564
564
  };
565
565
  /**
566
- * Fired when the value of the selection checkbox of the header is changed
566
+ * Fired when the value of the selection checkbox of the header is changed.
567
567
  */
568
568
  headerSelectionCheckboxChange: {
569
569
  params: GridHeaderSelectionCheckboxParams;
570
570
  };
571
571
  /**
572
- * Fired when the value of the selection checkbox of a row is changed
572
+ * Fired when the value of the selection checkbox of a row is changed.
573
573
  */
574
574
  rowSelectionCheckboxChange: {
575
575
  params: GridRowSelectionCheckboxParams;
576
576
  event: React.ChangeEvent<HTMLElement>;
577
577
  };
578
578
  /**
579
- * Fired when the data is copied to the clipboard
579
+ * Fired when the data is copied to the clipboard.
580
580
  */
581
581
  clipboardCopy: {
582
582
  params: string;
@@ -3,6 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  const _excluded = ["innerRef", "className", "visibleColumns", "sortColumnLookup", "filterColumnLookup", "columnPositions", "columnHeaderTabIndexState", "columnGroupHeaderTabIndexState", "columnHeaderFocus", "columnGroupHeaderFocus", "densityFactor", "headerGroupingMaxDepth", "columnMenuState", "columnVisibility", "columnGroupsHeaderStructure", "hasOtherElementInTabSequence"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
+ import { fastMemo } from '../utils/fastMemo';
6
7
  import { useGridColumnHeaders } from '../hooks/features/columnHeaders/useGridColumnHeaders';
7
8
  import { GridBaseColumnHeaders } from './columnHeaders/GridBaseColumnHeaders';
8
9
  import { GridColumnHeadersInner } from './columnHeaders/GridColumnHeadersInner';
@@ -100,4 +101,5 @@ process.env.NODE_ENV !== "production" ? GridColumnHeaders.propTypes = {
100
101
  sortColumnLookup: PropTypes.object.isRequired,
101
102
  visibleColumns: PropTypes.arrayOf(PropTypes.object).isRequired
102
103
  } : void 0;
103
- export { GridColumnHeaders };
104
+ const MemoizedGridColumnHeaders = fastMemo(GridColumnHeaders);
105
+ export { MemoizedGridColumnHeaders as GridColumnHeaders };
@@ -1,17 +1,17 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
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", "unstable_updateValueOnRender"];
3
+ const _excluded = ["selected", "rowId", "row", "index", "style", "position", "rowHeight", "className", "visibleColumns", "renderedColumns", "containerWidth", "firstColumnToRender", "lastColumnToRender", "isLastVisible", "focusedCell", "tabbableCell", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave"];
5
4
  import * as React from 'react';
6
5
  import PropTypes from 'prop-types';
7
6
  import clsx from 'clsx';
8
7
  import { unstable_composeClasses as composeClasses, unstable_useForkRef as useForkRef } from '@mui/utils';
8
+ import { fastMemo } from '../utils/fastMemo';
9
9
  import { GridEditModes, GridRowModes, GridCellModes } from '../models/gridEditRowModel';
10
10
  import { useGridApiContext } from '../hooks/utils/useGridApiContext';
11
11
  import { getDataGridUtilityClass, gridClasses } from '../constants/gridClasses';
12
12
  import { useGridRootProps } from '../hooks/utils/useGridRootProps';
13
13
  import { gridColumnsTotalWidthSelector } from '../hooks/features/columns/gridColumnsSelector';
14
- import { useGridSelector } from '../hooks/utils/useGridSelector';
14
+ import { useGridSelector, objectShallowCompare } from '../hooks/utils/useGridSelector';
15
15
  import { useGridVisibleRows } from '../hooks/utils/useGridVisibleRows';
16
16
  import { findParentElementFromClassName } from '../utils/domUtils';
17
17
  import { GRID_CHECKBOX_SELECTION_COL_DEF } from '../colDef/gridCheckboxSelectionColDef';
@@ -21,6 +21,7 @@ import { gridSortModelSelector } from '../hooks/features/sorting/gridSortingSele
21
21
  import { gridRowMaximumTreeDepthSelector } from '../hooks/features/rows/gridRowsSelector';
22
22
  import { gridColumnGroupsHeaderMaxDepthSelector } from '../hooks/features/columnGrouping/gridColumnGroupsSelector';
23
23
  import { randomNumberBetween } from '../utils/utils';
24
+ import { GridCellWrapper, GridCellV7 } from './cell/GridCell';
24
25
  import { gridEditRowsStateSelector } from '../hooks/features/editing/gridEditingSelectors';
25
26
  import { jsx as _jsx } from "react/jsx-runtime";
26
27
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -67,8 +68,6 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
67
68
  containerWidth,
68
69
  firstColumnToRender,
69
70
  isLastVisible = false,
70
- focusedCell,
71
- tabbableCell,
72
71
  onClick,
73
72
  onDoubleClick,
74
73
  onMouseEnter,
@@ -183,78 +182,27 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
183
182
  const {
184
183
  slots,
185
184
  slotProps,
186
- classes: rootClasses,
187
- disableColumnReorder,
188
- getCellClassName
185
+ disableColumnReorder
189
186
  } = rootProps;
187
+ const CellComponent = slots.cell === GridCellV7 ? GridCellV7 : GridCellWrapper;
190
188
  const rowReordering = rootProps.rowReordering;
191
- const CellComponent = slots.cell;
192
- const getCell = React.useCallback((column, cellProps) => {
193
- const cellParams = apiRef.current.getCellParams(rowId, column.field);
194
- const classNames = apiRef.current.unstable_applyPipeProcessors('cellClassName', [], {
195
- id: rowId,
196
- field: column.field
197
- });
189
+ const getCell = (column, cellProps) => {
198
190
  const disableDragEvents = disableColumnReorder && column.disableReorder || !rowReordering && !!sortModel.length && treeDepth > 1 && Object.keys(editRowsState).length > 0;
199
- if (column.cellClassName) {
200
- classNames.push(clsx(typeof column.cellClassName === 'function' ? column.cellClassName(cellParams) : column.cellClassName));
201
- }
202
- const editCellState = editRowsState[rowId] ? editRowsState[rowId][column.field] : null;
203
- let content;
204
- if (editCellState == null && column.renderCell) {
205
- content = column.renderCell(_extends({}, cellParams, {
206
- api: apiRef.current
207
- }));
208
- // TODO move to GridCell
209
- classNames.push(clsx(gridClasses['cell--withRenderer'], rootClasses?.['cell--withRenderer']));
210
- }
211
- if (editCellState != null && column.renderEditCell) {
212
- const updatedRow = apiRef.current.getRowWithUpdatedValues(rowId, column.field);
213
-
214
- // eslint-disable-next-line @typescript-eslint/naming-convention
215
- const editCellStateRest = _objectWithoutPropertiesLoose(editCellState, _excluded2);
216
- const params = _extends({}, cellParams, {
217
- row: updatedRow
218
- }, editCellStateRest, {
219
- api: apiRef.current
220
- });
221
- content = column.renderEditCell(params);
222
- // TODO move to GridCell
223
- classNames.push(clsx(gridClasses['cell--editing'], rootClasses?.['cell--editing']));
224
- }
225
- if (getCellClassName) {
226
- // TODO move to GridCell
227
- classNames.push(getCellClassName(cellParams));
228
- }
229
- const hasFocus = focusedCell === column.field;
230
- const tabIndex = tabbableCell === column.field ? 0 : -1;
231
- const isSelected = apiRef.current.unstable_applyPipeProcessors('isCellSelected', false, {
232
- id: rowId,
233
- field: column.field
234
- });
191
+ const editCellState = editRowsState[rowId]?.[column.field] ?? null;
235
192
  return /*#__PURE__*/_jsx(CellComponent, _extends({
236
- value: cellParams.value,
237
- field: column.field,
193
+ column: column,
238
194
  width: cellProps.width,
239
195
  rowId: rowId,
240
196
  height: rowHeight,
241
197
  showRightBorder: cellProps.showRightBorder,
242
- formattedValue: cellParams.formattedValue,
243
198
  align: column.align || 'left',
244
- cellMode: cellParams.cellMode,
245
199
  colIndex: cellProps.indexRelativeToAllColumns,
246
- isEditable: cellParams.isEditable,
247
- isSelected: isSelected,
248
- hasFocus: hasFocus,
249
- tabIndex: tabIndex,
250
- className: clsx(classNames),
251
200
  colSpan: cellProps.colSpan,
252
- disableDragEvents: disableDragEvents
253
- }, slotProps?.cell, {
254
- children: content
255
- }), column.field);
256
- }, [apiRef, rowId, disableColumnReorder, rowReordering, sortModel.length, treeDepth, editRowsState, getCellClassName, focusedCell, tabbableCell, CellComponent, rowHeight, slotProps?.cell, rootClasses]);
257
- const sizes = apiRef.current.unstable_getRowInternalSizes(rowId);
201
+ disableDragEvents: disableDragEvents,
202
+ editCellState: editCellState
203
+ }, slotProps?.cell), column.field);
204
+ };
205
+ const sizes = useGridSelector(apiRef, () => _extends({}, apiRef.current.unstable_getRowInternalSizes(rowId)), objectShallowCompare);
258
206
  let minHeight = rowHeight;
259
207
  if (minHeight === 'auto' && sizes) {
260
208
  let numberOfBaseSizes = 0;
@@ -303,7 +251,11 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
303
251
  rowClassNames.push(rootProps.getRowClassName(rowParams));
304
252
  }
305
253
  const randomNumber = randomNumberBetween(10000, 20, 80);
306
- const rowType = apiRef.current.getRowNode(rowId).type;
254
+ const rowNode = apiRef.current.getRowNode(rowId);
255
+ if (!rowNode) {
256
+ return null;
257
+ }
258
+ const rowType = rowNode.type;
307
259
  const cells = [];
308
260
  for (let i = 0; i < renderedColumns.length; i += 1) {
309
261
  const column = renderedColumns[i];
@@ -327,7 +279,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
327
279
  width
328
280
  } = cellColSpanInfo.cellProps;
329
281
  const contentWidth = Math.round(randomNumber());
330
- cells.push( /*#__PURE__*/_jsx(rootProps.slots.skeletonCell, {
282
+ cells.push( /*#__PURE__*/_jsx(slots.skeletonCell, {
331
283
  width: width,
332
284
  contentWidth: contentWidth,
333
285
  field: column.field,
@@ -394,4 +346,5 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
394
346
  tabbableCell: PropTypes.string,
395
347
  visibleColumns: PropTypes.arrayOf(PropTypes.object)
396
348
  } : void 0;
397
- export { GridRow };
349
+ const MemoizedGridRow = fastMemo(GridRow);
350
+ export { MemoizedGridRow as GridRow };