@mui/x-data-grid 5.8.0 → 5.9.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 +141 -63
- package/DataGrid/DataGrid.js +1 -1
- package/DataGrid/useDataGridComponent.js +3 -1
- package/LICENSE +21 -0
- package/README.md +1 -1
- package/components/GridRow.d.ts +4 -0
- package/components/GridRow.js +49 -23
- package/components/base/GridOverlays.js +4 -3
- package/components/cell/GridActionsCell.d.ts +5 -1
- package/components/cell/GridActionsCell.js +170 -21
- package/components/cell/GridActionsCellItem.d.ts +66 -4
- package/components/cell/GridActionsCellItem.js +7 -5
- package/components/cell/GridCell.d.ts +1 -0
- package/components/cell/GridCell.js +28 -7
- package/components/cell/GridEditInputCell.js +1 -1
- package/components/cell/GridEditSingleSelectCell.js +22 -13
- package/components/columnHeaders/GridColumnHeaderItem.js +4 -7
- package/components/columnHeaders/GridColumnHeaders.d.ts +0 -1
- package/components/columnHeaders/GridColumnHeaders.js +1 -1
- package/components/columnSelection/GridCellCheckboxRenderer.d.ts +3 -3
- package/components/columnSelection/GridCellCheckboxRenderer.js +20 -3
- package/components/panel/GridPanel.js +1 -0
- package/components/panel/filterPanel/GridFilterForm.js +14 -10
- package/components/panel/filterPanel/GridFilterInputBoolean.js +13 -8
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +22 -15
- package/components/panel/filterPanel/GridFilterInputValue.js +22 -15
- package/components/toolbar/GridToolbarDensitySelector.js +1 -1
- package/components/toolbar/GridToolbarFilterButton.d.ts +1 -1
- package/components/virtualization/GridVirtualScroller.js +2 -0
- package/components/virtualization/GridVirtualScrollerContent.js +1 -3
- package/constants/gridDetailPanelToggleField.d.ts +1 -0
- package/constants/gridDetailPanelToggleField.js +2 -0
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +32 -15
- package/hooks/core/pipeProcessing/index.d.ts +1 -0
- package/hooks/core/pipeProcessing/index.js +2 -1
- package/hooks/core/pipeProcessing/useGridPipeProcessing.d.ts +8 -3
- package/hooks/core/pipeProcessing/useGridPipeProcessing.js +53 -19
- package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.d.ts +3 -0
- package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +27 -0
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +0 -3
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +0 -4
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +0 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +76 -10
- package/hooks/features/columns/gridColumnsInterfaces.d.ts +3 -1
- package/hooks/features/columns/gridColumnsUtils.d.ts +19 -1
- package/hooks/features/columns/gridColumnsUtils.js +61 -8
- package/hooks/features/columns/useGridColumnSpanning.d.ts +7 -0
- package/hooks/features/columns/useGridColumnSpanning.js +109 -0
- package/hooks/features/columns/useGridColumns.js +24 -18
- package/hooks/features/dimensions/useGridDimensions.js +3 -3
- package/hooks/features/editRows/useGridCellEditing.new.js +18 -10
- package/hooks/features/editRows/useGridEditing.new.js +7 -3
- package/hooks/features/editRows/useGridRowEditing.new.js +23 -15
- package/hooks/features/filter/useGridFilter.js +14 -9
- package/hooks/features/focus/useGridFocus.js +19 -9
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -0
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +39 -7
- package/hooks/features/rows/gridRowsSelector.d.ts +1 -0
- package/hooks/features/rows/gridRowsSelector.js +1 -0
- package/hooks/features/rows/gridRowsState.d.ts +4 -0
- package/hooks/features/rows/useGridRows.d.ts +2 -2
- package/hooks/features/rows/useGridRows.js +5 -4
- package/hooks/features/rows/useGridRowsMeta.js +6 -13
- package/hooks/features/scroll/useGridScroll.d.ts +2 -0
- package/hooks/features/scroll/useGridScroll.js +25 -3
- package/hooks/features/selection/useGridSelection.js +3 -2
- package/hooks/features/sorting/useGridSorting.js +10 -10
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +7 -0
- package/hooks/features/virtualization/useGridVirtualScroller.js +54 -27
- package/index.js +1 -1
- package/internals/index.d.ts +1 -0
- package/internals/index.js +1 -0
- package/legacy/DataGrid/DataGrid.js +1 -1
- package/legacy/DataGrid/useDataGridComponent.js +3 -1
- package/legacy/components/GridRow.js +47 -23
- package/legacy/components/base/GridOverlays.js +4 -3
- package/legacy/components/cell/GridActionsCell.js +188 -27
- package/legacy/components/cell/GridActionsCellItem.js +7 -5
- package/legacy/components/cell/GridCell.js +29 -7
- package/legacy/components/cell/GridEditInputCell.js +1 -1
- package/legacy/components/cell/GridEditSingleSelectCell.js +33 -24
- package/legacy/components/columnHeaders/GridColumnHeaderItem.js +4 -7
- package/legacy/components/columnHeaders/GridColumnHeaders.js +2 -3
- package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +21 -3
- package/legacy/components/panel/GridPanel.js +1 -0
- package/legacy/components/panel/filterPanel/GridFilterForm.js +14 -10
- package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +13 -8
- package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +22 -17
- package/legacy/components/panel/filterPanel/GridFilterInputValue.js +22 -17
- package/legacy/components/toolbar/GridToolbarDensitySelector.js +1 -1
- package/legacy/components/virtualization/GridVirtualScroller.js +2 -0
- package/legacy/components/virtualization/GridVirtualScrollerContent.js +1 -3
- package/legacy/constants/gridDetailPanelToggleField.js +2 -0
- package/legacy/hooks/core/pipeProcessing/index.js +2 -1
- package/legacy/hooks/core/pipeProcessing/useGridPipeProcessing.js +60 -24
- package/legacy/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +27 -0
- package/legacy/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +0 -4
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +89 -10
- package/legacy/hooks/features/columns/gridColumnsUtils.js +79 -22
- package/legacy/hooks/features/columns/useGridColumnSpanning.js +107 -0
- package/legacy/hooks/features/columns/useGridColumns.js +24 -18
- package/legacy/hooks/features/dimensions/useGridDimensions.js +3 -3
- package/legacy/hooks/features/editRows/useGridCellEditing.new.js +14 -8
- package/legacy/hooks/features/editRows/useGridEditing.new.js +7 -3
- package/legacy/hooks/features/editRows/useGridRowEditing.new.js +32 -24
- package/legacy/hooks/features/filter/useGridFilter.js +14 -9
- package/legacy/hooks/features/focus/useGridFocus.js +19 -9
- package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +39 -6
- package/legacy/hooks/features/rows/gridRowsSelector.js +3 -0
- package/legacy/hooks/features/rows/useGridRows.js +5 -4
- package/legacy/hooks/features/rows/useGridRowsMeta.js +6 -13
- package/legacy/hooks/features/scroll/useGridScroll.js +25 -3
- package/legacy/hooks/features/selection/useGridSelection.js +3 -2
- package/legacy/hooks/features/sorting/useGridSorting.js +5 -7
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +65 -37
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +1 -0
- package/legacy/locales/huHU.js +120 -0
- package/legacy/locales/index.js +1 -0
- package/legacy/models/api/gridColumnSpanning.js +1 -0
- package/legacy/models/events/gridEvents.js +2 -3
- package/legacy/models/gridColumnSpanning.js +1 -0
- package/locales/huHU.d.ts +2 -0
- package/locales/huHU.js +108 -0
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/models/api/gridApiCommon.d.ts +2 -1
- package/models/api/gridColumnSpanning.d.ts +28 -0
- package/models/api/gridColumnSpanning.js +1 -0
- package/models/api/gridEditingApi.d.ts +49 -3
- package/models/colDef/gridColDef.d.ts +5 -0
- package/models/events/gridEventLookup.d.ts +3 -8
- package/models/events/gridEvents.d.ts +9 -14
- package/models/events/gridEvents.js +2 -3
- package/models/gridColumnSpanning.d.ts +12 -0
- package/models/gridColumnSpanning.js +1 -0
- package/models/gridEditRowModel.d.ts +1 -1
- package/models/params/gridCellParams.d.ts +12 -2
- package/models/params/gridRowParams.d.ts +5 -0
- package/models/props/DataGridProps.d.ts +1 -1
- package/modern/DataGrid/DataGrid.js +1 -1
- package/modern/DataGrid/useDataGridComponent.js +3 -1
- package/modern/components/GridRow.js +47 -21
- package/modern/components/base/GridOverlays.js +4 -3
- package/modern/components/cell/GridActionsCell.js +168 -21
- package/modern/components/cell/GridActionsCellItem.js +7 -5
- package/modern/components/cell/GridCell.js +28 -7
- package/modern/components/cell/GridEditInputCell.js +1 -1
- package/modern/components/cell/GridEditSingleSelectCell.js +20 -11
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +4 -7
- package/modern/components/columnHeaders/GridColumnHeaders.js +1 -1
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +20 -3
- package/modern/components/panel/GridPanel.js +1 -0
- package/modern/components/panel/filterPanel/GridFilterForm.js +10 -6
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +11 -6
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +20 -13
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +20 -13
- package/modern/components/toolbar/GridToolbarDensitySelector.js +1 -1
- package/modern/components/virtualization/GridVirtualScroller.js +2 -0
- package/modern/components/virtualization/GridVirtualScrollerContent.js +1 -3
- package/modern/constants/gridDetailPanelToggleField.js +2 -0
- package/modern/hooks/core/pipeProcessing/index.js +2 -1
- package/modern/hooks/core/pipeProcessing/useGridPipeProcessing.js +53 -19
- package/modern/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +27 -0
- package/modern/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +0 -4
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +76 -10
- package/modern/hooks/features/columns/gridColumnsUtils.js +61 -8
- package/modern/hooks/features/columns/useGridColumnSpanning.js +107 -0
- package/modern/hooks/features/columns/useGridColumns.js +24 -18
- package/modern/hooks/features/dimensions/useGridDimensions.js +3 -3
- package/modern/hooks/features/editRows/useGridCellEditing.new.js +18 -10
- package/modern/hooks/features/editRows/useGridEditing.new.js +7 -3
- package/modern/hooks/features/editRows/useGridRowEditing.new.js +23 -15
- package/modern/hooks/features/filter/useGridFilter.js +14 -9
- package/modern/hooks/features/focus/useGridFocus.js +19 -9
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +37 -7
- package/modern/hooks/features/rows/gridRowsSelector.js +1 -0
- package/modern/hooks/features/rows/useGridRows.js +5 -4
- package/modern/hooks/features/rows/useGridRowsMeta.js +6 -13
- package/modern/hooks/features/scroll/useGridScroll.js +23 -3
- package/modern/hooks/features/selection/useGridSelection.js +3 -2
- package/modern/hooks/features/sorting/useGridSorting.js +10 -10
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +54 -23
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -0
- package/modern/locales/huHU.js +108 -0
- package/modern/locales/index.js +1 -0
- package/modern/models/api/gridColumnSpanning.js +1 -0
- package/modern/models/events/gridEvents.js +2 -3
- package/modern/models/gridColumnSpanning.js +1 -0
- package/node/DataGrid/DataGrid.js +1 -1
- package/node/DataGrid/useDataGridComponent.js +4 -1
- package/node/components/GridRow.js +50 -23
- package/node/components/base/GridOverlays.js +3 -2
- package/node/components/cell/GridActionsCell.js +172 -21
- package/node/components/cell/GridActionsCellItem.js +7 -4
- package/node/components/cell/GridCell.js +28 -7
- package/node/components/cell/GridEditInputCell.js +1 -1
- package/node/components/cell/GridEditSingleSelectCell.js +23 -13
- package/node/components/columnHeaders/GridColumnHeaderItem.js +4 -7
- package/node/components/columnHeaders/GridColumnHeaders.js +1 -1
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +20 -3
- package/node/components/panel/GridPanel.js +1 -0
- package/node/components/panel/filterPanel/GridFilterForm.js +15 -10
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +14 -8
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +23 -15
- package/node/components/panel/filterPanel/GridFilterInputValue.js +23 -15
- package/node/components/toolbar/GridToolbarDensitySelector.js +1 -1
- package/node/components/virtualization/GridVirtualScroller.js +2 -0
- package/node/components/virtualization/GridVirtualScrollerContent.js +1 -3
- package/node/constants/gridDetailPanelToggleField.js +9 -0
- package/node/hooks/core/pipeProcessing/index.js +13 -0
- package/node/hooks/core/pipeProcessing/useGridPipeProcessing.js +51 -20
- package/node/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +42 -0
- package/node/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +0 -3
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +80 -10
- package/node/hooks/features/columns/gridColumnsUtils.js +65 -9
- package/node/hooks/features/columns/useGridColumnSpanning.js +130 -0
- package/node/hooks/features/columns/useGridColumns.js +23 -17
- package/node/hooks/features/dimensions/useGridDimensions.js +3 -3
- package/node/hooks/features/editRows/useGridCellEditing.new.js +18 -10
- package/node/hooks/features/editRows/useGridEditing.new.js +6 -2
- package/node/hooks/features/editRows/useGridRowEditing.new.js +21 -14
- package/node/hooks/features/filter/useGridFilter.js +14 -9
- package/node/hooks/features/focus/useGridFocus.js +19 -9
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +40 -7
- package/node/hooks/features/rows/gridRowsSelector.js +3 -1
- package/node/hooks/features/rows/useGridRows.js +5 -4
- package/node/hooks/features/rows/useGridRowsMeta.js +6 -14
- package/node/hooks/features/scroll/useGridScroll.js +26 -2
- package/node/hooks/features/selection/useGridSelection.js +4 -2
- package/node/hooks/features/sorting/useGridSorting.js +10 -10
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +59 -27
- package/node/index.js +1 -1
- package/node/internals/index.js +8 -0
- package/node/locales/huHU.js +118 -0
- package/node/locales/index.js +13 -0
- package/node/models/api/gridColumnSpanning.js +5 -0
- package/node/models/events/gridEvents.js +2 -3
- package/node/models/gridColumnSpanning.js +5 -0
- package/package.json +4 -4
- package/utils/domUtils.d.ts +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["field", "id", "value", "formattedValue", "row", "rowNode", "colDef", "isEditable", "cellMode", "hasFocus", "tabIndex", "getValue"];
|
|
3
|
+
var _excluded = ["field", "id", "value", "formattedValue", "row", "rowNode", "colDef", "isEditable", "cellMode", "hasFocus", "tabIndex", "getValue", "api"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
@@ -35,6 +35,7 @@ var GridCellCheckboxForwardRef = /*#__PURE__*/React.forwardRef(function GridCell
|
|
|
35
35
|
hasFocus = props.hasFocus,
|
|
36
36
|
tabIndex = props.tabIndex,
|
|
37
37
|
getValue = props.getValue,
|
|
38
|
+
api = props.api,
|
|
38
39
|
other = _objectWithoutProperties(props, _excluded);
|
|
39
40
|
|
|
40
41
|
var apiRef = useGridApiContext();
|
|
@@ -104,6 +105,12 @@ process.env.NODE_ENV !== "production" ? GridCellCheckboxForwardRef.propTypes = {
|
|
|
104
105
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
105
106
|
// ----------------------------------------------------------------------
|
|
106
107
|
|
|
108
|
+
/**
|
|
109
|
+
* GridApi that let you manipulate the grid.
|
|
110
|
+
* @deprecated Use the `apiRef` returned by `useGridApiContext` or `useGridApiRef` (only available in `@mui/x-data-grid-pro`)
|
|
111
|
+
*/
|
|
112
|
+
api: PropTypes.any.isRequired,
|
|
113
|
+
|
|
107
114
|
/**
|
|
108
115
|
* The mode of the cell.
|
|
109
116
|
*/
|
|
@@ -119,10 +126,21 @@ process.env.NODE_ENV !== "production" ? GridCellCheckboxForwardRef.propTypes = {
|
|
|
119
126
|
*/
|
|
120
127
|
field: PropTypes.string.isRequired,
|
|
121
128
|
|
|
129
|
+
/**
|
|
130
|
+
* A ref allowing to set imperative focus.
|
|
131
|
+
* It can be passed to the element that should receive focus.
|
|
132
|
+
* @ignore - do not document.
|
|
133
|
+
*/
|
|
134
|
+
focusElementRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
135
|
+
current: PropTypes.shape({
|
|
136
|
+
focus: PropTypes.func.isRequired
|
|
137
|
+
})
|
|
138
|
+
})]),
|
|
139
|
+
|
|
122
140
|
/**
|
|
123
141
|
* The cell value formatted with the column valueFormatter.
|
|
124
142
|
*/
|
|
125
|
-
formattedValue: PropTypes.any
|
|
143
|
+
formattedValue: PropTypes.any,
|
|
126
144
|
|
|
127
145
|
/**
|
|
128
146
|
* Get the cell value of a row and field.
|
|
@@ -166,7 +184,7 @@ process.env.NODE_ENV !== "production" ? GridCellCheckboxForwardRef.propTypes = {
|
|
|
166
184
|
/**
|
|
167
185
|
* The cell value, but if the column has valueGetter, use getValue.
|
|
168
186
|
*/
|
|
169
|
-
value: PropTypes.any
|
|
187
|
+
value: PropTypes.any
|
|
170
188
|
} : void 0;
|
|
171
189
|
export { GridCellCheckboxForwardRef };
|
|
172
190
|
export var GridCellCheckboxRenderer = /*#__PURE__*/React.memo(GridCellCheckboxForwardRef);
|
|
@@ -97,6 +97,7 @@ var GridPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
97
97
|
modifiers: modifiers
|
|
98
98
|
}, other, {
|
|
99
99
|
children: /*#__PURE__*/_jsx(ClickAwayListener, {
|
|
100
|
+
mouseEvent: "onMouseUp",
|
|
100
101
|
onClickAway: handleClickAway,
|
|
101
102
|
children: /*#__PURE__*/_jsx(GridPaperRoot, {
|
|
102
103
|
className: classes.paper,
|
|
@@ -3,6 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
5
5
|
import IconButton from '@mui/material/IconButton';
|
|
6
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
6
7
|
import InputLabel from '@mui/material/InputLabel';
|
|
7
8
|
import FormControl from '@mui/material/FormControl';
|
|
8
9
|
import { capitalize, unstable_useId as useId } from '@mui/material/utils';
|
|
@@ -117,7 +118,7 @@ var getColumnLabel = function getColumnLabel(col) {
|
|
|
117
118
|
var collator = new Intl.Collator();
|
|
118
119
|
|
|
119
120
|
function GridFilterForm(props) {
|
|
120
|
-
var _rootProps$components, _rootProps$components2, _rootProps$components3, _rootProps$components4, _currentColumn$filter2;
|
|
121
|
+
var _rootProps$components, _rootProps$components2, _baseSelectProps$nati, _rootProps$components3, _rootProps$components4, _rootProps$components5, _currentColumn$filter2;
|
|
121
122
|
|
|
122
123
|
var item = props.item,
|
|
123
124
|
hasMultipleFilters = props.hasMultipleFilters,
|
|
@@ -156,6 +157,9 @@ function GridFilterForm(props) {
|
|
|
156
157
|
var filterSelectorRef = React.useRef(null);
|
|
157
158
|
var hasLinkOperatorColumn = hasMultipleFilters && linkOperators.length > 0;
|
|
158
159
|
var baseFormControlProps = ((_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseFormControl) || {};
|
|
160
|
+
var baseSelectProps = ((_rootProps$components2 = rootProps.componentsProps) == null ? void 0 : _rootProps$components2.baseSelect) || {};
|
|
161
|
+
var isBaseSelectNative = (_baseSelectProps$nati = baseSelectProps.native) != null ? _baseSelectProps$nati : true;
|
|
162
|
+
var OptionComponent = isBaseSelectNative ? 'option' : MenuItem;
|
|
159
163
|
var sortedFilterableColumns = React.useMemo(function () {
|
|
160
164
|
switch (columnsSort) {
|
|
161
165
|
case 'asc':
|
|
@@ -281,10 +285,10 @@ function GridFilterForm(props) {
|
|
|
281
285
|
value: multiFilterOperator,
|
|
282
286
|
onChange: changeLinkOperator,
|
|
283
287
|
disabled: !!disableMultiFilterOperator || linkOperators.length === 1,
|
|
284
|
-
native:
|
|
285
|
-
}, (_rootProps$
|
|
288
|
+
native: isBaseSelectNative
|
|
289
|
+
}, (_rootProps$components3 = rootProps.componentsProps) == null ? void 0 : _rootProps$components3.baseSelect, {
|
|
286
290
|
children: linkOperators.map(function (linkOperator) {
|
|
287
|
-
return /*#__PURE__*/_jsx(
|
|
291
|
+
return /*#__PURE__*/_jsx(OptionComponent, {
|
|
288
292
|
value: linkOperator.toString(),
|
|
289
293
|
children: apiRef.current.getLocaleText(getLinkOperatorLocaleKey(linkOperator))
|
|
290
294
|
}, linkOperator.toString());
|
|
@@ -305,10 +309,10 @@ function GridFilterForm(props) {
|
|
|
305
309
|
label: apiRef.current.getLocaleText('filterPanelColumns'),
|
|
306
310
|
value: item.columnField || '',
|
|
307
311
|
onChange: changeColumn,
|
|
308
|
-
native:
|
|
309
|
-
}, (_rootProps$
|
|
312
|
+
native: isBaseSelectNative
|
|
313
|
+
}, (_rootProps$components4 = rootProps.componentsProps) == null ? void 0 : _rootProps$components4.baseSelect, {
|
|
310
314
|
children: sortedFilterableColumns.map(function (col) {
|
|
311
|
-
return /*#__PURE__*/_jsx(
|
|
315
|
+
return /*#__PURE__*/_jsx(OptionComponent, {
|
|
312
316
|
value: col.field,
|
|
313
317
|
children: getColumnLabel(col)
|
|
314
318
|
}, col.field);
|
|
@@ -329,11 +333,11 @@ function GridFilterForm(props) {
|
|
|
329
333
|
id: operatorSelectId,
|
|
330
334
|
value: item.operatorValue,
|
|
331
335
|
onChange: changeOperator,
|
|
332
|
-
native:
|
|
336
|
+
native: isBaseSelectNative,
|
|
333
337
|
inputRef: filterSelectorRef
|
|
334
|
-
}, (_rootProps$
|
|
338
|
+
}, (_rootProps$components5 = rootProps.componentsProps) == null ? void 0 : _rootProps$components5.baseSelect, {
|
|
335
339
|
children: currentColumn == null ? void 0 : (_currentColumn$filter2 = currentColumn.filterOperators) == null ? void 0 : _currentColumn$filter2.map(function (operator) {
|
|
336
|
-
return /*#__PURE__*/_jsx(
|
|
340
|
+
return /*#__PURE__*/_jsx(OptionComponent, {
|
|
337
341
|
value: operator.value,
|
|
338
342
|
children: operator.label || apiRef.current.getLocaleText("filterOperator".concat(capitalize(operator.value)))
|
|
339
343
|
}, operator.value);
|
|
@@ -3,11 +3,12 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
4
|
var _excluded = ["item", "applyValue", "apiRef", "focusElementRef"];
|
|
5
5
|
import * as React from 'react';
|
|
6
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
6
7
|
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
10
|
export function GridFilterInputBoolean(props) {
|
|
10
|
-
var _rootProps$components;
|
|
11
|
+
var _rootProps$components, _baseSelectProps$nati, _rootProps$components2, _rootProps$components3;
|
|
11
12
|
|
|
12
13
|
var item = props.item,
|
|
13
14
|
applyValue = props.applyValue,
|
|
@@ -21,6 +22,9 @@ export function GridFilterInputBoolean(props) {
|
|
|
21
22
|
setFilterValueState = _React$useState2[1];
|
|
22
23
|
|
|
23
24
|
var rootProps = useGridRootProps();
|
|
25
|
+
var baseSelectProps = ((_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseSelect) || {};
|
|
26
|
+
var isSelectNative = (_baseSelectProps$nati = baseSelectProps.native) != null ? _baseSelectProps$nati : true;
|
|
27
|
+
var OptionComponent = isSelectNative ? 'option' : MenuItem;
|
|
24
28
|
var onFilterChange = React.useCallback(function (event) {
|
|
25
29
|
var value = event.target.value;
|
|
26
30
|
setFilterValueState(value);
|
|
@@ -37,21 +41,22 @@ export function GridFilterInputBoolean(props) {
|
|
|
37
41
|
onChange: onFilterChange,
|
|
38
42
|
variant: "standard",
|
|
39
43
|
select: true,
|
|
40
|
-
SelectProps: {
|
|
41
|
-
native:
|
|
42
|
-
|
|
44
|
+
SelectProps: _extends({
|
|
45
|
+
native: isSelectNative,
|
|
46
|
+
displayEmpty: true
|
|
47
|
+
}, (_rootProps$components2 = rootProps.componentsProps) == null ? void 0 : _rootProps$components2.baseSelect),
|
|
43
48
|
InputLabelProps: {
|
|
44
49
|
shrink: true
|
|
45
50
|
},
|
|
46
51
|
inputRef: focusElementRef
|
|
47
|
-
}, others, (_rootProps$
|
|
48
|
-
children: [/*#__PURE__*/_jsx(
|
|
52
|
+
}, others, (_rootProps$components3 = rootProps.componentsProps) == null ? void 0 : _rootProps$components3.baseTextField, {
|
|
53
|
+
children: [/*#__PURE__*/_jsx(OptionComponent, {
|
|
49
54
|
value: "",
|
|
50
55
|
children: apiRef.current.getLocaleText('filterValueAny')
|
|
51
|
-
}), /*#__PURE__*/_jsx(
|
|
56
|
+
}), /*#__PURE__*/_jsx(OptionComponent, {
|
|
52
57
|
value: "true",
|
|
53
58
|
children: apiRef.current.getLocaleText('filterValueTrue')
|
|
54
|
-
}), /*#__PURE__*/_jsx(
|
|
59
|
+
}), /*#__PURE__*/_jsx(OptionComponent, {
|
|
55
60
|
value: "false",
|
|
56
61
|
children: apiRef.current.getLocaleText('filterValueFalse')
|
|
57
62
|
})]
|
|
@@ -7,11 +7,12 @@ var _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef"];
|
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import { unstable_useId as useId } from '@mui/material/utils';
|
|
10
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
10
11
|
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
11
12
|
import { getValueFromValueOptions } from './filterPanelUtils';
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
14
|
|
|
14
|
-
var renderSingleSelectOptions = function renderSingleSelectOptions(_ref, api) {
|
|
15
|
+
var renderSingleSelectOptions = function renderSingleSelectOptions(_ref, api, OptionComponent) {
|
|
15
16
|
var valueOptions = _ref.valueOptions,
|
|
16
17
|
valueFormatter = _ref.valueFormatter,
|
|
17
18
|
field = _ref.field;
|
|
@@ -19,22 +20,24 @@ var renderSingleSelectOptions = function renderSingleSelectOptions(_ref, api) {
|
|
|
19
20
|
field: field
|
|
20
21
|
}))) : [''].concat(_toConsumableArray(valueOptions || []));
|
|
21
22
|
return iterableColumnValues.map(function (option) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
var isOptionTypeObject = _typeof(option) === 'object';
|
|
24
|
+
var key = isOptionTypeObject ? option.value : option;
|
|
25
|
+
var value = isOptionTypeObject ? option.value : option;
|
|
26
|
+
var formattedValue = valueFormatter && option !== '' ? valueFormatter({
|
|
26
27
|
value: option,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
field: field,
|
|
29
|
+
api: api
|
|
30
|
+
}) : option;
|
|
31
|
+
var content = isOptionTypeObject ? option.label : formattedValue;
|
|
32
|
+
return /*#__PURE__*/_jsx(OptionComponent, {
|
|
33
|
+
value: value,
|
|
34
|
+
children: content
|
|
35
|
+
}, key);
|
|
33
36
|
});
|
|
34
37
|
};
|
|
35
38
|
|
|
36
39
|
function GridFilterInputSingleSelect(props) {
|
|
37
|
-
var _item$value, _rootProps$components;
|
|
40
|
+
var _item$value, _rootProps$components, _baseSelectProps$nati, _rootProps$components2, _rootProps$components3;
|
|
38
41
|
|
|
39
42
|
var item = props.item,
|
|
40
43
|
applyValue = props.applyValue,
|
|
@@ -50,6 +53,8 @@ function GridFilterInputSingleSelect(props) {
|
|
|
50
53
|
|
|
51
54
|
var id = useId();
|
|
52
55
|
var rootProps = useGridRootProps();
|
|
56
|
+
var baseSelectProps = ((_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseSelect) || {};
|
|
57
|
+
var isSelectNative = (_baseSelectProps$nati = baseSelectProps.native) != null ? _baseSelectProps$nati : true;
|
|
53
58
|
var currentColumn = item.columnField ? apiRef.current.getColumn(item.columnField) : null;
|
|
54
59
|
var currentValueOptions = React.useMemo(function () {
|
|
55
60
|
return typeof currentColumn.valueOptions === 'function' ? currentColumn.valueOptions({
|
|
@@ -100,11 +105,11 @@ function GridFilterInputSingleSelect(props) {
|
|
|
100
105
|
},
|
|
101
106
|
inputRef: focusElementRef,
|
|
102
107
|
select: true,
|
|
103
|
-
SelectProps: {
|
|
104
|
-
native:
|
|
105
|
-
}
|
|
106
|
-
}, others, (_rootProps$
|
|
107
|
-
children: renderSingleSelectOptions(apiRef.current.getColumn(item.columnField), apiRef.current)
|
|
108
|
+
SelectProps: _extends({
|
|
109
|
+
native: isSelectNative
|
|
110
|
+
}, (_rootProps$components2 = rootProps.componentsProps) == null ? void 0 : _rootProps$components2.baseSelect)
|
|
111
|
+
}, others, (_rootProps$components3 = rootProps.componentsProps) == null ? void 0 : _rootProps$components3.baseTextField, {
|
|
112
|
+
children: renderSingleSelectOptions(apiRef.current.getColumn(item.columnField), apiRef.current, isSelectNative ? 'option' : MenuItem)
|
|
108
113
|
}));
|
|
109
114
|
}
|
|
110
115
|
|
|
@@ -7,6 +7,7 @@ var _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef"];
|
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import { unstable_useId as useId } from '@mui/material/utils';
|
|
10
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
10
11
|
import { GridLoadIcon } from '../../icons';
|
|
11
12
|
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
12
13
|
import { getValueFromValueOptions } from './filterPanelUtils';
|
|
@@ -18,7 +19,7 @@ function warnDeprecatedTypeSupport(type) {
|
|
|
18
19
|
warnedOnce[type] = true;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
var renderSingleSelectOptions = function renderSingleSelectOptions(_ref, api) {
|
|
22
|
+
var renderSingleSelectOptions = function renderSingleSelectOptions(_ref, api, OptionComponent) {
|
|
22
23
|
var valueOptions = _ref.valueOptions,
|
|
23
24
|
valueFormatter = _ref.valueFormatter,
|
|
24
25
|
field = _ref.field;
|
|
@@ -26,24 +27,26 @@ var renderSingleSelectOptions = function renderSingleSelectOptions(_ref, api) {
|
|
|
26
27
|
field: field
|
|
27
28
|
}))) : [''].concat(_toConsumableArray(valueOptions || []));
|
|
28
29
|
return iterableColumnValues.map(function (option) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
var isOptionTypeObject = _typeof(option) === 'object';
|
|
31
|
+
var key = isOptionTypeObject ? option.value : option;
|
|
32
|
+
var value = isOptionTypeObject ? option.value : option;
|
|
33
|
+
var formattedValue = valueFormatter && option !== '' ? valueFormatter({
|
|
33
34
|
value: option,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
field: field,
|
|
36
|
+
api: api
|
|
37
|
+
}) : option;
|
|
38
|
+
var content = isOptionTypeObject ? option.label : formattedValue;
|
|
39
|
+
return /*#__PURE__*/_jsx(OptionComponent, {
|
|
40
|
+
value: value,
|
|
41
|
+
children: content
|
|
42
|
+
}, key);
|
|
40
43
|
});
|
|
41
44
|
};
|
|
42
45
|
|
|
43
46
|
export var SUBMIT_FILTER_STROKE_TIME = 500;
|
|
44
47
|
|
|
45
48
|
function GridFilterInputValue(props) {
|
|
46
|
-
var _item$value, _rootProps$components;
|
|
49
|
+
var _item$value, _rootProps$components, _baseSelectProps$nati, _rootProps$components2, _rootProps$components3;
|
|
47
50
|
|
|
48
51
|
var item = props.item,
|
|
49
52
|
applyValue = props.applyValue,
|
|
@@ -70,12 +73,14 @@ function GridFilterInputValue(props) {
|
|
|
70
73
|
|
|
71
74
|
var id = useId();
|
|
72
75
|
var rootProps = useGridRootProps();
|
|
76
|
+
var baseSelectProps = ((_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseSelect) || {};
|
|
77
|
+
var isSelectNative = (_baseSelectProps$nati = baseSelectProps.native) != null ? _baseSelectProps$nati : true;
|
|
73
78
|
var singleSelectProps = type === 'singleSelect' ? {
|
|
74
79
|
select: true,
|
|
75
|
-
SelectProps: {
|
|
76
|
-
native:
|
|
77
|
-
},
|
|
78
|
-
children: renderSingleSelectOptions(apiRef.current.getColumn(item.columnField), apiRef.current)
|
|
80
|
+
SelectProps: _extends({
|
|
81
|
+
native: isSelectNative
|
|
82
|
+
}, (_rootProps$components2 = rootProps.componentsProps) == null ? void 0 : _rootProps$components2.baseSelect),
|
|
83
|
+
children: renderSingleSelectOptions(apiRef.current.getColumn(item.columnField), apiRef.current, isSelectNative ? 'option' : MenuItem)
|
|
79
84
|
} : {};
|
|
80
85
|
var onFilterChange = React.useCallback(function (event) {
|
|
81
86
|
var value = event.target.value; // NativeSelect casts the value to a string.
|
|
@@ -126,7 +131,7 @@ function GridFilterInputValue(props) {
|
|
|
126
131
|
shrink: true
|
|
127
132
|
},
|
|
128
133
|
inputRef: focusElementRef
|
|
129
|
-
}, singleSelectProps, others, (_rootProps$
|
|
134
|
+
}, singleSelectProps, others, (_rootProps$components3 = rootProps.componentsProps) == null ? void 0 : _rootProps$components3.baseTextField));
|
|
130
135
|
}
|
|
131
136
|
|
|
132
137
|
process.env.NODE_ENV !== "production" ? GridFilterInputValue.propTypes = {
|
|
@@ -111,7 +111,7 @@ export var GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function G
|
|
|
111
111
|
"aria-label": apiRef.current.getLocaleText('toolbarDensityLabel'),
|
|
112
112
|
"aria-expanded": open ? 'true' : undefined,
|
|
113
113
|
"aria-haspopup": "menu",
|
|
114
|
-
"aria-
|
|
114
|
+
"aria-controls": densityMenuId,
|
|
115
115
|
id: densityButtonId
|
|
116
116
|
}, other, {
|
|
117
117
|
onClick: handleDensitySelectorOpen
|
|
@@ -24,9 +24,7 @@ var VirtualScrollerContentRoot = styled('div', {
|
|
|
24
24
|
overridesResolver: function overridesResolver(props, styles) {
|
|
25
25
|
return styles.virtualScrollerContent;
|
|
26
26
|
}
|
|
27
|
-
})({
|
|
28
|
-
position: 'relative'
|
|
29
|
-
});
|
|
27
|
+
})({});
|
|
30
28
|
var GridVirtualScrollerContent = /*#__PURE__*/React.forwardRef(function GridVirtualScrollerContent(props, ref) {
|
|
31
29
|
var className = props.className,
|
|
32
30
|
style = props.style,
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
import _toPropertyKey from "@babel/runtime/helpers/esm/toPropertyKey";
|
|
4
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
5
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
6
4
|
import * as React from 'react';
|
|
7
5
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
8
|
-
|
|
6
|
+
|
|
9
7
|
/**
|
|
10
8
|
* Implement the Pipeline Pattern
|
|
11
9
|
*
|
|
@@ -19,7 +17,10 @@ import { GridEvents } from '../../../models/events';
|
|
|
19
17
|
* The plugin containing the custom logic must use:
|
|
20
18
|
*
|
|
21
19
|
* - `useGridRegisterPipeProcessor` to register their processor.
|
|
22
|
-
*
|
|
20
|
+
*
|
|
21
|
+
* - `apiRef.current.unstable_requestPipeProcessorsApplication` to imperatively re-apply a group.
|
|
22
|
+
* This method should be used in last resort.
|
|
23
|
+
* Most of the time, the application should be triggered by an update on the deps of the processor.
|
|
23
24
|
*
|
|
24
25
|
* =====================================================================================================================
|
|
25
26
|
*
|
|
@@ -27,56 +28,91 @@ import { GridEvents } from '../../../models/events';
|
|
|
27
28
|
*
|
|
28
29
|
* - `apiRef.current.unstable_applyPipeProcessors` to run in chain all the processors of a given group.
|
|
29
30
|
*
|
|
30
|
-
* - `
|
|
31
|
-
*
|
|
31
|
+
* - `useGridRegisterPipeApplier` to re-apply the whole pipe when requested.
|
|
32
|
+
* The applier will be called when:
|
|
33
|
+
* * a processor is registered.
|
|
34
|
+
* * `apiRef.current.unstable_requestPipeProcessorsApplication` is called for the given group.
|
|
32
35
|
*/
|
|
33
|
-
|
|
34
36
|
export var useGridPipeProcessing = function useGridPipeProcessing(apiRef) {
|
|
35
37
|
var processorsCache = React.useRef({});
|
|
38
|
+
var runAppliers = React.useCallback(function (groupCache) {
|
|
39
|
+
if (!groupCache) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
Object.values(groupCache.appliers).forEach(function (callback) {
|
|
44
|
+
callback();
|
|
45
|
+
});
|
|
46
|
+
}, []);
|
|
36
47
|
var registerPipeProcessor = React.useCallback(function (group, id, processor) {
|
|
37
48
|
if (!processorsCache.current[group]) {
|
|
38
|
-
processorsCache.current[group] = {
|
|
49
|
+
processorsCache.current[group] = {
|
|
50
|
+
processors: {},
|
|
51
|
+
appliers: {}
|
|
52
|
+
};
|
|
39
53
|
}
|
|
40
54
|
|
|
41
|
-
var
|
|
42
|
-
var oldProcessor =
|
|
55
|
+
var groupCache = processorsCache.current[group];
|
|
56
|
+
var oldProcessor = groupCache.processors[id];
|
|
43
57
|
|
|
44
58
|
if (oldProcessor !== processor) {
|
|
45
|
-
|
|
46
|
-
|
|
59
|
+
groupCache.processors[id] = processor;
|
|
60
|
+
runAppliers(groupCache);
|
|
47
61
|
}
|
|
48
62
|
|
|
49
63
|
return function () {
|
|
50
|
-
var
|
|
51
|
-
removedGroupProcessor =
|
|
52
|
-
otherProcessors = _objectWithoutProperties(
|
|
64
|
+
var _processors = processorsCache.current[group].processors,
|
|
65
|
+
removedGroupProcessor = _processors[id],
|
|
66
|
+
otherProcessors = _objectWithoutProperties(_processors, [id].map(_toPropertyKey));
|
|
53
67
|
|
|
54
|
-
processorsCache.current[group] = otherProcessors;
|
|
55
|
-
apiRef.current.publishEvent(GridEvents.pipeProcessorUnregister, group);
|
|
68
|
+
processorsCache.current[group].processors = otherProcessors;
|
|
56
69
|
};
|
|
57
|
-
}, [
|
|
70
|
+
}, [runAppliers]);
|
|
71
|
+
var registerPipeApplier = React.useCallback(function (group, id, applier) {
|
|
72
|
+
if (!processorsCache.current[group]) {
|
|
73
|
+
processorsCache.current[group] = {
|
|
74
|
+
processors: {},
|
|
75
|
+
appliers: {}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
processorsCache.current[group].appliers[id] = applier;
|
|
80
|
+
return function () {
|
|
81
|
+
var _appliers = processorsCache.current[group].appliers,
|
|
82
|
+
removedGroupApplier = _appliers[id],
|
|
83
|
+
otherAppliers = _objectWithoutProperties(_appliers, [id].map(_toPropertyKey));
|
|
84
|
+
|
|
85
|
+
processorsCache.current[group].appliers = otherAppliers;
|
|
86
|
+
};
|
|
87
|
+
}, []);
|
|
88
|
+
var requestPipeProcessorsApplication = React.useCallback(function (group) {
|
|
89
|
+
var groupCache = processorsCache.current[group];
|
|
90
|
+
runAppliers(groupCache);
|
|
91
|
+
}, [runAppliers]);
|
|
58
92
|
var applyPipeProcessors = React.useCallback(function () {
|
|
59
93
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
60
94
|
args[_key] = arguments[_key];
|
|
61
95
|
}
|
|
62
96
|
|
|
63
|
-
var
|
|
64
|
-
|
|
65
|
-
group =
|
|
66
|
-
value =
|
|
67
|
-
context =
|
|
97
|
+
var _ref = args,
|
|
98
|
+
_ref2 = _slicedToArray(_ref, 3),
|
|
99
|
+
group = _ref2[0],
|
|
100
|
+
value = _ref2[1],
|
|
101
|
+
context = _ref2[2];
|
|
68
102
|
|
|
69
103
|
if (!processorsCache.current[group]) {
|
|
70
104
|
return value;
|
|
71
105
|
}
|
|
72
106
|
|
|
73
|
-
var preProcessors = Object.values(processorsCache.current[group]);
|
|
107
|
+
var preProcessors = Object.values(processorsCache.current[group].processors);
|
|
74
108
|
return preProcessors.reduce(function (acc, preProcessor) {
|
|
75
109
|
return preProcessor(acc, context);
|
|
76
110
|
}, value);
|
|
77
111
|
}, []);
|
|
78
112
|
var preProcessingApi = {
|
|
79
113
|
unstable_registerPipeProcessor: registerPipeProcessor,
|
|
114
|
+
unstable_registerPipeApplier: registerPipeApplier,
|
|
115
|
+
unstable_requestPipeProcessorsApplication: requestPipeProcessorsApplication,
|
|
80
116
|
unstable_applyPipeProcessors: applyPipeProcessors
|
|
81
117
|
};
|
|
82
118
|
useGridApiMethod(apiRef, preProcessingApi, 'GridPipeProcessingApi');
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useFirstRender } from '../../utils/useFirstRender';
|
|
3
|
+
export var useGridRegisterPipeApplier = function useGridRegisterPipeApplier(apiRef, group, callback) {
|
|
4
|
+
var cleanup = React.useRef();
|
|
5
|
+
var id = React.useRef("mui-".concat(Math.round(Math.random() * 1e9)));
|
|
6
|
+
var registerPreProcessor = React.useCallback(function () {
|
|
7
|
+
cleanup.current = apiRef.current.unstable_registerPipeApplier(group, id.current, callback);
|
|
8
|
+
}, [apiRef, callback, group]);
|
|
9
|
+
useFirstRender(function () {
|
|
10
|
+
registerPreProcessor();
|
|
11
|
+
});
|
|
12
|
+
var isFirstRender = React.useRef(true);
|
|
13
|
+
React.useEffect(function () {
|
|
14
|
+
if (isFirstRender.current) {
|
|
15
|
+
isFirstRender.current = false;
|
|
16
|
+
} else {
|
|
17
|
+
registerPreProcessor();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return function () {
|
|
21
|
+
if (cleanup.current) {
|
|
22
|
+
cleanup.current();
|
|
23
|
+
cleanup.current = null;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}, [registerPreProcessor]);
|
|
27
|
+
};
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useFirstRender } from '../../utils/useFirstRender';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* TODO: Rename `useGridRegisterPipeProcessor`
|
|
6
|
-
*/
|
|
7
3
|
export var useGridRegisterPipeProcessor = function useGridRegisterPipeProcessor(apiRef, group, callback) {
|
|
8
4
|
var cleanup = React.useRef();
|
|
9
5
|
var id = React.useRef("mui-".concat(Math.round(Math.random() * 1e9)));
|