@mui/x-data-grid 6.1.0 → 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 +53 -1
- package/components/GridPagination.d.ts +2 -2
- 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/hooks/features/rowSelection/useGridRowSelection.js +5 -26
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +36 -16
- package/index.js +1 -1
- package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +37 -29
- package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +34 -30
- package/legacy/hooks/features/rowSelection/useGridRowSelection.js +5 -24
- package/legacy/index.js +1 -1
- package/legacy/locales/frFR.js +7 -9
- package/legacy/locales/urPK.js +6 -6
- package/legacy/utils/utils.js +1 -1
- package/locales/frFR.js +7 -9
- package/locales/urPK.js +6 -6
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +36 -28
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +33 -29
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +5 -26
- package/modern/index.js +1 -1
- package/modern/locales/frFR.js +7 -9
- package/modern/locales/urPK.js +6 -6
- package/modern/utils/utils.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +36 -28
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +32 -29
- 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/urPK.js +6 -6
- package/node/utils/utils.js +1 -1
- package/package.json +1 -1
- package/utils/utils.d.ts +1 -1
- package/utils/utils.js +1 -1
|
@@ -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 --------------------------------
|
|
@@ -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
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/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);
|
package/modern/utils/utils.js
CHANGED
|
@@ -8,6 +8,7 @@ exports.GridFilterInputBoolean = GridFilterInputBoolean;
|
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _utils = require("@mui/utils");
|
|
11
12
|
var _useGridRootProps = require("../../../hooks/utils/useGridRootProps");
|
|
12
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
14
|
const _excluded = ["item", "applyValue", "apiRef", "focusElementRef"];
|
|
@@ -23,6 +24,8 @@ function GridFilterInputBoolean(props) {
|
|
|
23
24
|
others = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
24
25
|
const [filterValueState, setFilterValueState] = React.useState(item.value || '');
|
|
25
26
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
27
|
+
const labelId = (0, _utils.unstable_useId)();
|
|
28
|
+
const selectId = (0, _utils.unstable_useId)();
|
|
26
29
|
const baseSelectProps = rootProps.slotProps?.baseSelect || {};
|
|
27
30
|
const isSelectNative = baseSelectProps.native ?? true;
|
|
28
31
|
const baseSelectOptionProps = rootProps.slotProps?.baseSelectOption || {};
|
|
@@ -36,34 +39,39 @@ function GridFilterInputBoolean(props) {
|
|
|
36
39
|
React.useEffect(() => {
|
|
37
40
|
setFilterValueState(item.value || '');
|
|
38
41
|
}, [item.value]);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
const label = apiRef.current.getLocaleText('filterPanelInputLabel');
|
|
43
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
44
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseInputLabel, (0, _extends2.default)({}, rootProps.slotProps?.baseInputLabel, {
|
|
45
|
+
id: labelId,
|
|
46
|
+
shrink: true,
|
|
47
|
+
variant: "standard",
|
|
48
|
+
children: label
|
|
49
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsxs)(rootProps.slots.baseSelect, (0, _extends2.default)({
|
|
50
|
+
labelId: labelId,
|
|
51
|
+
id: selectId,
|
|
52
|
+
label: label,
|
|
53
|
+
value: filterValueState,
|
|
54
|
+
onChange: onFilterChange,
|
|
55
|
+
variant: "standard",
|
|
47
56
|
native: isSelectNative,
|
|
48
|
-
displayEmpty: true
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
children: apiRef.current.getLocaleText('filterValueFalse')
|
|
57
|
+
displayEmpty: true,
|
|
58
|
+
inputProps: {
|
|
59
|
+
ref: focusElementRef
|
|
60
|
+
}
|
|
61
|
+
}, others, baseSelectProps, {
|
|
62
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseSelectOption, (0, _extends2.default)({}, baseSelectOptionProps, {
|
|
63
|
+
native: isSelectNative,
|
|
64
|
+
value: "",
|
|
65
|
+
children: apiRef.current.getLocaleText('filterValueAny')
|
|
66
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseSelectOption, (0, _extends2.default)({}, baseSelectOptionProps, {
|
|
67
|
+
native: isSelectNative,
|
|
68
|
+
value: "true",
|
|
69
|
+
children: apiRef.current.getLocaleText('filterValueTrue')
|
|
70
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseSelectOption, (0, _extends2.default)({}, baseSelectOptionProps, {
|
|
71
|
+
native: isSelectNative,
|
|
72
|
+
value: "false",
|
|
73
|
+
children: apiRef.current.getLocaleText('filterValueFalse')
|
|
74
|
+
}))]
|
|
67
75
|
}))]
|
|
68
|
-
})
|
|
76
|
+
});
|
|
69
77
|
}
|
|
@@ -53,10 +53,9 @@ function GridFilterInputSingleSelect(props) {
|
|
|
53
53
|
others = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
54
54
|
const [filterValueState, setFilterValueState] = React.useState(item.value ?? '');
|
|
55
55
|
const id = (0, _utils.unstable_useId)();
|
|
56
|
+
const labelId = (0, _utils.unstable_useId)();
|
|
56
57
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
57
|
-
const
|
|
58
|
-
const isSelectNative = baseSelectProps.native ?? true;
|
|
59
|
-
const baseSelectOptionProps = rootProps.slotProps?.baseSelectOption || {};
|
|
58
|
+
const isSelectNative = rootProps.slotProps?.baseSelect?.native ?? true;
|
|
60
59
|
let resolvedColumn = null;
|
|
61
60
|
if (item.field) {
|
|
62
61
|
const column = apiRef.current.getColumn(item.field);
|
|
@@ -107,33 +106,37 @@ function GridFilterInputSingleSelect(props) {
|
|
|
107
106
|
if (!(0, _filterPanelUtils.isSingleSelectColDef)(resolvedColumn)) {
|
|
108
107
|
return null;
|
|
109
108
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
109
|
+
const label = apiRef.current.getLocaleText('filterPanelInputLabel');
|
|
110
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
111
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseInputLabel, (0, _extends2.default)({}, rootProps.slotProps?.baseInputLabel, {
|
|
112
|
+
id: labelId,
|
|
113
|
+
shrink: true,
|
|
114
|
+
variant: "standard",
|
|
115
|
+
children: label
|
|
116
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseSelect, (0, _extends2.default)({
|
|
117
|
+
id: id,
|
|
118
|
+
label: label,
|
|
119
|
+
labelId: labelId,
|
|
120
|
+
value: filterValueState,
|
|
121
|
+
onChange: onFilterChange,
|
|
122
|
+
variant: "standard",
|
|
123
|
+
type: type || 'text',
|
|
124
|
+
inputProps: {
|
|
125
|
+
ref: focusElementRef,
|
|
126
|
+
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder')
|
|
127
|
+
},
|
|
125
128
|
native: isSelectNative
|
|
126
|
-
}, rootProps.slotProps?.baseSelect
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
})
|
|
136
|
-
})
|
|
129
|
+
}, others, rootProps.slotProps?.baseSelect, {
|
|
130
|
+
children: renderSingleSelectOptions({
|
|
131
|
+
column: resolvedColumn,
|
|
132
|
+
OptionComponent: rootProps.slots.baseSelectOption,
|
|
133
|
+
getOptionLabel,
|
|
134
|
+
getOptionValue,
|
|
135
|
+
isSelectNative,
|
|
136
|
+
baseSelectOptionProps: rootProps.slotProps?.baseSelectOption
|
|
137
|
+
})
|
|
138
|
+
}))]
|
|
139
|
+
});
|
|
137
140
|
}
|
|
138
141
|
process.env.NODE_ENV !== "production" ? GridFilterInputSingleSelect.propTypes = {
|
|
139
142
|
// ----------------------------- Warning --------------------------------
|
|
@@ -68,8 +68,6 @@ const useGridRowSelection = (apiRef, props) => {
|
|
|
68
68
|
checkboxSelection,
|
|
69
69
|
disableMultipleRowSelection,
|
|
70
70
|
disableRowSelectionOnClick,
|
|
71
|
-
pagination,
|
|
72
|
-
paginationMode,
|
|
73
71
|
isRowSelectable: propIsRowSelectable
|
|
74
72
|
} = props;
|
|
75
73
|
const canHaveMultipleSelection = !disableMultipleRowSelection || checkboxSelection;
|
|
@@ -385,33 +383,14 @@ const useGridRowSelection = (apiRef, props) => {
|
|
|
385
383
|
}
|
|
386
384
|
}, [apiRef, isRowSelectable, isStateControlled, props.rowSelection]);
|
|
387
385
|
React.useEffect(() => {
|
|
388
|
-
if (!props.rowSelection) {
|
|
386
|
+
if (!props.rowSelection || isStateControlled) {
|
|
389
387
|
return;
|
|
390
388
|
}
|
|
391
389
|
const currentSelection = (0, _gridRowSelectionSelector.gridRowSelectionStateSelector)(apiRef.current.state);
|
|
392
390
|
if (!canHaveMultipleSelection && currentSelection.length > 1) {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
} = (0, _useGridVisibleRows.getVisibleRows)(apiRef, {
|
|
396
|
-
pagination,
|
|
397
|
-
paginationMode
|
|
398
|
-
});
|
|
399
|
-
const currentPageRowsLookup = currentPageRows.reduce((acc, {
|
|
400
|
-
id
|
|
401
|
-
}) => {
|
|
402
|
-
acc[id] = true;
|
|
403
|
-
return acc;
|
|
404
|
-
}, {});
|
|
405
|
-
const firstSelectableRow = currentSelection.find(id => {
|
|
406
|
-
let isSelectable = true;
|
|
407
|
-
if (isRowSelectable) {
|
|
408
|
-
isSelectable = isRowSelectable(id);
|
|
409
|
-
}
|
|
410
|
-
return isSelectable && currentPageRowsLookup[id]; // Check if the row is in the current page
|
|
411
|
-
});
|
|
412
|
-
|
|
413
|
-
apiRef.current.setRowSelectionModel(firstSelectableRow !== undefined ? [firstSelectableRow] : []);
|
|
391
|
+
// See https://github.com/mui/mui-x/issues/8455
|
|
392
|
+
apiRef.current.setRowSelectionModel([]);
|
|
414
393
|
}
|
|
415
|
-
}, [apiRef, canHaveMultipleSelection, checkboxSelection,
|
|
394
|
+
}, [apiRef, canHaveMultipleSelection, checkboxSelection, isStateControlled, props.rowSelection]);
|
|
416
395
|
};
|
|
417
396
|
exports.useGridRowSelection = useGridRowSelection;
|
package/node/index.js
CHANGED
package/node/locales/frFR.js
CHANGED
|
@@ -117,16 +117,14 @@ const frFRGrid = {
|
|
|
117
117
|
expandDetailPanel: 'Afficher',
|
|
118
118
|
collapseDetailPanel: 'Masquer',
|
|
119
119
|
// Row reordering text
|
|
120
|
-
rowReorderingHeaderName: 'Positionnement des lignes'
|
|
121
|
-
|
|
120
|
+
rowReorderingHeaderName: 'Positionnement des lignes',
|
|
122
121
|
// Aggregation
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
122
|
+
aggregationMenuItemHeader: 'Agrégation',
|
|
123
|
+
aggregationFunctionLabelSum: 'Somme',
|
|
124
|
+
aggregationFunctionLabelAvg: 'Moyenne',
|
|
125
|
+
aggregationFunctionLabelMin: 'Minimum',
|
|
126
|
+
aggregationFunctionLabelMax: 'Maximum',
|
|
127
|
+
aggregationFunctionLabelSize: "Nombre d'éléments"
|
|
129
128
|
};
|
|
130
|
-
|
|
131
129
|
const frFR = (0, _getGridLocalization.getGridLocalization)(frFRGrid, _locale.frFR);
|
|
132
130
|
exports.frFR = frFR;
|
package/node/locales/urPK.js
CHANGED
|
@@ -119,12 +119,12 @@ const urPKGrid = {
|
|
|
119
119
|
// Row reordering text
|
|
120
120
|
rowReorderingHeaderName: 'قطاروں کی ترتیب تبدیل کریں',
|
|
121
121
|
// Aggregation
|
|
122
|
-
aggregationMenuItemHeader: '
|
|
123
|
-
aggregationFunctionLabelSum: '
|
|
124
|
-
aggregationFunctionLabelAvg: '
|
|
125
|
-
aggregationFunctionLabelMin: '
|
|
126
|
-
aggregationFunctionLabelMax: '
|
|
127
|
-
aggregationFunctionLabelSize: '
|
|
122
|
+
aggregationMenuItemHeader: 'ایگریگیشن',
|
|
123
|
+
aggregationFunctionLabelSum: 'کل',
|
|
124
|
+
aggregationFunctionLabelAvg: 'اوسط',
|
|
125
|
+
aggregationFunctionLabelMin: 'کم از کم',
|
|
126
|
+
aggregationFunctionLabelMax: 'زیادہ سے زیادہ',
|
|
127
|
+
aggregationFunctionLabelSize: 'سائز'
|
|
128
128
|
};
|
|
129
129
|
const urPK = (0, _getGridLocalization.getGridLocalization)(urPKGrid, _coreLocales.urPKCore);
|
|
130
130
|
exports.urPK = urPK;
|
package/node/utils/utils.js
CHANGED
package/package.json
CHANGED
package/utils/utils.d.ts
CHANGED