@mui/x-data-grid 7.0.0-beta.7 → 7.0.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 +195 -12
- package/DataGrid/DataGrid.js +13 -17
- package/DataGrid/useDataGridProps.js +3 -5
- package/README.md +1 -1
- package/components/GridFooter.js +2 -3
- package/components/GridHeader.js +1 -2
- package/components/GridPagination.d.ts +6 -5
- package/components/GridPagination.js +12 -4
- package/components/GridRow.js +13 -17
- package/components/base/GridFooterPlaceholder.js +1 -2
- package/components/base/GridOverlays.js +3 -6
- package/components/cell/GridActionsCell.js +4 -6
- package/components/cell/GridActionsCellItem.d.ts +8 -25
- package/components/cell/GridActionsCellItem.js +8 -5
- package/components/cell/GridBooleanCell.d.ts +1 -0
- package/components/cell/GridBooleanCell.js +3 -2
- package/components/cell/GridCell.js +7 -8
- package/components/cell/GridEditBooleanCell.js +1 -2
- package/components/cell/GridEditDateCell.js +2 -3
- package/components/cell/GridEditInputCell.js +2 -2
- package/components/cell/GridEditSingleSelectCell.js +5 -8
- package/components/columnHeaders/ColumnHeaderMenuIcon.js +2 -3
- package/components/columnHeaders/GridColumnGroupHeader.js +4 -5
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.js +2 -3
- package/components/columnHeaders/GridColumnHeaderItem.js +5 -6
- package/components/columnHeaders/GridColumnHeaderSortIcon.js +1 -2
- package/components/columnHeaders/GridColumnHeaderTitle.js +2 -3
- package/components/columnHeaders/GridGenericColumnHeaderItem.js +1 -1
- package/components/columnSelection/GridCellCheckboxRenderer.js +3 -5
- package/components/columnSelection/GridHeaderCheckbox.js +1 -2
- package/components/columnsManagement/GridColumnsManagement.js +17 -21
- package/components/containers/GridRoot.js +3 -3
- package/components/menu/GridMenu.js +4 -6
- package/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
- package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +2 -3
- package/components/panel/GridColumnsPanel.js +1 -2
- package/components/panel/GridPanel.d.ts +1 -10
- package/components/panel/GridPanel.js +1 -2
- package/components/panel/GridPreferencesPanel.js +2 -3
- package/components/panel/filterPanel/GridFilterForm.js +24 -27
- package/components/panel/filterPanel/GridFilterInputBoolean.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputBoolean.js +6 -7
- package/components/panel/filterPanel/GridFilterInputDate.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputDate.js +3 -4
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +11 -15
- package/components/panel/filterPanel/GridFilterInputMultipleValue.js +10 -14
- package/components/panel/filterPanel/GridFilterInputSingleSelect.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +10 -11
- package/components/panel/filterPanel/GridFilterInputValue.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputValue.js +5 -7
- package/components/panel/filterPanel/GridFilterPanel.js +5 -9
- package/components/panel/filterPanel/filterPanelUtils.js +1 -1
- package/components/toolbar/GridToolbarColumnsButton.js +3 -5
- package/components/toolbar/GridToolbarDensitySelector.js +8 -10
- package/components/toolbar/GridToolbarExport.js +2 -2
- package/components/toolbar/GridToolbarExportContainer.js +3 -5
- package/components/toolbar/GridToolbarFilterButton.js +3 -5
- package/components/toolbar/GridToolbarQuickFilter.js +4 -5
- package/components/virtualization/GridVirtualScrollerContent.js +1 -2
- package/components/virtualization/GridVirtualScrollerRenderZone.js +1 -2
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.js +1 -2
- package/hooks/core/useGridApiInitialization.js +4 -6
- package/hooks/features/clipboard/useGridClipboard.js +6 -5
- package/hooks/features/columnGrouping/gridColumnGroupsSelector.js +4 -16
- package/hooks/features/columnGrouping/gridColumnGroupsUtils.js +4 -8
- package/hooks/features/columnGrouping/useGridColumnGrouping.js +12 -23
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +6 -8
- package/hooks/features/columnMenu/useGridColumnMenuSlots.js +2 -2
- package/hooks/features/columnResize/useGridColumnResize.js +9 -19
- package/hooks/features/columns/gridColumnsSelector.js +1 -2
- package/hooks/features/columns/gridColumnsUtils.d.ts +0 -9
- package/hooks/features/columns/gridColumnsUtils.js +2 -22
- package/hooks/features/columns/useGridColumnSpanning.js +1 -2
- package/hooks/features/columns/useGridColumns.js +11 -19
- package/hooks/features/density/densitySelector.d.ts +4 -2
- package/hooks/features/density/densitySelector.js +8 -2
- package/hooks/features/density/densityState.d.ts +1 -4
- package/hooks/features/density/useGridDensity.d.ts +2 -4
- package/hooks/features/density/useGridDensity.js +21 -29
- package/hooks/features/dimensions/useGridDimensions.js +3 -5
- package/hooks/features/editing/useGridCellEditing.js +4 -6
- package/hooks/features/editing/useGridEditing.js +1 -2
- package/hooks/features/editing/useGridRowEditing.js +4 -6
- package/hooks/features/export/serializers/csvSerializer.d.ts +2 -0
- package/hooks/features/export/serializers/csvSerializer.js +25 -16
- package/hooks/features/export/useGridCsvExport.js +9 -10
- package/hooks/features/export/useGridPrintExport.js +9 -15
- package/hooks/features/export/utils.js +2 -3
- package/hooks/features/filter/gridFilterSelector.js +15 -22
- package/hooks/features/filter/gridFilterUtils.js +10 -16
- package/hooks/features/filter/useGridFilter.js +9 -15
- package/hooks/features/focus/useGridFocus.js +5 -6
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +1 -4
- package/hooks/features/headerFiltering/useGridHeaderFiltering.js +12 -17
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +1 -2
- package/hooks/features/pagination/gridPaginationSelector.js +1 -2
- package/hooks/features/pagination/useGridPagination.js +2 -3
- package/hooks/features/pagination/useGridPaginationModel.js +6 -11
- package/hooks/features/pagination/useGridRowCount.js +3 -6
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +7 -12
- package/hooks/features/rowSelection/useGridRowSelection.js +11 -16
- package/hooks/features/rows/gridRowsSelector.js +11 -19
- package/hooks/features/rows/gridRowsUtils.js +7 -9
- package/hooks/features/rows/useGridParamsApi.js +1 -1
- package/hooks/features/rows/useGridRows.js +4 -13
- package/hooks/features/rows/useGridRowsMeta.js +7 -13
- package/hooks/features/scroll/useGridScroll.js +2 -3
- package/hooks/features/sorting/gridSortingSelector.js +4 -7
- package/hooks/features/sorting/useGridSorting.js +8 -14
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +220 -71
- package/hooks/utils/useGridApiEventHandler.js +5 -10
- package/hooks/utils/useGridNativeEventListener.js +1 -2
- package/index.js +1 -1
- package/internals/index.d.ts +2 -0
- package/internals/index.js +1 -0
- package/internals/utils/useProps.js +1 -2
- package/joy/joySlots.js +7 -13
- package/models/api/gridRowsMetaApi.d.ts +1 -1
- package/models/api/index.d.ts +1 -1
- package/models/api/index.js +0 -1
- package/models/events/gridEventLookup.d.ts +7 -0
- package/models/gridExport.d.ts +6 -0
- package/models/gridStateCommunity.d.ts +1 -0
- package/models/props/DataGridProps.d.ts +23 -27
- package/modern/DataGrid/DataGrid.js +13 -17
- package/modern/DataGrid/useDataGridProps.js +3 -5
- package/modern/components/GridPagination.js +11 -2
- package/modern/components/cell/GridActionsCell.js +1 -1
- package/modern/components/cell/GridActionsCellItem.js +4 -0
- package/modern/components/cell/GridBooleanCell.js +3 -2
- package/modern/components/containers/GridRoot.js +3 -3
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputDate.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +1 -1
- package/modern/components/toolbar/GridToolbarDensitySelector.js +5 -5
- package/modern/hooks/features/clipboard/useGridClipboard.js +4 -2
- package/modern/hooks/features/columnResize/useGridColumnResize.js +1 -1
- package/modern/hooks/features/columns/gridColumnsUtils.js +0 -19
- package/modern/hooks/features/density/densitySelector.js +8 -2
- package/modern/hooks/features/density/useGridDensity.js +21 -29
- package/modern/hooks/features/editing/useGridCellEditing.js +1 -1
- package/modern/hooks/features/editing/useGridRowEditing.js +1 -1
- package/modern/hooks/features/export/serializers/csvSerializer.js +23 -12
- package/modern/hooks/features/export/useGridCsvExport.js +2 -1
- package/modern/hooks/features/filter/gridFilterUtils.js +1 -1
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +3 -2
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +211 -57
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -0
- package/modern/models/api/index.js +0 -1
- package/modern/utils/createSelector.js +1 -1
- package/modern/utils/domUtils.js +1 -1
- package/modern/utils/keyboardUtils.js +1 -1
- package/node/DataGrid/DataGrid.js +13 -17
- package/node/DataGrid/useDataGridProps.js +3 -5
- package/node/components/GridPagination.js +9 -1
- package/node/components/cell/GridActionsCell.js +1 -1
- package/node/components/cell/GridActionsCellItem.js +4 -0
- package/node/components/cell/GridBooleanCell.js +3 -2
- package/node/components/containers/GridRoot.js +2 -2
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputDate.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputValue.js +1 -1
- package/node/components/toolbar/GridToolbarDensitySelector.js +4 -4
- package/node/hooks/features/clipboard/useGridClipboard.js +4 -2
- package/node/hooks/features/columnResize/useGridColumnResize.js +1 -1
- package/node/hooks/features/columns/gridColumnsUtils.js +0 -20
- package/node/hooks/features/density/densitySelector.js +9 -3
- package/node/hooks/features/density/useGridDensity.js +22 -30
- package/node/hooks/features/editing/useGridCellEditing.js +1 -1
- package/node/hooks/features/editing/useGridRowEditing.js +1 -1
- package/node/hooks/features/export/serializers/csvSerializer.js +23 -12
- package/node/hooks/features/export/useGridCsvExport.js +2 -1
- package/node/hooks/features/filter/gridFilterUtils.js +1 -1
- package/node/hooks/features/rowSelection/useGridRowSelection.js +2 -1
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +211 -57
- package/node/index.js +1 -1
- package/node/internals/index.js +12 -0
- package/node/models/api/index.js +0 -11
- package/node/utils/createSelector.js +1 -1
- package/node/utils/domUtils.js +1 -1
- package/node/utils/keyboardUtils.js +1 -1
- package/package.json +4 -4
- package/utils/createSelector.js +9 -9
- package/utils/domUtils.js +4 -7
- package/utils/getGridLocalization.js +9 -12
- package/utils/keyboardUtils.js +1 -1
|
@@ -41,7 +41,6 @@ const SingleSelectOperatorContainer = styled('div')({
|
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
43
|
function GridFilterInputSingleSelect(props) {
|
|
44
|
-
var _item$value, _rootProps$slotProps$, _rootProps$slotProps, _resolvedColumn, _resolvedColumn2, _rootProps$slotProps2, _rootProps$slotProps3, _rootProps$slotProps4;
|
|
45
44
|
const {
|
|
46
45
|
item,
|
|
47
46
|
applyValue,
|
|
@@ -55,11 +54,11 @@ function GridFilterInputSingleSelect(props) {
|
|
|
55
54
|
clearButton
|
|
56
55
|
} = props,
|
|
57
56
|
others = _objectWithoutPropertiesLoose(props, _excluded);
|
|
58
|
-
const filterValue =
|
|
57
|
+
const filterValue = item.value ?? '';
|
|
59
58
|
const id = useId();
|
|
60
59
|
const labelId = useId();
|
|
61
60
|
const rootProps = useGridRootProps();
|
|
62
|
-
const isSelectNative =
|
|
61
|
+
const isSelectNative = rootProps.slotProps?.baseSelect?.native ?? false;
|
|
63
62
|
let resolvedColumn = null;
|
|
64
63
|
if (item.field) {
|
|
65
64
|
const column = apiRef.current.getColumn(item.field);
|
|
@@ -67,8 +66,8 @@ function GridFilterInputSingleSelect(props) {
|
|
|
67
66
|
resolvedColumn = column;
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
|
-
const getOptionValue =
|
|
71
|
-
const getOptionLabel =
|
|
69
|
+
const getOptionValue = resolvedColumn?.getOptionValue;
|
|
70
|
+
const getOptionLabel = resolvedColumn?.getOptionLabel;
|
|
72
71
|
const currentValueOptions = React.useMemo(() => {
|
|
73
72
|
return getValueOptions(resolvedColumn);
|
|
74
73
|
}, [resolvedColumn]);
|
|
@@ -84,11 +83,11 @@ function GridFilterInputSingleSelect(props) {
|
|
|
84
83
|
if (!isSingleSelectColDef(resolvedColumn)) {
|
|
85
84
|
return null;
|
|
86
85
|
}
|
|
87
|
-
const label = labelProp
|
|
86
|
+
const label = labelProp ?? apiRef.current.getLocaleText('filterPanelInputLabel');
|
|
88
87
|
return /*#__PURE__*/_jsxs(SingleSelectOperatorContainer, {
|
|
89
88
|
children: [/*#__PURE__*/_jsxs(rootProps.slots.baseFormControl, {
|
|
90
89
|
fullWidth: true,
|
|
91
|
-
children: [/*#__PURE__*/_jsx(rootProps.slots.baseInputLabel, _extends({},
|
|
90
|
+
children: [/*#__PURE__*/_jsx(rootProps.slots.baseInputLabel, _extends({}, rootProps.slotProps?.baseInputLabel, {
|
|
92
91
|
id: labelId,
|
|
93
92
|
htmlFor: id,
|
|
94
93
|
shrink: true,
|
|
@@ -105,18 +104,18 @@ function GridFilterInputSingleSelect(props) {
|
|
|
105
104
|
inputProps: {
|
|
106
105
|
tabIndex,
|
|
107
106
|
ref: focusElementRef,
|
|
108
|
-
placeholder: placeholder
|
|
107
|
+
placeholder: placeholder ?? apiRef.current.getLocaleText('filterPanelInputPlaceholder')
|
|
109
108
|
},
|
|
110
109
|
native: isSelectNative,
|
|
111
110
|
notched: variant === 'outlined' ? true : undefined
|
|
112
|
-
}, others /* FIXME: typing error */,
|
|
111
|
+
}, others /* FIXME: typing error */, rootProps.slotProps?.baseSelect, {
|
|
113
112
|
children: renderSingleSelectOptions({
|
|
114
113
|
column: resolvedColumn,
|
|
115
114
|
OptionComponent: rootProps.slots.baseSelectOption,
|
|
116
115
|
getOptionLabel,
|
|
117
116
|
getOptionValue,
|
|
118
117
|
isSelectNative,
|
|
119
|
-
baseSelectOptionProps:
|
|
118
|
+
baseSelectOptionProps: rootProps.slotProps?.baseSelectOption
|
|
120
119
|
})
|
|
121
120
|
}))]
|
|
122
121
|
}), clearButton]
|
|
@@ -135,7 +134,7 @@ process.env.NODE_ENV !== "production" ? GridFilterInputSingleSelect.propTypes =
|
|
|
135
134
|
focusElementRef: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.func, PropTypes.object]),
|
|
136
135
|
/**
|
|
137
136
|
* It is `true` if the filter either has a value or an operator with no value
|
|
138
|
-
* required is selected (
|
|
137
|
+
* required is selected (for example `isEmpty`)
|
|
139
138
|
*/
|
|
140
139
|
isFilterActive: PropTypes.bool,
|
|
141
140
|
item: PropTypes.shape({
|
|
@@ -6,7 +6,7 @@ export type GridTypeFilterInputValueProps = GridFilterInputValueProps & TextFiel
|
|
|
6
6
|
clearButton?: React.ReactNode | null;
|
|
7
7
|
/**
|
|
8
8
|
* It is `true` if the filter either has a value or an operator with no value
|
|
9
|
-
* required is selected (
|
|
9
|
+
* required is selected (for example `isEmpty`)
|
|
10
10
|
*/
|
|
11
11
|
isFilterActive?: boolean;
|
|
12
12
|
};
|
|
@@ -8,7 +8,6 @@ import { useTimeout } from '../../../hooks/utils/useTimeout';
|
|
|
8
8
|
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
function GridFilterInputValue(props) {
|
|
11
|
-
var _item$value, _rootProps$slotProps;
|
|
12
11
|
const {
|
|
13
12
|
item,
|
|
14
13
|
applyValue,
|
|
@@ -23,7 +22,7 @@ function GridFilterInputValue(props) {
|
|
|
23
22
|
} = props,
|
|
24
23
|
others = _objectWithoutPropertiesLoose(props, _excluded);
|
|
25
24
|
const filterTimeout = useTimeout();
|
|
26
|
-
const [filterValueState, setFilterValueState] = React.useState(
|
|
25
|
+
const [filterValueState, setFilterValueState] = React.useState(item.value ?? '');
|
|
27
26
|
const [applying, setIsApplying] = React.useState(false);
|
|
28
27
|
const id = useId();
|
|
29
28
|
const rootProps = useGridRootProps();
|
|
@@ -45,8 +44,7 @@ function GridFilterInputValue(props) {
|
|
|
45
44
|
React.useEffect(() => {
|
|
46
45
|
const itemPlusTag = item;
|
|
47
46
|
if (itemPlusTag.fromInput !== id || item.value === undefined) {
|
|
48
|
-
|
|
49
|
-
setFilterValueState(String((_item$value2 = item.value) != null ? _item$value2 : ''));
|
|
47
|
+
setFilterValueState(String(item.value ?? ''));
|
|
50
48
|
}
|
|
51
49
|
}, [id, item]);
|
|
52
50
|
return /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({
|
|
@@ -67,13 +65,13 @@ function GridFilterInputValue(props) {
|
|
|
67
65
|
}, InputProps, {
|
|
68
66
|
inputProps: _extends({
|
|
69
67
|
tabIndex
|
|
70
|
-
}, InputProps
|
|
68
|
+
}, InputProps?.inputProps)
|
|
71
69
|
}),
|
|
72
70
|
InputLabelProps: {
|
|
73
71
|
shrink: true
|
|
74
72
|
},
|
|
75
73
|
inputRef: focusElementRef
|
|
76
|
-
}, others,
|
|
74
|
+
}, others, rootProps.slotProps?.baseTextField));
|
|
77
75
|
}
|
|
78
76
|
process.env.NODE_ENV !== "production" ? GridFilterInputValue.propTypes = {
|
|
79
77
|
// ----------------------------- Warning --------------------------------
|
|
@@ -88,7 +86,7 @@ process.env.NODE_ENV !== "production" ? GridFilterInputValue.propTypes = {
|
|
|
88
86
|
focusElementRef: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.func, PropTypes.object]),
|
|
89
87
|
/**
|
|
90
88
|
* It is `true` if the filter either has a value or an operator with no value
|
|
91
|
-
* required is selected (
|
|
89
|
+
* required is selected (for example `isEmpty`)
|
|
92
90
|
*/
|
|
93
91
|
isFilterActive: PropTypes.bool,
|
|
94
92
|
item: PropTypes.shape({
|
|
@@ -21,7 +21,6 @@ const getGridFilter = col => ({
|
|
|
21
21
|
id: Math.round(Math.random() * 1e5)
|
|
22
22
|
});
|
|
23
23
|
const GridFilterPanel = /*#__PURE__*/React.forwardRef(function GridFilterPanel(props, ref) {
|
|
24
|
-
var _rootProps$slotProps, _rootProps$slotProps2;
|
|
25
24
|
const apiRef = useGridApiContext();
|
|
26
25
|
const rootProps = useGridRootProps();
|
|
27
26
|
const filterModel = useGridSelector(apiRef, gridFilterModelSelector);
|
|
@@ -47,7 +46,7 @@ const GridFilterPanel = /*#__PURE__*/React.forwardRef(function GridFilterPanel(p
|
|
|
47
46
|
if (getColumnForNewFilter && typeof getColumnForNewFilter === 'function') {
|
|
48
47
|
// To allow override the column for default (first) filter
|
|
49
48
|
const nextFieldName = getColumnForNewFilter({
|
|
50
|
-
currentFilters:
|
|
49
|
+
currentFilters: filterModel?.items || [],
|
|
51
50
|
columns: filterableColumns
|
|
52
51
|
});
|
|
53
52
|
if (nextFieldName === null) {
|
|
@@ -57,16 +56,13 @@ const GridFilterPanel = /*#__PURE__*/React.forwardRef(function GridFilterPanel(p
|
|
|
57
56
|
field
|
|
58
57
|
}) => field === nextFieldName);
|
|
59
58
|
} else {
|
|
60
|
-
nextColumnWithOperator = filterableColumns.find(colDef =>
|
|
61
|
-
var _colDef$filterOperato;
|
|
62
|
-
return (_colDef$filterOperato = colDef.filterOperators) == null ? void 0 : _colDef$filterOperato.length;
|
|
63
|
-
});
|
|
59
|
+
nextColumnWithOperator = filterableColumns.find(colDef => colDef.filterOperators?.length);
|
|
64
60
|
}
|
|
65
61
|
if (!nextColumnWithOperator) {
|
|
66
62
|
return null;
|
|
67
63
|
}
|
|
68
64
|
return getGridFilter(nextColumnWithOperator);
|
|
69
|
-
}, [filterModel
|
|
65
|
+
}, [filterModel?.items, filterableColumns, getColumnForNewFilter]);
|
|
70
66
|
const getNewFilter = React.useCallback(() => {
|
|
71
67
|
if (getColumnForNewFilter === undefined || typeof getColumnForNewFilter !== 'function') {
|
|
72
68
|
return getDefaultFilter();
|
|
@@ -178,12 +174,12 @@ const GridFilterPanel = /*#__PURE__*/React.forwardRef(function GridFilterPanel(p
|
|
|
178
174
|
children: [!disableAddFilterButton ? /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
179
175
|
onClick: addNewFilter,
|
|
180
176
|
startIcon: /*#__PURE__*/_jsx(rootProps.slots.filterPanelAddIcon, {})
|
|
181
|
-
},
|
|
177
|
+
}, rootProps.slotProps?.baseButton, {
|
|
182
178
|
children: apiRef.current.getLocaleText('filterPanelAddFilter')
|
|
183
179
|
})) : /*#__PURE__*/_jsx("span", {}), !disableRemoveAllButton && validFilters.length > 0 ? /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
184
180
|
onClick: handleRemoveAll,
|
|
185
181
|
startIcon: /*#__PURE__*/_jsx(rootProps.slots.filterPanelRemoveAllIcon, {})
|
|
186
|
-
},
|
|
182
|
+
}, rootProps.slotProps?.baseButton, {
|
|
187
183
|
children: apiRef.current.getLocaleText('filterPanelRemoveAll')
|
|
188
184
|
})) : null]
|
|
189
185
|
}) : null]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
export function isSingleSelectColDef(colDef) {
|
|
3
|
-
return
|
|
3
|
+
return colDef?.type === 'singleSelect';
|
|
4
4
|
}
|
|
5
5
|
export function getValueOptions(column, additionalParams) {
|
|
6
6
|
if (!column) {
|
|
@@ -9,7 +9,6 @@ import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
|
9
9
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
const GridToolbarColumnsButton = /*#__PURE__*/React.forwardRef(function GridToolbarColumnsButton(props, ref) {
|
|
12
|
-
var _rootProps$slotProps, _rootProps$slotProps2;
|
|
13
12
|
const {
|
|
14
13
|
slotProps = {}
|
|
15
14
|
} = props;
|
|
@@ -21,13 +20,12 @@ const GridToolbarColumnsButton = /*#__PURE__*/React.forwardRef(function GridTool
|
|
|
21
20
|
const rootProps = useGridRootProps();
|
|
22
21
|
const preferencePanel = useGridSelector(apiRef, gridPreferencePanelStateSelector);
|
|
23
22
|
const showColumns = event => {
|
|
24
|
-
var _buttonProps$onClick;
|
|
25
23
|
if (preferencePanel.open && preferencePanel.openedPanelValue === GridPreferencePanelsValue.columns) {
|
|
26
24
|
apiRef.current.hidePreferences();
|
|
27
25
|
} else {
|
|
28
26
|
apiRef.current.showPreferences(GridPreferencePanelsValue.columns, columnPanelId, columnButtonId);
|
|
29
27
|
}
|
|
30
|
-
|
|
28
|
+
buttonProps.onClick?.(event);
|
|
31
29
|
};
|
|
32
30
|
|
|
33
31
|
// Disable the button if the corresponding is disabled
|
|
@@ -38,7 +36,7 @@ const GridToolbarColumnsButton = /*#__PURE__*/React.forwardRef(function GridTool
|
|
|
38
36
|
return /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, _extends({
|
|
39
37
|
title: apiRef.current.getLocaleText('toolbarColumnsLabel'),
|
|
40
38
|
enterDelay: 1000
|
|
41
|
-
}, tooltipProps,
|
|
39
|
+
}, tooltipProps, rootProps.slotProps?.baseTooltip, {
|
|
42
40
|
children: /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
43
41
|
ref: ref,
|
|
44
42
|
id: columnButtonId,
|
|
@@ -50,7 +48,7 @@ const GridToolbarColumnsButton = /*#__PURE__*/React.forwardRef(function GridTool
|
|
|
50
48
|
startIcon: /*#__PURE__*/_jsx(rootProps.slots.columnSelectorIcon, {})
|
|
51
49
|
}, buttonProps, {
|
|
52
50
|
onClick: showColumns
|
|
53
|
-
},
|
|
51
|
+
}, rootProps.slotProps?.baseButton, {
|
|
54
52
|
children: apiRef.current.getLocaleText('toolbarColumns')
|
|
55
53
|
}))
|
|
56
54
|
}));
|
|
@@ -5,7 +5,7 @@ import { unstable_useId as useId, unstable_useForkRef as useForkRef } from '@mui
|
|
|
5
5
|
import MenuList from '@mui/material/MenuList';
|
|
6
6
|
import MenuItem from '@mui/material/MenuItem';
|
|
7
7
|
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
8
|
-
import {
|
|
8
|
+
import { gridDensitySelector } from '../../hooks/features/density/densitySelector';
|
|
9
9
|
import { isHideMenuKey, isTabKey } from '../../utils/keyboardUtils';
|
|
10
10
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
11
11
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
@@ -15,7 +15,6 @@ import { gridClasses } from '../../constants/gridClasses';
|
|
|
15
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
17
|
const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridToolbarDensitySelector(props, ref) {
|
|
18
|
-
var _rootProps$slotProps, _rootProps$slotProps2;
|
|
19
18
|
const {
|
|
20
19
|
slotProps = {}
|
|
21
20
|
} = props;
|
|
@@ -23,7 +22,7 @@ const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
23
22
|
const tooltipProps = slotProps.tooltip || {};
|
|
24
23
|
const apiRef = useGridApiContext();
|
|
25
24
|
const rootProps = useGridRootProps();
|
|
26
|
-
const
|
|
25
|
+
const density = useGridSelector(apiRef, gridDensitySelector);
|
|
27
26
|
const densityButtonId = useId();
|
|
28
27
|
const densityMenuId = useId();
|
|
29
28
|
const [open, setOpen] = React.useState(false);
|
|
@@ -43,7 +42,7 @@ const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
43
42
|
value: 'comfortable'
|
|
44
43
|
}];
|
|
45
44
|
const startIcon = React.useMemo(() => {
|
|
46
|
-
switch (
|
|
45
|
+
switch (density) {
|
|
47
46
|
case 'compact':
|
|
48
47
|
return /*#__PURE__*/_jsx(rootProps.slots.densityCompactIcon, {});
|
|
49
48
|
case 'comfortable':
|
|
@@ -51,11 +50,10 @@ const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
51
50
|
default:
|
|
52
51
|
return /*#__PURE__*/_jsx(rootProps.slots.densityStandardIcon, {});
|
|
53
52
|
}
|
|
54
|
-
}, [
|
|
53
|
+
}, [density, rootProps]);
|
|
55
54
|
const handleDensitySelectorOpen = event => {
|
|
56
|
-
var _buttonProps$onClick;
|
|
57
55
|
setOpen(prevOpen => !prevOpen);
|
|
58
|
-
|
|
56
|
+
buttonProps.onClick?.(event);
|
|
59
57
|
};
|
|
60
58
|
const handleDensitySelectorClose = () => {
|
|
61
59
|
setOpen(false);
|
|
@@ -79,7 +77,7 @@ const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
79
77
|
}
|
|
80
78
|
const densityElements = densityOptions.map((option, index) => /*#__PURE__*/_jsxs(MenuItem, {
|
|
81
79
|
onClick: () => handleDensityUpdate(option.value),
|
|
82
|
-
selected: option.value ===
|
|
80
|
+
selected: option.value === density,
|
|
83
81
|
children: [/*#__PURE__*/_jsx(ListItemIcon, {
|
|
84
82
|
children: option.icon
|
|
85
83
|
}), option.label]
|
|
@@ -88,7 +86,7 @@ const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
88
86
|
children: [/*#__PURE__*/_jsx(rootProps.slots.baseTooltip, _extends({
|
|
89
87
|
title: apiRef.current.getLocaleText('toolbarDensityLabel'),
|
|
90
88
|
enterDelay: 1000
|
|
91
|
-
}, tooltipProps,
|
|
89
|
+
}, tooltipProps, rootProps.slotProps?.baseTooltip, {
|
|
92
90
|
children: /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
93
91
|
ref: handleRef,
|
|
94
92
|
size: "small",
|
|
@@ -100,7 +98,7 @@ const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
100
98
|
id: densityButtonId
|
|
101
99
|
}, buttonProps, {
|
|
102
100
|
onClick: handleDensitySelectorOpen
|
|
103
|
-
},
|
|
101
|
+
}, rootProps.slotProps?.baseButton, {
|
|
104
102
|
children: apiRef.current.getLocaleText('toolbarDensity')
|
|
105
103
|
}))
|
|
106
104
|
})), /*#__PURE__*/_jsx(GridMenu, {
|
|
@@ -19,7 +19,7 @@ export function GridCsvExportMenuItem(props) {
|
|
|
19
19
|
return /*#__PURE__*/_jsx(MenuItem, _extends({
|
|
20
20
|
onClick: () => {
|
|
21
21
|
apiRef.current.exportDataAsCsv(options);
|
|
22
|
-
hideMenu
|
|
22
|
+
hideMenu?.();
|
|
23
23
|
}
|
|
24
24
|
}, other, {
|
|
25
25
|
children: apiRef.current.getLocaleText('toolbarExportCSV')
|
|
@@ -35,7 +35,7 @@ export function GridPrintExportMenuItem(props) {
|
|
|
35
35
|
return /*#__PURE__*/_jsx(MenuItem, _extends({
|
|
36
36
|
onClick: () => {
|
|
37
37
|
apiRef.current.exportDataAsPrint(options);
|
|
38
|
-
hideMenu
|
|
38
|
+
hideMenu?.();
|
|
39
39
|
}
|
|
40
40
|
}, other, {
|
|
41
41
|
children: apiRef.current.getLocaleText('toolbarExportPrint')
|
|
@@ -11,7 +11,6 @@ import { gridClasses } from '../../constants/gridClasses';
|
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
const GridToolbarExportContainer = /*#__PURE__*/React.forwardRef(function GridToolbarExportContainer(props, ref) {
|
|
14
|
-
var _rootProps$slotProps, _rootProps$slotProps2;
|
|
15
14
|
const {
|
|
16
15
|
children,
|
|
17
16
|
slotProps = {}
|
|
@@ -26,9 +25,8 @@ const GridToolbarExportContainer = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
26
25
|
const buttonRef = React.useRef(null);
|
|
27
26
|
const handleRef = useForkRef(ref, buttonRef);
|
|
28
27
|
const handleMenuOpen = event => {
|
|
29
|
-
var _buttonProps$onClick;
|
|
30
28
|
setOpen(prevOpen => !prevOpen);
|
|
31
|
-
|
|
29
|
+
buttonProps.onClick?.(event);
|
|
32
30
|
};
|
|
33
31
|
const handleMenuClose = () => setOpen(false);
|
|
34
32
|
const handleListKeyDown = event => {
|
|
@@ -46,7 +44,7 @@ const GridToolbarExportContainer = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
46
44
|
children: [/*#__PURE__*/_jsx(rootProps.slots.baseTooltip, _extends({
|
|
47
45
|
title: apiRef.current.getLocaleText('toolbarExportLabel'),
|
|
48
46
|
enterDelay: 1000
|
|
49
|
-
}, tooltipProps,
|
|
47
|
+
}, tooltipProps, rootProps.slotProps?.baseTooltip, {
|
|
50
48
|
children: /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
51
49
|
ref: handleRef,
|
|
52
50
|
size: "small",
|
|
@@ -58,7 +56,7 @@ const GridToolbarExportContainer = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
58
56
|
id: exportButtonId
|
|
59
57
|
}, buttonProps, {
|
|
60
58
|
onClick: handleMenuOpen
|
|
61
|
-
},
|
|
59
|
+
}, rootProps.slotProps?.baseButton, {
|
|
62
60
|
children: apiRef.current.getLocaleText('toolbarExport')
|
|
63
61
|
}))
|
|
64
62
|
})), /*#__PURE__*/_jsx(GridMenu, {
|
|
@@ -34,7 +34,6 @@ const GridToolbarFilterListRoot = styled('ul', {
|
|
|
34
34
|
padding: theme.spacing(0, 1)
|
|
35
35
|
}));
|
|
36
36
|
const GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolbarFilterButton(props, ref) {
|
|
37
|
-
var _rootProps$slotProps, _rootProps$slotProps2;
|
|
38
37
|
const {
|
|
39
38
|
slotProps = {}
|
|
40
39
|
} = props;
|
|
@@ -77,7 +76,6 @@ const GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolb
|
|
|
77
76
|
});
|
|
78
77
|
}, [apiRef, rootProps, preferencePanel.open, activeFilters, lookup, classes]);
|
|
79
78
|
const toggleFilter = event => {
|
|
80
|
-
var _buttonProps$onClick;
|
|
81
79
|
const {
|
|
82
80
|
open,
|
|
83
81
|
openedPanelValue
|
|
@@ -87,7 +85,7 @@ const GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolb
|
|
|
87
85
|
} else {
|
|
88
86
|
apiRef.current.showPreferences(GridPreferencePanelsValue.filters, filterPanelId, filterButtonId);
|
|
89
87
|
}
|
|
90
|
-
|
|
88
|
+
buttonProps.onClick?.(event);
|
|
91
89
|
};
|
|
92
90
|
|
|
93
91
|
// Disable the button if the corresponding is disabled
|
|
@@ -98,7 +96,7 @@ const GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolb
|
|
|
98
96
|
return /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, _extends({
|
|
99
97
|
title: tooltipContentNode,
|
|
100
98
|
enterDelay: 1000
|
|
101
|
-
}, tooltipProps,
|
|
99
|
+
}, tooltipProps, rootProps.slotProps?.baseTooltip, {
|
|
102
100
|
children: /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
103
101
|
ref: ref,
|
|
104
102
|
id: filterButtonId,
|
|
@@ -114,7 +112,7 @@ const GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolb
|
|
|
114
112
|
})
|
|
115
113
|
}, buttonProps, {
|
|
116
114
|
onClick: toggleFilter
|
|
117
|
-
},
|
|
115
|
+
}, rootProps.slotProps?.baseButton, {
|
|
118
116
|
children: apiRef.current.getLocaleText('toolbarFilters')
|
|
119
117
|
}))
|
|
120
118
|
}));
|
|
@@ -45,7 +45,6 @@ const GridToolbarQuickFilterRoot = styled(TextField, {
|
|
|
45
45
|
const defaultSearchValueParser = searchText => searchText.split(' ').filter(word => word !== '');
|
|
46
46
|
const defaultSearchValueFormatter = values => values.join(' ');
|
|
47
47
|
function GridToolbarQuickFilter(props) {
|
|
48
|
-
var _rootProps$slotProps, _rootProps$slotProps2;
|
|
49
48
|
const apiRef = useGridApiContext();
|
|
50
49
|
const rootProps = useGridRootProps();
|
|
51
50
|
const quickFilterValues = useGridSelector(apiRef, gridQuickFilterValuesSelector);
|
|
@@ -55,7 +54,7 @@ function GridToolbarQuickFilter(props) {
|
|
|
55
54
|
debounceMs = rootProps.filterDebounceMs
|
|
56
55
|
} = props,
|
|
57
56
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
58
|
-
const [searchValue, setSearchValue] = React.useState(() => quickFilterFormatter(quickFilterValues
|
|
57
|
+
const [searchValue, setSearchValue] = React.useState(() => quickFilterFormatter(quickFilterValues ?? []));
|
|
59
58
|
const prevQuickFilterValuesRef = React.useRef(quickFilterValues);
|
|
60
59
|
React.useEffect(() => {
|
|
61
60
|
if (!isDeepEqual(prevQuickFilterValuesRef.current, quickFilterValues)) {
|
|
@@ -63,7 +62,7 @@ function GridToolbarQuickFilter(props) {
|
|
|
63
62
|
prevQuickFilterValuesRef.current = quickFilterValues;
|
|
64
63
|
|
|
65
64
|
// Update the input value if needed to match the new model
|
|
66
|
-
setSearchValue(prevSearchValue => isDeepEqual(quickFilterParser(prevSearchValue), quickFilterValues) ? prevSearchValue : quickFilterFormatter(quickFilterValues
|
|
65
|
+
setSearchValue(prevSearchValue => isDeepEqual(quickFilterParser(prevSearchValue), quickFilterValues) ? prevSearchValue : quickFilterFormatter(quickFilterValues ?? []));
|
|
67
66
|
}
|
|
68
67
|
}, [quickFilterValues, quickFilterFormatter, quickFilterParser]);
|
|
69
68
|
const updateSearchValue = React.useCallback(newSearchValue => {
|
|
@@ -102,13 +101,13 @@ function GridToolbarQuickFilter(props) {
|
|
|
102
101
|
visibility: searchValue ? 'visible' : 'hidden'
|
|
103
102
|
},
|
|
104
103
|
onClick: handleSearchReset
|
|
105
|
-
},
|
|
104
|
+
}, rootProps.slotProps?.baseIconButton, {
|
|
106
105
|
children: /*#__PURE__*/_jsx(rootProps.slots.quickFilterClearIcon, {
|
|
107
106
|
fontSize: "small"
|
|
108
107
|
})
|
|
109
108
|
}))
|
|
110
109
|
}, other.InputProps)
|
|
111
|
-
},
|
|
110
|
+
}, rootProps.slotProps?.baseTextField));
|
|
112
111
|
}
|
|
113
112
|
process.env.NODE_ENV !== "production" ? GridToolbarQuickFilter.propTypes = {
|
|
114
113
|
// ----------------------------- Warning --------------------------------
|
|
@@ -21,9 +21,8 @@ const VirtualScrollerContentRoot = styled('div', {
|
|
|
21
21
|
overridesResolver: (props, styles) => styles.virtualScrollerContent
|
|
22
22
|
})({});
|
|
23
23
|
const GridVirtualScrollerContent = /*#__PURE__*/React.forwardRef(function GridVirtualScrollerContent(props, ref) {
|
|
24
|
-
var _props$style;
|
|
25
24
|
const rootProps = useGridRootProps();
|
|
26
|
-
const overflowedContent = !rootProps.autoHeight &&
|
|
25
|
+
const overflowedContent = !rootProps.autoHeight && props.style?.minHeight === 'auto';
|
|
27
26
|
const classes = useUtilityClasses(rootProps, overflowedContent);
|
|
28
27
|
return /*#__PURE__*/_jsx(VirtualScrollerContentRoot, _extends({
|
|
29
28
|
ref: ref
|
|
@@ -40,10 +40,9 @@ const GridVirtualScrollerRenderZone = /*#__PURE__*/React.forwardRef(function Gri
|
|
|
40
40
|
const rootProps = useGridRootProps();
|
|
41
41
|
const classes = useUtilityClasses(rootProps);
|
|
42
42
|
const offsetTop = useGridSelector(apiRef, () => {
|
|
43
|
-
var _rowsMeta$positions$r;
|
|
44
43
|
const renderContext = gridRenderContextSelector(apiRef);
|
|
45
44
|
const rowsMeta = gridRowsMetaSelector(apiRef.current.state);
|
|
46
|
-
return
|
|
45
|
+
return rowsMeta.positions[renderContext.firstRowIndex] ?? 0;
|
|
47
46
|
});
|
|
48
47
|
return /*#__PURE__*/_jsx(VirtualScrollerRenderZoneRoot, _extends({
|
|
49
48
|
ref: ref,
|
|
@@ -85,7 +85,6 @@ export const useGridStrategyProcessing = apiRef => {
|
|
|
85
85
|
return processor(params);
|
|
86
86
|
}, [apiRef]);
|
|
87
87
|
const getActiveStrategy = React.useCallback(strategyGroup => {
|
|
88
|
-
var _availableStrategyEnt;
|
|
89
88
|
const strategyEntries = Array.from(availableStrategies.current.entries());
|
|
90
89
|
const availableStrategyEntry = strategyEntries.find(([, strategy]) => {
|
|
91
90
|
if (strategy.group !== strategyGroup) {
|
|
@@ -93,7 +92,7 @@ export const useGridStrategyProcessing = apiRef => {
|
|
|
93
92
|
}
|
|
94
93
|
return strategy.isAvailable();
|
|
95
94
|
});
|
|
96
|
-
return
|
|
95
|
+
return availableStrategyEntry?.[0] ?? GRID_DEFAULT_STRATEGY;
|
|
97
96
|
}, []);
|
|
98
97
|
const setStrategyAvailability = React.useCallback((strategyGroup, strategyName, isAvailable) => {
|
|
99
98
|
availableStrategies.current.set(strategyName, {
|
|
@@ -12,8 +12,7 @@ export function unwrapPrivateAPI(publicApi) {
|
|
|
12
12
|
}
|
|
13
13
|
let globalId = 0;
|
|
14
14
|
function createPrivateAPI(publicApiRef) {
|
|
15
|
-
|
|
16
|
-
const existingPrivateApi = (_publicApiRef$current = publicApiRef.current) == null ? void 0 : _publicApiRef$current[SYMBOL_API_PRIVATE];
|
|
15
|
+
const existingPrivateApi = publicApiRef.current?.[SYMBOL_API_PRIVATE];
|
|
17
16
|
if (existingPrivateApi) {
|
|
18
17
|
return existingPrivateApi;
|
|
19
18
|
}
|
|
@@ -31,7 +30,7 @@ function createPrivateAPI(publicApiRef) {
|
|
|
31
30
|
Object.keys(methods).forEach(methodName => {
|
|
32
31
|
const method = methods[methodName];
|
|
33
32
|
const currentPrivateMethod = privateApi[methodName];
|
|
34
|
-
if (
|
|
33
|
+
if (currentPrivateMethod?.spying === true) {
|
|
35
34
|
currentPrivateMethod.target = method;
|
|
36
35
|
} else {
|
|
37
36
|
privateApi[methodName] = method;
|
|
@@ -39,7 +38,7 @@ function createPrivateAPI(publicApiRef) {
|
|
|
39
38
|
if (visibility === 'public') {
|
|
40
39
|
const publicApi = publicApiRef.current;
|
|
41
40
|
const currentPublicMethod = publicApi[methodName];
|
|
42
|
-
if (
|
|
41
|
+
if (currentPublicMethod?.spying === true) {
|
|
43
42
|
currentPublicMethod.target = method;
|
|
44
43
|
} else {
|
|
45
44
|
publicApi[methodName] = method;
|
|
@@ -69,7 +68,6 @@ function createPublicAPI(privateApiRef) {
|
|
|
69
68
|
return publicApi;
|
|
70
69
|
}
|
|
71
70
|
export function useGridApiInitialization(inputApiRef, props) {
|
|
72
|
-
var _inputApiRef$current;
|
|
73
71
|
const publicApiRef = React.useRef();
|
|
74
72
|
const privateApiRef = React.useRef();
|
|
75
73
|
if (!privateApiRef.current) {
|
|
@@ -100,7 +98,7 @@ export function useGridApiInitialization(inputApiRef, props) {
|
|
|
100
98
|
subscribeEvent,
|
|
101
99
|
publishEvent
|
|
102
100
|
}, 'public');
|
|
103
|
-
if (inputApiRef && !
|
|
101
|
+
if (inputApiRef && !inputApiRef.current?.state) {
|
|
104
102
|
inputApiRef.current = publicApiRef.current;
|
|
105
103
|
}
|
|
106
104
|
React.useImperativeHandle(inputApiRef, () => publicApiRef.current, [publicApiRef]);
|
|
@@ -30,9 +30,8 @@ function copyToClipboard(data) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
function hasNativeSelection(element) {
|
|
33
|
-
var _window$getSelection;
|
|
34
33
|
// When getSelection is called on an <iframe> that is not displayed Firefox will return null.
|
|
35
|
-
if (
|
|
34
|
+
if (window.getSelection()?.toString()) {
|
|
36
35
|
return true;
|
|
37
36
|
}
|
|
38
37
|
|
|
@@ -51,7 +50,7 @@ function hasNativeSelection(element) {
|
|
|
51
50
|
*/
|
|
52
51
|
export const useGridClipboard = (apiRef, props) => {
|
|
53
52
|
const ignoreValueFormatterProp = props.ignoreValueFormatterDuringExport;
|
|
54
|
-
const ignoreValueFormatter = (typeof ignoreValueFormatterProp === 'object' ? ignoreValueFormatterProp
|
|
53
|
+
const ignoreValueFormatter = (typeof ignoreValueFormatterProp === 'object' ? ignoreValueFormatterProp?.clipboardExport : ignoreValueFormatterProp) || false;
|
|
55
54
|
const clipboardCopyCellDelimiter = props.clipboardCopyCellDelimiter;
|
|
56
55
|
const handleCopy = React.useCallback(event => {
|
|
57
56
|
if (!((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === 'c' && !event.shiftKey && !event.altKey)) {
|
|
@@ -68,7 +67,8 @@ export const useGridClipboard = (apiRef, props) => {
|
|
|
68
67
|
textToCopy = apiRef.current.getDataAsCsv({
|
|
69
68
|
includeHeaders: false,
|
|
70
69
|
// TODO: make it configurable
|
|
71
|
-
delimiter: clipboardCopyCellDelimiter
|
|
70
|
+
delimiter: clipboardCopyCellDelimiter,
|
|
71
|
+
shouldAppendQuotes: false
|
|
72
72
|
});
|
|
73
73
|
} else {
|
|
74
74
|
const focusedCell = gridFocusCellSelector(apiRef);
|
|
@@ -76,7 +76,8 @@ export const useGridClipboard = (apiRef, props) => {
|
|
|
76
76
|
const cellParams = apiRef.current.getCellParams(focusedCell.id, focusedCell.field);
|
|
77
77
|
textToCopy = serializeCellValue(cellParams, {
|
|
78
78
|
delimiterCharacter: clipboardCopyCellDelimiter,
|
|
79
|
-
ignoreValueFormatter
|
|
79
|
+
ignoreValueFormatter,
|
|
80
|
+
shouldAppendQuotes: false
|
|
80
81
|
});
|
|
81
82
|
}
|
|
82
83
|
}
|
|
@@ -4,19 +4,7 @@ import { createSelector, createSelectorMemoized } from '../../../utils/createSel
|
|
|
4
4
|
* @ignore - do not document.
|
|
5
5
|
*/
|
|
6
6
|
export const gridColumnGroupingSelector = state => state.columnGrouping;
|
|
7
|
-
export const gridColumnGroupsUnwrappedModelSelector = createSelectorMemoized(gridColumnGroupingSelector, columnGrouping => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export const gridColumnGroupsLookupSelector = createSelectorMemoized(gridColumnGroupingSelector, columnGrouping => {
|
|
12
|
-
var _columnGrouping$looku;
|
|
13
|
-
return (_columnGrouping$looku = columnGrouping == null ? void 0 : columnGrouping.lookup) != null ? _columnGrouping$looku : {};
|
|
14
|
-
});
|
|
15
|
-
export const gridColumnGroupsHeaderStructureSelector = createSelectorMemoized(gridColumnGroupingSelector, columnGrouping => {
|
|
16
|
-
var _columnGrouping$heade;
|
|
17
|
-
return (_columnGrouping$heade = columnGrouping == null ? void 0 : columnGrouping.headerStructure) != null ? _columnGrouping$heade : [];
|
|
18
|
-
});
|
|
19
|
-
export const gridColumnGroupsHeaderMaxDepthSelector = createSelector(gridColumnGroupingSelector, columnGrouping => {
|
|
20
|
-
var _columnGrouping$maxDe;
|
|
21
|
-
return (_columnGrouping$maxDe = columnGrouping == null ? void 0 : columnGrouping.maxDepth) != null ? _columnGrouping$maxDe : 0;
|
|
22
|
-
});
|
|
7
|
+
export const gridColumnGroupsUnwrappedModelSelector = createSelectorMemoized(gridColumnGroupingSelector, columnGrouping => columnGrouping?.unwrappedGroupingModel ?? {});
|
|
8
|
+
export const gridColumnGroupsLookupSelector = createSelectorMemoized(gridColumnGroupingSelector, columnGrouping => columnGrouping?.lookup ?? {});
|
|
9
|
+
export const gridColumnGroupsHeaderStructureSelector = createSelectorMemoized(gridColumnGroupingSelector, columnGrouping => columnGrouping?.headerStructure ?? []);
|
|
10
|
+
export const gridColumnGroupsHeaderMaxDepthSelector = createSelector(gridColumnGroupingSelector, columnGrouping => columnGrouping?.maxDepth ?? 0);
|
|
@@ -35,26 +35,22 @@ export const unwrapGroupingColumnModel = columnGroupingModel => {
|
|
|
35
35
|
return unwrappedSubTree;
|
|
36
36
|
};
|
|
37
37
|
export const getColumnGroupsHeaderStructure = (orderedColumns, unwrappedGroupingModel, pinnedFields) => {
|
|
38
|
-
const getParents = field =>
|
|
39
|
-
var _unwrappedGroupingMod;
|
|
40
|
-
return (_unwrappedGroupingMod = unwrappedGroupingModel[field]) != null ? _unwrappedGroupingMod : [];
|
|
41
|
-
};
|
|
38
|
+
const getParents = field => unwrappedGroupingModel[field] ?? [];
|
|
42
39
|
const groupingHeaderStructure = [];
|
|
43
40
|
const maxDepth = Math.max(...orderedColumns.map(field => getParents(field).length));
|
|
44
41
|
const haveSameParents = (field1, field2, depth) => isDeepEqual(getParents(field1).slice(0, depth + 1), getParents(field2).slice(0, depth + 1));
|
|
45
42
|
const haveDifferentContainers = (field1, field2) => {
|
|
46
|
-
if (pinnedFields
|
|
43
|
+
if (pinnedFields?.left && pinnedFields.left.includes(field1) && !pinnedFields.left.includes(field2)) {
|
|
47
44
|
return true;
|
|
48
45
|
}
|
|
49
|
-
if (pinnedFields
|
|
46
|
+
if (pinnedFields?.right && !pinnedFields.right.includes(field1) && pinnedFields.right.includes(field2)) {
|
|
50
47
|
return true;
|
|
51
48
|
}
|
|
52
49
|
return false;
|
|
53
50
|
};
|
|
54
51
|
for (let depth = 0; depth < maxDepth; depth += 1) {
|
|
55
52
|
const depthStructure = orderedColumns.reduce((structure, newField) => {
|
|
56
|
-
|
|
57
|
-
const groupId = (_getParents$depth = getParents(newField)[depth]) != null ? _getParents$depth : null;
|
|
53
|
+
const groupId = getParents(newField)[depth] ?? null;
|
|
58
54
|
if (structure.length === 0) {
|
|
59
55
|
return [{
|
|
60
56
|
columnFields: [newField],
|