@mui/x-data-grid 6.19.3 → 6.19.4
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 +56 -0
- package/components/GridPagination.d.ts +1 -1
- package/components/GridPagination.js +8 -1
- package/components/cell/GridActionsCell.js +3 -3
- package/components/cell/GridActionsCellItem.d.ts +13 -1
- package/components/cell/GridActionsCellItem.js +27 -15
- package/components/containers/GridRootStyles.js +6 -0
- package/hooks/features/export/useGridPrintExport.js +3 -1
- package/hooks/features/filter/gridFilterUtils.js +15 -22
- package/index.js +1 -1
- package/legacy/components/GridPagination.js +8 -1
- package/legacy/components/cell/GridActionsCell.js +3 -3
- package/legacy/components/cell/GridActionsCellItem.js +30 -17
- package/legacy/components/containers/GridRootStyles.js +5 -1
- package/legacy/hooks/features/export/useGridPrintExport.js +11 -7
- package/legacy/hooks/features/filter/gridFilterUtils.js +11 -14
- package/legacy/index.js +1 -1
- package/legacy/locales/daDK.js +12 -12
- package/locales/daDK.js +12 -12
- package/models/props/DataGridProps.d.ts +1 -1
- package/modern/components/GridPagination.js +8 -1
- package/modern/components/cell/GridActionsCell.js +3 -3
- package/modern/components/cell/GridActionsCellItem.js +27 -15
- package/modern/components/containers/GridRootStyles.js +6 -0
- package/modern/hooks/features/export/useGridPrintExport.js +3 -1
- package/modern/hooks/features/filter/gridFilterUtils.js +15 -22
- package/modern/index.js +1 -1
- package/modern/locales/daDK.js +12 -12
- package/node/components/GridPagination.js +8 -1
- package/node/components/cell/GridActionsCell.js +3 -3
- package/node/components/cell/GridActionsCellItem.js +27 -15
- package/node/components/containers/GridRootStyles.js +6 -0
- package/node/hooks/features/export/useGridPrintExport.js +3 -1
- package/node/hooks/features/filter/gridFilterUtils.js +15 -21
- package/node/index.js +1 -1
- package/node/locales/daDK.js +12 -12
- package/package.json +1 -1
package/legacy/locales/daDK.js
CHANGED
|
@@ -11,8 +11,8 @@ var daDKGrid = {
|
|
|
11
11
|
toolbarDensityStandard: 'Standard',
|
|
12
12
|
toolbarDensityComfortable: 'Luftig',
|
|
13
13
|
// Columns selector toolbar button text
|
|
14
|
-
toolbarColumns: '
|
|
15
|
-
toolbarColumnsLabel: 'Vælg
|
|
14
|
+
toolbarColumns: 'Kolonner',
|
|
15
|
+
toolbarColumnsLabel: 'Vælg kolonner',
|
|
16
16
|
// Filters toolbar button text
|
|
17
17
|
toolbarFilters: 'Filtre',
|
|
18
18
|
toolbarFiltersLabel: 'Vis filtre',
|
|
@@ -42,12 +42,12 @@ var daDKGrid = {
|
|
|
42
42
|
filterPanelRemoveAll: 'Fjern alle',
|
|
43
43
|
filterPanelDeleteIconLabel: 'Slet',
|
|
44
44
|
filterPanelLogicOperator: 'Logisk operator',
|
|
45
|
-
filterPanelOperator: '
|
|
45
|
+
filterPanelOperator: 'Operator',
|
|
46
46
|
filterPanelOperatorAnd: 'Og',
|
|
47
47
|
filterPanelOperatorOr: 'Eller',
|
|
48
|
-
filterPanelColumns: '
|
|
48
|
+
filterPanelColumns: 'Kolonner',
|
|
49
49
|
filterPanelInputLabel: 'Værdi',
|
|
50
|
-
filterPanelInputPlaceholder: '
|
|
50
|
+
filterPanelInputPlaceholder: 'Filterværdi',
|
|
51
51
|
// Filter operators text
|
|
52
52
|
filterOperatorContains: 'indeholder',
|
|
53
53
|
filterOperatorEquals: 'lig med',
|
|
@@ -94,10 +94,10 @@ var daDKGrid = {
|
|
|
94
94
|
filterValueFalse: 'negativ',
|
|
95
95
|
// Column menu text
|
|
96
96
|
columnMenuLabel: 'Menu',
|
|
97
|
-
columnMenuShowColumns: 'Vis
|
|
97
|
+
columnMenuShowColumns: 'Vis kolonner',
|
|
98
98
|
columnMenuManageColumns: 'Administrer kolonner',
|
|
99
|
-
columnMenuFilter: '
|
|
100
|
-
columnMenuHideColumn: 'Skjul',
|
|
99
|
+
columnMenuFilter: 'Filtrer',
|
|
100
|
+
columnMenuHideColumn: 'Skjul kolonne',
|
|
101
101
|
columnMenuUnsort: 'Fjern sortering',
|
|
102
102
|
columnMenuSortAsc: 'Sorter stigende',
|
|
103
103
|
columnMenuSortDesc: 'Sorter faldende',
|
|
@@ -133,16 +133,16 @@ var daDKGrid = {
|
|
|
133
133
|
pinToRight: 'Fastgør til højre',
|
|
134
134
|
unpin: 'Frigiv',
|
|
135
135
|
// Tree Data
|
|
136
|
-
treeDataGroupingHeaderName: '
|
|
136
|
+
treeDataGroupingHeaderName: 'Gruppe',
|
|
137
137
|
treeDataExpand: 'Vis underelementer',
|
|
138
138
|
treeDataCollapse: 'Skjul underelementer',
|
|
139
139
|
// Grouping columns
|
|
140
|
-
groupingColumnHeaderName: '
|
|
140
|
+
groupingColumnHeaderName: 'Gruppe',
|
|
141
141
|
groupColumn: function groupColumn(name) {
|
|
142
142
|
return "Grupp\xE9r efter ".concat(name);
|
|
143
143
|
},
|
|
144
144
|
unGroupColumn: function unGroupColumn(name) {
|
|
145
|
-
return "Fjern
|
|
145
|
+
return "Fjern gruppering efter ".concat(name);
|
|
146
146
|
},
|
|
147
147
|
// Master/detail
|
|
148
148
|
detailPanelToggle: 'Udvid/kollaps detaljepanel',
|
|
@@ -151,7 +151,7 @@ var daDKGrid = {
|
|
|
151
151
|
// Row reordering text
|
|
152
152
|
rowReorderingHeaderName: 'Omarrangering af rækker',
|
|
153
153
|
// Aggregation
|
|
154
|
-
aggregationMenuItemHeader: '
|
|
154
|
+
aggregationMenuItemHeader: 'Aggregering',
|
|
155
155
|
aggregationFunctionLabelSum: 'sum',
|
|
156
156
|
aggregationFunctionLabelAvg: 'gns',
|
|
157
157
|
aggregationFunctionLabelMin: 'min',
|
package/locales/daDK.js
CHANGED
|
@@ -11,8 +11,8 @@ const daDKGrid = {
|
|
|
11
11
|
toolbarDensityStandard: 'Standard',
|
|
12
12
|
toolbarDensityComfortable: 'Luftig',
|
|
13
13
|
// Columns selector toolbar button text
|
|
14
|
-
toolbarColumns: '
|
|
15
|
-
toolbarColumnsLabel: 'Vælg
|
|
14
|
+
toolbarColumns: 'Kolonner',
|
|
15
|
+
toolbarColumnsLabel: 'Vælg kolonner',
|
|
16
16
|
// Filters toolbar button text
|
|
17
17
|
toolbarFilters: 'Filtre',
|
|
18
18
|
toolbarFiltersLabel: 'Vis filtre',
|
|
@@ -40,12 +40,12 @@ const daDKGrid = {
|
|
|
40
40
|
filterPanelRemoveAll: 'Fjern alle',
|
|
41
41
|
filterPanelDeleteIconLabel: 'Slet',
|
|
42
42
|
filterPanelLogicOperator: 'Logisk operator',
|
|
43
|
-
filterPanelOperator: '
|
|
43
|
+
filterPanelOperator: 'Operator',
|
|
44
44
|
filterPanelOperatorAnd: 'Og',
|
|
45
45
|
filterPanelOperatorOr: 'Eller',
|
|
46
|
-
filterPanelColumns: '
|
|
46
|
+
filterPanelColumns: 'Kolonner',
|
|
47
47
|
filterPanelInputLabel: 'Værdi',
|
|
48
|
-
filterPanelInputPlaceholder: '
|
|
48
|
+
filterPanelInputPlaceholder: 'Filterværdi',
|
|
49
49
|
// Filter operators text
|
|
50
50
|
filterOperatorContains: 'indeholder',
|
|
51
51
|
filterOperatorEquals: 'lig med',
|
|
@@ -92,10 +92,10 @@ const daDKGrid = {
|
|
|
92
92
|
filterValueFalse: 'negativ',
|
|
93
93
|
// Column menu text
|
|
94
94
|
columnMenuLabel: 'Menu',
|
|
95
|
-
columnMenuShowColumns: 'Vis
|
|
95
|
+
columnMenuShowColumns: 'Vis kolonner',
|
|
96
96
|
columnMenuManageColumns: 'Administrer kolonner',
|
|
97
|
-
columnMenuFilter: '
|
|
98
|
-
columnMenuHideColumn: 'Skjul',
|
|
97
|
+
columnMenuFilter: 'Filtrer',
|
|
98
|
+
columnMenuHideColumn: 'Skjul kolonne',
|
|
99
99
|
columnMenuUnsort: 'Fjern sortering',
|
|
100
100
|
columnMenuSortAsc: 'Sorter stigende',
|
|
101
101
|
columnMenuSortDesc: 'Sorter faldende',
|
|
@@ -125,13 +125,13 @@ const daDKGrid = {
|
|
|
125
125
|
pinToRight: 'Fastgør til højre',
|
|
126
126
|
unpin: 'Frigiv',
|
|
127
127
|
// Tree Data
|
|
128
|
-
treeDataGroupingHeaderName: '
|
|
128
|
+
treeDataGroupingHeaderName: 'Gruppe',
|
|
129
129
|
treeDataExpand: 'Vis underelementer',
|
|
130
130
|
treeDataCollapse: 'Skjul underelementer',
|
|
131
131
|
// Grouping columns
|
|
132
|
-
groupingColumnHeaderName: '
|
|
132
|
+
groupingColumnHeaderName: 'Gruppe',
|
|
133
133
|
groupColumn: name => `Gruppér efter ${name}`,
|
|
134
|
-
unGroupColumn: name => `Fjern
|
|
134
|
+
unGroupColumn: name => `Fjern gruppering efter ${name}`,
|
|
135
135
|
// Master/detail
|
|
136
136
|
detailPanelToggle: 'Udvid/kollaps detaljepanel',
|
|
137
137
|
expandDetailPanel: 'Udvid',
|
|
@@ -139,7 +139,7 @@ const daDKGrid = {
|
|
|
139
139
|
// Row reordering text
|
|
140
140
|
rowReorderingHeaderName: 'Omarrangering af rækker',
|
|
141
141
|
// Aggregation
|
|
142
|
-
aggregationMenuItemHeader: '
|
|
142
|
+
aggregationMenuItemHeader: 'Aggregering',
|
|
143
143
|
aggregationFunctionLabelSum: 'sum',
|
|
144
144
|
aggregationFunctionLabelAvg: 'gns',
|
|
145
145
|
aggregationFunctionLabelMin: 'min',
|
|
@@ -278,7 +278,7 @@ export interface DataGridPropsWithDefaultValues {
|
|
|
278
278
|
* Select the pageSize dynamically using the component UI.
|
|
279
279
|
* @default [25, 50, 100]
|
|
280
280
|
*/
|
|
281
|
-
pageSizeOptions:
|
|
281
|
+
pageSizeOptions: ReadonlyArray<number | {
|
|
282
282
|
value: number;
|
|
283
283
|
label: string;
|
|
284
284
|
}>;
|
|
@@ -24,6 +24,9 @@ const GridPaginationRoot = styled(TablePagination)(({
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
}));
|
|
27
|
+
|
|
28
|
+
// A mutable version of a readonly array.
|
|
29
|
+
|
|
27
30
|
export const GridPagination = /*#__PURE__*/React.forwardRef(function GridPagination(props, ref) {
|
|
28
31
|
const apiRef = useGridApiContext();
|
|
29
32
|
const rootProps = useGridRootProps();
|
|
@@ -65,7 +68,11 @@ export const GridPagination = /*#__PURE__*/React.forwardRef(function GridPaginat
|
|
|
65
68
|
ref: ref,
|
|
66
69
|
component: "div",
|
|
67
70
|
count: rowCount,
|
|
68
|
-
page: paginationModel.page <= lastPage ? paginationModel.page : lastPage
|
|
71
|
+
page: paginationModel.page <= lastPage ? paginationModel.page : lastPage
|
|
72
|
+
// TODO: Remove the cast once the type is fixed in Material UI and that the min Material UI version
|
|
73
|
+
// for x-data-grid is past the fix.
|
|
74
|
+
// Note that Material UI will not mutate the array, so this is safe.
|
|
75
|
+
,
|
|
69
76
|
rowsPerPageOptions: pageSizeOptions,
|
|
70
77
|
rowsPerPage: paginationModel.pageSize,
|
|
71
78
|
onPageChange: handlePageChange,
|
|
@@ -136,7 +136,7 @@ function GridActionsCell(props) {
|
|
|
136
136
|
if (event.key === 'Tab') {
|
|
137
137
|
event.preventDefault();
|
|
138
138
|
}
|
|
139
|
-
if (['Tab', '
|
|
139
|
+
if (['Tab', 'Escape'].includes(event.key)) {
|
|
140
140
|
hideMenu();
|
|
141
141
|
}
|
|
142
142
|
};
|
|
@@ -173,7 +173,6 @@ function GridActionsCell(props) {
|
|
|
173
173
|
target: buttonRef.current,
|
|
174
174
|
position: position,
|
|
175
175
|
onClose: hideMenu,
|
|
176
|
-
onClick: hideMenu,
|
|
177
176
|
children: /*#__PURE__*/_jsx(MenuList, {
|
|
178
177
|
id: menuId,
|
|
179
178
|
className: gridClasses.menuList,
|
|
@@ -182,7 +181,8 @@ function GridActionsCell(props) {
|
|
|
182
181
|
variant: "menu",
|
|
183
182
|
autoFocusItem: true,
|
|
184
183
|
children: menuButtons.map((button, index) => /*#__PURE__*/React.cloneElement(button, {
|
|
185
|
-
key: index
|
|
184
|
+
key: index,
|
|
185
|
+
closeMenu: hideMenu
|
|
186
186
|
}))
|
|
187
187
|
})
|
|
188
188
|
})]
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["label", "icon", "showInMenu", "onClick"]
|
|
3
|
+
const _excluded = ["label", "icon", "showInMenu", "onClick"],
|
|
4
|
+
_excluded2 = ["label", "icon", "showInMenu", "onClick", "closeMenuOnClick", "closeMenu"];
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
6
7
|
import MenuItem from '@mui/material/MenuItem';
|
|
@@ -9,20 +10,17 @@ import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
12
|
const GridActionsCellItem = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
12
|
-
const {
|
|
13
|
-
label,
|
|
14
|
-
icon,
|
|
15
|
-
showInMenu,
|
|
16
|
-
onClick
|
|
17
|
-
} = props,
|
|
18
|
-
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
19
13
|
const rootProps = useGridRootProps();
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
if (!props.showInMenu) {
|
|
15
|
+
const {
|
|
16
|
+
label,
|
|
17
|
+
icon,
|
|
18
|
+
onClick
|
|
19
|
+
} = props,
|
|
20
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
21
|
+
const handleClick = event => {
|
|
22
|
+
onClick?.(event);
|
|
23
|
+
};
|
|
26
24
|
return /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
|
|
27
25
|
ref: ref,
|
|
28
26
|
size: "small",
|
|
@@ -36,10 +34,24 @@ const GridActionsCellItem = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
36
34
|
})
|
|
37
35
|
}));
|
|
38
36
|
}
|
|
37
|
+
const {
|
|
38
|
+
label,
|
|
39
|
+
icon,
|
|
40
|
+
onClick,
|
|
41
|
+
closeMenuOnClick = true,
|
|
42
|
+
closeMenu
|
|
43
|
+
} = props,
|
|
44
|
+
other = _objectWithoutPropertiesLoose(props, _excluded2);
|
|
45
|
+
const handleClick = event => {
|
|
46
|
+
onClick?.(event);
|
|
47
|
+
if (closeMenuOnClick) {
|
|
48
|
+
closeMenu?.();
|
|
49
|
+
}
|
|
50
|
+
};
|
|
39
51
|
return /*#__PURE__*/_jsxs(MenuItem, _extends({
|
|
40
52
|
ref: ref
|
|
41
53
|
}, other, {
|
|
42
|
-
onClick:
|
|
54
|
+
onClick: handleClick,
|
|
43
55
|
children: [icon && /*#__PURE__*/_jsx(ListItemIcon, {
|
|
44
56
|
children: icon
|
|
45
57
|
}), label]
|
|
@@ -193,6 +193,12 @@ export const GridRootStyles = styled('div', {
|
|
|
193
193
|
[`& .${gridClasses.cell} > *`]: {
|
|
194
194
|
overflow: 'visible !important',
|
|
195
195
|
whiteSpace: 'nowrap'
|
|
196
|
+
},
|
|
197
|
+
[`& .${gridClasses.groupingCriteriaCell}`]: {
|
|
198
|
+
width: 'unset'
|
|
199
|
+
},
|
|
200
|
+
[`& .${gridClasses.treeDataGroupingCell}`]: {
|
|
201
|
+
width: 'unset'
|
|
196
202
|
}
|
|
197
203
|
},
|
|
198
204
|
[`& .${gridClasses['virtualScrollerContent--overflowed']} .${gridClasses['row--lastVisible']} .${gridClasses.cell}`]: {
|
|
@@ -13,6 +13,7 @@ import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
|
|
|
13
13
|
import { GridPrintExportMenuItem } from '../../../components/toolbar/GridToolbarExport';
|
|
14
14
|
import { getTotalHeaderHeight } from '../columns/gridColumnsUtils';
|
|
15
15
|
import { GRID_CHECKBOX_SELECTION_COL_DEF } from '../../../colDef/gridCheckboxSelectionColDef';
|
|
16
|
+
import { gridDataRowIdsSelector, gridRowsLookupSelector } from '../rows/gridRowsSelector';
|
|
16
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
18
|
function raf() {
|
|
18
19
|
return new Promise(resolve => {
|
|
@@ -213,7 +214,8 @@ export const useGridPrintExport = (apiRef, props) => {
|
|
|
213
214
|
previousGridState.current = apiRef.current.exportState();
|
|
214
215
|
// It appends that the visibility model is not exported, especially if columnVisibility is not controlled
|
|
215
216
|
previousColumnVisibility.current = gridColumnVisibilityModelSelector(apiRef);
|
|
216
|
-
|
|
217
|
+
const gridRowsLookup = gridRowsLookupSelector(apiRef);
|
|
218
|
+
previousRows.current = gridDataRowIdsSelector(apiRef).map(rowId => gridRowsLookup[rowId]);
|
|
217
219
|
if (props.pagination) {
|
|
218
220
|
const visibleRowCount = gridExpandedRowCountSelector(apiRef);
|
|
219
221
|
const paginationModel = {
|
|
@@ -5,22 +5,18 @@ import { getDefaultGridFilterModel } from './gridFilterState';
|
|
|
5
5
|
import { buildWarning } from '../../../utils/warning';
|
|
6
6
|
import { getPublicApiRef } from '../../../utils/getPublicApiRef';
|
|
7
7
|
import { gridColumnFieldsSelector, gridColumnLookupSelector, gridVisibleColumnFieldsSelector } from '../columns';
|
|
8
|
-
|
|
9
|
-
// Fixes https://github.com/mui/mui-x/issues/10056
|
|
10
|
-
const globalScope = typeof window === 'undefined' ? globalThis : window;
|
|
11
|
-
const evalCode = globalScope[atob('ZXZhbA==')];
|
|
12
8
|
let hasEval;
|
|
13
|
-
|
|
9
|
+
function getHasEval() {
|
|
14
10
|
if (hasEval !== undefined) {
|
|
15
11
|
return hasEval;
|
|
16
12
|
}
|
|
17
13
|
try {
|
|
18
|
-
hasEval =
|
|
14
|
+
hasEval = new Function('return true')();
|
|
19
15
|
} catch (_) {
|
|
20
16
|
hasEval = false;
|
|
21
17
|
}
|
|
22
18
|
return hasEval;
|
|
23
|
-
}
|
|
19
|
+
}
|
|
24
20
|
/**
|
|
25
21
|
* Adds default values to the optional fields of a filter items.
|
|
26
22
|
* @param {GridFilterItem} item The raw filter item.
|
|
@@ -183,25 +179,22 @@ const buildAggregatedFilterItemsApplier = (filterModel, apiRef, disableEval) =>
|
|
|
183
179
|
};
|
|
184
180
|
}
|
|
185
181
|
|
|
186
|
-
// We generate a new function with `
|
|
182
|
+
// We generate a new function with `new Function()` to avoid expensive patterns for JS engines
|
|
187
183
|
// such as a dynamic object assignment, e.g. `{ [dynamicKey]: value }`.
|
|
188
|
-
const
|
|
189
|
-
|
|
184
|
+
const filterItemCore = new Function('getRowId', 'appliers', 'row', 'shouldApplyFilter', `"use strict";
|
|
185
|
+
${appliers.map((applier, i) => `const shouldApply${i} = !shouldApplyFilter || shouldApplyFilter(${JSON.stringify(applier.item.field)});`).join('\n')}
|
|
190
186
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
`).join('\n')}};
|
|
187
|
+
const result$$ = {
|
|
188
|
+
${appliers.map((applier, i) => ` ${JSON.stringify(String(applier.item.id))}: !shouldApply${i}
|
|
189
|
+
? false
|
|
190
|
+
: ${applier.v7 ? `appliers[${i}].fn(row)` : `appliers[${i}].fn(getRowId(row))`},`).join('\n')}
|
|
191
|
+
};
|
|
197
192
|
|
|
198
|
-
|
|
199
|
-
})`;
|
|
200
|
-
const filterItemCore = evalCode(filterItemTemplate.replaceAll('$$', String(filterItemsApplierId)));
|
|
201
|
-
const filterItem = (row, shouldApplyItem) => {
|
|
202
|
-
return filterItemCore(apiRef.current.getRowId, appliers, row, shouldApplyItem);
|
|
203
|
-
};
|
|
193
|
+
return result$$;`.replaceAll('$$', String(filterItemsApplierId)));
|
|
204
194
|
filterItemsApplierId += 1;
|
|
195
|
+
|
|
196
|
+
// Assign to the arrow function a name to help debugging
|
|
197
|
+
const filterItem = (row, shouldApplyItem) => filterItemCore(apiRef.current.getRowId, appliers, row, shouldApplyItem);
|
|
205
198
|
return filterItem;
|
|
206
199
|
};
|
|
207
200
|
|
package/modern/index.js
CHANGED
package/modern/locales/daDK.js
CHANGED
|
@@ -11,8 +11,8 @@ const daDKGrid = {
|
|
|
11
11
|
toolbarDensityStandard: 'Standard',
|
|
12
12
|
toolbarDensityComfortable: 'Luftig',
|
|
13
13
|
// Columns selector toolbar button text
|
|
14
|
-
toolbarColumns: '
|
|
15
|
-
toolbarColumnsLabel: 'Vælg
|
|
14
|
+
toolbarColumns: 'Kolonner',
|
|
15
|
+
toolbarColumnsLabel: 'Vælg kolonner',
|
|
16
16
|
// Filters toolbar button text
|
|
17
17
|
toolbarFilters: 'Filtre',
|
|
18
18
|
toolbarFiltersLabel: 'Vis filtre',
|
|
@@ -40,12 +40,12 @@ const daDKGrid = {
|
|
|
40
40
|
filterPanelRemoveAll: 'Fjern alle',
|
|
41
41
|
filterPanelDeleteIconLabel: 'Slet',
|
|
42
42
|
filterPanelLogicOperator: 'Logisk operator',
|
|
43
|
-
filterPanelOperator: '
|
|
43
|
+
filterPanelOperator: 'Operator',
|
|
44
44
|
filterPanelOperatorAnd: 'Og',
|
|
45
45
|
filterPanelOperatorOr: 'Eller',
|
|
46
|
-
filterPanelColumns: '
|
|
46
|
+
filterPanelColumns: 'Kolonner',
|
|
47
47
|
filterPanelInputLabel: 'Værdi',
|
|
48
|
-
filterPanelInputPlaceholder: '
|
|
48
|
+
filterPanelInputPlaceholder: 'Filterværdi',
|
|
49
49
|
// Filter operators text
|
|
50
50
|
filterOperatorContains: 'indeholder',
|
|
51
51
|
filterOperatorEquals: 'lig med',
|
|
@@ -92,10 +92,10 @@ const daDKGrid = {
|
|
|
92
92
|
filterValueFalse: 'negativ',
|
|
93
93
|
// Column menu text
|
|
94
94
|
columnMenuLabel: 'Menu',
|
|
95
|
-
columnMenuShowColumns: 'Vis
|
|
95
|
+
columnMenuShowColumns: 'Vis kolonner',
|
|
96
96
|
columnMenuManageColumns: 'Administrer kolonner',
|
|
97
|
-
columnMenuFilter: '
|
|
98
|
-
columnMenuHideColumn: 'Skjul',
|
|
97
|
+
columnMenuFilter: 'Filtrer',
|
|
98
|
+
columnMenuHideColumn: 'Skjul kolonne',
|
|
99
99
|
columnMenuUnsort: 'Fjern sortering',
|
|
100
100
|
columnMenuSortAsc: 'Sorter stigende',
|
|
101
101
|
columnMenuSortDesc: 'Sorter faldende',
|
|
@@ -125,13 +125,13 @@ const daDKGrid = {
|
|
|
125
125
|
pinToRight: 'Fastgør til højre',
|
|
126
126
|
unpin: 'Frigiv',
|
|
127
127
|
// Tree Data
|
|
128
|
-
treeDataGroupingHeaderName: '
|
|
128
|
+
treeDataGroupingHeaderName: 'Gruppe',
|
|
129
129
|
treeDataExpand: 'Vis underelementer',
|
|
130
130
|
treeDataCollapse: 'Skjul underelementer',
|
|
131
131
|
// Grouping columns
|
|
132
|
-
groupingColumnHeaderName: '
|
|
132
|
+
groupingColumnHeaderName: 'Gruppe',
|
|
133
133
|
groupColumn: name => `Gruppér efter ${name}`,
|
|
134
|
-
unGroupColumn: name => `Fjern
|
|
134
|
+
unGroupColumn: name => `Fjern gruppering efter ${name}`,
|
|
135
135
|
// Master/detail
|
|
136
136
|
detailPanelToggle: 'Udvid/kollaps detaljepanel',
|
|
137
137
|
expandDetailPanel: 'Udvid',
|
|
@@ -139,7 +139,7 @@ const daDKGrid = {
|
|
|
139
139
|
// Row reordering text
|
|
140
140
|
rowReorderingHeaderName: 'Omarrangering af rækker',
|
|
141
141
|
// Aggregation
|
|
142
|
-
aggregationMenuItemHeader: '
|
|
142
|
+
aggregationMenuItemHeader: 'Aggregering',
|
|
143
143
|
aggregationFunctionLabelSum: 'sum',
|
|
144
144
|
aggregationFunctionLabelAvg: 'gns',
|
|
145
145
|
aggregationFunctionLabelMin: 'min',
|
|
@@ -33,6 +33,9 @@ const GridPaginationRoot = (0, _styles.styled)(_TablePagination.default)(({
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}));
|
|
36
|
+
|
|
37
|
+
// A mutable version of a readonly array.
|
|
38
|
+
|
|
36
39
|
const GridPagination = exports.GridPagination = /*#__PURE__*/React.forwardRef(function GridPagination(props, ref) {
|
|
37
40
|
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
38
41
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
@@ -74,7 +77,11 @@ const GridPagination = exports.GridPagination = /*#__PURE__*/React.forwardRef(fu
|
|
|
74
77
|
ref: ref,
|
|
75
78
|
component: "div",
|
|
76
79
|
count: rowCount,
|
|
77
|
-
page: paginationModel.page <= lastPage ? paginationModel.page : lastPage
|
|
80
|
+
page: paginationModel.page <= lastPage ? paginationModel.page : lastPage
|
|
81
|
+
// TODO: Remove the cast once the type is fixed in Material UI and that the min Material UI version
|
|
82
|
+
// for x-data-grid is past the fix.
|
|
83
|
+
// Note that Material UI will not mutate the array, so this is safe.
|
|
84
|
+
,
|
|
78
85
|
rowsPerPageOptions: pageSizeOptions,
|
|
79
86
|
rowsPerPage: paginationModel.pageSize,
|
|
80
87
|
onPageChange: handlePageChange,
|
|
@@ -145,7 +145,7 @@ function GridActionsCell(props) {
|
|
|
145
145
|
if (event.key === 'Tab') {
|
|
146
146
|
event.preventDefault();
|
|
147
147
|
}
|
|
148
|
-
if (['Tab', '
|
|
148
|
+
if (['Tab', 'Escape'].includes(event.key)) {
|
|
149
149
|
hideMenu();
|
|
150
150
|
}
|
|
151
151
|
};
|
|
@@ -182,7 +182,6 @@ function GridActionsCell(props) {
|
|
|
182
182
|
target: buttonRef.current,
|
|
183
183
|
position: position,
|
|
184
184
|
onClose: hideMenu,
|
|
185
|
-
onClick: hideMenu,
|
|
186
185
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuList.default, {
|
|
187
186
|
id: menuId,
|
|
188
187
|
className: _gridClasses.gridClasses.menuList,
|
|
@@ -191,7 +190,8 @@ function GridActionsCell(props) {
|
|
|
191
190
|
variant: "menu",
|
|
192
191
|
autoFocusItem: true,
|
|
193
192
|
children: menuButtons.map((button, index) => /*#__PURE__*/React.cloneElement(button, {
|
|
194
|
-
key: index
|
|
193
|
+
key: index,
|
|
194
|
+
closeMenu: hideMenu
|
|
195
195
|
}))
|
|
196
196
|
})
|
|
197
197
|
})]
|
|
@@ -13,24 +13,22 @@ var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
|
13
13
|
var _ListItemIcon = _interopRequireDefault(require("@mui/material/ListItemIcon"));
|
|
14
14
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
15
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
-
const _excluded = ["label", "icon", "showInMenu", "onClick"]
|
|
16
|
+
const _excluded = ["label", "icon", "showInMenu", "onClick"],
|
|
17
|
+
_excluded2 = ["label", "icon", "showInMenu", "onClick", "closeMenuOnClick", "closeMenu"];
|
|
17
18
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
18
19
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
20
|
const GridActionsCellItem = exports.GridActionsCellItem = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
20
|
-
const {
|
|
21
|
-
label,
|
|
22
|
-
icon,
|
|
23
|
-
showInMenu,
|
|
24
|
-
onClick
|
|
25
|
-
} = props,
|
|
26
|
-
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
27
21
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
if (!props.showInMenu) {
|
|
23
|
+
const {
|
|
24
|
+
label,
|
|
25
|
+
icon,
|
|
26
|
+
onClick
|
|
27
|
+
} = props,
|
|
28
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
29
|
+
const handleClick = event => {
|
|
30
|
+
onClick?.(event);
|
|
31
|
+
};
|
|
34
32
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseIconButton, (0, _extends2.default)({
|
|
35
33
|
ref: ref,
|
|
36
34
|
size: "small",
|
|
@@ -44,10 +42,24 @@ const GridActionsCellItem = exports.GridActionsCellItem = /*#__PURE__*/React.for
|
|
|
44
42
|
})
|
|
45
43
|
}));
|
|
46
44
|
}
|
|
45
|
+
const {
|
|
46
|
+
label,
|
|
47
|
+
icon,
|
|
48
|
+
onClick,
|
|
49
|
+
closeMenuOnClick = true,
|
|
50
|
+
closeMenu
|
|
51
|
+
} = props,
|
|
52
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded2);
|
|
53
|
+
const handleClick = event => {
|
|
54
|
+
onClick?.(event);
|
|
55
|
+
if (closeMenuOnClick) {
|
|
56
|
+
closeMenu?.();
|
|
57
|
+
}
|
|
58
|
+
};
|
|
47
59
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_MenuItem.default, (0, _extends2.default)({
|
|
48
60
|
ref: ref
|
|
49
61
|
}, other, {
|
|
50
|
-
onClick:
|
|
62
|
+
onClick: handleClick,
|
|
51
63
|
children: [icon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemIcon.default, {
|
|
52
64
|
children: icon
|
|
53
65
|
}), label]
|
|
@@ -200,6 +200,12 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
|
|
|
200
200
|
[`& .${_gridClasses.gridClasses.cell} > *`]: {
|
|
201
201
|
overflow: 'visible !important',
|
|
202
202
|
whiteSpace: 'nowrap'
|
|
203
|
+
},
|
|
204
|
+
[`& .${_gridClasses.gridClasses.groupingCriteriaCell}`]: {
|
|
205
|
+
width: 'unset'
|
|
206
|
+
},
|
|
207
|
+
[`& .${_gridClasses.gridClasses.treeDataGroupingCell}`]: {
|
|
208
|
+
width: 'unset'
|
|
203
209
|
}
|
|
204
210
|
},
|
|
205
211
|
[`& .${_gridClasses.gridClasses['virtualScrollerContent--overflowed']} .${_gridClasses.gridClasses['row--lastVisible']} .${_gridClasses.gridClasses.cell}`]: {
|
|
@@ -20,6 +20,7 @@ var _pipeProcessing = require("../../core/pipeProcessing");
|
|
|
20
20
|
var _GridToolbarExport = require("../../../components/toolbar/GridToolbarExport");
|
|
21
21
|
var _gridColumnsUtils = require("../columns/gridColumnsUtils");
|
|
22
22
|
var _gridCheckboxSelectionColDef = require("../../../colDef/gridCheckboxSelectionColDef");
|
|
23
|
+
var _gridRowsSelector = require("../rows/gridRowsSelector");
|
|
23
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
25
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
25
26
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -222,7 +223,8 @@ const useGridPrintExport = (apiRef, props) => {
|
|
|
222
223
|
previousGridState.current = apiRef.current.exportState();
|
|
223
224
|
// It appends that the visibility model is not exported, especially if columnVisibility is not controlled
|
|
224
225
|
previousColumnVisibility.current = (0, _gridColumnsSelector.gridColumnVisibilityModelSelector)(apiRef);
|
|
225
|
-
|
|
226
|
+
const gridRowsLookup = (0, _gridRowsSelector.gridRowsLookupSelector)(apiRef);
|
|
227
|
+
previousRows.current = (0, _gridRowsSelector.gridDataRowIdsSelector)(apiRef).map(rowId => gridRowsLookup[rowId]);
|
|
226
228
|
if (props.pagination) {
|
|
227
229
|
const visibleRowCount = (0, _gridFilterSelector.gridExpandedRowCountSelector)(apiRef);
|
|
228
230
|
const paginationModel = {
|
|
@@ -12,21 +12,18 @@ var _gridFilterState = require("./gridFilterState");
|
|
|
12
12
|
var _warning = require("../../../utils/warning");
|
|
13
13
|
var _getPublicApiRef = require("../../../utils/getPublicApiRef");
|
|
14
14
|
var _columns = require("../columns");
|
|
15
|
-
// Fixes https://github.com/mui/mui-x/issues/10056
|
|
16
|
-
const globalScope = typeof window === 'undefined' ? globalThis : window;
|
|
17
|
-
const evalCode = globalScope[atob('ZXZhbA==')];
|
|
18
15
|
let hasEval;
|
|
19
|
-
|
|
16
|
+
function getHasEval() {
|
|
20
17
|
if (hasEval !== undefined) {
|
|
21
18
|
return hasEval;
|
|
22
19
|
}
|
|
23
20
|
try {
|
|
24
|
-
hasEval =
|
|
21
|
+
hasEval = new Function('return true')();
|
|
25
22
|
} catch (_) {
|
|
26
23
|
hasEval = false;
|
|
27
24
|
}
|
|
28
25
|
return hasEval;
|
|
29
|
-
}
|
|
26
|
+
}
|
|
30
27
|
/**
|
|
31
28
|
* Adds default values to the optional fields of a filter items.
|
|
32
29
|
* @param {GridFilterItem} item The raw filter item.
|
|
@@ -193,25 +190,22 @@ const buildAggregatedFilterItemsApplier = (filterModel, apiRef, disableEval) =>
|
|
|
193
190
|
};
|
|
194
191
|
}
|
|
195
192
|
|
|
196
|
-
// We generate a new function with `
|
|
193
|
+
// We generate a new function with `new Function()` to avoid expensive patterns for JS engines
|
|
197
194
|
// such as a dynamic object assignment, e.g. `{ [dynamicKey]: value }`.
|
|
198
|
-
const
|
|
199
|
-
|
|
195
|
+
const filterItemCore = new Function('getRowId', 'appliers', 'row', 'shouldApplyFilter', `"use strict";
|
|
196
|
+
${appliers.map((applier, i) => `const shouldApply${i} = !shouldApplyFilter || shouldApplyFilter(${JSON.stringify(applier.item.field)});`).join('\n')}
|
|
200
197
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
`).join('\n')}};
|
|
198
|
+
const result$$ = {
|
|
199
|
+
${appliers.map((applier, i) => ` ${JSON.stringify(String(applier.item.id))}: !shouldApply${i}
|
|
200
|
+
? false
|
|
201
|
+
: ${applier.v7 ? `appliers[${i}].fn(row)` : `appliers[${i}].fn(getRowId(row))`},`).join('\n')}
|
|
202
|
+
};
|
|
207
203
|
|
|
208
|
-
|
|
209
|
-
})`;
|
|
210
|
-
const filterItemCore = evalCode(filterItemTemplate.replaceAll('$$', String(filterItemsApplierId)));
|
|
211
|
-
const filterItem = (row, shouldApplyItem) => {
|
|
212
|
-
return filterItemCore(apiRef.current.getRowId, appliers, row, shouldApplyItem);
|
|
213
|
-
};
|
|
204
|
+
return result$$;`.replaceAll('$$', String(filterItemsApplierId)));
|
|
214
205
|
filterItemsApplierId += 1;
|
|
206
|
+
|
|
207
|
+
// Assign to the arrow function a name to help debugging
|
|
208
|
+
const filterItem = (row, shouldApplyItem) => filterItemCore(apiRef.current.getRowId, appliers, row, shouldApplyItem);
|
|
215
209
|
return filterItem;
|
|
216
210
|
};
|
|
217
211
|
|
package/node/index.js
CHANGED