@mui/x-data-grid 6.0.4 → 6.2.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 +110 -0
- package/components/GridAutoSizer.js +3 -0
- package/components/GridPagination.d.ts +6 -6
- package/components/GridRow.js +3 -1
- package/components/cell/GridActionsCellItem.d.ts +2 -2
- package/components/cell/GridEditDateCell.js +37 -16
- package/components/columnHeaders/ColumnHeaderMenuIcon.js +20 -16
- package/components/panel/GridColumnsPanel.d.ts +8 -0
- package/components/panel/GridColumnsPanel.js +18 -6
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputBoolean.js +37 -29
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +34 -30
- 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/hooks/core/useGridApiInitialization.js +3 -3
- package/hooks/features/columns/gridColumnsSelector.d.ts +3 -3
- package/hooks/features/editing/useGridCellEditing.js +5 -1
- package/hooks/features/editing/useGridEditing.js +1 -3
- package/hooks/features/editing/useGridRowEditing.js +5 -1
- package/hooks/features/filter/gridFilterState.js +6 -1
- package/hooks/features/filter/useGridFilter.js +5 -0
- package/hooks/features/rowSelection/useGridRowSelection.js +5 -26
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +36 -16
- package/index.js +9 -1
- package/legacy/components/GridAutoSizer.js +3 -0
- package/legacy/components/GridRow.js +4 -1
- package/legacy/components/cell/GridEditBooleanCell.js +19 -21
- package/legacy/components/cell/GridEditDateCell.js +69 -39
- package/legacy/components/cell/GridEditInputCell.js +25 -27
- package/legacy/components/cell/GridEditSingleSelectCell.js +26 -28
- package/legacy/components/columnHeaders/ColumnHeaderMenuIcon.js +20 -16
- package/legacy/components/panel/GridColumnsPanel.js +19 -6
- package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +37 -29
- package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +34 -30
- package/legacy/hooks/core/useGridApiInitialization.js +3 -3
- package/legacy/hooks/features/columns/gridColumnsUtils.js +2 -2
- package/legacy/hooks/features/editing/useGridCellEditing.js +120 -120
- package/legacy/hooks/features/editing/useGridEditing.js +17 -21
- package/legacy/hooks/features/editing/useGridRowEditing.js +5 -1
- package/legacy/hooks/features/export/useGridPrintExport.js +45 -47
- package/legacy/hooks/features/filter/gridFilterState.js +6 -1
- package/legacy/hooks/features/filter/useGridFilter.js +5 -0
- package/legacy/hooks/features/rowSelection/useGridRowSelection.js +5 -24
- package/legacy/hooks/features/rows/gridRowsUtils.js +2 -2
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +6 -6
- package/legacy/index.js +9 -1
- package/legacy/locales/coreLocales.js +0 -1
- package/legacy/locales/frFR.js +7 -9
- package/legacy/locales/huHU.js +15 -20
- package/legacy/locales/jaJP.js +1 -1
- package/legacy/locales/nlNL.js +3 -3
- package/legacy/locales/ptBR.js +7 -9
- package/legacy/locales/ruRU.js +1 -1
- package/legacy/locales/urPK.js +6 -6
- package/legacy/models/gridColumnGrouping.js +4 -0
- package/legacy/models/params/gridRowParams.js +8 -0
- package/legacy/utils/createSelector.js +14 -22
- package/legacy/utils/utils.js +1 -1
- package/locales/coreLocales.js +0 -1
- package/locales/frFR.js +7 -9
- package/locales/huHU.js +15 -20
- package/locales/jaJP.js +1 -1
- package/locales/nlNL.js +3 -3
- package/locales/ptBR.js +7 -9
- package/locales/ruRU.js +1 -1
- package/locales/urPK.js +6 -6
- package/models/api/gridCoreApi.d.ts +3 -1
- package/models/api/gridEditingApi.d.ts +4 -0
- package/models/gridColumnGrouping.js +4 -0
- package/models/params/gridRowParams.js +8 -0
- package/modern/components/GridAutoSizer.js +3 -0
- package/modern/components/GridRow.js +3 -1
- package/modern/components/cell/GridEditDateCell.js +37 -16
- package/modern/components/columnHeaders/ColumnHeaderMenuIcon.js +19 -15
- package/modern/components/panel/GridColumnsPanel.js +18 -6
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +36 -28
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +33 -29
- package/modern/hooks/core/useGridApiInitialization.js +3 -3
- package/modern/hooks/features/editing/useGridCellEditing.js +5 -1
- package/modern/hooks/features/editing/useGridEditing.js +1 -3
- package/modern/hooks/features/editing/useGridRowEditing.js +5 -1
- package/modern/hooks/features/filter/gridFilterState.js +6 -1
- package/modern/hooks/features/filter/useGridFilter.js +5 -0
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +5 -26
- package/modern/index.js +9 -1
- package/modern/locales/coreLocales.js +0 -1
- package/modern/locales/frFR.js +7 -9
- package/modern/locales/huHU.js +15 -20
- package/modern/locales/jaJP.js +1 -1
- package/modern/locales/nlNL.js +3 -3
- package/modern/locales/ptBR.js +7 -9
- package/modern/locales/ruRU.js +1 -1
- package/modern/locales/urPK.js +6 -6
- package/modern/models/gridColumnGrouping.js +4 -0
- package/modern/models/params/gridRowParams.js +8 -0
- package/modern/utils/createSelector.js +12 -22
- package/modern/utils/utils.js +1 -1
- package/node/components/GridAutoSizer.js +3 -1
- package/node/components/GridRow.js +3 -1
- package/node/components/cell/GridCell.js +1 -0
- package/node/components/cell/GridEditDateCell.js +37 -16
- package/node/components/columnHeaders/ColumnHeaderMenuIcon.js +19 -15
- package/node/components/panel/GridColumnsPanel.js +18 -6
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +36 -28
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +32 -29
- package/node/hooks/core/useGridApiInitialization.js +3 -3
- package/node/hooks/features/editing/useGridCellEditing.js +5 -1
- package/node/hooks/features/editing/useGridEditing.js +1 -3
- package/node/hooks/features/editing/useGridRowEditing.js +5 -1
- package/node/hooks/features/filter/gridFilterState.js +5 -0
- package/node/hooks/features/filter/useGridFilter.js +5 -0
- package/node/hooks/features/rowSelection/useGridRowSelection.js +4 -25
- package/node/index.js +1 -1
- package/node/locales/frFR.js +7 -9
- package/node/locales/huHU.js +15 -20
- package/node/locales/jaJP.js +1 -1
- package/node/locales/nlNL.js +3 -3
- package/node/locales/ptBR.js +7 -9
- package/node/locales/ruRU.js +1 -1
- package/node/locales/urPK.js +6 -6
- package/node/models/gridColumnGrouping.js +4 -0
- package/node/models/params/gridEditCellParams.js +1 -0
- package/node/models/params/gridRowParams.js +9 -0
- package/node/utils/createSelector.js +12 -22
- package/node/utils/utils.js +1 -1
- package/package.json +1 -1
- package/utils/createSelector.d.ts +4 -4
- package/utils/createSelector.js +14 -22
- package/utils/utils.d.ts +1 -1
- package/utils/utils.js +1 -1
|
@@ -37,22 +37,26 @@ export const ColumnHeaderMenuIcon = /*#__PURE__*/React.memo(props => {
|
|
|
37
37
|
}, [apiRef, colDef.field]);
|
|
38
38
|
return /*#__PURE__*/_jsx("div", {
|
|
39
39
|
className: classes.root,
|
|
40
|
-
children: /*#__PURE__*/_jsx(rootProps.slots.
|
|
41
|
-
ref: iconButtonRef,
|
|
42
|
-
tabIndex: -1,
|
|
43
|
-
className: classes.button,
|
|
44
|
-
"aria-label": apiRef.current.getLocaleText('columnMenuLabel'),
|
|
40
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, _extends({
|
|
45
41
|
title: apiRef.current.getLocaleText('columnMenuLabel'),
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
42
|
+
enterDelay: 1000
|
|
43
|
+
}, rootProps.slotProps?.baseTooltip, {
|
|
44
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
|
|
45
|
+
ref: iconButtonRef,
|
|
46
|
+
tabIndex: -1,
|
|
47
|
+
className: classes.button,
|
|
48
|
+
"aria-label": apiRef.current.getLocaleText('columnMenuLabel'),
|
|
49
|
+
size: "small",
|
|
50
|
+
onClick: handleMenuIconClick,
|
|
51
|
+
"aria-expanded": open ? 'true' : undefined,
|
|
52
|
+
"aria-haspopup": "true",
|
|
53
|
+
"aria-controls": columnMenuId,
|
|
54
|
+
id: columnMenuButtonId
|
|
55
|
+
}, rootProps.slotProps?.baseIconButton, {
|
|
56
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuIcon, {
|
|
57
|
+
fontSize: "small"
|
|
58
|
+
})
|
|
59
|
+
}))
|
|
56
60
|
}))
|
|
57
61
|
});
|
|
58
62
|
});
|
|
@@ -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 = ["sort", "searchPredicate", "autoFocusSearchField", "disableHideAllButton", "disableShowAllButton"];
|
|
3
|
+
const _excluded = ["sort", "searchPredicate", "autoFocusSearchField", "disableHideAllButton", "disableShowAllButton", "getTogglableColumns"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
@@ -71,7 +71,8 @@ function GridColumnsPanel(props) {
|
|
|
71
71
|
searchPredicate = defaultSearchPredicate,
|
|
72
72
|
autoFocusSearchField = true,
|
|
73
73
|
disableHideAllButton = false,
|
|
74
|
-
disableShowAllButton = false
|
|
74
|
+
disableShowAllButton = false,
|
|
75
|
+
getTogglableColumns
|
|
75
76
|
} = props,
|
|
76
77
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
77
78
|
const sortedColumns = React.useMemo(() => {
|
|
@@ -109,12 +110,15 @@ function GridColumnsPanel(props) {
|
|
|
109
110
|
setSearchValue(event.target.value);
|
|
110
111
|
}, []);
|
|
111
112
|
const currentColumns = React.useMemo(() => {
|
|
113
|
+
const togglableColumns = getTogglableColumns ? getTogglableColumns(sortedColumns) : null;
|
|
114
|
+
const togglableSortedColumns = togglableColumns ? sortedColumns.filter(({
|
|
115
|
+
field
|
|
116
|
+
}) => togglableColumns.includes(field)) : sortedColumns;
|
|
112
117
|
if (!searchValue) {
|
|
113
|
-
return
|
|
118
|
+
return togglableSortedColumns;
|
|
114
119
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}, [sortedColumns, searchValue, searchPredicate]);
|
|
120
|
+
return togglableSortedColumns.filter(column => searchPredicate(column, searchValue.toLowerCase()));
|
|
121
|
+
}, [sortedColumns, searchValue, searchPredicate, getTogglableColumns]);
|
|
118
122
|
const firstSwitchRef = React.useRef(null);
|
|
119
123
|
React.useEffect(() => {
|
|
120
124
|
if (autoFocusSearchField) {
|
|
@@ -192,6 +196,14 @@ process.env.NODE_ENV !== "production" ? GridColumnsPanel.propTypes = {
|
|
|
192
196
|
autoFocusSearchField: PropTypes.bool,
|
|
193
197
|
disableHideAllButton: PropTypes.bool,
|
|
194
198
|
disableShowAllButton: PropTypes.bool,
|
|
199
|
+
/**
|
|
200
|
+
* Returns the list of togglable columns.
|
|
201
|
+
* If used, only those columns will be displayed in the panel
|
|
202
|
+
* which are passed as the return value of the function.
|
|
203
|
+
* @param {GridColDef[]} columns The `ColDef` list of all columns.
|
|
204
|
+
* @returns {GridColDef['field'][]} The list of togglable columns' field names.
|
|
205
|
+
*/
|
|
206
|
+
getTogglableColumns: PropTypes.func,
|
|
195
207
|
searchPredicate: PropTypes.func,
|
|
196
208
|
slotProps: PropTypes.object,
|
|
197
209
|
sort: PropTypes.oneOf(['asc', 'desc'])
|
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["item", "applyValue", "apiRef", "focusElementRef"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
+
import { unstable_useId as useId } from '@mui/utils';
|
|
5
6
|
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -15,6 +16,8 @@ export function GridFilterInputBoolean(props) {
|
|
|
15
16
|
others = _objectWithoutPropertiesLoose(props, _excluded);
|
|
16
17
|
const [filterValueState, setFilterValueState] = React.useState(item.value || '');
|
|
17
18
|
const rootProps = useGridRootProps();
|
|
19
|
+
const labelId = useId();
|
|
20
|
+
const selectId = useId();
|
|
18
21
|
const baseSelectProps = rootProps.slotProps?.baseSelect || {};
|
|
19
22
|
const isSelectNative = baseSelectProps.native ?? true;
|
|
20
23
|
const baseSelectOptionProps = rootProps.slotProps?.baseSelectOption || {};
|
|
@@ -28,34 +31,39 @@ export function GridFilterInputBoolean(props) {
|
|
|
28
31
|
React.useEffect(() => {
|
|
29
32
|
setFilterValueState(item.value || '');
|
|
30
33
|
}, [item.value]);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
const label = apiRef.current.getLocaleText('filterPanelInputLabel');
|
|
35
|
+
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
36
|
+
children: [/*#__PURE__*/_jsx(rootProps.slots.baseInputLabel, _extends({}, rootProps.slotProps?.baseInputLabel, {
|
|
37
|
+
id: labelId,
|
|
38
|
+
shrink: true,
|
|
39
|
+
variant: "standard",
|
|
40
|
+
children: label
|
|
41
|
+
})), /*#__PURE__*/_jsxs(rootProps.slots.baseSelect, _extends({
|
|
42
|
+
labelId: labelId,
|
|
43
|
+
id: selectId,
|
|
44
|
+
label: label,
|
|
45
|
+
value: filterValueState,
|
|
46
|
+
onChange: onFilterChange,
|
|
47
|
+
variant: "standard",
|
|
39
48
|
native: isSelectNative,
|
|
40
|
-
displayEmpty: true
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
children: apiRef.current.getLocaleText('filterValueFalse')
|
|
49
|
+
displayEmpty: true,
|
|
50
|
+
inputProps: {
|
|
51
|
+
ref: focusElementRef
|
|
52
|
+
}
|
|
53
|
+
}, others, baseSelectProps, {
|
|
54
|
+
children: [/*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
55
|
+
native: isSelectNative,
|
|
56
|
+
value: "",
|
|
57
|
+
children: apiRef.current.getLocaleText('filterValueAny')
|
|
58
|
+
})), /*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
59
|
+
native: isSelectNative,
|
|
60
|
+
value: "true",
|
|
61
|
+
children: apiRef.current.getLocaleText('filterValueTrue')
|
|
62
|
+
})), /*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
63
|
+
native: isSelectNative,
|
|
64
|
+
value: "false",
|
|
65
|
+
children: apiRef.current.getLocaleText('filterValueFalse')
|
|
66
|
+
}))]
|
|
59
67
|
}))]
|
|
60
|
-
})
|
|
68
|
+
});
|
|
61
69
|
}
|
|
@@ -8,6 +8,7 @@ import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
|
8
8
|
import { getValueFromValueOptions, isSingleSelectColDef } from './filterPanelUtils';
|
|
9
9
|
import { createElement as _createElement } from "react";
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
12
|
const renderSingleSelectOptions = ({
|
|
12
13
|
column: {
|
|
13
14
|
valueOptions,
|
|
@@ -45,10 +46,9 @@ function GridFilterInputSingleSelect(props) {
|
|
|
45
46
|
others = _objectWithoutPropertiesLoose(props, _excluded);
|
|
46
47
|
const [filterValueState, setFilterValueState] = React.useState(item.value ?? '');
|
|
47
48
|
const id = useId();
|
|
49
|
+
const labelId = useId();
|
|
48
50
|
const rootProps = useGridRootProps();
|
|
49
|
-
const
|
|
50
|
-
const isSelectNative = baseSelectProps.native ?? true;
|
|
51
|
-
const baseSelectOptionProps = rootProps.slotProps?.baseSelectOption || {};
|
|
51
|
+
const isSelectNative = rootProps.slotProps?.baseSelect?.native ?? true;
|
|
52
52
|
let resolvedColumn = null;
|
|
53
53
|
if (item.field) {
|
|
54
54
|
const column = apiRef.current.getColumn(item.field);
|
|
@@ -99,33 +99,37 @@ function GridFilterInputSingleSelect(props) {
|
|
|
99
99
|
if (!isSingleSelectColDef(resolvedColumn)) {
|
|
100
100
|
return null;
|
|
101
101
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
102
|
+
const label = apiRef.current.getLocaleText('filterPanelInputLabel');
|
|
103
|
+
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
104
|
+
children: [/*#__PURE__*/_jsx(rootProps.slots.baseInputLabel, _extends({}, rootProps.slotProps?.baseInputLabel, {
|
|
105
|
+
id: labelId,
|
|
106
|
+
shrink: true,
|
|
107
|
+
variant: "standard",
|
|
108
|
+
children: label
|
|
109
|
+
})), /*#__PURE__*/_jsx(rootProps.slots.baseSelect, _extends({
|
|
110
|
+
id: id,
|
|
111
|
+
label: label,
|
|
112
|
+
labelId: labelId,
|
|
113
|
+
value: filterValueState,
|
|
114
|
+
onChange: onFilterChange,
|
|
115
|
+
variant: "standard",
|
|
116
|
+
type: type || 'text',
|
|
117
|
+
inputProps: {
|
|
118
|
+
ref: focusElementRef,
|
|
119
|
+
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder')
|
|
120
|
+
},
|
|
117
121
|
native: isSelectNative
|
|
118
|
-
}, rootProps.slotProps?.baseSelect
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
})
|
|
128
|
-
})
|
|
122
|
+
}, others, rootProps.slotProps?.baseSelect, {
|
|
123
|
+
children: renderSingleSelectOptions({
|
|
124
|
+
column: resolvedColumn,
|
|
125
|
+
OptionComponent: rootProps.slots.baseSelectOption,
|
|
126
|
+
getOptionLabel,
|
|
127
|
+
getOptionValue,
|
|
128
|
+
isSelectNative,
|
|
129
|
+
baseSelectOptionProps: rootProps.slotProps?.baseSelectOption
|
|
130
|
+
})
|
|
131
|
+
}))]
|
|
132
|
+
});
|
|
129
133
|
}
|
|
130
134
|
process.env.NODE_ENV !== "production" ? GridFilterInputSingleSelect.propTypes = {
|
|
131
135
|
// ----------------------------- Warning --------------------------------
|
|
@@ -2,7 +2,6 @@ import * as React from 'react';
|
|
|
2
2
|
import { useGridApiMethod } from '../utils/useGridApiMethod';
|
|
3
3
|
import { GridSignature } from '../utils/useGridApiEventHandler';
|
|
4
4
|
import { EventManager } from '../../utils/EventManager';
|
|
5
|
-
import { unstable_resetCreateSelectorCache } from '../../utils/createSelector';
|
|
6
5
|
const isSyntheticEvent = event => {
|
|
7
6
|
return event.isPropagationStopped !== undefined;
|
|
8
7
|
};
|
|
@@ -38,7 +37,9 @@ export function useGridApiInitialization(inputApiRef, props) {
|
|
|
38
37
|
if (!publicApiRef.current) {
|
|
39
38
|
publicApiRef.current = {
|
|
40
39
|
state: {},
|
|
41
|
-
instanceId:
|
|
40
|
+
instanceId: {
|
|
41
|
+
id: globalId
|
|
42
|
+
}
|
|
42
43
|
};
|
|
43
44
|
globalId += 1;
|
|
44
45
|
}
|
|
@@ -76,7 +77,6 @@ export function useGridApiInitialization(inputApiRef, props) {
|
|
|
76
77
|
React.useEffect(() => {
|
|
77
78
|
const api = privateApiRef.current;
|
|
78
79
|
return () => {
|
|
79
|
-
unstable_resetCreateSelectorCache(api.instanceId);
|
|
80
80
|
api.publishEvent('unmount');
|
|
81
81
|
};
|
|
82
82
|
}, [privateApiRef]);
|
|
@@ -242,13 +242,17 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
242
242
|
initialValue
|
|
243
243
|
} = params;
|
|
244
244
|
let newValue = apiRef.current.getCellValue(id, field);
|
|
245
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
246
|
+
let unstable_updateValueOnRender = false;
|
|
245
247
|
if (deleteValue || initialValue) {
|
|
246
248
|
newValue = deleteValue ? '' : initialValue;
|
|
249
|
+
unstable_updateValueOnRender = true;
|
|
247
250
|
}
|
|
248
251
|
const newProps = {
|
|
249
252
|
value: newValue,
|
|
250
253
|
error: false,
|
|
251
|
-
isProcessingProps: false
|
|
254
|
+
isProcessingProps: false,
|
|
255
|
+
unstable_updateValueOnRender
|
|
252
256
|
};
|
|
253
257
|
updateOrDeleteFieldState(id, field, newProps);
|
|
254
258
|
apiRef.current.setCellFocus(id, field);
|
|
@@ -110,9 +110,7 @@ export const useGridEditing = (apiRef, props) => {
|
|
|
110
110
|
}, [apiRef, props.editMode]);
|
|
111
111
|
const getEditCellMeta = React.useCallback((id, field) => {
|
|
112
112
|
const editingState = gridEditRowsStateSelector(apiRef.current.state);
|
|
113
|
-
return
|
|
114
|
-
changeReason: editingState[id][field].changeReason
|
|
115
|
-
};
|
|
113
|
+
return editingState[id][field];
|
|
116
114
|
}, [apiRef]);
|
|
117
115
|
const editingSharedApi = {
|
|
118
116
|
isCellEditable,
|
|
@@ -310,13 +310,17 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
310
310
|
return acc;
|
|
311
311
|
}
|
|
312
312
|
let newValue = apiRef.current.getCellValue(id, field);
|
|
313
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
314
|
+
let unstable_updateValueOnRender = false;
|
|
313
315
|
if (fieldToFocus === field && (deleteValue || initialValue)) {
|
|
314
316
|
newValue = deleteValue ? '' : initialValue;
|
|
317
|
+
unstable_updateValueOnRender = true;
|
|
315
318
|
}
|
|
316
319
|
acc[field] = {
|
|
317
320
|
value: newValue,
|
|
318
321
|
error: false,
|
|
319
|
-
isProcessingProps: false
|
|
322
|
+
isProcessingProps: false,
|
|
323
|
+
unstable_updateValueOnRender
|
|
320
324
|
};
|
|
321
325
|
return acc;
|
|
322
326
|
}, {});
|
|
@@ -4,4 +4,9 @@ export const getDefaultGridFilterModel = () => ({
|
|
|
4
4
|
logicOperator: GridLogicOperator.And,
|
|
5
5
|
quickFilterValues: [],
|
|
6
6
|
quickFilterLogicOperator: GridLogicOperator.And
|
|
7
|
-
});
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @param {GridRowId} rowId The id of the row we want to filter.
|
|
11
|
+
* @param {(filterItem: GridFilterItem) => boolean} shouldApplyItem An optional callback to allow the filtering engine to only apply some items.
|
|
12
|
+
*/
|
|
@@ -111,6 +111,11 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
111
111
|
const filterModel = gridFilterModelSelector(apiRef);
|
|
112
112
|
const filterItemsWithValue = filterModel.items.filter(item => {
|
|
113
113
|
if (item.value !== undefined) {
|
|
114
|
+
// Some filters like `isAnyOf` support array as `item.value`.
|
|
115
|
+
// If array is empty, we want to remove it from the filter model.
|
|
116
|
+
if (Array.isArray(item.value) && item.value.length === 0) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
114
119
|
return true;
|
|
115
120
|
}
|
|
116
121
|
const column = apiRef.current.getColumn(item.field);
|
|
@@ -11,7 +11,7 @@ import { gridExpandedSortedRowIdsSelector } from '../filter/gridFilterSelector';
|
|
|
11
11
|
import { GRID_CHECKBOX_SELECTION_COL_DEF, GRID_ACTIONS_COLUMN_TYPE } from '../../../colDef';
|
|
12
12
|
import { GridCellModes } from '../../../models/gridEditRowModel';
|
|
13
13
|
import { isKeyboardEvent, isNavigationKey } from '../../../utils/keyboardUtils';
|
|
14
|
-
import {
|
|
14
|
+
import { useGridVisibleRows } from '../../utils/useGridVisibleRows';
|
|
15
15
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../../../constants/gridDetailPanelToggleField';
|
|
16
16
|
import { gridClasses } from '../../../constants/gridClasses';
|
|
17
17
|
const getSelectionModelPropValue = (selectionModelProp, prevSelectionModel) => {
|
|
@@ -58,8 +58,6 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
58
58
|
checkboxSelection,
|
|
59
59
|
disableMultipleRowSelection,
|
|
60
60
|
disableRowSelectionOnClick,
|
|
61
|
-
pagination,
|
|
62
|
-
paginationMode,
|
|
63
61
|
isRowSelectable: propIsRowSelectable
|
|
64
62
|
} = props;
|
|
65
63
|
const canHaveMultipleSelection = !disableMultipleRowSelection || checkboxSelection;
|
|
@@ -375,32 +373,13 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
375
373
|
}
|
|
376
374
|
}, [apiRef, isRowSelectable, isStateControlled, props.rowSelection]);
|
|
377
375
|
React.useEffect(() => {
|
|
378
|
-
if (!props.rowSelection) {
|
|
376
|
+
if (!props.rowSelection || isStateControlled) {
|
|
379
377
|
return;
|
|
380
378
|
}
|
|
381
379
|
const currentSelection = gridRowSelectionStateSelector(apiRef.current.state);
|
|
382
380
|
if (!canHaveMultipleSelection && currentSelection.length > 1) {
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
} = getVisibleRows(apiRef, {
|
|
386
|
-
pagination,
|
|
387
|
-
paginationMode
|
|
388
|
-
});
|
|
389
|
-
const currentPageRowsLookup = currentPageRows.reduce((acc, {
|
|
390
|
-
id
|
|
391
|
-
}) => {
|
|
392
|
-
acc[id] = true;
|
|
393
|
-
return acc;
|
|
394
|
-
}, {});
|
|
395
|
-
const firstSelectableRow = currentSelection.find(id => {
|
|
396
|
-
let isSelectable = true;
|
|
397
|
-
if (isRowSelectable) {
|
|
398
|
-
isSelectable = isRowSelectable(id);
|
|
399
|
-
}
|
|
400
|
-
return isSelectable && currentPageRowsLookup[id]; // Check if the row is in the current page
|
|
401
|
-
});
|
|
402
|
-
|
|
403
|
-
apiRef.current.setRowSelectionModel(firstSelectableRow !== undefined ? [firstSelectableRow] : []);
|
|
381
|
+
// See https://github.com/mui/mui-x/issues/8455
|
|
382
|
+
apiRef.current.setRowSelectionModel([]);
|
|
404
383
|
}
|
|
405
|
-
}, [apiRef, canHaveMultipleSelection, checkboxSelection,
|
|
384
|
+
}, [apiRef, canHaveMultipleSelection, checkboxSelection, isStateControlled, props.rowSelection]);
|
|
406
385
|
};
|
package/modern/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-data-grid v6.0
|
|
2
|
+
* @mui/x-data-grid v6.2.0
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -28,4 +28,12 @@ export { GridColumnMenu, GRID_COLUMN_MENU_SLOTS, GRID_COLUMN_MENU_SLOT_PROPS } f
|
|
|
28
28
|
* The full grid API.
|
|
29
29
|
* @demos
|
|
30
30
|
* - [API object](/x/react-data-grid/api-object/)
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The state of `DataGrid`.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The initial state of `DataGrid`.
|
|
31
39
|
*/
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
// This allows not to bump the minimal version of `@mui/material` in peerDependencies which results
|
|
4
4
|
// in broader compatibility between the packages.
|
|
5
5
|
// See https://github.com/mui/mui-x/pull/7646#issuecomment-1404605556 for additional context.
|
|
6
|
-
|
|
7
6
|
export const beBYCore = {
|
|
8
7
|
components: {
|
|
9
8
|
MuiTablePagination: {
|
package/modern/locales/frFR.js
CHANGED
|
@@ -111,15 +111,13 @@ const frFRGrid = {
|
|
|
111
111
|
expandDetailPanel: 'Afficher',
|
|
112
112
|
collapseDetailPanel: 'Masquer',
|
|
113
113
|
// Row reordering text
|
|
114
|
-
rowReorderingHeaderName: 'Positionnement des lignes'
|
|
115
|
-
|
|
114
|
+
rowReorderingHeaderName: 'Positionnement des lignes',
|
|
116
115
|
// Aggregation
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
116
|
+
aggregationMenuItemHeader: 'Agrégation',
|
|
117
|
+
aggregationFunctionLabelSum: 'Somme',
|
|
118
|
+
aggregationFunctionLabelAvg: 'Moyenne',
|
|
119
|
+
aggregationFunctionLabelMin: 'Minimum',
|
|
120
|
+
aggregationFunctionLabelMax: 'Maximum',
|
|
121
|
+
aggregationFunctionLabelSize: "Nombre d'éléments"
|
|
123
122
|
};
|
|
124
|
-
|
|
125
123
|
export const frFR = getGridLocalization(frFRGrid, frFRCore);
|
package/modern/locales/huHU.js
CHANGED
|
@@ -20,17 +20,15 @@ const huHUGrid = {
|
|
|
20
20
|
toolbarFiltersTooltipShow: 'Szűrők megjelenítése',
|
|
21
21
|
toolbarFiltersTooltipActive: count => `${count} aktív szűrő`,
|
|
22
22
|
// Quick filter toolbar field
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
toolbarQuickFilterPlaceholder: 'Keresés…',
|
|
24
|
+
toolbarQuickFilterLabel: 'Keresés',
|
|
25
|
+
toolbarQuickFilterDeleteIconLabel: 'Törlés',
|
|
27
26
|
// Export selector toolbar button text
|
|
28
27
|
toolbarExport: 'Exportálás',
|
|
29
28
|
toolbarExportLabel: 'Exportálás',
|
|
30
29
|
toolbarExportCSV: 'Mentés CSV fájlként',
|
|
31
30
|
toolbarExportPrint: 'Nyomtatás',
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
toolbarExportExcel: 'Mentés Excel fájlként',
|
|
34
32
|
// Columns panel text
|
|
35
33
|
columnsPanelTextFieldLabel: 'Oszlop keresése',
|
|
36
34
|
columnsPanelTextFieldPlaceholder: 'Oszlop neve',
|
|
@@ -39,7 +37,7 @@ const huHUGrid = {
|
|
|
39
37
|
columnsPanelHideAllButton: 'Összes elrejtése',
|
|
40
38
|
// Filter panel text
|
|
41
39
|
filterPanelAddFilter: 'Szűrő hozzáadása',
|
|
42
|
-
|
|
40
|
+
filterPanelRemoveAll: 'Összes törlése',
|
|
43
41
|
filterPanelDeleteIconLabel: 'Törlés',
|
|
44
42
|
filterPanelLogicOperator: 'Logikai operátor',
|
|
45
43
|
filterPanelOperator: 'Operátorok',
|
|
@@ -69,7 +67,7 @@ const huHUGrid = {
|
|
|
69
67
|
// Column menu text
|
|
70
68
|
columnMenuLabel: 'Menü',
|
|
71
69
|
columnMenuShowColumns: 'Oszlopok megjelenítése',
|
|
72
|
-
|
|
70
|
+
columnMenuManageColumns: 'Oszlopok kezelése',
|
|
73
71
|
columnMenuFilter: 'Szűrők',
|
|
74
72
|
columnMenuHideColumn: 'Elrejtés',
|
|
75
73
|
columnMenuUnsort: 'Sorrend visszaállítása',
|
|
@@ -109,20 +107,17 @@ const huHUGrid = {
|
|
|
109
107
|
groupColumn: name => `Csoportosítás ${name} szerint`,
|
|
110
108
|
unGroupColumn: name => `${name} szerinti csoportosítás törlése`,
|
|
111
109
|
// Master/detail
|
|
112
|
-
|
|
110
|
+
detailPanelToggle: 'Részletek panel váltása',
|
|
113
111
|
expandDetailPanel: 'Kibontás',
|
|
114
|
-
collapseDetailPanel: 'Összecsukás'
|
|
115
|
-
|
|
112
|
+
collapseDetailPanel: 'Összecsukás',
|
|
116
113
|
// Row reordering text
|
|
117
|
-
|
|
118
|
-
|
|
114
|
+
rowReorderingHeaderName: 'Sorok újrarendezése',
|
|
119
115
|
// Aggregation
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
116
|
+
aggregationMenuItemHeader: 'Összesítés',
|
|
117
|
+
aggregationFunctionLabelSum: 'Összeg',
|
|
118
|
+
aggregationFunctionLabelAvg: 'Átlag',
|
|
119
|
+
aggregationFunctionLabelMin: 'Minimum',
|
|
120
|
+
aggregationFunctionLabelMax: 'Maximum',
|
|
121
|
+
aggregationFunctionLabelSize: 'Darabszám'
|
|
126
122
|
};
|
|
127
|
-
|
|
128
123
|
export const huHU = getGridLocalization(huHUGrid, huHUCore);
|
package/modern/locales/jaJP.js
CHANGED
|
@@ -37,7 +37,7 @@ const jaJPGrid = {
|
|
|
37
37
|
columnsPanelHideAllButton: 'すべて非表示',
|
|
38
38
|
// Filter panel text
|
|
39
39
|
filterPanelAddFilter: 'フィルター追加',
|
|
40
|
-
|
|
40
|
+
filterPanelRemoveAll: 'すべて削除',
|
|
41
41
|
filterPanelDeleteIconLabel: '削除',
|
|
42
42
|
filterPanelLogicOperator: '論理演算子',
|
|
43
43
|
filterPanelOperator: '演算子',
|
package/modern/locales/nlNL.js
CHANGED
|
@@ -37,7 +37,7 @@ const nlNLGrid = {
|
|
|
37
37
|
columnsPanelHideAllButton: 'Alles verbergen',
|
|
38
38
|
// Filter panel text
|
|
39
39
|
filterPanelAddFilter: 'Filter toevoegen',
|
|
40
|
-
|
|
40
|
+
filterPanelRemoveAll: 'Alles verwijderen',
|
|
41
41
|
filterPanelDeleteIconLabel: 'Verwijderen',
|
|
42
42
|
filterPanelLogicOperator: 'Logische operator',
|
|
43
43
|
filterPanelOperator: 'Operatoren',
|
|
@@ -67,7 +67,7 @@ const nlNLGrid = {
|
|
|
67
67
|
// Column menu text
|
|
68
68
|
columnMenuLabel: 'Menu',
|
|
69
69
|
columnMenuShowColumns: 'Toon kolommen',
|
|
70
|
-
|
|
70
|
+
columnMenuManageColumns: 'Kolommen beheren',
|
|
71
71
|
columnMenuFilter: 'Filteren',
|
|
72
72
|
columnMenuHideColumn: 'Verbergen',
|
|
73
73
|
columnMenuUnsort: 'Annuleer sortering',
|
|
@@ -107,7 +107,7 @@ const nlNLGrid = {
|
|
|
107
107
|
groupColumn: name => `Groepeer op ${name}`,
|
|
108
108
|
unGroupColumn: name => `Stop groeperen op ${name}`,
|
|
109
109
|
// Master/detail
|
|
110
|
-
|
|
110
|
+
detailPanelToggle: 'Detailmenu in- of uitklappen',
|
|
111
111
|
expandDetailPanel: 'Uitklappen',
|
|
112
112
|
collapseDetailPanel: 'Inklappen',
|
|
113
113
|
// Row reordering text
|
package/modern/locales/ptBR.js
CHANGED
|
@@ -111,15 +111,13 @@ const ptBRGrid = {
|
|
|
111
111
|
expandDetailPanel: 'Expandir',
|
|
112
112
|
collapseDetailPanel: 'Esconder',
|
|
113
113
|
// Row reordering text
|
|
114
|
-
rowReorderingHeaderName: 'Reorganizar linhas'
|
|
115
|
-
|
|
114
|
+
rowReorderingHeaderName: 'Reorganizar linhas',
|
|
116
115
|
// Aggregation
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
116
|
+
aggregationMenuItemHeader: 'Agrupar',
|
|
117
|
+
aggregationFunctionLabelSum: 'soma',
|
|
118
|
+
aggregationFunctionLabelAvg: 'média',
|
|
119
|
+
aggregationFunctionLabelMin: 'mín',
|
|
120
|
+
aggregationFunctionLabelMax: 'máx',
|
|
121
|
+
aggregationFunctionLabelSize: 'tamanho'
|
|
123
122
|
};
|
|
124
|
-
|
|
125
123
|
export const ptBR = getGridLocalization(ptBRGrid, ptBRCore);
|
package/modern/locales/ruRU.js
CHANGED
|
@@ -76,7 +76,7 @@ const ruRUGrid = {
|
|
|
76
76
|
// Column menu text
|
|
77
77
|
columnMenuLabel: 'Меню',
|
|
78
78
|
columnMenuShowColumns: 'Показать столбцы',
|
|
79
|
-
|
|
79
|
+
columnMenuManageColumns: 'Управление колонками',
|
|
80
80
|
columnMenuFilter: 'Фильтр',
|
|
81
81
|
columnMenuHideColumn: 'Скрыть',
|
|
82
82
|
columnMenuUnsort: 'Отменить сортировку',
|
package/modern/locales/urPK.js
CHANGED
|
@@ -113,11 +113,11 @@ const urPKGrid = {
|
|
|
113
113
|
// Row reordering text
|
|
114
114
|
rowReorderingHeaderName: 'قطاروں کی ترتیب تبدیل کریں',
|
|
115
115
|
// Aggregation
|
|
116
|
-
aggregationMenuItemHeader: '
|
|
117
|
-
aggregationFunctionLabelSum: '
|
|
118
|
-
aggregationFunctionLabelAvg: '
|
|
119
|
-
aggregationFunctionLabelMin: '
|
|
120
|
-
aggregationFunctionLabelMax: '
|
|
121
|
-
aggregationFunctionLabelSize: '
|
|
116
|
+
aggregationMenuItemHeader: 'ایگریگیشن',
|
|
117
|
+
aggregationFunctionLabelSum: 'کل',
|
|
118
|
+
aggregationFunctionLabelAvg: 'اوسط',
|
|
119
|
+
aggregationFunctionLabelMin: 'کم از کم',
|
|
120
|
+
aggregationFunctionLabelMax: 'زیادہ سے زیادہ',
|
|
121
|
+
aggregationFunctionLabelSize: 'سائز'
|
|
122
122
|
};
|
|
123
123
|
export const urPK = getGridLocalization(urPKGrid, urPKCore);
|