@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
|
@@ -91,7 +91,9 @@ export function GridColumnsPanel(props) {
|
|
|
91
91
|
return apiRef.current.setColumnVisibilityModel({});
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
return apiRef.current.setColumnVisibilityModel(Object.fromEntries(columns.
|
|
94
|
+
return apiRef.current.setColumnVisibilityModel(Object.fromEntries(columns.filter(function (col) {
|
|
95
|
+
return col.hideable !== false;
|
|
96
|
+
}).map(function (col) {
|
|
95
97
|
return [col.field, false];
|
|
96
98
|
})));
|
|
97
99
|
} // TODO v6: Remove
|
|
@@ -29,9 +29,17 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
29
29
|
var id = useId();
|
|
30
30
|
var resolvedColumn = item.columnField ? apiRef.current.getColumn(item.columnField) : null;
|
|
31
31
|
var resolvedValueOptions = React.useMemo(function () {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
32
|
+
if (!(resolvedColumn != null && resolvedColumn.valueOptions)) {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (typeof resolvedColumn.valueOptions === 'function') {
|
|
37
|
+
return resolvedColumn.valueOptions({
|
|
38
|
+
field: resolvedColumn.field
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return resolvedColumn.valueOptions;
|
|
35
43
|
}, [resolvedColumn]);
|
|
36
44
|
var resolvedFormattedValueOptions = React.useMemo(function () {
|
|
37
45
|
return resolvedValueOptions == null ? void 0 : resolvedValueOptions.map(getValueFromOption);
|
|
@@ -94,8 +102,7 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
94
102
|
return /*#__PURE__*/_jsx(Autocomplete, _extends({
|
|
95
103
|
multiple: true,
|
|
96
104
|
limitTags: 1,
|
|
97
|
-
options: resolvedValueOptions
|
|
98
|
-
,
|
|
105
|
+
options: resolvedValueOptions,
|
|
99
106
|
isOptionEqualToValue: isOptionEqualToValue,
|
|
100
107
|
filterOptions: filter,
|
|
101
108
|
id: id,
|
|
@@ -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 var cleanFilterItem = function 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
|
+
var column = gridColumnLookupSelector(apiRef)[cleanItem.columnField];
|
|
23
24
|
cleanItem.operatorValue = column && column.filterOperators[0].value;
|
|
24
25
|
}
|
|
25
26
|
|
|
@@ -212,15 +213,17 @@ export var buildAggregatedQuickFilterApplier = function buildAggregatedQuickFilt
|
|
|
212
213
|
});
|
|
213
214
|
return function (rowId, shouldApplyFilter) {
|
|
214
215
|
var usedCellParams = {};
|
|
216
|
+
var columnsFieldsToFilter = [];
|
|
215
217
|
Object.keys(appliersPerColumnField).forEach(function (columnField) {
|
|
216
218
|
if (!shouldApplyFilter || shouldApplyFilter(columnField)) {
|
|
217
219
|
usedCellParams[columnField] = apiRef.current.getCellParams(rowId, columnField);
|
|
220
|
+
columnsFieldsToFilter.push(columnField);
|
|
218
221
|
}
|
|
219
222
|
}); // Return `false` as soon as we have a quick filter value that does not match any column
|
|
220
223
|
|
|
221
224
|
if (quickFilterLogicOperator === GridLinkOperator.And) {
|
|
222
225
|
return sanitizedQuickFilterValues.every(function (value, index) {
|
|
223
|
-
return
|
|
226
|
+
return columnsFieldsToFilter.some(function (field) {
|
|
224
227
|
var _appliersPerColumnFie, _appliersPerColumnFie2;
|
|
225
228
|
|
|
226
229
|
if (appliersPerColumnField[field][index] == null) {
|
|
@@ -234,7 +237,7 @@ export var buildAggregatedQuickFilterApplier = function buildAggregatedQuickFilt
|
|
|
234
237
|
|
|
235
238
|
|
|
236
239
|
return sanitizedQuickFilterValues.some(function (value, index) {
|
|
237
|
-
return
|
|
240
|
+
return columnsFieldsToFilter.some(function (field) {
|
|
238
241
|
var _appliersPerColumnFie3, _appliersPerColumnFie4;
|
|
239
242
|
|
|
240
243
|
if (appliersPerColumnField[field][index] == null) {
|
|
@@ -348,10 +348,25 @@ export var useGridRows = function useGridRows(apiRef, props) {
|
|
|
348
348
|
if (isFirstRender.current) {
|
|
349
349
|
isFirstRender.current = false;
|
|
350
350
|
return;
|
|
351
|
-
}
|
|
351
|
+
}
|
|
352
352
|
|
|
353
|
+
var areNewRowsAlreadyInState = apiRef.current.unstable_caches.rows.rowsBeforePartialUpdates === props.rows;
|
|
354
|
+
var isNewLoadingAlreadyInState = apiRef.current.unstable_caches.rows.loadingPropBeforePartialUpdates === props.loading; // The new rows have already been applied (most likely in the `'rowGroupsPreProcessingChange'` listener)
|
|
355
|
+
|
|
356
|
+
if (areNewRowsAlreadyInState) {
|
|
357
|
+
// If the loading prop has changed, we need to update its value in the state because it won't be done by `throttledRowsChange`
|
|
358
|
+
if (!isNewLoadingAlreadyInState) {
|
|
359
|
+
apiRef.current.setState(function (state) {
|
|
360
|
+
return _extends({}, state, {
|
|
361
|
+
rows: _extends({}, state.rows, {
|
|
362
|
+
loading: props.loading
|
|
363
|
+
})
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
apiRef.current.unstable_caches.rows.loadingPropBeforePartialUpdates = props.loading;
|
|
367
|
+
apiRef.current.forceUpdate();
|
|
368
|
+
}
|
|
353
369
|
|
|
354
|
-
if (apiRef.current.unstable_caches.rows.rowsBeforePartialUpdates === props.rows && apiRef.current.unstable_caches.rows.loadingPropBeforePartialUpdates === props.loading) {
|
|
355
370
|
return;
|
|
356
371
|
}
|
|
357
372
|
|
package/legacy/index.js
CHANGED
package/legacy/locales/index.js
CHANGED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { svSE as svSECore } from '@mui/material/locale';
|
|
2
|
+
import { getGridLocalization } from '../utils/getGridLocalization';
|
|
3
|
+
var 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: function toolbarFiltersTooltipActive(count) {
|
|
23
|
+
return count !== 1 ? "".concat(count, " aktiva filter") : "".concat(count, " aktivt filter");
|
|
24
|
+
},
|
|
25
|
+
// Quick filter toolbar field
|
|
26
|
+
toolbarQuickFilterPlaceholder: 'Sök...',
|
|
27
|
+
toolbarQuickFilterLabel: 'Sök',
|
|
28
|
+
toolbarQuickFilterDeleteIconLabel: 'Rensa',
|
|
29
|
+
// Export selector toolbar button text
|
|
30
|
+
toolbarExport: 'Exportera',
|
|
31
|
+
toolbarExportLabel: 'Exportera',
|
|
32
|
+
toolbarExportCSV: 'Ladda ner som CSV',
|
|
33
|
+
toolbarExportPrint: 'Skriv ut',
|
|
34
|
+
toolbarExportExcel: 'Ladda ner som Excel',
|
|
35
|
+
// Columns panel text
|
|
36
|
+
columnsPanelTextFieldLabel: 'Hitta kolumn',
|
|
37
|
+
columnsPanelTextFieldPlaceholder: 'Kolumntitel',
|
|
38
|
+
columnsPanelDragIconLabel: 'Ordna om kolumnen',
|
|
39
|
+
columnsPanelShowAllButton: 'Visa alla',
|
|
40
|
+
columnsPanelHideAllButton: 'Dölj alla',
|
|
41
|
+
// Filter panel text
|
|
42
|
+
filterPanelAddFilter: 'Lägg till filter',
|
|
43
|
+
filterPanelDeleteIconLabel: 'Ta bort',
|
|
44
|
+
filterPanelLinkOperator: 'Logisk operatör',
|
|
45
|
+
filterPanelOperators: 'Operatör',
|
|
46
|
+
// TODO v6: rename to filterPanelOperator
|
|
47
|
+
filterPanelOperatorAnd: 'Och',
|
|
48
|
+
filterPanelOperatorOr: 'Eller',
|
|
49
|
+
filterPanelColumns: 'Kolumner',
|
|
50
|
+
filterPanelInputLabel: 'Värde',
|
|
51
|
+
filterPanelInputPlaceholder: 'Filtervärde',
|
|
52
|
+
// Filter operators text
|
|
53
|
+
filterOperatorContains: 'innehåller',
|
|
54
|
+
filterOperatorEquals: 'är lika med',
|
|
55
|
+
filterOperatorStartsWith: 'börjar med',
|
|
56
|
+
filterOperatorEndsWith: 'slutar med',
|
|
57
|
+
filterOperatorIs: 'är',
|
|
58
|
+
filterOperatorNot: 'är inte',
|
|
59
|
+
filterOperatorAfter: 'är efter',
|
|
60
|
+
filterOperatorOnOrAfter: 'är på eller efter',
|
|
61
|
+
filterOperatorBefore: 'är innan',
|
|
62
|
+
filterOperatorOnOrBefore: 'är på eller innan',
|
|
63
|
+
filterOperatorIsEmpty: 'är tom',
|
|
64
|
+
filterOperatorIsNotEmpty: 'är inte tom',
|
|
65
|
+
filterOperatorIsAnyOf: 'är någon av',
|
|
66
|
+
// Filter values text
|
|
67
|
+
filterValueAny: 'något',
|
|
68
|
+
filterValueTrue: 'sant',
|
|
69
|
+
filterValueFalse: 'falskt',
|
|
70
|
+
// Column menu text
|
|
71
|
+
columnMenuLabel: 'Meny',
|
|
72
|
+
columnMenuShowColumns: 'Visa kolumner',
|
|
73
|
+
columnMenuFilter: 'Filtrera',
|
|
74
|
+
columnMenuHideColumn: 'Dölj',
|
|
75
|
+
columnMenuUnsort: 'Osortera',
|
|
76
|
+
columnMenuSortAsc: 'Sortera stigande',
|
|
77
|
+
columnMenuSortDesc: 'Sortera fallande',
|
|
78
|
+
// Column header text
|
|
79
|
+
columnHeaderFiltersTooltipActive: function columnHeaderFiltersTooltipActive(count) {
|
|
80
|
+
return count !== 1 ? "".concat(count, " aktiva filter") : "".concat(count, " aktivt filter");
|
|
81
|
+
},
|
|
82
|
+
columnHeaderFiltersLabel: 'Visa filter',
|
|
83
|
+
columnHeaderSortIconLabel: 'Sortera',
|
|
84
|
+
// Rows selected footer text
|
|
85
|
+
footerRowSelected: function footerRowSelected(count) {
|
|
86
|
+
return count !== 1 ? "".concat(count.toLocaleString(), " rader markerade") : "".concat(count.toLocaleString(), " rad markerad");
|
|
87
|
+
},
|
|
88
|
+
// Total row amount footer text
|
|
89
|
+
footerTotalRows: 'Totalt antal rader:',
|
|
90
|
+
// Total visible row amount footer text
|
|
91
|
+
footerTotalVisibleRows: function footerTotalVisibleRows(visibleCount, totalCount) {
|
|
92
|
+
return "".concat(visibleCount.toLocaleString(), " av ").concat(totalCount.toLocaleString());
|
|
93
|
+
},
|
|
94
|
+
// Checkbox selection text
|
|
95
|
+
checkboxSelectionHeaderName: 'Markering med kryssruta',
|
|
96
|
+
checkboxSelectionSelectAllRows: 'Markera alla rader',
|
|
97
|
+
checkboxSelectionUnselectAllRows: 'Avmarkera alla rader',
|
|
98
|
+
checkboxSelectionSelectRow: 'Markera rad',
|
|
99
|
+
checkboxSelectionUnselectRow: 'Avmarkera rad',
|
|
100
|
+
// Boolean cell text
|
|
101
|
+
booleanCellTrueLabel: 'ja',
|
|
102
|
+
booleanCellFalseLabel: 'nej',
|
|
103
|
+
// Actions cell more text
|
|
104
|
+
actionsCellMore: 'mer',
|
|
105
|
+
// Column pinning text
|
|
106
|
+
pinToLeft: 'Fäst till vänster',
|
|
107
|
+
pinToRight: 'Fäst till höger',
|
|
108
|
+
unpin: 'Ta bort fäste',
|
|
109
|
+
// Tree Data
|
|
110
|
+
treeDataGroupingHeaderName: 'Grupp',
|
|
111
|
+
treeDataExpand: 'visa underordnade',
|
|
112
|
+
treeDataCollapse: 'dölj underordnade',
|
|
113
|
+
// Grouping columns
|
|
114
|
+
groupingColumnHeaderName: 'Grupp',
|
|
115
|
+
groupColumn: function groupColumn(name) {
|
|
116
|
+
return "Gruppera efter ".concat(name);
|
|
117
|
+
},
|
|
118
|
+
unGroupColumn: function unGroupColumn(name) {
|
|
119
|
+
return "Sluta gruppera efter ".concat(name);
|
|
120
|
+
},
|
|
121
|
+
// Master/detail
|
|
122
|
+
// detailPanelToggle: 'Detail panel toggle',
|
|
123
|
+
expandDetailPanel: 'Expandera',
|
|
124
|
+
collapseDetailPanel: 'Kollapsa',
|
|
125
|
+
// Row reordering text
|
|
126
|
+
rowReorderingHeaderName: 'Ordna om rader'
|
|
127
|
+
};
|
|
128
|
+
export var svSE = getGridLocalization(svSEGrid, svSECore);
|
package/locales/index.d.ts
CHANGED
package/locales/index.js
CHANGED
package/locales/svSE.js
ADDED
|
@@ -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);
|
|
@@ -5,6 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
6
6
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
7
7
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
8
|
+
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
8
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
10
|
|
|
10
11
|
const useUtilityClasses = ownerState => {
|
|
@@ -19,11 +20,11 @@ const useUtilityClasses = ownerState => {
|
|
|
19
20
|
|
|
20
21
|
export const GridBooleanCell = /*#__PURE__*/React.memo(props => {
|
|
21
22
|
const {
|
|
22
|
-
value
|
|
23
|
-
api
|
|
23
|
+
value
|
|
24
24
|
} = props,
|
|
25
25
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
26
26
|
|
|
27
|
+
const apiRef = useGridApiContext();
|
|
27
28
|
const rootProps = useGridRootProps();
|
|
28
29
|
const ownerState = {
|
|
29
30
|
classes: rootProps.classes
|
|
@@ -33,7 +34,7 @@ export const GridBooleanCell = /*#__PURE__*/React.memo(props => {
|
|
|
33
34
|
return /*#__PURE__*/_jsx(Icon, _extends({
|
|
34
35
|
fontSize: "small",
|
|
35
36
|
className: classes.root,
|
|
36
|
-
titleAccess:
|
|
37
|
+
titleAccess: apiRef.current.getLocaleText(value ? 'booleanCellTrueLabel' : 'booleanCellFalseLabel'),
|
|
37
38
|
"data-value": Boolean(value)
|
|
38
39
|
}, other));
|
|
39
40
|
});
|
|
@@ -8,6 +8,7 @@ import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
|
8
8
|
import { unstable_useId as useId, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/material/utils';
|
|
9
9
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
10
10
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
11
|
+
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
|
|
13
14
|
const useUtilityClasses = ownerState => {
|
|
@@ -24,7 +25,6 @@ function GridEditBooleanCell(props) {
|
|
|
24
25
|
const {
|
|
25
26
|
id: idProp,
|
|
26
27
|
value,
|
|
27
|
-
api,
|
|
28
28
|
field,
|
|
29
29
|
className,
|
|
30
30
|
hasFocus,
|
|
@@ -32,6 +32,7 @@ function GridEditBooleanCell(props) {
|
|
|
32
32
|
} = props,
|
|
33
33
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
34
34
|
|
|
35
|
+
const apiRef = useGridApiContext();
|
|
35
36
|
const inputRef = React.useRef(null);
|
|
36
37
|
const id = useId();
|
|
37
38
|
const [valueState, setValueState] = React.useState(value);
|
|
@@ -48,12 +49,12 @@ function GridEditBooleanCell(props) {
|
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
setValueState(newValue);
|
|
51
|
-
await
|
|
52
|
+
await apiRef.current.setEditCellValue({
|
|
52
53
|
id: idProp,
|
|
53
54
|
field,
|
|
54
55
|
value: newValue
|
|
55
56
|
}, event);
|
|
56
|
-
}, [
|
|
57
|
+
}, [apiRef, field, idProp, onValueChange]);
|
|
57
58
|
React.useEffect(() => {
|
|
58
59
|
setValueState(value);
|
|
59
60
|
}, [value]);
|
|
@@ -8,6 +8,7 @@ import { unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/material/u
|
|
|
8
8
|
import InputBase from '@mui/material/InputBase';
|
|
9
9
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
10
10
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
11
|
+
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
|
|
13
14
|
const useUtilityClasses = ownerState => {
|
|
@@ -24,7 +25,6 @@ function GridEditDateCell(props) {
|
|
|
24
25
|
const {
|
|
25
26
|
id,
|
|
26
27
|
value: valueProp,
|
|
27
|
-
api,
|
|
28
28
|
field,
|
|
29
29
|
colDef,
|
|
30
30
|
hasFocus,
|
|
@@ -34,6 +34,7 @@ function GridEditDateCell(props) {
|
|
|
34
34
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
35
35
|
|
|
36
36
|
const isDateTime = colDef.type === 'dateTime';
|
|
37
|
+
const apiRef = useGridApiContext();
|
|
37
38
|
const inputRef = React.useRef();
|
|
38
39
|
const valueTransformed = React.useMemo(() => {
|
|
39
40
|
let parsedDate;
|
|
@@ -93,12 +94,12 @@ function GridEditDateCell(props) {
|
|
|
93
94
|
parsed: newParsedDate,
|
|
94
95
|
formatted: newFormattedDate
|
|
95
96
|
});
|
|
96
|
-
|
|
97
|
+
apiRef.current.setEditCellValue({
|
|
97
98
|
id,
|
|
98
99
|
field,
|
|
99
100
|
value: newParsedDate
|
|
100
101
|
}, event);
|
|
101
|
-
}, [
|
|
102
|
+
}, [apiRef, field, id, onValueChange]);
|
|
102
103
|
React.useEffect(() => {
|
|
103
104
|
setValueState(state => {
|
|
104
105
|
if (valueTransformed.parsed !== state.parsed && valueTransformed.parsed?.getTime() !== state.parsed?.getTime()) {
|
|
@@ -11,6 +11,7 @@ import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
|
11
11
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
12
12
|
import { GridLoadIcon } from '../icons/index';
|
|
13
13
|
import { SUBMIT_FILTER_STROKE_TIME } from '../panel/filterPanel/GridFilterInputValue';
|
|
14
|
+
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
14
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
16
|
|
|
16
17
|
const useUtilityClasses = ownerState => {
|
|
@@ -43,7 +44,6 @@ function GridEditInputCell(props) {
|
|
|
43
44
|
const {
|
|
44
45
|
id,
|
|
45
46
|
value,
|
|
46
|
-
api,
|
|
47
47
|
field,
|
|
48
48
|
colDef,
|
|
49
49
|
hasFocus,
|
|
@@ -53,6 +53,7 @@ function GridEditInputCell(props) {
|
|
|
53
53
|
} = props,
|
|
54
54
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
55
55
|
|
|
56
|
+
const apiRef = useGridApiContext();
|
|
56
57
|
const inputRef = React.useRef();
|
|
57
58
|
const [valueState, setValueState] = React.useState(value);
|
|
58
59
|
const ownerState = {
|
|
@@ -67,13 +68,13 @@ function GridEditInputCell(props) {
|
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
setValueState(newValue);
|
|
70
|
-
|
|
71
|
+
apiRef.current.setEditCellValue({
|
|
71
72
|
id,
|
|
72
73
|
field,
|
|
73
74
|
value: newValue,
|
|
74
75
|
debounceMs
|
|
75
76
|
}, event);
|
|
76
|
-
}, [
|
|
77
|
+
}, [apiRef, debounceMs, field, id, onValueChange]);
|
|
77
78
|
React.useEffect(() => {
|
|
78
79
|
setValueState(value);
|
|
79
80
|
}, [value]);
|
|
@@ -9,6 +9,7 @@ import { isEscapeKey } from '../../utils/keyboardUtils';
|
|
|
9
9
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
10
10
|
import { GridEditModes } from '../../models/gridEditRowModel';
|
|
11
11
|
import { getValueFromValueOptions } from '../panel/filterPanel/filterPanelUtils';
|
|
12
|
+
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
14
|
|
|
14
15
|
const renderSingleSelectOptions = (option, OptionComponent) => {
|
|
@@ -36,6 +37,7 @@ function GridEditSingleSelectCell(props) {
|
|
|
36
37
|
} = props,
|
|
37
38
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
38
39
|
|
|
40
|
+
const apiRef = useGridApiContext();
|
|
39
41
|
const ref = React.useRef();
|
|
40
42
|
const inputRef = React.useRef();
|
|
41
43
|
const rootProps = useGridRootProps();
|
|
@@ -82,7 +84,7 @@ function GridEditSingleSelectCell(props) {
|
|
|
82
84
|
await onValueChange(event, formattedTargetValue);
|
|
83
85
|
}
|
|
84
86
|
|
|
85
|
-
const isValid = await
|
|
87
|
+
const isValid = await apiRef.current.setEditCellValue({
|
|
86
88
|
id,
|
|
87
89
|
field,
|
|
88
90
|
value: formattedTargetValue
|
|
@@ -97,18 +99,18 @@ function GridEditSingleSelectCell(props) {
|
|
|
97
99
|
return;
|
|
98
100
|
}
|
|
99
101
|
|
|
100
|
-
const canCommit = await Promise.resolve(
|
|
102
|
+
const canCommit = await Promise.resolve(apiRef.current.commitCellChange({
|
|
101
103
|
id,
|
|
102
104
|
field
|
|
103
105
|
}, event));
|
|
104
106
|
|
|
105
107
|
if (canCommit) {
|
|
106
|
-
|
|
108
|
+
apiRef.current.setCellMode(id, field, 'view');
|
|
107
109
|
|
|
108
110
|
if (event.key) {
|
|
109
111
|
// TODO v6: remove once we stop ignoring events fired from portals
|
|
110
|
-
const params =
|
|
111
|
-
|
|
112
|
+
const params = apiRef.current.getCellParams(id, field);
|
|
113
|
+
apiRef.current.publishEvent('cellNavigationKeyDown', params, event);
|
|
112
114
|
}
|
|
113
115
|
}
|
|
114
116
|
};
|
|
@@ -121,13 +123,13 @@ function GridEditSingleSelectCell(props) {
|
|
|
121
123
|
|
|
122
124
|
if (reason === 'backdropClick' || isEscapeKey(event.key)) {
|
|
123
125
|
if (rootProps.experimentalFeatures?.newEditingApi) {
|
|
124
|
-
|
|
126
|
+
apiRef.current.stopCellEditMode({
|
|
125
127
|
id,
|
|
126
128
|
field,
|
|
127
129
|
ignoreModifications: true
|
|
128
130
|
});
|
|
129
131
|
} else {
|
|
130
|
-
|
|
132
|
+
apiRef.current.setCellMode(id, field, 'view');
|
|
131
133
|
}
|
|
132
134
|
}
|
|
133
135
|
};
|
|
@@ -79,7 +79,7 @@ export function GridColumnsPanel(props) {
|
|
|
79
79
|
return apiRef.current.setColumnVisibilityModel({});
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
return apiRef.current.setColumnVisibilityModel(Object.fromEntries(columns.map(col => [col.field, false])));
|
|
82
|
+
return apiRef.current.setColumnVisibilityModel(Object.fromEntries(columns.filter(col => col.hideable !== false).map(col => [col.field, false])));
|
|
83
83
|
} // TODO v6: Remove
|
|
84
84
|
|
|
85
85
|
|
|
@@ -26,9 +26,17 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
26
26
|
const id = useId();
|
|
27
27
|
const resolvedColumn = item.columnField ? apiRef.current.getColumn(item.columnField) : null;
|
|
28
28
|
const resolvedValueOptions = React.useMemo(() => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
29
|
+
if (!resolvedColumn?.valueOptions) {
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (typeof resolvedColumn.valueOptions === 'function') {
|
|
34
|
+
return resolvedColumn.valueOptions({
|
|
35
|
+
field: resolvedColumn.field
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return resolvedColumn.valueOptions;
|
|
32
40
|
}, [resolvedColumn]);
|
|
33
41
|
const resolvedFormattedValueOptions = React.useMemo(() => {
|
|
34
42
|
return resolvedValueOptions?.map(getValueFromOption);
|
|
@@ -85,8 +93,7 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
85
93
|
return /*#__PURE__*/_jsx(Autocomplete, _extends({
|
|
86
94
|
multiple: true,
|
|
87
95
|
limitTags: 1,
|
|
88
|
-
options: resolvedValueOptions
|
|
89
|
-
,
|
|
96
|
+
options: resolvedValueOptions,
|
|
90
97
|
isOptionEqualToValue: isOptionEqualToValue,
|
|
91
98
|
filterOptions: filter,
|
|
92
99
|
id: id,
|