@mui/x-data-grid 5.17.2 → 5.17.4
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 +70 -2
- package/colDef/gridNumericOperators.d.ts +1 -1
- package/colDef/gridSingleSelectOperators.d.ts +1 -1
- package/colDef/gridStringOperators.d.ts +1 -1
- package/components/GridRow.js +5 -2
- package/components/cell/GridEditBooleanCell.js +1 -0
- package/components/cell/GridEditDateCell.js +1 -0
- package/components/cell/GridEditInputCell.js +21 -7
- package/components/cell/GridEditSingleSelectCell.js +1 -0
- package/hooks/features/editRows/useGridCellEditing.new.js +6 -3
- package/hooks/features/editRows/useGridEditing.new.js +9 -1
- package/hooks/features/editRows/useGridRowEditing.new.js +6 -3
- package/hooks/features/focus/useGridFocus.js +14 -15
- package/hooks/utils/useGridInitializeState.d.ts +1 -1
- package/index.js +1 -1
- package/legacy/components/GridRow.js +6 -2
- package/legacy/components/cell/GridEditBooleanCell.js +1 -0
- package/legacy/components/cell/GridEditDateCell.js +1 -0
- package/legacy/components/cell/GridEditInputCell.js +23 -9
- package/legacy/components/cell/GridEditSingleSelectCell.js +1 -0
- package/legacy/hooks/features/editRows/useGridCellEditing.new.js +5 -4
- package/legacy/hooks/features/editRows/useGridEditing.new.js +9 -1
- package/legacy/hooks/features/editRows/useGridRowEditing.new.js +6 -3
- package/legacy/hooks/features/focus/useGridFocus.js +14 -15
- package/legacy/index.js +1 -1
- package/legacy/locales/faIR.js +14 -14
- package/legacy/locales/fiFI.js +32 -28
- package/legacy/locales/plPL.js +7 -7
- package/locales/faIR.js +14 -14
- package/locales/fiFI.js +28 -28
- package/locales/plPL.js +7 -7
- package/models/api/gridEditingApi.d.ts +10 -0
- package/models/gridEditRowModel.d.ts +2 -0
- package/models/gridRows.d.ts +1 -1
- package/models/params/gridEditCellParams.d.ts +7 -3
- package/modern/components/GridRow.js +5 -2
- package/modern/components/cell/GridEditBooleanCell.js +1 -0
- package/modern/components/cell/GridEditDateCell.js +1 -0
- package/modern/components/cell/GridEditInputCell.js +18 -6
- package/modern/components/cell/GridEditSingleSelectCell.js +1 -0
- package/modern/hooks/features/editRows/useGridCellEditing.new.js +6 -3
- package/modern/hooks/features/editRows/useGridEditing.new.js +9 -1
- package/modern/hooks/features/editRows/useGridRowEditing.new.js +6 -3
- package/modern/hooks/features/focus/useGridFocus.js +14 -15
- package/modern/index.js +1 -1
- package/modern/locales/faIR.js +14 -14
- package/modern/locales/fiFI.js +28 -28
- package/modern/locales/plPL.js +7 -7
- package/node/components/GridRow.js +4 -2
- package/node/components/cell/GridEditBooleanCell.js +1 -0
- package/node/components/cell/GridEditDateCell.js +1 -0
- package/node/components/cell/GridEditInputCell.js +21 -7
- package/node/components/cell/GridEditSingleSelectCell.js +1 -0
- package/node/hooks/features/editRows/useGridCellEditing.new.js +6 -3
- package/node/hooks/features/editRows/useGridEditing.new.js +10 -1
- package/node/hooks/features/editRows/useGridRowEditing.new.js +6 -3
- package/node/hooks/features/focus/useGridFocus.js +14 -15
- package/node/index.js +1 -1
- package/node/locales/faIR.js +14 -14
- package/node/locales/fiFI.js +28 -28
- package/node/locales/plPL.js +7 -7
- package/package.json +2 -2
|
@@ -359,7 +359,9 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
359
359
|
const {
|
|
360
360
|
id,
|
|
361
361
|
field,
|
|
362
|
-
value
|
|
362
|
+
value,
|
|
363
|
+
debounceMs,
|
|
364
|
+
unstable_skipValueParser: skipValueParser
|
|
363
365
|
} = params;
|
|
364
366
|
throwIfNotEditable(id, field);
|
|
365
367
|
throwIfNotInMode(id, field, GridCellModes.Edit);
|
|
@@ -367,14 +369,15 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
367
369
|
const row = apiRef.current.getRow(id);
|
|
368
370
|
let parsedValue = value;
|
|
369
371
|
|
|
370
|
-
if (column.valueParser) {
|
|
372
|
+
if (column.valueParser && !skipValueParser) {
|
|
371
373
|
parsedValue = column.valueParser(value, apiRef.current.getCellParams(id, field));
|
|
372
374
|
}
|
|
373
375
|
|
|
374
376
|
let editingState = gridEditRowsStateSelector(apiRef.current.state);
|
|
375
377
|
|
|
376
378
|
let newProps = _extends({}, editingState[id][field], {
|
|
377
|
-
value: parsedValue
|
|
379
|
+
value: parsedValue,
|
|
380
|
+
changeReason: debounceMs ? 'debouncedSetEditCellValue' : 'setEditCellValue'
|
|
378
381
|
});
|
|
379
382
|
|
|
380
383
|
if (column.preProcessEditCellProps) {
|
|
@@ -4,6 +4,7 @@ import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
|
4
4
|
import { useGridCellEditing } from './useGridCellEditing.new';
|
|
5
5
|
import { GridCellModes, GridEditModes } from '../../../models/gridEditRowModel';
|
|
6
6
|
import { useGridRowEditing } from './useGridRowEditing.new';
|
|
7
|
+
import { gridEditRowsStateSelector } from './gridEditRowsSelector';
|
|
7
8
|
export const editingStateInitializer = state => _extends({}, state, {
|
|
8
9
|
editRows: {}
|
|
9
10
|
});
|
|
@@ -116,11 +117,18 @@ export const useGridEditing = (apiRef, props) => {
|
|
|
116
117
|
const getRowWithUpdatedValues = React.useCallback((id, field) => {
|
|
117
118
|
return props.editMode === GridEditModes.Cell ? apiRef.current.unstable_getRowWithUpdatedValuesFromCellEditing(id, field) : apiRef.current.unstable_getRowWithUpdatedValuesFromRowEditing(id);
|
|
118
119
|
}, [apiRef, props.editMode]);
|
|
120
|
+
const getEditCellMeta = React.useCallback((id, field) => {
|
|
121
|
+
const editingState = gridEditRowsStateSelector(apiRef.current.state);
|
|
122
|
+
return {
|
|
123
|
+
changeReason: editingState[id][field].changeReason
|
|
124
|
+
};
|
|
125
|
+
}, [apiRef]);
|
|
119
126
|
const editingSharedApi = {
|
|
120
127
|
isCellEditable,
|
|
121
128
|
setEditCellValue,
|
|
122
129
|
unstable_runPendingEditCellValueMutation: runPendingEditCellValueMutation,
|
|
123
|
-
unstable_getRowWithUpdatedValues: getRowWithUpdatedValues
|
|
130
|
+
unstable_getRowWithUpdatedValues: getRowWithUpdatedValues,
|
|
131
|
+
unstable_getEditCellMeta: getEditCellMeta
|
|
124
132
|
};
|
|
125
133
|
useGridApiMethod(apiRef, editingSharedApi, 'EditingApi');
|
|
126
134
|
};
|
|
@@ -440,21 +440,24 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
440
440
|
const {
|
|
441
441
|
id,
|
|
442
442
|
field,
|
|
443
|
-
value
|
|
443
|
+
value,
|
|
444
|
+
debounceMs,
|
|
445
|
+
unstable_skipValueParser: skipValueParser
|
|
444
446
|
} = params;
|
|
445
447
|
throwIfNotEditable(id, field);
|
|
446
448
|
const column = apiRef.current.getColumn(field);
|
|
447
449
|
const row = apiRef.current.getRow(id);
|
|
448
450
|
let parsedValue = value;
|
|
449
451
|
|
|
450
|
-
if (column.valueParser) {
|
|
452
|
+
if (column.valueParser && !skipValueParser) {
|
|
451
453
|
parsedValue = column.valueParser(value, apiRef.current.getCellParams(id, field));
|
|
452
454
|
}
|
|
453
455
|
|
|
454
456
|
let editingState = gridEditRowsStateSelector(apiRef.current.state);
|
|
455
457
|
|
|
456
458
|
let newProps = _extends({}, editingState[id][field], {
|
|
457
|
-
value: parsedValue
|
|
459
|
+
value: parsedValue,
|
|
460
|
+
changeReason: debounceMs ? 'debouncedSetEditCellValue' : 'setEditCellValue'
|
|
458
461
|
});
|
|
459
462
|
|
|
460
463
|
if (!column.preProcessEditCellProps) {
|
|
@@ -28,6 +28,14 @@ export const focusStateInitializer = state => _extends({}, state, {
|
|
|
28
28
|
export const useGridFocus = (apiRef, props) => {
|
|
29
29
|
const logger = useGridLogger(apiRef, 'useGridFocus');
|
|
30
30
|
const lastClickedCell = React.useRef(null);
|
|
31
|
+
const publishCellFocusOut = React.useCallback((cell, event) => {
|
|
32
|
+
if (cell) {
|
|
33
|
+
// The row might have been deleted
|
|
34
|
+
if (apiRef.current.getRow(cell.id)) {
|
|
35
|
+
apiRef.current.publishEvent('cellFocusOut', apiRef.current.getCellParams(cell.id, cell.field), event);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}, [apiRef]);
|
|
31
39
|
const setCellFocus = React.useCallback((id, field) => {
|
|
32
40
|
const focusedCell = gridFocusCellSelector(apiRef);
|
|
33
41
|
|
|
@@ -63,18 +71,14 @@ export const useGridFocus = (apiRef, props) => {
|
|
|
63
71
|
if (focusedCell) {
|
|
64
72
|
// There's a focused cell but another cell was clicked
|
|
65
73
|
// Publishes an event to notify that the focus was lost
|
|
66
|
-
|
|
74
|
+
publishCellFocusOut(focusedCell, {});
|
|
67
75
|
}
|
|
68
76
|
|
|
69
77
|
apiRef.current.publishEvent('cellFocusIn', apiRef.current.getCellParams(id, field));
|
|
70
|
-
}, [apiRef, logger]);
|
|
78
|
+
}, [apiRef, logger, publishCellFocusOut]);
|
|
71
79
|
const setColumnHeaderFocus = React.useCallback((field, event = {}) => {
|
|
72
80
|
const cell = gridFocusCellSelector(apiRef);
|
|
73
|
-
|
|
74
|
-
if (cell) {
|
|
75
|
-
apiRef.current.publishEvent('cellFocusOut', apiRef.current.getCellParams(cell.id, cell.field), event);
|
|
76
|
-
}
|
|
77
|
-
|
|
81
|
+
publishCellFocusOut(cell, event);
|
|
78
82
|
apiRef.current.setState(state => {
|
|
79
83
|
logger.debug(`Focusing on column header with colIndex=${field}`);
|
|
80
84
|
return _extends({}, state, {
|
|
@@ -93,7 +97,7 @@ export const useGridFocus = (apiRef, props) => {
|
|
|
93
97
|
});
|
|
94
98
|
});
|
|
95
99
|
apiRef.current.forceUpdate();
|
|
96
|
-
}, [apiRef, logger]);
|
|
100
|
+
}, [apiRef, logger, publishCellFocusOut]);
|
|
97
101
|
const moveFocusToRelativeCell = React.useCallback((id, field, direction) => {
|
|
98
102
|
let columnIndexToFocus = apiRef.current.getColumnIndex(field);
|
|
99
103
|
let rowIndexToFocus = apiRef.current.getRowIndexRelativeToVisibleRows(id);
|
|
@@ -202,11 +206,6 @@ export const useGridFocus = (apiRef, props) => {
|
|
|
202
206
|
|
|
203
207
|
if (cellElement?.contains(event.target)) {
|
|
204
208
|
return;
|
|
205
|
-
} // The row might have been deleted during the click
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
if (!apiRef.current.getRow(focusedCell.id)) {
|
|
209
|
-
return;
|
|
210
209
|
}
|
|
211
210
|
|
|
212
211
|
if (cellParams) {
|
|
@@ -221,9 +220,9 @@ export const useGridFocus = (apiRef, props) => {
|
|
|
221
220
|
apiRef.current.forceUpdate(); // There's a focused cell but another element (not a cell) was clicked
|
|
222
221
|
// Publishes an event to notify that the focus was lost
|
|
223
222
|
|
|
224
|
-
|
|
223
|
+
publishCellFocusOut(focusedCell, event);
|
|
225
224
|
}
|
|
226
|
-
}, [apiRef]);
|
|
225
|
+
}, [apiRef, publishCellFocusOut]);
|
|
227
226
|
const handleCellModeChange = React.useCallback(params => {
|
|
228
227
|
if (params.cellMode === 'view') {
|
|
229
228
|
return;
|
package/modern/index.js
CHANGED
package/modern/locales/faIR.js
CHANGED
|
@@ -21,15 +21,15 @@ const faIRGrid = {
|
|
|
21
21
|
toolbarFiltersTooltipShow: 'نمایش فیلترها',
|
|
22
22
|
toolbarFiltersTooltipActive: count => count !== 1 ? `${count} فیلترهای فعال` : `${count} فیلتر فعال`,
|
|
23
23
|
// Quick filter toolbar field
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
toolbarQuickFilterPlaceholder: 'جستجو...',
|
|
25
|
+
toolbarQuickFilterLabel: 'جستجو',
|
|
26
|
+
toolbarQuickFilterDeleteIconLabel: 'حذف',
|
|
27
27
|
// Export selector toolbar button text
|
|
28
28
|
toolbarExport: 'خروجی',
|
|
29
29
|
toolbarExportLabel: 'خروجی',
|
|
30
30
|
toolbarExportCSV: 'دانلود به صورت CSV',
|
|
31
31
|
toolbarExportPrint: 'چاپ',
|
|
32
|
-
|
|
32
|
+
toolbarExportExcel: 'دانلود به صورت اکسل',
|
|
33
33
|
// Columns panel text
|
|
34
34
|
columnsPanelTextFieldLabel: 'پیداکردن ستون',
|
|
35
35
|
columnsPanelTextFieldPlaceholder: 'عنوان ستون',
|
|
@@ -107,17 +107,17 @@ const faIRGrid = {
|
|
|
107
107
|
groupColumn: name => `گروهبندی براساس ${name}`,
|
|
108
108
|
unGroupColumn: name => `لغو گروهبندی براساس ${name}`,
|
|
109
109
|
// Master/detail
|
|
110
|
-
|
|
110
|
+
detailPanelToggle: 'پنل جزئیات',
|
|
111
111
|
expandDetailPanel: 'بازکردن پنل جزئیات',
|
|
112
|
-
collapseDetailPanel: 'بستن پنل جزئیات'
|
|
113
|
-
//
|
|
112
|
+
collapseDetailPanel: 'بستن پنل جزئیات',
|
|
113
|
+
// Row reordering text
|
|
114
|
+
rowReorderingHeaderName: 'ترتیب مجدد سطر',
|
|
114
115
|
// Aggregation
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
aggregationMenuItemHeader: 'تجمیع',
|
|
117
|
+
aggregationFunctionLabelSum: 'جمع',
|
|
118
|
+
aggregationFunctionLabelAvg: 'میانگین',
|
|
119
|
+
aggregationFunctionLabelMin: 'حداقل',
|
|
120
|
+
aggregationFunctionLabelMax: 'حداکثر',
|
|
121
|
+
aggregationFunctionLabelSize: 'اندازه'
|
|
122
122
|
};
|
|
123
123
|
export const faIR = getGridLocalization(faIRGrid, faIRCore);
|
package/modern/locales/fiFI.js
CHANGED
|
@@ -6,7 +6,7 @@ const fiFIGrid = {
|
|
|
6
6
|
noResultsOverlayLabel: 'Ei tuloksia.',
|
|
7
7
|
errorOverlayDefaultLabel: 'Tapahtui virhe.',
|
|
8
8
|
// Density selector toolbar button text
|
|
9
|
-
toolbarDensity: '
|
|
9
|
+
toolbarDensity: 'Tiiveys',
|
|
10
10
|
toolbarDensityLabel: 'Tiiveys',
|
|
11
11
|
toolbarDensityCompact: 'Kompakti',
|
|
12
12
|
toolbarDensityStandard: 'Vakio',
|
|
@@ -21,15 +21,15 @@ const fiFIGrid = {
|
|
|
21
21
|
toolbarFiltersTooltipShow: 'Näytä suodattimet',
|
|
22
22
|
toolbarFiltersTooltipActive: count => count !== 1 ? `${count} aktiivista suodatinta` : `${count} aktiivinen suodatin`,
|
|
23
23
|
// Quick filter toolbar field
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
toolbarQuickFilterPlaceholder: 'Hae…',
|
|
25
|
+
toolbarQuickFilterLabel: 'Hae',
|
|
26
|
+
toolbarQuickFilterDeleteIconLabel: 'Tyhjennä',
|
|
27
27
|
// Export selector toolbar button text
|
|
28
|
-
toolbarExport: '
|
|
29
|
-
toolbarExportLabel: '
|
|
28
|
+
toolbarExport: 'Vie',
|
|
29
|
+
toolbarExportLabel: 'Vie',
|
|
30
30
|
toolbarExportCSV: 'Lataa CSV-muodossa',
|
|
31
31
|
toolbarExportPrint: 'Tulosta',
|
|
32
|
-
|
|
32
|
+
toolbarExportExcel: 'Lataa Excel-muodossa',
|
|
33
33
|
// Columns panel text
|
|
34
34
|
columnsPanelTextFieldLabel: 'Etsi sarake',
|
|
35
35
|
columnsPanelTextFieldPlaceholder: 'Sarakkeen otsikko',
|
|
@@ -39,7 +39,7 @@ const fiFIGrid = {
|
|
|
39
39
|
// Filter panel text
|
|
40
40
|
filterPanelAddFilter: 'Lisää suodatin',
|
|
41
41
|
filterPanelDeleteIconLabel: 'Poista',
|
|
42
|
-
|
|
42
|
+
filterPanelLinkOperator: 'Logiikkaoperaattori',
|
|
43
43
|
filterPanelOperators: 'Operaattorit',
|
|
44
44
|
// TODO v6: rename to filterPanelOperator
|
|
45
45
|
filterPanelOperatorAnd: 'Ja',
|
|
@@ -60,7 +60,7 @@ const fiFIGrid = {
|
|
|
60
60
|
filterOperatorOnOrBefore: 'on sama tai ennen',
|
|
61
61
|
filterOperatorIsEmpty: 'on tyhjä',
|
|
62
62
|
filterOperatorIsNotEmpty: 'ei ole tyhjä',
|
|
63
|
-
|
|
63
|
+
filterOperatorIsAnyOf: 'mikä tahansa seuraavista',
|
|
64
64
|
// Filter values text
|
|
65
65
|
filterValueAny: 'mikä tahansa',
|
|
66
66
|
filterValueTrue: 'tosi',
|
|
@@ -85,10 +85,10 @@ const fiFIGrid = {
|
|
|
85
85
|
footerTotalVisibleRows: (visibleCount, totalCount) => `${visibleCount.toLocaleString()} / ${totalCount.toLocaleString()}`,
|
|
86
86
|
// Checkbox selection text
|
|
87
87
|
checkboxSelectionHeaderName: 'Valintaruutu',
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
checkboxSelectionSelectAllRows: 'Valitse kaikki rivit',
|
|
89
|
+
checkboxSelectionUnselectAllRows: 'Poista kaikkien rivien valinta',
|
|
90
|
+
checkboxSelectionSelectRow: 'Valitse rivi',
|
|
91
|
+
checkboxSelectionUnselectRow: 'Poista rivin valinta',
|
|
92
92
|
// Boolean cell text
|
|
93
93
|
booleanCellTrueLabel: 'tosi',
|
|
94
94
|
booleanCellFalseLabel: 'epätosi',
|
|
@@ -101,23 +101,23 @@ const fiFIGrid = {
|
|
|
101
101
|
// Tree Data
|
|
102
102
|
treeDataGroupingHeaderName: 'Ryhmä',
|
|
103
103
|
treeDataExpand: 'Laajenna',
|
|
104
|
-
treeDataCollapse: 'Supista'
|
|
105
|
-
//
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
treeDataCollapse: 'Supista',
|
|
105
|
+
// Grouping columns
|
|
106
|
+
groupingColumnHeaderName: 'Ryhmä',
|
|
107
|
+
groupColumn: name => `Ryhmittelyperuste ${name}`,
|
|
108
|
+
unGroupColumn: name => `Poista ryhmittelyperuste ${name}`,
|
|
108
109
|
// Master/detail
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
detailPanelToggle: 'Yksityiskohtapaneelin vaihto',
|
|
111
|
+
expandDetailPanel: 'Laajenna',
|
|
112
|
+
collapseDetailPanel: 'Tiivistä',
|
|
112
113
|
// Row reordering text
|
|
113
|
-
|
|
114
|
+
rowReorderingHeaderName: 'Rivien uudelleenjärjestely',
|
|
114
115
|
// Aggregation
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
aggregationMenuItemHeader: 'Koostaminen',
|
|
117
|
+
aggregationFunctionLabelSum: 'summa',
|
|
118
|
+
aggregationFunctionLabelAvg: 'ka.',
|
|
119
|
+
aggregationFunctionLabelMin: 'min.',
|
|
120
|
+
aggregationFunctionLabelMax: 'maks.',
|
|
121
|
+
aggregationFunctionLabelSize: 'koko'
|
|
122
122
|
};
|
|
123
123
|
export const fiFI = getGridLocalization(fiFIGrid, fiFICore);
|
package/modern/locales/plPL.js
CHANGED
|
@@ -21,15 +21,15 @@ const plPLGrid = {
|
|
|
21
21
|
toolbarFiltersTooltipShow: 'Pokaż filtry',
|
|
22
22
|
toolbarFiltersTooltipActive: count => `Liczba aktywnych filtrów: ${count}`,
|
|
23
23
|
// Quick filter toolbar field
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
toolbarQuickFilterPlaceholder: 'Wyszukaj…',
|
|
25
|
+
toolbarQuickFilterLabel: 'Szukaj',
|
|
26
|
+
toolbarQuickFilterDeleteIconLabel: 'Wyczyść',
|
|
27
27
|
// Export selector toolbar button text
|
|
28
28
|
toolbarExport: 'Eksportuj',
|
|
29
29
|
toolbarExportLabel: 'Eksportuj',
|
|
30
30
|
toolbarExportCSV: 'Pobierz jako plik CSV',
|
|
31
31
|
toolbarExportPrint: 'Drukuj',
|
|
32
|
-
|
|
32
|
+
toolbarExportExcel: 'Pobierz jako plik Excel',
|
|
33
33
|
// Columns panel text
|
|
34
34
|
columnsPanelTextFieldLabel: 'Znajdź kolumnę',
|
|
35
35
|
columnsPanelTextFieldPlaceholder: 'Tytuł kolumny',
|
|
@@ -109,9 +109,9 @@ const plPLGrid = {
|
|
|
109
109
|
// Master/detail
|
|
110
110
|
// detailPanelToggle: 'Detail panel toggle',
|
|
111
111
|
expandDetailPanel: 'Rozwiń',
|
|
112
|
-
collapseDetailPanel: 'Zwiń'
|
|
113
|
-
//
|
|
114
|
-
// Aggregation
|
|
112
|
+
collapseDetailPanel: 'Zwiń',
|
|
113
|
+
// Row reordering text
|
|
114
|
+
rowReorderingHeaderName: 'Porządkowanie wierszy' // Aggregation
|
|
115
115
|
// aggregationMenuItemHeader: 'Aggregation',
|
|
116
116
|
// aggregationFunctionLabelSum: 'sum',
|
|
117
117
|
// aggregationFunctionLabelAvg: 'avg',
|
|
@@ -51,7 +51,8 @@ var _utils = require("../utils/utils");
|
|
|
51
51
|
|
|
52
52
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
53
53
|
|
|
54
|
-
const _excluded = ["selected", "rowId", "row", "index", "style", "position", "rowHeight", "className", "visibleColumns", "renderedColumns", "containerWidth", "firstColumnToRender", "lastColumnToRender", "cellFocus", "cellTabIndex", "editRowsState", "isLastVisible", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave"]
|
|
54
|
+
const _excluded = ["selected", "rowId", "row", "index", "style", "position", "rowHeight", "className", "visibleColumns", "renderedColumns", "containerWidth", "firstColumnToRender", "lastColumnToRender", "cellFocus", "cellTabIndex", "editRowsState", "isLastVisible", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave"],
|
|
55
|
+
_excluded2 = ["changeReason"];
|
|
55
56
|
|
|
56
57
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
57
58
|
|
|
@@ -264,9 +265,10 @@ function GridRow(props) {
|
|
|
264
265
|
updatedRow = apiRef.current.unstable_getRowWithUpdatedValues(rowId, column.field);
|
|
265
266
|
}
|
|
266
267
|
|
|
268
|
+
const editCellStateRest = (0, _objectWithoutPropertiesLoose2.default)(editCellState, _excluded2);
|
|
267
269
|
const params = (0, _extends2.default)({}, cellParams, {
|
|
268
270
|
row: updatedRow
|
|
269
|
-
},
|
|
271
|
+
}, editCellStateRest, {
|
|
270
272
|
api: apiRef.current
|
|
271
273
|
});
|
|
272
274
|
content = column.renderEditCell(params); // TODO move to GridCell
|
|
@@ -119,6 +119,7 @@ process.env.NODE_ENV !== "production" ? GridEditBooleanCell.propTypes = {
|
|
|
119
119
|
* The mode of the cell.
|
|
120
120
|
*/
|
|
121
121
|
cellMode: _propTypes.default.oneOf(['edit', 'view']).isRequired,
|
|
122
|
+
changeReason: _propTypes.default.oneOf(['debouncedSetEditCellValue', 'setEditCellValue']),
|
|
122
123
|
|
|
123
124
|
/**
|
|
124
125
|
* The column of the row that the current cell belongs to.
|
|
@@ -175,6 +175,7 @@ process.env.NODE_ENV !== "production" ? GridEditDateCell.propTypes = {
|
|
|
175
175
|
* The mode of the cell.
|
|
176
176
|
*/
|
|
177
177
|
cellMode: _propTypes.default.oneOf(['edit', 'view']).isRequired,
|
|
178
|
+
changeReason: _propTypes.default.oneOf(['debouncedSetEditCellValue', 'setEditCellValue']),
|
|
178
179
|
|
|
179
180
|
/**
|
|
180
181
|
* The column of the row that the current cell belongs to.
|
|
@@ -65,7 +65,7 @@ const GridEditInputCellRoot = (0, _styles.styled)(_InputBase.default, {
|
|
|
65
65
|
}
|
|
66
66
|
}));
|
|
67
67
|
const GridEditInputCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
68
|
-
var _rootProps$experiment;
|
|
68
|
+
var _rootProps$experiment, _rootProps$experiment3;
|
|
69
69
|
|
|
70
70
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
71
71
|
const {
|
|
@@ -87,23 +87,36 @@ const GridEditInputCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
87
87
|
};
|
|
88
88
|
const classes = useUtilityClasses(ownerState);
|
|
89
89
|
const handleChange = React.useCallback(async event => {
|
|
90
|
+
var _rootProps$experiment2;
|
|
91
|
+
|
|
90
92
|
const newValue = event.target.value;
|
|
91
93
|
|
|
92
94
|
if (onValueChange) {
|
|
93
95
|
await onValueChange(event, newValue);
|
|
94
96
|
}
|
|
95
97
|
|
|
96
|
-
|
|
98
|
+
const column = apiRef.current.getColumn(field);
|
|
99
|
+
let parsedValue = newValue;
|
|
100
|
+
|
|
101
|
+
if (column.valueParser && (_rootProps$experiment2 = rootProps.experimentalFeatures) != null && _rootProps$experiment2.newEditingApi) {
|
|
102
|
+
parsedValue = column.valueParser(newValue, apiRef.current.getCellParams(id, field));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
setValueState(parsedValue);
|
|
97
106
|
apiRef.current.setEditCellValue({
|
|
98
107
|
id,
|
|
99
108
|
field,
|
|
100
|
-
value:
|
|
101
|
-
debounceMs
|
|
109
|
+
value: parsedValue,
|
|
110
|
+
debounceMs,
|
|
111
|
+
unstable_skipValueParser: true
|
|
102
112
|
}, event);
|
|
103
|
-
}, [apiRef, debounceMs, field, id, onValueChange]);
|
|
113
|
+
}, [apiRef, debounceMs, field, id, onValueChange, (_rootProps$experiment3 = rootProps.experimentalFeatures) == null ? void 0 : _rootProps$experiment3.newEditingApi]);
|
|
114
|
+
const meta = apiRef.current.unstable_getEditCellMeta ? apiRef.current.unstable_getEditCellMeta(id, field) : {};
|
|
104
115
|
React.useEffect(() => {
|
|
105
|
-
|
|
106
|
-
|
|
116
|
+
if (meta.changeReason !== 'debouncedSetEditCellValue') {
|
|
117
|
+
setValueState(value);
|
|
118
|
+
}
|
|
119
|
+
}, [meta.changeReason, value]);
|
|
107
120
|
(0, _utils.unstable_useEnhancedEffect)(() => {
|
|
108
121
|
if (hasFocus) {
|
|
109
122
|
inputRef.current.focus();
|
|
@@ -137,6 +150,7 @@ process.env.NODE_ENV !== "production" ? GridEditInputCell.propTypes = {
|
|
|
137
150
|
* The mode of the cell.
|
|
138
151
|
*/
|
|
139
152
|
cellMode: _propTypes.default.oneOf(['edit', 'view']),
|
|
153
|
+
changeReason: _propTypes.default.oneOf(['debouncedSetEditCellValue', 'setEditCellValue']),
|
|
140
154
|
|
|
141
155
|
/**
|
|
142
156
|
* The column of the row that the current cell belongs to.
|
|
@@ -217,6 +217,7 @@ process.env.NODE_ENV !== "production" ? GridEditSingleSelectCell.propTypes = {
|
|
|
217
217
|
* The mode of the cell.
|
|
218
218
|
*/
|
|
219
219
|
cellMode: _propTypes.default.oneOf(['edit', 'view']).isRequired,
|
|
220
|
+
changeReason: _propTypes.default.oneOf(['debouncedSetEditCellValue', 'setEditCellValue']),
|
|
220
221
|
|
|
221
222
|
/**
|
|
222
223
|
* The column of the row that the current cell belongs to.
|
|
@@ -382,7 +382,9 @@ const useGridCellEditing = (apiRef, props) => {
|
|
|
382
382
|
const {
|
|
383
383
|
id,
|
|
384
384
|
field,
|
|
385
|
-
value
|
|
385
|
+
value,
|
|
386
|
+
debounceMs,
|
|
387
|
+
unstable_skipValueParser: skipValueParser
|
|
386
388
|
} = params;
|
|
387
389
|
throwIfNotEditable(id, field);
|
|
388
390
|
throwIfNotInMode(id, field, _gridEditRowModel.GridCellModes.Edit);
|
|
@@ -390,13 +392,14 @@ const useGridCellEditing = (apiRef, props) => {
|
|
|
390
392
|
const row = apiRef.current.getRow(id);
|
|
391
393
|
let parsedValue = value;
|
|
392
394
|
|
|
393
|
-
if (column.valueParser) {
|
|
395
|
+
if (column.valueParser && !skipValueParser) {
|
|
394
396
|
parsedValue = column.valueParser(value, apiRef.current.getCellParams(id, field));
|
|
395
397
|
}
|
|
396
398
|
|
|
397
399
|
let editingState = (0, _gridEditRowsSelector.gridEditRowsStateSelector)(apiRef.current.state);
|
|
398
400
|
let newProps = (0, _extends2.default)({}, editingState[id][field], {
|
|
399
|
-
value: parsedValue
|
|
401
|
+
value: parsedValue,
|
|
402
|
+
changeReason: debounceMs ? 'debouncedSetEditCellValue' : 'setEditCellValue'
|
|
400
403
|
});
|
|
401
404
|
|
|
402
405
|
if (column.preProcessEditCellProps) {
|
|
@@ -19,6 +19,8 @@ var _gridEditRowModel = require("../../../models/gridEditRowModel");
|
|
|
19
19
|
|
|
20
20
|
var _useGridRowEditing = require("./useGridRowEditing.new");
|
|
21
21
|
|
|
22
|
+
var _gridEditRowsSelector = require("./gridEditRowsSelector");
|
|
23
|
+
|
|
22
24
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
25
|
|
|
24
26
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -138,11 +140,18 @@ const useGridEditing = (apiRef, props) => {
|
|
|
138
140
|
const getRowWithUpdatedValues = React.useCallback((id, field) => {
|
|
139
141
|
return props.editMode === _gridEditRowModel.GridEditModes.Cell ? apiRef.current.unstable_getRowWithUpdatedValuesFromCellEditing(id, field) : apiRef.current.unstable_getRowWithUpdatedValuesFromRowEditing(id);
|
|
140
142
|
}, [apiRef, props.editMode]);
|
|
143
|
+
const getEditCellMeta = React.useCallback((id, field) => {
|
|
144
|
+
const editingState = (0, _gridEditRowsSelector.gridEditRowsStateSelector)(apiRef.current.state);
|
|
145
|
+
return {
|
|
146
|
+
changeReason: editingState[id][field].changeReason
|
|
147
|
+
};
|
|
148
|
+
}, [apiRef]);
|
|
141
149
|
const editingSharedApi = {
|
|
142
150
|
isCellEditable,
|
|
143
151
|
setEditCellValue,
|
|
144
152
|
unstable_runPendingEditCellValueMutation: runPendingEditCellValueMutation,
|
|
145
|
-
unstable_getRowWithUpdatedValues: getRowWithUpdatedValues
|
|
153
|
+
unstable_getRowWithUpdatedValues: getRowWithUpdatedValues,
|
|
154
|
+
unstable_getEditCellMeta: getEditCellMeta
|
|
146
155
|
};
|
|
147
156
|
(0, _useGridApiMethod.useGridApiMethod)(apiRef, editingSharedApi, 'EditingApi');
|
|
148
157
|
};
|
|
@@ -461,20 +461,23 @@ const useGridRowEditing = (apiRef, props) => {
|
|
|
461
461
|
const {
|
|
462
462
|
id,
|
|
463
463
|
field,
|
|
464
|
-
value
|
|
464
|
+
value,
|
|
465
|
+
debounceMs,
|
|
466
|
+
unstable_skipValueParser: skipValueParser
|
|
465
467
|
} = params;
|
|
466
468
|
throwIfNotEditable(id, field);
|
|
467
469
|
const column = apiRef.current.getColumn(field);
|
|
468
470
|
const row = apiRef.current.getRow(id);
|
|
469
471
|
let parsedValue = value;
|
|
470
472
|
|
|
471
|
-
if (column.valueParser) {
|
|
473
|
+
if (column.valueParser && !skipValueParser) {
|
|
472
474
|
parsedValue = column.valueParser(value, apiRef.current.getCellParams(id, field));
|
|
473
475
|
}
|
|
474
476
|
|
|
475
477
|
let editingState = (0, _gridEditRowsSelector.gridEditRowsStateSelector)(apiRef.current.state);
|
|
476
478
|
let newProps = (0, _extends2.default)({}, editingState[id][field], {
|
|
477
|
-
value: parsedValue
|
|
479
|
+
value: parsedValue,
|
|
480
|
+
changeReason: debounceMs ? 'debouncedSetEditCellValue' : 'setEditCellValue'
|
|
478
481
|
});
|
|
479
482
|
|
|
480
483
|
if (!column.preProcessEditCellProps) {
|
|
@@ -55,6 +55,14 @@ exports.focusStateInitializer = focusStateInitializer;
|
|
|
55
55
|
const useGridFocus = (apiRef, props) => {
|
|
56
56
|
const logger = (0, _useGridLogger.useGridLogger)(apiRef, 'useGridFocus');
|
|
57
57
|
const lastClickedCell = React.useRef(null);
|
|
58
|
+
const publishCellFocusOut = React.useCallback((cell, event) => {
|
|
59
|
+
if (cell) {
|
|
60
|
+
// The row might have been deleted
|
|
61
|
+
if (apiRef.current.getRow(cell.id)) {
|
|
62
|
+
apiRef.current.publishEvent('cellFocusOut', apiRef.current.getCellParams(cell.id, cell.field), event);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}, [apiRef]);
|
|
58
66
|
const setCellFocus = React.useCallback((id, field) => {
|
|
59
67
|
const focusedCell = (0, _gridFocusStateSelector.gridFocusCellSelector)(apiRef);
|
|
60
68
|
|
|
@@ -90,18 +98,14 @@ const useGridFocus = (apiRef, props) => {
|
|
|
90
98
|
if (focusedCell) {
|
|
91
99
|
// There's a focused cell but another cell was clicked
|
|
92
100
|
// Publishes an event to notify that the focus was lost
|
|
93
|
-
|
|
101
|
+
publishCellFocusOut(focusedCell, {});
|
|
94
102
|
}
|
|
95
103
|
|
|
96
104
|
apiRef.current.publishEvent('cellFocusIn', apiRef.current.getCellParams(id, field));
|
|
97
|
-
}, [apiRef, logger]);
|
|
105
|
+
}, [apiRef, logger, publishCellFocusOut]);
|
|
98
106
|
const setColumnHeaderFocus = React.useCallback((field, event = {}) => {
|
|
99
107
|
const cell = (0, _gridFocusStateSelector.gridFocusCellSelector)(apiRef);
|
|
100
|
-
|
|
101
|
-
if (cell) {
|
|
102
|
-
apiRef.current.publishEvent('cellFocusOut', apiRef.current.getCellParams(cell.id, cell.field), event);
|
|
103
|
-
}
|
|
104
|
-
|
|
108
|
+
publishCellFocusOut(cell, event);
|
|
105
109
|
apiRef.current.setState(state => {
|
|
106
110
|
logger.debug(`Focusing on column header with colIndex=${field}`);
|
|
107
111
|
return (0, _extends2.default)({}, state, {
|
|
@@ -120,7 +124,7 @@ const useGridFocus = (apiRef, props) => {
|
|
|
120
124
|
});
|
|
121
125
|
});
|
|
122
126
|
apiRef.current.forceUpdate();
|
|
123
|
-
}, [apiRef, logger]);
|
|
127
|
+
}, [apiRef, logger, publishCellFocusOut]);
|
|
124
128
|
const moveFocusToRelativeCell = React.useCallback((id, field, direction) => {
|
|
125
129
|
let columnIndexToFocus = apiRef.current.getColumnIndex(field);
|
|
126
130
|
let rowIndexToFocus = apiRef.current.getRowIndexRelativeToVisibleRows(id);
|
|
@@ -229,11 +233,6 @@ const useGridFocus = (apiRef, props) => {
|
|
|
229
233
|
|
|
230
234
|
if (cellElement != null && cellElement.contains(event.target)) {
|
|
231
235
|
return;
|
|
232
|
-
} // The row might have been deleted during the click
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
if (!apiRef.current.getRow(focusedCell.id)) {
|
|
236
|
-
return;
|
|
237
236
|
}
|
|
238
237
|
|
|
239
238
|
if (cellParams) {
|
|
@@ -248,9 +247,9 @@ const useGridFocus = (apiRef, props) => {
|
|
|
248
247
|
apiRef.current.forceUpdate(); // There's a focused cell but another element (not a cell) was clicked
|
|
249
248
|
// Publishes an event to notify that the focus was lost
|
|
250
249
|
|
|
251
|
-
|
|
250
|
+
publishCellFocusOut(focusedCell, event);
|
|
252
251
|
}
|
|
253
|
-
}, [apiRef]);
|
|
252
|
+
}, [apiRef, publishCellFocusOut]);
|
|
254
253
|
const handleCellModeChange = React.useCallback(params => {
|
|
255
254
|
if (params.cellMode === 'view') {
|
|
256
255
|
return;
|
package/node/index.js
CHANGED