@mui/x-data-grid 6.0.4 → 6.1.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 +58 -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/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/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/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/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/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/models/gridColumnGrouping.js +4 -0
- package/legacy/models/params/gridRowParams.js +8 -0
- package/legacy/utils/createSelector.js +14 -22
- package/locales/coreLocales.js +0 -1
- 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/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/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/index.js +9 -1
- package/modern/locales/coreLocales.js +0 -1
- 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/models/gridColumnGrouping.js +4 -0
- package/modern/models/params/gridRowParams.js +8 -0
- package/modern/utils/createSelector.js +12 -22
- 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/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/index.js +1 -1
- 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/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/package.json +1 -1
- package/utils/createSelector.d.ts +4 -4
- package/utils/createSelector.js +14 -22
package/legacy/locales/nlNL.js
CHANGED
|
@@ -39,7 +39,7 @@ var nlNLGrid = {
|
|
|
39
39
|
columnsPanelHideAllButton: 'Alles verbergen',
|
|
40
40
|
// Filter panel text
|
|
41
41
|
filterPanelAddFilter: 'Filter toevoegen',
|
|
42
|
-
|
|
42
|
+
filterPanelRemoveAll: 'Alles verwijderen',
|
|
43
43
|
filterPanelDeleteIconLabel: 'Verwijderen',
|
|
44
44
|
filterPanelLogicOperator: 'Logische operator',
|
|
45
45
|
filterPanelOperator: 'Operatoren',
|
|
@@ -69,7 +69,7 @@ var nlNLGrid = {
|
|
|
69
69
|
// Column menu text
|
|
70
70
|
columnMenuLabel: 'Menu',
|
|
71
71
|
columnMenuShowColumns: 'Toon kolommen',
|
|
72
|
-
|
|
72
|
+
columnMenuManageColumns: 'Kolommen beheren',
|
|
73
73
|
columnMenuFilter: 'Filteren',
|
|
74
74
|
columnMenuHideColumn: 'Verbergen',
|
|
75
75
|
columnMenuUnsort: 'Annuleer sortering',
|
|
@@ -119,7 +119,7 @@ var nlNLGrid = {
|
|
|
119
119
|
return "Stop groeperen op ".concat(name);
|
|
120
120
|
},
|
|
121
121
|
// Master/detail
|
|
122
|
-
|
|
122
|
+
detailPanelToggle: 'Detailmenu in- of uitklappen',
|
|
123
123
|
expandDetailPanel: 'Uitklappen',
|
|
124
124
|
collapseDetailPanel: 'Inklappen',
|
|
125
125
|
// Row reordering text
|
package/legacy/locales/ptBR.js
CHANGED
|
@@ -123,15 +123,13 @@ var ptBRGrid = {
|
|
|
123
123
|
expandDetailPanel: 'Expandir',
|
|
124
124
|
collapseDetailPanel: 'Esconder',
|
|
125
125
|
// Row reordering text
|
|
126
|
-
rowReorderingHeaderName: 'Reorganizar linhas'
|
|
127
|
-
|
|
126
|
+
rowReorderingHeaderName: 'Reorganizar linhas',
|
|
128
127
|
// Aggregation
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
128
|
+
aggregationMenuItemHeader: 'Agrupar',
|
|
129
|
+
aggregationFunctionLabelSum: 'soma',
|
|
130
|
+
aggregationFunctionLabelAvg: 'média',
|
|
131
|
+
aggregationFunctionLabelMin: 'mín',
|
|
132
|
+
aggregationFunctionLabelMax: 'máx',
|
|
133
|
+
aggregationFunctionLabelSize: 'tamanho'
|
|
135
134
|
};
|
|
136
|
-
|
|
137
135
|
export var ptBR = getGridLocalization(ptBRGrid, ptBRCore);
|
package/legacy/locales/ruRU.js
CHANGED
|
@@ -76,7 +76,7 @@ var ruRUGrid = {
|
|
|
76
76
|
// Column menu text
|
|
77
77
|
columnMenuLabel: 'Меню',
|
|
78
78
|
columnMenuShowColumns: 'Показать столбцы',
|
|
79
|
-
|
|
79
|
+
columnMenuManageColumns: 'Управление колонками',
|
|
80
80
|
columnMenuFilter: 'Фильтр',
|
|
81
81
|
columnMenuHideColumn: 'Скрыть',
|
|
82
82
|
columnMenuUnsort: 'Отменить сортировку',
|
|
@@ -32,5 +32,13 @@ var GridRowEditStopReasons = /*#__PURE__*/function (GridRowEditStopReasons) {
|
|
|
32
32
|
GridRowEditStopReasons["shiftTabKeyDown"] = "shiftTabKeyDown";
|
|
33
33
|
return GridRowEditStopReasons;
|
|
34
34
|
}(GridRowEditStopReasons || {});
|
|
35
|
+
/**
|
|
36
|
+
* Object passed as parameter in the row `getRowSpacing` callback prop.
|
|
37
|
+
* @demos
|
|
38
|
+
* - [Row spacing](/x/react-data-grid/row-height/#row-spacing)
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
* The getRowSpacing return value.
|
|
42
|
+
*/
|
|
35
43
|
// https://github.com/mui/mui-x/pull/3738#discussion_r798504277
|
|
36
44
|
export { GridRowEditStartReasons, GridRowEditStopReasons };
|
|
@@ -1,44 +1,42 @@
|
|
|
1
1
|
import { createSelector as reselectCreateSelector } from 'reselect';
|
|
2
2
|
import { buildWarning } from './warning';
|
|
3
3
|
var cacheContainer = {
|
|
4
|
-
cache:
|
|
4
|
+
cache: new WeakMap()
|
|
5
5
|
};
|
|
6
6
|
var missingInstanceIdWarning = buildWarning(['MUI: A selector was called without passing the instance ID, which may impact the performance of the grid.', 'To fix, call it with `apiRef`, e.g. `mySelector(apiRef)`, or pass the instance ID explicitly, e.g `mySelector(state, apiRef.current.instanceId)`.']);
|
|
7
7
|
export var createSelector = function createSelector() {
|
|
8
8
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
9
9
|
args[_key] = arguments[_key];
|
|
10
10
|
}
|
|
11
|
-
if (cacheContainer.cache === null) {
|
|
12
|
-
cacheContainer.cache = {};
|
|
13
|
-
}
|
|
14
11
|
var selector = function selector() {
|
|
12
|
+
var _cache$get, _cache$get3;
|
|
15
13
|
for (var _len2 = arguments.length, selectorArgs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
16
14
|
selectorArgs[_key2] = arguments[_key2];
|
|
17
15
|
}
|
|
18
16
|
var stateOrApiRef = selectorArgs[0],
|
|
19
17
|
instanceId = selectorArgs[1];
|
|
20
18
|
var isApiRef = !!stateOrApiRef.current;
|
|
21
|
-
var cacheKey = isApiRef ? stateOrApiRef.current.instanceId : instanceId != null ? instanceId :
|
|
19
|
+
var cacheKey = isApiRef ? stateOrApiRef.current.instanceId : instanceId != null ? instanceId : {
|
|
20
|
+
id: 'default'
|
|
21
|
+
};
|
|
22
22
|
var state = isApiRef ? stateOrApiRef.current.state : stateOrApiRef;
|
|
23
23
|
if (process.env.NODE_ENV !== 'production') {
|
|
24
|
-
if (cacheKey === 'default') {
|
|
24
|
+
if (cacheKey.id === 'default') {
|
|
25
25
|
missingInstanceIdWarning();
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
if (cacheContainer.cache === null) {
|
|
29
|
-
cacheContainer.cache = {};
|
|
30
|
-
}
|
|
31
28
|
var cache = cacheContainer.cache;
|
|
32
|
-
if (cache
|
|
29
|
+
if (cache.get(cacheKey) && (_cache$get = cache.get(cacheKey)) != null && _cache$get.get(args)) {
|
|
30
|
+
var _cache$get2;
|
|
33
31
|
// We pass the cache key because the called selector might have as
|
|
34
32
|
// dependency another selector created with this `createSelector`.
|
|
35
|
-
return cache
|
|
33
|
+
return (_cache$get2 = cache.get(cacheKey)) == null ? void 0 : _cache$get2.get(args)(state, cacheKey);
|
|
36
34
|
}
|
|
37
35
|
var newSelector = reselectCreateSelector.apply(void 0, args);
|
|
38
|
-
if (!cache
|
|
39
|
-
cache
|
|
36
|
+
if (!cache.get(cacheKey)) {
|
|
37
|
+
cache.set(cacheKey, new Map());
|
|
40
38
|
}
|
|
41
|
-
cache
|
|
39
|
+
(_cache$get3 = cache.get(cacheKey)) == null ? void 0 : _cache$get3.set(args, newSelector);
|
|
42
40
|
return newSelector(state, cacheKey);
|
|
43
41
|
};
|
|
44
42
|
|
|
@@ -49,12 +47,6 @@ export var createSelector = function createSelector() {
|
|
|
49
47
|
};
|
|
50
48
|
|
|
51
49
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
52
|
-
export var unstable_resetCreateSelectorCache = function unstable_resetCreateSelectorCache(
|
|
53
|
-
|
|
54
|
-
if (cacheContainer.cache && cacheContainer.cache[cacheKey]) {
|
|
55
|
-
delete cacheContainer.cache[cacheKey];
|
|
56
|
-
}
|
|
57
|
-
} else {
|
|
58
|
-
cacheContainer.cache = null;
|
|
59
|
-
}
|
|
50
|
+
export var unstable_resetCreateSelectorCache = function unstable_resetCreateSelectorCache() {
|
|
51
|
+
cacheContainer.cache = new WeakMap();
|
|
60
52
|
};
|
package/locales/coreLocales.js
CHANGED
|
@@ -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/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/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/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/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/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: 'Отменить сортировку',
|
|
@@ -31,7 +31,9 @@ export interface GridCoreApi {
|
|
|
31
31
|
* Unique identifier for each component instance in a page.
|
|
32
32
|
* @ignore - do not document.
|
|
33
33
|
*/
|
|
34
|
-
instanceId:
|
|
34
|
+
instanceId: {
|
|
35
|
+
id: number;
|
|
36
|
+
};
|
|
35
37
|
}
|
|
36
38
|
export interface GridCorePrivateApi<GridPublicApi extends GridApiCommon, GridPrivateApi extends GridPrivateApiCommon> {
|
|
37
39
|
/**
|
|
@@ -18,6 +18,10 @@ export type GridRowModesModelProps = ({
|
|
|
18
18
|
export type GridRowModesModel = Record<GridRowId, GridRowModesModelProps>;
|
|
19
19
|
export interface GridEditCellMeta {
|
|
20
20
|
changeReason?: 'debouncedSetEditCellValue' | 'setEditCellValue';
|
|
21
|
+
/**
|
|
22
|
+
* Determines if `setEditCellValue` should be called on the first render to sync the value.
|
|
23
|
+
*/
|
|
24
|
+
unstable_updateValueOnRender?: boolean;
|
|
21
25
|
}
|
|
22
26
|
export interface GridEditingSharedApi {
|
|
23
27
|
/**
|
|
@@ -32,5 +32,13 @@ var GridRowEditStopReasons = /*#__PURE__*/function (GridRowEditStopReasons) {
|
|
|
32
32
|
GridRowEditStopReasons["shiftTabKeyDown"] = "shiftTabKeyDown";
|
|
33
33
|
return GridRowEditStopReasons;
|
|
34
34
|
}(GridRowEditStopReasons || {});
|
|
35
|
+
/**
|
|
36
|
+
* Object passed as parameter in the row `getRowSpacing` callback prop.
|
|
37
|
+
* @demos
|
|
38
|
+
* - [Row spacing](/x/react-data-grid/row-height/#row-spacing)
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
* The getRowSpacing return value.
|
|
42
|
+
*/
|
|
35
43
|
// https://github.com/mui/mui-x/pull/3738#discussion_r798504277
|
|
36
44
|
export { GridRowEditStartReasons, GridRowEditStopReasons };
|
|
@@ -6,6 +6,9 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { unstable_useForkRef as useForkRef, unstable_ownerWindow as ownerWindow, unstable_useEventCallback as useEventCallback, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
|
|
7
7
|
import createDetectElementResize from '../lib/createDetectElementResize';
|
|
8
8
|
// TODO replace with https://caniuse.com/resizeobserver.
|
|
9
|
+
|
|
10
|
+
// Credit to https://github.com/bvaughn/react-virtualized/blob/master/source/AutoSizer/AutoSizer.js
|
|
11
|
+
// for the sources.
|
|
9
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
13
|
const GridAutoSizer = /*#__PURE__*/React.forwardRef(function AutoSizer(props, ref) {
|
|
11
14
|
const {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["selected", "rowId", "row", "index", "style", "position", "rowHeight", "className", "visibleColumns", "renderedColumns", "containerWidth", "firstColumnToRender", "lastColumnToRender", "isLastVisible", "focusedCell", "tabbableCell", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave"],
|
|
4
|
-
_excluded2 = ["changeReason"];
|
|
4
|
+
_excluded2 = ["changeReason", "unstable_updateValueOnRender"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import clsx from 'clsx';
|
|
@@ -210,6 +210,8 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
210
210
|
}
|
|
211
211
|
if (editCellState != null && column.renderEditCell) {
|
|
212
212
|
const updatedRow = apiRef.current.getRowWithUpdatedValues(rowId, column.field);
|
|
213
|
+
|
|
214
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
213
215
|
const editCellStateRest = _objectWithoutPropertiesLoose(editCellState, _excluded2);
|
|
214
216
|
const params = _extends({}, cellParams, {
|
|
215
217
|
row: updatedRow
|
|
@@ -63,22 +63,25 @@ function GridEditDateCell(props) {
|
|
|
63
63
|
classes: rootProps.classes
|
|
64
64
|
};
|
|
65
65
|
const classes = useUtilityClasses(ownerState);
|
|
66
|
+
const hasUpdatedEditValueOnMount = React.useRef(false);
|
|
67
|
+
const parseValueToDate = React.useCallback(value => {
|
|
68
|
+
if (value === '') {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
const [date, time] = value.split('T');
|
|
72
|
+
const [year, month, day] = date.split('-');
|
|
73
|
+
const parsedDate = new Date();
|
|
74
|
+
parsedDate.setFullYear(Number(year), Number(month) - 1, Number(day));
|
|
75
|
+
parsedDate.setHours(0, 0, 0, 0);
|
|
76
|
+
if (time) {
|
|
77
|
+
const [hours, minutes] = time.split(':');
|
|
78
|
+
parsedDate.setHours(Number(hours), Number(minutes), 0, 0);
|
|
79
|
+
}
|
|
80
|
+
return parsedDate;
|
|
81
|
+
}, []);
|
|
66
82
|
const handleChange = React.useCallback(async event => {
|
|
67
83
|
const newFormattedDate = event.target.value;
|
|
68
|
-
|
|
69
|
-
if (newFormattedDate === '') {
|
|
70
|
-
newParsedDate = null;
|
|
71
|
-
} else {
|
|
72
|
-
const [date, time] = newFormattedDate.split('T');
|
|
73
|
-
const [year, month, day] = date.split('-');
|
|
74
|
-
newParsedDate = new Date();
|
|
75
|
-
newParsedDate.setFullYear(Number(year), Number(month) - 1, Number(day));
|
|
76
|
-
newParsedDate.setHours(0, 0, 0, 0);
|
|
77
|
-
if (time) {
|
|
78
|
-
const [hours, minutes] = time.split(':');
|
|
79
|
-
newParsedDate.setHours(Number(hours), Number(minutes), 0, 0);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
84
|
+
const newParsedDate = parseValueToDate(newFormattedDate);
|
|
82
85
|
if (onValueChange) {
|
|
83
86
|
await onValueChange(event, newParsedDate);
|
|
84
87
|
}
|
|
@@ -91,7 +94,7 @@ function GridEditDateCell(props) {
|
|
|
91
94
|
field,
|
|
92
95
|
value: newParsedDate
|
|
93
96
|
}, event);
|
|
94
|
-
}, [apiRef, field, id, onValueChange]);
|
|
97
|
+
}, [apiRef, field, id, onValueChange, parseValueToDate]);
|
|
95
98
|
React.useEffect(() => {
|
|
96
99
|
setValueState(state => {
|
|
97
100
|
if (valueTransformed.parsed !== state.parsed && valueTransformed.parsed?.getTime() !== state.parsed?.getTime()) {
|
|
@@ -105,8 +108,26 @@ function GridEditDateCell(props) {
|
|
|
105
108
|
inputRef.current.focus();
|
|
106
109
|
}
|
|
107
110
|
}, [hasFocus]);
|
|
111
|
+
const meta = apiRef.current.unstable_getEditCellMeta(id, field);
|
|
112
|
+
const handleInputRef = el => {
|
|
113
|
+
inputRef.current = el;
|
|
114
|
+
if (meta.unstable_updateValueOnRender && !hasUpdatedEditValueOnMount.current) {
|
|
115
|
+
const inputValue = inputRef.current.value;
|
|
116
|
+
const parsedDate = parseValueToDate(inputValue);
|
|
117
|
+
setValueState({
|
|
118
|
+
parsed: parsedDate,
|
|
119
|
+
formatted: inputValue
|
|
120
|
+
});
|
|
121
|
+
apiRef.current.setEditCellValue({
|
|
122
|
+
id,
|
|
123
|
+
field,
|
|
124
|
+
value: parsedDate
|
|
125
|
+
});
|
|
126
|
+
hasUpdatedEditValueOnMount.current = true;
|
|
127
|
+
}
|
|
128
|
+
};
|
|
108
129
|
return /*#__PURE__*/_jsx(StyledInputBase, _extends({
|
|
109
|
-
inputRef:
|
|
130
|
+
inputRef: handleInputRef,
|
|
110
131
|
fullWidth: true,
|
|
111
132
|
className: classes.root,
|
|
112
133
|
type: isDateTime ? 'datetime-local' : 'date',
|
|
@@ -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,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
|
}, {});
|