@mui/x-data-grid 8.22.0 → 8.23.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.
- package/CHANGELOG.md +202 -0
- package/colDef/gridBooleanColDef.js +0 -1
- package/colDef/gridDateOperators.js +6 -6
- package/components/cell/GridBooleanCell.js +9 -1
- package/components/cell/GridFooterCell.d.ts +9 -0
- package/components/cell/GridFooterCell.js +54 -0
- package/components/columnSelection/GridCellCheckboxRenderer.js +4 -3
- package/components/containers/GridRootStyles.js +4 -0
- package/esm/colDef/gridBooleanColDef.js +0 -1
- package/esm/colDef/gridDateOperators.js +6 -6
- package/esm/components/cell/GridBooleanCell.js +9 -1
- package/esm/components/cell/GridFooterCell.d.ts +9 -0
- package/esm/components/cell/GridFooterCell.js +48 -0
- package/esm/components/columnSelection/GridCellCheckboxRenderer.js +4 -3
- package/esm/components/containers/GridRootStyles.js +4 -0
- package/esm/hooks/core/useGridProps.js +2 -1
- package/esm/hooks/features/columnResize/gridColumnResizeApi.d.ts +7 -0
- package/esm/hooks/features/columnResize/gridColumnResizeApi.js +1 -0
- package/esm/hooks/features/columnResize/useGridColumnResize.js +29 -2
- package/esm/hooks/features/columns/gridColumnsUtils.js +12 -7
- package/esm/hooks/features/dataSource/useGridDataSourceBase.d.ts +3 -3
- package/esm/hooks/features/editing/useGridCellEditing.js +1 -0
- package/esm/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +1 -1
- package/esm/hooks/features/pagination/gridPaginationSelector.js +3 -0
- package/esm/hooks/features/rowSelection/useGridRowSelection.js +17 -15
- package/esm/hooks/features/rowSelection/utils.js +36 -9
- package/esm/hooks/features/rows/useGridRowSpanning.js +1 -0
- package/esm/index.js +1 -1
- package/esm/internals/index.d.ts +2 -0
- package/esm/internals/index.js +1 -0
- package/esm/locales/ptPT.d.ts +2 -1
- package/esm/locales/ptPT.js +114 -125
- package/esm/locales/svSE.js +2 -2
- package/esm/models/gridAggregation.d.ts +18 -0
- package/esm/models/gridAggregation.js +1 -0
- package/esm/utils/domUtils.d.ts +1 -0
- package/esm/utils/domUtils.js +4 -0
- package/esm/utils/utils.d.ts +1 -1
- package/esm/utils/utils.js +2 -2
- package/hooks/core/useGridProps.js +2 -1
- package/hooks/features/columnResize/gridColumnResizeApi.d.ts +7 -0
- package/hooks/features/columnResize/gridColumnResizeApi.js +1 -0
- package/hooks/features/columnResize/useGridColumnResize.js +28 -1
- package/hooks/features/columns/gridColumnsUtils.js +12 -7
- package/hooks/features/dataSource/useGridDataSourceBase.d.ts +3 -3
- package/hooks/features/editing/useGridCellEditing.js +1 -0
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +1 -1
- package/hooks/features/pagination/gridPaginationSelector.js +3 -0
- package/hooks/features/rowSelection/useGridRowSelection.js +17 -15
- package/hooks/features/rowSelection/utils.js +36 -9
- package/hooks/features/rows/useGridRowSpanning.js +1 -0
- package/index.js +1 -1
- package/internals/index.d.ts +2 -0
- package/internals/index.js +8 -0
- package/locales/ptPT.d.ts +2 -1
- package/locales/ptPT.js +114 -125
- package/locales/svSE.js +2 -2
- package/models/gridAggregation.d.ts +18 -0
- package/models/gridAggregation.js +5 -0
- package/package.json +3 -3
- package/utils/domUtils.d.ts +1 -0
- package/utils/domUtils.js +5 -0
- package/utils/utils.d.ts +1 -1
- package/utils/utils.js +2 -2
package/esm/locales/ptPT.js
CHANGED
|
@@ -3,10 +3,9 @@ const ptPTGrid = {
|
|
|
3
3
|
// Root
|
|
4
4
|
noRowsLabel: 'Nenhuma linha',
|
|
5
5
|
noResultsOverlayLabel: 'Nenhum resultado encontrado.',
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
noColumnsOverlayLabel: 'Sem colunas',
|
|
7
|
+
noColumnsOverlayManageColumns: 'Gerir colunas',
|
|
8
|
+
emptyPivotOverlayLabel: 'Adicione campos às linhas, colunas e valores para criar uma tabela dinâmica',
|
|
10
9
|
// Density selector toolbar button text
|
|
11
10
|
toolbarDensity: 'Densidade',
|
|
12
11
|
toolbarDensityLabel: 'Densidade',
|
|
@@ -33,14 +32,11 @@ const ptPTGrid = {
|
|
|
33
32
|
toolbarExportPrint: 'Imprimir',
|
|
34
33
|
toolbarExportExcel: 'Descarregar como Excel',
|
|
35
34
|
// Toolbar pivot button
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
toolbarPivot: 'Pivot',
|
|
38
36
|
// Toolbar charts button
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
toolbarCharts: 'Gráficos',
|
|
41
38
|
// Toolbar AI Assistant button
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
toolbarAssistant: 'Assistente de IA',
|
|
44
40
|
// Columns management text
|
|
45
41
|
columnsManagementSearchTitle: 'Procurar',
|
|
46
42
|
columnsManagementNoColumns: 'Sem colunas',
|
|
@@ -99,18 +95,17 @@ const ptPTGrid = {
|
|
|
99
95
|
'headerFilterOperator=': 'É igual a',
|
|
100
96
|
'headerFilterOperator!=': 'Não é igual',
|
|
101
97
|
'headerFilterOperator>': 'Maior que',
|
|
102
|
-
'headerFilterOperator>=': '
|
|
98
|
+
'headerFilterOperator>=': 'Maior que ou igual a',
|
|
103
99
|
'headerFilterOperator<': 'Menor que',
|
|
104
|
-
'headerFilterOperator<=': '
|
|
105
|
-
|
|
106
|
-
|
|
100
|
+
'headerFilterOperator<=': 'Menor que ou igual a',
|
|
101
|
+
headerFilterClear: 'Limpar filtro',
|
|
107
102
|
// Filter values text
|
|
108
103
|
filterValueAny: 'qualquer',
|
|
109
104
|
filterValueTrue: 'verdadeiro',
|
|
110
105
|
filterValueFalse: 'falso',
|
|
111
106
|
// Column menu text
|
|
112
107
|
columnMenuLabel: 'Menu',
|
|
113
|
-
|
|
108
|
+
columnMenuAriaLabel: columnName => `Menu da coluna ${columnName}`,
|
|
114
109
|
columnMenuShowColumns: 'Mostrar colunas',
|
|
115
110
|
columnMenuManageColumns: 'Gerir colunas',
|
|
116
111
|
columnMenuFilter: 'Filtro',
|
|
@@ -118,9 +113,8 @@ const ptPTGrid = {
|
|
|
118
113
|
columnMenuUnsort: 'Desclassificar',
|
|
119
114
|
columnMenuSortAsc: 'Classificar por ordem crescente',
|
|
120
115
|
columnMenuSortDesc: 'Classificar por ordem decrescente',
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
116
|
+
columnMenuManagePivot: 'Gerir pivot',
|
|
117
|
+
columnMenuManageCharts: 'Gerir gráficos',
|
|
124
118
|
// Column header text
|
|
125
119
|
columnHeaderFiltersTooltipActive: count => count !== 1 ? `${count} filtros ativos` : `${count} filtro ativo`,
|
|
126
120
|
columnHeaderFiltersLabel: 'Mostrar filtros',
|
|
@@ -160,18 +154,18 @@ const ptPTGrid = {
|
|
|
160
154
|
collapseDetailPanel: 'Colapsar',
|
|
161
155
|
// Pagination
|
|
162
156
|
paginationRowsPerPage: 'Linhas por página:',
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
157
|
+
paginationDisplayedRows: ({
|
|
158
|
+
from,
|
|
159
|
+
to,
|
|
160
|
+
count,
|
|
161
|
+
estimated
|
|
162
|
+
}) => {
|
|
163
|
+
if (!estimated) {
|
|
164
|
+
return `${from}–${to} de ${count !== -1 ? count : `mais do que ${to}`}`;
|
|
165
|
+
}
|
|
166
|
+
const estimatedLabel = estimated && estimated > to ? `cerca de ${estimated}` : `mais do que ${to}`;
|
|
167
|
+
return `${from}–${to} de ${count !== -1 ? count : estimatedLabel}`;
|
|
168
|
+
},
|
|
175
169
|
paginationItemAriaLabel: type => {
|
|
176
170
|
if (type === 'first') {
|
|
177
171
|
return 'Primeira página';
|
|
@@ -189,114 +183,109 @@ const ptPTGrid = {
|
|
|
189
183
|
rowReorderingHeaderName: 'Reordenação de linhas',
|
|
190
184
|
// Aggregation
|
|
191
185
|
aggregationMenuItemHeader: 'Agregação',
|
|
192
|
-
|
|
186
|
+
aggregationFunctionLabelNone: 'nenhuma',
|
|
193
187
|
aggregationFunctionLabelSum: 'soma',
|
|
194
188
|
aggregationFunctionLabelAvg: 'média',
|
|
195
189
|
aggregationFunctionLabelMin: 'min',
|
|
196
190
|
aggregationFunctionLabelMax: 'máx.',
|
|
197
191
|
aggregationFunctionLabelSize: 'tamanho',
|
|
198
192
|
// Pivot panel
|
|
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
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
193
|
+
pivotToggleLabel: 'Pivot',
|
|
194
|
+
pivotRows: 'Linhas',
|
|
195
|
+
pivotColumns: 'Colunas',
|
|
196
|
+
pivotValues: 'Valores',
|
|
197
|
+
pivotCloseButton: 'Fechar configurações de pivot',
|
|
198
|
+
pivotSearchButton: 'Pesquisar campos',
|
|
199
|
+
pivotSearchControlPlaceholder: 'Pesquisar campos',
|
|
200
|
+
pivotSearchControlLabel: 'Pesquisar campos',
|
|
201
|
+
pivotSearchControlClear: 'Limpar pesquisa',
|
|
202
|
+
pivotNoFields: 'Nenhum campo',
|
|
203
|
+
pivotMenuMoveUp: 'Mover para cima',
|
|
204
|
+
pivotMenuMoveDown: 'Mover para baixo',
|
|
205
|
+
pivotMenuMoveToTop: 'Mover para o topo',
|
|
206
|
+
pivotMenuMoveToBottom: 'Mover para o fundo',
|
|
207
|
+
pivotMenuRows: 'Linhas',
|
|
208
|
+
pivotMenuColumns: 'Colunas',
|
|
209
|
+
pivotMenuValues: 'Valores',
|
|
210
|
+
pivotMenuOptions: 'Opções do campo',
|
|
211
|
+
pivotMenuAddToRows: 'Adicionar às Linhas',
|
|
212
|
+
pivotMenuAddToColumns: 'Adicionar às Colunas',
|
|
213
|
+
pivotMenuAddToValues: 'Adicionar aos Valores',
|
|
214
|
+
pivotMenuRemove: 'Remover',
|
|
215
|
+
pivotDragToRows: 'Arraste para aqui para criar linhas',
|
|
216
|
+
pivotDragToColumns: 'Arraste para aqui para criar colunas',
|
|
217
|
+
pivotDragToValues: 'Arraste para aqui para criar valores',
|
|
218
|
+
pivotYearColumnHeaderName: '(Ano)',
|
|
219
|
+
pivotQuarterColumnHeaderName: '(Trimestre)',
|
|
227
220
|
// Charts configuration panel
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
221
|
+
chartsNoCharts: 'Não há gráficos disponíveis',
|
|
222
|
+
chartsChartNotSelected: 'Selecione um tipo de gráfico para configurar as suas opções',
|
|
223
|
+
chartsTabChart: 'Gráfico',
|
|
224
|
+
chartsTabFields: 'Campos',
|
|
225
|
+
chartsTabCustomize: 'Personalizar',
|
|
226
|
+
chartsCloseButton: 'Fechar configuração de gráficos',
|
|
227
|
+
chartsSyncButtonLabel: 'Sincronizar gráfico',
|
|
228
|
+
chartsSearchPlaceholder: 'Pesquisar campos',
|
|
229
|
+
chartsSearchLabel: 'Pesquisar campos',
|
|
230
|
+
chartsSearchClear: 'Limpar pesquisa',
|
|
231
|
+
chartsNoFields: 'Nenhum campo',
|
|
232
|
+
chartsFieldBlocked: 'Este campo não pode ser adicionado a nenhuma secção',
|
|
233
|
+
chartsCategories: 'Categorias',
|
|
234
|
+
chartsSeries: 'Séries',
|
|
235
|
+
chartsMenuAddToDimensions: dimensionLabel => `Adicionar a ${dimensionLabel}`,
|
|
236
|
+
chartsMenuAddToValues: valuesLabel => `Adicionar a ${valuesLabel}`,
|
|
237
|
+
chartsMenuMoveUp: 'Mover para cima',
|
|
238
|
+
chartsMenuMoveDown: 'Mover para baixo',
|
|
239
|
+
chartsMenuMoveToTop: 'Mover para o topo',
|
|
240
|
+
chartsMenuMoveToBottom: 'Mover para o fundo',
|
|
241
|
+
chartsMenuOptions: 'Opções do campo',
|
|
242
|
+
chartsMenuRemove: 'Remover',
|
|
243
|
+
chartsDragToDimensions: dimensionLabel => `Arraste para aqui para usar a coluna como ${dimensionLabel}`,
|
|
244
|
+
chartsDragToValues: valuesLabel => `Arraste para aqui para usar a coluna como ${valuesLabel}`,
|
|
253
245
|
// AI Assistant panel
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
246
|
+
aiAssistantPanelTitle: 'Assistente de IA',
|
|
247
|
+
aiAssistantPanelClose: 'Fechar Assistente de IA',
|
|
248
|
+
aiAssistantPanelNewConversation: 'Nova conversa',
|
|
249
|
+
aiAssistantPanelConversationHistory: 'Histórico de conversas',
|
|
250
|
+
aiAssistantPanelEmptyConversation: 'Nenhum histórico de prompts',
|
|
251
|
+
aiAssistantSuggestions: 'Sugestões',
|
|
261
252
|
// Prompt field
|
|
262
253
|
promptFieldLabel: 'Prompt',
|
|
263
|
-
promptFieldPlaceholder: 'Digite um prompt
|
|
264
|
-
promptFieldPlaceholderWithRecording: 'Digite ou grave um prompt
|
|
265
|
-
promptFieldPlaceholderListening: 'Ouvindo o prompt
|
|
266
|
-
|
|
254
|
+
promptFieldPlaceholder: 'Digite um prompt',
|
|
255
|
+
promptFieldPlaceholderWithRecording: 'Digite ou grave um prompt',
|
|
256
|
+
promptFieldPlaceholderListening: 'Ouvindo o prompt',
|
|
257
|
+
promptFieldSpeechRecognitionNotSupported: 'Reconhecimento de voz não é suportado neste navegador',
|
|
267
258
|
promptFieldSend: 'Enviar',
|
|
268
259
|
promptFieldRecord: 'Gravar',
|
|
269
|
-
promptFieldStopRecording: 'Parar gravação'
|
|
270
|
-
|
|
260
|
+
promptFieldStopRecording: 'Parar gravação',
|
|
271
261
|
// Prompt
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
262
|
+
promptRerun: 'Executar novamente',
|
|
263
|
+
promptProcessing: 'Processando…',
|
|
264
|
+
promptAppliedChanges: 'Alterações aplicadas',
|
|
276
265
|
// Prompt changes
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
266
|
+
promptChangeGroupDescription: column => `Agrupar por ${column}`,
|
|
267
|
+
promptChangeAggregationLabel: (column, aggregation) => `${column} (${aggregation})`,
|
|
268
|
+
promptChangeAggregationDescription: (column, aggregation) => `Agregar ${column} (${aggregation})`,
|
|
269
|
+
promptChangeFilterLabel: (column, operator, value) => {
|
|
270
|
+
if (operator === 'is any of') {
|
|
271
|
+
return `${column} é um de: ${value}`;
|
|
272
|
+
}
|
|
273
|
+
return `${column} ${operator} ${value}`;
|
|
274
|
+
},
|
|
275
|
+
promptChangeFilterDescription: (column, operator, value) => {
|
|
276
|
+
if (operator === 'is any of') {
|
|
277
|
+
return `Filtrar onde ${column} é um de: ${value}`;
|
|
278
|
+
}
|
|
279
|
+
return `Filtrar onde ${column} ${operator} ${value}`;
|
|
280
|
+
},
|
|
281
|
+
promptChangeSortDescription: (column, direction) => `Ordenar por ${column} (${direction})`,
|
|
282
|
+
promptChangePivotEnableLabel: 'Pivot',
|
|
283
|
+
promptChangePivotEnableDescription: 'Ativar pivot',
|
|
284
|
+
promptChangePivotColumnsLabel: count => `Colunas (${count})`,
|
|
285
|
+
promptChangePivotColumnsDescription: (column, direction) => `${column}${direction ? ` (${direction})` : ''}`,
|
|
286
|
+
promptChangePivotRowsLabel: count => `Linhas (${count})`,
|
|
287
|
+
promptChangePivotValuesLabel: count => `Valores (${count})`,
|
|
288
|
+
promptChangePivotValuesDescription: (column, aggregation) => `${column} (${aggregation})`,
|
|
289
|
+
promptChangeChartsLabel: (dimensionsCount, valuesCount) => `Dimensões (${dimensionsCount}), Valores (${valuesCount})`
|
|
301
290
|
};
|
|
302
291
|
export const ptPT = getGridLocalization(ptPTGrid);
|
package/esm/locales/svSE.js
CHANGED
|
@@ -3,8 +3,8 @@ const svSEGrid = {
|
|
|
3
3
|
// Root
|
|
4
4
|
noRowsLabel: 'Inga rader',
|
|
5
5
|
noResultsOverlayLabel: 'Inga resultat funna.',
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
noColumnsOverlayLabel: 'Inga kolumner',
|
|
7
|
+
noColumnsOverlayManageColumns: 'Hantera kolumner',
|
|
8
8
|
// emptyPivotOverlayLabel: 'Add fields to rows, columns, and values to create a pivot table',
|
|
9
9
|
|
|
10
10
|
// Density selector toolbar button text
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type GridAggregationPosition = 'inline' | 'footer';
|
|
2
|
+
export interface GridAggregationCellMeta {
|
|
3
|
+
/**
|
|
4
|
+
* If `true`, the current aggregated value has the same unit as the value of the other cells of this row.
|
|
5
|
+
* For instance, "min" / "max" aggregation have the same unit as the other cells.
|
|
6
|
+
* If `false`, the current aggregated value has another unit or not unit.
|
|
7
|
+
* For instance, "size" aggregation has no unit.
|
|
8
|
+
*/
|
|
9
|
+
hasCellUnit: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Name of the aggregation function currently applied on this cell.
|
|
12
|
+
*/
|
|
13
|
+
aggregationFunctionName: string;
|
|
14
|
+
/**
|
|
15
|
+
* Position of the aggregated value.
|
|
16
|
+
*/
|
|
17
|
+
position: GridAggregationPosition;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/esm/utils/domUtils.d.ts
CHANGED
|
@@ -26,4 +26,5 @@ export declare function findRightPinnedCellsBeforeCol(api: GridPrivateApiCommuni
|
|
|
26
26
|
export declare function findLeftPinnedHeadersAfterCol(api: GridPrivateApiCommunity, col: HTMLElement, isRtl: boolean): HTMLElement[];
|
|
27
27
|
export declare function findRightPinnedHeadersBeforeCol(api: GridPrivateApiCommunity, col: HTMLElement, isRtl: boolean): HTMLElement[];
|
|
28
28
|
export declare function findGridHeader(api: GridPrivateApiCommunity, field: string): Element | null;
|
|
29
|
+
export declare function findGridHeaderFilter(api: GridPrivateApiCommunity, field: string): Element | null;
|
|
29
30
|
export declare function findGridCells(api: GridPrivateApiCommunity, field: string): Element[];
|
package/esm/utils/domUtils.js
CHANGED
|
@@ -186,6 +186,10 @@ export function findGridHeader(api, field) {
|
|
|
186
186
|
const headers = api.columnHeadersContainerRef.current;
|
|
187
187
|
return headers.querySelector(`:scope > div > [data-field="${escapeOperandAttributeSelector(field)}"][role="columnheader"]`);
|
|
188
188
|
}
|
|
189
|
+
export function findGridHeaderFilter(api, field) {
|
|
190
|
+
const headers = api.columnHeadersContainerRef.current;
|
|
191
|
+
return headers.querySelector(`:scope > .${gridClasses.headerFilterRow} > [data-field="${escapeOperandAttributeSelector(field)}"]`);
|
|
192
|
+
}
|
|
189
193
|
export function findGridCells(api, field) {
|
|
190
194
|
const container = api.virtualScrollerRef.current;
|
|
191
195
|
return Array.from(container.querySelectorAll(`:scope > div > div > div > [data-field="${escapeOperandAttributeSelector(field)}"][role="gridcell"]`));
|
package/esm/utils/utils.d.ts
CHANGED
|
@@ -27,4 +27,4 @@ export declare function deepClone(obj: Record<string, any>): any;
|
|
|
27
27
|
* that hint disables checks on all values instead of just one.
|
|
28
28
|
*/
|
|
29
29
|
export declare function eslintUseValue(_: any): void;
|
|
30
|
-
export declare const runIf: (condition: boolean, fn: Function) => (params: unknown) => void;
|
|
30
|
+
export declare const runIf: (condition: boolean, fn: Function) => (...params: unknown[]) => void;
|
package/esm/utils/utils.js
CHANGED
|
@@ -75,8 +75,8 @@ export function deepClone(obj) {
|
|
|
75
75
|
* that hint disables checks on all values instead of just one.
|
|
76
76
|
*/
|
|
77
77
|
export function eslintUseValue(_) {}
|
|
78
|
-
export const runIf = (condition, fn) => params => {
|
|
78
|
+
export const runIf = (condition, fn) => (...params) => {
|
|
79
79
|
if (condition) {
|
|
80
|
-
fn(params);
|
|
80
|
+
fn(...params);
|
|
81
81
|
}
|
|
82
82
|
};
|
|
@@ -14,7 +14,8 @@ const propsStateInitializer = (state, props) => {
|
|
|
14
14
|
props: {
|
|
15
15
|
listView: props.listView,
|
|
16
16
|
getRowId: props.getRowId,
|
|
17
|
-
isCellEditable: props.isCellEditable
|
|
17
|
+
isCellEditable: props.isCellEditable,
|
|
18
|
+
isRowSelectable: props.isRowSelectable
|
|
18
19
|
}
|
|
19
20
|
});
|
|
20
21
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { GridColDef } from "../../../models/colDef/gridColDef.js";
|
|
2
2
|
export declare const DEFAULT_GRID_AUTOSIZE_OPTIONS: {
|
|
3
3
|
includeHeaders: boolean;
|
|
4
|
+
includeHeaderFilters: boolean;
|
|
4
5
|
includeOutliers: boolean;
|
|
5
6
|
outliersFactor: number;
|
|
6
7
|
expand: boolean;
|
|
@@ -16,6 +17,12 @@ export type GridAutosizeOptions = {
|
|
|
16
17
|
* @default false
|
|
17
18
|
*/
|
|
18
19
|
includeHeaders?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* If true, include header filter widths in the calculation.
|
|
22
|
+
* Only applies when header filters are enabled.
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
includeHeaderFilters?: boolean;
|
|
19
26
|
/**
|
|
20
27
|
* If true, width outliers will be ignored.
|
|
21
28
|
* @default false
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.DEFAULT_GRID_AUTOSIZE_OPTIONS = void 0;
|
|
7
7
|
const DEFAULT_GRID_AUTOSIZE_OPTIONS = exports.DEFAULT_GRID_AUTOSIZE_OPTIONS = {
|
|
8
8
|
includeHeaders: true,
|
|
9
|
+
includeHeaderFilters: false,
|
|
9
10
|
includeOutliers: false,
|
|
10
11
|
outliersFactor: 1.5,
|
|
11
12
|
expand: false,
|
|
@@ -24,6 +24,8 @@ var _useTimeout = require("../../utils/useTimeout");
|
|
|
24
24
|
var _gridColumnsInterfaces = require("../columns/gridColumnsInterfaces");
|
|
25
25
|
var _columns = require("../columns");
|
|
26
26
|
var _dimensions = require("../dimensions");
|
|
27
|
+
var _headerFiltering = require("../headerFiltering");
|
|
28
|
+
var _columnResizeSelector = require("./columnResizeSelector");
|
|
27
29
|
function trackFinger(event, currentTouchId) {
|
|
28
30
|
if (currentTouchId !== undefined && event.changedTouches) {
|
|
29
31
|
for (let i = 0; i < event.changedTouches.length; i += 1) {
|
|
@@ -140,6 +142,7 @@ function extractColumnWidths(apiRef, options, columns) {
|
|
|
140
142
|
const widthByField = {};
|
|
141
143
|
const root = apiRef.current.rootElementRef.current;
|
|
142
144
|
root.classList.add(_gridClasses.gridClasses.autosizing);
|
|
145
|
+
const includeHeaderFilters = options.includeHeaderFilters && (0, _headerFiltering.gridHeaderFilteringEnabledSelector)(apiRef);
|
|
143
146
|
columns.forEach(column => {
|
|
144
147
|
const cells = (0, _domUtils.findGridCells)(apiRef.current, column.field);
|
|
145
148
|
const widths = cells.map(cell => {
|
|
@@ -170,6 +173,16 @@ function extractColumnWidths(apiRef, options, columns) {
|
|
|
170
173
|
filteredWidths.push(width);
|
|
171
174
|
}
|
|
172
175
|
}
|
|
176
|
+
if (includeHeaderFilters) {
|
|
177
|
+
const headerFilter = (0, _domUtils.findGridHeaderFilter)(apiRef.current, column.field);
|
|
178
|
+
if (headerFilter) {
|
|
179
|
+
const style = window.getComputedStyle(headerFilter, null);
|
|
180
|
+
const paddingWidth = parseInt(style.paddingLeft, 10) + parseInt(style.paddingRight, 10);
|
|
181
|
+
const contentWidth = headerFilter.scrollWidth;
|
|
182
|
+
const width = contentWidth + paddingWidth;
|
|
183
|
+
filteredWidths.push(width);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
173
186
|
const hasColumnMin = column.minWidth !== -Infinity && column.minWidth !== undefined;
|
|
174
187
|
const hasColumnMax = column.maxWidth !== Infinity && column.maxWidth !== undefined;
|
|
175
188
|
const min = hasColumnMin ? column.minWidth : 0;
|
|
@@ -328,6 +341,11 @@ const useGridColumnResize = (apiRef, props) => {
|
|
|
328
341
|
apiRef.current.publishEvent('columnResizeStop', null, nativeEvent);
|
|
329
342
|
});
|
|
330
343
|
};
|
|
344
|
+
const setCellElementsRef = () => {
|
|
345
|
+
if (refs.columnHeaderElement) {
|
|
346
|
+
refs.cellElements = (0, _domUtils.findGridCellElementsFromCol)(refs.columnHeaderElement, apiRef.current);
|
|
347
|
+
}
|
|
348
|
+
};
|
|
331
349
|
const storeReferences = (colDef, separator, xStart) => {
|
|
332
350
|
const root = apiRef.current.rootElementRef.current;
|
|
333
351
|
refs.initialColWidth = colDef.computedWidth;
|
|
@@ -339,7 +357,7 @@ const useGridColumnResize = (apiRef, props) => {
|
|
|
339
357
|
refs.headerFilterElement = headerFilterElement;
|
|
340
358
|
}
|
|
341
359
|
refs.groupHeaderElements = (0, _domUtils.findGroupHeaderElementsFromField)(apiRef.current.columnHeadersContainerRef?.current, colDef.field);
|
|
342
|
-
|
|
360
|
+
setCellElementsRef();
|
|
343
361
|
refs.fillerLeft = (0, _domUtils.findGridElement)(apiRef.current, isRtl ? 'filler--pinnedRight' : 'filler--pinnedLeft');
|
|
344
362
|
refs.fillerRight = (0, _domUtils.findGridElement)(apiRef.current, isRtl ? 'filler--pinnedLeft' : 'filler--pinnedRight');
|
|
345
363
|
const pinnedPosition = apiRef.current.unstable_applyPipeProcessors('isColumnPinned', false, refs.colDef.field);
|
|
@@ -586,6 +604,15 @@ const useGridColumnResize = (apiRef, props) => {
|
|
|
586
604
|
(0, _utils.useGridEvent)(apiRef, 'columnResizeStart', handleResizeStart);
|
|
587
605
|
(0, _utils.useGridEvent)(apiRef, 'columnSeparatorMouseDown', handleColumnResizeMouseDown);
|
|
588
606
|
(0, _utils.useGridEvent)(apiRef, 'columnSeparatorDoubleClick', handleColumnSeparatorDoubleClick);
|
|
607
|
+
(0, _utils.useGridEvent)(apiRef, 'rowsSet', () => {
|
|
608
|
+
// if the user is still resizing the column, update the cell references included in the resize action
|
|
609
|
+
if ((0, _columnResizeSelector.gridResizingColumnFieldSelector)(apiRef) !== '') {
|
|
610
|
+
// wait until the rows are in the DOM
|
|
611
|
+
requestAnimationFrame(() => {
|
|
612
|
+
setCellElementsRef();
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
});
|
|
589
616
|
(0, _utils.useGridEventPriority)(apiRef, 'columnResize', props.onColumnResize);
|
|
590
617
|
(0, _utils.useGridEventPriority)(apiRef, 'columnWidthChange', props.onColumnWidthChange);
|
|
591
618
|
};
|
|
@@ -251,8 +251,7 @@ const createColumnsState = ({
|
|
|
251
251
|
const currentState = (0, _gridColumnsSelector.gridColumnsStateSelector)(apiRef);
|
|
252
252
|
columnsState = {
|
|
253
253
|
orderedFields: keepOnlyColumnsToUpsert ? [] : [...currentState.orderedFields],
|
|
254
|
-
lookup: (0, _extends2.default)({}, currentState.lookup),
|
|
255
|
-
// Will be cleaned later if keepOnlyColumnsToUpsert=true
|
|
254
|
+
lookup: keepOnlyColumnsToUpsert ? {} : (0, _extends2.default)({}, currentState.lookup),
|
|
256
255
|
columnVisibilityModel,
|
|
257
256
|
initialColumnVisibilityModel: updateInitialVisibilityModel ? columnVisibilityModel : currentState.initialColumnVisibilityModel
|
|
258
257
|
};
|
|
@@ -265,12 +264,10 @@ const createColumnsState = ({
|
|
|
265
264
|
}
|
|
266
265
|
}
|
|
267
266
|
}
|
|
268
|
-
const columnsToUpsertLookup = {};
|
|
269
267
|
columnsToUpsert.forEach(newColumn => {
|
|
270
268
|
const {
|
|
271
269
|
field
|
|
272
270
|
} = newColumn;
|
|
273
|
-
columnsToUpsertLookup[field] = true;
|
|
274
271
|
columnsToKeep[field] = true;
|
|
275
272
|
let existingState = columnsState.lookup[field];
|
|
276
273
|
if (existingState == null) {
|
|
@@ -298,9 +295,17 @@ const createColumnsState = ({
|
|
|
298
295
|
}
|
|
299
296
|
}
|
|
300
297
|
});
|
|
301
|
-
|
|
302
|
-
hasBeenResized
|
|
303
|
-
|
|
298
|
+
const mergedProps = (0, _extends2.default)({}, getDefaultColTypeDef(newColumn.type), {
|
|
299
|
+
hasBeenResized,
|
|
300
|
+
field
|
|
301
|
+
});
|
|
302
|
+
let key;
|
|
303
|
+
for (key in newColumn) {
|
|
304
|
+
if (newColumn[key] !== undefined && key !== 'field') {
|
|
305
|
+
mergedProps[key] = newColumn[key];
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
columnsState.lookup[field] = (0, _resolveProps.default)(existingState, mergedProps);
|
|
304
309
|
});
|
|
305
310
|
if (keepOnlyColumnsToUpsert && !isInsideStateInitializer) {
|
|
306
311
|
Object.keys(columnsState.lookup).forEach(field => {
|
|
@@ -21,8 +21,8 @@ export declare const useGridDataSourceBase: <Api extends GridPrivateApiCommunity
|
|
|
21
21
|
cache: GridDataSourceCache;
|
|
22
22
|
events: {
|
|
23
23
|
strategyAvailabilityChange: GridEventListener<"strategyAvailabilityChange">;
|
|
24
|
-
sortModelChange: (params: unknown) => void;
|
|
25
|
-
filterModelChange: (params: unknown) => void;
|
|
26
|
-
paginationModelChange: (params: unknown) => void;
|
|
24
|
+
sortModelChange: (...params: unknown[]) => void;
|
|
25
|
+
filterModelChange: (...params: unknown[]) => void;
|
|
26
|
+
paginationModelChange: (...params: unknown[]) => void;
|
|
27
27
|
};
|
|
28
28
|
};
|
|
@@ -114,6 +114,7 @@ const useGridCellEditing = (apiRef, props) => {
|
|
|
114
114
|
reason = _gridEditCellParams.GridCellEditStartReasons.pasteKeyDown;
|
|
115
115
|
} else if (event.key === 'Enter') {
|
|
116
116
|
reason = _gridEditCellParams.GridCellEditStartReasons.enterKeyDown;
|
|
117
|
+
event.preventDefault();
|
|
117
118
|
} else if (event.key === 'Backspace' || event.key === 'Delete') {
|
|
118
119
|
reason = _gridEditCellParams.GridCellEditStartReasons.deleteKeyDown;
|
|
119
120
|
}
|
|
@@ -113,7 +113,7 @@ const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
113
113
|
// There is one exception for the checkBoxHeader
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
|
-
if (!(0, _keyboardUtils.isNavigationKey)(event.key) && event.key !== 'Tab') {
|
|
116
|
+
if (!(0, _keyboardUtils.isNavigationKey)(event.key) && event.key !== 'Tab' && event.key !== 'Enter') {
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
119
|
|
|
@@ -66,6 +66,9 @@ const gridPaginationRowRangeSelector = exports.gridPaginationRowRangeSelector =
|
|
|
66
66
|
if (!clientSidePaginationEnabled) {
|
|
67
67
|
return null;
|
|
68
68
|
}
|
|
69
|
+
if (!visibleSortedRowEntries || visibleSortedRowEntries.length === 0) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
69
72
|
const visibleTopLevelRowCount = visibleSortedTopLevelRowEntries.length;
|
|
70
73
|
const topLevelFirstRowIndex = Math.min(paginationModel.pageSize * paginationModel.page, visibleTopLevelRowCount - 1);
|
|
71
74
|
const topLevelLastRowIndex = paginationModel.pageSize === ALL_RESULTS_PAGE_VALUE ? visibleTopLevelRowCount - 1 : Math.min(topLevelFirstRowIndex + paginationModel.pageSize - 1, visibleTopLevelRowCount - 1);
|