@mui/x-data-grid 7.18.0 → 7.20.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 +213 -11
- package/DataGrid/DataGrid.js +12 -0
- package/components/cell/GridCell.js +7 -8
- package/components/columnHeaders/GridBaseColumnHeaders.js +1 -1
- package/components/columnHeaders/GridColumnHeaderItem.js +1 -0
- package/components/columnSelection/GridCellCheckboxRenderer.js +12 -4
- package/components/columnSelection/GridHeaderCheckbox.d.ts +1 -1
- package/components/containers/GridRoot.js +1 -1
- package/components/containers/GridRootStyles.js +32 -23
- package/components/containers/GridToolbarContainer.js +1 -1
- package/components/menu/GridMenu.js +1 -1
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/panel/GridPanel.js +1 -1
- package/components/panel/GridPanelContent.js +1 -1
- package/components/panel/GridPanelFooter.js +1 -1
- package/components/panel/GridPanelHeader.js +1 -1
- package/components/panel/GridPanelWrapper.js +1 -1
- package/components/panel/filterPanel/filterPanelUtils.d.ts +1 -1
- package/components/toolbar/GridToolbarQuickFilter.js +1 -1
- package/components/virtualization/GridBottomContainer.d.ts +1 -1
- package/components/virtualization/GridBottomContainer.js +18 -1
- package/components/virtualization/GridMainContainer.js +3 -1
- package/components/virtualization/GridTopContainer.d.ts +1 -1
- package/components/virtualization/GridTopContainer.js +1 -1
- package/components/virtualization/GridVirtualScrollbar.js +1 -7
- package/components/virtualization/GridVirtualScroller.js +1 -0
- package/components/virtualization/GridVirtualScrollerFiller.js +3 -4
- package/hooks/core/useGridRefs.js +4 -0
- package/hooks/features/columnGrouping/gridColumnGroupsSelector.d.ts +4 -4
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +1 -1
- package/hooks/features/columnResize/columnResizeSelector.d.ts +1 -1
- package/hooks/features/columns/gridColumnsSelector.d.ts +12 -12
- package/hooks/features/columns/gridColumnsUtils.js +3 -2
- package/hooks/features/density/densitySelector.d.ts +1 -1
- package/hooks/features/dimensions/useGridDimensions.js +2 -2
- package/hooks/features/editing/useGridCellEditing.js +4 -2
- package/hooks/features/editing/useGridRowEditing.js +4 -2
- package/hooks/features/events/useGridEvents.d.ts +1 -1
- package/hooks/features/events/useGridEvents.js +1 -0
- package/hooks/features/filter/gridFilterSelector.d.ts +17 -17
- package/hooks/features/filter/gridFilterUtils.js +1 -1
- package/hooks/features/focus/gridFocusStateSelector.d.ts +8 -8
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +3 -3
- package/hooks/features/keyboardNavigation/utils.d.ts +1 -1
- package/hooks/features/pagination/gridPaginationSelector.d.ts +9 -9
- package/hooks/features/rowSelection/gridRowSelectionSelector.d.ts +3 -3
- package/hooks/features/rowSelection/useGridRowSelection.d.ts +1 -1
- package/hooks/features/rowSelection/useGridRowSelection.js +105 -29
- package/hooks/features/rowSelection/utils.d.ts +10 -0
- package/hooks/features/rowSelection/utils.js +156 -1
- package/hooks/features/rows/gridRowSpanningSelectors.d.ts +3 -3
- package/hooks/features/rows/gridRowsSelector.d.ts +14 -14
- package/hooks/features/rows/gridRowsUtils.js +1 -1
- package/hooks/features/rows/useGridRowSpanning.js +1 -1
- package/hooks/features/rows/useGridRows.d.ts +1 -1
- package/hooks/features/rows/useGridRows.js +7 -1
- package/hooks/features/scroll/useGridScroll.js +26 -22
- package/hooks/features/sorting/gridSortingSelector.d.ts +4 -4
- package/hooks/features/sorting/gridSortingUtils.js +1 -1
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +5 -5
- package/hooks/features/virtualization/useGridVirtualScroller.js +2 -2
- package/hooks/utils/useGridApiContext.js +1 -1
- package/hooks/utils/useGridApiEventHandler.d.ts +1 -1
- package/hooks/utils/useGridApiEventHandler.js +1 -1
- package/hooks/utils/useGridConfiguration.js +1 -1
- package/hooks/utils/useGridPrivateApiContext.js +1 -1
- package/hooks/utils/useGridVisibleRows.d.ts +2 -2
- package/index.d.ts +2 -2
- package/index.js +3 -3
- package/internals/index.d.ts +1 -0
- package/internals/index.js +1 -0
- package/joy/icons.js +0 -1
- package/locales/bgBG.js +8 -9
- package/locales/deDE.js +4 -4
- package/locales/frFR.js +4 -4
- package/locales/hrHR.d.ts +1 -1
- package/locales/hrHR.js +69 -46
- package/locales/jaJP.js +5 -6
- package/locales/ptPT.d.ts +1 -1
- package/locales/ptPT.js +4 -4
- package/locales/viVN.js +20 -20
- package/locales/zhHK.d.ts +1 -1
- package/models/api/gridApiCommunity.d.ts +1 -1
- package/models/api/gridCoreApi.d.ts +9 -1
- package/models/api/gridFilterApi.d.ts +1 -1
- package/models/events/gridEventLookup.d.ts +7 -0
- package/models/gridRowSelectionModel.d.ts +4 -0
- package/models/gridStateCommunity.d.ts +2 -2
- package/models/props/DataGridProps.d.ts +38 -10
- package/modern/DataGrid/DataGrid.js +12 -0
- package/modern/components/cell/GridCell.js +7 -8
- package/modern/components/columnHeaders/GridBaseColumnHeaders.js +1 -1
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +1 -0
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +12 -4
- package/modern/components/containers/GridRoot.js +1 -1
- package/modern/components/containers/GridRootStyles.js +32 -23
- package/modern/components/containers/GridToolbarContainer.js +1 -1
- package/modern/components/menu/GridMenu.js +1 -1
- package/modern/components/panel/GridPanel.js +1 -1
- package/modern/components/panel/GridPanelContent.js +1 -1
- package/modern/components/panel/GridPanelFooter.js +1 -1
- package/modern/components/panel/GridPanelHeader.js +1 -1
- package/modern/components/panel/GridPanelWrapper.js +1 -1
- package/modern/components/toolbar/GridToolbarQuickFilter.js +1 -1
- package/modern/components/virtualization/GridBottomContainer.js +18 -1
- package/modern/components/virtualization/GridMainContainer.js +3 -1
- package/modern/components/virtualization/GridTopContainer.js +1 -1
- package/modern/components/virtualization/GridVirtualScrollbar.js +1 -7
- package/modern/components/virtualization/GridVirtualScroller.js +1 -0
- package/modern/components/virtualization/GridVirtualScrollerFiller.js +3 -4
- package/modern/hooks/core/useGridRefs.js +4 -0
- package/modern/hooks/features/columns/gridColumnsUtils.js +3 -2
- package/modern/hooks/features/dimensions/useGridDimensions.js +2 -2
- package/modern/hooks/features/editing/useGridCellEditing.js +4 -2
- package/modern/hooks/features/editing/useGridRowEditing.js +4 -2
- package/modern/hooks/features/events/useGridEvents.js +1 -0
- package/modern/hooks/features/filter/gridFilterUtils.js +1 -1
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +105 -29
- package/modern/hooks/features/rowSelection/utils.js +156 -1
- package/modern/hooks/features/rows/gridRowsUtils.js +1 -1
- package/modern/hooks/features/rows/useGridRowSpanning.js +1 -1
- package/modern/hooks/features/rows/useGridRows.js +7 -1
- package/modern/hooks/features/scroll/useGridScroll.js +26 -22
- package/modern/hooks/features/sorting/gridSortingUtils.js +1 -1
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +2 -2
- package/modern/hooks/utils/useGridApiContext.js +1 -1
- package/modern/hooks/utils/useGridApiEventHandler.js +1 -1
- package/modern/hooks/utils/useGridConfiguration.js +1 -1
- package/modern/hooks/utils/useGridPrivateApiContext.js +1 -1
- package/modern/index.js +3 -3
- package/modern/internals/index.js +1 -0
- package/modern/joy/icons.js +0 -1
- package/modern/locales/bgBG.js +8 -9
- package/modern/locales/deDE.js +4 -4
- package/modern/locales/frFR.js +4 -4
- package/modern/locales/hrHR.js +69 -46
- package/modern/locales/jaJP.js +5 -6
- package/modern/locales/ptPT.js +4 -4
- package/modern/locales/viVN.js +20 -20
- package/modern/utils/createSelector.js +6 -0
- package/modern/utils/domUtils.js +1 -1
- package/node/DataGrid/DataGrid.js +12 -0
- package/node/components/cell/GridCell.js +7 -8
- package/node/components/columnHeaders/GridBaseColumnHeaders.js +1 -1
- package/node/components/columnHeaders/GridColumnHeaderItem.js +1 -0
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +12 -4
- package/node/components/containers/GridRoot.js +1 -1
- package/node/components/containers/GridRootStyles.js +32 -23
- package/node/components/containers/GridToolbarContainer.js +1 -1
- package/node/components/menu/GridMenu.js +1 -1
- package/node/components/panel/GridPanel.js +1 -1
- package/node/components/panel/GridPanelContent.js +1 -1
- package/node/components/panel/GridPanelFooter.js +1 -1
- package/node/components/panel/GridPanelHeader.js +1 -1
- package/node/components/panel/GridPanelWrapper.js +1 -1
- package/node/components/toolbar/GridToolbarQuickFilter.js +1 -1
- package/node/components/virtualization/GridBottomContainer.js +18 -1
- package/node/components/virtualization/GridMainContainer.js +3 -1
- package/node/components/virtualization/GridTopContainer.js +1 -1
- package/node/components/virtualization/GridVirtualScrollbar.js +1 -7
- package/node/components/virtualization/GridVirtualScroller.js +1 -0
- package/node/components/virtualization/GridVirtualScrollerFiller.js +3 -4
- package/node/hooks/core/useGridRefs.js +4 -0
- package/node/hooks/features/columns/gridColumnsUtils.js +3 -2
- package/node/hooks/features/dimensions/useGridDimensions.js +2 -2
- package/node/hooks/features/editing/useGridCellEditing.js +4 -2
- package/node/hooks/features/editing/useGridRowEditing.js +4 -2
- package/node/hooks/features/events/useGridEvents.js +1 -0
- package/node/hooks/features/filter/gridFilterUtils.js +1 -1
- package/node/hooks/features/rowSelection/useGridRowSelection.js +102 -26
- package/node/hooks/features/rowSelection/utils.js +160 -1
- package/node/hooks/features/rows/gridRowsUtils.js +1 -1
- package/node/hooks/features/rows/useGridRowSpanning.js +1 -1
- package/node/hooks/features/rows/useGridRows.js +7 -1
- package/node/hooks/features/scroll/useGridScroll.js +26 -22
- package/node/hooks/features/sorting/gridSortingUtils.js +1 -1
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +2 -2
- package/node/hooks/utils/useGridApiContext.js +1 -1
- package/node/hooks/utils/useGridApiEventHandler.js +1 -1
- package/node/hooks/utils/useGridConfiguration.js +1 -1
- package/node/hooks/utils/useGridPrivateApiContext.js +1 -1
- package/node/index.js +1 -1
- package/node/internals/index.js +23 -15
- package/node/joy/icons.js +0 -1
- package/node/locales/bgBG.js +8 -9
- package/node/locales/deDE.js +4 -4
- package/node/locales/frFR.js +4 -4
- package/node/locales/hrHR.js +69 -46
- package/node/locales/jaJP.js +5 -6
- package/node/locales/ptPT.js +4 -4
- package/node/locales/viVN.js +20 -20
- package/node/utils/createSelector.js +6 -0
- package/node/utils/domUtils.js +1 -1
- package/package.json +4 -4
- package/utils/createSelector.js +6 -0
- package/utils/domUtils.js +1 -1
package/modern/locales/viVN.js
CHANGED
|
@@ -46,21 +46,21 @@ const viVNGrid = {
|
|
|
46
46
|
filterPanelInputLabel: 'Giá trị',
|
|
47
47
|
filterPanelInputPlaceholder: 'Lọc giá trị',
|
|
48
48
|
// Filter operators text
|
|
49
|
-
filterOperatorContains: '
|
|
50
|
-
|
|
51
|
-
filterOperatorEquals: '
|
|
52
|
-
|
|
53
|
-
filterOperatorStartsWith: '
|
|
54
|
-
filterOperatorEndsWith: '
|
|
55
|
-
filterOperatorIs: '
|
|
56
|
-
filterOperatorNot: '
|
|
57
|
-
filterOperatorAfter: '
|
|
49
|
+
filterOperatorContains: 'chứa',
|
|
50
|
+
filterOperatorDoesNotContain: 'không chứa',
|
|
51
|
+
filterOperatorEquals: 'bằng',
|
|
52
|
+
filterOperatorDoesNotEqual: 'không bằng',
|
|
53
|
+
filterOperatorStartsWith: 'bắt đầu với',
|
|
54
|
+
filterOperatorEndsWith: 'kết thúc với',
|
|
55
|
+
filterOperatorIs: 'là',
|
|
56
|
+
filterOperatorNot: 'không phải là',
|
|
57
|
+
filterOperatorAfter: 'sau',
|
|
58
58
|
filterOperatorOnOrAfter: 'bằng hoặc sau',
|
|
59
|
-
filterOperatorBefore: '
|
|
59
|
+
filterOperatorBefore: 'trước',
|
|
60
60
|
filterOperatorOnOrBefore: 'bằng hoặc trước',
|
|
61
|
-
filterOperatorIsEmpty: '
|
|
62
|
-
filterOperatorIsNotEmpty: '
|
|
63
|
-
filterOperatorIsAnyOf: '
|
|
61
|
+
filterOperatorIsEmpty: 'rỗng',
|
|
62
|
+
filterOperatorIsNotEmpty: 'khác rỗng',
|
|
63
|
+
filterOperatorIsAnyOf: 'là một trong',
|
|
64
64
|
'filterOperator=': '=',
|
|
65
65
|
'filterOperator!=': '!=',
|
|
66
66
|
'filterOperator>': '>',
|
|
@@ -69,20 +69,20 @@ const viVNGrid = {
|
|
|
69
69
|
'filterOperator<=': '<=',
|
|
70
70
|
// Header filter operators text
|
|
71
71
|
headerFilterOperatorContains: 'Chứa',
|
|
72
|
-
|
|
72
|
+
headerFilterOperatorDoesNotContain: 'Không chứa',
|
|
73
73
|
headerFilterOperatorEquals: 'Bằng',
|
|
74
|
-
|
|
74
|
+
headerFilterOperatorDoesNotEqual: 'Không bằng',
|
|
75
75
|
headerFilterOperatorStartsWith: 'Bắt đầu với',
|
|
76
76
|
headerFilterOperatorEndsWith: 'Kết thúc với',
|
|
77
|
-
headerFilterOperatorIs: '
|
|
78
|
-
headerFilterOperatorNot: 'Không là',
|
|
77
|
+
headerFilterOperatorIs: 'Là',
|
|
78
|
+
headerFilterOperatorNot: 'Không phải là',
|
|
79
79
|
headerFilterOperatorAfter: 'Sau',
|
|
80
|
-
headerFilterOperatorOnOrAfter: '
|
|
80
|
+
headerFilterOperatorOnOrAfter: 'Bằng hoặc sau',
|
|
81
81
|
headerFilterOperatorBefore: 'Trước',
|
|
82
|
-
headerFilterOperatorOnOrBefore: '
|
|
82
|
+
headerFilterOperatorOnOrBefore: 'Bằng hoặc trước',
|
|
83
83
|
headerFilterOperatorIsEmpty: 'Rỗng',
|
|
84
84
|
headerFilterOperatorIsNotEmpty: 'Khác rỗng',
|
|
85
|
-
headerFilterOperatorIsAnyOf: '
|
|
85
|
+
headerFilterOperatorIsAnyOf: 'Là một trong',
|
|
86
86
|
'headerFilterOperator=': 'Bằng',
|
|
87
87
|
'headerFilterOperator!=': 'Khác',
|
|
88
88
|
'headerFilterOperator>': 'Lớn hơn',
|
|
@@ -34,6 +34,8 @@ export const createSelector = (a, b, c, d, e, f, ...other) => {
|
|
|
34
34
|
throw new Error('Unsupported number of selectors');
|
|
35
35
|
}
|
|
36
36
|
let selector;
|
|
37
|
+
|
|
38
|
+
// eslint-disable-next-line id-denylist
|
|
37
39
|
if (a && b && c && d && e && f) {
|
|
38
40
|
selector = (stateOrApiRef, instanceIdParam) => {
|
|
39
41
|
const isAPIRef = checkIsAPIRef(stateOrApiRef);
|
|
@@ -46,6 +48,7 @@ export const createSelector = (a, b, c, d, e, f, ...other) => {
|
|
|
46
48
|
const ve = e(state, instanceId);
|
|
47
49
|
return f(va, vb, vc, vd, ve);
|
|
48
50
|
};
|
|
51
|
+
// eslint-disable-next-line id-denylist
|
|
49
52
|
} else if (a && b && c && d && e) {
|
|
50
53
|
selector = (stateOrApiRef, instanceIdParam) => {
|
|
51
54
|
const isAPIRef = checkIsAPIRef(stateOrApiRef);
|
|
@@ -100,6 +103,8 @@ export const createSelectorV8 = (a, b, c, d, e, f, ...other) => {
|
|
|
100
103
|
throw new Error('Unsupported number of selectors');
|
|
101
104
|
}
|
|
102
105
|
let selector;
|
|
106
|
+
|
|
107
|
+
// eslint-disable-next-line id-denylist
|
|
103
108
|
if (a && b && c && d && e && f) {
|
|
104
109
|
selector = (stateOrApiRef, args, instanceIdParam) => {
|
|
105
110
|
const isAPIRef = checkIsAPIRef(stateOrApiRef);
|
|
@@ -112,6 +117,7 @@ export const createSelectorV8 = (a, b, c, d, e, f, ...other) => {
|
|
|
112
117
|
const ve = e(state, args, instanceId);
|
|
113
118
|
return f(va, vb, vc, vd, ve, args);
|
|
114
119
|
};
|
|
120
|
+
// eslint-disable-next-line id-denylist
|
|
115
121
|
} else if (a && b && c && d && e) {
|
|
116
122
|
selector = (stateOrApiRef, args, instanceIdParam) => {
|
|
117
123
|
const isAPIRef = checkIsAPIRef(stateOrApiRef);
|
package/modern/utils/domUtils.js
CHANGED
|
@@ -187,7 +187,7 @@ export function findGridCells(api, field) {
|
|
|
187
187
|
}
|
|
188
188
|
function queryRows(api) {
|
|
189
189
|
return api.virtualScrollerRef.current.querySelectorAll(
|
|
190
|
-
// Use > to ignore rows from nested
|
|
190
|
+
// Use > to ignore rows from nested Data Grids (for example in detail panel)
|
|
191
191
|
`:scope > div > div > .${gridClasses.row}`);
|
|
192
192
|
}
|
|
193
193
|
function parseCellColIndex(col) {
|
|
@@ -80,6 +80,11 @@ DataGridRaw.propTypes = {
|
|
|
80
80
|
/**
|
|
81
81
|
* If `true`, the Data Grid height is dynamic and follows the number of rows in the Data Grid.
|
|
82
82
|
* @default false
|
|
83
|
+
* @deprecated Use flex parent container instead: https://mui.com/x/react-data-grid/layout/#flex-parent-container
|
|
84
|
+
* @example
|
|
85
|
+
* <div style={{ display: 'flex', flexDirection: 'column' }}>
|
|
86
|
+
* <DataGrid />
|
|
87
|
+
* </div>
|
|
83
88
|
*/
|
|
84
89
|
autoHeight: _propTypes.default.bool,
|
|
85
90
|
/**
|
|
@@ -440,6 +445,12 @@ DataGridRaw.propTypes = {
|
|
|
440
445
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
441
446
|
*/
|
|
442
447
|
onColumnHeaderClick: _propTypes.default.func,
|
|
448
|
+
/**
|
|
449
|
+
* Callback fired when a contextmenu event comes from a column header element.
|
|
450
|
+
* @param {GridColumnHeaderParams} params With all properties from [[GridColumnHeaderParams]].
|
|
451
|
+
* @param {MuiEvent<React.MouseEvent>} event The event object.
|
|
452
|
+
*/
|
|
453
|
+
onColumnHeaderContextMenu: _propTypes.default.func,
|
|
443
454
|
/**
|
|
444
455
|
* Callback fired when a double click event comes from a column header element.
|
|
445
456
|
* @param {GridColumnHeaderParams} params With all properties from [[GridColumnHeaderParams]].
|
|
@@ -657,6 +668,7 @@ DataGridRaw.propTypes = {
|
|
|
657
668
|
* @template R
|
|
658
669
|
* @param {R} newRow Row object with the new values.
|
|
659
670
|
* @param {R} oldRow Row object with the old values.
|
|
671
|
+
* @param {{ rowId: GridRowId }} params Additional parameters.
|
|
660
672
|
* @returns {Promise<R> | R} The final values to update the row.
|
|
661
673
|
*/
|
|
662
674
|
processRowUpdate: _propTypes.default.func,
|
|
@@ -126,11 +126,11 @@ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
|
|
|
126
126
|
const result = apiRef.current.getCellParams(rowId, field);
|
|
127
127
|
result.api = apiRef.current;
|
|
128
128
|
return result;
|
|
129
|
-
} catch (
|
|
130
|
-
if (
|
|
129
|
+
} catch (error) {
|
|
130
|
+
if (error instanceof _useGridParamsApi.MissingRowIdError) {
|
|
131
131
|
return EMPTY_CELL_PARAMS;
|
|
132
132
|
}
|
|
133
|
-
throw
|
|
133
|
+
throw error;
|
|
134
134
|
}
|
|
135
135
|
}, _useGridSelector.objectShallowCompare);
|
|
136
136
|
const isSelected = (0, _useGridSelector.useGridSelector)(apiRef, () => apiRef.current.unstable_applyPipeProcessors('isCellSelected', false, {
|
|
@@ -263,10 +263,9 @@ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
|
|
|
263
263
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
264
264
|
"data-colindex": colIndex,
|
|
265
265
|
role: "presentation",
|
|
266
|
-
style: (0, _extends2.default)({
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
})
|
|
266
|
+
style: (0, _extends2.default)({
|
|
267
|
+
width: 'var(--width)'
|
|
268
|
+
}, style)
|
|
270
269
|
});
|
|
271
270
|
}
|
|
272
271
|
if (cellParams === EMPTY_CELL_PARAMS) {
|
|
@@ -323,7 +322,7 @@ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
|
|
|
323
322
|
};
|
|
324
323
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", (0, _extends2.default)({
|
|
325
324
|
ref: handleRef,
|
|
326
|
-
className: (0, _clsx.default)(
|
|
325
|
+
className: (0, _clsx.default)(classes.root, classNames, className),
|
|
327
326
|
role: "gridcell",
|
|
328
327
|
"data-field": field,
|
|
329
328
|
"data-colindex": colIndex,
|
|
@@ -44,7 +44,7 @@ const GridBaseColumnHeaders = exports.GridBaseColumnHeaders = /*#__PURE__*/React
|
|
|
44
44
|
const classes = useUtilityClasses(rootProps);
|
|
45
45
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridColumnHeadersRoot, (0, _extends2.default)({
|
|
46
46
|
ref: ref,
|
|
47
|
-
className: (0, _clsx.default)(
|
|
47
|
+
className: (0, _clsx.default)(classes.root, className),
|
|
48
48
|
ownerState: rootProps
|
|
49
49
|
}, other, {
|
|
50
50
|
role: "presentation"
|
|
@@ -100,6 +100,7 @@ function GridColumnHeaderItem(props) {
|
|
|
100
100
|
}, [apiRef, colDef.field]);
|
|
101
101
|
const mouseEventsHandlers = React.useMemo(() => ({
|
|
102
102
|
onClick: publish('columnHeaderClick'),
|
|
103
|
+
onContextMenu: publish('columnHeaderContextMenu'),
|
|
103
104
|
onDoubleClick: publish('columnHeaderDoubleClick'),
|
|
104
105
|
onMouseOver: publish('columnHeaderOver'),
|
|
105
106
|
// TODO remove as it's not used
|
|
@@ -14,8 +14,10 @@ var _utils = require("@mui/utils");
|
|
|
14
14
|
var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
|
|
15
15
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
16
16
|
var _gridClasses = require("../../constants/gridClasses");
|
|
17
|
+
var _useGridSelector = require("../../hooks/utils/useGridSelector");
|
|
18
|
+
var _utils2 = require("../../hooks/features/rowSelection/utils");
|
|
17
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
-
const _excluded = ["field", "id", "
|
|
20
|
+
const _excluded = ["field", "id", "formattedValue", "row", "rowNode", "colDef", "isEditable", "cellMode", "hasFocus", "tabIndex", "api"];
|
|
19
21
|
const useUtilityClasses = ownerState => {
|
|
20
22
|
const {
|
|
21
23
|
classes
|
|
@@ -29,7 +31,6 @@ const GridCellCheckboxForwardRef = exports.GridCellCheckboxForwardRef = /*#__PUR
|
|
|
29
31
|
const {
|
|
30
32
|
field,
|
|
31
33
|
id,
|
|
32
|
-
value: isChecked,
|
|
33
34
|
rowNode,
|
|
34
35
|
hasFocus,
|
|
35
36
|
tabIndex
|
|
@@ -77,21 +78,28 @@ const GridCellCheckboxForwardRef = exports.GridCellCheckboxForwardRef = /*#__PUR
|
|
|
77
78
|
event.stopPropagation();
|
|
78
79
|
}
|
|
79
80
|
}, []);
|
|
81
|
+
const isSelectable = apiRef.current.isRowSelectable(id);
|
|
82
|
+
const checkboxPropsSelector = (0, _utils2.getCheckboxPropsSelector)(id, rootProps.rowSelectionPropagation?.parents ?? false);
|
|
83
|
+
const {
|
|
84
|
+
isIndeterminate,
|
|
85
|
+
isChecked
|
|
86
|
+
} = (0, _useGridSelector.useGridSelector)(apiRef, checkboxPropsSelector);
|
|
80
87
|
if (rowNode.type === 'footer' || rowNode.type === 'pinnedRow') {
|
|
81
88
|
return null;
|
|
82
89
|
}
|
|
83
|
-
const isSelectable = apiRef.current.isRowSelectable(id);
|
|
84
90
|
const label = apiRef.current.getLocaleText(isChecked ? 'checkboxSelectionUnselectRow' : 'checkboxSelectionSelectRow');
|
|
91
|
+
const checked = rootProps.indeterminateCheckboxAction === 'select' ? isChecked && !isIndeterminate : isChecked;
|
|
85
92
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseCheckbox, (0, _extends2.default)({
|
|
86
93
|
ref: handleRef,
|
|
87
94
|
tabIndex: tabIndex,
|
|
88
|
-
checked:
|
|
95
|
+
checked: checked,
|
|
89
96
|
onChange: handleChange,
|
|
90
97
|
className: classes.root,
|
|
91
98
|
inputProps: {
|
|
92
99
|
'aria-label': label
|
|
93
100
|
},
|
|
94
101
|
onKeyDown: handleKeyDown,
|
|
102
|
+
indeterminate: isIndeterminate,
|
|
95
103
|
disabled: !isSelectable,
|
|
96
104
|
touchRippleRef: rippleRef /* FIXME: typing error */
|
|
97
105
|
}, rootProps.slotProps?.baseCheckbox, other));
|
|
@@ -54,7 +54,7 @@ const GridRoot = exports.GridRoot = /*#__PURE__*/React.forwardRef(function GridR
|
|
|
54
54
|
}
|
|
55
55
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridRootStyles.GridRootStyles, (0, _extends2.default)({
|
|
56
56
|
ref: handleRef,
|
|
57
|
-
className: (0, _clsx.default)(
|
|
57
|
+
className: (0, _clsx.default)(classes.root, className),
|
|
58
58
|
ownerState: ownerState
|
|
59
59
|
}, other));
|
|
60
60
|
});
|
|
@@ -177,14 +177,28 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
|
|
|
177
177
|
const hoverOpacity = (t.vars || t).palette.action.hoverOpacity;
|
|
178
178
|
const hoverColor = (t.vars || t).palette.action.hover;
|
|
179
179
|
const selectedOpacity = (t.vars || t).palette.action.selectedOpacity;
|
|
180
|
+
const selectedHoverOpacity = t.vars ? `calc(${hoverOpacity} + ${selectedOpacity})` // TODO: Improve type
|
|
181
|
+
: hoverOpacity + selectedOpacity;
|
|
180
182
|
const selectedBackground = t.vars ? `rgba(${t.vars.palette.primary.mainChannel} / ${selectedOpacity})` : (0, _styles.alpha)(t.palette.primary.main, selectedOpacity);
|
|
181
|
-
const selectedHoverBackground = t.vars ? `rgba(${t.vars.palette.primary.mainChannel} /
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
183
|
+
const selectedHoverBackground = t.vars ? `rgba(${t.vars.palette.primary.mainChannel} / ${selectedHoverOpacity})` : (0, _styles.alpha)(t.palette.primary.main, selectedHoverOpacity);
|
|
184
|
+
const blendFn = t.vars ? blendCssVars : blend;
|
|
185
|
+
const getPinnedBackgroundStyles = backgroundColor => ({
|
|
186
|
+
[`& .${_gridClasses.gridClasses['cell--pinnedLeft']}, & .${_gridClasses.gridClasses['cell--pinnedRight']}`]: {
|
|
187
|
+
backgroundColor,
|
|
188
|
+
'&.Mui-selected': {
|
|
189
|
+
backgroundColor: blendFn(backgroundColor, selectedBackground, selectedOpacity),
|
|
190
|
+
'&:hover': {
|
|
191
|
+
backgroundColor: blendFn(backgroundColor, selectedBackground, selectedHoverOpacity)
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
const pinnedBackgroundColor = blendFn(pinnedBackground, hoverColor, hoverOpacity);
|
|
197
|
+
const pinnedHoverStyles = getPinnedBackgroundStyles(pinnedBackgroundColor);
|
|
198
|
+
const pinnedSelectedBackgroundColor = blendFn(pinnedBackground, selectedBackground, selectedOpacity);
|
|
199
|
+
const pinnedSelectedStyles = getPinnedBackgroundStyles(pinnedSelectedBackgroundColor);
|
|
200
|
+
const pinnedSelectedHoverBackgroundColor = blendFn(pinnedBackground, selectedHoverBackground, selectedHoverOpacity);
|
|
201
|
+
const pinnedSelectedHoverStyles = getPinnedBackgroundStyles(pinnedSelectedHoverBackgroundColor);
|
|
188
202
|
const selectedStyles = {
|
|
189
203
|
backgroundColor: selectedBackground,
|
|
190
204
|
'&:hover': {
|
|
@@ -624,24 +638,15 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
|
|
|
624
638
|
[`& .${_gridClasses.gridClasses['cell--pinnedLeft']}, & .${_gridClasses.gridClasses['cell--pinnedRight']}`]: {
|
|
625
639
|
position: 'sticky',
|
|
626
640
|
zIndex: 3,
|
|
627
|
-
background: 'var(--DataGrid-pinnedBackground)'
|
|
641
|
+
background: 'var(--DataGrid-pinnedBackground)',
|
|
642
|
+
'&.Mui-selected': {
|
|
643
|
+
backgroundColor: pinnedSelectedBackgroundColor
|
|
644
|
+
}
|
|
628
645
|
},
|
|
629
646
|
[`& .${_gridClasses.gridClasses.virtualScrollerContent} .${_gridClasses.gridClasses.row}`]: {
|
|
630
|
-
'&:hover':
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
}
|
|
634
|
-
},
|
|
635
|
-
[`&.Mui-selected`]: {
|
|
636
|
-
[`& .${_gridClasses.gridClasses['cell--pinnedLeft']}, & .${_gridClasses.gridClasses['cell--pinnedRight']}`]: {
|
|
637
|
-
backgroundColor: pinnedSelectedBackground
|
|
638
|
-
},
|
|
639
|
-
'&:hover': {
|
|
640
|
-
[`& .${_gridClasses.gridClasses['cell--pinnedLeft']}, & .${_gridClasses.gridClasses['cell--pinnedRight']}`]: {
|
|
641
|
-
backgroundColor: pinnedSelectedHoverBackground
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
}
|
|
647
|
+
'&:hover': pinnedHoverStyles,
|
|
648
|
+
'&.Mui-selected': pinnedSelectedStyles,
|
|
649
|
+
'&.Mui-selected:hover': pinnedSelectedHoverStyles
|
|
645
650
|
},
|
|
646
651
|
[`& .${_gridClasses.gridClasses.cellOffsetLeft}`]: {
|
|
647
652
|
flex: '0 0 auto',
|
|
@@ -754,4 +759,8 @@ function blend(background, overlay, opacity, gamma = 1) {
|
|
|
754
759
|
type: 'rgb',
|
|
755
760
|
values: rgb
|
|
756
761
|
});
|
|
762
|
+
}
|
|
763
|
+
const removeOpacity = color => `rgb(from ${color} r g b / 1)`;
|
|
764
|
+
function blendCssVars(background, overlay, opacity) {
|
|
765
|
+
return `color-mix(in srgb,${background}, ${removeOpacity(overlay)} calc(${opacity} * 100%))`;
|
|
757
766
|
}
|
|
@@ -52,7 +52,7 @@ const GridToolbarContainer = exports.GridToolbarContainer = /*#__PURE__*/React.f
|
|
|
52
52
|
}
|
|
53
53
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridToolbarContainerRoot, (0, _extends2.default)({
|
|
54
54
|
ref: ref,
|
|
55
|
-
className: (0, _clsx.default)(
|
|
55
|
+
className: (0, _clsx.default)(classes.root, className),
|
|
56
56
|
ownerState: rootProps
|
|
57
57
|
}, other, {
|
|
58
58
|
children: children
|
|
@@ -93,7 +93,7 @@ function GridMenu(props) {
|
|
|
93
93
|
};
|
|
94
94
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridMenuRoot, (0, _extends2.default)({
|
|
95
95
|
as: rootProps.slots.basePopper,
|
|
96
|
-
className: (0, _clsx.default)(
|
|
96
|
+
className: (0, _clsx.default)(classes.root, className),
|
|
97
97
|
ownerState: rootProps,
|
|
98
98
|
open: open,
|
|
99
99
|
anchorEl: target,
|
|
@@ -92,7 +92,7 @@ const GridPanel = exports.GridPanel = /*#__PURE__*/React.forwardRef((props, ref)
|
|
|
92
92
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridPanelRoot, (0, _extends2.default)({
|
|
93
93
|
ref: ref,
|
|
94
94
|
placement: "bottom-start",
|
|
95
|
-
className: (0, _clsx.default)(
|
|
95
|
+
className: (0, _clsx.default)(classes.panel, className),
|
|
96
96
|
ownerState: rootProps,
|
|
97
97
|
anchorEl: anchorEl,
|
|
98
98
|
modifiers: modifiers
|
|
@@ -45,7 +45,7 @@ function GridPanelContent(props) {
|
|
|
45
45
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
46
46
|
const classes = useUtilityClasses(rootProps);
|
|
47
47
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridPanelContentRoot, (0, _extends2.default)({
|
|
48
|
-
className: (0, _clsx.default)(
|
|
48
|
+
className: (0, _clsx.default)(classes.root, className),
|
|
49
49
|
ownerState: rootProps
|
|
50
50
|
}, other));
|
|
51
51
|
}
|
|
@@ -45,7 +45,7 @@ function GridPanelFooter(props) {
|
|
|
45
45
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
46
46
|
const classes = useUtilityClasses(rootProps);
|
|
47
47
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridPanelFooterRoot, (0, _extends2.default)({
|
|
48
|
-
className: (0, _clsx.default)(
|
|
48
|
+
className: (0, _clsx.default)(classes.root, className),
|
|
49
49
|
ownerState: rootProps
|
|
50
50
|
}, other));
|
|
51
51
|
}
|
|
@@ -43,7 +43,7 @@ function GridPanelHeader(props) {
|
|
|
43
43
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
44
44
|
const classes = useUtilityClasses(rootProps);
|
|
45
45
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridPanelHeaderRoot, (0, _extends2.default)({
|
|
46
|
-
className: (0, _clsx.default)(
|
|
46
|
+
className: (0, _clsx.default)(classes.root, className),
|
|
47
47
|
ownerState: rootProps
|
|
48
48
|
}, other));
|
|
49
49
|
}
|
|
@@ -56,7 +56,7 @@ const GridPanelWrapper = exports.GridPanelWrapper = /*#__PURE__*/React.forwardRe
|
|
|
56
56
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(GridPanelWrapperRoot, (0, _extends2.default)({
|
|
57
57
|
ref: ref,
|
|
58
58
|
tabIndex: -1,
|
|
59
|
-
className: (0, _clsx.default)(
|
|
59
|
+
className: (0, _clsx.default)(classes.root, className),
|
|
60
60
|
ownerState: rootProps
|
|
61
61
|
}, other))
|
|
62
62
|
}));
|
|
@@ -101,7 +101,7 @@ function GridToolbarQuickFilter(props) {
|
|
|
101
101
|
variant: "standard",
|
|
102
102
|
value: searchValue,
|
|
103
103
|
onChange: handleSearchValueChange,
|
|
104
|
-
className: (0, _clsx.default)(
|
|
104
|
+
className: (0, _clsx.default)(classes.root, className),
|
|
105
105
|
placeholder: apiRef.current.getLocaleText('toolbarQuickFilterPlaceholder'),
|
|
106
106
|
"aria-label": apiRef.current.getLocaleText('toolbarQuickFilterLabel'),
|
|
107
107
|
type: "search"
|
|
@@ -12,6 +12,9 @@ var _clsx = _interopRequireDefault(require("clsx"));
|
|
|
12
12
|
var _system = require("@mui/system");
|
|
13
13
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
14
14
|
var _gridClasses = require("../../constants/gridClasses");
|
|
15
|
+
var _gridDimensionsSelectors = require("../../hooks/features/dimensions/gridDimensionsSelectors");
|
|
16
|
+
var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
|
|
17
|
+
var _useGridSelector = require("../../hooks/utils/useGridSelector");
|
|
15
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
19
|
const useUtilityClasses = () => {
|
|
17
20
|
const slots = {
|
|
@@ -26,8 +29,22 @@ const Element = (0, _system.styled)('div')({
|
|
|
26
29
|
});
|
|
27
30
|
function GridBottomContainer(props) {
|
|
28
31
|
const classes = useUtilityClasses();
|
|
32
|
+
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
33
|
+
const {
|
|
34
|
+
viewportOuterSize,
|
|
35
|
+
minimumSize,
|
|
36
|
+
hasScrollX,
|
|
37
|
+
scrollbarSize
|
|
38
|
+
} = (0, _useGridSelector.useGridSelector)(apiRef, _gridDimensionsSelectors.gridDimensionsSelector);
|
|
39
|
+
const scrollHeight = hasScrollX ? scrollbarSize : 0;
|
|
40
|
+
const offset = Math.max(viewportOuterSize.height - minimumSize.height -
|
|
41
|
+
// Subtract scroll height twice to account for GridVirtualScrollerFiller and horizontal scrollbar
|
|
42
|
+
2 * scrollHeight, 0);
|
|
29
43
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Element, (0, _extends2.default)({}, props, {
|
|
30
|
-
className: (0, _clsx.default)(classes.root,
|
|
44
|
+
className: (0, _clsx.default)(classes.root, _gridClasses.gridClasses['container--bottom']),
|
|
45
|
+
style: {
|
|
46
|
+
transform: `translateY(${offset}px)`
|
|
47
|
+
},
|
|
31
48
|
role: "presentation"
|
|
32
49
|
}));
|
|
33
50
|
}
|
|
@@ -24,7 +24,9 @@ const Element = (0, _system.styled)('div', {
|
|
|
24
24
|
})({
|
|
25
25
|
flexGrow: 1,
|
|
26
26
|
position: 'relative',
|
|
27
|
-
overflow: 'hidden'
|
|
27
|
+
overflow: 'hidden',
|
|
28
|
+
display: 'flex',
|
|
29
|
+
flexDirection: 'column'
|
|
28
30
|
});
|
|
29
31
|
const GridMainContainer = exports.GridMainContainer = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
30
32
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
@@ -27,7 +27,7 @@ const Element = (0, _system.styled)('div')({
|
|
|
27
27
|
function GridTopContainer(props) {
|
|
28
28
|
const classes = useUtilityClasses();
|
|
29
29
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Element, (0, _extends2.default)({}, props, {
|
|
30
|
-
className: (0, _clsx.default)(classes.root,
|
|
30
|
+
className: (0, _clsx.default)(classes.root, _gridClasses.gridClasses['container--top']),
|
|
31
31
|
role: "presentation"
|
|
32
32
|
}));
|
|
33
33
|
}
|
|
@@ -28,9 +28,6 @@ const Scrollbar = (0, _system.styled)('div')({
|
|
|
28
28
|
position: 'absolute',
|
|
29
29
|
display: 'inline-block',
|
|
30
30
|
zIndex: 6,
|
|
31
|
-
'& > div': {
|
|
32
|
-
display: 'inline-block'
|
|
33
|
-
},
|
|
34
31
|
// In macOS Safari and Gnome Web, scrollbars are overlaid and don't affect the layout. So we consider
|
|
35
32
|
// their size to be 0px throughout all the calculations, but the floating scrollbar container does need
|
|
36
33
|
// to appear and have a real size. We set it to 14px because it seems like an acceptable value and we
|
|
@@ -62,9 +59,6 @@ const ScrollbarHorizontal = (0, _system.styled)(Scrollbar)({
|
|
|
62
59
|
},
|
|
63
60
|
bottom: '0px'
|
|
64
61
|
});
|
|
65
|
-
const Content = (0, _system.styled)('div')({
|
|
66
|
-
display: 'inline-block'
|
|
67
|
-
});
|
|
68
62
|
const GridVirtualScrollbar = exports.GridVirtualScrollbar = /*#__PURE__*/React.forwardRef(function GridVirtualScrollbar(props, ref) {
|
|
69
63
|
const apiRef = (0, _useGridPrivateApiContext.useGridPrivateApiContext)();
|
|
70
64
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
@@ -134,7 +128,7 @@ const GridVirtualScrollbar = exports.GridVirtualScrollbar = /*#__PURE__*/React.f
|
|
|
134
128
|
className: classes.root,
|
|
135
129
|
tabIndex: -1,
|
|
136
130
|
"aria-hidden": "true",
|
|
137
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
131
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
138
132
|
ref: contentRef,
|
|
139
133
|
className: classes.content
|
|
140
134
|
})
|
|
@@ -51,10 +51,9 @@ function GridVirtualScrollerFiller({
|
|
|
51
51
|
leftPinnedWidth,
|
|
52
52
|
rightPinnedWidth
|
|
53
53
|
} = (0, _useGridSelector.useGridSelector)(apiRef, _dimensions.gridDimensionsSelector);
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
if (height === 0) {
|
|
54
|
+
const height = hasScrollX ? scrollbarSize : 0;
|
|
55
|
+
const needsLastRowBorder = viewportOuterSize.height - minimumSize.height > 0;
|
|
56
|
+
if (height === 0 && !needsLastRowBorder) {
|
|
58
57
|
return null;
|
|
59
58
|
}
|
|
60
59
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Filler, {
|
|
@@ -10,6 +10,8 @@ const useGridRefs = apiRef => {
|
|
|
10
10
|
const rootElementRef = React.useRef(null);
|
|
11
11
|
const mainElementRef = React.useRef(null);
|
|
12
12
|
const virtualScrollerRef = React.useRef(null);
|
|
13
|
+
const virtualScrollbarVerticalRef = React.useRef(null);
|
|
14
|
+
const virtualScrollbarHorizontalRef = React.useRef(null);
|
|
13
15
|
const columnHeadersContainerRef = React.useRef(null);
|
|
14
16
|
apiRef.current.register('public', {
|
|
15
17
|
rootElementRef
|
|
@@ -17,6 +19,8 @@ const useGridRefs = apiRef => {
|
|
|
17
19
|
apiRef.current.register('private', {
|
|
18
20
|
mainElementRef,
|
|
19
21
|
virtualScrollerRef,
|
|
22
|
+
virtualScrollbarVerticalRef,
|
|
23
|
+
virtualScrollbarHorizontalRef,
|
|
20
24
|
columnHeadersContainerRef
|
|
21
25
|
});
|
|
22
26
|
};
|
|
@@ -11,6 +11,7 @@ exports.getFirstNonSpannedColumnToRender = getFirstNonSpannedColumnToRender;
|
|
|
11
11
|
exports.getTotalHeaderHeight = getTotalHeaderHeight;
|
|
12
12
|
exports.hydrateColumnsWidth = void 0;
|
|
13
13
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
14
|
+
var _resolveProps = _interopRequireDefault(require("@mui/utils/resolveProps"));
|
|
14
15
|
var _colDef = require("../../../colDef");
|
|
15
16
|
var _gridColumnsSelector = require("./gridColumnsSelector");
|
|
16
17
|
var _utils = require("../../../utils/utils");
|
|
@@ -289,9 +290,9 @@ const createColumnsState = ({
|
|
|
289
290
|
}
|
|
290
291
|
}
|
|
291
292
|
});
|
|
292
|
-
columnsState.lookup[field] = (0, _extends2.default)({},
|
|
293
|
+
columnsState.lookup[field] = (0, _resolveProps.default)(existingState, (0, _extends2.default)({}, newColumn, {
|
|
293
294
|
hasBeenResized
|
|
294
|
-
});
|
|
295
|
+
}));
|
|
295
296
|
});
|
|
296
297
|
if (keepOnlyColumnsToUpsert && !isInsideStateInitializer) {
|
|
297
298
|
Object.keys(columnsState.lookup).forEach(field => {
|
|
@@ -248,11 +248,11 @@ function useGridDimensions(apiRef, props) {
|
|
|
248
248
|
// jsdom has no layout capabilities
|
|
249
249
|
const isJSDOM = /jsdom/.test(window.navigator.userAgent);
|
|
250
250
|
if (size.height === 0 && !errorShown.current && !props.autoHeight && !isJSDOM) {
|
|
251
|
-
logger.error(['The parent DOM element of the
|
|
251
|
+
logger.error(['The parent DOM element of the Data Grid has an empty height.', 'Please make sure that this element has an intrinsic height.', 'The grid displays with a height of 0px.', '', 'More details: https://mui.com/r/x-data-grid-no-dimensions.'].join('\n'));
|
|
252
252
|
errorShown.current = true;
|
|
253
253
|
}
|
|
254
254
|
if (size.width === 0 && !errorShown.current && !isJSDOM) {
|
|
255
|
-
logger.error(['The parent DOM element of the
|
|
255
|
+
logger.error(['The parent DOM element of the Data Grid has an empty width.', 'Please make sure that this element has an intrinsic width.', 'The grid displays with a width of 0px.', '', 'More details: https://mui.com/r/x-data-grid-no-dimensions.'].join('\n'));
|
|
256
256
|
errorShown.current = true;
|
|
257
257
|
}
|
|
258
258
|
if (isFirstSizing.current) {
|
|
@@ -76,7 +76,7 @@ const useGridCellEditing = (apiRef, props) => {
|
|
|
76
76
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
77
77
|
if (params.cellMode === _gridEditRowModel.GridCellModes.Edit) {
|
|
78
78
|
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
79
|
-
// TODO:
|
|
79
|
+
// TODO: to replace at one point. See https://github.com/mui/material-ui/pull/39713#discussion_r1381678957.
|
|
80
80
|
if (event.which === 229) {
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
@@ -332,7 +332,9 @@ const useGridCellEditing = (apiRef, props) => {
|
|
|
332
332
|
};
|
|
333
333
|
try {
|
|
334
334
|
const row = apiRef.current.getRow(id);
|
|
335
|
-
Promise.resolve(processRowUpdate(rowUpdate, row
|
|
335
|
+
Promise.resolve(processRowUpdate(rowUpdate, row, {
|
|
336
|
+
rowId: id
|
|
337
|
+
})).then(finalRowUpdate => {
|
|
336
338
|
apiRef.current.updateRows([finalRowUpdate]);
|
|
337
339
|
finishCellEditMode();
|
|
338
340
|
}).catch(handleError);
|
|
@@ -118,7 +118,7 @@ const useGridRowEditing = (apiRef, props) => {
|
|
|
118
118
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
119
119
|
if (params.cellMode === _gridEditRowModel.GridRowModes.Edit) {
|
|
120
120
|
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
121
|
-
// TODO:
|
|
121
|
+
// TODO: to replace at one point. See https://github.com/mui/material-ui/pull/39713#discussion_r1381678957.
|
|
122
122
|
if (event.which === 229) {
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
@@ -405,7 +405,9 @@ const useGridRowEditing = (apiRef, props) => {
|
|
|
405
405
|
}
|
|
406
406
|
};
|
|
407
407
|
try {
|
|
408
|
-
Promise.resolve(processRowUpdate(rowUpdate, row
|
|
408
|
+
Promise.resolve(processRowUpdate(rowUpdate, row, {
|
|
409
|
+
rowId: id
|
|
410
|
+
})).then(finalRowUpdate => {
|
|
409
411
|
apiRef.current.updateRows([finalRowUpdate]);
|
|
410
412
|
finishRowEditMode();
|
|
411
413
|
}).catch(handleError);
|
|
@@ -11,6 +11,7 @@ var _useGridApiEventHandler = require("../../utils/useGridApiEventHandler");
|
|
|
11
11
|
*/
|
|
12
12
|
function useGridEvents(apiRef, props) {
|
|
13
13
|
(0, _useGridApiEventHandler.useGridApiOptionHandler)(apiRef, 'columnHeaderClick', props.onColumnHeaderClick);
|
|
14
|
+
(0, _useGridApiEventHandler.useGridApiOptionHandler)(apiRef, 'columnHeaderContextMenu', props.onColumnHeaderContextMenu);
|
|
14
15
|
(0, _useGridApiEventHandler.useGridApiOptionHandler)(apiRef, 'columnHeaderDoubleClick', props.onColumnHeaderDoubleClick);
|
|
15
16
|
(0, _useGridApiEventHandler.useGridApiOptionHandler)(apiRef, 'columnHeaderOver', props.onColumnHeaderOver);
|
|
16
17
|
(0, _useGridApiEventHandler.useGridApiOptionHandler)(apiRef, 'columnHeaderOut', props.onColumnHeaderOut);
|