@mui/x-data-grid 8.9.2 → 8.10.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.
- package/CHANGELOG.md +217 -6
- package/components/GridFooter.js +1 -1
- package/components/GridPagination.js +4 -3
- package/components/GridRow.js +8 -6
- package/components/virtualization/GridVirtualScroller.js +3 -3
- package/esm/DataGrid/index.js +1 -1
- package/esm/components/GridFooter.js +1 -1
- package/esm/components/GridPagination.js +3 -2
- package/esm/components/GridRow.js +8 -6
- package/esm/components/virtualization/GridVirtualScroller.js +3 -3
- package/esm/hooks/core/useGridVirtualizer.js +64 -44
- package/esm/hooks/features/dataSource/cache.js +0 -3
- package/esm/hooks/features/dataSource/gridDataSourceError.js +16 -16
- package/esm/hooks/features/dataSource/models.d.ts +11 -2
- package/esm/hooks/features/dataSource/useGridDataSourceBase.d.ts +1 -1
- package/esm/hooks/features/dataSource/useGridDataSourceBase.js +9 -2
- package/esm/hooks/features/dataSource/utils.js +51 -52
- package/esm/hooks/features/dimensions/gridDimensionsApi.d.ts +2 -67
- package/esm/hooks/features/dimensions/useGridDimensions.js +20 -15
- package/esm/hooks/features/editing/useGridRowEditing.js +4 -1
- package/esm/hooks/features/export/serializers/csvSerializer.js +2 -3
- package/esm/hooks/features/export/useGridPrintExport.js +3 -8
- package/esm/hooks/features/rowReorder/gridRowReorderInterfaces.d.ts +9 -0
- package/esm/hooks/features/rowReorder/gridRowReorderInterfaces.js +1 -0
- package/esm/hooks/features/rowReorder/gridRowReorderSelector.d.ts +5 -0
- package/esm/hooks/features/rowReorder/gridRowReorderSelector.js +3 -0
- package/esm/hooks/features/rowSelection/useGridRowSelection.js +2 -2
- package/esm/hooks/features/rowSelection/utils.js +5 -0
- package/esm/index.js +1 -1
- package/esm/internals/index.d.ts +2 -0
- package/esm/internals/index.js +1 -0
- package/esm/internals/utils/cache.js +0 -1
- package/esm/locales/nnNO.js +96 -107
- package/esm/material/index.js +2 -2
- package/esm/models/api/gridApiCommon.d.ts +1 -1
- package/esm/models/gridRowSelectionManager.js +0 -2
- package/esm/models/gridStateCommunity.d.ts +2 -0
- package/esm/utils/cleanupTracking/FinalizationRegistryBasedCleanupTracking.js +5 -7
- package/esm/utils/cleanupTracking/TimerBasedCleanupTracking.js +2 -2
- package/hooks/core/useGridVirtualizer.js +62 -42
- package/hooks/features/dataSource/cache.js +0 -3
- package/hooks/features/dataSource/gridDataSourceError.js +16 -16
- package/hooks/features/dataSource/models.d.ts +11 -2
- package/hooks/features/dataSource/useGridDataSourceBase.d.ts +1 -1
- package/hooks/features/dataSource/useGridDataSourceBase.js +10 -3
- package/hooks/features/dataSource/utils.js +51 -52
- package/hooks/features/dimensions/gridDimensionsApi.d.ts +2 -67
- package/hooks/features/dimensions/useGridDimensions.js +20 -15
- package/hooks/features/editing/useGridRowEditing.js +4 -1
- package/hooks/features/export/serializers/csvSerializer.js +2 -3
- package/hooks/features/export/useGridPrintExport.js +3 -8
- package/hooks/features/rowReorder/gridRowReorderInterfaces.d.ts +9 -0
- package/hooks/features/rowReorder/gridRowReorderInterfaces.js +5 -0
- package/hooks/features/rowReorder/gridRowReorderSelector.d.ts +5 -0
- package/hooks/features/rowReorder/gridRowReorderSelector.js +9 -0
- package/hooks/features/rowSelection/useGridRowSelection.js +2 -2
- package/hooks/features/rowSelection/utils.js +5 -0
- package/index.js +1 -1
- package/internals/index.d.ts +2 -0
- package/internals/index.js +8 -0
- package/internals/utils/cache.js +0 -1
- package/locales/nnNO.js +96 -107
- package/material/index.js +2 -2
- package/models/api/gridApiCommon.d.ts +1 -1
- package/models/gridRowSelectionManager.js +0 -2
- package/models/gridStateCommunity.d.ts +2 -0
- package/package.json +16 -18
- package/utils/cleanupTracking/FinalizationRegistryBasedCleanupTracking.js +5 -7
- package/utils/cleanupTracking/TimerBasedCleanupTracking.js +2 -2
|
@@ -43,7 +43,8 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
43
43
|
callback(...args);
|
|
44
44
|
}
|
|
45
45
|
}, [props.rowSelection]);
|
|
46
|
-
const
|
|
46
|
+
const isNestedData = useGridSelector(apiRef, gridRowMaximumTreeDepthSelector) > 1;
|
|
47
|
+
const applyAutoSelection = props.signature !== GridSignature.DataGrid && (props.rowSelectionPropagation?.parents || props.rowSelectionPropagation?.descendants) && isNestedData;
|
|
47
48
|
const propRowSelectionModel = React.useMemo(() => {
|
|
48
49
|
return props.rowSelectionModel;
|
|
49
50
|
}, [props.rowSelectionModel]);
|
|
@@ -62,7 +63,6 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
62
63
|
} = props;
|
|
63
64
|
const canHaveMultipleSelection = isMultipleRowSelectionEnabled(props);
|
|
64
65
|
const tree = useGridSelector(apiRef, gridRowTreeSelector);
|
|
65
|
-
const isNestedData = useGridSelector(apiRef, gridRowMaximumTreeDepthSelector) > 1;
|
|
66
66
|
const expandMouseRowRangeSelection = React.useCallback(id => {
|
|
67
67
|
let endId = id;
|
|
68
68
|
const startId = lastRowToggled.current ?? id;
|
|
@@ -137,6 +137,11 @@ export const findRowsToSelect = (apiRef, tree, selectedRow, autoSelectDescendant
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
|
+
// For root level rows, we don't need to traverse parents
|
|
141
|
+
const rowNode = tree[selectedRow];
|
|
142
|
+
if (!rowNode || rowNode.parent === GRID_ROOT_GROUP_ID) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
140
145
|
traverseParents(selectedRow);
|
|
141
146
|
}
|
|
142
147
|
};
|
package/esm/index.js
CHANGED
package/esm/internals/index.d.ts
CHANGED
|
@@ -63,6 +63,8 @@ export { getRowIdFromRowModel, GRID_ID_AUTOGENERATED, getRowValue } from "../hoo
|
|
|
63
63
|
export { gridAdditionalRowGroupsSelector, gridPinnedRowsSelector, gridRowSelector } from "../hooks/features/rows/gridRowsSelector.js";
|
|
64
64
|
export { headerFilteringStateInitializer, useGridHeaderFiltering } from "../hooks/features/headerFiltering/useGridHeaderFiltering.js";
|
|
65
65
|
export { useGridRowSelection, rowSelectionStateInitializer } from "../hooks/features/rowSelection/useGridRowSelection.js";
|
|
66
|
+
export { gridIsRowDragActiveSelector } from "../hooks/features/rowReorder/gridRowReorderSelector.js";
|
|
67
|
+
export type { GridRowReorderState } from "../hooks/features/rowReorder/gridRowReorderInterfaces.js";
|
|
66
68
|
export { useGridRowSelectionPreProcessors } from "../hooks/features/rowSelection/useGridRowSelectionPreProcessors.js";
|
|
67
69
|
export { useGridSorting, sortingStateInitializer } from "../hooks/features/sorting/useGridSorting.js";
|
|
68
70
|
export type { GridSortingModelApplier } from "../hooks/features/sorting/gridSortingState.js";
|
package/esm/internals/index.js
CHANGED
|
@@ -51,6 +51,7 @@ export { getRowIdFromRowModel, GRID_ID_AUTOGENERATED, getRowValue } from "../hoo
|
|
|
51
51
|
export { gridAdditionalRowGroupsSelector, gridPinnedRowsSelector, gridRowSelector } from "../hooks/features/rows/gridRowsSelector.js";
|
|
52
52
|
export { headerFilteringStateInitializer, useGridHeaderFiltering } from "../hooks/features/headerFiltering/useGridHeaderFiltering.js";
|
|
53
53
|
export { useGridRowSelection, rowSelectionStateInitializer } from "../hooks/features/rowSelection/useGridRowSelection.js";
|
|
54
|
+
export { gridIsRowDragActiveSelector } from "../hooks/features/rowReorder/gridRowReorderSelector.js";
|
|
54
55
|
export { useGridRowSelectionPreProcessors } from "../hooks/features/rowSelection/useGridRowSelectionPreProcessors.js";
|
|
55
56
|
export { useGridSorting, sortingStateInitializer } from "../hooks/features/sorting/useGridSorting.js";
|
|
56
57
|
export { gridSortedRowIndexLookupSelector } from "../hooks/features/sorting/gridSortingSelector.js";
|
package/esm/locales/nnNO.js
CHANGED
|
@@ -3,10 +3,9 @@ const nnNOGrid = {
|
|
|
3
3
|
// Root
|
|
4
4
|
noRowsLabel: 'Ingen rader',
|
|
5
5
|
noResultsOverlayLabel: 'Fann ingen resultat.',
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
noColumnsOverlayLabel: 'Ingen kolonner',
|
|
7
|
+
noColumnsOverlayManageColumns: 'Vel kolonner',
|
|
8
|
+
emptyPivotOverlayLabel: 'Legg til felt i rader, kolonner og verdiar for å opprette ein pivot-tabell',
|
|
10
9
|
// Density selector toolbar button text
|
|
11
10
|
toolbarDensity: 'Tettheit',
|
|
12
11
|
toolbarDensityLabel: 'Tettheit',
|
|
@@ -33,18 +32,15 @@ const nnNOGrid = {
|
|
|
33
32
|
toolbarExportPrint: 'Skriv ut',
|
|
34
33
|
toolbarExportExcel: 'Last ned som Excel',
|
|
35
34
|
// Toolbar pivot button
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
toolbarPivot: 'Pivot',
|
|
38
36
|
// Toolbar AI Assistant button
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
toolbarAssistant: 'AI Assistent',
|
|
41
38
|
// Columns management text
|
|
42
39
|
columnsManagementSearchTitle: 'Søk',
|
|
43
40
|
columnsManagementNoColumns: 'Ingen kolonner',
|
|
44
41
|
columnsManagementShowHideAllText: 'Vis/skjul alle',
|
|
45
42
|
columnsManagementReset: 'Nullstill',
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
columnsManagementDeleteIconLabel: 'Tøm',
|
|
48
44
|
// Filter panel text
|
|
49
45
|
filterPanelAddFilter: 'Legg til filter',
|
|
50
46
|
filterPanelRemoveAll: 'Fjern alle',
|
|
@@ -58,9 +54,9 @@ const nnNOGrid = {
|
|
|
58
54
|
filterPanelInputPlaceholder: 'Filter verdi',
|
|
59
55
|
// Filter operators text
|
|
60
56
|
filterOperatorContains: 'inneheld',
|
|
61
|
-
|
|
57
|
+
filterOperatorDoesNotContain: 'inneheld ikkje',
|
|
62
58
|
filterOperatorEquals: 'er lik',
|
|
63
|
-
|
|
59
|
+
filterOperatorDoesNotEqual: 'er ikkje lik',
|
|
64
60
|
filterOperatorStartsWith: 'startar med',
|
|
65
61
|
filterOperatorEndsWith: 'sluttar med',
|
|
66
62
|
filterOperatorIs: 'er',
|
|
@@ -80,9 +76,9 @@ const nnNOGrid = {
|
|
|
80
76
|
'filterOperator<=': '<=',
|
|
81
77
|
// Header filter operators text
|
|
82
78
|
headerFilterOperatorContains: 'Inneheld',
|
|
83
|
-
|
|
79
|
+
headerFilterOperatorDoesNotContain: 'Inneheld ikkje',
|
|
84
80
|
headerFilterOperatorEquals: 'Lik',
|
|
85
|
-
|
|
81
|
+
headerFilterOperatorDoesNotEqual: 'Er ikkje lik',
|
|
86
82
|
headerFilterOperatorStartsWith: 'Startar på',
|
|
87
83
|
headerFilterOperatorEndsWith: 'Sluttar på',
|
|
88
84
|
headerFilterOperatorIs: 'Er',
|
|
@@ -100,15 +96,14 @@ const nnNOGrid = {
|
|
|
100
96
|
'headerFilterOperator>=': 'Større enn eller lik',
|
|
101
97
|
'headerFilterOperator<': 'Mindre enn',
|
|
102
98
|
'headerFilterOperator<=': 'Mindre enn eller lik',
|
|
103
|
-
|
|
104
|
-
|
|
99
|
+
headerFilterClear: 'Tøm filter',
|
|
105
100
|
// Filter values text
|
|
106
101
|
filterValueAny: 'nokon',
|
|
107
102
|
filterValueTrue: 'sant',
|
|
108
103
|
filterValueFalse: 'usant',
|
|
109
104
|
// Column menu text
|
|
110
105
|
columnMenuLabel: 'Meny',
|
|
111
|
-
|
|
106
|
+
columnMenuAriaLabel: columnName => `${columnName} kolonne meny`,
|
|
112
107
|
columnMenuShowColumns: 'Vis kolonner',
|
|
113
108
|
columnMenuManageColumns: 'Administrer kolonner',
|
|
114
109
|
columnMenuFilter: 'Filter',
|
|
@@ -116,8 +111,7 @@ const nnNOGrid = {
|
|
|
116
111
|
columnMenuUnsort: 'Usorter',
|
|
117
112
|
columnMenuSortAsc: 'Sorter AUKANDE',
|
|
118
113
|
columnMenuSortDesc: 'Sorter SYNKANDE',
|
|
119
|
-
|
|
120
|
-
|
|
114
|
+
columnMenuManagePivot: 'Behandle pivot',
|
|
121
115
|
// Column header text
|
|
122
116
|
columnHeaderFiltersTooltipActive: count => count !== 1 ? `${count} aktive filter` : `${count} aktivt filter`,
|
|
123
117
|
columnHeaderFiltersLabel: 'Vis filter',
|
|
@@ -152,23 +146,23 @@ const nnNOGrid = {
|
|
|
152
146
|
groupColumn: name => `Grupper på ${name}`,
|
|
153
147
|
unGroupColumn: name => `Slutt å grupper på ${name}`,
|
|
154
148
|
// Master/detail
|
|
155
|
-
detailPanelToggle: '
|
|
156
|
-
expandDetailPanel: '
|
|
157
|
-
collapseDetailPanel: '
|
|
149
|
+
detailPanelToggle: 'Vis/gøym detaljpanel',
|
|
150
|
+
expandDetailPanel: 'Vis',
|
|
151
|
+
collapseDetailPanel: 'Gøym',
|
|
158
152
|
// Pagination
|
|
159
153
|
paginationRowsPerPage: 'Rader per side:',
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
154
|
+
paginationDisplayedRows: ({
|
|
155
|
+
from,
|
|
156
|
+
to,
|
|
157
|
+
count,
|
|
158
|
+
estimated
|
|
159
|
+
}) => {
|
|
160
|
+
if (!estimated) {
|
|
161
|
+
return `${from}–${to} av ${count !== -1 ? count : `flere enn ${to}`}`;
|
|
162
|
+
}
|
|
163
|
+
const estimatedLabel = estimated && estimated > to ? `omtrent ${estimated}` : `flere enn ${to}`;
|
|
164
|
+
return `${from}–${to} av ${count !== -1 ? count : estimatedLabel}`;
|
|
165
|
+
},
|
|
172
166
|
paginationItemAriaLabel: type => {
|
|
173
167
|
if (type === 'first') {
|
|
174
168
|
return 'Gå til første side';
|
|
@@ -190,83 +184,78 @@ const nnNOGrid = {
|
|
|
190
184
|
aggregationFunctionLabelAvg: 'snitt',
|
|
191
185
|
aggregationFunctionLabelMin: 'min',
|
|
192
186
|
aggregationFunctionLabelMax: 'maks',
|
|
193
|
-
aggregationFunctionLabelSize: 'størrelse'
|
|
194
|
-
|
|
187
|
+
aggregationFunctionLabelSize: 'størrelse',
|
|
195
188
|
// Pivot panel
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
189
|
+
pivotToggleLabel: 'Pivot',
|
|
190
|
+
pivotRows: 'Rader',
|
|
191
|
+
pivotColumns: 'Kolonner',
|
|
192
|
+
pivotValues: 'Verdiar',
|
|
193
|
+
pivotCloseButton: 'Lukk pivotinnstillingar',
|
|
194
|
+
pivotSearchButton: 'Søk felt',
|
|
195
|
+
pivotSearchControlPlaceholder: 'Søk felt',
|
|
196
|
+
pivotSearchControlLabel: 'Søk felt',
|
|
197
|
+
pivotSearchControlClear: 'Tøm søk',
|
|
198
|
+
pivotNoFields: 'Ingen felt',
|
|
199
|
+
pivotMenuMoveUp: 'Flytt opp',
|
|
200
|
+
pivotMenuMoveDown: 'Flytt ned',
|
|
201
|
+
pivotMenuMoveToTop: 'Flytt til toppen',
|
|
202
|
+
pivotMenuMoveToBottom: 'Flytt til botnen',
|
|
203
|
+
pivotMenuRows: 'Rader',
|
|
204
|
+
pivotMenuColumns: 'Kolonner',
|
|
205
|
+
pivotMenuValues: 'Verdiar',
|
|
206
|
+
pivotMenuOptions: 'Feltalternativ',
|
|
207
|
+
pivotMenuAddToRows: 'Legg til i Rader',
|
|
208
|
+
pivotMenuAddToColumns: 'Legg til i Kolonner',
|
|
209
|
+
pivotMenuAddToValues: 'Legg til i Verdiar',
|
|
210
|
+
pivotMenuRemove: 'Fjern',
|
|
211
|
+
pivotDragToRows: 'Dra hit for å opprette rader',
|
|
212
|
+
pivotDragToColumns: 'Dra hit for å opprette kolonner',
|
|
213
|
+
pivotDragToValues: 'Dra hit for å opprette verdiar',
|
|
214
|
+
pivotYearColumnHeaderName: '(År)',
|
|
215
|
+
pivotQuarterColumnHeaderName: '(Kvartal)',
|
|
224
216
|
// AI Assistant panel
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
217
|
+
aiAssistantPanelTitle: 'AI Assistent',
|
|
218
|
+
aiAssistantPanelClose: 'Lukk AI Assistent',
|
|
219
|
+
aiAssistantPanelNewConversation: 'Ny samtale',
|
|
220
|
+
aiAssistantPanelConversationHistory: 'Samtalehistorikk',
|
|
221
|
+
aiAssistantPanelEmptyConversation: 'Ingen prompt-historikk',
|
|
222
|
+
aiAssistantSuggestions: 'Forslag',
|
|
232
223
|
// Prompt field
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
224
|
+
promptFieldLabel: 'Prompt',
|
|
225
|
+
promptFieldPlaceholder: 'Skriv ein prompt…',
|
|
226
|
+
promptFieldPlaceholderWithRecording: 'Skriv eller spel inn ein prompt…',
|
|
227
|
+
promptFieldPlaceholderListening: 'Lyttar etter prompt…',
|
|
228
|
+
promptFieldSpeechRecognitionNotSupported: 'Talegjenkjenning er ikkje støtta i denne nettlesaren',
|
|
229
|
+
promptFieldSend: 'Send',
|
|
230
|
+
promptFieldRecord: 'Spel inn',
|
|
231
|
+
promptFieldStopRecording: 'Stopp opptak',
|
|
242
232
|
// Prompt
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
233
|
+
promptRerun: 'Kjør på nytt',
|
|
234
|
+
promptProcessing: 'Behandlar…',
|
|
235
|
+
promptAppliedChanges: 'Brukte endringar',
|
|
247
236
|
// Prompt changes
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
237
|
+
promptChangeGroupDescription: column => `Grupper etter ${column}`,
|
|
238
|
+
promptChangeAggregationLabel: (column, aggregation) => `${column} (${aggregation})`,
|
|
239
|
+
promptChangeAggregationDescription: (column, aggregation) => `Aggreger ${column} (${aggregation})`,
|
|
240
|
+
promptChangeFilterLabel: (column, operator, value) => {
|
|
241
|
+
if (operator === 'is any of') {
|
|
242
|
+
return `${column} er ein av: ${value}`;
|
|
243
|
+
}
|
|
244
|
+
return `${column} ${operator} ${value}`;
|
|
245
|
+
},
|
|
246
|
+
promptChangeFilterDescription: (column, operator, value) => {
|
|
247
|
+
if (operator === 'is any of') {
|
|
248
|
+
return `Filter der ${column} er ein av: ${value}`;
|
|
249
|
+
}
|
|
250
|
+
return `Filter der ${column} ${operator} ${value}`;
|
|
251
|
+
},
|
|
252
|
+
promptChangeSortDescription: (column, direction) => `Sorter etter ${column} (${direction})`,
|
|
253
|
+
promptChangePivotEnableLabel: 'Pivot',
|
|
254
|
+
promptChangePivotEnableDescription: 'Aktiver pivot',
|
|
255
|
+
promptChangePivotColumnsLabel: count => `Kolonner (${count})`,
|
|
256
|
+
promptChangePivotColumnsDescription: (column, direction) => `${column}${direction ? ` (${direction})` : ''}`,
|
|
257
|
+
promptChangePivotRowsLabel: count => `Rader (${count})`,
|
|
258
|
+
promptChangePivotValuesLabel: count => `Verdiar (${count})`,
|
|
259
|
+
promptChangePivotValuesDescription: (column, aggregation) => `${column} (${aggregation})`
|
|
271
260
|
};
|
|
272
261
|
export const nnNO = getGridLocalization(nnNOGrid);
|
package/esm/material/index.js
CHANGED
|
@@ -159,9 +159,9 @@ const BaseSelect = forwardRef(function BaseSelect(props, ref) {
|
|
|
159
159
|
labelId: labelId,
|
|
160
160
|
label: label,
|
|
161
161
|
displayEmpty: true,
|
|
162
|
-
onChange: onChange
|
|
162
|
+
onChange: onChange,
|
|
163
|
+
variant: "outlined"
|
|
163
164
|
}, rest, {
|
|
164
|
-
variant: "outlined",
|
|
165
165
|
notched: true,
|
|
166
166
|
inputProps: slotProps?.htmlInput,
|
|
167
167
|
onOpen: onOpen,
|
|
@@ -31,7 +31,7 @@ import type { GridHeaderFilteringApi, GridHeaderFilteringPrivateApi } from "./gr
|
|
|
31
31
|
import type { DataGridProcessedProps } from "../props/DataGridProps.js";
|
|
32
32
|
import type { GridColumnResizeApi } from "../../hooks/features/columnResize/index.js";
|
|
33
33
|
import type { GridPivotingPrivateApiCommunity } from "../../hooks/features/pivoting/gridPivotingInterfaces.js";
|
|
34
|
-
export interface GridApiCommon<GridState extends GridStateCommunity =
|
|
34
|
+
export interface GridApiCommon<GridState extends GridStateCommunity = GridStateCommunity, GridInitialState extends GridInitialStateCommunity = GridInitialStateCommunity> extends GridCoreApi, GridPipeProcessingApi, GridDensityApi, GridDimensionsApi, GridRowApi, GridRowsMetaApi, GridEditingApi, GridParamsApi, GridColumnApi, GridRowSelectionApi, GridSortApi, GridPaginationApi, GridCsvExportApi, GridFocusApi, GridFilterApi, GridColumnMenuApi, GridPreferencesPanelApi, GridPrintExportApi, GridVirtualizationApi, GridLocaleTextApi, GridScrollApi, GridColumnSpanningApi, GridStateApi<GridState>, GridStatePersistenceApi<GridInitialState>, GridColumnGroupingApi, GridHeaderFilteringApi, GridColumnResizeApi {}
|
|
35
35
|
export interface GridPrivateOnlyApiCommon<Api extends GridApiCommon, PrivateApi extends GridPrivateApiCommon, Props extends DataGridProcessedProps> extends GridCorePrivateApi<Api, PrivateApi, Props>, GridStatePrivateApi<PrivateApi['state']>, GridPipeProcessingPrivateApi, GridStrategyProcessingApi, GridColumnSpanningPrivateApi, GridRowsMetaPrivateApi, GridDimensionsPrivateApi, GridEditingPrivateApi, GridLoggerApi, GridFocusPrivateApi, GridHeaderFilteringPrivateApi, GridVirtualizationPrivateApi, GridRowProPrivateApi, GridParamsPrivateApi, GridPivotingPrivateApiCommunity {
|
|
36
36
|
virtualizer: Virtualizer;
|
|
37
37
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
class IncludeManager {
|
|
2
2
|
constructor(model) {
|
|
3
|
-
this.data = void 0;
|
|
4
3
|
this.data = model.ids;
|
|
5
4
|
}
|
|
6
5
|
has(id) {
|
|
@@ -15,7 +14,6 @@ class IncludeManager {
|
|
|
15
14
|
}
|
|
16
15
|
class ExcludeManager {
|
|
17
16
|
constructor(model) {
|
|
18
|
-
this.data = void 0;
|
|
19
17
|
this.data = model.ids;
|
|
20
18
|
}
|
|
21
19
|
has(id) {
|
|
@@ -8,6 +8,7 @@ import type { GridVisibleRowsLookupState } from "../hooks/features/filter/gridFi
|
|
|
8
8
|
import type { GridColumnResizeState } from "../hooks/features/columnResize/index.js";
|
|
9
9
|
import type { GridRowSpanningState } from "../hooks/features/rows/useGridRowSpanning.js";
|
|
10
10
|
import type { GridListViewState } from "../hooks/features/listView/useGridListView.js";
|
|
11
|
+
import type { GridRowReorderState } from "../hooks/features/rowReorder/gridRowReorderInterfaces.js";
|
|
11
12
|
/**
|
|
12
13
|
* Some props are passed on the state to enable grid selectors to select
|
|
13
14
|
* and react to them.
|
|
@@ -41,6 +42,7 @@ export interface GridStateCommunity {
|
|
|
41
42
|
columnResize: GridColumnResizeState;
|
|
42
43
|
rowSpanning: GridRowSpanningState;
|
|
43
44
|
listViewColumn: GridListViewState;
|
|
45
|
+
rowReorder: GridRowReorderState;
|
|
44
46
|
}
|
|
45
47
|
/**
|
|
46
48
|
* The initial state of Data Grid.
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
export class FinalizationRegistryBasedCleanupTracking {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
});
|
|
8
|
-
}
|
|
2
|
+
registry = (() => new FinalizationRegistry(unsubscribe => {
|
|
3
|
+
if (typeof unsubscribe === 'function') {
|
|
4
|
+
unsubscribe();
|
|
5
|
+
}
|
|
6
|
+
}))();
|
|
9
7
|
register(object, unsubscribe, unregisterToken) {
|
|
10
8
|
this.registry.register(object, unsubscribe, unregisterToken);
|
|
11
9
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// If no effect ran after this amount of time, we assume that the render was not committed by React
|
|
2
2
|
const CLEANUP_TIMER_LOOP_MILLIS = 1000;
|
|
3
3
|
export class TimerBasedCleanupTracking {
|
|
4
|
+
timeouts = (() => new Map())();
|
|
5
|
+
cleanupTimeout = (() => CLEANUP_TIMER_LOOP_MILLIS)();
|
|
4
6
|
constructor(timeout = CLEANUP_TIMER_LOOP_MILLIS) {
|
|
5
|
-
this.timeouts = new Map();
|
|
6
|
-
this.cleanupTimeout = CLEANUP_TIMER_LOOP_MILLIS;
|
|
7
7
|
this.cleanupTimeout = timeout;
|
|
8
8
|
}
|
|
9
9
|
register(object, unsubscribe, unregisterToken) {
|
|
@@ -8,9 +8,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.useGridVirtualizer = useGridVirtualizer;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _useLazyRef = _interopRequireDefault(require("@mui/utils/useLazyRef"));
|
|
11
12
|
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
12
13
|
var _RtlProvider = require("@mui/system/RtlProvider");
|
|
13
14
|
var _math = require("@mui/x-internals/math");
|
|
15
|
+
var _lruMemoize = require("@mui/x-internals/lruMemoize");
|
|
14
16
|
var _store = require("@mui/x-internals/store");
|
|
15
17
|
var _xVirtualizer = require("@mui/x-virtualizer");
|
|
16
18
|
var _useFirstRender = require("../utils/useFirstRender");
|
|
@@ -39,6 +41,18 @@ const columnsTotalWidthSelector = (0, _createSelector.createSelector)(_gridColum
|
|
|
39
41
|
return (0, _math.roundToDecimalPlaces)(positions[colCount - 1] + visibleColumns[colCount - 1].computedWidth, 1);
|
|
40
42
|
});
|
|
41
43
|
|
|
44
|
+
/** Translates virtualizer state to grid state */
|
|
45
|
+
const addGridDimensionsCreator = () => (0, _lruMemoize.lruMemoize)((dimensions, headerHeight, groupHeaderHeight, headerFilterHeight, headersTotalHeight) => {
|
|
46
|
+
return (0, _extends2.default)({}, dimensions, {
|
|
47
|
+
headerHeight,
|
|
48
|
+
groupHeaderHeight,
|
|
49
|
+
headerFilterHeight,
|
|
50
|
+
headersTotalHeight
|
|
51
|
+
});
|
|
52
|
+
}, {
|
|
53
|
+
maxSize: 1
|
|
54
|
+
});
|
|
55
|
+
|
|
42
56
|
/**
|
|
43
57
|
* Virtualizer setup
|
|
44
58
|
*/
|
|
@@ -54,9 +68,6 @@ function useGridVirtualizer(apiRef, rootProps) {
|
|
|
54
68
|
const isRowSelected = id => rowSelectionManager.has(id) && apiRef.current.isRowSelectable(id);
|
|
55
69
|
const currentPage = (0, _useGridVisibleRows.useGridVisibleRows)(apiRef);
|
|
56
70
|
const hasColSpan = (0, _useGridSelector.useGridSelector)(apiRef, _gridColumnsSelector.gridHasColSpanSelector);
|
|
57
|
-
|
|
58
|
-
/* TODO: extract dimensions code */
|
|
59
|
-
const contentHeight = (0, _useGridSelector.useGridSelector)(apiRef, _gridDimensionsSelectors.gridContentHeightSelector);
|
|
60
71
|
const verticalScrollbarWidth = (0, _useGridSelector.useGridSelector)(apiRef, _gridDimensionsSelectors.gridVerticalScrollbarWidthSelector);
|
|
61
72
|
const hasFiller = (0, _useGridSelector.useGridSelector)(apiRef, _gridDimensionsSelectors.gridHasFillerSelector);
|
|
62
73
|
const {
|
|
@@ -75,16 +86,17 @@ function useGridVirtualizer(apiRef, rootProps) {
|
|
|
75
86
|
const headersTotalHeight = (0, _gridColumnsUtils.getTotalHeaderHeight)(apiRef, rootProps);
|
|
76
87
|
const leftPinnedWidth = pinnedColumns.left.reduce((w, col) => w + col.computedWidth, 0);
|
|
77
88
|
const rightPinnedWidth = pinnedColumns.right.reduce((w, col) => w + col.computedWidth, 0);
|
|
78
|
-
const
|
|
89
|
+
const dimensionsParams = {
|
|
79
90
|
rowHeight,
|
|
80
91
|
headerHeight,
|
|
81
|
-
groupHeaderHeight,
|
|
82
|
-
headerFilterHeight,
|
|
83
92
|
columnsTotalWidth,
|
|
84
|
-
headersTotalHeight,
|
|
85
93
|
leftPinnedWidth,
|
|
86
|
-
rightPinnedWidth
|
|
94
|
+
rightPinnedWidth,
|
|
95
|
+
topPinnedHeight: headersTotalHeight,
|
|
96
|
+
bottomPinnedHeight: 0,
|
|
97
|
+
scrollbarSize: rootProps.scrollbarSize
|
|
87
98
|
};
|
|
99
|
+
const addGridDimensions = (0, _useLazyRef.default)(addGridDimensionsCreator).current;
|
|
88
100
|
|
|
89
101
|
// </DIMENSIONS>
|
|
90
102
|
|
|
@@ -101,32 +113,42 @@ function useGridVirtualizer(apiRef, rootProps) {
|
|
|
101
113
|
|
|
102
114
|
const focusedVirtualCell = (0, _useGridSelector.useGridSelector)(apiRef, _gridFocusedVirtualCellSelector.gridFocusedVirtualCellSelector);
|
|
103
115
|
const virtualizer = (0, _xVirtualizer.useVirtualizer)({
|
|
104
|
-
|
|
105
|
-
|
|
116
|
+
refs: {
|
|
117
|
+
container: apiRef.current.mainElementRef,
|
|
118
|
+
scroller: apiRef.current.virtualScrollerRef,
|
|
119
|
+
scrollbarVertical: apiRef.current.virtualScrollbarVerticalRef,
|
|
120
|
+
scrollbarHorizontal: apiRef.current.virtualScrollbarHorizontalRef
|
|
121
|
+
},
|
|
122
|
+
dimensions: dimensionsParams,
|
|
123
|
+
virtualization: {
|
|
124
|
+
isRtl,
|
|
125
|
+
rowBufferPx: rootProps.rowBufferPx,
|
|
126
|
+
columnBufferPx: rootProps.columnBufferPx
|
|
127
|
+
},
|
|
128
|
+
colspan: {
|
|
129
|
+
enabled: hasColSpan,
|
|
130
|
+
getColspan: (rowId, column) => {
|
|
131
|
+
if (typeof column.colSpan === 'function') {
|
|
132
|
+
const row = apiRef.current.getRow(rowId);
|
|
133
|
+
const value = apiRef.current.getRowValue(row, column);
|
|
134
|
+
return column.colSpan(value, row, column, apiRef) ?? 0;
|
|
135
|
+
}
|
|
136
|
+
return column.colSpan ?? 1;
|
|
137
|
+
}
|
|
138
|
+
},
|
|
106
139
|
initialState: {
|
|
107
140
|
scroll: rootProps.initialState?.scroll,
|
|
108
|
-
dimensions: apiRef.current.state.dimensions,
|
|
109
141
|
rowSpanning: apiRef.current.state.rowSpanning,
|
|
110
142
|
virtualization: apiRef.current.state.virtualization
|
|
111
143
|
},
|
|
112
|
-
isRtl,
|
|
113
144
|
rows: currentPage.rows,
|
|
114
145
|
range: currentPage.range,
|
|
115
|
-
rowIdToIndexMap: currentPage.rowIdToIndexMap,
|
|
116
146
|
rowCount,
|
|
117
147
|
columns: visibleColumns,
|
|
118
148
|
pinnedRows,
|
|
119
149
|
pinnedColumns,
|
|
120
|
-
refs: {
|
|
121
|
-
container: apiRef.current.mainElementRef,
|
|
122
|
-
scroller: apiRef.current.virtualScrollerRef,
|
|
123
|
-
scrollbarVertical: apiRef.current.virtualScrollbarVerticalRef,
|
|
124
|
-
scrollbarHorizontal: apiRef.current.virtualScrollbarHorizontalRef
|
|
125
|
-
},
|
|
126
|
-
hasColSpan,
|
|
127
|
-
contentHeight,
|
|
128
|
-
minimalContentHeight: _gridRowsUtils.minimalContentHeight,
|
|
129
150
|
autoHeight,
|
|
151
|
+
minimalContentHeight: _gridRowsUtils.minimalContentHeight,
|
|
130
152
|
getRowHeight: React.useMemo(() => {
|
|
131
153
|
if (!getRowHeight) {
|
|
132
154
|
return undefined;
|
|
@@ -138,14 +160,20 @@ function useGridVirtualizer(apiRef, rootProps) {
|
|
|
138
160
|
getEstimatedRowHeight: React.useMemo(() => getEstimatedRowHeight ? rowEntry => getEstimatedRowHeight((0, _extends2.default)({}, rowEntry, {
|
|
139
161
|
densityFactor: density
|
|
140
162
|
})) : undefined, [getEstimatedRowHeight, density]),
|
|
141
|
-
getRowSpacing: React.useMemo(() => getRowSpacing ?
|
|
142
|
-
indexRelativeToCurrentPage
|
|
143
|
-
|
|
163
|
+
getRowSpacing: React.useMemo(() => getRowSpacing ? rowEntry => {
|
|
164
|
+
const indexRelativeToCurrentPage = currentPage.rowIdToIndexMap.get(rowEntry.id) ?? -1;
|
|
165
|
+
const visibility = {
|
|
166
|
+
isFirstVisible: indexRelativeToCurrentPage === 0,
|
|
167
|
+
isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1,
|
|
168
|
+
indexRelativeToCurrentPage
|
|
169
|
+
};
|
|
170
|
+
return getRowSpacing((0, _extends2.default)({}, rowEntry, visibility, {
|
|
171
|
+
indexRelativeToCurrentPage: apiRef.current.getRowIndexRelativeToVisibleRows(rowEntry.id)
|
|
172
|
+
}));
|
|
173
|
+
} : undefined, [apiRef, getRowSpacing, currentPage.rows, currentPage.rowIdToIndexMap]),
|
|
144
174
|
applyRowHeight: (0, _useEventCallback.default)((entry, row) => apiRef.current.unstable_applyPipeProcessors('rowHeight', entry, row)),
|
|
145
175
|
virtualizeColumnsWithAutoRowHeight: rootProps.virtualizeColumnsWithAutoRowHeight,
|
|
146
176
|
focusedVirtualCell: (0, _useEventCallback.default)(() => focusedVirtualCell),
|
|
147
|
-
rowBufferPx: rootProps.rowBufferPx,
|
|
148
|
-
columnBufferPx: rootProps.columnBufferPx,
|
|
149
177
|
resizeThrottleMs: rootProps.resizeThrottleMs,
|
|
150
178
|
onResize: (0, _useEventCallback.default)(size => apiRef.current.publishEvent('resize', size)),
|
|
151
179
|
onWheel: (0, _useEventCallback.default)(event => {
|
|
@@ -165,14 +193,6 @@ function useGridVirtualizer(apiRef, rootProps) {
|
|
|
165
193
|
});
|
|
166
194
|
},
|
|
167
195
|
scrollReset,
|
|
168
|
-
getColspan: (rowId, column) => {
|
|
169
|
-
if (typeof column.colSpan === 'function') {
|
|
170
|
-
const row = apiRef.current.getRow(rowId);
|
|
171
|
-
const value = apiRef.current.getRowValue(row, column);
|
|
172
|
-
return column.colSpan(value, row, column, apiRef) ?? 0;
|
|
173
|
-
}
|
|
174
|
-
return column.colSpan ?? 0;
|
|
175
|
-
},
|
|
176
196
|
renderRow: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.row, (0, _extends2.default)({
|
|
177
197
|
row: params.model,
|
|
178
198
|
rowId: params.id,
|
|
@@ -182,7 +202,7 @@ function useGridVirtualizer(apiRef, rootProps) {
|
|
|
182
202
|
columnsTotalWidth: columnsTotalWidth,
|
|
183
203
|
rowHeight: params.baseRowHeight,
|
|
184
204
|
pinnedColumns: pinnedColumns,
|
|
185
|
-
visibleColumns:
|
|
205
|
+
visibleColumns: visibleColumns,
|
|
186
206
|
firstColumnIndex: params.firstColumnIndex,
|
|
187
207
|
lastColumnIndex: params.lastColumnIndex,
|
|
188
208
|
focusedColumnIndex: params.focusedColumnIndex,
|
|
@@ -204,16 +224,16 @@ function useGridVirtualizer(apiRef, rootProps) {
|
|
|
204
224
|
//
|
|
205
225
|
// TODO(v9): Remove this
|
|
206
226
|
(0, _useFirstRender.useFirstRender)(() => {
|
|
207
|
-
apiRef.current.store.state.dimensions = virtualizer.store.state.dimensions;
|
|
227
|
+
apiRef.current.store.state.dimensions = addGridDimensions(virtualizer.store.state.dimensions, headerHeight, groupHeaderHeight, headerFilterHeight, headersTotalHeight);
|
|
208
228
|
apiRef.current.store.state.rowsMeta = virtualizer.store.state.rowsMeta;
|
|
209
229
|
apiRef.current.store.state.virtualization = virtualizer.store.state.virtualization;
|
|
210
230
|
});
|
|
231
|
+
(0, _store.useStoreEffect)(virtualizer.store, _xVirtualizer.Dimensions.selectors.dimensions, (_, dimensions) => {
|
|
232
|
+
apiRef.current.setState(gridState => (0, _extends2.default)({}, gridState, {
|
|
233
|
+
dimensions: addGridDimensions(dimensions, headerHeight, groupHeaderHeight, headerFilterHeight, headersTotalHeight)
|
|
234
|
+
}));
|
|
235
|
+
});
|
|
211
236
|
(0, _store.useStoreEffect)(virtualizer.store, identity, (_, state) => {
|
|
212
|
-
if (state.dimensions !== apiRef.current.state.dimensions) {
|
|
213
|
-
apiRef.current.setState(gridState => (0, _extends2.default)({}, gridState, {
|
|
214
|
-
dimensions: state.dimensions
|
|
215
|
-
}));
|
|
216
|
-
}
|
|
217
237
|
if (state.rowsMeta !== apiRef.current.state.rowsMeta) {
|
|
218
238
|
apiRef.current.setState(gridState => (0, _extends2.default)({}, gridState, {
|
|
219
239
|
rowsMeta: state.rowsMeta
|