@mui/x-data-grid 6.19.3 → 6.19.5
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 +117 -0
- package/DataGrid/DataGrid.js +1 -1
- 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/components/panel/filterPanel/GridFilterInputBoolean.js +6 -4
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +7 -5
- package/components/panel/filterPanel/GridFilterInputValue.js +4 -3
- package/hooks/features/export/useGridPrintExport.js +3 -1
- package/hooks/features/filter/gridFilterUtils.js +15 -22
- package/index.js +1 -1
- package/legacy/DataGrid/DataGrid.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/components/panel/filterPanel/GridFilterInputBoolean.js +6 -3
- package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -5
- package/legacy/components/panel/filterPanel/GridFilterInputValue.js +4 -2
- 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 +2 -2
- package/modern/DataGrid/DataGrid.js +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/components/panel/filterPanel/GridFilterInputBoolean.js +6 -4
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +7 -5
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +4 -3
- 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/DataGrid/DataGrid.js +1 -1
- 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/components/panel/filterPanel/GridFilterInputBoolean.js +6 -4
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +7 -5
- package/node/components/panel/filterPanel/GridFilterInputValue.js +4 -3
- 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "tabIndex", "disabled", "isFilterActive", "clearButton", "InputProps"];
|
|
3
|
+
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "tabIndex", "disabled", "isFilterActive", "clearButton", "InputProps", "variant"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { unstable_useId as useId } from '@mui/utils';
|
|
@@ -17,7 +17,8 @@ function GridFilterInputValue(props) {
|
|
|
17
17
|
tabIndex,
|
|
18
18
|
disabled,
|
|
19
19
|
clearButton,
|
|
20
|
-
InputProps
|
|
20
|
+
InputProps,
|
|
21
|
+
variant = 'standard'
|
|
21
22
|
} = props,
|
|
22
23
|
others = _objectWithoutPropertiesLoose(props, _excluded);
|
|
23
24
|
const filterTimeout = useTimeout();
|
|
@@ -52,7 +53,7 @@ function GridFilterInputValue(props) {
|
|
|
52
53
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
53
54
|
value: filterValueState,
|
|
54
55
|
onChange: onFilterChange,
|
|
55
|
-
variant:
|
|
56
|
+
variant: variant,
|
|
56
57
|
type: type || 'text',
|
|
57
58
|
InputProps: _extends({}, applying || clearButton ? {
|
|
58
59
|
endAdornment: applying ? /*#__PURE__*/_jsx(rootProps.slots.loadIcon, {
|
|
@@ -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',
|
|
@@ -322,7 +322,7 @@ DataGridRaw.propTypes = {
|
|
|
322
322
|
loading: _propTypes.default.bool,
|
|
323
323
|
/**
|
|
324
324
|
* Set the locale text of the Data Grid.
|
|
325
|
-
* You can find all the translation keys supported in [the source](https://github.com/mui/mui-x/blob/
|
|
325
|
+
* You can find all the translation keys supported in [the source](https://github.com/mui/mui-x/blob/v6.19.4/packages/grid/x-data-grid/src/constants/localeTextConstants.ts) in the GitHub repository.
|
|
326
326
|
*/
|
|
327
327
|
localeText: _propTypes.default.object,
|
|
328
328
|
/**
|
|
@@ -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}`]: {
|
|
@@ -13,7 +13,7 @@ var _utils = require("@mui/utils");
|
|
|
13
13
|
var _styles = require("@mui/material/styles");
|
|
14
14
|
var _useGridRootProps = require("../../../hooks/utils/useGridRootProps");
|
|
15
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
-
const _excluded = ["item", "applyValue", "apiRef", "focusElementRef", "isFilterActive", "clearButton", "tabIndex", "label", "InputLabelProps"];
|
|
16
|
+
const _excluded = ["item", "applyValue", "apiRef", "focusElementRef", "isFilterActive", "clearButton", "tabIndex", "label", "variant", "InputLabelProps"];
|
|
17
17
|
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
18
|
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
19
|
const BooleanOperatorContainer = (0, _styles.styled)('div')({
|
|
@@ -32,7 +32,8 @@ function GridFilterInputBoolean(props) {
|
|
|
32
32
|
focusElementRef,
|
|
33
33
|
clearButton,
|
|
34
34
|
tabIndex,
|
|
35
|
-
label: labelProp
|
|
35
|
+
label: labelProp,
|
|
36
|
+
variant = 'standard'
|
|
36
37
|
} = props,
|
|
37
38
|
others = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
38
39
|
const [filterValueState, setFilterValueState] = React.useState(item.value || '');
|
|
@@ -59,7 +60,7 @@ function GridFilterInputBoolean(props) {
|
|
|
59
60
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseInputLabel, (0, _extends2.default)({}, rootProps.slotProps?.baseInputLabel, {
|
|
60
61
|
id: labelId,
|
|
61
62
|
shrink: true,
|
|
62
|
-
variant:
|
|
63
|
+
variant: variant,
|
|
63
64
|
children: label
|
|
64
65
|
})), /*#__PURE__*/(0, _jsxRuntime.jsxs)(rootProps.slots.baseSelect, (0, _extends2.default)({
|
|
65
66
|
labelId: labelId,
|
|
@@ -67,7 +68,8 @@ function GridFilterInputBoolean(props) {
|
|
|
67
68
|
label: label,
|
|
68
69
|
value: filterValueState,
|
|
69
70
|
onChange: onFilterChange,
|
|
70
|
-
variant:
|
|
71
|
+
variant: variant,
|
|
72
|
+
notched: variant === 'outlined' ? true : undefined,
|
|
71
73
|
native: isSelectNative,
|
|
72
74
|
displayEmpty: true,
|
|
73
75
|
inputProps: {
|
|
@@ -15,7 +15,7 @@ var _styles = require("@mui/material/styles");
|
|
|
15
15
|
var _useGridRootProps = require("../../../hooks/utils/useGridRootProps");
|
|
16
16
|
var _filterPanelUtils = require("./filterPanelUtils");
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
-
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "getOptionLabel", "getOptionValue", "placeholder", "tabIndex", "label", "isFilterActive", "clearButton", "InputLabelProps"];
|
|
18
|
+
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "getOptionLabel", "getOptionValue", "placeholder", "tabIndex", "label", "variant", "isFilterActive", "clearButton", "InputLabelProps"];
|
|
19
19
|
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); }
|
|
20
20
|
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; }
|
|
21
21
|
const renderSingleSelectOptions = ({
|
|
@@ -62,6 +62,7 @@ function GridFilterInputSingleSelect(props) {
|
|
|
62
62
|
placeholder,
|
|
63
63
|
tabIndex,
|
|
64
64
|
label: labelProp,
|
|
65
|
+
variant = 'standard',
|
|
65
66
|
clearButton
|
|
66
67
|
} = props,
|
|
67
68
|
others = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
@@ -127,7 +128,7 @@ function GridFilterInputSingleSelect(props) {
|
|
|
127
128
|
id: labelId,
|
|
128
129
|
htmlFor: id,
|
|
129
130
|
shrink: true,
|
|
130
|
-
variant:
|
|
131
|
+
variant: variant,
|
|
131
132
|
children: label
|
|
132
133
|
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseSelect, (0, _extends2.default)({
|
|
133
134
|
id: id,
|
|
@@ -135,15 +136,16 @@ function GridFilterInputSingleSelect(props) {
|
|
|
135
136
|
labelId: labelId,
|
|
136
137
|
value: filterValueState,
|
|
137
138
|
onChange: onFilterChange,
|
|
138
|
-
variant:
|
|
139
|
+
variant: variant,
|
|
139
140
|
type: type || 'text',
|
|
140
141
|
inputProps: {
|
|
141
142
|
tabIndex,
|
|
142
143
|
ref: focusElementRef,
|
|
143
144
|
placeholder: placeholder ?? apiRef.current.getLocaleText('filterPanelInputPlaceholder')
|
|
144
145
|
},
|
|
145
|
-
native: isSelectNative
|
|
146
|
-
|
|
146
|
+
native: isSelectNative,
|
|
147
|
+
notched: variant === 'outlined' ? true : undefined
|
|
148
|
+
}, others /* FIXME: typing error */, rootProps.slotProps?.baseSelect, {
|
|
147
149
|
children: renderSingleSelectOptions({
|
|
148
150
|
column: resolvedColumn,
|
|
149
151
|
OptionComponent: rootProps.slots.baseSelectOption,
|
|
@@ -13,7 +13,7 @@ var _utils = require("@mui/utils");
|
|
|
13
13
|
var _useTimeout = require("../../../hooks/utils/useTimeout");
|
|
14
14
|
var _useGridRootProps = require("../../../hooks/utils/useGridRootProps");
|
|
15
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
-
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "tabIndex", "disabled", "isFilterActive", "clearButton", "InputProps"];
|
|
16
|
+
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "tabIndex", "disabled", "isFilterActive", "clearButton", "InputProps", "variant"];
|
|
17
17
|
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
18
|
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
19
|
function GridFilterInputValue(props) {
|
|
@@ -26,7 +26,8 @@ function GridFilterInputValue(props) {
|
|
|
26
26
|
tabIndex,
|
|
27
27
|
disabled,
|
|
28
28
|
clearButton,
|
|
29
|
-
InputProps
|
|
29
|
+
InputProps,
|
|
30
|
+
variant = 'standard'
|
|
30
31
|
} = props,
|
|
31
32
|
others = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
32
33
|
const filterTimeout = (0, _useTimeout.useTimeout)();
|
|
@@ -61,7 +62,7 @@ function GridFilterInputValue(props) {
|
|
|
61
62
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
62
63
|
value: filterValueState,
|
|
63
64
|
onChange: onFilterChange,
|
|
64
|
-
variant:
|
|
65
|
+
variant: variant,
|
|
65
66
|
type: type || 'text',
|
|
66
67
|
InputProps: (0, _extends2.default)({}, applying || clearButton ? {
|
|
67
68
|
endAdornment: applying ? /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.loadIcon, {
|
|
@@ -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
package/node/locales/daDK.js
CHANGED
|
@@ -17,8 +17,8 @@ const daDKGrid = {
|
|
|
17
17
|
toolbarDensityStandard: 'Standard',
|
|
18
18
|
toolbarDensityComfortable: 'Luftig',
|
|
19
19
|
// Columns selector toolbar button text
|
|
20
|
-
toolbarColumns: '
|
|
21
|
-
toolbarColumnsLabel: 'Vælg
|
|
20
|
+
toolbarColumns: 'Kolonner',
|
|
21
|
+
toolbarColumnsLabel: 'Vælg kolonner',
|
|
22
22
|
// Filters toolbar button text
|
|
23
23
|
toolbarFilters: 'Filtre',
|
|
24
24
|
toolbarFiltersLabel: 'Vis filtre',
|
|
@@ -46,12 +46,12 @@ const daDKGrid = {
|
|
|
46
46
|
filterPanelRemoveAll: 'Fjern alle',
|
|
47
47
|
filterPanelDeleteIconLabel: 'Slet',
|
|
48
48
|
filterPanelLogicOperator: 'Logisk operator',
|
|
49
|
-
filterPanelOperator: '
|
|
49
|
+
filterPanelOperator: 'Operator',
|
|
50
50
|
filterPanelOperatorAnd: 'Og',
|
|
51
51
|
filterPanelOperatorOr: 'Eller',
|
|
52
|
-
filterPanelColumns: '
|
|
52
|
+
filterPanelColumns: 'Kolonner',
|
|
53
53
|
filterPanelInputLabel: 'Værdi',
|
|
54
|
-
filterPanelInputPlaceholder: '
|
|
54
|
+
filterPanelInputPlaceholder: 'Filterværdi',
|
|
55
55
|
// Filter operators text
|
|
56
56
|
filterOperatorContains: 'indeholder',
|
|
57
57
|
filterOperatorEquals: 'lig med',
|
|
@@ -98,10 +98,10 @@ const daDKGrid = {
|
|
|
98
98
|
filterValueFalse: 'negativ',
|
|
99
99
|
// Column menu text
|
|
100
100
|
columnMenuLabel: 'Menu',
|
|
101
|
-
columnMenuShowColumns: 'Vis
|
|
101
|
+
columnMenuShowColumns: 'Vis kolonner',
|
|
102
102
|
columnMenuManageColumns: 'Administrer kolonner',
|
|
103
|
-
columnMenuFilter: '
|
|
104
|
-
columnMenuHideColumn: 'Skjul',
|
|
103
|
+
columnMenuFilter: 'Filtrer',
|
|
104
|
+
columnMenuHideColumn: 'Skjul kolonne',
|
|
105
105
|
columnMenuUnsort: 'Fjern sortering',
|
|
106
106
|
columnMenuSortAsc: 'Sorter stigende',
|
|
107
107
|
columnMenuSortDesc: 'Sorter faldende',
|
|
@@ -131,13 +131,13 @@ const daDKGrid = {
|
|
|
131
131
|
pinToRight: 'Fastgør til højre',
|
|
132
132
|
unpin: 'Frigiv',
|
|
133
133
|
// Tree Data
|
|
134
|
-
treeDataGroupingHeaderName: '
|
|
134
|
+
treeDataGroupingHeaderName: 'Gruppe',
|
|
135
135
|
treeDataExpand: 'Vis underelementer',
|
|
136
136
|
treeDataCollapse: 'Skjul underelementer',
|
|
137
137
|
// Grouping columns
|
|
138
|
-
groupingColumnHeaderName: '
|
|
138
|
+
groupingColumnHeaderName: 'Gruppe',
|
|
139
139
|
groupColumn: name => `Gruppér efter ${name}`,
|
|
140
|
-
unGroupColumn: name => `Fjern
|
|
140
|
+
unGroupColumn: name => `Fjern gruppering efter ${name}`,
|
|
141
141
|
// Master/detail
|
|
142
142
|
detailPanelToggle: 'Udvid/kollaps detaljepanel',
|
|
143
143
|
expandDetailPanel: 'Udvid',
|
|
@@ -145,7 +145,7 @@ const daDKGrid = {
|
|
|
145
145
|
// Row reordering text
|
|
146
146
|
rowReorderingHeaderName: 'Omarrangering af rækker',
|
|
147
147
|
// Aggregation
|
|
148
|
-
aggregationMenuItemHeader: '
|
|
148
|
+
aggregationMenuItemHeader: 'Aggregering',
|
|
149
149
|
aggregationFunctionLabelSum: 'sum',
|
|
150
150
|
aggregationFunctionLabelAvg: 'gns',
|
|
151
151
|
aggregationFunctionLabelMin: 'min',
|