@mui/x-data-grid 5.12.3 → 5.13.0
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 +53 -0
- package/DataGrid/DataGrid.js +4 -4
- package/colDef/gridStringOperators.d.ts +1 -1
- package/colDef/gridStringOperators.js +11 -6
- package/components/GridRow.js +1 -1
- package/components/cell/GridActionsCellItem.d.ts +2 -2
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterForm.js +11 -4
- package/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/components/panel/filterPanel/GridFilterInputDate.js +4 -2
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +3 -8
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +30 -14
- package/components/panel/filterPanel/GridFilterInputMultipleValue.d.ts +3 -7
- package/components/panel/filterPanel/GridFilterInputMultipleValue.js +32 -14
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -2
- package/components/panel/filterPanel/GridFilterInputValue.js +4 -2
- package/components/panel/filterPanel/GridFilterInputValueProps.d.ts +6 -3
- package/components/panel/filterPanel/filterPanelUtils.d.ts +1 -1
- package/components/toolbar/GridToolbarColumnsButton.d.ts +1 -1
- package/components/toolbar/GridToolbarDensitySelector.d.ts +1 -1
- package/components/toolbar/GridToolbarExportContainer.d.ts +1 -1
- package/components/toolbar/GridToolbarFilterButton.d.ts +1 -1
- package/hooks/features/dimensions/useGridDimensions.js +28 -15
- package/hooks/features/editRows/useGridCellEditing.new.js +6 -0
- package/hooks/features/editRows/useGridCellEditing.old.js +6 -0
- package/hooks/features/editRows/useGridRowEditing.new.js +6 -0
- package/hooks/features/editRows/useGridRowEditing.old.js +6 -0
- package/hooks/features/rows/useGridRows.js +1 -1
- package/hooks/features/rows/useGridRowsPreProcessors.js +1 -1
- package/hooks/utils/useGridApiContext.js +1 -1
- package/hooks/utils/useGridRootProps.js +1 -1
- package/index.js +1 -1
- package/legacy/DataGrid/DataGrid.js +4 -4
- package/legacy/colDef/gridStringOperators.js +13 -5
- package/legacy/components/GridRow.js +1 -1
- package/legacy/components/panel/filterPanel/GridFilterForm.js +9 -4
- package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/legacy/components/panel/filterPanel/GridFilterInputDate.js +4 -2
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +22 -7
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleValue.js +24 -7
- package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -2
- package/legacy/components/panel/filterPanel/GridFilterInputValue.js +4 -2
- package/legacy/hooks/features/dimensions/useGridDimensions.js +27 -15
- package/legacy/hooks/features/editRows/useGridCellEditing.new.js +6 -0
- package/legacy/hooks/features/editRows/useGridCellEditing.old.js +16 -8
- package/legacy/hooks/features/editRows/useGridRowEditing.new.js +6 -0
- package/legacy/hooks/features/editRows/useGridRowEditing.old.js +22 -14
- package/legacy/hooks/features/rows/useGridRows.js +1 -1
- package/legacy/hooks/features/rows/useGridRowsPreProcessors.js +1 -1
- package/legacy/hooks/utils/useGridApiContext.js +1 -1
- package/legacy/hooks/utils/useGridRootProps.js +1 -1
- package/legacy/index.js +1 -1
- package/legacy/locales/index.js +2 -0
- package/legacy/locales/roRO.js +128 -0
- package/legacy/locales/skSK.js +16 -16
- package/legacy/utils/keyboardUtils.js +4 -3
- package/locales/index.d.ts +2 -0
- package/locales/index.js +2 -0
- package/locales/roRO.d.ts +2 -0
- package/locales/roRO.js +116 -0
- package/locales/skSK.js +16 -16
- package/modern/DataGrid/DataGrid.js +4 -4
- package/modern/colDef/gridStringOperators.js +11 -6
- package/modern/components/GridRow.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterForm.js +11 -4
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputDate.js +4 -2
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +20 -8
- package/modern/components/panel/filterPanel/GridFilterInputMultipleValue.js +22 -8
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -2
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +4 -2
- package/modern/hooks/features/dimensions/useGridDimensions.js +28 -15
- package/modern/hooks/features/editRows/useGridCellEditing.new.js +6 -0
- package/modern/hooks/features/editRows/useGridCellEditing.old.js +6 -0
- package/modern/hooks/features/editRows/useGridRowEditing.new.js +6 -0
- package/modern/hooks/features/editRows/useGridRowEditing.old.js +6 -0
- package/modern/hooks/features/rows/useGridRows.js +1 -1
- package/modern/hooks/features/rows/useGridRowsPreProcessors.js +1 -1
- package/modern/hooks/utils/useGridApiContext.js +1 -1
- package/modern/hooks/utils/useGridRootProps.js +1 -1
- package/modern/index.js +1 -1
- package/modern/locales/index.js +2 -0
- package/modern/locales/roRO.js +116 -0
- package/modern/locales/skSK.js +16 -16
- package/modern/utils/keyboardUtils.js +4 -3
- package/node/DataGrid/DataGrid.js +4 -4
- package/node/colDef/gridStringOperators.js +11 -6
- package/node/components/GridRow.js +1 -1
- package/node/components/panel/filterPanel/GridFilterForm.js +9 -4
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputDate.js +4 -2
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +31 -15
- package/node/components/panel/filterPanel/GridFilterInputMultipleValue.js +33 -15
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -2
- package/node/components/panel/filterPanel/GridFilterInputValue.js +4 -2
- package/node/hooks/features/dimensions/useGridDimensions.js +28 -15
- package/node/hooks/features/editRows/useGridCellEditing.new.js +6 -0
- package/node/hooks/features/editRows/useGridCellEditing.old.js +6 -0
- package/node/hooks/features/editRows/useGridRowEditing.new.js +6 -0
- package/node/hooks/features/editRows/useGridRowEditing.old.js +6 -0
- package/node/hooks/features/rows/useGridRows.js +1 -1
- package/node/hooks/features/rows/useGridRowsPreProcessors.js +1 -1
- package/node/hooks/utils/useGridApiContext.js +1 -1
- package/node/hooks/utils/useGridRootProps.js +1 -1
- package/node/index.js +1 -1
- package/node/locales/index.js +26 -0
- package/node/locales/roRO.js +126 -0
- package/node/locales/skSK.js +16 -16
- package/node/utils/keyboardUtils.js +4 -3
- package/package.json +2 -2
- package/utils/keyboardUtils.js +4 -3
|
@@ -2,14 +2,14 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef"];
|
|
5
|
+
var _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "color", "error", "helperText", "size", "variant"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete';
|
|
9
9
|
import Chip from '@mui/material/Chip';
|
|
10
|
-
import TextField from '@mui/material/TextField';
|
|
11
10
|
import { unstable_useId as useId } from '@mui/material/utils';
|
|
12
11
|
import { getValueFromOption } from './filterPanelUtils';
|
|
12
|
+
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
|
|
15
15
|
var isOptionEqualToValue = function isOptionEqualToValue(option, value) {
|
|
@@ -24,9 +24,23 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
24
24
|
type = props.type,
|
|
25
25
|
apiRef = props.apiRef,
|
|
26
26
|
focusElementRef = props.focusElementRef,
|
|
27
|
+
color = props.color,
|
|
28
|
+
error = props.error,
|
|
29
|
+
helperText = props.helperText,
|
|
30
|
+
size = props.size,
|
|
31
|
+
_props$variant = props.variant,
|
|
32
|
+
variant = _props$variant === void 0 ? 'standard' : _props$variant,
|
|
27
33
|
other = _objectWithoutProperties(props, _excluded);
|
|
28
34
|
|
|
35
|
+
var TextFieldProps = {
|
|
36
|
+
color: color,
|
|
37
|
+
error: error,
|
|
38
|
+
helperText: helperText,
|
|
39
|
+
size: size,
|
|
40
|
+
variant: variant
|
|
41
|
+
};
|
|
29
42
|
var id = useId();
|
|
43
|
+
var rootProps = useGridRootProps();
|
|
30
44
|
var resolvedColumn = item.columnField ? apiRef.current.getColumn(item.columnField) : null;
|
|
31
45
|
var resolvedValueOptions = React.useMemo(function () {
|
|
32
46
|
if (!(resolvedColumn != null && resolvedColumn.valueOptions)) {
|
|
@@ -70,7 +84,7 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
70
84
|
|
|
71
85
|
if (resolvedValueOptions !== undefined) {
|
|
72
86
|
var itemValueIndexes = item.value.map(function (element) {
|
|
73
|
-
// get the index matching between values and
|
|
87
|
+
// get the index matching between values and valueOptions
|
|
74
88
|
var formattedElement = getValueFromOption(element);
|
|
75
89
|
var index = (resolvedFormattedValueOptions == null ? void 0 : resolvedFormattedValueOptions.findIndex(function (formatedOption) {
|
|
76
90
|
return formatedOption === formattedElement;
|
|
@@ -120,16 +134,17 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
120
134
|
});
|
|
121
135
|
},
|
|
122
136
|
renderInput: function renderInput(params) {
|
|
123
|
-
|
|
137
|
+
var _rootProps$components;
|
|
138
|
+
|
|
139
|
+
return /*#__PURE__*/_jsx(rootProps.components.BaseTextField, _extends({}, params, {
|
|
124
140
|
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
125
141
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
126
142
|
InputLabelProps: _extends({}, params.InputLabelProps, {
|
|
127
143
|
shrink: true
|
|
128
144
|
}),
|
|
129
145
|
inputRef: focusElementRef,
|
|
130
|
-
type:
|
|
131
|
-
|
|
132
|
-
}));
|
|
146
|
+
type: "singleSelect"
|
|
147
|
+
}, TextFieldProps, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseTextField));
|
|
133
148
|
}
|
|
134
149
|
}, other));
|
|
135
150
|
}
|
|
@@ -2,13 +2,13 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef"];
|
|
5
|
+
var _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "color", "error", "helperText", "size", "variant"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import Autocomplete from '@mui/material/Autocomplete';
|
|
9
9
|
import Chip from '@mui/material/Chip';
|
|
10
|
-
import TextField from '@mui/material/TextField';
|
|
11
10
|
import { unstable_useId as useId } from '@mui/material/utils';
|
|
11
|
+
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
|
|
14
14
|
function GridFilterInputMultipleValue(props) {
|
|
@@ -17,14 +17,28 @@ function GridFilterInputMultipleValue(props) {
|
|
|
17
17
|
type = props.type,
|
|
18
18
|
apiRef = props.apiRef,
|
|
19
19
|
focusElementRef = props.focusElementRef,
|
|
20
|
+
color = props.color,
|
|
21
|
+
error = props.error,
|
|
22
|
+
helperText = props.helperText,
|
|
23
|
+
size = props.size,
|
|
24
|
+
variant = props.variant,
|
|
20
25
|
other = _objectWithoutProperties(props, _excluded);
|
|
21
26
|
|
|
27
|
+
var TextFieldProps = {
|
|
28
|
+
color: color,
|
|
29
|
+
error: error,
|
|
30
|
+
helperText: helperText,
|
|
31
|
+
size: size,
|
|
32
|
+
variant: variant
|
|
33
|
+
};
|
|
34
|
+
|
|
22
35
|
var _React$useState = React.useState(item.value || []),
|
|
23
36
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
24
37
|
filterValueState = _React$useState2[0],
|
|
25
38
|
setFilterValueState = _React$useState2[1];
|
|
26
39
|
|
|
27
40
|
var id = useId();
|
|
41
|
+
var rootProps = useGridRootProps();
|
|
28
42
|
React.useEffect(function () {
|
|
29
43
|
var _item$value;
|
|
30
44
|
|
|
@@ -61,16 +75,17 @@ function GridFilterInputMultipleValue(props) {
|
|
|
61
75
|
});
|
|
62
76
|
},
|
|
63
77
|
renderInput: function renderInput(params) {
|
|
64
|
-
|
|
78
|
+
var _rootProps$components;
|
|
79
|
+
|
|
80
|
+
return /*#__PURE__*/_jsx(rootProps.components.BaseTextField, _extends({}, params, {
|
|
65
81
|
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
66
82
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
67
83
|
InputLabelProps: _extends({}, params.InputLabelProps, {
|
|
68
84
|
shrink: true
|
|
69
85
|
}),
|
|
70
86
|
inputRef: focusElementRef,
|
|
71
|
-
type: type || 'text'
|
|
72
|
-
|
|
73
|
-
}));
|
|
87
|
+
type: type || 'text'
|
|
88
|
+
}, TextFieldProps, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseTextField));
|
|
74
89
|
}
|
|
75
90
|
}, other));
|
|
76
91
|
}
|
|
@@ -80,7 +95,9 @@ process.env.NODE_ENV !== "production" ? GridFilterInputMultipleValue.propTypes =
|
|
|
80
95
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
81
96
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
82
97
|
// ----------------------------------------------------------------------
|
|
83
|
-
apiRef: PropTypes.
|
|
98
|
+
apiRef: PropTypes.shape({
|
|
99
|
+
current: PropTypes.object.isRequired
|
|
100
|
+
}).isRequired,
|
|
84
101
|
applyValue: PropTypes.func.isRequired,
|
|
85
102
|
focusElementRef: PropTypes
|
|
86
103
|
/* @typescript-to-proptypes-ignore */
|
|
@@ -57,6 +57,10 @@ function GridFilterInputSingleSelect(props) {
|
|
|
57
57
|
var isSelectNative = (_baseSelectProps$nati = baseSelectProps.native) != null ? _baseSelectProps$nati : true;
|
|
58
58
|
var currentColumn = item.columnField ? apiRef.current.getColumn(item.columnField) : null;
|
|
59
59
|
var currentValueOptions = React.useMemo(function () {
|
|
60
|
+
if (currentColumn === null) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
|
|
60
64
|
return typeof currentColumn.valueOptions === 'function' ? currentColumn.valueOptions({
|
|
61
65
|
field: currentColumn.field
|
|
62
66
|
}) : currentColumn.valueOptions;
|
|
@@ -98,8 +102,8 @@ function GridFilterInputSingleSelect(props) {
|
|
|
98
102
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
99
103
|
value: filterValueState,
|
|
100
104
|
onChange: onFilterChange,
|
|
101
|
-
type: type || 'text',
|
|
102
105
|
variant: "standard",
|
|
106
|
+
type: type || 'text',
|
|
103
107
|
InputLabelProps: {
|
|
104
108
|
shrink: true
|
|
105
109
|
},
|
|
@@ -118,7 +122,9 @@ process.env.NODE_ENV !== "production" ? GridFilterInputSingleSelect.propTypes =
|
|
|
118
122
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
119
123
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
120
124
|
// ----------------------------------------------------------------------
|
|
121
|
-
apiRef: PropTypes.
|
|
125
|
+
apiRef: PropTypes.shape({
|
|
126
|
+
current: PropTypes.object.isRequired
|
|
127
|
+
}).isRequired,
|
|
122
128
|
applyValue: PropTypes.func.isRequired,
|
|
123
129
|
focusElementRef: PropTypes
|
|
124
130
|
/* @typescript-to-proptypes-ignore */
|
|
@@ -124,8 +124,8 @@ function GridFilterInputValue(props) {
|
|
|
124
124
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
125
125
|
value: filterValueState,
|
|
126
126
|
onChange: onFilterChange,
|
|
127
|
-
type: type || 'text',
|
|
128
127
|
variant: "standard",
|
|
128
|
+
type: type || 'text',
|
|
129
129
|
InputProps: InputProps,
|
|
130
130
|
InputLabelProps: {
|
|
131
131
|
shrink: true
|
|
@@ -139,7 +139,9 @@ process.env.NODE_ENV !== "production" ? GridFilterInputValue.propTypes = {
|
|
|
139
139
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
140
140
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
141
141
|
// ----------------------------------------------------------------------
|
|
142
|
-
apiRef: PropTypes.
|
|
142
|
+
apiRef: PropTypes.shape({
|
|
143
|
+
current: PropTypes.object.isRequired
|
|
144
|
+
}).isRequired,
|
|
143
145
|
applyValue: PropTypes.func.isRequired,
|
|
144
146
|
focusElementRef: PropTypes
|
|
145
147
|
/* @typescript-to-proptypes-ignore */
|
|
@@ -70,21 +70,33 @@ export function useGridDimensions(apiRef, props) {
|
|
|
70
70
|
rootElement.removeChild(scrollDiv);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
var viewportOuterSize
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
73
|
+
var viewportOuterSize;
|
|
74
|
+
var hasScrollX;
|
|
75
|
+
var hasScrollY;
|
|
76
|
+
|
|
77
|
+
if (props.autoHeight) {
|
|
78
|
+
hasScrollY = false;
|
|
79
|
+
hasScrollX = Math.round(columnsTotalWidth) > rootDimensionsRef.current.width;
|
|
80
|
+
viewportOuterSize = {
|
|
81
|
+
width: rootDimensionsRef.current.width,
|
|
82
|
+
height: rowsMeta.currentPageTotalHeight + (hasScrollX ? scrollBarSize : 0)
|
|
83
|
+
};
|
|
84
|
+
} else {
|
|
85
|
+
viewportOuterSize = {
|
|
86
|
+
width: rootDimensionsRef.current.width,
|
|
87
|
+
height: rootDimensionsRef.current.height - headerHeight
|
|
88
|
+
};
|
|
89
|
+
var scrollInformation = hasScroll({
|
|
90
|
+
content: {
|
|
91
|
+
width: Math.round(columnsTotalWidth),
|
|
92
|
+
height: rowsMeta.currentPageTotalHeight
|
|
93
|
+
},
|
|
94
|
+
container: viewportOuterSize,
|
|
95
|
+
scrollBarSize: scrollBarSize
|
|
96
|
+
});
|
|
97
|
+
hasScrollY = scrollInformation.hasScrollY;
|
|
98
|
+
hasScrollX = scrollInformation.hasScrollX;
|
|
99
|
+
}
|
|
88
100
|
|
|
89
101
|
var viewportInnerSize = {
|
|
90
102
|
width: viewportOuterSize.width - (hasScrollY ? scrollBarSize : 0),
|
|
@@ -78,6 +78,12 @@ export var useGridCellEditing = function useGridCellEditing(apiRef, props) {
|
|
|
78
78
|
}, [apiRef]);
|
|
79
79
|
var handleCellKeyDown = React.useCallback(function (params, event) {
|
|
80
80
|
if (params.cellMode === GridCellModes.Edit) {
|
|
81
|
+
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
82
|
+
// TODO: `event.which` is depricated but this is a temporary workaround
|
|
83
|
+
if (event.which === 229) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
81
87
|
var reason;
|
|
82
88
|
|
|
83
89
|
if (event.key === 'Escape') {
|
|
@@ -189,16 +189,24 @@ export var useCellEditing = function useCellEditing(apiRef, props) {
|
|
|
189
189
|
while (1) {
|
|
190
190
|
switch (_context.prev = _context.next) {
|
|
191
191
|
case 0:
|
|
192
|
+
if (!(event.which === 229)) {
|
|
193
|
+
_context.next = 2;
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return _context.abrupt("return");
|
|
198
|
+
|
|
199
|
+
case 2:
|
|
192
200
|
id = params.id, field = params.field, cellMode = params.cellMode, isEditable = params.isEditable;
|
|
193
201
|
|
|
194
202
|
if (isEditable) {
|
|
195
|
-
_context.next =
|
|
203
|
+
_context.next = 5;
|
|
196
204
|
break;
|
|
197
205
|
}
|
|
198
206
|
|
|
199
207
|
return _context.abrupt("return");
|
|
200
208
|
|
|
201
|
-
case
|
|
209
|
+
case 5:
|
|
202
210
|
isEditMode = cellMode === GridCellModes.Edit;
|
|
203
211
|
isModifierKeyPressed = event.ctrlKey || event.metaKey || event.altKey;
|
|
204
212
|
|
|
@@ -220,7 +228,7 @@ export var useCellEditing = function useCellEditing(apiRef, props) {
|
|
|
220
228
|
}
|
|
221
229
|
|
|
222
230
|
if (!(isEditMode && isCellEditCommitKeys(event.key))) {
|
|
223
|
-
_context.next =
|
|
231
|
+
_context.next = 16;
|
|
224
232
|
break;
|
|
225
233
|
}
|
|
226
234
|
|
|
@@ -228,25 +236,25 @@ export var useCellEditing = function useCellEditing(apiRef, props) {
|
|
|
228
236
|
id: id,
|
|
229
237
|
field: field
|
|
230
238
|
};
|
|
231
|
-
_context.next =
|
|
239
|
+
_context.next = 13;
|
|
232
240
|
return apiRef.current.commitCellChange(commitParams, event);
|
|
233
241
|
|
|
234
|
-
case
|
|
242
|
+
case 13:
|
|
235
243
|
isValid = _context.sent;
|
|
236
244
|
|
|
237
245
|
if (isValid) {
|
|
238
|
-
_context.next =
|
|
246
|
+
_context.next = 16;
|
|
239
247
|
break;
|
|
240
248
|
}
|
|
241
249
|
|
|
242
250
|
return _context.abrupt("return");
|
|
243
251
|
|
|
244
|
-
case
|
|
252
|
+
case 16:
|
|
245
253
|
if (isEditMode && isCellExitEditModeKeys(event.key)) {
|
|
246
254
|
apiRef.current.publishEvent('cellEditStop', params, event);
|
|
247
255
|
}
|
|
248
256
|
|
|
249
|
-
case
|
|
257
|
+
case 17:
|
|
250
258
|
case "end":
|
|
251
259
|
return _context.stop();
|
|
252
260
|
}
|
|
@@ -116,6 +116,12 @@ export var useGridRowEditing = function useGridRowEditing(apiRef, props) {
|
|
|
116
116
|
}, []);
|
|
117
117
|
var handleCellKeyDown = React.useCallback(function (params, event) {
|
|
118
118
|
if (params.cellMode === GridRowModes.Edit) {
|
|
119
|
+
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
120
|
+
// TODO: `event.which` is depricated but this is a temporary workaround
|
|
121
|
+
if (event.which === 229) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
119
125
|
var reason;
|
|
120
126
|
|
|
121
127
|
if (event.key === 'Escape') {
|
|
@@ -241,62 +241,70 @@ export var useGridRowEditing = function useGridRowEditing(apiRef, props) {
|
|
|
241
241
|
while (1) {
|
|
242
242
|
switch (_context3.prev = _context3.next) {
|
|
243
243
|
case 0:
|
|
244
|
+
if (!(event.which === 229)) {
|
|
245
|
+
_context3.next = 2;
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return _context3.abrupt("return");
|
|
250
|
+
|
|
251
|
+
case 2:
|
|
244
252
|
cellMode = params.cellMode, isEditable = params.isEditable;
|
|
245
253
|
|
|
246
254
|
if (isEditable) {
|
|
247
|
-
_context3.next =
|
|
255
|
+
_context3.next = 5;
|
|
248
256
|
break;
|
|
249
257
|
}
|
|
250
258
|
|
|
251
259
|
return _context3.abrupt("return");
|
|
252
260
|
|
|
253
|
-
case
|
|
261
|
+
case 5:
|
|
254
262
|
isEditMode = cellMode === GridCellModes.Edit;
|
|
255
263
|
rowParams = apiRef.current.getRowParams(params.id);
|
|
256
264
|
|
|
257
265
|
if (!isEditMode) {
|
|
258
|
-
_context3.next =
|
|
266
|
+
_context3.next = 20;
|
|
259
267
|
break;
|
|
260
268
|
}
|
|
261
269
|
|
|
262
270
|
if (!(event.key === 'Enter')) {
|
|
263
|
-
_context3.next =
|
|
271
|
+
_context3.next = 17;
|
|
264
272
|
break;
|
|
265
273
|
}
|
|
266
274
|
|
|
267
|
-
_context3.next =
|
|
275
|
+
_context3.next = 11;
|
|
268
276
|
return apiRef.current.commitRowChange(params.id);
|
|
269
277
|
|
|
270
|
-
case
|
|
278
|
+
case 11:
|
|
271
279
|
isValid = _context3.sent;
|
|
272
280
|
|
|
273
281
|
if (!(!isValid && (_props$experimentalFe3 = props.experimentalFeatures) != null && _props$experimentalFe3.preventCommitWhileValidating)) {
|
|
274
|
-
_context3.next =
|
|
282
|
+
_context3.next = 14;
|
|
275
283
|
break;
|
|
276
284
|
}
|
|
277
285
|
|
|
278
286
|
return _context3.abrupt("return");
|
|
279
287
|
|
|
280
|
-
case
|
|
288
|
+
case 14:
|
|
281
289
|
apiRef.current.publishEvent('rowEditStop', rowParams, event);
|
|
282
|
-
_context3.next =
|
|
290
|
+
_context3.next = 18;
|
|
283
291
|
break;
|
|
284
292
|
|
|
285
|
-
case
|
|
293
|
+
case 17:
|
|
286
294
|
if (event.key === 'Escape') {
|
|
287
295
|
apiRef.current.publishEvent('rowEditStop', rowParams, event);
|
|
288
296
|
}
|
|
289
297
|
|
|
290
|
-
case
|
|
291
|
-
_context3.next =
|
|
298
|
+
case 18:
|
|
299
|
+
_context3.next = 21;
|
|
292
300
|
break;
|
|
293
301
|
|
|
294
|
-
case
|
|
302
|
+
case 20:
|
|
295
303
|
if (event.key === 'Enter') {
|
|
296
304
|
apiRef.current.publishEvent('rowEditStart', rowParams, event);
|
|
297
305
|
}
|
|
298
306
|
|
|
299
|
-
case
|
|
307
|
+
case 21:
|
|
300
308
|
case "end":
|
|
301
309
|
return _context3.stop();
|
|
302
310
|
}
|
|
@@ -102,7 +102,7 @@ export var useGridRows = function useGridRows(apiRef, props) {
|
|
|
102
102
|
var updateRows = React.useCallback(function (updates) {
|
|
103
103
|
if (props.signature === GridSignature.DataGrid && updates.length > 1) {
|
|
104
104
|
// TODO: Add test with direct call to `apiRef.current.updateRows` in DataGrid after enabling the `apiRef` on the free plan.
|
|
105
|
-
throw new Error(["MUI: You can't update several rows at once in `apiRef.current.updateRows` on the DataGrid.", 'You need to upgrade to
|
|
105
|
+
throw new Error(["MUI: You can't update several rows at once in `apiRef.current.updateRows` on the DataGrid.", 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
|
|
106
106
|
} // we remove duplicate updates. A server can batch updates, and send several updates for the same row in one fn call.
|
|
107
107
|
|
|
108
108
|
|
|
@@ -10,7 +10,7 @@ var flatRowTreeCreationMethod = function flatRowTreeCreationMethod(_ref) {
|
|
|
10
10
|
for (var i = 0; i < ids.length; i += 1) {
|
|
11
11
|
var rowId = ids[i];
|
|
12
12
|
|
|
13
|
-
if (previousTree && previousTree[rowId]) {
|
|
13
|
+
if (previousTree && previousTree[rowId] && previousTree[rowId].depth === 0 && previousTree[rowId].parent == null) {
|
|
14
14
|
tree[rowId] = previousTree[rowId];
|
|
15
15
|
} else {
|
|
16
16
|
tree[rowId] = {
|
|
@@ -4,7 +4,7 @@ export function useGridApiContext() {
|
|
|
4
4
|
var apiRef = React.useContext(GridApiContext);
|
|
5
5
|
|
|
6
6
|
if (apiRef === undefined) {
|
|
7
|
-
throw new Error(['MUI: Could not find the data grid context.', 'It looks like you rendered your component outside of a DataGrid or
|
|
7
|
+
throw new Error(['MUI: Could not find the data grid context.', 'It looks like you rendered your component outside of a DataGrid, DataGridPro or DataGridPremium parent component.', 'This can also happen if you are bundling multiple versions of the data grid.'].join('\n'));
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
return apiRef;
|
|
@@ -4,7 +4,7 @@ export var useGridRootProps = function useGridRootProps() {
|
|
|
4
4
|
var contextValue = React.useContext(GridRootPropsContext);
|
|
5
5
|
|
|
6
6
|
if (!contextValue) {
|
|
7
|
-
throw new Error('MUI: useGridRootProps should only be used inside the DataGrid
|
|
7
|
+
throw new Error('MUI: useGridRootProps should only be used inside the DataGrid, DataGridPro or DataGridPremium component.');
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
return contextValue;
|
package/legacy/index.js
CHANGED
package/legacy/locales/index.js
CHANGED
|
@@ -15,9 +15,11 @@ export * from './huHU';
|
|
|
15
15
|
export * from './itIT';
|
|
16
16
|
export * from './jaJP';
|
|
17
17
|
export * from './koKR';
|
|
18
|
+
export * from './nbNO';
|
|
18
19
|
export * from './nlNL';
|
|
19
20
|
export * from './plPL';
|
|
20
21
|
export * from './ptBR';
|
|
22
|
+
export * from './roRO';
|
|
21
23
|
export * from './ruRU';
|
|
22
24
|
export * from './skSK';
|
|
23
25
|
export * from './svSE';
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { roRO as roROCore } from '@mui/material/locale';
|
|
2
|
+
import { getGridLocalization } from '../utils/getGridLocalization';
|
|
3
|
+
var roROGrid = {
|
|
4
|
+
// Root
|
|
5
|
+
noRowsLabel: 'Lipsă date',
|
|
6
|
+
noResultsOverlayLabel: 'Nu au fost găsite rezultate.',
|
|
7
|
+
errorOverlayDefaultLabel: 'A apărut o eroare neașteptată.',
|
|
8
|
+
// Density selector toolbar button text
|
|
9
|
+
toolbarDensity: 'Înălțime rând',
|
|
10
|
+
toolbarDensityLabel: 'Înălțime rând',
|
|
11
|
+
toolbarDensityCompact: 'Compact',
|
|
12
|
+
toolbarDensityStandard: 'Standard',
|
|
13
|
+
toolbarDensityComfortable: 'Lat',
|
|
14
|
+
// Columns selector toolbar button text
|
|
15
|
+
toolbarColumns: 'Coloane',
|
|
16
|
+
toolbarColumnsLabel: 'Afișează selecție coloane',
|
|
17
|
+
// Filters toolbar button text
|
|
18
|
+
toolbarFilters: 'Filtru',
|
|
19
|
+
toolbarFiltersLabel: 'Afișează filtru',
|
|
20
|
+
toolbarFiltersTooltipHide: 'Ascunde filtru',
|
|
21
|
+
toolbarFiltersTooltipShow: 'Afișează filtru',
|
|
22
|
+
toolbarFiltersTooltipActive: function toolbarFiltersTooltipActive(count) {
|
|
23
|
+
return count !== 1 ? "".concat(count, " filtru activ") : "".concat(count, " filtru activ");
|
|
24
|
+
},
|
|
25
|
+
// Quick filter toolbar field
|
|
26
|
+
// toolbarQuickFilterPlaceholder: 'Search...',
|
|
27
|
+
// toolbarQuickFilterLabel: 'Search',
|
|
28
|
+
// toolbarQuickFilterDeleteIconLabel: 'Clear',
|
|
29
|
+
// Export selector toolbar button text
|
|
30
|
+
toolbarExport: 'Export',
|
|
31
|
+
toolbarExportLabel: 'Export',
|
|
32
|
+
toolbarExportCSV: 'Download în format CSV',
|
|
33
|
+
toolbarExportPrint: 'Printare',
|
|
34
|
+
toolbarExportExcel: 'Download în format Excel',
|
|
35
|
+
// Columns panel text
|
|
36
|
+
columnsPanelTextFieldLabel: 'Găsește coloana',
|
|
37
|
+
columnsPanelTextFieldPlaceholder: 'Titlu coloană',
|
|
38
|
+
columnsPanelDragIconLabel: 'Resortare coloană',
|
|
39
|
+
columnsPanelShowAllButton: 'Afișează tot',
|
|
40
|
+
columnsPanelHideAllButton: 'Ascunde tot',
|
|
41
|
+
// Filter panel text
|
|
42
|
+
filterPanelAddFilter: 'Adăugare filtru',
|
|
43
|
+
filterPanelDeleteIconLabel: 'Ștergere',
|
|
44
|
+
filterPanelLinkOperator: 'Operatori logici',
|
|
45
|
+
filterPanelOperators: 'Operatori',
|
|
46
|
+
// TODO v6: rename to filterPanelOperator
|
|
47
|
+
filterPanelOperatorAnd: 'Și',
|
|
48
|
+
filterPanelOperatorOr: 'Sau',
|
|
49
|
+
filterPanelColumns: 'Coloane',
|
|
50
|
+
filterPanelInputLabel: 'Valoare',
|
|
51
|
+
filterPanelInputPlaceholder: 'Filtrare valoare',
|
|
52
|
+
// Filter operators text
|
|
53
|
+
filterOperatorContains: 'conține',
|
|
54
|
+
filterOperatorEquals: 'este egal cu',
|
|
55
|
+
filterOperatorStartsWith: 'începe cu',
|
|
56
|
+
filterOperatorEndsWith: 'se termină cu',
|
|
57
|
+
filterOperatorIs: 'este',
|
|
58
|
+
filterOperatorNot: 'nu este',
|
|
59
|
+
filterOperatorAfter: 'este după',
|
|
60
|
+
filterOperatorOnOrAfter: 'este la sau după',
|
|
61
|
+
filterOperatorBefore: 'este înainte de',
|
|
62
|
+
filterOperatorOnOrBefore: 'este la sau înainte de',
|
|
63
|
+
filterOperatorIsEmpty: 'este gol',
|
|
64
|
+
filterOperatorIsNotEmpty: 'nu este gol',
|
|
65
|
+
filterOperatorIsAnyOf: 'este una din valori',
|
|
66
|
+
// Filter values text
|
|
67
|
+
filterValueAny: 'Aleatoriu',
|
|
68
|
+
filterValueTrue: 'Da',
|
|
69
|
+
filterValueFalse: 'Nu',
|
|
70
|
+
// Column menu text
|
|
71
|
+
columnMenuLabel: 'Meniu',
|
|
72
|
+
columnMenuShowColumns: 'Afișează toate coloanele',
|
|
73
|
+
columnMenuFilter: 'Filtru',
|
|
74
|
+
columnMenuHideColumn: 'Ascunde',
|
|
75
|
+
columnMenuUnsort: 'Dezactivare sortare',
|
|
76
|
+
columnMenuSortAsc: 'Sortează crescător',
|
|
77
|
+
columnMenuSortDesc: 'Sortează descrescător',
|
|
78
|
+
// Column header text
|
|
79
|
+
columnHeaderFiltersTooltipActive: function columnHeaderFiltersTooltipActive(count) {
|
|
80
|
+
return count !== 1 ? "".concat(count, " filtru activ") : "".concat(count, " filtru activ");
|
|
81
|
+
},
|
|
82
|
+
columnHeaderFiltersLabel: 'Afișează filtru',
|
|
83
|
+
columnHeaderSortIconLabel: 'Sortare',
|
|
84
|
+
// Rows selected footer text
|
|
85
|
+
footerRowSelected: function footerRowSelected(count) {
|
|
86
|
+
return count !== 1 ? "".concat(count.toLocaleString(), " \xCEnregistr\u0103ri selectate") : "".concat(count.toLocaleString(), " \xCEnregistrare selectat\u0103");
|
|
87
|
+
},
|
|
88
|
+
// Total row amount footer text
|
|
89
|
+
footerTotalRows: 'Total:',
|
|
90
|
+
// Total visible row amount footer text
|
|
91
|
+
footerTotalVisibleRows: function footerTotalVisibleRows(visibleCount, totalCount) {
|
|
92
|
+
return "".concat(visibleCount.toLocaleString(), " din ").concat(totalCount.toLocaleString());
|
|
93
|
+
},
|
|
94
|
+
// Checkbox selection text
|
|
95
|
+
checkboxSelectionHeaderName: 'Checkbox Selecție',
|
|
96
|
+
checkboxSelectionSelectAllRows: 'Selectare toate rândurile',
|
|
97
|
+
checkboxSelectionUnselectAllRows: 'Deselectare toate rândurile',
|
|
98
|
+
checkboxSelectionSelectRow: 'Selectare rând',
|
|
99
|
+
checkboxSelectionUnselectRow: 'Deselectare rând',
|
|
100
|
+
// Boolean cell text
|
|
101
|
+
booleanCellTrueLabel: 'Da',
|
|
102
|
+
booleanCellFalseLabel: 'Nu',
|
|
103
|
+
// Actions cell more text
|
|
104
|
+
actionsCellMore: 'Mai multe',
|
|
105
|
+
// Column pinning text
|
|
106
|
+
pinToLeft: 'Fixare în stânga',
|
|
107
|
+
pinToRight: 'Fixare în dreapta',
|
|
108
|
+
unpin: 'Anulare fixare',
|
|
109
|
+
// Tree Data
|
|
110
|
+
treeDataGroupingHeaderName: 'Grup',
|
|
111
|
+
treeDataExpand: 'Afișare copii',
|
|
112
|
+
treeDataCollapse: 'Ascundere copii',
|
|
113
|
+
// Grouping columns
|
|
114
|
+
groupingColumnHeaderName: 'Grupare',
|
|
115
|
+
groupColumn: function groupColumn(name) {
|
|
116
|
+
return "Grupare dup\u0103 ".concat(name);
|
|
117
|
+
},
|
|
118
|
+
unGroupColumn: function unGroupColumn(name) {
|
|
119
|
+
return "Anulare Grupare dup\u0103 ".concat(name);
|
|
120
|
+
},
|
|
121
|
+
// Master/detail
|
|
122
|
+
// detailPanelToggle: 'Detail panel toggle',
|
|
123
|
+
expandDetailPanel: 'Extindere',
|
|
124
|
+
collapseDetailPanel: 'Restrângere',
|
|
125
|
+
// Row reordering text
|
|
126
|
+
rowReorderingHeaderName: 'Reordonare rânduri'
|
|
127
|
+
};
|
|
128
|
+
export var roRO = getGridLocalization(roROGrid, roROCore);
|