@mui/x-data-grid 5.17.18 → 5.17.19
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 +25 -0
- package/components/columnHeaders/GridColumnHeaders.js +1 -0
- package/hooks/features/export/useGridPrintExport.js +31 -17
- 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/hooks/features/export/useGridPrintExport.js +33 -20
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +1 -1
- package/legacy/locales/esES.js +27 -27
- package/legacy/utils/utils.js +1 -1
- package/locales/esES.js +27 -27
- package/models/api/gridParamsApi.d.ts +1 -1
- package/modern/components/columnHeaders/GridColumnHeaders.js +1 -0
- package/modern/hooks/features/export/useGridPrintExport.js +30 -16
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -1
- package/modern/locales/esES.js +27 -27
- package/modern/utils/utils.js +1 -1
- package/node/components/columnHeaders/GridColumnHeaders.js +1 -0
- package/node/hooks/features/export/useGridPrintExport.js +31 -17
- package/node/index.js +1 -1
- package/node/internals/index.js +6 -0
- package/node/locales/esES.js +27 -27
- 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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,31 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 5.17.19
|
|
7
|
+
|
|
8
|
+
_Jan 16, 2023_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 4 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🌍 Improve Spanish (es-ES) and add Belarusian (be-BY) and Urdu (ur-PK) locales
|
|
13
|
+
- 🐞 Bugfixes
|
|
14
|
+
|
|
15
|
+
### `@mui/x-data-grid@v5.17.19` / `@mui/x-data-grid-pro@v5.17.19` / `@mui/x-data-grid-premium@v5.17.19`
|
|
16
|
+
|
|
17
|
+
#### Changes
|
|
18
|
+
|
|
19
|
+
- [DataGrid] Improve print support (#7407) @cherniavskii
|
|
20
|
+
- [DataGrid] Improve Spanish (es-ES) locale (#7438) @Anderssxn
|
|
21
|
+
- [DataGridPremium] Fix Excel export not working with date strings (#7478) @cherniavskii
|
|
22
|
+
- [DataGridPro] Fix missing column headers border with top-pinned rows (#7399) @cherniavskii
|
|
23
|
+
|
|
24
|
+
### `@mui/x-date-pickers@v5.0.14` / `@mui/x-date-pickers-pro@v5.0.14`
|
|
25
|
+
|
|
26
|
+
#### Changes
|
|
27
|
+
|
|
28
|
+
- [pickers] Add Belarusian (be-BY) locale (#7450) @volhalink
|
|
29
|
+
- [pickers] Add Urdu (ur-PK) locale (#7449) @MBilalShafi
|
|
30
|
+
|
|
6
31
|
## 5.17.18
|
|
7
32
|
|
|
8
33
|
_Jan 5, 2023_
|
|
@@ -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
|
|
@@ -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';
|
|
@@ -62,18 +69,15 @@ export const useGridPrintExport = (apiRef, props) => {
|
|
|
62
69
|
return iframeEl;
|
|
63
70
|
}, []);
|
|
64
71
|
const handlePrintWindowLoad = React.useCallback((printWindow, options) => {
|
|
65
|
-
var
|
|
72
|
+
var _querySelector, _querySelector2;
|
|
66
73
|
|
|
67
74
|
const normalizeOptions = _extends({
|
|
68
75
|
copyStyles: true,
|
|
69
76
|
hideToolbar: false,
|
|
70
77
|
hideFooter: false
|
|
71
|
-
}, options);
|
|
72
|
-
// `onload` callback. This ensures that it is only called once.
|
|
78
|
+
}, options);
|
|
73
79
|
|
|
74
|
-
|
|
75
|
-
printWindow.onload = null;
|
|
76
|
-
const printDoc = printWindow.contentDocument || ((_printWindow$contentW = printWindow.contentWindow) == null ? void 0 : _printWindow$contentW.document);
|
|
80
|
+
const printDoc = printWindow.contentDocument;
|
|
77
81
|
|
|
78
82
|
if (!printDoc) {
|
|
79
83
|
return;
|
|
@@ -113,10 +117,12 @@ export const useGridPrintExport = (apiRef, props) => {
|
|
|
113
117
|
} // Expand container height to accommodate all rows
|
|
114
118
|
|
|
115
119
|
|
|
116
|
-
gridClone.style.height = `${rowsMeta.currentPageTotalHeight + totalHeaderHeight + gridToolbarElementHeight + gridFooterElementHeight}px`; //
|
|
120
|
+
gridClone.style.height = `${rowsMeta.currentPageTotalHeight + totalHeaderHeight + gridToolbarElementHeight + gridFooterElementHeight}px`; // printDoc.body.appendChild(gridClone); should be enough but a clone isolation bug in Safari
|
|
121
|
+
// prevents us to do it
|
|
117
122
|
|
|
118
|
-
|
|
119
|
-
|
|
123
|
+
const container = document.createElement('div');
|
|
124
|
+
container.appendChild(gridClone);
|
|
125
|
+
printDoc.body.innerHTML = container.innerHTML;
|
|
120
126
|
const defaultPageStyle = typeof normalizeOptions.pageStyle === 'function' ? normalizeOptions.pageStyle() : normalizeOptions.pageStyle;
|
|
121
127
|
|
|
122
128
|
if (typeof defaultPageStyle === 'string') {
|
|
@@ -210,17 +216,25 @@ export const useGridPrintExport = (apiRef, props) => {
|
|
|
210
216
|
|
|
211
217
|
await updateGridColumnsForPrint(options == null ? void 0 : options.fields, options == null ? void 0 : options.allColumns);
|
|
212
218
|
apiRef.current.unstable_disableVirtualization();
|
|
219
|
+
await raf(); // wait for the state changes to take action
|
|
220
|
+
|
|
213
221
|
const printWindow = buildPrintWindow(options == null ? void 0 : options.fileName);
|
|
214
|
-
doc.current.body.appendChild(printWindow);
|
|
215
222
|
|
|
216
223
|
if (process.env.NODE_ENV === 'test') {
|
|
217
|
-
// In test env, run the all pipeline without waiting for loading
|
|
224
|
+
doc.current.body.appendChild(printWindow); // In test env, run the all pipeline without waiting for loading
|
|
225
|
+
|
|
218
226
|
handlePrintWindowLoad(printWindow, options);
|
|
219
227
|
handlePrintWindowAfterPrint(printWindow);
|
|
220
228
|
} else {
|
|
221
|
-
printWindow.onload = () =>
|
|
229
|
+
printWindow.onload = () => {
|
|
230
|
+
handlePrintWindowLoad(printWindow, options);
|
|
231
|
+
|
|
232
|
+
printWindow.contentWindow.onafterprint = () => {
|
|
233
|
+
handlePrintWindowAfterPrint(printWindow);
|
|
234
|
+
};
|
|
235
|
+
};
|
|
222
236
|
|
|
223
|
-
|
|
237
|
+
doc.current.body.appendChild(printWindow);
|
|
224
238
|
}
|
|
225
239
|
}, [props, logger, apiRef, buildPrintWindow, handlePrintWindowLoad, handlePrintWindowAfterPrint, updateGridColumnsForPrint]);
|
|
226
240
|
const printExportApi = {
|
package/index.js
CHANGED
package/internals/index.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export { getColumnsToExport, defaultGetRowsToExport } from '../hooks/features/ex
|
|
|
54
54
|
export { createSelector, unstable_resetCreateSelectorCache } from '../utils/createSelector';
|
|
55
55
|
export { findParentElementFromClassName } from '../utils/domUtils';
|
|
56
56
|
export { isNavigationKey } from '../utils/keyboardUtils';
|
|
57
|
-
export { clamp, isDeepEqual, isNumber, isFunction } from '../utils/utils';
|
|
57
|
+
export { clamp, isDeepEqual, isNumber, isFunction, isObject } from '../utils/utils';
|
|
58
58
|
export { buildWarning } from '../utils/warning';
|
|
59
59
|
export { exportAs } from '../utils/exportAs';
|
|
60
60
|
export type { GridApiCommunity } from '../models/api/gridApiCommunity';
|
package/internals/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';
|
|
@@ -34,6 +34,7 @@ var GridColumnHeadersRoot = styled('div', {
|
|
|
34
34
|
overflow: 'hidden',
|
|
35
35
|
display: 'flex',
|
|
36
36
|
alignItems: 'center',
|
|
37
|
+
boxSizing: 'border-box',
|
|
37
38
|
borderBottom: "1px solid ".concat(borderColor),
|
|
38
39
|
borderTopLeftRadius: theme.shape.borderRadius,
|
|
39
40
|
borderTopRightRadius: theme.shape.borderRadius
|
|
@@ -16,6 +16,14 @@ import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
|
|
|
16
16
|
import { GridPrintExportMenuItem } from '../../../components/toolbar/GridToolbarExport';
|
|
17
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
18
|
|
|
19
|
+
function raf() {
|
|
20
|
+
return new Promise(function (resolve) {
|
|
21
|
+
requestAnimationFrame(function () {
|
|
22
|
+
resolve();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
19
27
|
/**
|
|
20
28
|
* @requires useGridColumns (state)
|
|
21
29
|
* @requires useGridFilter (state)
|
|
@@ -34,6 +42,7 @@ export var useGridPrintExport = function useGridPrintExport(apiRef, props) {
|
|
|
34
42
|
|
|
35
43
|
var updateGridColumnsForPrint = React.useCallback(function (fields, allColumns) {
|
|
36
44
|
return new Promise(function (resolve) {
|
|
45
|
+
// TODO remove unused Promise
|
|
37
46
|
if (!fields && !allColumns) {
|
|
38
47
|
resolve();
|
|
39
48
|
return;
|
|
@@ -56,12 +65,10 @@ export var useGridPrintExport = function useGridPrintExport(apiRef, props) {
|
|
|
56
65
|
apiRef.current.setColumnVisibilityModel(newColumnVisibilityModel);
|
|
57
66
|
resolve();
|
|
58
67
|
});
|
|
59
|
-
}, [apiRef]);
|
|
68
|
+
}, [apiRef]); // TODO move outside of this scope and remove React.useCallback
|
|
69
|
+
|
|
60
70
|
var buildPrintWindow = React.useCallback(function (title) {
|
|
61
71
|
var iframeEl = document.createElement('iframe');
|
|
62
|
-
iframeEl.id = 'grid-print-window'; // Without this 'onload' event won't fire in some browsers
|
|
63
|
-
|
|
64
|
-
iframeEl.src = window.location.href;
|
|
65
72
|
iframeEl.style.position = 'absolute';
|
|
66
73
|
iframeEl.style.width = '0px';
|
|
67
74
|
iframeEl.style.height = '0px';
|
|
@@ -69,18 +76,15 @@ export var useGridPrintExport = function useGridPrintExport(apiRef, props) {
|
|
|
69
76
|
return iframeEl;
|
|
70
77
|
}, []);
|
|
71
78
|
var handlePrintWindowLoad = React.useCallback(function (printWindow, options) {
|
|
72
|
-
var
|
|
79
|
+
var _querySelector, _querySelector2;
|
|
73
80
|
|
|
74
81
|
var normalizeOptions = _extends({
|
|
75
82
|
copyStyles: true,
|
|
76
83
|
hideToolbar: false,
|
|
77
84
|
hideFooter: false
|
|
78
|
-
}, options);
|
|
79
|
-
// `onload` callback. This ensures that it is only called once.
|
|
85
|
+
}, options);
|
|
80
86
|
|
|
81
|
-
|
|
82
|
-
printWindow.onload = null;
|
|
83
|
-
var printDoc = printWindow.contentDocument || ((_printWindow$contentW = printWindow.contentWindow) == null ? void 0 : _printWindow$contentW.document);
|
|
87
|
+
var printDoc = printWindow.contentDocument;
|
|
84
88
|
|
|
85
89
|
if (!printDoc) {
|
|
86
90
|
return;
|
|
@@ -120,10 +124,12 @@ export var useGridPrintExport = function useGridPrintExport(apiRef, props) {
|
|
|
120
124
|
} // Expand container height to accommodate all rows
|
|
121
125
|
|
|
122
126
|
|
|
123
|
-
gridClone.style.height = "".concat(rowsMeta.currentPageTotalHeight + totalHeaderHeight + gridToolbarElementHeight + gridFooterElementHeight, "px"); //
|
|
127
|
+
gridClone.style.height = "".concat(rowsMeta.currentPageTotalHeight + totalHeaderHeight + gridToolbarElementHeight + gridFooterElementHeight, "px"); // printDoc.body.appendChild(gridClone); should be enough but a clone isolation bug in Safari
|
|
128
|
+
// prevents us to do it
|
|
124
129
|
|
|
125
|
-
|
|
126
|
-
|
|
130
|
+
var container = document.createElement('div');
|
|
131
|
+
container.appendChild(gridClone);
|
|
132
|
+
printDoc.body.innerHTML = container.innerHTML;
|
|
127
133
|
var defaultPageStyle = typeof normalizeOptions.pageStyle === 'function' ? normalizeOptions.pageStyle() : normalizeOptions.pageStyle;
|
|
128
134
|
|
|
129
135
|
if (typeof defaultPageStyle === 'string') {
|
|
@@ -232,24 +238,31 @@ export var useGridPrintExport = function useGridPrintExport(apiRef, props) {
|
|
|
232
238
|
|
|
233
239
|
case 8:
|
|
234
240
|
apiRef.current.unstable_disableVirtualization();
|
|
241
|
+
_context.next = 11;
|
|
242
|
+
return raf();
|
|
243
|
+
|
|
244
|
+
case 11:
|
|
245
|
+
// wait for the state changes to take action
|
|
235
246
|
printWindow = buildPrintWindow(options == null ? void 0 : options.fileName);
|
|
236
|
-
doc.current.body.appendChild(printWindow);
|
|
237
247
|
|
|
238
248
|
if (process.env.NODE_ENV === 'test') {
|
|
239
|
-
// 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
|
+
|
|
240
251
|
handlePrintWindowLoad(printWindow, options);
|
|
241
252
|
handlePrintWindowAfterPrint(printWindow);
|
|
242
253
|
} else {
|
|
243
254
|
printWindow.onload = function () {
|
|
244
|
-
|
|
245
|
-
};
|
|
255
|
+
handlePrintWindowLoad(printWindow, options);
|
|
246
256
|
|
|
247
|
-
|
|
248
|
-
|
|
257
|
+
printWindow.contentWindow.onafterprint = function () {
|
|
258
|
+
handlePrintWindowAfterPrint(printWindow);
|
|
259
|
+
};
|
|
249
260
|
};
|
|
261
|
+
|
|
262
|
+
doc.current.body.appendChild(printWindow);
|
|
250
263
|
}
|
|
251
264
|
|
|
252
|
-
case
|
|
265
|
+
case 13:
|
|
253
266
|
case "end":
|
|
254
267
|
return _context.stop();
|
|
255
268
|
}
|
package/legacy/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/legacy/locales/esES.js
CHANGED
|
@@ -3,7 +3,7 @@ import { getGridLocalization } from '../utils/getGridLocalization';
|
|
|
3
3
|
var 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',
|
|
@@ -23,15 +23,15 @@ var esESGrid = {
|
|
|
23
23
|
return count > 1 ? "".concat(count, " filtros activos") : "".concat(count, " filtro activo");
|
|
24
24
|
},
|
|
25
25
|
// Quick filter toolbar field
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
toolbarQuickFilterPlaceholder: 'Buscar…',
|
|
27
|
+
toolbarQuickFilterLabel: 'Buscar',
|
|
28
|
+
toolbarQuickFilterDeleteIconLabel: 'Limpiar',
|
|
29
29
|
// Export selector toolbar button text
|
|
30
30
|
toolbarExport: 'Exportar',
|
|
31
31
|
toolbarExportLabel: 'Exportar',
|
|
32
32
|
toolbarExportCSV: 'Descargar como CSV',
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
toolbarExportPrint: 'Imprimir',
|
|
34
|
+
toolbarExportExcel: 'Descargar como Excel',
|
|
35
35
|
// Columns panel text
|
|
36
36
|
columnsPanelTextFieldLabel: 'Columna de búsqueda',
|
|
37
37
|
columnsPanelTextFieldPlaceholder: 'Título de columna',
|
|
@@ -41,7 +41,7 @@ var esESGrid = {
|
|
|
41
41
|
// Filter panel text
|
|
42
42
|
filterPanelAddFilter: 'Agregar filtro',
|
|
43
43
|
filterPanelDeleteIconLabel: 'Borrar',
|
|
44
|
-
|
|
44
|
+
filterPanelLinkOperator: 'Operador lógico',
|
|
45
45
|
filterPanelOperators: 'Operadores',
|
|
46
46
|
// TODO v6: rename to filterPanelOperator
|
|
47
47
|
filterPanelOperatorAnd: 'Y',
|
|
@@ -62,11 +62,11 @@ var esESGrid = {
|
|
|
62
62
|
filterOperatorOnOrBefore: 'es en o anterior',
|
|
63
63
|
filterOperatorIsEmpty: 'está vacío',
|
|
64
64
|
filterOperatorIsNotEmpty: 'no esta vacío',
|
|
65
|
-
|
|
65
|
+
filterOperatorIsAnyOf: 'es cualquiera de',
|
|
66
66
|
// Filter values text
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
filterValueAny: 'cualquiera',
|
|
68
|
+
filterValueTrue: 'verdadero',
|
|
69
|
+
filterValueFalse: 'falso',
|
|
70
70
|
// Column menu text
|
|
71
71
|
columnMenuLabel: 'Menú',
|
|
72
72
|
columnMenuShowColumns: 'Mostrar columnas',
|
|
@@ -92,19 +92,20 @@ var esESGrid = {
|
|
|
92
92
|
return "".concat(visibleCount.toLocaleString(), " de ").concat(totalCount.toLocaleString());
|
|
93
93
|
},
|
|
94
94
|
// Checkbox selection text
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
checkboxSelectionHeaderName: 'Seleccionar casilla',
|
|
96
|
+
checkboxSelectionSelectAllRows: 'Seleccionar todas las filas',
|
|
97
|
+
checkboxSelectionUnselectAllRows: 'Deseleccionar todas las filas',
|
|
98
|
+
checkboxSelectionSelectRow: 'Seleccionar fila',
|
|
99
|
+
checkboxSelectionUnselectRow: 'Deseleccionar fila',
|
|
100
100
|
// Boolean cell text
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
booleanCellTrueLabel: 'si',
|
|
102
|
+
booleanCellFalseLabel: 'no',
|
|
103
103
|
// Actions cell more text
|
|
104
|
-
actionsCellMore: 'más'
|
|
105
|
-
//
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
actionsCellMore: 'más',
|
|
105
|
+
// Column pinning text
|
|
106
|
+
pinToLeft: 'Anclar a la izquierda',
|
|
107
|
+
pinToRight: 'Anclar a la derecha',
|
|
108
|
+
unpin: 'Desanclar',
|
|
108
109
|
// Tree Data
|
|
109
110
|
// treeDataGroupingHeaderName: 'Group',
|
|
110
111
|
// treeDataExpand: 'see children',
|
|
@@ -115,17 +116,16 @@ var esESGrid = {
|
|
|
115
116
|
// unGroupColumn: name => `Stop grouping by ${name}`,
|
|
116
117
|
// Master/detail
|
|
117
118
|
// detailPanelToggle: 'Detail panel toggle',
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
expandDetailPanel: 'Expandir',
|
|
120
|
+
collapseDetailPanel: 'reducirse',
|
|
120
121
|
// Row reordering text
|
|
121
122
|
// rowReorderingHeaderName: 'Row reordering',
|
|
122
123
|
// Aggregation
|
|
123
124
|
// aggregationMenuItemHeader: 'Aggregation',
|
|
124
125
|
// aggregationFunctionLabelSum: 'sum',
|
|
125
126
|
// aggregationFunctionLabelAvg: 'avg',
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
// aggregationFunctionLabelSize: 'size',
|
|
127
|
+
aggregationFunctionLabelMin: 'min',
|
|
128
|
+
aggregationFunctionLabelMax: 'max' // aggregationFunctionLabelSize: 'size',
|
|
129
129
|
|
|
130
130
|
};
|
|
131
131
|
export var esES = getGridLocalization(esESGrid, esESCore);
|
package/legacy/utils/utils.js
CHANGED
|
@@ -6,7 +6,7 @@ export function isFunction(value) {
|
|
|
6
6
|
return typeof value === 'function';
|
|
7
7
|
}
|
|
8
8
|
export function isObject(value) {
|
|
9
|
-
return _typeof(value) === 'object';
|
|
9
|
+
return _typeof(value) === 'object' && value !== null;
|
|
10
10
|
}
|
|
11
11
|
export function localStorageAvailable() {
|
|
12
12
|
try {
|
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);
|
|
@@ -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
|
|
@@ -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 = {
|
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/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
|
|
@@ -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 = {
|
package/node/index.js
CHANGED
package/node/internals/index.js
CHANGED
|
@@ -183,6 +183,12 @@ Object.defineProperty(exports, "isNumber", {
|
|
|
183
183
|
return _utils2.isNumber;
|
|
184
184
|
}
|
|
185
185
|
});
|
|
186
|
+
Object.defineProperty(exports, "isObject", {
|
|
187
|
+
enumerable: true,
|
|
188
|
+
get: function () {
|
|
189
|
+
return _utils2.isObject;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
186
192
|
Object.defineProperty(exports, "paginationStateInitializer", {
|
|
187
193
|
enumerable: true,
|
|
188
194
|
get: function () {
|
package/node/locales/esES.js
CHANGED
|
@@ -12,7 +12,7 @@ var _getGridLocalization = require("../utils/getGridLocalization");
|
|
|
12
12
|
const esESGrid = {
|
|
13
13
|
// Root
|
|
14
14
|
noRowsLabel: 'Sin filas',
|
|
15
|
-
|
|
15
|
+
noResultsOverlayLabel: 'Resultados no encontrados',
|
|
16
16
|
errorOverlayDefaultLabel: 'Ha ocurrido un error.',
|
|
17
17
|
// Density selector toolbar button text
|
|
18
18
|
toolbarDensity: 'Densidad',
|
|
@@ -30,15 +30,15 @@ const esESGrid = {
|
|
|
30
30
|
toolbarFiltersTooltipShow: 'Mostrar filtros',
|
|
31
31
|
toolbarFiltersTooltipActive: count => count > 1 ? `${count} filtros activos` : `${count} filtro activo`,
|
|
32
32
|
// Quick filter toolbar field
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
toolbarQuickFilterPlaceholder: 'Buscar…',
|
|
34
|
+
toolbarQuickFilterLabel: 'Buscar',
|
|
35
|
+
toolbarQuickFilterDeleteIconLabel: 'Limpiar',
|
|
36
36
|
// Export selector toolbar button text
|
|
37
37
|
toolbarExport: 'Exportar',
|
|
38
38
|
toolbarExportLabel: 'Exportar',
|
|
39
39
|
toolbarExportCSV: 'Descargar como CSV',
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
toolbarExportPrint: 'Imprimir',
|
|
41
|
+
toolbarExportExcel: 'Descargar como Excel',
|
|
42
42
|
// Columns panel text
|
|
43
43
|
columnsPanelTextFieldLabel: 'Columna de búsqueda',
|
|
44
44
|
columnsPanelTextFieldPlaceholder: 'Título de columna',
|
|
@@ -48,7 +48,7 @@ const esESGrid = {
|
|
|
48
48
|
// Filter panel text
|
|
49
49
|
filterPanelAddFilter: 'Agregar filtro',
|
|
50
50
|
filterPanelDeleteIconLabel: 'Borrar',
|
|
51
|
-
|
|
51
|
+
filterPanelLinkOperator: 'Operador lógico',
|
|
52
52
|
filterPanelOperators: 'Operadores',
|
|
53
53
|
// TODO v6: rename to filterPanelOperator
|
|
54
54
|
filterPanelOperatorAnd: 'Y',
|
|
@@ -69,11 +69,11 @@ const esESGrid = {
|
|
|
69
69
|
filterOperatorOnOrBefore: 'es en o anterior',
|
|
70
70
|
filterOperatorIsEmpty: 'está vacío',
|
|
71
71
|
filterOperatorIsNotEmpty: 'no esta vacío',
|
|
72
|
-
|
|
72
|
+
filterOperatorIsAnyOf: 'es cualquiera de',
|
|
73
73
|
// Filter values text
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
filterValueAny: 'cualquiera',
|
|
75
|
+
filterValueTrue: 'verdadero',
|
|
76
|
+
filterValueFalse: 'falso',
|
|
77
77
|
// Column menu text
|
|
78
78
|
columnMenuLabel: 'Menú',
|
|
79
79
|
columnMenuShowColumns: 'Mostrar columnas',
|
|
@@ -93,19 +93,20 @@ const esESGrid = {
|
|
|
93
93
|
// Total visible row amount footer text
|
|
94
94
|
footerTotalVisibleRows: (visibleCount, totalCount) => `${visibleCount.toLocaleString()} de ${totalCount.toLocaleString()}`,
|
|
95
95
|
// Checkbox selection text
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
96
|
+
checkboxSelectionHeaderName: 'Seleccionar casilla',
|
|
97
|
+
checkboxSelectionSelectAllRows: 'Seleccionar todas las filas',
|
|
98
|
+
checkboxSelectionUnselectAllRows: 'Deseleccionar todas las filas',
|
|
99
|
+
checkboxSelectionSelectRow: 'Seleccionar fila',
|
|
100
|
+
checkboxSelectionUnselectRow: 'Deseleccionar fila',
|
|
101
101
|
// Boolean cell text
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
booleanCellTrueLabel: 'si',
|
|
103
|
+
booleanCellFalseLabel: 'no',
|
|
104
104
|
// Actions cell more text
|
|
105
|
-
actionsCellMore: 'más'
|
|
106
|
-
//
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
actionsCellMore: 'más',
|
|
106
|
+
// Column pinning text
|
|
107
|
+
pinToLeft: 'Anclar a la izquierda',
|
|
108
|
+
pinToRight: 'Anclar a la derecha',
|
|
109
|
+
unpin: 'Desanclar',
|
|
109
110
|
// Tree Data
|
|
110
111
|
// treeDataGroupingHeaderName: 'Group',
|
|
111
112
|
// treeDataExpand: 'see children',
|
|
@@ -116,17 +117,16 @@ const esESGrid = {
|
|
|
116
117
|
// unGroupColumn: name => `Stop grouping by ${name}`,
|
|
117
118
|
// Master/detail
|
|
118
119
|
// detailPanelToggle: 'Detail panel toggle',
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
expandDetailPanel: 'Expandir',
|
|
121
|
+
collapseDetailPanel: 'reducirse',
|
|
121
122
|
// Row reordering text
|
|
122
123
|
// rowReorderingHeaderName: 'Row reordering',
|
|
123
124
|
// Aggregation
|
|
124
125
|
// aggregationMenuItemHeader: 'Aggregation',
|
|
125
126
|
// aggregationFunctionLabelSum: 'sum',
|
|
126
127
|
// aggregationFunctionLabelAvg: 'avg',
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
// aggregationFunctionLabelSize: 'size',
|
|
128
|
+
aggregationFunctionLabelMin: 'min',
|
|
129
|
+
aggregationFunctionLabelMax: 'max' // aggregationFunctionLabelSize: 'size',
|
|
130
130
|
|
|
131
131
|
};
|
|
132
132
|
const esES = (0, _getGridLocalization.getGridLocalization)(esESGrid, _locale.esES);
|
package/node/utils/utils.js
CHANGED
package/package.json
CHANGED
package/utils/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare function isNumber(value: any): value is number;
|
|
2
2
|
export declare function isFunction(value: any): value is Function;
|
|
3
|
-
export declare function isObject(value:
|
|
3
|
+
export declare function isObject<TObject = Record<PropertyKey, any>>(value: unknown): value is TObject;
|
|
4
4
|
export declare function localStorageAvailable(): boolean;
|
|
5
5
|
export declare function escapeRegExp(value: string): string;
|
|
6
6
|
/**
|
package/utils/utils.js
CHANGED