@mui/x-data-grid 5.12.2 → 5.12.3
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 +57 -6
- package/components/cell/GridBooleanCell.js +4 -3
- package/components/cell/GridEditBooleanCell.js +4 -3
- package/components/cell/GridEditDateCell.js +4 -3
- package/components/cell/GridEditInputCell.js +4 -3
- package/components/cell/GridEditSingleSelectCell.js +9 -7
- package/components/panel/GridColumnsPanel.js +1 -1
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +3 -2
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +12 -5
- package/hooks/features/filter/gridFilterUtils.js +8 -5
- package/hooks/features/rows/useGridRows.js +15 -2
- package/index.js +1 -1
- package/legacy/components/cell/GridBooleanCell.js +3 -1
- package/legacy/components/cell/GridEditBooleanCell.js +4 -2
- package/legacy/components/cell/GridEditDateCell.js +4 -2
- package/legacy/components/cell/GridEditInputCell.js +4 -2
- package/legacy/components/cell/GridEditSingleSelectCell.js +9 -7
- package/legacy/components/panel/GridColumnsPanel.js +3 -1
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +12 -5
- package/legacy/hooks/features/filter/gridFilterUtils.js +8 -5
- package/legacy/hooks/features/rows/useGridRows.js +17 -2
- package/legacy/index.js +1 -1
- package/legacy/locales/index.js +1 -0
- package/legacy/locales/svSE.js +128 -0
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/locales/svSE.d.ts +2 -0
- package/locales/svSE.js +116 -0
- package/modern/components/cell/GridBooleanCell.js +4 -3
- package/modern/components/cell/GridEditBooleanCell.js +4 -3
- package/modern/components/cell/GridEditDateCell.js +4 -3
- package/modern/components/cell/GridEditInputCell.js +4 -3
- package/modern/components/cell/GridEditSingleSelectCell.js +9 -7
- package/modern/components/panel/GridColumnsPanel.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +12 -5
- package/modern/hooks/features/filter/gridFilterUtils.js +8 -5
- package/modern/hooks/features/rows/useGridRows.js +15 -2
- package/modern/index.js +1 -1
- package/modern/locales/index.js +1 -0
- package/modern/locales/svSE.js +116 -0
- package/node/components/cell/GridBooleanCell.js +5 -3
- package/node/components/cell/GridEditBooleanCell.js +5 -3
- package/node/components/cell/GridEditDateCell.js +5 -3
- package/node/components/cell/GridEditInputCell.js +5 -3
- package/node/components/cell/GridEditSingleSelectCell.js +10 -7
- package/node/components/panel/GridColumnsPanel.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +12 -5
- package/node/hooks/features/filter/gridFilterUtils.js +7 -4
- package/node/hooks/features/rows/useGridRows.js +15 -2
- package/node/index.js +1 -1
- package/node/locales/index.js +13 -0
- package/node/locales/svSE.js +126 -0
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import { GridLinkOperator } from '../../../models';
|
|
3
3
|
import { buildWarning } from '../../../utils/warning';
|
|
4
|
-
import { gridColumnFieldsSelector } from '../columns';
|
|
4
|
+
import { gridColumnFieldsSelector, gridColumnLookupSelector } from '../columns';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Adds default values to the optional fields of a filter items.
|
|
@@ -18,8 +18,9 @@ export const cleanFilterItem = (item, apiRef) => {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
if (cleanItem.operatorValue == null) {
|
|
21
|
-
//
|
|
22
|
-
|
|
21
|
+
// Selects a default operator
|
|
22
|
+
// We don't use `apiRef.current.getColumn` because it is not ready during state initialization
|
|
23
|
+
const column = gridColumnLookupSelector(apiRef)[cleanItem.columnField];
|
|
23
24
|
cleanItem.operatorValue = column && column.filterOperators[0].value;
|
|
24
25
|
}
|
|
25
26
|
|
|
@@ -183,14 +184,16 @@ export const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
|
183
184
|
const sanitizedQuickFilterValues = quickFilterValues.filter((value, index) => Object.keys(appliersPerColumnField).some(field => appliersPerColumnField[field][index] != null));
|
|
184
185
|
return (rowId, shouldApplyFilter) => {
|
|
185
186
|
const usedCellParams = {};
|
|
187
|
+
const columnsFieldsToFilter = [];
|
|
186
188
|
Object.keys(appliersPerColumnField).forEach(columnField => {
|
|
187
189
|
if (!shouldApplyFilter || shouldApplyFilter(columnField)) {
|
|
188
190
|
usedCellParams[columnField] = apiRef.current.getCellParams(rowId, columnField);
|
|
191
|
+
columnsFieldsToFilter.push(columnField);
|
|
189
192
|
}
|
|
190
193
|
}); // Return `false` as soon as we have a quick filter value that does not match any column
|
|
191
194
|
|
|
192
195
|
if (quickFilterLogicOperator === GridLinkOperator.And) {
|
|
193
|
-
return sanitizedQuickFilterValues.every((value, index) =>
|
|
196
|
+
return sanitizedQuickFilterValues.every((value, index) => columnsFieldsToFilter.some(field => {
|
|
194
197
|
if (appliersPerColumnField[field][index] == null) {
|
|
195
198
|
return false;
|
|
196
199
|
}
|
|
@@ -200,7 +203,7 @@ export const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
|
200
203
|
} // Return `true` as soon as we have have a quick filter value that match any column
|
|
201
204
|
|
|
202
205
|
|
|
203
|
-
return sanitizedQuickFilterValues.some((value, index) =>
|
|
206
|
+
return sanitizedQuickFilterValues.some((value, index) => columnsFieldsToFilter.some(field => {
|
|
204
207
|
if (appliersPerColumnField[field][index] == null) {
|
|
205
208
|
return false;
|
|
206
209
|
}
|
|
@@ -315,10 +315,23 @@ export const useGridRows = (apiRef, props) => {
|
|
|
315
315
|
if (isFirstRender.current) {
|
|
316
316
|
isFirstRender.current = false;
|
|
317
317
|
return;
|
|
318
|
-
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
const areNewRowsAlreadyInState = apiRef.current.unstable_caches.rows.rowsBeforePartialUpdates === props.rows;
|
|
321
|
+
const isNewLoadingAlreadyInState = apiRef.current.unstable_caches.rows.loadingPropBeforePartialUpdates === props.loading; // The new rows have already been applied (most likely in the `'rowGroupsPreProcessingChange'` listener)
|
|
319
322
|
|
|
323
|
+
if (areNewRowsAlreadyInState) {
|
|
324
|
+
// If the loading prop has changed, we need to update its value in the state because it won't be done by `throttledRowsChange`
|
|
325
|
+
if (!isNewLoadingAlreadyInState) {
|
|
326
|
+
apiRef.current.setState(state => _extends({}, state, {
|
|
327
|
+
rows: _extends({}, state.rows, {
|
|
328
|
+
loading: props.loading
|
|
329
|
+
})
|
|
330
|
+
}));
|
|
331
|
+
apiRef.current.unstable_caches.rows.loadingPropBeforePartialUpdates = props.loading;
|
|
332
|
+
apiRef.current.forceUpdate();
|
|
333
|
+
}
|
|
320
334
|
|
|
321
|
-
if (apiRef.current.unstable_caches.rows.rowsBeforePartialUpdates === props.rows && apiRef.current.unstable_caches.rows.loadingPropBeforePartialUpdates === props.loading) {
|
|
322
335
|
return;
|
|
323
336
|
}
|
|
324
337
|
|
package/modern/index.js
CHANGED
package/modern/locales/index.js
CHANGED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { svSE as svSECore } from '@mui/material/locale';
|
|
2
|
+
import { getGridLocalization } from '../utils/getGridLocalization';
|
|
3
|
+
const svSEGrid = {
|
|
4
|
+
// Root
|
|
5
|
+
noRowsLabel: 'Inga rader',
|
|
6
|
+
noResultsOverlayLabel: 'Inga resultat funna.',
|
|
7
|
+
errorOverlayDefaultLabel: 'Ett fel uppstod.',
|
|
8
|
+
// Density selector toolbar button text
|
|
9
|
+
toolbarDensity: 'Densitet',
|
|
10
|
+
toolbarDensityLabel: 'Densitet',
|
|
11
|
+
toolbarDensityCompact: 'Kompakt',
|
|
12
|
+
toolbarDensityStandard: 'Standard',
|
|
13
|
+
toolbarDensityComfortable: 'Bekväm',
|
|
14
|
+
// Columns selector toolbar button text
|
|
15
|
+
toolbarColumns: 'Kolumner',
|
|
16
|
+
toolbarColumnsLabel: 'Välj kolumner',
|
|
17
|
+
// Filters toolbar button text
|
|
18
|
+
toolbarFilters: 'Filter',
|
|
19
|
+
toolbarFiltersLabel: 'Visa filter',
|
|
20
|
+
toolbarFiltersTooltipHide: 'Dölj filter',
|
|
21
|
+
toolbarFiltersTooltipShow: 'Visa filter',
|
|
22
|
+
toolbarFiltersTooltipActive: count => count !== 1 ? `${count} aktiva filter` : `${count} aktivt filter`,
|
|
23
|
+
// Quick filter toolbar field
|
|
24
|
+
toolbarQuickFilterPlaceholder: 'Sök...',
|
|
25
|
+
toolbarQuickFilterLabel: 'Sök',
|
|
26
|
+
toolbarQuickFilterDeleteIconLabel: 'Rensa',
|
|
27
|
+
// Export selector toolbar button text
|
|
28
|
+
toolbarExport: 'Exportera',
|
|
29
|
+
toolbarExportLabel: 'Exportera',
|
|
30
|
+
toolbarExportCSV: 'Ladda ner som CSV',
|
|
31
|
+
toolbarExportPrint: 'Skriv ut',
|
|
32
|
+
toolbarExportExcel: 'Ladda ner som Excel',
|
|
33
|
+
// Columns panel text
|
|
34
|
+
columnsPanelTextFieldLabel: 'Hitta kolumn',
|
|
35
|
+
columnsPanelTextFieldPlaceholder: 'Kolumntitel',
|
|
36
|
+
columnsPanelDragIconLabel: 'Ordna om kolumnen',
|
|
37
|
+
columnsPanelShowAllButton: 'Visa alla',
|
|
38
|
+
columnsPanelHideAllButton: 'Dölj alla',
|
|
39
|
+
// Filter panel text
|
|
40
|
+
filterPanelAddFilter: 'Lägg till filter',
|
|
41
|
+
filterPanelDeleteIconLabel: 'Ta bort',
|
|
42
|
+
filterPanelLinkOperator: 'Logisk operatör',
|
|
43
|
+
filterPanelOperators: 'Operatör',
|
|
44
|
+
// TODO v6: rename to filterPanelOperator
|
|
45
|
+
filterPanelOperatorAnd: 'Och',
|
|
46
|
+
filterPanelOperatorOr: 'Eller',
|
|
47
|
+
filterPanelColumns: 'Kolumner',
|
|
48
|
+
filterPanelInputLabel: 'Värde',
|
|
49
|
+
filterPanelInputPlaceholder: 'Filtervärde',
|
|
50
|
+
// Filter operators text
|
|
51
|
+
filterOperatorContains: 'innehåller',
|
|
52
|
+
filterOperatorEquals: 'är lika med',
|
|
53
|
+
filterOperatorStartsWith: 'börjar med',
|
|
54
|
+
filterOperatorEndsWith: 'slutar med',
|
|
55
|
+
filterOperatorIs: 'är',
|
|
56
|
+
filterOperatorNot: 'är inte',
|
|
57
|
+
filterOperatorAfter: 'är efter',
|
|
58
|
+
filterOperatorOnOrAfter: 'är på eller efter',
|
|
59
|
+
filterOperatorBefore: 'är innan',
|
|
60
|
+
filterOperatorOnOrBefore: 'är på eller innan',
|
|
61
|
+
filterOperatorIsEmpty: 'är tom',
|
|
62
|
+
filterOperatorIsNotEmpty: 'är inte tom',
|
|
63
|
+
filterOperatorIsAnyOf: 'är någon av',
|
|
64
|
+
// Filter values text
|
|
65
|
+
filterValueAny: 'något',
|
|
66
|
+
filterValueTrue: 'sant',
|
|
67
|
+
filterValueFalse: 'falskt',
|
|
68
|
+
// Column menu text
|
|
69
|
+
columnMenuLabel: 'Meny',
|
|
70
|
+
columnMenuShowColumns: 'Visa kolumner',
|
|
71
|
+
columnMenuFilter: 'Filtrera',
|
|
72
|
+
columnMenuHideColumn: 'Dölj',
|
|
73
|
+
columnMenuUnsort: 'Osortera',
|
|
74
|
+
columnMenuSortAsc: 'Sortera stigande',
|
|
75
|
+
columnMenuSortDesc: 'Sortera fallande',
|
|
76
|
+
// Column header text
|
|
77
|
+
columnHeaderFiltersTooltipActive: count => count !== 1 ? `${count} aktiva filter` : `${count} aktivt filter`,
|
|
78
|
+
columnHeaderFiltersLabel: 'Visa filter',
|
|
79
|
+
columnHeaderSortIconLabel: 'Sortera',
|
|
80
|
+
// Rows selected footer text
|
|
81
|
+
footerRowSelected: count => count !== 1 ? `${count.toLocaleString()} rader markerade` : `${count.toLocaleString()} rad markerad`,
|
|
82
|
+
// Total row amount footer text
|
|
83
|
+
footerTotalRows: 'Totalt antal rader:',
|
|
84
|
+
// Total visible row amount footer text
|
|
85
|
+
footerTotalVisibleRows: (visibleCount, totalCount) => `${visibleCount.toLocaleString()} av ${totalCount.toLocaleString()}`,
|
|
86
|
+
// Checkbox selection text
|
|
87
|
+
checkboxSelectionHeaderName: 'Markering med kryssruta',
|
|
88
|
+
checkboxSelectionSelectAllRows: 'Markera alla rader',
|
|
89
|
+
checkboxSelectionUnselectAllRows: 'Avmarkera alla rader',
|
|
90
|
+
checkboxSelectionSelectRow: 'Markera rad',
|
|
91
|
+
checkboxSelectionUnselectRow: 'Avmarkera rad',
|
|
92
|
+
// Boolean cell text
|
|
93
|
+
booleanCellTrueLabel: 'ja',
|
|
94
|
+
booleanCellFalseLabel: 'nej',
|
|
95
|
+
// Actions cell more text
|
|
96
|
+
actionsCellMore: 'mer',
|
|
97
|
+
// Column pinning text
|
|
98
|
+
pinToLeft: 'Fäst till vänster',
|
|
99
|
+
pinToRight: 'Fäst till höger',
|
|
100
|
+
unpin: 'Ta bort fäste',
|
|
101
|
+
// Tree Data
|
|
102
|
+
treeDataGroupingHeaderName: 'Grupp',
|
|
103
|
+
treeDataExpand: 'visa underordnade',
|
|
104
|
+
treeDataCollapse: 'dölj underordnade',
|
|
105
|
+
// Grouping columns
|
|
106
|
+
groupingColumnHeaderName: 'Grupp',
|
|
107
|
+
groupColumn: name => `Gruppera efter ${name}`,
|
|
108
|
+
unGroupColumn: name => `Sluta gruppera efter ${name}`,
|
|
109
|
+
// Master/detail
|
|
110
|
+
// detailPanelToggle: 'Detail panel toggle',
|
|
111
|
+
expandDetailPanel: 'Expandera',
|
|
112
|
+
collapseDetailPanel: 'Kollapsa',
|
|
113
|
+
// Row reordering text
|
|
114
|
+
rowReorderingHeaderName: 'Ordna om rader'
|
|
115
|
+
};
|
|
116
|
+
export const svSE = getGridLocalization(svSEGrid, svSECore);
|
|
@@ -19,6 +19,8 @@ var _gridClasses = require("../../constants/gridClasses");
|
|
|
19
19
|
|
|
20
20
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
21
21
|
|
|
22
|
+
var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
|
|
23
|
+
|
|
22
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
25
|
|
|
24
26
|
const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "hasFocus", "tabIndex", "getValue"];
|
|
@@ -39,10 +41,10 @@ const useUtilityClasses = ownerState => {
|
|
|
39
41
|
|
|
40
42
|
const GridBooleanCell = /*#__PURE__*/React.memo(props => {
|
|
41
43
|
const {
|
|
42
|
-
value
|
|
43
|
-
api
|
|
44
|
+
value
|
|
44
45
|
} = props,
|
|
45
46
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
47
|
+
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
46
48
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
47
49
|
const ownerState = {
|
|
48
50
|
classes: rootProps.classes
|
|
@@ -52,7 +54,7 @@ const GridBooleanCell = /*#__PURE__*/React.memo(props => {
|
|
|
52
54
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Icon, (0, _extends2.default)({
|
|
53
55
|
fontSize: "small",
|
|
54
56
|
className: classes.root,
|
|
55
|
-
titleAccess:
|
|
57
|
+
titleAccess: apiRef.current.getLocaleText(value ? 'booleanCellTrueLabel' : 'booleanCellFalseLabel'),
|
|
56
58
|
"data-value": Boolean(value)
|
|
57
59
|
}, other));
|
|
58
60
|
});
|
|
@@ -26,6 +26,8 @@ var _gridClasses = require("../../constants/gridClasses");
|
|
|
26
26
|
|
|
27
27
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
28
28
|
|
|
29
|
+
var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
|
|
30
|
+
|
|
29
31
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
30
32
|
|
|
31
33
|
const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "className", "getValue", "hasFocus", "isValidating", "isProcessingProps", "error", "onValueChange"];
|
|
@@ -50,13 +52,13 @@ function GridEditBooleanCell(props) {
|
|
|
50
52
|
const {
|
|
51
53
|
id: idProp,
|
|
52
54
|
value,
|
|
53
|
-
api,
|
|
54
55
|
field,
|
|
55
56
|
className,
|
|
56
57
|
hasFocus,
|
|
57
58
|
onValueChange
|
|
58
59
|
} = props,
|
|
59
60
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
61
|
+
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
60
62
|
const inputRef = React.useRef(null);
|
|
61
63
|
const id = (0, _utils.unstable_useId)();
|
|
62
64
|
const [valueState, setValueState] = React.useState(value);
|
|
@@ -73,12 +75,12 @@ function GridEditBooleanCell(props) {
|
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
setValueState(newValue);
|
|
76
|
-
await
|
|
78
|
+
await apiRef.current.setEditCellValue({
|
|
77
79
|
id: idProp,
|
|
78
80
|
field,
|
|
79
81
|
value: newValue
|
|
80
82
|
}, event);
|
|
81
|
-
}, [
|
|
83
|
+
}, [apiRef, field, idProp, onValueChange]);
|
|
82
84
|
React.useEffect(() => {
|
|
83
85
|
setValueState(value);
|
|
84
86
|
}, [value]);
|
|
@@ -26,6 +26,8 @@ var _gridClasses = require("../../constants/gridClasses");
|
|
|
26
26
|
|
|
27
27
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
28
28
|
|
|
29
|
+
var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
|
|
30
|
+
|
|
29
31
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
30
32
|
|
|
31
33
|
const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "hasFocus", "getValue", "inputProps", "isValidating", "isProcessingProps", "onValueChange"];
|
|
@@ -48,7 +50,6 @@ function GridEditDateCell(props) {
|
|
|
48
50
|
const {
|
|
49
51
|
id,
|
|
50
52
|
value: valueProp,
|
|
51
|
-
api,
|
|
52
53
|
field,
|
|
53
54
|
colDef,
|
|
54
55
|
hasFocus,
|
|
@@ -57,6 +58,7 @@ function GridEditDateCell(props) {
|
|
|
57
58
|
} = props,
|
|
58
59
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
59
60
|
const isDateTime = colDef.type === 'dateTime';
|
|
61
|
+
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
60
62
|
const inputRef = React.useRef();
|
|
61
63
|
const valueTransformed = React.useMemo(() => {
|
|
62
64
|
let parsedDate;
|
|
@@ -116,12 +118,12 @@ function GridEditDateCell(props) {
|
|
|
116
118
|
parsed: newParsedDate,
|
|
117
119
|
formatted: newFormattedDate
|
|
118
120
|
});
|
|
119
|
-
|
|
121
|
+
apiRef.current.setEditCellValue({
|
|
120
122
|
id,
|
|
121
123
|
field,
|
|
122
124
|
value: newParsedDate
|
|
123
125
|
}, event);
|
|
124
|
-
}, [
|
|
126
|
+
}, [apiRef, field, id, onValueChange]);
|
|
125
127
|
React.useEffect(() => {
|
|
126
128
|
setValueState(state => {
|
|
127
129
|
var _valueTransformed$par, _state$parsed;
|
|
@@ -32,6 +32,8 @@ var _index = require("../icons/index");
|
|
|
32
32
|
|
|
33
33
|
var _GridFilterInputValue = require("../panel/filterPanel/GridFilterInputValue");
|
|
34
34
|
|
|
35
|
+
var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
|
|
36
|
+
|
|
35
37
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
36
38
|
|
|
37
39
|
const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "hasFocus", "getValue", "isValidating", "debounceMs", "isProcessingProps", "onValueChange"];
|
|
@@ -71,7 +73,6 @@ function GridEditInputCell(props) {
|
|
|
71
73
|
const {
|
|
72
74
|
id,
|
|
73
75
|
value,
|
|
74
|
-
api,
|
|
75
76
|
field,
|
|
76
77
|
colDef,
|
|
77
78
|
hasFocus,
|
|
@@ -80,6 +81,7 @@ function GridEditInputCell(props) {
|
|
|
80
81
|
onValueChange
|
|
81
82
|
} = props,
|
|
82
83
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
84
|
+
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
83
85
|
const inputRef = React.useRef();
|
|
84
86
|
const [valueState, setValueState] = React.useState(value);
|
|
85
87
|
const ownerState = {
|
|
@@ -94,13 +96,13 @@ function GridEditInputCell(props) {
|
|
|
94
96
|
}
|
|
95
97
|
|
|
96
98
|
setValueState(newValue);
|
|
97
|
-
|
|
99
|
+
apiRef.current.setEditCellValue({
|
|
98
100
|
id,
|
|
99
101
|
field,
|
|
100
102
|
value: newValue,
|
|
101
103
|
debounceMs
|
|
102
104
|
}, event);
|
|
103
|
-
}, [
|
|
105
|
+
}, [apiRef, debounceMs, field, id, onValueChange]);
|
|
104
106
|
React.useEffect(() => {
|
|
105
107
|
setValueState(value);
|
|
106
108
|
}, [value]);
|
|
@@ -28,6 +28,8 @@ var _gridEditRowModel = require("../../models/gridEditRowModel");
|
|
|
28
28
|
|
|
29
29
|
var _filterPanelUtils = require("../panel/filterPanel/filterPanelUtils");
|
|
30
30
|
|
|
31
|
+
var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
|
|
32
|
+
|
|
31
33
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
32
34
|
|
|
33
35
|
const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "className", "getValue", "hasFocus", "isValidating", "isProcessingProps", "error", "onValueChange"];
|
|
@@ -62,6 +64,7 @@ function GridEditSingleSelectCell(props) {
|
|
|
62
64
|
onValueChange
|
|
63
65
|
} = props,
|
|
64
66
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
67
|
+
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
65
68
|
const ref = React.useRef();
|
|
66
69
|
const inputRef = React.useRef();
|
|
67
70
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
@@ -110,7 +113,7 @@ function GridEditSingleSelectCell(props) {
|
|
|
110
113
|
await onValueChange(event, formattedTargetValue);
|
|
111
114
|
}
|
|
112
115
|
|
|
113
|
-
const isValid = await
|
|
116
|
+
const isValid = await apiRef.current.setEditCellValue({
|
|
114
117
|
id,
|
|
115
118
|
field,
|
|
116
119
|
value: formattedTargetValue
|
|
@@ -125,18 +128,18 @@ function GridEditSingleSelectCell(props) {
|
|
|
125
128
|
return;
|
|
126
129
|
}
|
|
127
130
|
|
|
128
|
-
const canCommit = await Promise.resolve(
|
|
131
|
+
const canCommit = await Promise.resolve(apiRef.current.commitCellChange({
|
|
129
132
|
id,
|
|
130
133
|
field
|
|
131
134
|
}, event));
|
|
132
135
|
|
|
133
136
|
if (canCommit) {
|
|
134
|
-
|
|
137
|
+
apiRef.current.setCellMode(id, field, 'view');
|
|
135
138
|
|
|
136
139
|
if (event.key) {
|
|
137
140
|
// TODO v6: remove once we stop ignoring events fired from portals
|
|
138
|
-
const params =
|
|
139
|
-
|
|
141
|
+
const params = apiRef.current.getCellParams(id, field);
|
|
142
|
+
apiRef.current.publishEvent('cellNavigationKeyDown', params, event);
|
|
140
143
|
}
|
|
141
144
|
}
|
|
142
145
|
};
|
|
@@ -151,13 +154,13 @@ function GridEditSingleSelectCell(props) {
|
|
|
151
154
|
var _rootProps$experiment2;
|
|
152
155
|
|
|
153
156
|
if ((_rootProps$experiment2 = rootProps.experimentalFeatures) != null && _rootProps$experiment2.newEditingApi) {
|
|
154
|
-
|
|
157
|
+
apiRef.current.stopCellEditMode({
|
|
155
158
|
id,
|
|
156
159
|
field,
|
|
157
160
|
ignoreModifications: true
|
|
158
161
|
});
|
|
159
162
|
} else {
|
|
160
|
-
|
|
163
|
+
apiRef.current.setCellMode(id, field, 'view');
|
|
161
164
|
}
|
|
162
165
|
}
|
|
163
166
|
};
|
|
@@ -112,7 +112,7 @@ function GridColumnsPanel(props) {
|
|
|
112
112
|
return apiRef.current.setColumnVisibilityModel({});
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
return apiRef.current.setColumnVisibilityModel(Object.fromEntries(columns.map(col => [col.field, false])));
|
|
115
|
+
return apiRef.current.setColumnVisibilityModel(Object.fromEntries(columns.filter(col => col.hideable !== false).map(col => [col.field, false])));
|
|
116
116
|
} // TODO v6: Remove
|
|
117
117
|
|
|
118
118
|
|
|
@@ -48,9 +48,17 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
48
48
|
const id = (0, _utils.unstable_useId)();
|
|
49
49
|
const resolvedColumn = item.columnField ? apiRef.current.getColumn(item.columnField) : null;
|
|
50
50
|
const resolvedValueOptions = React.useMemo(() => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
51
|
+
if (!(resolvedColumn != null && resolvedColumn.valueOptions)) {
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (typeof resolvedColumn.valueOptions === 'function') {
|
|
56
|
+
return resolvedColumn.valueOptions({
|
|
57
|
+
field: resolvedColumn.field
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return resolvedColumn.valueOptions;
|
|
54
62
|
}, [resolvedColumn]);
|
|
55
63
|
const resolvedFormattedValueOptions = React.useMemo(() => {
|
|
56
64
|
return resolvedValueOptions == null ? void 0 : resolvedValueOptions.map(_filterPanelUtils.getValueFromOption);
|
|
@@ -107,8 +115,7 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
107
115
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Autocomplete.default, (0, _extends2.default)({
|
|
108
116
|
multiple: true,
|
|
109
117
|
limitTags: 1,
|
|
110
|
-
options: resolvedValueOptions
|
|
111
|
-
,
|
|
118
|
+
options: resolvedValueOptions,
|
|
112
119
|
isOptionEqualToValue: isOptionEqualToValue,
|
|
113
120
|
filterOptions: filter,
|
|
114
121
|
id: id,
|
|
@@ -30,8 +30,9 @@ const cleanFilterItem = (item, apiRef) => {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
if (cleanItem.operatorValue == null) {
|
|
33
|
-
//
|
|
34
|
-
|
|
33
|
+
// Selects a default operator
|
|
34
|
+
// We don't use `apiRef.current.getColumn` because it is not ready during state initialization
|
|
35
|
+
const column = (0, _columns.gridColumnLookupSelector)(apiRef)[cleanItem.columnField];
|
|
35
36
|
cleanItem.operatorValue = column && column.filterOperators[0].value;
|
|
36
37
|
}
|
|
37
38
|
|
|
@@ -208,14 +209,16 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
|
208
209
|
const sanitizedQuickFilterValues = quickFilterValues.filter((value, index) => Object.keys(appliersPerColumnField).some(field => appliersPerColumnField[field][index] != null));
|
|
209
210
|
return (rowId, shouldApplyFilter) => {
|
|
210
211
|
const usedCellParams = {};
|
|
212
|
+
const columnsFieldsToFilter = [];
|
|
211
213
|
Object.keys(appliersPerColumnField).forEach(columnField => {
|
|
212
214
|
if (!shouldApplyFilter || shouldApplyFilter(columnField)) {
|
|
213
215
|
usedCellParams[columnField] = apiRef.current.getCellParams(rowId, columnField);
|
|
216
|
+
columnsFieldsToFilter.push(columnField);
|
|
214
217
|
}
|
|
215
218
|
}); // Return `false` as soon as we have a quick filter value that does not match any column
|
|
216
219
|
|
|
217
220
|
if (quickFilterLogicOperator === _models.GridLinkOperator.And) {
|
|
218
|
-
return sanitizedQuickFilterValues.every((value, index) =>
|
|
221
|
+
return sanitizedQuickFilterValues.every((value, index) => columnsFieldsToFilter.some(field => {
|
|
219
222
|
var _appliersPerColumnFie, _appliersPerColumnFie2;
|
|
220
223
|
|
|
221
224
|
if (appliersPerColumnField[field][index] == null) {
|
|
@@ -227,7 +230,7 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
|
227
230
|
} // Return `true` as soon as we have have a quick filter value that match any column
|
|
228
231
|
|
|
229
232
|
|
|
230
|
-
return sanitizedQuickFilterValues.some((value, index) =>
|
|
233
|
+
return sanitizedQuickFilterValues.some((value, index) => columnsFieldsToFilter.some(field => {
|
|
231
234
|
var _appliersPerColumnFie3, _appliersPerColumnFie4;
|
|
232
235
|
|
|
233
236
|
if (appliersPerColumnField[field][index] == null) {
|
|
@@ -349,10 +349,23 @@ const useGridRows = (apiRef, props) => {
|
|
|
349
349
|
if (isFirstRender.current) {
|
|
350
350
|
isFirstRender.current = false;
|
|
351
351
|
return;
|
|
352
|
-
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
const areNewRowsAlreadyInState = apiRef.current.unstable_caches.rows.rowsBeforePartialUpdates === props.rows;
|
|
355
|
+
const isNewLoadingAlreadyInState = apiRef.current.unstable_caches.rows.loadingPropBeforePartialUpdates === props.loading; // The new rows have already been applied (most likely in the `'rowGroupsPreProcessingChange'` listener)
|
|
353
356
|
|
|
357
|
+
if (areNewRowsAlreadyInState) {
|
|
358
|
+
// If the loading prop has changed, we need to update its value in the state because it won't be done by `throttledRowsChange`
|
|
359
|
+
if (!isNewLoadingAlreadyInState) {
|
|
360
|
+
apiRef.current.setState(state => (0, _extends2.default)({}, state, {
|
|
361
|
+
rows: (0, _extends2.default)({}, state.rows, {
|
|
362
|
+
loading: props.loading
|
|
363
|
+
})
|
|
364
|
+
}));
|
|
365
|
+
apiRef.current.unstable_caches.rows.loadingPropBeforePartialUpdates = props.loading;
|
|
366
|
+
apiRef.current.forceUpdate();
|
|
367
|
+
}
|
|
354
368
|
|
|
355
|
-
if (apiRef.current.unstable_caches.rows.rowsBeforePartialUpdates === props.rows && apiRef.current.unstable_caches.rows.loadingPropBeforePartialUpdates === props.loading) {
|
|
356
369
|
return;
|
|
357
370
|
}
|
|
358
371
|
|
package/node/index.js
CHANGED
package/node/locales/index.js
CHANGED
|
@@ -277,6 +277,19 @@ Object.keys(_skSK).forEach(function (key) {
|
|
|
277
277
|
});
|
|
278
278
|
});
|
|
279
279
|
|
|
280
|
+
var _svSE = require("./svSE");
|
|
281
|
+
|
|
282
|
+
Object.keys(_svSE).forEach(function (key) {
|
|
283
|
+
if (key === "default" || key === "__esModule") return;
|
|
284
|
+
if (key in exports && exports[key] === _svSE[key]) return;
|
|
285
|
+
Object.defineProperty(exports, key, {
|
|
286
|
+
enumerable: true,
|
|
287
|
+
get: function () {
|
|
288
|
+
return _svSE[key];
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
|
|
280
293
|
var _trTR = require("./trTR");
|
|
281
294
|
|
|
282
295
|
Object.keys(_trTR).forEach(function (key) {
|