@mui/x-data-grid 7.0.0-beta.7 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +266 -12
- package/DataGrid/DataGrid.js +18 -17
- package/DataGrid/useDataGridProps.js +4 -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 +8 -7
- package/components/columnHeaders/GridColumnHeaderSortIcon.js +1 -2
- package/components/columnHeaders/GridColumnHeaderTitle.js +2 -3
- package/components/columnHeaders/GridGenericColumnHeaderItem.js +4 -2
- 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 +21 -7
- 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.d.ts +1 -1
- package/hooks/features/dimensions/useGridDimensions.js +6 -7
- package/hooks/features/editing/useGridCellEditing.js +4 -6
- package/hooks/features/editing/useGridEditing.js +1 -2
- package/hooks/features/editing/useGridRowEditing.js +17 -10
- 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 +26 -25
- package/modern/DataGrid/DataGrid.js +18 -17
- package/modern/DataGrid/useDataGridProps.js +4 -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/columnHeaders/GridColumnHeaderItem.js +3 -1
- package/modern/components/columnHeaders/GridGenericColumnHeaderItem.js +3 -1
- 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/components/toolbar/GridToolbarQuickFilter.js +17 -2
- 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/dimensions/useGridDimensions.js +3 -2
- package/modern/hooks/features/editing/useGridCellEditing.js +1 -1
- package/modern/hooks/features/editing/useGridRowEditing.js +14 -5
- 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/modern/utils/throttle.js +19 -0
- package/node/DataGrid/DataGrid.js +18 -17
- package/node/DataGrid/useDataGridProps.js +4 -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/columnHeaders/GridColumnHeaderItem.js +3 -1
- package/node/components/columnHeaders/GridGenericColumnHeaderItem.js +3 -1
- 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/components/toolbar/GridToolbarQuickFilter.js +17 -2
- 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/dimensions/useGridDimensions.js +2 -1
- package/node/hooks/features/editing/useGridCellEditing.js +1 -1
- package/node/hooks/features/editing/useGridRowEditing.js +14 -5
- 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/node/utils/throttle.js +25 -0
- 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
- package/utils/throttle.d.ts +4 -0
- package/utils/throttle.js +19 -0
package/joy/joySlots.js
CHANGED
|
@@ -79,7 +79,6 @@ const Checkbox = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
79
79
|
}));
|
|
80
80
|
});
|
|
81
81
|
const TextField = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
82
|
-
var _props$InputProps, _props$inputProps;
|
|
83
82
|
let {
|
|
84
83
|
onChange,
|
|
85
84
|
label,
|
|
@@ -91,8 +90,8 @@ const TextField = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
91
90
|
variant
|
|
92
91
|
} = _ref2,
|
|
93
92
|
props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
94
|
-
const rootRef = useForkRef(ref,
|
|
95
|
-
const inputForkRef = useForkRef(inputRef, props
|
|
93
|
+
const rootRef = useForkRef(ref, props.InputProps?.ref);
|
|
94
|
+
const inputForkRef = useForkRef(inputRef, props?.inputProps?.ref);
|
|
96
95
|
const {
|
|
97
96
|
startAdornment,
|
|
98
97
|
endAdornment
|
|
@@ -109,7 +108,7 @@ const TextField = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
109
108
|
variant: convertVariant(variant, 'outlined'),
|
|
110
109
|
size: convertSize(size),
|
|
111
110
|
slotProps: {
|
|
112
|
-
input: _extends({}, props
|
|
111
|
+
input: _extends({}, props?.inputProps, {
|
|
113
112
|
ref: inputForkRef
|
|
114
113
|
})
|
|
115
114
|
},
|
|
@@ -139,7 +138,6 @@ const Button = /*#__PURE__*/React.forwardRef(function Button(_ref3, ref) {
|
|
|
139
138
|
}));
|
|
140
139
|
});
|
|
141
140
|
const IconButton = /*#__PURE__*/React.forwardRef(function IconButton(_ref4, ref) {
|
|
142
|
-
var _convertColor;
|
|
143
141
|
let {
|
|
144
142
|
color,
|
|
145
143
|
size,
|
|
@@ -148,7 +146,7 @@ const IconButton = /*#__PURE__*/React.forwardRef(function IconButton(_ref4, ref)
|
|
|
148
146
|
props = _objectWithoutPropertiesLoose(_ref4, _excluded4);
|
|
149
147
|
return /*#__PURE__*/_jsx(JoyIconButton, _extends({}, props, {
|
|
150
148
|
size: convertSize(size),
|
|
151
|
-
color:
|
|
149
|
+
color: convertColor(color) ?? 'neutral',
|
|
152
150
|
variant: "plain",
|
|
153
151
|
ref: ref,
|
|
154
152
|
sx: sx
|
|
@@ -193,10 +191,9 @@ const Select = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
|
|
|
193
191
|
listboxOpen: open,
|
|
194
192
|
onListboxOpenChange: isOpen => {
|
|
195
193
|
if (isOpen) {
|
|
196
|
-
onOpen
|
|
194
|
+
onOpen?.({});
|
|
197
195
|
} else {
|
|
198
|
-
|
|
199
|
-
MenuProps == null || (_MenuProps$onClose = MenuProps.onClose) == null || _MenuProps$onClose.call(MenuProps, {}, undefined);
|
|
196
|
+
MenuProps?.onClose?.({}, undefined);
|
|
200
197
|
}
|
|
201
198
|
},
|
|
202
199
|
size: convertSize(size),
|
|
@@ -257,10 +254,7 @@ const Pagination = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
257
254
|
const rootProps = useGridRootProps();
|
|
258
255
|
const paginationModel = gridPaginationModelSelector(apiRef);
|
|
259
256
|
const visibleTopLevelRowCount = gridFilteredTopLevelRowCountSelector(apiRef);
|
|
260
|
-
const rowCount = React.useMemo(() =>
|
|
261
|
-
var _ref8, _rootProps$rowCount;
|
|
262
|
-
return (_ref8 = (_rootProps$rowCount = rootProps.rowCount) != null ? _rootProps$rowCount : visibleTopLevelRowCount) != null ? _ref8 : 0;
|
|
263
|
-
}, [rootProps.rowCount, visibleTopLevelRowCount]);
|
|
257
|
+
const rowCount = React.useMemo(() => rootProps.rowCount ?? visibleTopLevelRowCount ?? 0, [rootProps.rowCount, visibleTopLevelRowCount]);
|
|
264
258
|
const lastPage = React.useMemo(() => Math.floor(rowCount / (paginationModel.pageSize || 1)), [rowCount, paginationModel.pageSize]);
|
|
265
259
|
const handlePageChange = React.useCallback(page => {
|
|
266
260
|
apiRef.current.setPage(page);
|
|
@@ -52,7 +52,7 @@ export interface GridRowsMetaPrivateApi {
|
|
|
52
52
|
rowHasAutoHeight: (id: GridRowId) => boolean;
|
|
53
53
|
/**
|
|
54
54
|
* Returns the index of the last row measured.
|
|
55
|
-
* The value considers only the rows reachable by scroll,
|
|
55
|
+
* The value considers only the rows reachable by scroll, for example first row has index=0 in all pages.
|
|
56
56
|
* @returns {number} The index of the last measured row.
|
|
57
57
|
*/
|
|
58
58
|
getLastMeasuredRowIndex: () => number;
|
package/models/api/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export * from './gridPreferencesPanelApi';
|
|
|
17
17
|
export * from './gridPrintExportApi';
|
|
18
18
|
export * from './gridCallbackDetails';
|
|
19
19
|
export * from './gridScrollApi';
|
|
20
|
-
export
|
|
20
|
+
export type { GridVirtualizationApi } from './gridVirtualizationApi';
|
|
21
21
|
export type { GridApiCommon } from './gridApiCommon';
|
|
22
22
|
export type { GridEditingApi, GridCellModesModel, GridRowModesModel } from './gridEditingApi';
|
|
23
23
|
export type GridEditRowApi = GridEditingApi;
|
package/models/api/index.js
CHANGED
|
@@ -13,6 +13,7 @@ import type { GridStrategyProcessorName } from '../../hooks/core/strategyProcess
|
|
|
13
13
|
import { GridRowEditStartParams, GridRowEditStopParams } from '../params/gridRowParams';
|
|
14
14
|
import { GridCellModesModel, GridRowModesModel } from '../api/gridEditingApi';
|
|
15
15
|
import { GridPaginationModel } from '../gridPaginationProps';
|
|
16
|
+
import { GridDensity } from '../gridDensity';
|
|
16
17
|
export interface GridRowEventLookup {
|
|
17
18
|
/**
|
|
18
19
|
* Fired when a row is clicked.
|
|
@@ -375,6 +376,12 @@ export interface GridControlledStateEventLookup {
|
|
|
375
376
|
rowCountChange: {
|
|
376
377
|
params: number;
|
|
377
378
|
};
|
|
379
|
+
/**
|
|
380
|
+
* Fired when the density changes.
|
|
381
|
+
*/
|
|
382
|
+
densityChange: {
|
|
383
|
+
params: GridDensity;
|
|
384
|
+
};
|
|
378
385
|
}
|
|
379
386
|
export interface GridControlledStateReasonLookup {
|
|
380
387
|
filter: 'upsertFilterItem' | 'upsertFilterItems' | 'deleteFilterItem' | 'changeLogicOperator' | 'restoreState' | 'removeAllFilterItems';
|
package/models/gridExport.d.ts
CHANGED
|
@@ -88,6 +88,12 @@ export interface GridCsvExportOptions extends GridFileExportOptions {
|
|
|
88
88
|
* @returns {GridRowId[]} The list of row ids to export.
|
|
89
89
|
*/
|
|
90
90
|
getRowsToExport?: (params: GridCsvGetRowsToExportParams) => GridRowId[];
|
|
91
|
+
/**
|
|
92
|
+
* @ignore
|
|
93
|
+
* If `false`, the quotes will not be appended to the cell value.
|
|
94
|
+
* @default true
|
|
95
|
+
*/
|
|
96
|
+
shouldAppendQuotes?: boolean;
|
|
91
97
|
}
|
|
92
98
|
/**
|
|
93
99
|
* The options to apply on the Print export.
|
|
@@ -35,7 +35,7 @@ export interface GridExperimentalFeatures {
|
|
|
35
35
|
/**
|
|
36
36
|
* The props users can give to the `DataGrid` component.
|
|
37
37
|
*/
|
|
38
|
-
export type DataGridProps<R extends GridValidRowModel = any> = Omit<Partial<DataGridPropsWithDefaultValues
|
|
38
|
+
export type DataGridProps<R extends GridValidRowModel = any> = Omit<Partial<DataGridPropsWithDefaultValues<R>> & DataGridPropsWithComplexDefaultValueBeforeProcessing & DataGridPropsWithoutDefaultValue<R>, DataGridForcedPropsKey> & {
|
|
39
39
|
pagination?: true;
|
|
40
40
|
};
|
|
41
41
|
/**
|
|
@@ -75,7 +75,7 @@ export interface DataGridPropsWithComplexDefaultValueBeforeProcessing {
|
|
|
75
75
|
* The controlled model do not have a default value at the prop processing level, so they must be defined in `DataGridOtherProps`
|
|
76
76
|
* TODO: add multiSortKey
|
|
77
77
|
*/
|
|
78
|
-
export interface DataGridPropsWithDefaultValues {
|
|
78
|
+
export interface DataGridPropsWithDefaultValues<R extends GridValidRowModel = any> {
|
|
79
79
|
/**
|
|
80
80
|
* If `true`, the Data Grid height is dynamic and follow the number of rows in the Data Grid.
|
|
81
81
|
* @default false
|
|
@@ -98,35 +98,25 @@ export interface DataGridPropsWithDefaultValues {
|
|
|
98
98
|
*/
|
|
99
99
|
checkboxSelectionVisibleOnly: boolean;
|
|
100
100
|
/**
|
|
101
|
-
*
|
|
102
|
-
* @default
|
|
101
|
+
* Column region in pixels to render before/after the viewport
|
|
102
|
+
* @default 150
|
|
103
103
|
*/
|
|
104
|
-
|
|
104
|
+
columnBufferPx: number;
|
|
105
105
|
/**
|
|
106
|
-
*
|
|
107
|
-
* @default
|
|
106
|
+
* Row region in pixels to render before/after the viewport
|
|
107
|
+
* @default 150
|
|
108
108
|
*/
|
|
109
|
-
|
|
109
|
+
rowBufferPx: number;
|
|
110
110
|
/**
|
|
111
111
|
* If `false`, the row selection mode is disabled.
|
|
112
112
|
* @default true
|
|
113
113
|
*/
|
|
114
114
|
rowSelection: boolean;
|
|
115
115
|
/**
|
|
116
|
-
*
|
|
117
|
-
* @default
|
|
118
|
-
*/
|
|
119
|
-
rowThreshold: number;
|
|
120
|
-
/**
|
|
121
|
-
* Number of rows from the `columnBuffer` that can be visible before a new slice is rendered.
|
|
122
|
-
* @default 3
|
|
116
|
+
* The milliseconds throttle delay for resizing the grid.
|
|
117
|
+
* @default 60
|
|
123
118
|
*/
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Set the density of the Data Grid.
|
|
127
|
-
* @default "standard"
|
|
128
|
-
*/
|
|
129
|
-
density: GridDensity;
|
|
119
|
+
resizeThrottleMs: number;
|
|
130
120
|
/**
|
|
131
121
|
* If `true`, column filters are disabled.
|
|
132
122
|
* @default false
|
|
@@ -260,6 +250,11 @@ export interface DataGridPropsWithDefaultValues {
|
|
|
260
250
|
* @default "client"
|
|
261
251
|
*/
|
|
262
252
|
paginationMode: GridFeatureMode;
|
|
253
|
+
/**
|
|
254
|
+
* Set of rows of type [[GridRowsProp]].
|
|
255
|
+
* @default []
|
|
256
|
+
*/
|
|
257
|
+
rows: GridRowsProp<R>;
|
|
263
258
|
/**
|
|
264
259
|
* Sets the height in pixel of a row in the Data Grid.
|
|
265
260
|
* @default 52
|
|
@@ -377,6 +372,11 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
377
372
|
* Override or extend the styles applied to the component.
|
|
378
373
|
*/
|
|
379
374
|
classes?: Partial<GridClasses>;
|
|
375
|
+
/**
|
|
376
|
+
* Set the density of the Data Grid.
|
|
377
|
+
* @default "standard"
|
|
378
|
+
*/
|
|
379
|
+
density?: GridDensity;
|
|
380
380
|
/**
|
|
381
381
|
* Set the total number of rows, if it is different from the length of the value `rows` prop.
|
|
382
382
|
* If some rows have children (for instance in the tree data), this number represents the amount of top level rows.
|
|
@@ -530,6 +530,11 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
530
530
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
531
531
|
*/
|
|
532
532
|
onColumnOrderChange?: GridEventListener<'columnOrderChange'>;
|
|
533
|
+
/**
|
|
534
|
+
* Callback fired when the density changes.
|
|
535
|
+
* @param {GridDensity} density New density value.
|
|
536
|
+
*/
|
|
537
|
+
onDensityChange?: (density: GridDensity) => void;
|
|
533
538
|
/**
|
|
534
539
|
* Callback fired when a row is clicked.
|
|
535
540
|
* Not called if the target clicked is an interactive element added by the built-in columns.
|
|
@@ -688,10 +693,6 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
688
693
|
* Nonce of the inline styles for [Content Security Policy](https://www.w3.org/TR/2016/REC-CSP2-20161215/#script-src-the-nonce-attribute).
|
|
689
694
|
*/
|
|
690
695
|
nonce?: string;
|
|
691
|
-
/**
|
|
692
|
-
* Set of rows of type [[GridRowsProp]].
|
|
693
|
-
*/
|
|
694
|
-
rows: GridRowsProp<R>;
|
|
695
696
|
/**
|
|
696
697
|
* The initial state of the DataGrid.
|
|
697
698
|
* The data in it will be set in the state on initialization but will not be controlled.
|
|
@@ -101,10 +101,10 @@ DataGridRaw.propTypes = {
|
|
|
101
101
|
*/
|
|
102
102
|
clipboardCopyCellDelimiter: PropTypes.string,
|
|
103
103
|
/**
|
|
104
|
-
*
|
|
105
|
-
* @default
|
|
104
|
+
* Column region in pixels to render before/after the viewport
|
|
105
|
+
* @default 150
|
|
106
106
|
*/
|
|
107
|
-
|
|
107
|
+
columnBufferPx: PropTypes.number,
|
|
108
108
|
columnGroupingModel: PropTypes.arrayOf(PropTypes.object),
|
|
109
109
|
/**
|
|
110
110
|
* Sets the height in pixel of the column headers in the Data Grid.
|
|
@@ -115,11 +115,6 @@ DataGridRaw.propTypes = {
|
|
|
115
115
|
* Set of columns of type [[GridColDef]][].
|
|
116
116
|
*/
|
|
117
117
|
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
118
|
-
/**
|
|
119
|
-
* Number of rows from the `columnBuffer` that can be visible before a new slice is rendered.
|
|
120
|
-
* @default 3
|
|
121
|
-
*/
|
|
122
|
-
columnThreshold: PropTypes.number,
|
|
123
118
|
/**
|
|
124
119
|
* Set the column visibility model of the Data Grid.
|
|
125
120
|
* If defined, the Data Grid will ignore the `hide` property in [[GridColDef]].
|
|
@@ -467,6 +462,11 @@ DataGridRaw.propTypes = {
|
|
|
467
462
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
468
463
|
*/
|
|
469
464
|
onColumnWidthChange: PropTypes.func,
|
|
465
|
+
/**
|
|
466
|
+
* Callback fired when the density changes.
|
|
467
|
+
* @param {GridDensity} density New density value.
|
|
468
|
+
*/
|
|
469
|
+
onDensityChange: PropTypes.func,
|
|
470
470
|
/**
|
|
471
471
|
* Callback fired when the Filter model changes before the filters are applied.
|
|
472
472
|
* @param {GridFilterModel} model With all properties from [[GridFilterModel]].
|
|
@@ -609,10 +609,15 @@ DataGridRaw.propTypes = {
|
|
|
609
609
|
*/
|
|
610
610
|
processRowUpdate: PropTypes.func,
|
|
611
611
|
/**
|
|
612
|
-
*
|
|
613
|
-
* @default
|
|
612
|
+
* The milliseconds throttle delay for resizing the grid.
|
|
613
|
+
* @default 60
|
|
614
614
|
*/
|
|
615
|
-
|
|
615
|
+
resizeThrottleMs: PropTypes.number,
|
|
616
|
+
/**
|
|
617
|
+
* Row region in pixels to render before/after the viewport
|
|
618
|
+
* @default 150
|
|
619
|
+
*/
|
|
620
|
+
rowBufferPx: PropTypes.number,
|
|
616
621
|
/**
|
|
617
622
|
* Set the total number of rows, if it is different from the length of the value `rows` prop.
|
|
618
623
|
* If some rows have children (for instance in the tree data), this number represents the amount of top level rows.
|
|
@@ -636,8 +641,9 @@ DataGridRaw.propTypes = {
|
|
|
636
641
|
rowPositionsDebounceMs: PropTypes.number,
|
|
637
642
|
/**
|
|
638
643
|
* Set of rows of type [[GridRowsProp]].
|
|
644
|
+
* @default []
|
|
639
645
|
*/
|
|
640
|
-
rows: PropTypes.arrayOf(PropTypes.object)
|
|
646
|
+
rows: PropTypes.arrayOf(PropTypes.object),
|
|
641
647
|
/**
|
|
642
648
|
* If `false`, the row selection mode is disabled.
|
|
643
649
|
* @default true
|
|
@@ -652,11 +658,6 @@ DataGridRaw.propTypes = {
|
|
|
652
658
|
* @default "margin"
|
|
653
659
|
*/
|
|
654
660
|
rowSpacingType: PropTypes.oneOf(['border', 'margin']),
|
|
655
|
-
/**
|
|
656
|
-
* Number of rows from the `rowBuffer` that can be visible before a new slice is rendered.
|
|
657
|
-
* @default 3
|
|
658
|
-
*/
|
|
659
|
-
rowThreshold: PropTypes.number,
|
|
660
661
|
/**
|
|
661
662
|
* Override the height/width of the Data Grid inner scrollbar.
|
|
662
663
|
*/
|
|
@@ -25,12 +25,10 @@ export const DATA_GRID_PROPS_DEFAULT_VALUES = {
|
|
|
25
25
|
autoPageSize: false,
|
|
26
26
|
checkboxSelection: false,
|
|
27
27
|
checkboxSelectionVisibleOnly: false,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
rowThreshold: 3,
|
|
28
|
+
columnBufferPx: 150,
|
|
29
|
+
rowBufferPx: 150,
|
|
30
|
+
rows: [],
|
|
32
31
|
rowSelection: true,
|
|
33
|
-
density: 'standard',
|
|
34
32
|
disableColumnFilter: false,
|
|
35
33
|
disableColumnMenu: false,
|
|
36
34
|
disableColumnSelector: false,
|
|
@@ -56,6 +54,7 @@ export const DATA_GRID_PROPS_DEFAULT_VALUES = {
|
|
|
56
54
|
pagination: false,
|
|
57
55
|
paginationMode: 'client',
|
|
58
56
|
rowHeight: 52,
|
|
57
|
+
resizeThrottleMs: 60,
|
|
59
58
|
pageSizeOptions: [25, 50, 100],
|
|
60
59
|
rowSpacingType: 'margin',
|
|
61
60
|
showCellVerticalBorder: false,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
3
4
|
import TablePagination, { tablePaginationClasses } from '@mui/material/TablePagination';
|
|
4
5
|
import { styled } from '@mui/material/styles';
|
|
5
6
|
import { useGridSelector } from '../hooks/utils/useGridSelector';
|
|
@@ -26,7 +27,7 @@ const GridPaginationRoot = styled(TablePagination)(({
|
|
|
26
27
|
|
|
27
28
|
// A mutable version of a readonly array.
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
const GridPagination = /*#__PURE__*/React.forwardRef(function GridPagination(props, ref) {
|
|
30
31
|
const apiRef = useGridApiContext();
|
|
31
32
|
const rootProps = useGridRootProps();
|
|
32
33
|
const paginationModel = useGridSelector(apiRef, gridPaginationModelSelector);
|
|
@@ -79,4 +80,12 @@ export const GridPagination = /*#__PURE__*/React.forwardRef(function GridPaginat
|
|
|
79
80
|
onPageChange: handlePageChange,
|
|
80
81
|
onRowsPerPageChange: handlePageSizeChange
|
|
81
82
|
}, apiRef.current.getLocaleText('MuiTablePagination'), props));
|
|
82
|
-
});
|
|
83
|
+
});
|
|
84
|
+
process.env.NODE_ENV !== "production" ? GridPagination.propTypes = {
|
|
85
|
+
// ----------------------------- Warning --------------------------------
|
|
86
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
87
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
88
|
+
// ----------------------------------------------------------------------
|
|
89
|
+
component: PropTypes.elementType
|
|
90
|
+
} : void 0;
|
|
91
|
+
export { GridPagination };
|
|
@@ -128,7 +128,7 @@ function GridActionsCell(props) {
|
|
|
128
128
|
}
|
|
129
129
|
if (newIndex !== focusedButtonIndex) {
|
|
130
130
|
event.preventDefault(); // Prevent scrolling
|
|
131
|
-
event.stopPropagation(); // Don't stop propagation for other keys,
|
|
131
|
+
event.stopPropagation(); // Don't stop propagation for other keys, for example ArrowUp
|
|
132
132
|
setFocusedButtonIndex(newIndex);
|
|
133
133
|
}
|
|
134
134
|
};
|
|
@@ -62,6 +62,10 @@ process.env.NODE_ENV !== "production" ? GridActionsCellItem.propTypes = {
|
|
|
62
62
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
63
63
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
64
64
|
// ----------------------------------------------------------------------
|
|
65
|
+
/**
|
|
66
|
+
* from https://mui.com/material-ui/api/button-base/#ButtonBase-prop-component
|
|
67
|
+
*/
|
|
68
|
+
component: PropTypes.elementType,
|
|
65
69
|
icon: PropTypes.element,
|
|
66
70
|
label: PropTypes.string.isRequired,
|
|
67
71
|
showInMenu: PropTypes.bool
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "hasFocus", "tabIndex"];
|
|
3
|
+
const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "hasFocus", "tabIndex", "hideDescendantCount"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
@@ -76,6 +76,7 @@ process.env.NODE_ENV !== "production" ? GridBooleanCellRaw.propTypes = {
|
|
|
76
76
|
* If true, the cell is the active element.
|
|
77
77
|
*/
|
|
78
78
|
hasFocus: PropTypes.bool.isRequired,
|
|
79
|
+
hideDescendantCount: PropTypes.bool,
|
|
79
80
|
/**
|
|
80
81
|
* The grid row id.
|
|
81
82
|
*/
|
|
@@ -105,7 +106,7 @@ process.env.NODE_ENV !== "production" ? GridBooleanCellRaw.propTypes = {
|
|
|
105
106
|
const GridBooleanCell = /*#__PURE__*/React.memo(GridBooleanCellRaw);
|
|
106
107
|
export { GridBooleanCell };
|
|
107
108
|
export const renderBooleanCell = params => {
|
|
108
|
-
if (isAutoGeneratedRow(params.rowNode)) {
|
|
109
|
+
if (params.field !== '__row_group_by_columns_group__' && isAutoGeneratedRow(params.rowNode)) {
|
|
109
110
|
return '';
|
|
110
111
|
}
|
|
111
112
|
return /*#__PURE__*/_jsx(GridBooleanCell, _extends({}, params));
|
|
@@ -153,7 +153,9 @@ function GridColumnHeaderItem(props) {
|
|
|
153
153
|
const focusableElement = headerCellRef.current.querySelector('[tabindex="0"]');
|
|
154
154
|
const elementToFocus = focusableElement || headerCellRef.current;
|
|
155
155
|
elementToFocus?.focus();
|
|
156
|
-
apiRef.current.columnHeadersContainerRef
|
|
156
|
+
if (apiRef.current.columnHeadersContainerRef?.current) {
|
|
157
|
+
apiRef.current.columnHeadersContainerRef.current.scrollLeft = 0;
|
|
158
|
+
}
|
|
157
159
|
}
|
|
158
160
|
}, [apiRef, hasFocus]);
|
|
159
161
|
const headerClassName = typeof colDef.headerClassName === 'function' ? colDef.headerClassName({
|
|
@@ -56,7 +56,9 @@ const GridGenericColumnHeaderItem = /*#__PURE__*/React.forwardRef(function GridG
|
|
|
56
56
|
const focusableElement = headerCellRef.current.querySelector('[tabindex="0"]');
|
|
57
57
|
const elementToFocus = focusableElement || headerCellRef.current;
|
|
58
58
|
elementToFocus?.focus();
|
|
59
|
-
apiRef.current.columnHeadersContainerRef
|
|
59
|
+
if (apiRef.current.columnHeadersContainerRef?.current) {
|
|
60
|
+
apiRef.current.columnHeadersContainerRef.current.scrollLeft = 0;
|
|
61
|
+
}
|
|
60
62
|
}
|
|
61
63
|
}, [apiRef, hasFocus]);
|
|
62
64
|
return /*#__PURE__*/_jsxs("div", _extends({
|
|
@@ -11,7 +11,7 @@ import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
|
11
11
|
import { useGridPrivateApiContext } from '../../hooks/utils/useGridPrivateApiContext';
|
|
12
12
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
13
13
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
14
|
-
import {
|
|
14
|
+
import { gridDensitySelector } from '../../hooks/features/density/densitySelector';
|
|
15
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
17
|
const useUtilityClasses = ownerState => {
|
|
@@ -39,11 +39,11 @@ const GridRoot = /*#__PURE__*/React.forwardRef(function GridRoot(props, ref) {
|
|
|
39
39
|
} = props,
|
|
40
40
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
41
41
|
const apiRef = useGridPrivateApiContext();
|
|
42
|
-
const
|
|
42
|
+
const density = useGridSelector(apiRef, gridDensitySelector);
|
|
43
43
|
const rootElementRef = apiRef.current.rootElementRef;
|
|
44
44
|
const handleRef = useForkRef(rootElementRef, ref);
|
|
45
45
|
const ownerState = _extends({}, rootProps, {
|
|
46
|
-
density
|
|
46
|
+
density
|
|
47
47
|
});
|
|
48
48
|
const classes = useUtilityClasses(ownerState);
|
|
49
49
|
|
|
@@ -99,7 +99,7 @@ process.env.NODE_ENV !== "production" ? GridFilterInputBoolean.propTypes = {
|
|
|
99
99
|
focusElementRef: refType,
|
|
100
100
|
/**
|
|
101
101
|
* It is `true` if the filter either has a value or an operator with no value
|
|
102
|
-
* required is selected (
|
|
102
|
+
* required is selected (for example `isEmpty`)
|
|
103
103
|
*/
|
|
104
104
|
isFilterActive: PropTypes.bool,
|
|
105
105
|
item: PropTypes.shape({
|
|
@@ -99,7 +99,7 @@ process.env.NODE_ENV !== "production" ? GridFilterInputDate.propTypes = {
|
|
|
99
99
|
focusElementRef: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.func, PropTypes.object]),
|
|
100
100
|
/**
|
|
101
101
|
* It is `true` if the filter either has a value or an operator with no value
|
|
102
|
-
* required is selected (
|
|
102
|
+
* required is selected (for example `isEmpty`)
|
|
103
103
|
*/
|
|
104
104
|
isFilterActive: PropTypes.bool,
|
|
105
105
|
item: PropTypes.shape({
|
|
@@ -134,7 +134,7 @@ process.env.NODE_ENV !== "production" ? GridFilterInputSingleSelect.propTypes =
|
|
|
134
134
|
focusElementRef: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.func, PropTypes.object]),
|
|
135
135
|
/**
|
|
136
136
|
* It is `true` if the filter either has a value or an operator with no value
|
|
137
|
-
* required is selected (
|
|
137
|
+
* required is selected (for example `isEmpty`)
|
|
138
138
|
*/
|
|
139
139
|
isFilterActive: PropTypes.bool,
|
|
140
140
|
item: PropTypes.shape({
|
|
@@ -86,7 +86,7 @@ process.env.NODE_ENV !== "production" ? GridFilterInputValue.propTypes = {
|
|
|
86
86
|
focusElementRef: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.func, PropTypes.object]),
|
|
87
87
|
/**
|
|
88
88
|
* It is `true` if the filter either has a value or an operator with no value
|
|
89
|
-
* required is selected (
|
|
89
|
+
* required is selected (for example `isEmpty`)
|
|
90
90
|
*/
|
|
91
91
|
isFilterActive: PropTypes.bool,
|
|
92
92
|
item: PropTypes.shape({
|
|
@@ -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';
|
|
@@ -22,7 +22,7 @@ const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
22
22
|
const tooltipProps = slotProps.tooltip || {};
|
|
23
23
|
const apiRef = useGridApiContext();
|
|
24
24
|
const rootProps = useGridRootProps();
|
|
25
|
-
const
|
|
25
|
+
const density = useGridSelector(apiRef, gridDensitySelector);
|
|
26
26
|
const densityButtonId = useId();
|
|
27
27
|
const densityMenuId = useId();
|
|
28
28
|
const [open, setOpen] = React.useState(false);
|
|
@@ -42,7 +42,7 @@ const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
42
42
|
value: 'comfortable'
|
|
43
43
|
}];
|
|
44
44
|
const startIcon = React.useMemo(() => {
|
|
45
|
-
switch (
|
|
45
|
+
switch (density) {
|
|
46
46
|
case 'compact':
|
|
47
47
|
return /*#__PURE__*/_jsx(rootProps.slots.densityCompactIcon, {});
|
|
48
48
|
case 'comfortable':
|
|
@@ -50,7 +50,7 @@ const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
50
50
|
default:
|
|
51
51
|
return /*#__PURE__*/_jsx(rootProps.slots.densityStandardIcon, {});
|
|
52
52
|
}
|
|
53
|
-
}, [
|
|
53
|
+
}, [density, rootProps]);
|
|
54
54
|
const handleDensitySelectorOpen = event => {
|
|
55
55
|
setOpen(prevOpen => !prevOpen);
|
|
56
56
|
buttonProps.onClick?.(event);
|
|
@@ -77,7 +77,7 @@ const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
77
77
|
}
|
|
78
78
|
const densityElements = densityOptions.map((option, index) => /*#__PURE__*/_jsxs(MenuItem, {
|
|
79
79
|
onClick: () => handleDensityUpdate(option.value),
|
|
80
|
-
selected: option.value ===
|
|
80
|
+
selected: option.value === density,
|
|
81
81
|
children: [/*#__PURE__*/_jsx(ListItemIcon, {
|
|
82
82
|
children: option.icon
|
|
83
83
|
}), option.label]
|
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["quickFilterParser", "quickFilterFormatter", "debounceMs"];
|
|
3
|
+
const _excluded = ["quickFilterParser", "quickFilterFormatter", "debounceMs", "className"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
+
import clsx from 'clsx';
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
6
7
|
import TextField from '@mui/material/TextField';
|
|
7
8
|
import { styled } from '@mui/material/styles';
|
|
8
9
|
import { unstable_debounce as debounce } from '@mui/utils';
|
|
10
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
11
|
+
import { getDataGridUtilityClass } from '../../constants';
|
|
9
12
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
10
13
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
11
14
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
12
15
|
import { gridQuickFilterValuesSelector } from '../../hooks/features/filter';
|
|
13
16
|
import { isDeepEqual } from '../../utils/utils';
|
|
14
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
+
const useUtilityClasses = ownerState => {
|
|
19
|
+
const {
|
|
20
|
+
classes
|
|
21
|
+
} = ownerState;
|
|
22
|
+
const slots = {
|
|
23
|
+
root: ['toolbarQuickFilter']
|
|
24
|
+
};
|
|
25
|
+
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
26
|
+
};
|
|
15
27
|
const GridToolbarQuickFilterRoot = styled(TextField, {
|
|
16
28
|
name: 'MuiDataGrid',
|
|
17
29
|
slot: 'ToolbarQuickFilter',
|
|
@@ -47,11 +59,13 @@ const defaultSearchValueFormatter = values => values.join(' ');
|
|
|
47
59
|
function GridToolbarQuickFilter(props) {
|
|
48
60
|
const apiRef = useGridApiContext();
|
|
49
61
|
const rootProps = useGridRootProps();
|
|
62
|
+
const classes = useUtilityClasses(rootProps);
|
|
50
63
|
const quickFilterValues = useGridSelector(apiRef, gridQuickFilterValuesSelector);
|
|
51
64
|
const {
|
|
52
65
|
quickFilterParser = defaultSearchValueParser,
|
|
53
66
|
quickFilterFormatter = defaultSearchValueFormatter,
|
|
54
|
-
debounceMs = rootProps.filterDebounceMs
|
|
67
|
+
debounceMs = rootProps.filterDebounceMs,
|
|
68
|
+
className
|
|
55
69
|
} = props,
|
|
56
70
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
57
71
|
const [searchValue, setSearchValue] = React.useState(() => quickFilterFormatter(quickFilterValues ?? []));
|
|
@@ -86,6 +100,7 @@ function GridToolbarQuickFilter(props) {
|
|
|
86
100
|
variant: "standard",
|
|
87
101
|
value: searchValue,
|
|
88
102
|
onChange: handleSearchValueChange,
|
|
103
|
+
className: clsx(className, classes.root),
|
|
89
104
|
placeholder: apiRef.current.getLocaleText('toolbarQuickFilterPlaceholder'),
|
|
90
105
|
"aria-label": apiRef.current.getLocaleText('toolbarQuickFilterLabel'),
|
|
91
106
|
type: "search"
|
|
@@ -67,7 +67,8 @@ export const useGridClipboard = (apiRef, props) => {
|
|
|
67
67
|
textToCopy = apiRef.current.getDataAsCsv({
|
|
68
68
|
includeHeaders: false,
|
|
69
69
|
// TODO: make it configurable
|
|
70
|
-
delimiter: clipboardCopyCellDelimiter
|
|
70
|
+
delimiter: clipboardCopyCellDelimiter,
|
|
71
|
+
shouldAppendQuotes: false
|
|
71
72
|
});
|
|
72
73
|
} else {
|
|
73
74
|
const focusedCell = gridFocusCellSelector(apiRef);
|
|
@@ -75,7 +76,8 @@ export const useGridClipboard = (apiRef, props) => {
|
|
|
75
76
|
const cellParams = apiRef.current.getCellParams(focusedCell.id, focusedCell.field);
|
|
76
77
|
textToCopy = serializeCellValue(cellParams, {
|
|
77
78
|
delimiterCharacter: clipboardCopyCellDelimiter,
|
|
78
|
-
ignoreValueFormatter
|
|
79
|
+
ignoreValueFormatter,
|
|
80
|
+
shouldAppendQuotes: false
|
|
79
81
|
});
|
|
80
82
|
}
|
|
81
83
|
}
|
|
@@ -126,7 +126,7 @@ function excludeOutliers(inputValues, factor) {
|
|
|
126
126
|
const iqr = q3 - q1;
|
|
127
127
|
|
|
128
128
|
// We make a small adjustment if `iqr < 5` for the cases where the IQR is
|
|
129
|
-
// very small (
|
|
129
|
+
// very small (for example zero) due to very close by values in the input data.
|
|
130
130
|
// Otherwise, with an IQR of `0`, anything outside that would be considered
|
|
131
131
|
// an outlier, but it makes more sense visually to allow for this 5px variance
|
|
132
132
|
// rather than showing a cropped cell.
|