@mui/x-data-grid 5.11.1 → 5.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +199 -20
- package/DataGrid/DataGrid.js +26 -1
- package/README.md +2 -2
- package/colDef/gridCheckboxSelectionColDef.d.ts +1 -0
- package/colDef/gridCheckboxSelectionColDef.js +2 -1
- package/colDef/gridDateOperators.d.ts +1 -1
- package/colDef/gridNumericColDef.js +1 -1
- package/components/GridRow.d.ts +1 -1
- package/components/GridRow.js +51 -12
- package/components/cell/GridActionsCellItem.d.ts +1 -1
- package/components/cell/GridCell.d.ts +2 -1
- package/components/cell/GridCell.js +12 -7
- package/components/columnHeaders/GridColumnHeaderItem.js +9 -6
- package/components/columnSelection/GridCellCheckboxRenderer.js +0 -1
- package/components/columnSelection/GridHeaderCheckbox.js +0 -1
- package/components/containers/GridRootStyles.js +8 -3
- package/components/menu/GridMenu.js +9 -2
- package/components/panel/GridColumnsPanel.js +12 -7
- package/components/panel/GridPanelWrapper.d.ts +1 -1
- package/components/panel/GridPanelWrapper.js +3 -3
- package/components/panel/filterPanel/GridFilterForm.d.ts +61 -4
- package/components/panel/filterPanel/GridFilterForm.js +88 -8
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
- package/components/panel/filterPanel/GridFilterPanel.d.ts +8 -5
- package/components/panel/filterPanel/GridFilterPanel.js +26 -11
- package/components/toolbar/GridToolbarColumnsButton.js +0 -1
- package/components/toolbar/GridToolbarDensitySelector.js +0 -1
- package/components/toolbar/GridToolbarExportContainer.js +0 -1
- package/components/toolbar/GridToolbarFilterButton.d.ts +1 -1
- package/components/toolbar/GridToolbarFilterButton.js +0 -1
- package/components/toolbar/GridToolbarQuickFilter.d.ts +7 -0
- package/components/toolbar/GridToolbarQuickFilter.js +57 -4
- package/constants/defaultGridSlotsComponents.js +2 -1
- package/constants/gridClasses.d.ts +4 -0
- package/constants/gridClasses.js +1 -1
- package/constants/localeTextConstants.js +1 -0
- package/hooks/core/useGridStateInitialization.js +19 -6
- package/hooks/features/columnMenu/useGridColumnMenu.js +22 -0
- package/hooks/features/columns/gridColumnsInterfaces.d.ts +3 -0
- package/hooks/features/columns/useGridColumnSpanning.d.ts +1 -1
- package/hooks/features/columns/useGridColumnSpanning.js +1 -1
- package/hooks/features/columns/useGridColumns.d.ts +1 -1
- package/hooks/features/columns/useGridColumns.js +13 -15
- package/hooks/features/dimensions/gridDimensionsApi.d.ts +5 -0
- package/hooks/features/dimensions/useGridDimensions.js +9 -8
- package/hooks/features/editRows/useGridCellEditing.new.js +11 -4
- package/hooks/features/editRows/useGridEditing.old.js +1 -1
- package/hooks/features/editRows/useGridRowEditing.new.js +10 -4
- package/hooks/features/events/useGridEvents.d.ts +1 -1
- package/hooks/features/events/useGridEvents.js +2 -0
- package/hooks/features/filter/gridFilterSelector.d.ts +5 -0
- package/hooks/features/filter/gridFilterSelector.js +6 -0
- package/hooks/features/filter/gridFilterState.d.ts +1 -1
- package/hooks/features/filter/gridFilterUtils.d.ts +10 -2
- package/hooks/features/filter/gridFilterUtils.js +3 -6
- package/hooks/features/filter/useGridFilter.d.ts +1 -1
- package/hooks/features/filter/useGridFilter.js +29 -12
- package/hooks/features/pagination/useGridPage.js +1 -1
- package/hooks/features/pagination/useGridPageSize.js +1 -1
- package/hooks/features/rows/useGridRowsMeta.d.ts +1 -1
- package/hooks/features/rows/useGridRowsMeta.js +133 -67
- package/hooks/features/selection/useGridSelection.js +1 -1
- package/hooks/features/selection/useGridSelectionPreProcessors.js +8 -6
- package/hooks/features/sorting/useGridSorting.d.ts +1 -1
- package/hooks/features/sorting/useGridSorting.js +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +2 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +65 -11
- package/index.js +1 -1
- package/internals/index.d.ts +1 -0
- package/legacy/DataGrid/DataGrid.js +26 -1
- package/legacy/colDef/gridCheckboxSelectionColDef.js +2 -1
- package/legacy/colDef/gridNumericColDef.js +1 -1
- package/legacy/components/GridRow.js +56 -12
- package/legacy/components/cell/GridCell.js +12 -7
- package/legacy/components/columnHeaders/GridColumnHeaderItem.js +11 -6
- package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +0 -1
- package/legacy/components/columnSelection/GridHeaderCheckbox.js +0 -1
- package/legacy/components/containers/GridRootStyles.js +10 -7
- package/legacy/components/menu/GridMenu.js +9 -2
- package/legacy/components/panel/GridColumnsPanel.js +14 -7
- package/legacy/components/panel/GridPanelWrapper.js +3 -3
- package/legacy/components/panel/filterPanel/GridFilterForm.js +89 -8
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
- package/legacy/components/panel/filterPanel/GridFilterPanel.js +28 -12
- package/legacy/components/toolbar/GridToolbarColumnsButton.js +0 -1
- package/legacy/components/toolbar/GridToolbarDensitySelector.js +0 -1
- package/legacy/components/toolbar/GridToolbarExportContainer.js +0 -1
- package/legacy/components/toolbar/GridToolbarFilterButton.js +0 -1
- package/legacy/components/toolbar/GridToolbarQuickFilter.js +67 -6
- package/legacy/constants/defaultGridSlotsComponents.js +2 -1
- package/legacy/constants/gridClasses.js +1 -1
- package/legacy/constants/localeTextConstants.js +1 -0
- package/legacy/hooks/core/useGridStateInitialization.js +18 -6
- package/legacy/hooks/features/columnMenu/useGridColumnMenu.js +22 -0
- package/legacy/hooks/features/columns/useGridColumnSpanning.js +1 -1
- package/legacy/hooks/features/columns/useGridColumns.js +13 -15
- package/legacy/hooks/features/dimensions/useGridDimensions.js +9 -8
- package/legacy/hooks/features/editRows/useGridCellEditing.new.js +14 -7
- package/legacy/hooks/features/editRows/useGridEditing.old.js +1 -1
- package/legacy/hooks/features/editRows/useGridRowEditing.new.js +10 -4
- package/legacy/hooks/features/events/useGridEvents.js +2 -0
- package/legacy/hooks/features/filter/gridFilterSelector.js +8 -0
- package/legacy/hooks/features/filter/gridFilterUtils.js +4 -7
- package/legacy/hooks/features/filter/useGridFilter.js +33 -12
- package/legacy/hooks/features/pagination/useGridPage.js +1 -1
- package/legacy/hooks/features/pagination/useGridPageSize.js +1 -1
- package/legacy/hooks/features/rows/useGridRowsMeta.js +133 -66
- package/legacy/hooks/features/selection/useGridSelection.js +1 -1
- package/legacy/hooks/features/selection/useGridSelectionPreProcessors.js +8 -6
- package/legacy/hooks/features/sorting/useGridSorting.js +1 -1
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +84 -26
- package/legacy/index.js +1 -1
- package/legacy/locales/arSD.js +1 -0
- package/legacy/locales/bgBG.js +1 -0
- package/legacy/locales/csCZ.js +1 -0
- package/legacy/locales/daDK.js +1 -0
- package/legacy/locales/deDE.js +1 -0
- package/legacy/locales/elGR.js +1 -0
- package/legacy/locales/esES.js +1 -0
- package/legacy/locales/faIR.js +1 -0
- package/legacy/locales/fiFI.js +1 -0
- package/legacy/locales/frFR.js +1 -0
- package/legacy/locales/heIL.js +10 -9
- package/legacy/locales/huHU.js +1 -0
- package/legacy/locales/itIT.js +1 -0
- package/legacy/locales/jaJP.js +29 -24
- package/legacy/locales/koKR.js +1 -0
- package/legacy/locales/nbNO.js +128 -0
- package/legacy/locales/nlNL.js +1 -0
- package/legacy/locales/plPL.js +1 -0
- package/legacy/locales/ptBR.js +1 -0
- package/legacy/locales/ruRU.js +7 -6
- package/legacy/locales/skSK.js +1 -0
- package/legacy/locales/trTR.js +8 -7
- package/legacy/locales/ukUA.js +1 -0
- package/legacy/locales/viVN.js +1 -0
- package/legacy/locales/zhCN.js +1 -0
- package/legacy/models/events/gridEvents.js +2 -0
- package/legacy/models/gridApiCaches.js +1 -0
- package/legacy/models/params/gridMenuParams.js +1 -0
- package/legacy/models/params/index.js +2 -1
- package/locales/arSD.js +1 -0
- package/locales/bgBG.js +1 -0
- package/locales/csCZ.js +1 -0
- package/locales/daDK.js +1 -0
- package/locales/deDE.js +1 -0
- package/locales/elGR.js +1 -0
- package/locales/esES.js +1 -0
- package/locales/faIR.js +1 -0
- package/locales/fiFI.js +1 -0
- package/locales/frFR.js +1 -0
- package/locales/heIL.js +10 -9
- package/locales/huHU.js +1 -0
- package/locales/itIT.js +1 -0
- package/locales/jaJP.js +25 -24
- package/locales/koKR.js +1 -0
- package/locales/nbNO.d.ts +2 -0
- package/locales/nbNO.js +116 -0
- package/locales/nlNL.js +1 -0
- package/locales/plPL.js +1 -0
- package/locales/ptBR.js +1 -0
- package/locales/ruRU.js +7 -6
- package/locales/skSK.js +1 -0
- package/locales/trTR.js +8 -7
- package/locales/ukUA.js +1 -0
- package/locales/viVN.js +1 -0
- package/locales/zhCN.js +1 -0
- package/models/api/gridCallbackDetails.d.ts +6 -1
- package/models/api/gridCoreApi.d.ts +2 -6
- package/models/api/gridFilterApi.d.ts +8 -1
- package/models/api/gridLocaleTextApi.d.ts +1 -0
- package/models/api/gridRowsMetaApi.d.ts +24 -0
- package/models/api/gridStateApi.d.ts +14 -3
- package/models/colDef/gridColDef.d.ts +4 -4
- package/models/events/gridEventLookup.d.ts +16 -1
- package/models/events/gridEvents.d.ts +3 -1
- package/models/events/gridEvents.js +2 -0
- package/models/gridApiCaches.d.ts +6 -0
- package/models/gridApiCaches.js +1 -0
- package/models/gridIconSlotsComponent.d.ts +5 -0
- package/models/params/gridMenuParams.d.ts +7 -0
- package/models/params/gridMenuParams.js +1 -0
- package/models/params/gridRowParams.d.ts +1 -1
- package/models/params/index.d.ts +1 -0
- package/models/params/index.js +2 -1
- package/models/props/DataGridProps.d.ts +24 -2
- package/modern/DataGrid/DataGrid.js +26 -1
- package/modern/colDef/gridCheckboxSelectionColDef.js +2 -1
- package/modern/colDef/gridNumericColDef.js +1 -1
- package/modern/components/GridRow.js +51 -12
- package/modern/components/cell/GridCell.js +12 -7
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +9 -6
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +0 -1
- package/modern/components/columnSelection/GridHeaderCheckbox.js +0 -1
- package/modern/components/containers/GridRootStyles.js +8 -3
- package/modern/components/menu/GridMenu.js +9 -2
- package/modern/components/panel/GridColumnsPanel.js +12 -7
- package/modern/components/panel/GridPanelWrapper.js +3 -3
- package/modern/components/panel/filterPanel/GridFilterForm.js +88 -8
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
- package/modern/components/panel/filterPanel/GridFilterPanel.js +26 -11
- package/modern/components/toolbar/GridToolbarColumnsButton.js +0 -1
- package/modern/components/toolbar/GridToolbarDensitySelector.js +0 -1
- package/modern/components/toolbar/GridToolbarExportContainer.js +0 -1
- package/modern/components/toolbar/GridToolbarFilterButton.js +0 -1
- package/modern/components/toolbar/GridToolbarQuickFilter.js +57 -4
- package/modern/constants/defaultGridSlotsComponents.js +2 -1
- package/modern/constants/gridClasses.js +1 -1
- package/modern/constants/localeTextConstants.js +1 -0
- package/modern/hooks/core/useGridStateInitialization.js +19 -6
- package/modern/hooks/features/columnMenu/useGridColumnMenu.js +22 -0
- package/modern/hooks/features/columns/useGridColumnSpanning.js +1 -1
- package/modern/hooks/features/columns/useGridColumns.js +12 -14
- package/modern/hooks/features/dimensions/useGridDimensions.js +9 -8
- package/modern/hooks/features/editRows/useGridCellEditing.new.js +10 -3
- package/modern/hooks/features/editRows/useGridEditing.old.js +1 -1
- package/modern/hooks/features/editRows/useGridRowEditing.new.js +9 -3
- package/modern/hooks/features/events/useGridEvents.js +2 -0
- package/modern/hooks/features/filter/gridFilterSelector.js +6 -0
- package/modern/hooks/features/filter/gridFilterUtils.js +3 -6
- package/modern/hooks/features/filter/useGridFilter.js +29 -12
- package/modern/hooks/features/pagination/useGridPage.js +1 -1
- package/modern/hooks/features/pagination/useGridPageSize.js +1 -1
- package/modern/hooks/features/rows/useGridRowsMeta.js +129 -59
- package/modern/hooks/features/selection/useGridSelection.js +1 -1
- package/modern/hooks/features/selection/useGridSelectionPreProcessors.js +8 -6
- package/modern/hooks/features/sorting/useGridSorting.js +1 -1
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +65 -11
- package/modern/index.js +1 -1
- package/modern/locales/arSD.js +1 -0
- package/modern/locales/bgBG.js +1 -0
- package/modern/locales/csCZ.js +1 -0
- package/modern/locales/daDK.js +1 -0
- package/modern/locales/deDE.js +1 -0
- package/modern/locales/elGR.js +1 -0
- package/modern/locales/esES.js +1 -0
- package/modern/locales/faIR.js +1 -0
- package/modern/locales/fiFI.js +1 -0
- package/modern/locales/frFR.js +1 -0
- package/modern/locales/heIL.js +10 -9
- package/modern/locales/huHU.js +1 -0
- package/modern/locales/itIT.js +1 -0
- package/modern/locales/jaJP.js +25 -24
- package/modern/locales/koKR.js +1 -0
- package/modern/locales/nbNO.js +116 -0
- package/modern/locales/nlNL.js +1 -0
- package/modern/locales/plPL.js +1 -0
- package/modern/locales/ptBR.js +1 -0
- package/modern/locales/ruRU.js +7 -6
- package/modern/locales/skSK.js +1 -0
- package/modern/locales/trTR.js +8 -7
- package/modern/locales/ukUA.js +1 -0
- package/modern/locales/viVN.js +1 -0
- package/modern/locales/zhCN.js +1 -0
- package/modern/models/events/gridEvents.js +2 -0
- package/modern/models/gridApiCaches.js +1 -0
- package/modern/models/params/gridMenuParams.js +1 -0
- package/modern/models/params/index.js +2 -1
- package/node/DataGrid/DataGrid.js +26 -1
- package/node/colDef/gridCheckboxSelectionColDef.js +4 -2
- package/node/colDef/gridNumericColDef.js +1 -1
- package/node/components/GridRow.js +53 -12
- package/node/components/cell/GridCell.js +12 -7
- package/node/components/columnHeaders/GridColumnHeaderItem.js +9 -6
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +0 -1
- package/node/components/columnSelection/GridHeaderCheckbox.js +0 -1
- package/node/components/containers/GridRootStyles.js +8 -3
- package/node/components/menu/GridMenu.js +10 -2
- package/node/components/panel/GridColumnsPanel.js +12 -7
- package/node/components/panel/GridPanelWrapper.js +5 -3
- package/node/components/panel/filterPanel/GridFilterForm.js +91 -9
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
- package/node/components/panel/filterPanel/GridFilterPanel.js +28 -11
- package/node/components/toolbar/GridToolbarColumnsButton.js +0 -1
- package/node/components/toolbar/GridToolbarDensitySelector.js +0 -1
- package/node/components/toolbar/GridToolbarExportContainer.js +0 -1
- package/node/components/toolbar/GridToolbarFilterButton.js +0 -1
- package/node/components/toolbar/GridToolbarQuickFilter.js +61 -4
- package/node/constants/defaultGridSlotsComponents.js +2 -1
- package/node/constants/gridClasses.js +1 -1
- package/node/constants/localeTextConstants.js +1 -0
- package/node/hooks/core/useGridStateInitialization.js +19 -6
- package/node/hooks/features/columnMenu/useGridColumnMenu.js +23 -0
- package/node/hooks/features/columns/useGridColumnSpanning.js +11 -16
- package/node/hooks/features/columns/useGridColumns.js +13 -15
- package/node/hooks/features/dimensions/useGridDimensions.js +9 -8
- package/node/hooks/features/editRows/useGridCellEditing.new.js +11 -4
- package/node/hooks/features/editRows/useGridEditing.old.js +1 -1
- package/node/hooks/features/editRows/useGridRowEditing.new.js +10 -4
- package/node/hooks/features/events/useGridEvents.js +2 -0
- package/node/hooks/features/filter/gridFilterSelector.js +9 -2
- package/node/hooks/features/filter/gridFilterUtils.js +4 -5
- package/node/hooks/features/filter/useGridFilter.js +28 -11
- package/node/hooks/features/pagination/useGridPage.js +1 -1
- package/node/hooks/features/pagination/useGridPageSize.js +1 -1
- package/node/hooks/features/rows/useGridRowsMeta.js +136 -69
- package/node/hooks/features/selection/useGridSelection.js +1 -1
- package/node/hooks/features/selection/useGridSelectionPreProcessors.js +7 -5
- package/node/hooks/features/sorting/useGridSorting.js +1 -1
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +65 -12
- package/node/index.js +1 -1
- package/node/locales/arSD.js +1 -0
- package/node/locales/bgBG.js +1 -0
- package/node/locales/csCZ.js +1 -0
- package/node/locales/daDK.js +1 -0
- package/node/locales/deDE.js +1 -0
- package/node/locales/elGR.js +1 -0
- package/node/locales/esES.js +1 -0
- package/node/locales/faIR.js +1 -0
- package/node/locales/fiFI.js +1 -0
- package/node/locales/frFR.js +1 -0
- package/node/locales/heIL.js +10 -9
- package/node/locales/huHU.js +1 -0
- package/node/locales/itIT.js +1 -0
- package/node/locales/jaJP.js +25 -24
- package/node/locales/koKR.js +1 -0
- package/node/locales/nbNO.js +126 -0
- package/node/locales/nlNL.js +1 -0
- package/node/locales/plPL.js +1 -0
- package/node/locales/ptBR.js +1 -0
- package/node/locales/ruRU.js +7 -6
- package/node/locales/skSK.js +1 -0
- package/node/locales/trTR.js +8 -7
- package/node/locales/ukUA.js +1 -0
- package/node/locales/viVN.js +1 -0
- package/node/locales/zhCN.js +1 -0
- package/node/models/events/gridEvents.js +2 -0
- package/node/models/gridApiCaches.js +5 -0
- package/node/models/params/gridMenuParams.js +5 -0
- package/node/models/params/index.js +13 -0
- package/package.json +6 -5
|
@@ -37,7 +37,7 @@ var isEnabled = function isEnabled() {
|
|
|
37
37
|
return true;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
function GridPanelWrapper(props) {
|
|
40
|
+
var GridPanelWrapper = /*#__PURE__*/React.forwardRef(function GridPanelWrapper(props, ref) {
|
|
41
41
|
var className = props.className,
|
|
42
42
|
other = _objectWithoutProperties(props, _excluded);
|
|
43
43
|
|
|
@@ -51,10 +51,10 @@ function GridPanelWrapper(props) {
|
|
|
51
51
|
disableEnforceFocus: true,
|
|
52
52
|
isEnabled: isEnabled,
|
|
53
53
|
children: /*#__PURE__*/_jsx(GridPanelWrapperRoot, _extends({
|
|
54
|
+
ref: ref,
|
|
54
55
|
tabIndex: -1,
|
|
55
56
|
className: clsx(className, classes.root)
|
|
56
57
|
}, other))
|
|
57
58
|
});
|
|
58
|
-
}
|
|
59
|
-
|
|
59
|
+
});
|
|
60
60
|
export { GridPanelWrapper };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["item", "hasMultipleFilters", "deleteFilter", "applyFilterChanges", "multiFilterOperator", "showMultiFilterOperators", "disableMultiFilterOperator", "applyMultiFilterOperatorChanges", "focusElementRef", "linkOperators", "columnsSort", "deleteIconProps", "linkOperatorInputProps", "operatorInputProps", "columnInputProps", "valueInputProps", "children"];
|
|
2
4
|
import * as React from 'react';
|
|
3
5
|
import PropTypes from 'prop-types';
|
|
4
6
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
@@ -116,8 +118,7 @@ var getColumnLabel = function getColumnLabel(col) {
|
|
|
116
118
|
};
|
|
117
119
|
|
|
118
120
|
var collator = new Intl.Collator();
|
|
119
|
-
|
|
120
|
-
function GridFilterForm(props) {
|
|
121
|
+
var GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(props, ref) {
|
|
121
122
|
var _rootProps$components, _rootProps$components2, _baseSelectProps$nati, _rootProps$components3, _rootProps$components4, _rootProps$components5, _currentColumn$filter2;
|
|
122
123
|
|
|
123
124
|
var item = props.item,
|
|
@@ -141,7 +142,10 @@ function GridFilterForm(props) {
|
|
|
141
142
|
_props$columnInputPro = props.columnInputProps,
|
|
142
143
|
columnInputProps = _props$columnInputPro === void 0 ? {} : _props$columnInputPro,
|
|
143
144
|
_props$valueInputProp = props.valueInputProps,
|
|
144
|
-
valueInputProps = _props$valueInputProp === void 0 ? {} : _props$valueInputProp
|
|
145
|
+
valueInputProps = _props$valueInputProp === void 0 ? {} : _props$valueInputProp,
|
|
146
|
+
children = props.children,
|
|
147
|
+
other = _objectWithoutProperties(props, _excluded);
|
|
148
|
+
|
|
145
149
|
var apiRef = useGridApiContext();
|
|
146
150
|
var filterableColumns = useGridSelector(apiRef, gridFilterableColumnDefinitionsSelector);
|
|
147
151
|
var columnSelectId = useId();
|
|
@@ -253,8 +257,10 @@ function GridFilterForm(props) {
|
|
|
253
257
|
}
|
|
254
258
|
};
|
|
255
259
|
}, [currentOperator]);
|
|
256
|
-
return /*#__PURE__*/_jsxs(GridFilterFormRoot, {
|
|
257
|
-
|
|
260
|
+
return /*#__PURE__*/_jsxs(GridFilterFormRoot, _extends({
|
|
261
|
+
ref: ref,
|
|
262
|
+
className: classes.root
|
|
263
|
+
}, other, {
|
|
258
264
|
children: [/*#__PURE__*/_jsx(FilterFormDeleteIcon, _extends({
|
|
259
265
|
variant: "standard",
|
|
260
266
|
as: rootProps.components.BaseFormControl
|
|
@@ -355,36 +361,111 @@ function GridFilterForm(props) {
|
|
|
355
361
|
focusElementRef: valueRef
|
|
356
362
|
}, currentOperator.InputComponentProps)) : null
|
|
357
363
|
}))]
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
|
|
364
|
+
}));
|
|
365
|
+
});
|
|
361
366
|
process.env.NODE_ENV !== "production" ? GridFilterForm.propTypes = {
|
|
362
367
|
// ----------------------------- Warning --------------------------------
|
|
363
368
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
364
369
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
365
370
|
// ----------------------------------------------------------------------
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Callback called when the operator, column field or value is changed.
|
|
374
|
+
* @param {GridFilterItem} item The updated [[GridFilterItem]].
|
|
375
|
+
*/
|
|
366
376
|
applyFilterChanges: PropTypes.func.isRequired,
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Callback called when the logic operator is changed.
|
|
380
|
+
* @param {GridLinkOperator} operator The new logic operator.
|
|
381
|
+
*/
|
|
367
382
|
applyMultiFilterOperatorChanges: PropTypes.func.isRequired,
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Props passed to the column input component.
|
|
386
|
+
* @default {}
|
|
387
|
+
*/
|
|
368
388
|
columnInputProps: PropTypes.any,
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Changes how the options in the columns selector should be ordered.
|
|
392
|
+
* If not specified, the order is derived from the `columns` prop.
|
|
393
|
+
*/
|
|
369
394
|
columnsSort: PropTypes.oneOf(['asc', 'desc']),
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* Callback called when the delete button is clicked.
|
|
398
|
+
* @param {GridFilterItem} item The deleted [[GridFilterItem]].
|
|
399
|
+
*/
|
|
370
400
|
deleteFilter: PropTypes.func.isRequired,
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Props passed to the delete icon.
|
|
404
|
+
* @default {}
|
|
405
|
+
*/
|
|
371
406
|
deleteIconProps: PropTypes.any,
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* If `true`, disables the logic operator field but still renders it.
|
|
410
|
+
*/
|
|
372
411
|
disableMultiFilterOperator: PropTypes.bool,
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* A ref allowing to set imperative focus.
|
|
415
|
+
* It can be passed to the el
|
|
416
|
+
*/
|
|
373
417
|
focusElementRef: PropTypes
|
|
374
418
|
/* @typescript-to-proptypes-ignore */
|
|
375
419
|
.oneOfType([PropTypes.func, PropTypes.object]),
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* If `true`, the logic operator field is rendered.
|
|
423
|
+
* The field will be invisible if `showMultiFilterOperators` is also `true`.
|
|
424
|
+
*/
|
|
376
425
|
hasMultipleFilters: PropTypes.bool.isRequired,
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* The [[GridFilterItem]] representing this form.
|
|
429
|
+
*/
|
|
377
430
|
item: PropTypes.shape({
|
|
378
431
|
columnField: PropTypes.string.isRequired,
|
|
379
432
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
380
433
|
operatorValue: PropTypes.string,
|
|
381
434
|
value: PropTypes.any
|
|
382
435
|
}).isRequired,
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Props passed to the logic operator input component.
|
|
439
|
+
* @default {}
|
|
440
|
+
*/
|
|
383
441
|
linkOperatorInputProps: PropTypes.any,
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Sets the available logic operators.
|
|
445
|
+
* @default [GridLinkOperator.And, GridLinkOperator.Or]
|
|
446
|
+
*/
|
|
384
447
|
linkOperators: PropTypes.arrayOf(PropTypes.oneOf(['and', 'or']).isRequired),
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* The current logic operator applied.
|
|
451
|
+
*/
|
|
385
452
|
multiFilterOperator: PropTypes.oneOf(['and', 'or']),
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* Props passed to the operator input component.
|
|
456
|
+
* @default {}
|
|
457
|
+
*/
|
|
386
458
|
operatorInputProps: PropTypes.any,
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* If `true`, the logic operator field is visible.
|
|
462
|
+
*/
|
|
387
463
|
showMultiFilterOperators: PropTypes.bool,
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Props passed to the value input component.
|
|
467
|
+
* @default {}
|
|
468
|
+
*/
|
|
388
469
|
valueInputProps: PropTypes.any
|
|
389
470
|
} : void 0;
|
|
390
471
|
export { GridFilterForm };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["linkOperators", "columnsSort", "filterFormProps"];
|
|
4
|
+
var _excluded = ["linkOperators", "columnsSort", "filterFormProps", "children"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { GridLinkOperator } from '../../../models/gridFilterItem';
|
|
@@ -17,8 +17,7 @@ import { gridFilterModelSelector } from '../../../hooks/features/filter/gridFilt
|
|
|
17
17
|
import { gridFilterableColumnDefinitionsSelector } from '../../../hooks/features/columns/gridColumnsSelector';
|
|
18
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
19
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
-
|
|
21
|
-
function GridFilterPanel(props) {
|
|
20
|
+
var GridFilterPanel = /*#__PURE__*/React.forwardRef(function GridFilterPanel(props, ref) {
|
|
22
21
|
var _rootProps$components;
|
|
23
22
|
|
|
24
23
|
var apiRef = useGridApiContext();
|
|
@@ -31,6 +30,7 @@ function GridFilterPanel(props) {
|
|
|
31
30
|
linkOperators = _props$linkOperators === void 0 ? [GridLinkOperator.And, GridLinkOperator.Or] : _props$linkOperators,
|
|
32
31
|
columnsSort = props.columnsSort,
|
|
33
32
|
filterFormProps = props.filterFormProps,
|
|
33
|
+
children = props.children,
|
|
34
34
|
other = _objectWithoutProperties(props, _excluded);
|
|
35
35
|
|
|
36
36
|
var applyFilter = React.useCallback(function (item) {
|
|
@@ -73,9 +73,7 @@ function GridFilterPanel(props) {
|
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
apiRef.current.
|
|
77
|
-
items: [].concat(_toConsumableArray(items), [defaultItem])
|
|
78
|
-
}));
|
|
76
|
+
apiRef.current.upsertFilterItems([].concat(_toConsumableArray(items), [defaultItem]));
|
|
79
77
|
};
|
|
80
78
|
|
|
81
79
|
var deleteFilter = React.useCallback(function (item) {
|
|
@@ -96,7 +94,9 @@ function GridFilterPanel(props) {
|
|
|
96
94
|
lastFilterRef.current.focus();
|
|
97
95
|
}
|
|
98
96
|
}, [items.length]);
|
|
99
|
-
return /*#__PURE__*/_jsxs(GridPanelWrapper, _extends({
|
|
97
|
+
return /*#__PURE__*/_jsxs(GridPanelWrapper, _extends({
|
|
98
|
+
ref: ref
|
|
99
|
+
}, other, {
|
|
100
100
|
children: [/*#__PURE__*/_jsx(GridPanelContent, {
|
|
101
101
|
children: items.map(function (item, index) {
|
|
102
102
|
return /*#__PURE__*/_jsx(GridFilterForm, _extends({
|
|
@@ -116,21 +116,28 @@ function GridFilterPanel(props) {
|
|
|
116
116
|
}), !rootProps.disableMultipleColumnsFiltering && /*#__PURE__*/_jsx(GridPanelFooter, {
|
|
117
117
|
children: /*#__PURE__*/_jsx(rootProps.components.BaseButton, _extends({
|
|
118
118
|
onClick: addNewFilter,
|
|
119
|
-
startIcon: /*#__PURE__*/_jsx(GridAddIcon, {})
|
|
120
|
-
color: "primary"
|
|
119
|
+
startIcon: /*#__PURE__*/_jsx(GridAddIcon, {})
|
|
121
120
|
}, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseButton, {
|
|
122
121
|
children: apiRef.current.getLocaleText('filterPanelAddFilter')
|
|
123
122
|
}))
|
|
124
123
|
})]
|
|
125
124
|
}));
|
|
126
|
-
}
|
|
127
|
-
|
|
125
|
+
});
|
|
128
126
|
process.env.NODE_ENV !== "production" ? GridFilterPanel.propTypes = {
|
|
129
127
|
// ----------------------------- Warning --------------------------------
|
|
130
128
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
131
129
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
132
130
|
// ----------------------------------------------------------------------
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Changes how the options in the columns selector should be ordered.
|
|
134
|
+
* If not specified, the order is derived from the `columns` prop.
|
|
135
|
+
*/
|
|
133
136
|
columnsSort: PropTypes.oneOf(['asc', 'desc']),
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Props passed to each filter form.
|
|
140
|
+
*/
|
|
134
141
|
filterFormProps: PropTypes.shape({
|
|
135
142
|
columnInputProps: PropTypes.any,
|
|
136
143
|
columnsSort: PropTypes.oneOf(['asc', 'desc']),
|
|
@@ -139,7 +146,16 @@ process.env.NODE_ENV !== "production" ? GridFilterPanel.propTypes = {
|
|
|
139
146
|
operatorInputProps: PropTypes.any,
|
|
140
147
|
valueInputProps: PropTypes.any
|
|
141
148
|
}),
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Sets the available logic operators.
|
|
152
|
+
* @default [GridLinkOperator.And, GridLinkOperator.Or]
|
|
153
|
+
*/
|
|
142
154
|
linkOperators: PropTypes.arrayOf(PropTypes.oneOf(['and', 'or']).isRequired),
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
158
|
+
*/
|
|
143
159
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
144
160
|
} : void 0;
|
|
145
161
|
export { GridFilterPanel };
|
|
@@ -39,7 +39,6 @@ export var GridToolbarColumnsButton = /*#__PURE__*/React.forwardRef(function Gri
|
|
|
39
39
|
return /*#__PURE__*/_jsx(rootProps.components.BaseButton, _extends({
|
|
40
40
|
ref: ref,
|
|
41
41
|
size: "small",
|
|
42
|
-
color: "primary",
|
|
43
42
|
"aria-label": apiRef.current.getLocaleText('toolbarColumnsLabel'),
|
|
44
43
|
startIcon: /*#__PURE__*/_jsx(rootProps.components.ColumnSelectorIcon, {})
|
|
45
44
|
}, other, {
|
|
@@ -105,7 +105,6 @@ export var GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function G
|
|
|
105
105
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
106
106
|
children: [/*#__PURE__*/_jsx(rootProps.components.BaseButton, _extends({
|
|
107
107
|
ref: handleRef,
|
|
108
|
-
color: "primary",
|
|
109
108
|
size: "small",
|
|
110
109
|
startIcon: startIcon,
|
|
111
110
|
"aria-label": apiRef.current.getLocaleText('toolbarDensityLabel'),
|
|
@@ -58,7 +58,6 @@ export var GridToolbarExportContainer = /*#__PURE__*/React.forwardRef(function G
|
|
|
58
58
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
59
59
|
children: [/*#__PURE__*/_jsx(rootProps.components.BaseButton, _extends({
|
|
60
60
|
ref: handleRef,
|
|
61
|
-
color: "primary",
|
|
62
61
|
size: "small",
|
|
63
62
|
startIcon: /*#__PURE__*/_jsx(rootProps.components.ExportIcon, {}),
|
|
64
63
|
"aria-expanded": open ? 'true' : undefined,
|
|
@@ -110,7 +110,6 @@ var GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolbar
|
|
|
110
110
|
children: /*#__PURE__*/_jsx(rootProps.components.BaseButton, _extends({
|
|
111
111
|
ref: ref,
|
|
112
112
|
size: "small",
|
|
113
|
-
color: "primary",
|
|
114
113
|
"aria-label": apiRef.current.getLocaleText('toolbarFiltersLabel'),
|
|
115
114
|
startIcon: /*#__PURE__*/_jsx(Badge, {
|
|
116
115
|
badgeContent: activeFilters.length,
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
|
|
4
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
5
|
+
var _excluded = ["quickFilterParser", "quickFilterFormatter", "debounceMs"];
|
|
5
6
|
import * as React from 'react';
|
|
6
7
|
import PropTypes from 'prop-types';
|
|
7
8
|
import TextField from '@mui/material/TextField';
|
|
9
|
+
import IconButton from '@mui/material/IconButton';
|
|
8
10
|
import { styled } from '@mui/material/styles';
|
|
9
11
|
import { debounce } from '@mui/material/utils';
|
|
10
12
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
11
13
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
14
|
+
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
15
|
+
import { gridQuickFilterValuesSelector } from '../../hooks/features/filter';
|
|
16
|
+
import { isDeepEqual } from '../../utils/utils';
|
|
12
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
18
|
var GridToolbarQuickFilterRoot = styled(TextField, {
|
|
14
19
|
name: 'MuiDataGrid',
|
|
@@ -17,17 +22,27 @@ var GridToolbarQuickFilterRoot = styled(TextField, {
|
|
|
17
22
|
return styles.toolbarQuickFilter;
|
|
18
23
|
}
|
|
19
24
|
})(function (_ref) {
|
|
25
|
+
var _ref2;
|
|
26
|
+
|
|
20
27
|
var theme = _ref.theme;
|
|
21
|
-
return {
|
|
28
|
+
return _ref2 = {
|
|
22
29
|
width: 'auto',
|
|
23
30
|
paddingBottom: theme.spacing(0.5),
|
|
24
|
-
'&
|
|
25
|
-
|
|
31
|
+
'& input': {
|
|
32
|
+
marginLeft: theme.spacing(0.5)
|
|
26
33
|
},
|
|
27
34
|
'& .MuiInput-underline:before': {
|
|
28
35
|
borderBottom: "1px solid ".concat(theme.palette.divider)
|
|
29
36
|
}
|
|
30
|
-
}
|
|
37
|
+
}, _defineProperty(_ref2, "& input[type=search]::-ms-clear,\n& input[type=search]::-ms-reveal", {
|
|
38
|
+
/* clears the 'X' icon from IE */
|
|
39
|
+
display: 'none',
|
|
40
|
+
width: 0,
|
|
41
|
+
height: 0
|
|
42
|
+
}), _defineProperty(_ref2, "& input[type=\"search\"]::-webkit-search-decoration,\n & input[type=\"search\"]::-webkit-search-cancel-button,\n & input[type=\"search\"]::-webkit-search-results-button,\n & input[type=\"search\"]::-webkit-search-results-decoration", {
|
|
43
|
+
/* clears the 'X' icon from Chrome */
|
|
44
|
+
display: 'none'
|
|
45
|
+
}), _ref2;
|
|
31
46
|
});
|
|
32
47
|
|
|
33
48
|
var defaultSearchValueParser = function defaultSearchValueParser(searchText) {
|
|
@@ -36,23 +51,47 @@ var defaultSearchValueParser = function defaultSearchValueParser(searchText) {
|
|
|
36
51
|
});
|
|
37
52
|
};
|
|
38
53
|
|
|
54
|
+
var defaultSearchValueFormatter = function defaultSearchValueFormatter(values) {
|
|
55
|
+
return values.join(' ');
|
|
56
|
+
};
|
|
57
|
+
|
|
39
58
|
function GridToolbarQuickFilter(props) {
|
|
40
59
|
var _rootProps$components;
|
|
41
60
|
|
|
42
61
|
var _props$quickFilterPar = props.quickFilterParser,
|
|
43
62
|
quickFilterParser = _props$quickFilterPar === void 0 ? defaultSearchValueParser : _props$quickFilterPar,
|
|
63
|
+
_props$quickFilterFor = props.quickFilterFormatter,
|
|
64
|
+
quickFilterFormatter = _props$quickFilterFor === void 0 ? defaultSearchValueFormatter : _props$quickFilterFor,
|
|
44
65
|
_props$debounceMs = props.debounceMs,
|
|
45
66
|
debounceMs = _props$debounceMs === void 0 ? 500 : _props$debounceMs,
|
|
46
67
|
other = _objectWithoutProperties(props, _excluded);
|
|
47
68
|
|
|
48
69
|
var apiRef = useGridApiContext();
|
|
49
70
|
var rootProps = useGridRootProps();
|
|
71
|
+
var quickFilterValues = useGridSelector(apiRef, gridQuickFilterValuesSelector);
|
|
50
72
|
|
|
51
|
-
var _React$useState = React.useState(
|
|
73
|
+
var _React$useState = React.useState(function () {
|
|
74
|
+
return quickFilterFormatter(quickFilterValues != null ? quickFilterValues : []);
|
|
75
|
+
}),
|
|
52
76
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
53
77
|
searchValue = _React$useState2[0],
|
|
54
78
|
setSearchValue = _React$useState2[1];
|
|
55
79
|
|
|
80
|
+
var _React$useState3 = React.useState(quickFilterValues),
|
|
81
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
82
|
+
prevQuickFilterValues = _React$useState4[0],
|
|
83
|
+
setPrevQuickFilterValues = _React$useState4[1];
|
|
84
|
+
|
|
85
|
+
React.useEffect(function () {
|
|
86
|
+
if (!isDeepEqual(prevQuickFilterValues, quickFilterValues)) {
|
|
87
|
+
// The model of quick filter value has been updated
|
|
88
|
+
setPrevQuickFilterValues(quickFilterValues); // Update the input value if needed to match the new model
|
|
89
|
+
|
|
90
|
+
setSearchValue(function (prevSearchValue) {
|
|
91
|
+
return isDeepEqual(quickFilterParser(prevSearchValue), quickFilterValues) ? prevSearchValue : quickFilterFormatter(quickFilterValues != null ? quickFilterValues : []);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}, [prevQuickFilterValues, quickFilterValues, quickFilterFormatter, quickFilterParser]);
|
|
56
95
|
var updateSearchValue = React.useCallback(function (newSearchValue) {
|
|
57
96
|
apiRef.current.setQuickFilterValues(quickFilterParser(newSearchValue));
|
|
58
97
|
}, [apiRef, quickFilterParser]);
|
|
@@ -64,6 +103,10 @@ function GridToolbarQuickFilter(props) {
|
|
|
64
103
|
setSearchValue(newSearchValue);
|
|
65
104
|
debouncedUpdateSearchValue(newSearchValue);
|
|
66
105
|
}, [debouncedUpdateSearchValue]);
|
|
106
|
+
var handleSearchReset = React.useCallback(function () {
|
|
107
|
+
setSearchValue('');
|
|
108
|
+
updateSearchValue('');
|
|
109
|
+
}, [updateSearchValue]);
|
|
67
110
|
return /*#__PURE__*/_jsx(GridToolbarQuickFilterRoot, _extends({
|
|
68
111
|
as: rootProps.components.BaseTextField,
|
|
69
112
|
variant: "standard",
|
|
@@ -75,6 +118,17 @@ function GridToolbarQuickFilter(props) {
|
|
|
75
118
|
InputProps: {
|
|
76
119
|
startAdornment: /*#__PURE__*/_jsx(rootProps.components.QuickFilterIcon, {
|
|
77
120
|
fontSize: "small"
|
|
121
|
+
}),
|
|
122
|
+
endAdornment: /*#__PURE__*/_jsx(IconButton, {
|
|
123
|
+
"aria-label": apiRef.current.getLocaleText('toolbarQuickFilterDeleteIconLabel'),
|
|
124
|
+
size: "small",
|
|
125
|
+
sx: {
|
|
126
|
+
visibility: searchValue ? 'visible' : 'hidden'
|
|
127
|
+
},
|
|
128
|
+
onClick: handleSearchReset,
|
|
129
|
+
children: /*#__PURE__*/_jsx(rootProps.components.QuickFilterClearIcon, {
|
|
130
|
+
fontSize: "small"
|
|
131
|
+
})
|
|
78
132
|
})
|
|
79
133
|
}
|
|
80
134
|
}, other, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseTextField));
|
|
@@ -92,6 +146,13 @@ process.env.NODE_ENV !== "production" ? GridToolbarQuickFilter.propTypes = {
|
|
|
92
146
|
*/
|
|
93
147
|
debounceMs: PropTypes.number,
|
|
94
148
|
|
|
149
|
+
/**
|
|
150
|
+
* Function responsible for formatting values of quick filter in a string when the model is modified
|
|
151
|
+
* @param {any[]} values The new values passed to the quick filter model
|
|
152
|
+
* @returns {string} The string to display in the text field
|
|
153
|
+
*/
|
|
154
|
+
quickFilterFormatter: PropTypes.func,
|
|
155
|
+
|
|
95
156
|
/**
|
|
96
157
|
* Function responsible for parsing text input in an array of independent values for quick filtering.
|
|
97
158
|
* @param {string} input The value entered by the user
|
|
@@ -35,7 +35,8 @@ var DEFAULT_GRID_ICON_SLOTS_COMPONENTS = {
|
|
|
35
35
|
DetailPanelExpandIcon: GridAddIcon,
|
|
36
36
|
DetailPanelCollapseIcon: GridRemoveIcon,
|
|
37
37
|
RowReorderIcon: GridDragIcon,
|
|
38
|
-
QuickFilterIcon: GridSearchIcon
|
|
38
|
+
QuickFilterIcon: GridSearchIcon,
|
|
39
|
+
QuickFilterClearIcon: GridCloseIcon
|
|
39
40
|
};
|
|
40
41
|
/**
|
|
41
42
|
* TODO: Differentiate community and pro value and interface
|
|
@@ -2,4 +2,4 @@ import { generateUtilityClasses, generateUtilityClass } from '@mui/material';
|
|
|
2
2
|
export function getDataGridUtilityClass(slot) {
|
|
3
3
|
return generateUtilityClass('MuiDataGrid', slot);
|
|
4
4
|
}
|
|
5
|
-
export var gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'autoHeight', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--withRenderer', 'cell', 'cellContent', 'cellCheckbox', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderDropZone', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeaders', 'columnHeadersInner', 'columnHeadersInner--scrollable', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsPanel', 'columnsPanelRow', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filterForm', 'filterFormDeleteIcon', 'filterFormLinkOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'iconButtonContainer', 'iconSeparator', 'main', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'row', 'row--editable', 'row--editing', 'row--lastVisible', 'row--dragging', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'pinnedColumns--left', 'pinnedColumns--right', 'pinnedColumnHeaders', 'pinnedColumnHeaders--left', 'pinnedColumnHeaders--right', 'withBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle']);
|
|
5
|
+
export var gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'autoHeight', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--withRenderer', 'cell', 'cellContent', 'cellCheckbox', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderDropZone', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeaders', 'columnHeadersInner', 'columnHeadersInner--scrollable', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsPanel', 'columnsPanelRow', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filterForm', 'filterFormDeleteIcon', 'filterFormLinkOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'iconButtonContainer', 'iconSeparator', 'main', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'row', 'row--editable', 'row--editing', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'pinnedColumns--left', 'pinnedColumns--right', 'pinnedColumnHeaders', 'pinnedColumnHeaders--left', 'pinnedColumnHeaders--right', 'withBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle']);
|
|
@@ -117,6 +117,7 @@ export var GRID_DEFAULT_LOCALE_TEXT = {
|
|
|
117
117
|
return "Stop grouping by ".concat(name);
|
|
118
118
|
},
|
|
119
119
|
// Master/detail
|
|
120
|
+
detailPanelToggle: 'Detail panel toggle',
|
|
120
121
|
expandDetailPanel: 'Expand',
|
|
121
122
|
collapseDetailPanel: 'Collapse',
|
|
122
123
|
// Used core components translation keys
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
1
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
4
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
@@ -13,7 +14,7 @@ export var useGridStateInitialization = function useGridStateInitialization(apiR
|
|
|
13
14
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
14
15
|
rawForceUpdate = _React$useState2[1];
|
|
15
16
|
|
|
16
|
-
var
|
|
17
|
+
var registerControlState = React.useCallback(function (controlStateItem) {
|
|
17
18
|
var stateId = controlStateItem.stateId,
|
|
18
19
|
others = _objectWithoutProperties(controlStateItem, _excluded);
|
|
19
20
|
|
|
@@ -21,7 +22,7 @@ export var useGridStateInitialization = function useGridStateInitialization(apiR
|
|
|
21
22
|
stateId: stateId
|
|
22
23
|
});
|
|
23
24
|
}, []);
|
|
24
|
-
var setState = React.useCallback(function (state) {
|
|
25
|
+
var setState = React.useCallback(function (state, reason) {
|
|
25
26
|
var newState;
|
|
26
27
|
|
|
27
28
|
if (isFunction(state)) {
|
|
@@ -83,18 +84,28 @@ export var useGridStateInitialization = function useGridStateInitialization(apiR
|
|
|
83
84
|
|
|
84
85
|
if (controlState.propOnChange && hasPropChanged) {
|
|
85
86
|
var details = props.signature === GridSignature.DataGridPro ? {
|
|
86
|
-
api: apiRef.current
|
|
87
|
-
|
|
87
|
+
api: apiRef.current,
|
|
88
|
+
reason: reason
|
|
89
|
+
} : {
|
|
90
|
+
reason: reason
|
|
91
|
+
};
|
|
88
92
|
controlState.propOnChange(model, details);
|
|
89
93
|
}
|
|
90
94
|
|
|
91
95
|
if (!ignoreSetState) {
|
|
92
|
-
apiRef.current.publishEvent(controlState.changeEvent, model
|
|
96
|
+
apiRef.current.publishEvent(controlState.changeEvent, model, {
|
|
97
|
+
reason: reason
|
|
98
|
+
});
|
|
93
99
|
}
|
|
94
100
|
}
|
|
95
101
|
|
|
96
102
|
return !ignoreSetState;
|
|
97
103
|
}, [apiRef, props.signature]);
|
|
104
|
+
var updateControlState = React.useCallback(function (key, state, reason) {
|
|
105
|
+
return apiRef.current.setState(function (previousState) {
|
|
106
|
+
return _extends({}, previousState, _defineProperty({}, key, state(previousState[key])));
|
|
107
|
+
}, reason);
|
|
108
|
+
}, [apiRef]);
|
|
98
109
|
var forceUpdate = React.useCallback(function () {
|
|
99
110
|
return rawForceUpdate(function () {
|
|
100
111
|
return apiRef.current.state;
|
|
@@ -103,7 +114,8 @@ export var useGridStateInitialization = function useGridStateInitialization(apiR
|
|
|
103
114
|
var stateApi = {
|
|
104
115
|
setState: setState,
|
|
105
116
|
forceUpdate: forceUpdate,
|
|
106
|
-
unstable_updateControlState: updateControlState
|
|
117
|
+
unstable_updateControlState: updateControlState,
|
|
118
|
+
unstable_registerControlState: registerControlState
|
|
107
119
|
};
|
|
108
120
|
useGridApiMethod(apiRef, stateApi, 'GridStateApi');
|
|
109
121
|
};
|
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useGridLogger, useGridApiMethod, useGridApiEventHandler } from '../../utils';
|
|
4
4
|
import { gridColumnMenuSelector } from './columnMenuSelector';
|
|
5
|
+
import { gridClasses } from '../../../constants/gridClasses';
|
|
5
6
|
export var columnMenuStateInitializer = function columnMenuStateInitializer(state) {
|
|
6
7
|
return _extends({}, state, {
|
|
7
8
|
columnMenu: {
|
|
@@ -79,7 +80,28 @@ export var useGridColumnMenu = function useGridColumnMenu(apiRef) {
|
|
|
79
80
|
* EVENTS
|
|
80
81
|
*/
|
|
81
82
|
|
|
83
|
+
var handleColumnHeaderFocus = React.useCallback(function (params, event) {
|
|
84
|
+
// Check if the column menu button received focus
|
|
85
|
+
if (!event.target.classList.contains(gridClasses.menuIconButton)) {
|
|
86
|
+
return;
|
|
87
|
+
} // Check if there's an element which lost focus
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
if (!event.relatedTarget) {
|
|
91
|
+
return;
|
|
92
|
+
} // `true` if the focus was on the column menu itself, not on any item
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
var columnMenuLostFocus = event.relatedTarget.classList.contains(gridClasses.menuList); // `true` if the focus was on an item from the column menu
|
|
96
|
+
|
|
97
|
+
var columnMenuItemLostFocus = event.relatedTarget.getAttribute('role') === 'menuitem';
|
|
98
|
+
|
|
99
|
+
if (columnMenuLostFocus || columnMenuItemLostFocus) {
|
|
100
|
+
apiRef.current.setColumnHeaderFocus(params.field);
|
|
101
|
+
}
|
|
102
|
+
}, [apiRef]);
|
|
82
103
|
useGridApiEventHandler(apiRef, 'columnResizeStart', hideColumnMenu);
|
|
104
|
+
useGridApiEventHandler(apiRef, 'columnHeaderFocus', handleColumnHeaderFocus);
|
|
83
105
|
useGridApiEventHandler(apiRef, 'virtualScrollerWheel', apiRef.current.hideColumnMenu);
|
|
84
106
|
useGridApiEventHandler(apiRef, 'virtualScrollerTouchMove', apiRef.current.hideColumnMenu);
|
|
85
107
|
};
|