@mui/x-data-grid 5.17.18 → 5.17.20

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 (46) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/components/columnHeaders/GridColumnHeaders.js +1 -0
  3. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +1 -1
  4. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
  5. package/components/panel/filterPanel/GridFilterInputMultipleValue.js +0 -1
  6. package/hooks/features/export/useGridPrintExport.js +31 -17
  7. package/hooks/features/virtualization/useGridVirtualScroller.js +2 -6
  8. package/index.js +1 -1
  9. package/internals/index.d.ts +1 -1
  10. package/internals/index.js +1 -1
  11. package/legacy/components/columnHeaders/GridColumnHeaders.js +1 -0
  12. package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
  13. package/legacy/components/panel/filterPanel/GridFilterInputMultipleValue.js +0 -1
  14. package/legacy/hooks/features/export/useGridPrintExport.js +33 -20
  15. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +2 -6
  16. package/legacy/index.js +1 -1
  17. package/legacy/internals/index.js +1 -1
  18. package/legacy/locales/esES.js +27 -27
  19. package/legacy/locales/svSE.js +10 -10
  20. package/legacy/utils/utils.js +1 -1
  21. package/locales/esES.js +27 -27
  22. package/locales/svSE.js +10 -10
  23. package/models/api/gridParamsApi.d.ts +1 -1
  24. package/modern/components/columnHeaders/GridColumnHeaders.js +1 -0
  25. package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
  26. package/modern/components/panel/filterPanel/GridFilterInputMultipleValue.js +0 -1
  27. package/modern/hooks/features/export/useGridPrintExport.js +30 -16
  28. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +2 -6
  29. package/modern/index.js +1 -1
  30. package/modern/internals/index.js +1 -1
  31. package/modern/locales/esES.js +27 -27
  32. package/modern/locales/svSE.js +10 -10
  33. package/modern/utils/utils.js +1 -1
  34. package/node/components/columnHeaders/GridColumnHeaders.js +1 -0
  35. package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
  36. package/node/components/panel/filterPanel/GridFilterInputMultipleValue.js +0 -1
  37. package/node/hooks/features/export/useGridPrintExport.js +31 -17
  38. package/node/hooks/features/virtualization/useGridVirtualScroller.js +2 -6
  39. package/node/index.js +1 -1
  40. package/node/internals/index.js +6 -0
  41. package/node/locales/esES.js +27 -27
  42. package/node/locales/svSE.js +10 -10
  43. package/node/utils/utils.js +1 -1
  44. package/package.json +1 -1
  45. package/utils/utils.d.ts +1 -1
  46. package/utils/utils.js +1 -1
package/locales/esES.js CHANGED
@@ -3,7 +3,7 @@ import { getGridLocalization } from '../utils/getGridLocalization';
3
3
  const esESGrid = {
4
4
  // Root
5
5
  noRowsLabel: 'Sin filas',
6
- // noResultsOverlayLabel: 'No results found.',
6
+ noResultsOverlayLabel: 'Resultados no encontrados',
7
7
  errorOverlayDefaultLabel: 'Ha ocurrido un error.',
8
8
  // Density selector toolbar button text
9
9
  toolbarDensity: 'Densidad',
@@ -21,15 +21,15 @@ const esESGrid = {
21
21
  toolbarFiltersTooltipShow: 'Mostrar filtros',
22
22
  toolbarFiltersTooltipActive: count => count > 1 ? `${count} filtros activos` : `${count} filtro activo`,
23
23
  // Quick filter toolbar field
24
- // toolbarQuickFilterPlaceholder: 'Search…',
25
- // toolbarQuickFilterLabel: 'Search',
26
- // toolbarQuickFilterDeleteIconLabel: 'Clear',
24
+ toolbarQuickFilterPlaceholder: 'Buscar…',
25
+ toolbarQuickFilterLabel: 'Buscar',
26
+ toolbarQuickFilterDeleteIconLabel: 'Limpiar',
27
27
  // Export selector toolbar button text
28
28
  toolbarExport: 'Exportar',
29
29
  toolbarExportLabel: 'Exportar',
30
30
  toolbarExportCSV: 'Descargar como CSV',
31
- // toolbarExportPrint: 'Print',
32
- // toolbarExportExcel: 'Download as Excel',
31
+ toolbarExportPrint: 'Imprimir',
32
+ toolbarExportExcel: 'Descargar como Excel',
33
33
  // Columns panel text
34
34
  columnsPanelTextFieldLabel: 'Columna de búsqueda',
35
35
  columnsPanelTextFieldPlaceholder: 'Título de columna',
@@ -39,7 +39,7 @@ const esESGrid = {
39
39
  // Filter panel text
40
40
  filterPanelAddFilter: 'Agregar filtro',
41
41
  filterPanelDeleteIconLabel: 'Borrar',
42
- // filterPanelLinkOperator: 'Logic operator',
42
+ filterPanelLinkOperator: 'Operador lógico',
43
43
  filterPanelOperators: 'Operadores',
44
44
  // TODO v6: rename to filterPanelOperator
45
45
  filterPanelOperatorAnd: 'Y',
@@ -60,11 +60,11 @@ const esESGrid = {
60
60
  filterOperatorOnOrBefore: 'es en o anterior',
61
61
  filterOperatorIsEmpty: 'está vacío',
62
62
  filterOperatorIsNotEmpty: 'no esta vacío',
63
- // filterOperatorIsAnyOf: 'is any of',
63
+ filterOperatorIsAnyOf: 'es cualquiera de',
64
64
  // Filter values text
65
- // filterValueAny: 'any',
66
- // filterValueTrue: 'true',
67
- // filterValueFalse: 'false',
65
+ filterValueAny: 'cualquiera',
66
+ filterValueTrue: 'verdadero',
67
+ filterValueFalse: 'falso',
68
68
  // Column menu text
69
69
  columnMenuLabel: 'Menú',
70
70
  columnMenuShowColumns: 'Mostrar columnas',
@@ -84,19 +84,20 @@ const esESGrid = {
84
84
  // Total visible row amount footer text
85
85
  footerTotalVisibleRows: (visibleCount, totalCount) => `${visibleCount.toLocaleString()} de ${totalCount.toLocaleString()}`,
86
86
  // Checkbox selection text
87
- // checkboxSelectionHeaderName: 'Checkbox selection',
88
- // checkboxSelectionSelectAllRows: 'Select all rows',
89
- // checkboxSelectionUnselectAllRows: 'Unselect all rows',
90
- // checkboxSelectionSelectRow: 'Select row',
91
- // checkboxSelectionUnselectRow: 'Unselect row',
87
+ checkboxSelectionHeaderName: 'Seleccionar casilla',
88
+ checkboxSelectionSelectAllRows: 'Seleccionar todas las filas',
89
+ checkboxSelectionUnselectAllRows: 'Deseleccionar todas las filas',
90
+ checkboxSelectionSelectRow: 'Seleccionar fila',
91
+ checkboxSelectionUnselectRow: 'Deseleccionar fila',
92
92
  // Boolean cell text
93
- // booleanCellTrueLabel: 'yes',
94
- // booleanCellFalseLabel: 'no',
93
+ booleanCellTrueLabel: 'si',
94
+ booleanCellFalseLabel: 'no',
95
95
  // Actions cell more text
96
- actionsCellMore: 'más' // Column pinning text
97
- // pinToLeft: 'Pin to left',
98
- // pinToRight: 'Pin to right',
99
- // unpin: 'Unpin',
96
+ actionsCellMore: 'más',
97
+ // Column pinning text
98
+ pinToLeft: 'Anclar a la izquierda',
99
+ pinToRight: 'Anclar a la derecha',
100
+ unpin: 'Desanclar',
100
101
  // Tree Data
101
102
  // treeDataGroupingHeaderName: 'Group',
102
103
  // treeDataExpand: 'see children',
@@ -107,17 +108,16 @@ const esESGrid = {
107
108
  // unGroupColumn: name => `Stop grouping by ${name}`,
108
109
  // Master/detail
109
110
  // detailPanelToggle: 'Detail panel toggle',
110
- // expandDetailPanel: 'Expand',
111
- // collapseDetailPanel: 'Collapse',
111
+ expandDetailPanel: 'Expandir',
112
+ collapseDetailPanel: 'reducirse',
112
113
  // Row reordering text
113
114
  // rowReorderingHeaderName: 'Row reordering',
114
115
  // Aggregation
115
116
  // aggregationMenuItemHeader: 'Aggregation',
116
117
  // aggregationFunctionLabelSum: 'sum',
117
118
  // aggregationFunctionLabelAvg: 'avg',
118
- // aggregationFunctionLabelMin: 'min',
119
- // aggregationFunctionLabelMax: 'max',
120
- // aggregationFunctionLabelSize: 'size',
119
+ aggregationFunctionLabelMin: 'min',
120
+ aggregationFunctionLabelMax: 'max' // aggregationFunctionLabelSize: 'size',
121
121
 
122
122
  };
123
123
  export const esES = getGridLocalization(esESGrid, esESCore);
package/locales/svSE.js CHANGED
@@ -97,7 +97,7 @@ const svSEGrid = {
97
97
  // Column pinning text
98
98
  pinToLeft: 'Fäst till vänster',
99
99
  pinToRight: 'Fäst till höger',
100
- unpin: 'Ta bort fäste',
100
+ unpin: 'Ta bort fästning',
101
101
  // Tree Data
102
102
  treeDataGroupingHeaderName: 'Grupp',
103
103
  treeDataExpand: 'visa underordnade',
@@ -107,17 +107,17 @@ const svSEGrid = {
107
107
  groupColumn: name => `Gruppera efter ${name}`,
108
108
  unGroupColumn: name => `Sluta gruppera efter ${name}`,
109
109
  // Master/detail
110
- // detailPanelToggle: 'Detail panel toggle',
110
+ detailPanelToggle: 'Växla detaljpanel',
111
111
  expandDetailPanel: 'Expandera',
112
112
  collapseDetailPanel: 'Kollapsa',
113
113
  // Row reordering text
114
- rowReorderingHeaderName: 'Ordna om rader' // Aggregation
115
- // aggregationMenuItemHeader: 'Aggregation',
116
- // aggregationFunctionLabelSum: 'sum',
117
- // aggregationFunctionLabelAvg: 'avg',
118
- // aggregationFunctionLabelMin: 'min',
119
- // aggregationFunctionLabelMax: 'max',
120
- // aggregationFunctionLabelSize: 'size',
121
-
114
+ rowReorderingHeaderName: 'Ordna om rader',
115
+ // Aggregation
116
+ aggregationMenuItemHeader: 'Aggregering',
117
+ aggregationFunctionLabelSum: 'sum',
118
+ aggregationFunctionLabelAvg: 'medel',
119
+ aggregationFunctionLabelMin: 'min',
120
+ aggregationFunctionLabelMax: 'max',
121
+ aggregationFunctionLabelSize: 'antal'
122
122
  };
123
123
  export const svSE = getGridLocalization(svSEGrid, svSECore);
@@ -24,7 +24,7 @@ export interface GridParamsApi {
24
24
  * @param {string} field The column field.
25
25
  * @returns {GridCellParams} The cell params.
26
26
  */
27
- getCellParams: <V = any, R extends GridValidRowModel = any, F = V>(id: GridRowId, field: string) => GridCellParams<V, R, F>;
27
+ getCellParams: <V = unknown, R extends GridValidRowModel = any, F = V>(id: GridRowId, field: string) => GridCellParams<V, R, F>;
28
28
  /**
29
29
  * Gets the [[GridRowParams]] object that is passed as argument in events.
30
30
  * @param {GridRowId} id The id of the row.
@@ -35,6 +35,7 @@ const GridColumnHeadersRoot = styled('div', {
35
35
  overflow: 'hidden',
36
36
  display: 'flex',
37
37
  alignItems: 'center',
38
+ boxSizing: 'border-box',
38
39
  borderBottom: `1px solid ${borderColor}`,
39
40
  borderTopLeftRadius: theme.shape.borderRadius,
40
41
  borderTopRightRadius: theme.shape.borderRadius
@@ -105,7 +105,6 @@ function GridFilterInputMultipleSingleSelect(props) {
105
105
  }, [applyValue, item]);
106
106
  return /*#__PURE__*/_jsx(Autocomplete, _extends({
107
107
  multiple: true,
108
- limitTags: 1,
109
108
  options: resolvedValueOptions,
110
109
  isOptionEqualToValue: isOptionEqualToValue,
111
110
  filterOptions: filter,
@@ -47,7 +47,6 @@ function GridFilterInputMultipleValue(props) {
47
47
  return /*#__PURE__*/_jsx(Autocomplete, _extends({
48
48
  multiple: true,
49
49
  freeSolo: true,
50
- limitTags: 1,
51
50
  options: [],
52
51
  filterOptions: (options, params) => {
53
52
  const {
@@ -13,6 +13,14 @@ import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
13
13
  import { GridPrintExportMenuItem } from '../../../components/toolbar/GridToolbarExport';
14
14
  import { jsx as _jsx } from "react/jsx-runtime";
15
15
 
16
+ function raf() {
17
+ return new Promise(resolve => {
18
+ requestAnimationFrame(() => {
19
+ resolve();
20
+ });
21
+ });
22
+ }
23
+
16
24
  /**
17
25
  * @requires useGridColumns (state)
18
26
  * @requires useGridFilter (state)
@@ -30,6 +38,7 @@ export const useGridPrintExport = (apiRef, props) => {
30
38
  // the new state needs to be in place before the grid can be sized correctly
31
39
 
32
40
  const updateGridColumnsForPrint = React.useCallback((fields, allColumns) => new Promise(resolve => {
41
+ // TODO remove unused Promise
33
42
  if (!fields && !allColumns) {
34
43
  resolve();
35
44
  return;
@@ -49,12 +58,10 @@ export const useGridPrintExport = (apiRef, props) => {
49
58
  });
50
59
  apiRef.current.setColumnVisibilityModel(newColumnVisibilityModel);
51
60
  resolve();
52
- }), [apiRef]);
61
+ }), [apiRef]); // TODO move outside of this scope and remove React.useCallback
62
+
53
63
  const buildPrintWindow = React.useCallback(title => {
54
64
  const iframeEl = document.createElement('iframe');
55
- iframeEl.id = 'grid-print-window'; // Without this 'onload' event won't fire in some browsers
56
-
57
- iframeEl.src = window.location.href;
58
65
  iframeEl.style.position = 'absolute';
59
66
  iframeEl.style.width = '0px';
60
67
  iframeEl.style.height = '0px';
@@ -66,12 +73,9 @@ export const useGridPrintExport = (apiRef, props) => {
66
73
  copyStyles: true,
67
74
  hideToolbar: false,
68
75
  hideFooter: false
69
- }, options); // Some agents, such as IE11 and Enzyme (as of 2 Jun 2020) continuously call the
70
- // `onload` callback. This ensures that it is only called once.
76
+ }, options);
71
77
 
72
-
73
- printWindow.onload = null;
74
- const printDoc = printWindow.contentDocument || printWindow.contentWindow?.document;
78
+ const printDoc = printWindow.contentDocument;
75
79
 
76
80
  if (!printDoc) {
77
81
  return;
@@ -107,10 +111,12 @@ export const useGridPrintExport = (apiRef, props) => {
107
111
  } // Expand container height to accommodate all rows
108
112
 
109
113
 
110
- gridClone.style.height = `${rowsMeta.currentPageTotalHeight + totalHeaderHeight + gridToolbarElementHeight + gridFooterElementHeight}px`; // Remove all loaded elements from the current host
114
+ gridClone.style.height = `${rowsMeta.currentPageTotalHeight + totalHeaderHeight + gridToolbarElementHeight + gridFooterElementHeight}px`; // printDoc.body.appendChild(gridClone); should be enough but a clone isolation bug in Safari
115
+ // prevents us to do it
111
116
 
112
- printDoc.body.innerHTML = '';
113
- printDoc.body.appendChild(gridClone);
117
+ const container = document.createElement('div');
118
+ container.appendChild(gridClone);
119
+ printDoc.body.innerHTML = container.innerHTML;
114
120
  const defaultPageStyle = typeof normalizeOptions.pageStyle === 'function' ? normalizeOptions.pageStyle() : normalizeOptions.pageStyle;
115
121
 
116
122
  if (typeof defaultPageStyle === 'string') {
@@ -202,17 +208,25 @@ export const useGridPrintExport = (apiRef, props) => {
202
208
 
203
209
  await updateGridColumnsForPrint(options?.fields, options?.allColumns);
204
210
  apiRef.current.unstable_disableVirtualization();
211
+ await raf(); // wait for the state changes to take action
212
+
205
213
  const printWindow = buildPrintWindow(options?.fileName);
206
- doc.current.body.appendChild(printWindow);
207
214
 
208
215
  if (process.env.NODE_ENV === 'test') {
209
- // In test env, run the all pipeline without waiting for loading
216
+ doc.current.body.appendChild(printWindow); // In test env, run the all pipeline without waiting for loading
217
+
210
218
  handlePrintWindowLoad(printWindow, options);
211
219
  handlePrintWindowAfterPrint(printWindow);
212
220
  } else {
213
- printWindow.onload = () => handlePrintWindowLoad(printWindow, options);
221
+ printWindow.onload = () => {
222
+ handlePrintWindowLoad(printWindow, options);
223
+
224
+ printWindow.contentWindow.onafterprint = () => {
225
+ handlePrintWindowAfterPrint(printWindow);
226
+ };
227
+ };
214
228
 
215
- printWindow.contentWindow.onafterprint = () => handlePrintWindowAfterPrint(printWindow);
229
+ doc.current.body.appendChild(printWindow);
216
230
  }
217
231
  }, [props, logger, apiRef, buildPrintWindow, handlePrintWindowLoad, handlePrintWindowAfterPrint, updateGridColumnsForPrint]);
218
232
  const printExportApi = {
@@ -213,13 +213,9 @@ export const useGridVirtualScroller = props => {
213
213
  });
214
214
  }
215
215
  }, [apiRef, currentPage.rows, onRenderZonePositioning, renderZoneMinColumnIndex, renderZoneMaxColumnIndex, rootProps.columnBuffer, rootProps.rowBuffer]);
216
- React.useLayoutEffect(() => {
217
- if (renderContext) {
218
- updateRenderZonePosition(renderContext);
219
- }
220
- }, [renderContext, updateRenderZonePosition]);
221
216
  const updateRenderContext = React.useCallback(nextRenderContext => {
222
217
  setRenderContext(nextRenderContext);
218
+ updateRenderZonePosition(nextRenderContext);
223
219
  const [firstRowToRender, lastRowToRender] = getRenderableIndexes({
224
220
  firstIndex: nextRenderContext.firstRowIndex,
225
221
  lastIndex: nextRenderContext.lastRowIndex,
@@ -232,7 +228,7 @@ export const useGridVirtualScroller = props => {
232
228
  lastRowToRender
233
229
  });
234
230
  prevRenderContext.current = nextRenderContext;
235
- }, [apiRef, setRenderContext, prevRenderContext, currentPage.rows.length, rootProps.rowBuffer]);
231
+ }, [apiRef, setRenderContext, prevRenderContext, currentPage.rows.length, rootProps.rowBuffer, updateRenderZonePosition]);
236
232
  useEnhancedEffect(() => {
237
233
  if (containerDimensions.width == null) {
238
234
  return;
package/modern/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI X v5.17.18
1
+ /** @license MUI X v5.17.20
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -45,6 +45,6 @@ export { getColumnsToExport, defaultGetRowsToExport } from '../hooks/features/ex
45
45
  export { createSelector, unstable_resetCreateSelectorCache } from '../utils/createSelector';
46
46
  export { findParentElementFromClassName } from '../utils/domUtils';
47
47
  export { isNavigationKey } from '../utils/keyboardUtils';
48
- export { clamp, isDeepEqual, isNumber, isFunction } from '../utils/utils';
48
+ export { clamp, isDeepEqual, isNumber, isFunction, isObject } from '../utils/utils';
49
49
  export { buildWarning } from '../utils/warning';
50
50
  export { exportAs } from '../utils/exportAs';
@@ -3,7 +3,7 @@ import { getGridLocalization } from '../utils/getGridLocalization';
3
3
  const esESGrid = {
4
4
  // Root
5
5
  noRowsLabel: 'Sin filas',
6
- // noResultsOverlayLabel: 'No results found.',
6
+ noResultsOverlayLabel: 'Resultados no encontrados',
7
7
  errorOverlayDefaultLabel: 'Ha ocurrido un error.',
8
8
  // Density selector toolbar button text
9
9
  toolbarDensity: 'Densidad',
@@ -21,15 +21,15 @@ const esESGrid = {
21
21
  toolbarFiltersTooltipShow: 'Mostrar filtros',
22
22
  toolbarFiltersTooltipActive: count => count > 1 ? `${count} filtros activos` : `${count} filtro activo`,
23
23
  // Quick filter toolbar field
24
- // toolbarQuickFilterPlaceholder: 'Search…',
25
- // toolbarQuickFilterLabel: 'Search',
26
- // toolbarQuickFilterDeleteIconLabel: 'Clear',
24
+ toolbarQuickFilterPlaceholder: 'Buscar…',
25
+ toolbarQuickFilterLabel: 'Buscar',
26
+ toolbarQuickFilterDeleteIconLabel: 'Limpiar',
27
27
  // Export selector toolbar button text
28
28
  toolbarExport: 'Exportar',
29
29
  toolbarExportLabel: 'Exportar',
30
30
  toolbarExportCSV: 'Descargar como CSV',
31
- // toolbarExportPrint: 'Print',
32
- // toolbarExportExcel: 'Download as Excel',
31
+ toolbarExportPrint: 'Imprimir',
32
+ toolbarExportExcel: 'Descargar como Excel',
33
33
  // Columns panel text
34
34
  columnsPanelTextFieldLabel: 'Columna de búsqueda',
35
35
  columnsPanelTextFieldPlaceholder: 'Título de columna',
@@ -39,7 +39,7 @@ const esESGrid = {
39
39
  // Filter panel text
40
40
  filterPanelAddFilter: 'Agregar filtro',
41
41
  filterPanelDeleteIconLabel: 'Borrar',
42
- // filterPanelLinkOperator: 'Logic operator',
42
+ filterPanelLinkOperator: 'Operador lógico',
43
43
  filterPanelOperators: 'Operadores',
44
44
  // TODO v6: rename to filterPanelOperator
45
45
  filterPanelOperatorAnd: 'Y',
@@ -60,11 +60,11 @@ const esESGrid = {
60
60
  filterOperatorOnOrBefore: 'es en o anterior',
61
61
  filterOperatorIsEmpty: 'está vacío',
62
62
  filterOperatorIsNotEmpty: 'no esta vacío',
63
- // filterOperatorIsAnyOf: 'is any of',
63
+ filterOperatorIsAnyOf: 'es cualquiera de',
64
64
  // Filter values text
65
- // filterValueAny: 'any',
66
- // filterValueTrue: 'true',
67
- // filterValueFalse: 'false',
65
+ filterValueAny: 'cualquiera',
66
+ filterValueTrue: 'verdadero',
67
+ filterValueFalse: 'falso',
68
68
  // Column menu text
69
69
  columnMenuLabel: 'Menú',
70
70
  columnMenuShowColumns: 'Mostrar columnas',
@@ -84,19 +84,20 @@ const esESGrid = {
84
84
  // Total visible row amount footer text
85
85
  footerTotalVisibleRows: (visibleCount, totalCount) => `${visibleCount.toLocaleString()} de ${totalCount.toLocaleString()}`,
86
86
  // Checkbox selection text
87
- // checkboxSelectionHeaderName: 'Checkbox selection',
88
- // checkboxSelectionSelectAllRows: 'Select all rows',
89
- // checkboxSelectionUnselectAllRows: 'Unselect all rows',
90
- // checkboxSelectionSelectRow: 'Select row',
91
- // checkboxSelectionUnselectRow: 'Unselect row',
87
+ checkboxSelectionHeaderName: 'Seleccionar casilla',
88
+ checkboxSelectionSelectAllRows: 'Seleccionar todas las filas',
89
+ checkboxSelectionUnselectAllRows: 'Deseleccionar todas las filas',
90
+ checkboxSelectionSelectRow: 'Seleccionar fila',
91
+ checkboxSelectionUnselectRow: 'Deseleccionar fila',
92
92
  // Boolean cell text
93
- // booleanCellTrueLabel: 'yes',
94
- // booleanCellFalseLabel: 'no',
93
+ booleanCellTrueLabel: 'si',
94
+ booleanCellFalseLabel: 'no',
95
95
  // Actions cell more text
96
- actionsCellMore: 'más' // Column pinning text
97
- // pinToLeft: 'Pin to left',
98
- // pinToRight: 'Pin to right',
99
- // unpin: 'Unpin',
96
+ actionsCellMore: 'más',
97
+ // Column pinning text
98
+ pinToLeft: 'Anclar a la izquierda',
99
+ pinToRight: 'Anclar a la derecha',
100
+ unpin: 'Desanclar',
100
101
  // Tree Data
101
102
  // treeDataGroupingHeaderName: 'Group',
102
103
  // treeDataExpand: 'see children',
@@ -107,17 +108,16 @@ const esESGrid = {
107
108
  // unGroupColumn: name => `Stop grouping by ${name}`,
108
109
  // Master/detail
109
110
  // detailPanelToggle: 'Detail panel toggle',
110
- // expandDetailPanel: 'Expand',
111
- // collapseDetailPanel: 'Collapse',
111
+ expandDetailPanel: 'Expandir',
112
+ collapseDetailPanel: 'reducirse',
112
113
  // Row reordering text
113
114
  // rowReorderingHeaderName: 'Row reordering',
114
115
  // Aggregation
115
116
  // aggregationMenuItemHeader: 'Aggregation',
116
117
  // aggregationFunctionLabelSum: 'sum',
117
118
  // aggregationFunctionLabelAvg: 'avg',
118
- // aggregationFunctionLabelMin: 'min',
119
- // aggregationFunctionLabelMax: 'max',
120
- // aggregationFunctionLabelSize: 'size',
119
+ aggregationFunctionLabelMin: 'min',
120
+ aggregationFunctionLabelMax: 'max' // aggregationFunctionLabelSize: 'size',
121
121
 
122
122
  };
123
123
  export const esES = getGridLocalization(esESGrid, esESCore);
@@ -97,7 +97,7 @@ const svSEGrid = {
97
97
  // Column pinning text
98
98
  pinToLeft: 'Fäst till vänster',
99
99
  pinToRight: 'Fäst till höger',
100
- unpin: 'Ta bort fäste',
100
+ unpin: 'Ta bort fästning',
101
101
  // Tree Data
102
102
  treeDataGroupingHeaderName: 'Grupp',
103
103
  treeDataExpand: 'visa underordnade',
@@ -107,17 +107,17 @@ const svSEGrid = {
107
107
  groupColumn: name => `Gruppera efter ${name}`,
108
108
  unGroupColumn: name => `Sluta gruppera efter ${name}`,
109
109
  // Master/detail
110
- // detailPanelToggle: 'Detail panel toggle',
110
+ detailPanelToggle: 'Växla detaljpanel',
111
111
  expandDetailPanel: 'Expandera',
112
112
  collapseDetailPanel: 'Kollapsa',
113
113
  // Row reordering text
114
- rowReorderingHeaderName: 'Ordna om rader' // Aggregation
115
- // aggregationMenuItemHeader: 'Aggregation',
116
- // aggregationFunctionLabelSum: 'sum',
117
- // aggregationFunctionLabelAvg: 'avg',
118
- // aggregationFunctionLabelMin: 'min',
119
- // aggregationFunctionLabelMax: 'max',
120
- // aggregationFunctionLabelSize: 'size',
121
-
114
+ rowReorderingHeaderName: 'Ordna om rader',
115
+ // Aggregation
116
+ aggregationMenuItemHeader: 'Aggregering',
117
+ aggregationFunctionLabelSum: 'sum',
118
+ aggregationFunctionLabelAvg: 'medel',
119
+ aggregationFunctionLabelMin: 'min',
120
+ aggregationFunctionLabelMax: 'max',
121
+ aggregationFunctionLabelSize: 'antal'
122
122
  };
123
123
  export const svSE = getGridLocalization(svSEGrid, svSECore);
@@ -5,7 +5,7 @@ export function isFunction(value) {
5
5
  return typeof value === 'function';
6
6
  }
7
7
  export function isObject(value) {
8
- return typeof value === 'object';
8
+ return typeof value === 'object' && value !== null;
9
9
  }
10
10
  export function localStorageAvailable() {
11
11
  try {
@@ -57,6 +57,7 @@ const GridColumnHeadersRoot = (0, _styles.styled)('div', {
57
57
  overflow: 'hidden',
58
58
  display: 'flex',
59
59
  alignItems: 'center',
60
+ boxSizing: 'border-box',
60
61
  borderBottom: `1px solid ${borderColor}`,
61
62
  borderTopLeftRadius: theme.shape.borderRadius,
62
63
  borderTopRightRadius: theme.shape.borderRadius
@@ -127,7 +127,6 @@ function GridFilterInputMultipleSingleSelect(props) {
127
127
  }, [applyValue, item]);
128
128
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Autocomplete.default, (0, _extends2.default)({
129
129
  multiple: true,
130
- limitTags: 1,
131
130
  options: resolvedValueOptions,
132
131
  isOptionEqualToValue: isOptionEqualToValue,
133
132
  filterOptions: filter,
@@ -70,7 +70,6 @@ function GridFilterInputMultipleValue(props) {
70
70
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Autocomplete.default, (0, _extends2.default)({
71
71
  multiple: true,
72
72
  freeSolo: true,
73
- limitTags: 1,
74
73
  options: [],
75
74
  filterOptions: (options, params) => {
76
75
  const {
@@ -39,6 +39,14 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
39
39
 
40
40
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
41
41
 
42
+ function raf() {
43
+ return new Promise(resolve => {
44
+ requestAnimationFrame(() => {
45
+ resolve();
46
+ });
47
+ });
48
+ }
49
+
42
50
  /**
43
51
  * @requires useGridColumns (state)
44
52
  * @requires useGridFilter (state)
@@ -56,6 +64,7 @@ const useGridPrintExport = (apiRef, props) => {
56
64
  // the new state needs to be in place before the grid can be sized correctly
57
65
 
58
66
  const updateGridColumnsForPrint = React.useCallback((fields, allColumns) => new Promise(resolve => {
67
+ // TODO remove unused Promise
59
68
  if (!fields && !allColumns) {
60
69
  resolve();
61
70
  return;
@@ -75,12 +84,10 @@ const useGridPrintExport = (apiRef, props) => {
75
84
  });
76
85
  apiRef.current.setColumnVisibilityModel(newColumnVisibilityModel);
77
86
  resolve();
78
- }), [apiRef]);
87
+ }), [apiRef]); // TODO move outside of this scope and remove React.useCallback
88
+
79
89
  const buildPrintWindow = React.useCallback(title => {
80
90
  const iframeEl = document.createElement('iframe');
81
- iframeEl.id = 'grid-print-window'; // Without this 'onload' event won't fire in some browsers
82
-
83
- iframeEl.src = window.location.href;
84
91
  iframeEl.style.position = 'absolute';
85
92
  iframeEl.style.width = '0px';
86
93
  iframeEl.style.height = '0px';
@@ -88,17 +95,14 @@ const useGridPrintExport = (apiRef, props) => {
88
95
  return iframeEl;
89
96
  }, []);
90
97
  const handlePrintWindowLoad = React.useCallback((printWindow, options) => {
91
- var _printWindow$contentW, _querySelector, _querySelector2;
98
+ var _querySelector, _querySelector2;
92
99
 
93
100
  const normalizeOptions = (0, _extends2.default)({
94
101
  copyStyles: true,
95
102
  hideToolbar: false,
96
103
  hideFooter: false
97
- }, options); // Some agents, such as IE11 and Enzyme (as of 2 Jun 2020) continuously call the
98
- // `onload` callback. This ensures that it is only called once.
99
-
100
- printWindow.onload = null;
101
- const printDoc = printWindow.contentDocument || ((_printWindow$contentW = printWindow.contentWindow) == null ? void 0 : _printWindow$contentW.document);
104
+ }, options);
105
+ const printDoc = printWindow.contentDocument;
102
106
 
103
107
  if (!printDoc) {
104
108
  return;
@@ -138,10 +142,12 @@ const useGridPrintExport = (apiRef, props) => {
138
142
  } // Expand container height to accommodate all rows
139
143
 
140
144
 
141
- gridClone.style.height = `${rowsMeta.currentPageTotalHeight + totalHeaderHeight + gridToolbarElementHeight + gridFooterElementHeight}px`; // Remove all loaded elements from the current host
145
+ gridClone.style.height = `${rowsMeta.currentPageTotalHeight + totalHeaderHeight + gridToolbarElementHeight + gridFooterElementHeight}px`; // printDoc.body.appendChild(gridClone); should be enough but a clone isolation bug in Safari
146
+ // prevents us to do it
142
147
 
143
- printDoc.body.innerHTML = '';
144
- printDoc.body.appendChild(gridClone);
148
+ const container = document.createElement('div');
149
+ container.appendChild(gridClone);
150
+ printDoc.body.innerHTML = container.innerHTML;
145
151
  const defaultPageStyle = typeof normalizeOptions.pageStyle === 'function' ? normalizeOptions.pageStyle() : normalizeOptions.pageStyle;
146
152
 
147
153
  if (typeof defaultPageStyle === 'string') {
@@ -235,17 +241,25 @@ const useGridPrintExport = (apiRef, props) => {
235
241
 
236
242
  await updateGridColumnsForPrint(options == null ? void 0 : options.fields, options == null ? void 0 : options.allColumns);
237
243
  apiRef.current.unstable_disableVirtualization();
244
+ await raf(); // wait for the state changes to take action
245
+
238
246
  const printWindow = buildPrintWindow(options == null ? void 0 : options.fileName);
239
- doc.current.body.appendChild(printWindow);
240
247
 
241
248
  if (process.env.NODE_ENV === 'test') {
242
- // In test env, run the all pipeline without waiting for loading
249
+ doc.current.body.appendChild(printWindow); // In test env, run the all pipeline without waiting for loading
250
+
243
251
  handlePrintWindowLoad(printWindow, options);
244
252
  handlePrintWindowAfterPrint(printWindow);
245
253
  } else {
246
- printWindow.onload = () => handlePrintWindowLoad(printWindow, options);
254
+ printWindow.onload = () => {
255
+ handlePrintWindowLoad(printWindow, options);
256
+
257
+ printWindow.contentWindow.onafterprint = () => {
258
+ handlePrintWindowAfterPrint(printWindow);
259
+ };
260
+ };
247
261
 
248
- printWindow.contentWindow.onafterprint = () => handlePrintWindowAfterPrint(printWindow);
262
+ doc.current.body.appendChild(printWindow);
249
263
  }
250
264
  }, [props, logger, apiRef, buildPrintWindow, handlePrintWindowLoad, handlePrintWindowAfterPrint, updateGridColumnsForPrint]);
251
265
  const printExportApi = {
@@ -254,13 +254,9 @@ const useGridVirtualScroller = props => {
254
254
  });
255
255
  }
256
256
  }, [apiRef, currentPage.rows, onRenderZonePositioning, renderZoneMinColumnIndex, renderZoneMaxColumnIndex, rootProps.columnBuffer, rootProps.rowBuffer]);
257
- React.useLayoutEffect(() => {
258
- if (renderContext) {
259
- updateRenderZonePosition(renderContext);
260
- }
261
- }, [renderContext, updateRenderZonePosition]);
262
257
  const updateRenderContext = React.useCallback(nextRenderContext => {
263
258
  setRenderContext(nextRenderContext);
259
+ updateRenderZonePosition(nextRenderContext);
264
260
  const [firstRowToRender, lastRowToRender] = getRenderableIndexes({
265
261
  firstIndex: nextRenderContext.firstRowIndex,
266
262
  lastIndex: nextRenderContext.lastRowIndex,
@@ -273,7 +269,7 @@ const useGridVirtualScroller = props => {
273
269
  lastRowToRender
274
270
  });
275
271
  prevRenderContext.current = nextRenderContext;
276
- }, [apiRef, setRenderContext, prevRenderContext, currentPage.rows.length, rootProps.rowBuffer]);
272
+ }, [apiRef, setRenderContext, prevRenderContext, currentPage.rows.length, rootProps.rowBuffer, updateRenderZonePosition]);
277
273
  (0, _utils.unstable_useEnhancedEffect)(() => {
278
274
  if (containerDimensions.width == null) {
279
275
  return;
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI X v5.17.18
1
+ /** @license MUI X v5.17.20
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.