@mui/x-data-grid 6.0.0 → 6.0.2
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 +103 -12
- package/DataGrid/DataGrid.js +6 -6
- package/components/cell/GridEditSingleSelectCell.js +10 -4
- package/components/panel/GridPanel.d.ts +9 -1
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -1
- package/constants/gridClasses.d.ts +1 -1
- package/hooks/features/columnGrouping/gridColumnGroupsUtils.js +5 -5
- package/hooks/features/columnMenu/columnMenuInterfaces.d.ts +2 -2
- package/hooks/features/columns/gridColumnsUtils.js +2 -9
- package/hooks/features/editing/useGridCellEditing.js +3 -3
- package/hooks/features/editing/useGridEditing.js +1 -1
- package/hooks/features/editing/useGridRowEditing.js +3 -3
- package/hooks/features/export/useGridPrintExport.js +10 -11
- package/index.js +1 -1
- package/legacy/DataGrid/DataGrid.js +6 -6
- package/legacy/components/cell/GridEditSingleSelectCell.js +10 -6
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +2 -2
- package/legacy/hooks/features/columnGrouping/gridColumnGroupsUtils.js +5 -5
- package/legacy/hooks/features/columns/gridColumnsUtils.js +2 -9
- package/legacy/hooks/features/editing/useGridCellEditing.js +3 -3
- package/legacy/hooks/features/editing/useGridEditing.js +1 -1
- package/legacy/hooks/features/editing/useGridRowEditing.js +3 -3
- package/legacy/hooks/features/export/useGridPrintExport.js +10 -11
- package/legacy/index.js +1 -1
- package/legacy/locales/ptBR.js +1 -1
- package/locales/ptBR.js +1 -1
- package/material/index.d.ts +9 -1
- package/models/api/gridEditingApi.d.ts +1 -1
- package/models/gridSlotsComponentsProps.d.ts +1 -1
- package/models/props/DataGridProps.d.ts +6 -6
- package/modern/DataGrid/DataGrid.js +6 -6
- package/modern/components/cell/GridEditSingleSelectCell.js +10 -4
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -1
- package/modern/hooks/features/columnGrouping/gridColumnGroupsUtils.js +5 -5
- package/modern/hooks/features/columns/gridColumnsUtils.js +2 -9
- package/modern/hooks/features/editing/useGridCellEditing.js +3 -3
- package/modern/hooks/features/editing/useGridEditing.js +1 -1
- package/modern/hooks/features/editing/useGridRowEditing.js +3 -3
- package/modern/hooks/features/export/useGridPrintExport.js +10 -11
- package/modern/index.js +1 -1
- package/modern/locales/ptBR.js +1 -1
- package/node/DataGrid/DataGrid.js +6 -6
- package/node/components/cell/GridEditSingleSelectCell.js +10 -4
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +1 -1
- package/node/hooks/features/columnGrouping/gridColumnGroupsUtils.js +5 -5
- package/node/hooks/features/columns/gridColumnsUtils.js +3 -10
- package/node/hooks/features/editing/useGridCellEditing.js +3 -3
- package/node/hooks/features/editing/useGridEditing.js +1 -1
- package/node/hooks/features/editing/useGridRowEditing.js +3 -3
- package/node/hooks/features/export/useGridPrintExport.js +10 -11
- package/node/index.js +1 -1
- package/node/locales/ptBR.js +1 -1
- package/package.json +2 -2
|
@@ -2,7 +2,8 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "className", "hasFocus", "isValidating", "isProcessingProps", "error", "onValueChange", "initialOpen", "getOptionLabel", "getOptionValue"]
|
|
5
|
+
var _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "className", "hasFocus", "isValidating", "isProcessingProps", "error", "onValueChange", "initialOpen", "getOptionLabel", "getOptionValue"],
|
|
6
|
+
_excluded2 = ["MenuProps"];
|
|
6
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
7
8
|
import * as React from 'react';
|
|
8
9
|
import PropTypes from 'prop-types';
|
|
@@ -51,6 +52,9 @@ function GridEditSingleSelectCell(props) {
|
|
|
51
52
|
setOpen = _React$useState2[1];
|
|
52
53
|
var baseSelectProps = ((_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.baseSelect) || {};
|
|
53
54
|
var isSelectNative = (_baseSelectProps$nati = baseSelectProps.native) != null ? _baseSelectProps$nati : false;
|
|
55
|
+
var _ref = ((_rootProps$slotProps2 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps2.baseSelect) || {},
|
|
56
|
+
MenuProps = _ref.MenuProps,
|
|
57
|
+
otherBaseSelectProps = _objectWithoutProperties(_ref, _excluded2);
|
|
54
58
|
useEnhancedEffect(function () {
|
|
55
59
|
if (hasFocus) {
|
|
56
60
|
var _inputRef$current;
|
|
@@ -76,7 +80,7 @@ function GridEditSingleSelectCell(props) {
|
|
|
76
80
|
var getOptionValue = getOptionValueProp || colDef.getOptionValue;
|
|
77
81
|
var getOptionLabel = getOptionLabelProp || colDef.getOptionLabel;
|
|
78
82
|
var handleChange = /*#__PURE__*/function () {
|
|
79
|
-
var
|
|
83
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(event) {
|
|
80
84
|
var target, formattedTargetValue;
|
|
81
85
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
82
86
|
while (1) {
|
|
@@ -112,7 +116,7 @@ function GridEditSingleSelectCell(props) {
|
|
|
112
116
|
}, _callee);
|
|
113
117
|
}));
|
|
114
118
|
return function handleChange(_x) {
|
|
115
|
-
return
|
|
119
|
+
return _ref2.apply(this, arguments);
|
|
116
120
|
};
|
|
117
121
|
}();
|
|
118
122
|
var handleClose = function handleClose(event, reason) {
|
|
@@ -144,13 +148,13 @@ function GridEditSingleSelectCell(props) {
|
|
|
144
148
|
onChange: handleChange,
|
|
145
149
|
open: open,
|
|
146
150
|
onOpen: handleOpen,
|
|
147
|
-
MenuProps: {
|
|
151
|
+
MenuProps: _extends({
|
|
148
152
|
onClose: handleClose
|
|
149
|
-
},
|
|
153
|
+
}, MenuProps),
|
|
150
154
|
error: error,
|
|
151
155
|
native: isSelectNative,
|
|
152
156
|
fullWidth: true
|
|
153
|
-
}, other,
|
|
157
|
+
}, other, otherBaseSelectProps, {
|
|
154
158
|
children: valueOptions.map(function (valueOption) {
|
|
155
159
|
var _rootProps$slotProps3;
|
|
156
160
|
var value = getOptionValue(valueOption);
|
|
@@ -72,8 +72,8 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
72
72
|
if (resolvedValueOptions !== undefined) {
|
|
73
73
|
var itemValueIndexes = item.value.map(function (element) {
|
|
74
74
|
// Gets the index matching between values and valueOptions
|
|
75
|
-
return resolvedFormattedValueOptions == null ? void 0 : resolvedFormattedValueOptions.findIndex(function (
|
|
76
|
-
return
|
|
75
|
+
return resolvedFormattedValueOptions == null ? void 0 : resolvedFormattedValueOptions.findIndex(function (formattedOption) {
|
|
76
|
+
return formattedOption === element;
|
|
77
77
|
});
|
|
78
78
|
});
|
|
79
79
|
return itemValueIndexes.filter(function (index) {
|
|
@@ -2,18 +2,18 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
|
2
2
|
import { isLeaf } from '../../../models/gridColumnGrouping';
|
|
3
3
|
import { isDeepEqual } from '../../../utils/utils';
|
|
4
4
|
// This is the recurrence function that help writing `unwrapGroupingColumnModel()`
|
|
5
|
-
var recurrentUnwrapGroupingColumnModel = function recurrentUnwrapGroupingColumnModel(columnGroupNode, parents,
|
|
5
|
+
var recurrentUnwrapGroupingColumnModel = function recurrentUnwrapGroupingColumnModel(columnGroupNode, parents, unwrappedGroupingModelToComplete) {
|
|
6
6
|
if (isLeaf(columnGroupNode)) {
|
|
7
|
-
if (
|
|
8
|
-
throw new Error(["MUI: columnGroupingModel contains duplicated field", "column field ".concat(columnGroupNode.field, "
|
|
7
|
+
if (unwrappedGroupingModelToComplete[columnGroupNode.field] !== undefined) {
|
|
8
|
+
throw new Error(["MUI: columnGroupingModel contains duplicated field", "column field ".concat(columnGroupNode.field, " occurs two times in the grouping model:"), "- ".concat(unwrappedGroupingModelToComplete[columnGroupNode.field].join(' > ')), "- ".concat(parents.join(' > '))].join('\n'));
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
unwrappedGroupingModelToComplete[columnGroupNode.field] = parents;
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
var groupId = columnGroupNode.groupId,
|
|
14
14
|
children = columnGroupNode.children;
|
|
15
15
|
children.forEach(function (child) {
|
|
16
|
-
recurrentUnwrapGroupingColumnModel(child, [].concat(_toConsumableArray(parents), [groupId]),
|
|
16
|
+
recurrentUnwrapGroupingColumnModel(child, [].concat(_toConsumableArray(parents), [groupId]), unwrappedGroupingModelToComplete);
|
|
17
17
|
});
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -151,7 +151,6 @@ export var hydrateColumnsWidth = function hydrateColumnsWidth(rawState, viewport
|
|
|
151
151
|
lookup: columnsLookup
|
|
152
152
|
});
|
|
153
153
|
};
|
|
154
|
-
var columnTypeWarnedOnce = false;
|
|
155
154
|
|
|
156
155
|
/**
|
|
157
156
|
* Apply the order and the dimensions of the initial state.
|
|
@@ -247,14 +246,8 @@ export var createColumnsState = function createColumnsState(_ref5) {
|
|
|
247
246
|
var existingState = columnsState.lookup[field];
|
|
248
247
|
if (existingState == null) {
|
|
249
248
|
var colDef = columnTypes[DEFAULT_GRID_COL_TYPE_KEY];
|
|
250
|
-
if (newColumn.type) {
|
|
251
|
-
|
|
252
|
-
console.warn(["MUI: The column type \"".concat(newColumn.type, "\" you are using is not supported."), "Column type \"string\" is being used instead."].join('\n'));
|
|
253
|
-
columnTypeWarnedOnce = true;
|
|
254
|
-
}
|
|
255
|
-
if (columnTypes[newColumn.type]) {
|
|
256
|
-
colDef = columnTypes[newColumn.type];
|
|
257
|
-
}
|
|
249
|
+
if (newColumn.type && columnTypes[newColumn.type]) {
|
|
250
|
+
colDef = columnTypes[newColumn.type];
|
|
258
251
|
}
|
|
259
252
|
existingState = _extends({}, colDef, {
|
|
260
253
|
field: field,
|
|
@@ -75,7 +75,7 @@ export var useGridCellEditing = function useGridCellEditing(apiRef, props) {
|
|
|
75
75
|
var handleCellKeyDown = React.useCallback(function (params, event) {
|
|
76
76
|
if (params.cellMode === GridCellModes.Edit) {
|
|
77
77
|
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
78
|
-
// TODO: `event.which` is
|
|
78
|
+
// TODO: `event.which` is deprecated but this is a temporary workaround
|
|
79
79
|
if (event.which === 229) {
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
@@ -97,8 +97,8 @@ export var useGridCellEditing = function useGridCellEditing(apiRef, props) {
|
|
|
97
97
|
}
|
|
98
98
|
} else if (params.isEditable) {
|
|
99
99
|
var _reason;
|
|
100
|
-
if (event.key === ' '
|
|
101
|
-
return; //
|
|
100
|
+
if (event.key === ' ') {
|
|
101
|
+
return; // Space scrolls to the last row
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
if (isPrintableKey(event)) {
|
|
@@ -51,7 +51,7 @@ export var useGridEditing = function useGridEditing(apiRef, props) {
|
|
|
51
51
|
clearTimeout(_timeout);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
// To run the callback
|
|
54
|
+
// To run the callback immediately without waiting the timeout
|
|
55
55
|
var runImmediately = function runImmediately() {
|
|
56
56
|
var _debounceMap$current$2 = _slicedToArray(debounceMap.current[id][field], 1),
|
|
57
57
|
timeout = _debounceMap$current$2[0];
|
|
@@ -109,7 +109,7 @@ export var useGridRowEditing = function useGridRowEditing(apiRef, props) {
|
|
|
109
109
|
var handleCellKeyDown = React.useCallback(function (params, event) {
|
|
110
110
|
if (params.cellMode === GridRowModes.Edit) {
|
|
111
111
|
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
112
|
-
// TODO: `event.which` is
|
|
112
|
+
// TODO: `event.which` is deprecated but this is a temporary workaround
|
|
113
113
|
if (event.which === 229) {
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
@@ -153,8 +153,8 @@ export var useGridRowEditing = function useGridRowEditing(apiRef, props) {
|
|
|
153
153
|
}
|
|
154
154
|
} else if (params.isEditable) {
|
|
155
155
|
var _reason;
|
|
156
|
-
if (event.key === ' '
|
|
157
|
-
return; //
|
|
156
|
+
if (event.key === ' ') {
|
|
157
|
+
return; // Space scrolls to the last row
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
if (isPrintableKey(event)) {
|
|
@@ -22,6 +22,15 @@ function raf() {
|
|
|
22
22
|
});
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
+
function buildPrintWindow(title) {
|
|
26
|
+
var iframeEl = document.createElement('iframe');
|
|
27
|
+
iframeEl.style.position = 'absolute';
|
|
28
|
+
iframeEl.style.width = '0px';
|
|
29
|
+
iframeEl.style.height = '0px';
|
|
30
|
+
iframeEl.title = title || document.title;
|
|
31
|
+
return iframeEl;
|
|
32
|
+
}
|
|
33
|
+
|
|
25
34
|
/**
|
|
26
35
|
* @requires useGridColumns (state)
|
|
27
36
|
* @requires useGridFilter (state)
|
|
@@ -64,16 +73,6 @@ export var useGridPrintExport = function useGridPrintExport(apiRef, props) {
|
|
|
64
73
|
resolve();
|
|
65
74
|
});
|
|
66
75
|
}, [apiRef]);
|
|
67
|
-
|
|
68
|
-
// TODO move outside of this scope and remove React.useCallback
|
|
69
|
-
var buildPrintWindow = React.useCallback(function (title) {
|
|
70
|
-
var iframeEl = document.createElement('iframe');
|
|
71
|
-
iframeEl.style.position = 'absolute';
|
|
72
|
-
iframeEl.style.width = '0px';
|
|
73
|
-
iframeEl.style.height = '0px';
|
|
74
|
-
iframeEl.title = title || document.title;
|
|
75
|
-
return iframeEl;
|
|
76
|
-
}, []);
|
|
77
76
|
var handlePrintWindowLoad = React.useCallback(function (printWindow, options) {
|
|
78
77
|
var _querySelector, _querySelector2;
|
|
79
78
|
var normalizeOptions = _extends({
|
|
@@ -245,7 +244,7 @@ export var useGridPrintExport = function useGridPrintExport(apiRef, props) {
|
|
|
245
244
|
return function (_x) {
|
|
246
245
|
return _ref.apply(this, arguments);
|
|
247
246
|
};
|
|
248
|
-
}(), [props, logger, apiRef,
|
|
247
|
+
}(), [props, logger, apiRef, handlePrintWindowLoad, handlePrintWindowAfterPrint, updateGridColumnsForPrint]);
|
|
249
248
|
var printExportApi = {
|
|
250
249
|
exportDataAsPrint: exportDataAsPrint
|
|
251
250
|
};
|
package/legacy/index.js
CHANGED
package/legacy/locales/ptBR.js
CHANGED
|
@@ -69,7 +69,7 @@ var ptBRGrid = {
|
|
|
69
69
|
// Column menu text
|
|
70
70
|
columnMenuLabel: 'Menu',
|
|
71
71
|
columnMenuShowColumns: 'Exibir colunas',
|
|
72
|
-
|
|
72
|
+
columnMenuManageColumns: 'Gerir colunas',
|
|
73
73
|
columnMenuFilter: 'Filtrar',
|
|
74
74
|
columnMenuHideColumn: 'Ocultar',
|
|
75
75
|
columnMenuUnsort: 'Desfazer ordenação',
|
package/locales/ptBR.js
CHANGED
|
@@ -67,7 +67,7 @@ const ptBRGrid = {
|
|
|
67
67
|
// Column menu text
|
|
68
68
|
columnMenuLabel: 'Menu',
|
|
69
69
|
columnMenuShowColumns: 'Exibir colunas',
|
|
70
|
-
|
|
70
|
+
columnMenuManageColumns: 'Gerir colunas',
|
|
71
71
|
columnMenuFilter: 'Filtrar',
|
|
72
72
|
columnMenuHideColumn: 'Ocultar',
|
|
73
73
|
columnMenuUnsort: 'Desfazer ordenação',
|
package/material/index.d.ts
CHANGED
|
@@ -15,7 +15,15 @@ declare const materialSlots: {
|
|
|
15
15
|
BaseButton: import("@mui/material").ExtendButtonBase<import("@mui/material/Button").ButtonTypeMap<{}, "button">>;
|
|
16
16
|
BaseIconButton: import("@mui/material").ExtendButtonBase<import("@mui/material/IconButton").IconButtonTypeMap<{}, "button">>;
|
|
17
17
|
BaseTooltip: typeof MUITooltip;
|
|
18
|
-
BasePopper: import("react").ForwardRefExoticComponent<
|
|
18
|
+
BasePopper: import("react").ForwardRefExoticComponent<Omit<import("@mui/base").PopperUnstyledProps<"div", {}>, "direction"> & {
|
|
19
|
+
components?: {
|
|
20
|
+
Root?: import("react").ElementType<any> | undefined;
|
|
21
|
+
} | undefined;
|
|
22
|
+
componentsProps?: {
|
|
23
|
+
root?: import("@mui/base").SlotComponentProps<"div", import("@mui/base").PopperUnstyledRootSlotPropsOverrides, import("@mui/base").PopperUnstyledOwnerState> | undefined;
|
|
24
|
+
} | undefined;
|
|
25
|
+
sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
|
|
26
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
19
27
|
BaseInputLabel: import("@mui/material/OverridableComponent").OverridableComponent<import("@mui/material/InputLabel").InputLabelTypeMap<{}, "label">>;
|
|
20
28
|
BaseSelectOption: typeof MUISelectOption;
|
|
21
29
|
BooleanCellTrueIcon: import("react").JSXElementConstructor<any>;
|
|
@@ -52,7 +52,7 @@ export interface GridEditingSharedApi {
|
|
|
52
52
|
}
|
|
53
53
|
export interface GridEditingSharedPrivateApi {
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
55
|
+
* Immediately updates the value of the cell, without waiting for the debounce.
|
|
56
56
|
* @param {GridRowId} id The row id.
|
|
57
57
|
* @param {string} field The field to update. If not passed, updates all fields in the given row id.
|
|
58
58
|
*/
|
|
@@ -72,7 +72,7 @@ export interface RowPropsOverrides {
|
|
|
72
72
|
}
|
|
73
73
|
type SlotProps<Props, Overrides> = Partial<Props & Overrides>;
|
|
74
74
|
/**
|
|
75
|
-
*
|
|
75
|
+
* Overridable components props dynamically passed to the component at rendering.
|
|
76
76
|
*/
|
|
77
77
|
export interface GridSlotsComponentsProps {
|
|
78
78
|
baseCheckbox?: SlotProps<CheckboxProps, BaseCheckboxPropsOverrides>;
|
|
@@ -64,12 +64,12 @@ export interface DataGridPropsWithComplexDefaultValueAfterProcessing {
|
|
|
64
64
|
*/
|
|
65
65
|
export interface DataGridPropsWithComplexDefaultValueBeforeProcessing {
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
67
|
+
* Overridable components.
|
|
68
68
|
* @deprecated Use `slots` instead.
|
|
69
69
|
*/
|
|
70
70
|
components?: Partial<GridSlotsComponent>;
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
72
|
+
* Overridable components.
|
|
73
73
|
*/
|
|
74
74
|
slots?: UncapitalizeObjectKeys<Partial<GridSlotsComponent>>;
|
|
75
75
|
/**
|
|
@@ -558,7 +558,7 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
558
558
|
cellModesModel?: GridCellModesModel;
|
|
559
559
|
/**
|
|
560
560
|
* Callback fired when the `cellModesModel` prop changes.
|
|
561
|
-
* @param {GridCellModesModel} cellModesModel Object
|
|
561
|
+
* @param {GridCellModesModel} cellModesModel Object containing which cells are in "edit" mode.
|
|
562
562
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
563
563
|
*/
|
|
564
564
|
onCellModesModelChange?: (cellModesModel: GridCellModesModel, details: GridCallbackDetails) => void;
|
|
@@ -568,7 +568,7 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
568
568
|
rowModesModel?: GridRowModesModel;
|
|
569
569
|
/**
|
|
570
570
|
* Callback fired when the `rowModesModel` prop changes.
|
|
571
|
-
* @param {GridRowModesModel} rowModesModel Object
|
|
571
|
+
* @param {GridRowModesModel} rowModesModel Object containing which rows are in "edit" mode.
|
|
572
572
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
573
573
|
*/
|
|
574
574
|
onRowModesModelChange?: (rowModesModel: GridRowModesModel, details: GridCallbackDetails) => void;
|
|
@@ -648,11 +648,11 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
648
648
|
*/
|
|
649
649
|
initialState?: GridInitialStateCommunity;
|
|
650
650
|
/**
|
|
651
|
-
*
|
|
651
|
+
* Overridable components props dynamically passed to the component at rendering.
|
|
652
652
|
*/
|
|
653
653
|
slotProps?: GridSlotsComponentsProps;
|
|
654
654
|
/**
|
|
655
|
-
*
|
|
655
|
+
* Overridable components props dynamically passed to the component at rendering.
|
|
656
656
|
* @deprecated Use the `slotProps` prop instead.
|
|
657
657
|
*/
|
|
658
658
|
componentsProps?: GridSlotsComponentsProps;
|
|
@@ -100,12 +100,12 @@ DataGridRaw.propTypes = {
|
|
|
100
100
|
*/
|
|
101
101
|
columnVisibilityModel: PropTypes.object,
|
|
102
102
|
/**
|
|
103
|
-
*
|
|
103
|
+
* Overridable components.
|
|
104
104
|
* @deprecated Use `slots` instead.
|
|
105
105
|
*/
|
|
106
106
|
components: PropTypes.object,
|
|
107
107
|
/**
|
|
108
|
-
*
|
|
108
|
+
* Overridable components props dynamically passed to the component at rendering.
|
|
109
109
|
* @deprecated Use the `slotProps` prop instead.
|
|
110
110
|
*/
|
|
111
111
|
componentsProps: PropTypes.object,
|
|
@@ -322,7 +322,7 @@ DataGridRaw.propTypes = {
|
|
|
322
322
|
onCellKeyDown: PropTypes.func,
|
|
323
323
|
/**
|
|
324
324
|
* Callback fired when the `cellModesModel` prop changes.
|
|
325
|
-
* @param {GridCellModesModel} cellModesModel Object
|
|
325
|
+
* @param {GridCellModesModel} cellModesModel Object containing which cells are in "edit" mode.
|
|
326
326
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
327
327
|
*/
|
|
328
328
|
onCellModesModelChange: PropTypes.func,
|
|
@@ -468,7 +468,7 @@ DataGridRaw.propTypes = {
|
|
|
468
468
|
onRowEditStop: PropTypes.func,
|
|
469
469
|
/**
|
|
470
470
|
* Callback fired when the `rowModesModel` prop changes.
|
|
471
|
-
* @param {GridRowModesModel} rowModesModel Object
|
|
471
|
+
* @param {GridRowModesModel} rowModesModel Object containing which rows are in "edit" mode.
|
|
472
472
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
473
473
|
*/
|
|
474
474
|
onRowModesModelChange: PropTypes.func,
|
|
@@ -582,11 +582,11 @@ DataGridRaw.propTypes = {
|
|
|
582
582
|
*/
|
|
583
583
|
showColumnVerticalBorder: PropTypes.bool,
|
|
584
584
|
/**
|
|
585
|
-
*
|
|
585
|
+
* Overridable components props dynamically passed to the component at rendering.
|
|
586
586
|
*/
|
|
587
587
|
slotProps: PropTypes.object,
|
|
588
588
|
/**
|
|
589
|
-
*
|
|
589
|
+
* Overridable components.
|
|
590
590
|
*/
|
|
591
591
|
slots: PropTypes.object,
|
|
592
592
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "className", "hasFocus", "isValidating", "isProcessingProps", "error", "onValueChange", "initialOpen", "getOptionLabel", "getOptionValue"]
|
|
3
|
+
const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "className", "hasFocus", "isValidating", "isProcessingProps", "error", "onValueChange", "initialOpen", "getOptionLabel", "getOptionValue"],
|
|
4
|
+
_excluded2 = ["MenuProps"];
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
6
7
|
import { unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
|
|
@@ -36,6 +37,11 @@ function GridEditSingleSelectCell(props) {
|
|
|
36
37
|
const [open, setOpen] = React.useState(initialOpen);
|
|
37
38
|
const baseSelectProps = rootProps.slotProps?.baseSelect || {};
|
|
38
39
|
const isSelectNative = baseSelectProps.native ?? false;
|
|
40
|
+
const _ref = rootProps.slotProps?.baseSelect || {},
|
|
41
|
+
{
|
|
42
|
+
MenuProps
|
|
43
|
+
} = _ref,
|
|
44
|
+
otherBaseSelectProps = _objectWithoutPropertiesLoose(_ref, _excluded2);
|
|
39
45
|
useEnhancedEffect(() => {
|
|
40
46
|
if (hasFocus) {
|
|
41
47
|
inputRef.current?.focus();
|
|
@@ -105,13 +111,13 @@ function GridEditSingleSelectCell(props) {
|
|
|
105
111
|
onChange: handleChange,
|
|
106
112
|
open: open,
|
|
107
113
|
onOpen: handleOpen,
|
|
108
|
-
MenuProps: {
|
|
114
|
+
MenuProps: _extends({
|
|
109
115
|
onClose: handleClose
|
|
110
|
-
},
|
|
116
|
+
}, MenuProps),
|
|
111
117
|
error: error,
|
|
112
118
|
native: isSelectNative,
|
|
113
119
|
fullWidth: true
|
|
114
|
-
}, other,
|
|
120
|
+
}, other, otherBaseSelectProps, {
|
|
115
121
|
children: valueOptions.map(valueOption => {
|
|
116
122
|
const value = getOptionValue(valueOption);
|
|
117
123
|
return /*#__PURE__*/_createElement(rootProps.slots.baseSelectOption, _extends({}, rootProps.slotProps?.baseSelectOption || {}, {
|
|
@@ -68,7 +68,7 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
68
68
|
if (resolvedValueOptions !== undefined) {
|
|
69
69
|
const itemValueIndexes = item.value.map(element => {
|
|
70
70
|
// Gets the index matching between values and valueOptions
|
|
71
|
-
return resolvedFormattedValueOptions?.findIndex(
|
|
71
|
+
return resolvedFormattedValueOptions?.findIndex(formattedOption => formattedOption === element);
|
|
72
72
|
});
|
|
73
73
|
return itemValueIndexes.filter(index => index >= 0).map(index => resolvedValueOptions[index]);
|
|
74
74
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { isLeaf } from '../../../models/gridColumnGrouping';
|
|
2
2
|
import { isDeepEqual } from '../../../utils/utils';
|
|
3
3
|
// This is the recurrence function that help writing `unwrapGroupingColumnModel()`
|
|
4
|
-
const recurrentUnwrapGroupingColumnModel = (columnGroupNode, parents,
|
|
4
|
+
const recurrentUnwrapGroupingColumnModel = (columnGroupNode, parents, unwrappedGroupingModelToComplete) => {
|
|
5
5
|
if (isLeaf(columnGroupNode)) {
|
|
6
|
-
if (
|
|
7
|
-
throw new Error([`MUI: columnGroupingModel contains duplicated field`, `column field ${columnGroupNode.field}
|
|
6
|
+
if (unwrappedGroupingModelToComplete[columnGroupNode.field] !== undefined) {
|
|
7
|
+
throw new Error([`MUI: columnGroupingModel contains duplicated field`, `column field ${columnGroupNode.field} occurs two times in the grouping model:`, `- ${unwrappedGroupingModelToComplete[columnGroupNode.field].join(' > ')}`, `- ${parents.join(' > ')}`].join('\n'));
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
unwrappedGroupingModelToComplete[columnGroupNode.field] = parents;
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
12
|
const {
|
|
@@ -14,7 +14,7 @@ const recurrentUnwrapGroupingColumnModel = (columnGroupNode, parents, unwrappedG
|
|
|
14
14
|
children
|
|
15
15
|
} = columnGroupNode;
|
|
16
16
|
children.forEach(child => {
|
|
17
|
-
recurrentUnwrapGroupingColumnModel(child, [...parents, groupId],
|
|
17
|
+
recurrentUnwrapGroupingColumnModel(child, [...parents, groupId], unwrappedGroupingModelToComplete);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -150,7 +150,6 @@ export const hydrateColumnsWidth = (rawState, viewportInnerWidth) => {
|
|
|
150
150
|
lookup: columnsLookup
|
|
151
151
|
});
|
|
152
152
|
};
|
|
153
|
-
let columnTypeWarnedOnce = false;
|
|
154
153
|
|
|
155
154
|
/**
|
|
156
155
|
* Apply the order and the dimensions of the initial state.
|
|
@@ -238,14 +237,8 @@ export const createColumnsState = ({
|
|
|
238
237
|
let existingState = columnsState.lookup[field];
|
|
239
238
|
if (existingState == null) {
|
|
240
239
|
let colDef = columnTypes[DEFAULT_GRID_COL_TYPE_KEY];
|
|
241
|
-
if (newColumn.type) {
|
|
242
|
-
|
|
243
|
-
console.warn([`MUI: The column type "${newColumn.type}" you are using is not supported.`, `Column type "string" is being used instead.`].join('\n'));
|
|
244
|
-
columnTypeWarnedOnce = true;
|
|
245
|
-
}
|
|
246
|
-
if (columnTypes[newColumn.type]) {
|
|
247
|
-
colDef = columnTypes[newColumn.type];
|
|
248
|
-
}
|
|
240
|
+
if (newColumn.type && columnTypes[newColumn.type]) {
|
|
241
|
+
colDef = columnTypes[newColumn.type];
|
|
249
242
|
}
|
|
250
243
|
existingState = _extends({}, colDef, {
|
|
251
244
|
field,
|
|
@@ -68,7 +68,7 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
68
68
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
69
69
|
if (params.cellMode === GridCellModes.Edit) {
|
|
70
70
|
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
71
|
-
// TODO: `event.which` is
|
|
71
|
+
// TODO: `event.which` is deprecated but this is a temporary workaround
|
|
72
72
|
if (event.which === 229) {
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
@@ -90,8 +90,8 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
90
90
|
}
|
|
91
91
|
} else if (params.isEditable) {
|
|
92
92
|
let reason;
|
|
93
|
-
if (event.key === ' '
|
|
94
|
-
return; //
|
|
93
|
+
if (event.key === ' ') {
|
|
94
|
+
return; // Space scrolls to the last row
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
if (isPrintableKey(event)) {
|
|
@@ -47,7 +47,7 @@ export const useGridEditing = (apiRef, props) => {
|
|
|
47
47
|
clearTimeout(timeout);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
// To run the callback
|
|
50
|
+
// To run the callback immediately without waiting the timeout
|
|
51
51
|
const runImmediately = () => {
|
|
52
52
|
const [timeout] = debounceMap.current[id][field];
|
|
53
53
|
clearTimeout(timeout);
|
|
@@ -103,7 +103,7 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
103
103
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
104
104
|
if (params.cellMode === GridRowModes.Edit) {
|
|
105
105
|
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
106
|
-
// TODO: `event.which` is
|
|
106
|
+
// TODO: `event.which` is deprecated but this is a temporary workaround
|
|
107
107
|
if (event.which === 229) {
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
@@ -143,8 +143,8 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
143
143
|
}
|
|
144
144
|
} else if (params.isEditable) {
|
|
145
145
|
let reason;
|
|
146
|
-
if (event.key === ' '
|
|
147
|
-
return; //
|
|
146
|
+
if (event.key === ' ') {
|
|
147
|
+
return; // Space scrolls to the last row
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
if (isPrintableKey(event)) {
|
|
@@ -19,6 +19,15 @@ function raf() {
|
|
|
19
19
|
});
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
+
function buildPrintWindow(title) {
|
|
23
|
+
const iframeEl = document.createElement('iframe');
|
|
24
|
+
iframeEl.style.position = 'absolute';
|
|
25
|
+
iframeEl.style.width = '0px';
|
|
26
|
+
iframeEl.style.height = '0px';
|
|
27
|
+
iframeEl.title = title || document.title;
|
|
28
|
+
return iframeEl;
|
|
29
|
+
}
|
|
30
|
+
|
|
22
31
|
/**
|
|
23
32
|
* @requires useGridColumns (state)
|
|
24
33
|
* @requires useGridFilter (state)
|
|
@@ -57,16 +66,6 @@ export const useGridPrintExport = (apiRef, props) => {
|
|
|
57
66
|
apiRef.current.setColumnVisibilityModel(newColumnVisibilityModel);
|
|
58
67
|
resolve();
|
|
59
68
|
}), [apiRef]);
|
|
60
|
-
|
|
61
|
-
// TODO move outside of this scope and remove React.useCallback
|
|
62
|
-
const buildPrintWindow = React.useCallback(title => {
|
|
63
|
-
const iframeEl = document.createElement('iframe');
|
|
64
|
-
iframeEl.style.position = 'absolute';
|
|
65
|
-
iframeEl.style.width = '0px';
|
|
66
|
-
iframeEl.style.height = '0px';
|
|
67
|
-
iframeEl.title = title || document.title;
|
|
68
|
-
return iframeEl;
|
|
69
|
-
}, []);
|
|
70
69
|
const handlePrintWindowLoad = React.useCallback((printWindow, options) => {
|
|
71
70
|
const normalizeOptions = _extends({
|
|
72
71
|
copyStyles: true,
|
|
@@ -209,7 +208,7 @@ export const useGridPrintExport = (apiRef, props) => {
|
|
|
209
208
|
};
|
|
210
209
|
doc.current.body.appendChild(printWindow);
|
|
211
210
|
}
|
|
212
|
-
}, [props, logger, apiRef,
|
|
211
|
+
}, [props, logger, apiRef, handlePrintWindowLoad, handlePrintWindowAfterPrint, updateGridColumnsForPrint]);
|
|
213
212
|
const printExportApi = {
|
|
214
213
|
exportDataAsPrint
|
|
215
214
|
};
|
package/modern/index.js
CHANGED
package/modern/locales/ptBR.js
CHANGED
|
@@ -67,7 +67,7 @@ const ptBRGrid = {
|
|
|
67
67
|
// Column menu text
|
|
68
68
|
columnMenuLabel: 'Menu',
|
|
69
69
|
columnMenuShowColumns: 'Exibir colunas',
|
|
70
|
-
|
|
70
|
+
columnMenuManageColumns: 'Gerir colunas',
|
|
71
71
|
columnMenuFilter: 'Filtrar',
|
|
72
72
|
columnMenuHideColumn: 'Ocultar',
|
|
73
73
|
columnMenuUnsort: 'Desfazer ordenação',
|