@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.
- package/CHANGELOG.md +49 -0
- package/components/columnHeaders/GridColumnHeaders.js +1 -0
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
- package/components/panel/filterPanel/GridFilterInputMultipleValue.js +0 -1
- package/hooks/features/export/useGridPrintExport.js +31 -17
- package/hooks/features/virtualization/useGridVirtualScroller.js +2 -6
- package/index.js +1 -1
- package/internals/index.d.ts +1 -1
- package/internals/index.js +1 -1
- package/legacy/components/columnHeaders/GridColumnHeaders.js +1 -0
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleValue.js +0 -1
- package/legacy/hooks/features/export/useGridPrintExport.js +33 -20
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +2 -6
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +1 -1
- package/legacy/locales/esES.js +27 -27
- package/legacy/locales/svSE.js +10 -10
- package/legacy/utils/utils.js +1 -1
- package/locales/esES.js +27 -27
- package/locales/svSE.js +10 -10
- package/models/api/gridParamsApi.d.ts +1 -1
- package/modern/components/columnHeaders/GridColumnHeaders.js +1 -0
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
- package/modern/components/panel/filterPanel/GridFilterInputMultipleValue.js +0 -1
- package/modern/hooks/features/export/useGridPrintExport.js +30 -16
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +2 -6
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -1
- package/modern/locales/esES.js +27 -27
- package/modern/locales/svSE.js +10 -10
- package/modern/utils/utils.js +1 -1
- package/node/components/columnHeaders/GridColumnHeaders.js +1 -0
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
- package/node/components/panel/filterPanel/GridFilterInputMultipleValue.js +0 -1
- package/node/hooks/features/export/useGridPrintExport.js +31 -17
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +2 -6
- package/node/index.js +1 -1
- package/node/internals/index.js +6 -0
- package/node/locales/esES.js +27 -27
- package/node/locales/svSE.js +10 -10
- package/node/utils/utils.js +1 -1
- package/package.json +1 -1
- package/utils/utils.d.ts +1 -1
- 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
|
-
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
32
|
-
|
|
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
|
-
|
|
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
|
-
|
|
63
|
+
filterOperatorIsAnyOf: 'es cualquiera de',
|
|
64
64
|
// Filter values text
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
-
|
|
94
|
-
|
|
93
|
+
booleanCellTrueLabel: 'si',
|
|
94
|
+
booleanCellFalseLabel: 'no',
|
|
95
95
|
// Actions cell more text
|
|
96
|
-
actionsCellMore: 'más'
|
|
97
|
-
//
|
|
98
|
-
|
|
99
|
-
|
|
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
|
-
|
|
111
|
-
|
|
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
|
-
|
|
119
|
-
|
|
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
|
|
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
|
-
|
|
110
|
+
detailPanelToggle: 'Växla detaljpanel',
|
|
111
111
|
expandDetailPanel: 'Expandera',
|
|
112
112
|
collapseDetailPanel: 'Kollapsa',
|
|
113
113
|
// Row reordering text
|
|
114
|
-
rowReorderingHeaderName: 'Ordna om rader'
|
|
115
|
-
//
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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 =
|
|
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,
|
|
@@ -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);
|
|
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`; //
|
|
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
|
-
|
|
113
|
-
|
|
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 = () =>
|
|
221
|
+
printWindow.onload = () => {
|
|
222
|
+
handlePrintWindowLoad(printWindow, options);
|
|
223
|
+
|
|
224
|
+
printWindow.contentWindow.onafterprint = () => {
|
|
225
|
+
handlePrintWindowAfterPrint(printWindow);
|
|
226
|
+
};
|
|
227
|
+
};
|
|
214
228
|
|
|
215
|
-
|
|
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
|
@@ -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';
|
package/modern/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
|
-
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
32
|
-
|
|
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
|
-
|
|
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
|
-
|
|
63
|
+
filterOperatorIsAnyOf: 'es cualquiera de',
|
|
64
64
|
// Filter values text
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
-
|
|
94
|
-
|
|
93
|
+
booleanCellTrueLabel: 'si',
|
|
94
|
+
booleanCellFalseLabel: 'no',
|
|
95
95
|
// Actions cell more text
|
|
96
|
-
actionsCellMore: 'más'
|
|
97
|
-
//
|
|
98
|
-
|
|
99
|
-
|
|
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
|
-
|
|
111
|
-
|
|
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
|
-
|
|
119
|
-
|
|
120
|
-
// aggregationFunctionLabelSize: 'size',
|
|
119
|
+
aggregationFunctionLabelMin: 'min',
|
|
120
|
+
aggregationFunctionLabelMax: 'max' // aggregationFunctionLabelSize: 'size',
|
|
121
121
|
|
|
122
122
|
};
|
|
123
123
|
export const esES = getGridLocalization(esESGrid, esESCore);
|
package/modern/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
|
|
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
|
-
|
|
110
|
+
detailPanelToggle: 'Växla detaljpanel',
|
|
111
111
|
expandDetailPanel: 'Expandera',
|
|
112
112
|
collapseDetailPanel: 'Kollapsa',
|
|
113
113
|
// Row reordering text
|
|
114
|
-
rowReorderingHeaderName: 'Ordna om rader'
|
|
115
|
-
//
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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);
|
package/modern/utils/utils.js
CHANGED
|
@@ -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,
|
|
@@ -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
|
|
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);
|
|
98
|
-
|
|
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`; //
|
|
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
|
-
|
|
144
|
-
|
|
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 = () =>
|
|
254
|
+
printWindow.onload = () => {
|
|
255
|
+
handlePrintWindowLoad(printWindow, options);
|
|
256
|
+
|
|
257
|
+
printWindow.contentWindow.onafterprint = () => {
|
|
258
|
+
handlePrintWindowAfterPrint(printWindow);
|
|
259
|
+
};
|
|
260
|
+
};
|
|
247
261
|
|
|
248
|
-
|
|
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