@mui/x-data-grid 8.7.0 → 8.9.1

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 (112) hide show
  1. package/CHANGELOG.md +229 -24
  2. package/DataGrid/index.d.ts +0 -1
  3. package/DataGrid/useDataGridComponent.js +8 -0
  4. package/components/GridScrollArea.d.ts +1 -1
  5. package/components/GridScrollArea.js +134 -28
  6. package/components/containers/GridRootStyles.js +41 -0
  7. package/components/virtualization/GridVirtualScroller.js +4 -0
  8. package/constants/gridClasses.d.ts +20 -0
  9. package/constants/gridClasses.js +3 -1
  10. package/esm/DataGrid/index.d.ts +0 -1
  11. package/esm/DataGrid/useDataGridComponent.js +8 -0
  12. package/esm/components/GridScrollArea.d.ts +1 -1
  13. package/esm/components/GridScrollArea.js +134 -28
  14. package/esm/components/containers/GridRootStyles.js +41 -0
  15. package/esm/components/virtualization/GridVirtualScroller.js +4 -0
  16. package/esm/constants/gridClasses.d.ts +20 -0
  17. package/esm/constants/gridClasses.js +3 -1
  18. package/esm/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +5 -0
  19. package/esm/hooks/core/pipeProcessing/useGridPipeProcessing.js +20 -5
  20. package/esm/hooks/core/useGridProps.d.ts +2 -2
  21. package/esm/hooks/core/useGridProps.js +3 -1
  22. package/esm/hooks/features/columnGrouping/gridColumnGroupsInterfaces.d.ts +4 -1
  23. package/esm/hooks/features/columnGrouping/gridColumnGroupsUtils.js +35 -32
  24. package/esm/hooks/features/columnGrouping/useGridColumnGrouping.js +18 -13
  25. package/esm/hooks/features/columns/gridColumnsInterfaces.d.ts +3 -3
  26. package/esm/hooks/features/columns/gridColumnsSelector.js +6 -2
  27. package/esm/hooks/features/columns/gridColumnsUtils.js +6 -4
  28. package/esm/hooks/features/columns/useGridColumns.js +8 -10
  29. package/esm/hooks/features/dataSource/useGridDataSourceBase.d.ts +1 -1
  30. package/esm/hooks/features/dataSource/useGridDataSourceBase.js +3 -0
  31. package/esm/hooks/features/dataSource/utils.js +3 -0
  32. package/esm/hooks/features/export/utils.js +1 -1
  33. package/esm/hooks/features/filter/useGridFilter.js +3 -3
  34. package/esm/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
  35. package/esm/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +5 -9
  36. package/esm/hooks/features/listView/gridListViewSelectors.d.ts +8 -1
  37. package/esm/hooks/features/listView/gridListViewSelectors.js +7 -0
  38. package/esm/hooks/features/rowSelection/useGridRowSelection.js +5 -4
  39. package/esm/hooks/features/rows/gridRowsUtils.d.ts +1 -1
  40. package/esm/hooks/features/rows/gridRowsUtils.js +5 -2
  41. package/esm/hooks/features/rows/useGridRows.js +4 -3
  42. package/esm/hooks/features/scroll/useGridScroll.d.ts +1 -1
  43. package/esm/hooks/features/scroll/useGridScroll.js +2 -3
  44. package/esm/hooks/features/virtualization/useGridVirtualScroller.js +3 -6
  45. package/esm/hooks/utils/index.d.ts +1 -0
  46. package/esm/hooks/utils/index.js +2 -1
  47. package/esm/hooks/utils/useGridInitializeState.d.ts +1 -1
  48. package/esm/hooks/utils/useGridInitializeState.js +6 -1
  49. package/esm/hooks/utils/useGridSelector.js +4 -0
  50. package/esm/hooks/utils/useRunOncePerLoop.d.ts +1 -0
  51. package/esm/hooks/utils/useRunOncePerLoop.js +26 -0
  52. package/esm/index.js +1 -1
  53. package/esm/internals/utils/cache.d.ts +9 -0
  54. package/esm/internals/utils/cache.js +19 -0
  55. package/esm/internals/utils/index.d.ts +2 -1
  56. package/esm/internals/utils/index.js +2 -1
  57. package/esm/locales/idID.d.ts +4 -0
  58. package/esm/locales/idID.js +261 -0
  59. package/esm/locales/index.d.ts +2 -1
  60. package/esm/locales/index.js +2 -1
  61. package/esm/models/api/gridRowApi.d.ts +5 -0
  62. package/esm/models/events/gridEventLookup.d.ts +2 -1
  63. package/esm/models/gridApiCaches.d.ts +8 -2
  64. package/esm/models/gridStateCommunity.d.ts +2 -2
  65. package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +5 -0
  66. package/hooks/core/pipeProcessing/useGridPipeProcessing.js +20 -5
  67. package/hooks/core/useGridProps.d.ts +2 -2
  68. package/hooks/core/useGridProps.js +3 -1
  69. package/hooks/features/columnGrouping/gridColumnGroupsInterfaces.d.ts +4 -1
  70. package/hooks/features/columnGrouping/gridColumnGroupsUtils.js +35 -32
  71. package/hooks/features/columnGrouping/useGridColumnGrouping.js +18 -13
  72. package/hooks/features/columns/gridColumnsInterfaces.d.ts +3 -3
  73. package/hooks/features/columns/gridColumnsSelector.js +6 -2
  74. package/hooks/features/columns/gridColumnsUtils.js +6 -4
  75. package/hooks/features/columns/useGridColumns.js +8 -10
  76. package/hooks/features/dataSource/useGridDataSourceBase.d.ts +1 -1
  77. package/hooks/features/dataSource/useGridDataSourceBase.js +3 -0
  78. package/hooks/features/dataSource/utils.js +3 -0
  79. package/hooks/features/export/utils.js +1 -1
  80. package/hooks/features/filter/useGridFilter.js +3 -3
  81. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
  82. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +5 -9
  83. package/hooks/features/listView/gridListViewSelectors.d.ts +8 -1
  84. package/hooks/features/listView/gridListViewSelectors.js +8 -1
  85. package/hooks/features/rowSelection/useGridRowSelection.js +5 -4
  86. package/hooks/features/rows/gridRowsUtils.d.ts +1 -1
  87. package/hooks/features/rows/gridRowsUtils.js +5 -2
  88. package/hooks/features/rows/useGridRows.js +4 -3
  89. package/hooks/features/scroll/useGridScroll.d.ts +1 -1
  90. package/hooks/features/scroll/useGridScroll.js +2 -3
  91. package/hooks/features/virtualization/useGridVirtualScroller.js +3 -6
  92. package/hooks/utils/index.d.ts +1 -0
  93. package/hooks/utils/index.js +12 -0
  94. package/hooks/utils/useGridInitializeState.d.ts +1 -1
  95. package/hooks/utils/useGridInitializeState.js +6 -1
  96. package/hooks/utils/useGridSelector.js +4 -0
  97. package/hooks/utils/useRunOncePerLoop.d.ts +1 -0
  98. package/hooks/utils/useRunOncePerLoop.js +33 -0
  99. package/index.js +1 -1
  100. package/internals/utils/cache.d.ts +9 -0
  101. package/internals/utils/cache.js +26 -0
  102. package/internals/utils/index.d.ts +2 -1
  103. package/internals/utils/index.js +11 -0
  104. package/locales/idID.d.ts +4 -0
  105. package/locales/idID.js +267 -0
  106. package/locales/index.d.ts +2 -1
  107. package/locales/index.js +11 -0
  108. package/models/api/gridRowApi.d.ts +5 -0
  109. package/models/events/gridEventLookup.d.ts +2 -1
  110. package/models/gridApiCaches.d.ts +8 -2
  111. package/models/gridStateCommunity.d.ts +2 -2
  112. package/package.json +3 -3
@@ -0,0 +1,261 @@
1
+ import { getGridLocalization } from "../utils/getGridLocalization.js";
2
+ export const idIDGrid = {
3
+ // Root
4
+ noRowsLabel: 'Tidak ad abaris',
5
+ noResultsOverlayLabel: 'Tidak ada hasil yang ditemukan.',
6
+ noColumnsOverlayLabel: 'Tidak ada kolom',
7
+ noColumnsOverlayManageColumns: 'Kelola columns',
8
+ emptyPivotOverlayLabel: 'Tambahkan bidang ke baris, kolom, dan nilai untuk membuat tabel pivot',
9
+ // Density selector toolbar button text
10
+ toolbarDensity: 'Kepadatan',
11
+ toolbarDensityLabel: 'Kepadatan',
12
+ toolbarDensityCompact: 'Ringkas',
13
+ toolbarDensityStandard: 'Standar',
14
+ toolbarDensityComfortable: 'Nyaman',
15
+ // Columns selector toolbar button text
16
+ toolbarColumns: 'Kolom',
17
+ toolbarColumnsLabel: 'Pilih kolom',
18
+ // Filters toolbar button text
19
+ toolbarFilters: 'Filter',
20
+ toolbarFiltersLabel: 'Tampilkan filter',
21
+ toolbarFiltersTooltipHide: 'Sembunyikan filter',
22
+ toolbarFiltersTooltipShow: 'Tampilkan filter',
23
+ toolbarFiltersTooltipActive: count => `${count} filter aktif`,
24
+ // Quick filter toolbar field
25
+ toolbarQuickFilterPlaceholder: 'Cari…',
26
+ toolbarQuickFilterLabel: 'Cari',
27
+ toolbarQuickFilterDeleteIconLabel: 'Hapus',
28
+ // Export selector toolbar button text
29
+ toolbarExport: 'Ekspor',
30
+ toolbarExportLabel: 'Ekspor',
31
+ toolbarExportCSV: 'Unduh sebagai CSV',
32
+ toolbarExportPrint: 'Cetak',
33
+ toolbarExportExcel: 'Unduh sebagai Excel',
34
+ // Toolbar pivot button
35
+ toolbarPivot: 'Pivot',
36
+ // Toolbar AI Assistant button
37
+ toolbarAssistant: 'Asisten AI',
38
+ // Columns management text
39
+ columnsManagementSearchTitle: 'Cari',
40
+ columnsManagementNoColumns: 'Tidak ada kolom',
41
+ columnsManagementShowHideAllText: 'Tampilkan/Sembunyikan Semua',
42
+ columnsManagementReset: 'Atur ulang',
43
+ columnsManagementDeleteIconLabel: 'Hapus',
44
+ // Filter panel text
45
+ filterPanelAddFilter: 'Tambahkan filter',
46
+ filterPanelRemoveAll: 'Hapus semua',
47
+ filterPanelDeleteIconLabel: 'Hapus',
48
+ filterPanelLogicOperator: 'Operator logika',
49
+ filterPanelOperator: 'Operator',
50
+ filterPanelOperatorAnd: 'Dan',
51
+ filterPanelOperatorOr: 'Atau',
52
+ filterPanelColumns: 'Kolom',
53
+ filterPanelInputLabel: 'Nilai',
54
+ filterPanelInputPlaceholder: 'Nilai filter',
55
+ // Filter operators text
56
+ filterOperatorContains: 'berisi',
57
+ filterOperatorDoesNotContain: 'tidak berisi',
58
+ filterOperatorEquals: 'sama dengan',
59
+ filterOperatorDoesNotEqual: 'tidak sama dengan',
60
+ filterOperatorStartsWith: 'diawali dengan',
61
+ filterOperatorEndsWith: 'diakhiri dengan',
62
+ filterOperatorIs: 'adalah',
63
+ filterOperatorNot: 'bukan',
64
+ filterOperatorAfter: 'setelah',
65
+ filterOperatorOnOrAfter: 'pada atau setelah',
66
+ filterOperatorBefore: 'sebelum',
67
+ filterOperatorOnOrBefore: 'pada atau sebelum',
68
+ filterOperatorIsEmpty: 'kosong',
69
+ filterOperatorIsNotEmpty: 'tidak kosong',
70
+ filterOperatorIsAnyOf: 'salah satu dari',
71
+ 'filterOperator=': '=',
72
+ 'filterOperator!=': '!=',
73
+ 'filterOperator>': '>',
74
+ 'filterOperator>=': '>=',
75
+ 'filterOperator<': '<',
76
+ 'filterOperator<=': '<=',
77
+ // Header filter operators text
78
+ headerFilterOperatorContains: 'Mengandung',
79
+ headerFilterOperatorDoesNotContain: 'Tidak mengandung',
80
+ headerFilterOperatorEquals: 'Sama dengan',
81
+ headerFilterOperatorDoesNotEqual: 'Tidak sama dengan',
82
+ headerFilterOperatorStartsWith: 'Diawali dengan',
83
+ headerFilterOperatorEndsWith: 'Diakhiri dengan',
84
+ headerFilterOperatorIs: 'Adalah',
85
+ headerFilterOperatorNot: 'Bukan',
86
+ headerFilterOperatorAfter: 'Setelah',
87
+ headerFilterOperatorOnOrAfter: 'Pada atau setelah',
88
+ headerFilterOperatorBefore: 'Sebelum',
89
+ headerFilterOperatorOnOrBefore: 'Pada atau sebelum',
90
+ headerFilterOperatorIsEmpty: 'Kosong',
91
+ headerFilterOperatorIsNotEmpty: 'Tidak kosong',
92
+ headerFilterOperatorIsAnyOf: 'Salah satu dari',
93
+ 'headerFilterOperator=': 'Sama dengan',
94
+ 'headerFilterOperator!=': 'Tidak sama dengan',
95
+ 'headerFilterOperator>': 'Lebih dari',
96
+ 'headerFilterOperator>=': 'Lebih dari atau sama dengan',
97
+ 'headerFilterOperator<': 'Kurang dari',
98
+ 'headerFilterOperator<=': 'Kurang dari atau sama dengan',
99
+ headerFilterClear: 'Hapus filter',
100
+ // Filter values text
101
+ filterValueAny: 'apa saja',
102
+ filterValueTrue: 'benar',
103
+ filterValueFalse: 'salah',
104
+ // Column menu text
105
+ columnMenuLabel: 'Menu',
106
+ columnMenuAriaLabel: columnName => `Menu kolom ${columnName}`,
107
+ columnMenuShowColumns: 'Tampilkan kolom',
108
+ columnMenuManageColumns: 'Kelola kolom',
109
+ columnMenuFilter: 'Filter',
110
+ columnMenuHideColumn: 'Sembunyikan kolom',
111
+ columnMenuUnsort: 'Batalkan urutan',
112
+ columnMenuSortAsc: 'Urutkan menaik',
113
+ columnMenuSortDesc: 'Urutkan menurun',
114
+ columnMenuManagePivot: 'Kelola pivot',
115
+ // Column header text
116
+ columnHeaderFiltersTooltipActive: count => `${count} filter aktif`,
117
+ columnHeaderFiltersLabel: 'Tampilkan filter',
118
+ columnHeaderSortIconLabel: 'Urutkan',
119
+ // Rows selected footer text
120
+ footerRowSelected: count => `${count.toLocaleString()} baris dipilih`,
121
+ // Total row amount footer text
122
+ footerTotalRows: 'Total Baris:',
123
+ // Total visible row amount footer text
124
+ footerTotalVisibleRows: (visibleCount, totalCount) => `${visibleCount.toLocaleString()} dari ${totalCount.toLocaleString()}`,
125
+ // Checkbox selection text
126
+ checkboxSelectionHeaderName: 'Pilihan kotak centang',
127
+ checkboxSelectionSelectAllRows: 'Pilih semua baris',
128
+ checkboxSelectionUnselectAllRows: 'Batal pilih semua baris',
129
+ checkboxSelectionSelectRow: 'Pilih baris',
130
+ checkboxSelectionUnselectRow: 'Batal pilih baris',
131
+ // Boolean cell text
132
+ booleanCellTrueLabel: 'ya',
133
+ booleanCellFalseLabel: 'tidak',
134
+ // Actions cell more text
135
+ actionsCellMore: 'lainnya',
136
+ // Column pinning text
137
+ pinToLeft: 'Sematkan ke kiri',
138
+ pinToRight: 'Sematkan ke kanan',
139
+ unpin: 'Lepas sematan',
140
+ // Tree Data
141
+ treeDataGroupingHeaderName: 'Kelompok',
142
+ treeDataExpand: 'lihat turunan',
143
+ treeDataCollapse: 'sembunyikan turunan',
144
+ // Grouping columns
145
+ groupingColumnHeaderName: 'Kelompok',
146
+ groupColumn: name => `Kelompokkan berdasarkan ${name}`,
147
+ unGroupColumn: name => `Hentikan pengelompokan berdasarkan ${name}`,
148
+ // Master/detail
149
+ detailPanelToggle: 'Pengalih panel detail',
150
+ expandDetailPanel: 'Perluas',
151
+ collapseDetailPanel: 'Ciutkan',
152
+ // Pagination
153
+ paginationRowsPerPage: 'Baris per halaman:',
154
+ paginationDisplayedRows: ({
155
+ from,
156
+ to,
157
+ count,
158
+ estimated
159
+ }) => {
160
+ if (!estimated) {
161
+ return `${from}–${to} dari ${count !== -1 ? count : `lebih dari ${to}`}`;
162
+ }
163
+ const estimatedLabel = estimated && estimated > to ? `sekitar ${estimated}` : `lebih dari ${to}`;
164
+ return `${from}–${to} dari ${count !== -1 ? count : estimatedLabel}`;
165
+ },
166
+ paginationItemAriaLabel: type => {
167
+ if (type === 'first') {
168
+ return 'Pergi ke halaman pertama';
169
+ }
170
+ if (type === 'last') {
171
+ return 'Pergi ke halaman terakhir';
172
+ }
173
+ if (type === 'next') {
174
+ return 'Pergi ke halaman berikutnya';
175
+ }
176
+ // if (type === 'previous') {
177
+ return 'Pergi ke halaman sebelumnya';
178
+ },
179
+ // Row reordering text
180
+ rowReorderingHeaderName: 'Pengurutan ulang baris',
181
+ // Aggregation
182
+ aggregationMenuItemHeader: 'Agregasi',
183
+ aggregationFunctionLabelSum: 'jumlah',
184
+ aggregationFunctionLabelAvg: 'rata-rata',
185
+ aggregationFunctionLabelMin: 'min',
186
+ aggregationFunctionLabelMax: 'maks',
187
+ aggregationFunctionLabelSize: 'ukuran',
188
+ // Pivot panel
189
+ pivotToggleLabel: 'Pivot',
190
+ pivotRows: 'Baris',
191
+ pivotColumns: 'Kolom',
192
+ pivotValues: 'Nilai',
193
+ pivotCloseButton: 'Tutup pengaturan pivot',
194
+ pivotSearchButton: 'Cari bidang',
195
+ pivotSearchControlPlaceholder: 'Cari bidang',
196
+ pivotSearchControlLabel: 'Cari bidang',
197
+ pivotSearchControlClear: 'Hapus pencarian',
198
+ pivotNoFields: 'Tidak ada bidang',
199
+ pivotMenuMoveUp: 'Pindah ke atas',
200
+ pivotMenuMoveDown: 'Pindah ke bawah',
201
+ pivotMenuMoveToTop: 'Pindah ke paling atas',
202
+ pivotMenuMoveToBottom: 'Pindah ke paling bawah',
203
+ pivotMenuRows: 'Baris',
204
+ pivotMenuColumns: 'Kolom',
205
+ pivotMenuValues: 'Nilai',
206
+ pivotMenuOptions: 'Opsi bidang',
207
+ pivotMenuAddToRows: 'Tambahkan ke Baris',
208
+ pivotMenuAddToColumns: 'Tambahkan ke Kolom',
209
+ pivotMenuAddToValues: 'Tambahkan ke Nilai',
210
+ pivotMenuRemove: 'Hapus',
211
+ pivotDragToRows: 'Seret ke sini untuk membuat baris',
212
+ pivotDragToColumns: 'Seret ke sini untuk membuat kolom',
213
+ pivotDragToValues: 'Seret ke sini untuk membuat nilai',
214
+ pivotYearColumnHeaderName: '(Tahun)',
215
+ pivotQuarterColumnHeaderName: '(Kuartal)',
216
+ // AI Assistant panel
217
+ aiAssistantPanelTitle: 'Asisten AI',
218
+ aiAssistantPanelClose: 'Tutup Asisten AI',
219
+ aiAssistantPanelNewConversation: 'Percakapan baru',
220
+ aiAssistantPanelConversationHistory: 'Riwayat percakapan',
221
+ aiAssistantPanelEmptyConversation: 'Tidak ada riwayat percakapan',
222
+ aiAssistantSuggestions: 'Saran',
223
+ // Prompt field
224
+ promptFieldLabel: 'Perintah',
225
+ promptFieldPlaceholder: 'Ketik perintah…',
226
+ promptFieldPlaceholderWithRecording: 'Ketik atau rekam perintah…',
227
+ promptFieldPlaceholderListening: 'Mendengarkan perintah',
228
+ promptFieldSpeechRecognitionNotSupported: 'Pengenalan suara tidak didukung di browser ini',
229
+ promptFieldSend: 'Kirim',
230
+ promptFieldRecord: 'Rekam',
231
+ promptFieldStopRecording: 'Hentikan perekaman',
232
+ // Prompt
233
+ promptRerun: 'Jalankan lagi',
234
+ promptProcessing: 'Memproses…',
235
+ promptAppliedChanges: 'Perubahan diterapkan',
236
+ // Prompt changes
237
+ promptChangeGroupDescription: column => `Kelompokkan berdasarkan ${column}`,
238
+ promptChangeAggregationLabel: (column, aggregation) => `${column} (${aggregation})`,
239
+ promptChangeAggregationDescription: (column, aggregation) => `Agregasikan ${column} (${aggregation})`,
240
+ promptChangeFilterLabel: (column, operator, value) => {
241
+ if (operator === 'is any of') {
242
+ return `${column} salah satu dari: ${value}`;
243
+ }
244
+ return `${column} ${operator} ${value}`;
245
+ },
246
+ promptChangeFilterDescription: (column, operator, value) => {
247
+ if (operator === 'is any of') {
248
+ return `Filter di mana ${column} salah satu dari: ${value}`;
249
+ }
250
+ return `Filter di mana ${column} ${operator} ${value}`;
251
+ },
252
+ promptChangeSortDescription: (column, direction) => `Urutkan berdasarkan ${column} (${direction})`,
253
+ promptChangePivotEnableLabel: 'Pivot',
254
+ promptChangePivotEnableDescription: 'Aktifkan pivot',
255
+ promptChangePivotColumnsLabel: count => `Kolom (${count})`,
256
+ promptChangePivotColumnsDescription: (column, direction) => `${column}${direction ? ` (${direction})` : ''}`,
257
+ promptChangePivotRowsLabel: count => `Baris (${count})`,
258
+ promptChangePivotValuesLabel: count => `Nilai (${count})`,
259
+ promptChangePivotValuesDescription: (column, aggregation) => `${column} (${aggregation})`
260
+ };
261
+ export const idID = getGridLocalization(idIDGrid);
@@ -35,4 +35,5 @@ export * from "./zhTW.js";
35
35
  export * from "./hrHR.js";
36
36
  export * from "./ptPT.js";
37
37
  export * from "./zhHK.js";
38
- export * from "./isIS.js";
38
+ export * from "./isIS.js";
39
+ export * from "./idID.js";
@@ -36,4 +36,5 @@ export * from "./zhTW.js";
36
36
  export * from "./hrHR.js";
37
37
  export * from "./ptPT.js";
38
38
  export * from "./zhHK.js";
39
- export * from "./isIS.js";
39
+ export * from "./isIS.js";
40
+ export * from "./idID.js";
@@ -19,6 +19,11 @@ export interface GridRowGroupChildrenGetterParams {
19
19
  * @default false
20
20
  */
21
21
  applySorting?: boolean;
22
+ /**
23
+ * If `true`, the method will only return the direct leaf children of the group
24
+ * @default false
25
+ */
26
+ directChildrenOnly?: boolean;
22
27
  }
23
28
  /**
24
29
  * The Row API interface that is available in the grid `apiRef`.
@@ -77,11 +77,12 @@ export interface GridRowEventLookup {
77
77
  };
78
78
  /**
79
79
  * Fired when the dragging of a row ends.
80
+ * It's mapped to the `dragend` DOM event.
80
81
  * @ignore - do not document.
81
82
  */
82
83
  rowDragEnd: {
83
84
  params: GridRowParams;
84
- event: React.DragEvent<HTMLElement>;
85
+ event: DragEvent;
85
86
  };
86
87
  }
87
88
  export interface GridColumnHeaderEventLookup {
@@ -1,6 +1,12 @@
1
- import { GridRowsInternalCache } from "../hooks/features/rows/gridRowsInterfaces.js";
2
- import { GridRowsMetaInternalCache } from "../hooks/features/rows/gridRowsMetaInterfaces.js";
1
+ import type { GridRowsInternalCache } from "../hooks/features/rows/gridRowsInterfaces.js";
2
+ import type { GridRowsMetaInternalCache } from "../hooks/features/rows/gridRowsMetaInterfaces.js";
3
+ import type { GridColumnGroupingInternalCache } from "../hooks/features/columnGrouping/gridColumnGroupsInterfaces.js";
4
+ import type { GridColDef } from "./colDef/index.js";
3
5
  export interface GridApiCaches {
6
+ columns: {
7
+ lastColumnsProp: readonly GridColDef[];
8
+ };
9
+ columnGrouping: GridColumnGroupingInternalCache;
4
10
  rows: GridRowsInternalCache;
5
11
  rowsMeta: GridRowsMetaInternalCache;
6
12
  }
@@ -1,5 +1,5 @@
1
1
  import type { GridColumnMenuState, GridColumnsInitialState, GridColumnsState, GridColumnsGroupingState, GridColumnPinningState, GridDensityState, GridDimensionsState, GridFilterInitialState, GridFilterState, GridFocusState, GridPaginationInitialState, GridPaginationState, GridPreferencePanelInitialState, GridPreferencePanelState, GridRowsState, GridSortingInitialState, GridSortingState, GridTabIndexState, GridVirtualizationState } from "../hooks/index.js";
2
- import type { DataGridProps } from "./props/DataGridProps.js";
2
+ import type { DataGridProcessedProps } from "./props/DataGridProps.js";
3
3
  import type { GridRowsMetaState } from "../hooks/features/rows/gridRowsMetaState.js";
4
4
  import type { GridEditingState } from "./gridEditRowModel.js";
5
5
  import { GridHeaderFilteringState } from "./gridHeaderFilteringModel.js";
@@ -12,7 +12,7 @@ import type { GridListViewState } from "../hooks/features/listView/useGridListVi
12
12
  * Some props are passed on the state to enable grid selectors to select
13
13
  * and react to them.
14
14
  */
15
- type GridStateProps = Pick<DataGridProps, 'getRowId'>;
15
+ type GridStateProps = Pick<DataGridProcessedProps, 'getRowId' | 'listView'>;
16
16
  /**
17
17
  * The state of Data Grid.
18
18
  */
@@ -138,5 +138,10 @@ export interface GridPipeProcessingPrivateApi {
138
138
  * @param {GridPipeProcessorGroup} group The group to apply.
139
139
  */
140
140
  requestPipeProcessorsApplication: (group: GridPipeProcessorGroup) => void;
141
+ /**
142
+ * Checks of there are any processors that have been updated and runs appliers for them.
143
+ * It is intended to be called in a useEffect in the top-level data grid hook (`useDataGridComponent`).
144
+ */
145
+ runAppliersForPendingProcessors: () => void;
141
146
  }
142
147
  export {};
@@ -57,7 +57,8 @@ const useGridPipeProcessing = apiRef => {
57
57
  cache.current[group] = {
58
58
  processors: new Map(),
59
59
  processorsAsArray: [],
60
- appliers: {}
60
+ appliers: {},
61
+ processorsUpdated: false
61
62
  };
62
63
  }
63
64
  const groupCache = cache.current[group];
@@ -65,19 +66,20 @@ const useGridPipeProcessing = apiRef => {
65
66
  if (oldProcessor !== processor) {
66
67
  groupCache.processors.set(id, processor);
67
68
  groupCache.processorsAsArray = Array.from(cache.current[group].processors.values()).filter(processorValue => processorValue !== null);
68
- runAppliers(groupCache);
69
+ groupCache.processorsUpdated = true;
69
70
  }
70
71
  return () => {
71
72
  cache.current[group].processors.set(id, null);
72
73
  cache.current[group].processorsAsArray = Array.from(cache.current[group].processors.values()).filter(processorValue => processorValue !== null);
73
74
  };
74
- }, [runAppliers]);
75
+ }, []);
75
76
  const registerPipeApplier = React.useCallback((group, id, applier) => {
76
77
  if (!cache.current[group]) {
77
78
  cache.current[group] = {
78
79
  processors: new Map(),
79
80
  processorsAsArray: [],
80
- appliers: {}
81
+ appliers: {},
82
+ processorsUpdated: false
81
83
  };
82
84
  }
83
85
  cache.current[group].appliers[id] = applier;
@@ -90,6 +92,18 @@ const useGridPipeProcessing = apiRef => {
90
92
  const requestPipeProcessorsApplication = React.useCallback(group => {
91
93
  runAppliers(cache.current[group]);
92
94
  }, [runAppliers]);
95
+ const runAppliersForPendingProcessors = React.useCallback(() => {
96
+ for (const group in cache.current) {
97
+ if (!Object.prototype.hasOwnProperty.call(cache.current, group)) {
98
+ continue;
99
+ }
100
+ const groupCache = cache.current[group];
101
+ if (groupCache.processorsUpdated) {
102
+ groupCache.processorsUpdated = false;
103
+ runAppliers(groupCache);
104
+ }
105
+ }
106
+ }, [runAppliers]);
93
107
  const applyPipeProcessors = React.useCallback((...args) => {
94
108
  const [group, value, context] = args;
95
109
  if (!cache.current[group]) {
@@ -105,7 +119,8 @@ const useGridPipeProcessing = apiRef => {
105
119
  const preProcessingPrivateApi = {
106
120
  registerPipeProcessor,
107
121
  registerPipeApplier,
108
- requestPipeProcessorsApplication
122
+ requestPipeProcessorsApplication,
123
+ runAppliersForPendingProcessors
109
124
  };
110
125
  const preProcessingPublicApi = {
111
126
  unstable_applyPipeProcessors: applyPipeProcessors
@@ -1,8 +1,8 @@
1
1
  import type { RefObject } from '@mui/x-internals/types';
2
- import type { DataGridProps } from "../../models/props/DataGridProps.js";
2
+ import type { DataGridProcessedProps } from "../../models/props/DataGridProps.js";
3
3
  import type { GridPrivateApiCommon } from "../../models/api/gridApiCommon.js";
4
4
  import type { GridStateInitializer } from "../utils/useGridInitializeState.js";
5
- type Props = Pick<DataGridProps, 'getRowId'>;
5
+ type Props = Pick<DataGridProcessedProps, 'getRowId' | 'listView'>;
6
6
  export declare const propsStateInitializer: GridStateInitializer<Props>;
7
7
  export declare const useGridProps: <PrivateApi extends GridPrivateApiCommon>(apiRef: RefObject<PrivateApi>, props: Props) => void;
8
8
  export {};
@@ -12,6 +12,7 @@ var React = _interopRequireWildcard(require("react"));
12
12
  const propsStateInitializer = (state, props) => {
13
13
  return (0, _extends2.default)({}, state, {
14
14
  props: {
15
+ listView: props.listView,
15
16
  getRowId: props.getRowId
16
17
  }
17
18
  });
@@ -21,9 +22,10 @@ const useGridProps = (apiRef, props) => {
21
22
  React.useEffect(() => {
22
23
  apiRef.current.setState(state => (0, _extends2.default)({}, state, {
23
24
  props: {
25
+ listView: props.listView,
24
26
  getRowId: props.getRowId
25
27
  }
26
28
  }));
27
- }, [apiRef, props.getRowId]);
29
+ }, [apiRef, props.listView, props.getRowId]);
28
30
  };
29
31
  exports.useGridProps = useGridProps;
@@ -1,4 +1,4 @@
1
- import { GridColumnGroup } from "../../../models/gridColumnGrouping.js";
1
+ import { GridColumnGroup, GridColumnGroupingModel } from "../../../models/gridColumnGrouping.js";
2
2
  export type GridColumnGroupLookup = {
3
3
  [groupId: string]: Omit<GridColumnGroup, 'children'>;
4
4
  };
@@ -13,4 +13,7 @@ export interface GridColumnsGroupingState {
13
13
  [columnField: string]: GridColumnGroup['groupId'][];
14
14
  };
15
15
  maxDepth: number;
16
+ }
17
+ export interface GridColumnGroupingInternalCache {
18
+ lastColumnGroupingModel?: GridColumnGroupingModel;
16
19
  }
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.unwrapGroupingColumnModel = exports.getColumnGroupsHeaderStructure = void 0;
7
- var _isDeepEqual = require("@mui/x-internals/isDeepEqual");
8
7
  var _gridColumnGrouping = require("../../../models/gridColumnGrouping");
9
8
  // This is the recurrence function that help writing `unwrapGroupingColumnModel()`
10
9
  const recurrentUnwrapGroupingColumnModel = (columnGroupNode, parents, unwrappedGroupingModelToComplete) => {
@@ -44,45 +43,49 @@ exports.unwrapGroupingColumnModel = unwrapGroupingColumnModel;
44
43
  const getColumnGroupsHeaderStructure = (orderedColumns, unwrappedGroupingModel, pinnedFields) => {
45
44
  const getParents = field => unwrappedGroupingModel[field] ?? [];
46
45
  const groupingHeaderStructure = [];
47
- const maxDepth = Math.max(...orderedColumns.map(field => getParents(field).length));
48
- const haveSameParents = (field1, field2, depth) => (0, _isDeepEqual.isDeepEqual)(getParents(field1).slice(0, depth + 1), getParents(field2).slice(0, depth + 1));
49
- const haveDifferentContainers = (field1, field2) => {
50
- if (pinnedFields?.left && pinnedFields.left.includes(field1) && !pinnedFields.left.includes(field2)) {
51
- return true;
52
- }
53
- if (pinnedFields?.right && !pinnedFields.right.includes(field1) && pinnedFields.right.includes(field2)) {
54
- return true;
46
+ const maxDepth = Math.max(0, ...orderedColumns.map(field => getParents(field).length));
47
+ const haveSameParents = (field1, field2, depth) => {
48
+ const a = getParents(field1);
49
+ const b = getParents(field2);
50
+ for (let i = 0; i <= depth; i += 1) {
51
+ if (a[i] !== b[i]) {
52
+ return false;
53
+ }
55
54
  }
56
- return false;
55
+ return true;
56
+ };
57
+ const haveDifferentContainers = (field1, field2) => {
58
+ const left = pinnedFields?.left;
59
+ const right = pinnedFields?.right;
60
+ const inLeft1 = !!left?.includes(field1);
61
+ const inLeft2 = !!left?.includes(field2);
62
+ const inRight1 = !!right?.includes(field1);
63
+ const inRight2 = !!right?.includes(field2);
64
+ return inLeft1 !== inLeft2 || inRight1 !== inRight2;
57
65
  };
58
66
  for (let depth = 0; depth < maxDepth; depth += 1) {
59
- const depthStructure = orderedColumns.reduce((structure, newField) => {
60
- const groupId = getParents(newField)[depth] ?? null;
61
- if (structure.length === 0) {
62
- return [{
63
- columnFields: [newField],
67
+ const depthStructure = [];
68
+ for (let i = 0; i < orderedColumns.length; i += 1) {
69
+ const field = orderedColumns[i];
70
+ const groupId = getParents(field)[depth] ?? null;
71
+ if (depthStructure.length === 0) {
72
+ depthStructure.push({
73
+ columnFields: [field],
64
74
  groupId
65
- }];
75
+ });
76
+ continue;
66
77
  }
67
- const lastGroup = structure[structure.length - 1];
78
+ const lastGroup = depthStructure[depthStructure.length - 1];
68
79
  const prevField = lastGroup.columnFields[lastGroup.columnFields.length - 1];
69
- const prevGroupId = lastGroup.groupId;
70
- if (prevGroupId !== groupId || !haveSameParents(prevField, newField, depth) ||
71
- // Fix for https://github.com/mui/mui-x/issues/7041
72
- haveDifferentContainers(prevField, newField)) {
73
- // It's a new group
74
- return [...structure, {
75
- columnFields: [newField],
80
+ if (lastGroup.groupId !== groupId || !haveSameParents(prevField, field, depth) || haveDifferentContainers(prevField, field)) {
81
+ depthStructure.push({
82
+ columnFields: [field],
76
83
  groupId
77
- }];
84
+ });
85
+ } else {
86
+ lastGroup.columnFields.push(field);
78
87
  }
79
-
80
- // It extends the previous group
81
- return [...structure.slice(0, structure.length - 1), {
82
- columnFields: [...lastGroup.columnFields, newField],
83
- groupId
84
- }];
85
- }, []);
88
+ }
86
89
  groupingHeaderStructure.push(depthStructure);
87
90
  }
88
91
  return groupingHeaderStructure;
@@ -18,10 +18,11 @@ var _useGridEvent = require("../../utils/useGridEvent");
18
18
  var _columns = require("../columns");
19
19
  const _excluded = ["groupId", "children"];
20
20
  const createGroupLookup = columnGroupingModel => {
21
- let groupLookup = {};
22
- columnGroupingModel.forEach(node => {
21
+ const groupLookup = {};
22
+ for (let i = 0; i < columnGroupingModel.length; i += 1) {
23
+ const node = columnGroupingModel[i];
23
24
  if ((0, _gridColumnGrouping.isLeaf)(node)) {
24
- return;
25
+ continue;
25
26
  }
26
27
  const {
27
28
  groupId,
@@ -31,10 +32,8 @@ const createGroupLookup = columnGroupingModel => {
31
32
  if (!groupId) {
32
33
  throw new Error('MUI X: An element of the columnGroupingModel does not have either `field` or `groupId`.');
33
34
  }
34
- if (process.env.NODE_ENV !== 'production') {
35
- if (!children) {
36
- console.warn(`MUI X: group groupId=${groupId} has no children.`);
37
- }
35
+ if (process.env.NODE_ENV !== 'production' && !children) {
36
+ console.warn(`MUI X: group groupId=${groupId} has no children.`);
38
37
  }
39
38
  const groupParam = (0, _extends2.default)({}, other, {
40
39
  groupId
@@ -43,13 +42,15 @@ const createGroupLookup = columnGroupingModel => {
43
42
  if (subTreeLookup[groupId] !== undefined || groupLookup[groupId] !== undefined) {
44
43
  throw new Error(`MUI X: The groupId ${groupId} is used multiple times in the columnGroupingModel.`);
45
44
  }
46
- groupLookup = (0, _extends2.default)({}, groupLookup, subTreeLookup, {
47
- [groupId]: groupParam
48
- });
49
- });
50
- return (0, _extends2.default)({}, groupLookup);
45
+ Object.assign(groupLookup, subTreeLookup);
46
+ groupLookup[groupId] = groupParam;
47
+ }
48
+ return groupLookup;
51
49
  };
52
50
  const columnGroupsStateInitializer = (state, props, apiRef) => {
51
+ apiRef.current.caches.columnGrouping = {
52
+ lastColumnGroupingModel: props.columnGroupingModel
53
+ };
53
54
  if (!props.columnGroupingModel) {
54
55
  return state;
55
56
  }
@@ -105,6 +106,7 @@ const useGridColumnGrouping = (apiRef, props) => {
105
106
  });
106
107
  }, [apiRef, props.columnGroupingModel]);
107
108
  const updateColumnGroupingState = React.useCallback(columnGroupingModel => {
109
+ apiRef.current.caches.columnGrouping.lastColumnGroupingModel = columnGroupingModel;
108
110
  // @ts-expect-error Move this logic to `Pro` package
109
111
  const pinnedColumns = apiRef.current.getPinnedColumns?.() ?? {};
110
112
  const columnFields = (0, _columns.gridColumnFieldsSelector)(apiRef);
@@ -136,7 +138,10 @@ const useGridColumnGrouping = (apiRef, props) => {
136
138
  * EFFECTS
137
139
  */
138
140
  React.useEffect(() => {
141
+ if (props.columnGroupingModel === apiRef.current.caches.columnGrouping.lastColumnGroupingModel) {
142
+ return;
143
+ }
139
144
  updateColumnGroupingState(props.columnGroupingModel);
140
- }, [updateColumnGroupingState, props.columnGroupingModel]);
145
+ }, [apiRef, updateColumnGroupingState, props.columnGroupingModel]);
141
146
  };
142
147
  exports.useGridColumnGrouping = useGridColumnGrouping;
@@ -1,4 +1,4 @@
1
- import { GridColDef, GridStateColDef } from "../../../models/colDef/gridColDef.js";
1
+ import type { GridColDef, GridStateColDef } from "../../../models/colDef/gridColDef.js";
2
2
  import type { GridColumnDimensionProperties } from "./gridColumnsUtils.js";
3
3
  export declare enum GridPinnedColumnPosition {
4
4
  LEFT = "left",
@@ -21,8 +21,8 @@ export interface GridPinnedColumnFields {
21
21
  right?: string[];
22
22
  }
23
23
  export declare const EMPTY_PINNED_COLUMN_FIELDS: {
24
- left: string[];
25
- right: string[];
24
+ left: never[];
25
+ right: never[];
26
26
  };
27
27
  export interface GridPinnedColumns {
28
28
  left: GridStateColDef[];