@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
|
@@ -5,10 +5,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.GridFilterForm =
|
|
8
|
+
exports.GridFilterForm = void 0;
|
|
9
9
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
|
|
12
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
13
|
+
|
|
12
14
|
var React = _interopRequireWildcard(require("react"));
|
|
13
15
|
|
|
14
16
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -43,6 +45,8 @@ var _gridClasses = require("../../../constants/gridClasses");
|
|
|
43
45
|
|
|
44
46
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
45
47
|
|
|
48
|
+
const _excluded = ["item", "hasMultipleFilters", "deleteFilter", "applyFilterChanges", "multiFilterOperator", "showMultiFilterOperators", "disableMultiFilterOperator", "applyMultiFilterOperatorChanges", "focusElementRef", "linkOperators", "columnsSort", "deleteIconProps", "linkOperatorInputProps", "operatorInputProps", "columnInputProps", "valueInputProps", "children"];
|
|
49
|
+
|
|
46
50
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
47
51
|
|
|
48
52
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -131,8 +135,7 @@ const getLinkOperatorLocaleKey = linkOperator => {
|
|
|
131
135
|
const getColumnLabel = col => col.headerName || col.field;
|
|
132
136
|
|
|
133
137
|
const collator = new Intl.Collator();
|
|
134
|
-
|
|
135
|
-
function GridFilterForm(props) {
|
|
138
|
+
const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(props, ref) {
|
|
136
139
|
var _rootProps$components, _rootProps$components2, _baseSelectProps$nati, _rootProps$components3, _rootProps$components4, _rootProps$components5, _currentColumn$filter2;
|
|
137
140
|
|
|
138
141
|
const {
|
|
@@ -152,7 +155,8 @@ function GridFilterForm(props) {
|
|
|
152
155
|
operatorInputProps = {},
|
|
153
156
|
columnInputProps = {},
|
|
154
157
|
valueInputProps = {}
|
|
155
|
-
} = props
|
|
158
|
+
} = props,
|
|
159
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
156
160
|
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
157
161
|
const filterableColumns = (0, _useGridSelector.useGridSelector)(apiRef, _gridColumnsSelector.gridFilterableColumnDefinitionsSelector);
|
|
158
162
|
const columnSelectId = (0, _utils.unstable_useId)();
|
|
@@ -252,8 +256,10 @@ function GridFilterForm(props) {
|
|
|
252
256
|
}
|
|
253
257
|
}
|
|
254
258
|
}), [currentOperator]);
|
|
255
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(GridFilterFormRoot, {
|
|
256
|
-
|
|
259
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(GridFilterFormRoot, (0, _extends2.default)({
|
|
260
|
+
ref: ref,
|
|
261
|
+
className: classes.root
|
|
262
|
+
}, other, {
|
|
257
263
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(FilterFormDeleteIcon, (0, _extends2.default)({
|
|
258
264
|
variant: "standard",
|
|
259
265
|
as: rootProps.components.BaseFormControl
|
|
@@ -348,35 +354,111 @@ function GridFilterForm(props) {
|
|
|
348
354
|
focusElementRef: valueRef
|
|
349
355
|
}, currentOperator.InputComponentProps)) : null
|
|
350
356
|
}))]
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
|
|
357
|
+
}));
|
|
358
|
+
});
|
|
359
|
+
exports.GridFilterForm = GridFilterForm;
|
|
354
360
|
process.env.NODE_ENV !== "production" ? GridFilterForm.propTypes = {
|
|
355
361
|
// ----------------------------- Warning --------------------------------
|
|
356
362
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
357
363
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
358
364
|
// ----------------------------------------------------------------------
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Callback called when the operator, column field or value is changed.
|
|
368
|
+
* @param {GridFilterItem} item The updated [[GridFilterItem]].
|
|
369
|
+
*/
|
|
359
370
|
applyFilterChanges: _propTypes.default.func.isRequired,
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Callback called when the logic operator is changed.
|
|
374
|
+
* @param {GridLinkOperator} operator The new logic operator.
|
|
375
|
+
*/
|
|
360
376
|
applyMultiFilterOperatorChanges: _propTypes.default.func.isRequired,
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Props passed to the column input component.
|
|
380
|
+
* @default {}
|
|
381
|
+
*/
|
|
361
382
|
columnInputProps: _propTypes.default.any,
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Changes how the options in the columns selector should be ordered.
|
|
386
|
+
* If not specified, the order is derived from the `columns` prop.
|
|
387
|
+
*/
|
|
362
388
|
columnsSort: _propTypes.default.oneOf(['asc', 'desc']),
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Callback called when the delete button is clicked.
|
|
392
|
+
* @param {GridFilterItem} item The deleted [[GridFilterItem]].
|
|
393
|
+
*/
|
|
363
394
|
deleteFilter: _propTypes.default.func.isRequired,
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* Props passed to the delete icon.
|
|
398
|
+
* @default {}
|
|
399
|
+
*/
|
|
364
400
|
deleteIconProps: _propTypes.default.any,
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* If `true`, disables the logic operator field but still renders it.
|
|
404
|
+
*/
|
|
365
405
|
disableMultiFilterOperator: _propTypes.default.bool,
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* A ref allowing to set imperative focus.
|
|
409
|
+
* It can be passed to the el
|
|
410
|
+
*/
|
|
366
411
|
focusElementRef: _propTypes.default
|
|
367
412
|
/* @typescript-to-proptypes-ignore */
|
|
368
413
|
.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* If `true`, the logic operator field is rendered.
|
|
417
|
+
* The field will be invisible if `showMultiFilterOperators` is also `true`.
|
|
418
|
+
*/
|
|
369
419
|
hasMultipleFilters: _propTypes.default.bool.isRequired,
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* The [[GridFilterItem]] representing this form.
|
|
423
|
+
*/
|
|
370
424
|
item: _propTypes.default.shape({
|
|
371
425
|
columnField: _propTypes.default.string.isRequired,
|
|
372
426
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
373
427
|
operatorValue: _propTypes.default.string,
|
|
374
428
|
value: _propTypes.default.any
|
|
375
429
|
}).isRequired,
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Props passed to the logic operator input component.
|
|
433
|
+
* @default {}
|
|
434
|
+
*/
|
|
376
435
|
linkOperatorInputProps: _propTypes.default.any,
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Sets the available logic operators.
|
|
439
|
+
* @default [GridLinkOperator.And, GridLinkOperator.Or]
|
|
440
|
+
*/
|
|
377
441
|
linkOperators: _propTypes.default.arrayOf(_propTypes.default.oneOf(['and', 'or']).isRequired),
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* The current logic operator applied.
|
|
445
|
+
*/
|
|
378
446
|
multiFilterOperator: _propTypes.default.oneOf(['and', 'or']),
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Props passed to the operator input component.
|
|
450
|
+
* @default {}
|
|
451
|
+
*/
|
|
379
452
|
operatorInputProps: _propTypes.default.any,
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* If `true`, the logic operator field is visible.
|
|
456
|
+
*/
|
|
380
457
|
showMultiFilterOperators: _propTypes.default.bool,
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* Props passed to the value input component.
|
|
461
|
+
* @default {}
|
|
462
|
+
*/
|
|
381
463
|
valueInputProps: _propTypes.default.any
|
|
382
464
|
} : void 0;
|
|
@@ -106,7 +106,6 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
106
106
|
}, [applyValue, item]);
|
|
107
107
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Autocomplete.default, (0, _extends2.default)({
|
|
108
108
|
multiple: true,
|
|
109
|
-
freeSolo: false,
|
|
110
109
|
limitTags: 1,
|
|
111
110
|
options: resolvedValueOptions // TODO: avoid `any`?
|
|
112
111
|
,
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.GridFilterPanel =
|
|
8
|
+
exports.GridFilterPanel = void 0;
|
|
9
9
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
|
|
@@ -39,13 +39,13 @@ var _gridColumnsSelector = require("../../../hooks/features/columns/gridColumnsS
|
|
|
39
39
|
|
|
40
40
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
41
41
|
|
|
42
|
-
const _excluded = ["linkOperators", "columnsSort", "filterFormProps"];
|
|
42
|
+
const _excluded = ["linkOperators", "columnsSort", "filterFormProps", "children"];
|
|
43
43
|
|
|
44
44
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
45
45
|
|
|
46
46
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
47
47
|
|
|
48
|
-
function GridFilterPanel(props) {
|
|
48
|
+
const GridFilterPanel = /*#__PURE__*/React.forwardRef(function GridFilterPanel(props, ref) {
|
|
49
49
|
var _rootProps$components;
|
|
50
50
|
|
|
51
51
|
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
@@ -99,9 +99,7 @@ function GridFilterPanel(props) {
|
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
apiRef.current.
|
|
103
|
-
items: [...items, defaultItem]
|
|
104
|
-
}));
|
|
102
|
+
apiRef.current.upsertFilterItems([...items, defaultItem]);
|
|
105
103
|
};
|
|
106
104
|
|
|
107
105
|
const deleteFilter = React.useCallback(item => {
|
|
@@ -122,7 +120,9 @@ function GridFilterPanel(props) {
|
|
|
122
120
|
lastFilterRef.current.focus();
|
|
123
121
|
}
|
|
124
122
|
}, [items.length]);
|
|
125
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_GridPanelWrapper.GridPanelWrapper, (0, _extends2.default)({
|
|
123
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_GridPanelWrapper.GridPanelWrapper, (0, _extends2.default)({
|
|
124
|
+
ref: ref
|
|
125
|
+
}, other, {
|
|
126
126
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_GridPanelContent.GridPanelContent, {
|
|
127
127
|
children: items.map((item, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridFilterForm.GridFilterForm, (0, _extends2.default)({
|
|
128
128
|
item: item,
|
|
@@ -140,21 +140,29 @@ function GridFilterPanel(props) {
|
|
|
140
140
|
}), !rootProps.disableMultipleColumnsFiltering && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridPanelFooter.GridPanelFooter, {
|
|
141
141
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.components.BaseButton, (0, _extends2.default)({
|
|
142
142
|
onClick: addNewFilter,
|
|
143
|
-
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.GridAddIcon, {})
|
|
144
|
-
color: "primary"
|
|
143
|
+
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.GridAddIcon, {})
|
|
145
144
|
}, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseButton, {
|
|
146
145
|
children: apiRef.current.getLocaleText('filterPanelAddFilter')
|
|
147
146
|
}))
|
|
148
147
|
})]
|
|
149
148
|
}));
|
|
150
|
-
}
|
|
151
|
-
|
|
149
|
+
});
|
|
150
|
+
exports.GridFilterPanel = GridFilterPanel;
|
|
152
151
|
process.env.NODE_ENV !== "production" ? GridFilterPanel.propTypes = {
|
|
153
152
|
// ----------------------------- Warning --------------------------------
|
|
154
153
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
155
154
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
156
155
|
// ----------------------------------------------------------------------
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Changes how the options in the columns selector should be ordered.
|
|
159
|
+
* If not specified, the order is derived from the `columns` prop.
|
|
160
|
+
*/
|
|
157
161
|
columnsSort: _propTypes.default.oneOf(['asc', 'desc']),
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Props passed to each filter form.
|
|
165
|
+
*/
|
|
158
166
|
filterFormProps: _propTypes.default.shape({
|
|
159
167
|
columnInputProps: _propTypes.default.any,
|
|
160
168
|
columnsSort: _propTypes.default.oneOf(['asc', 'desc']),
|
|
@@ -163,6 +171,15 @@ process.env.NODE_ENV !== "production" ? GridFilterPanel.propTypes = {
|
|
|
163
171
|
operatorInputProps: _propTypes.default.any,
|
|
164
172
|
valueInputProps: _propTypes.default.any
|
|
165
173
|
}),
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Sets the available logic operators.
|
|
177
|
+
* @default [GridLinkOperator.And, GridLinkOperator.Or]
|
|
178
|
+
*/
|
|
166
179
|
linkOperators: _propTypes.default.arrayOf(_propTypes.default.oneOf(['and', 'or']).isRequired),
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
183
|
+
*/
|
|
167
184
|
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object])
|
|
168
185
|
} : void 0;
|
|
@@ -63,7 +63,6 @@ const GridToolbarColumnsButton = /*#__PURE__*/React.forwardRef(function GridTool
|
|
|
63
63
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.components.BaseButton, (0, _extends2.default)({
|
|
64
64
|
ref: ref,
|
|
65
65
|
size: "small",
|
|
66
|
-
color: "primary",
|
|
67
66
|
"aria-label": apiRef.current.getLocaleText('toolbarColumnsLabel'),
|
|
68
67
|
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.components.ColumnSelectorIcon, {})
|
|
69
68
|
}, other, {
|
|
@@ -123,7 +123,6 @@ const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
123
123
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
124
124
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.components.BaseButton, (0, _extends2.default)({
|
|
125
125
|
ref: handleRef,
|
|
126
|
-
color: "primary",
|
|
127
126
|
size: "small",
|
|
128
127
|
startIcon: startIcon,
|
|
129
128
|
"aria-label": apiRef.current.getLocaleText('toolbarDensityLabel'),
|
|
@@ -75,7 +75,6 @@ const GridToolbarExportContainer = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
75
75
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
76
76
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.components.BaseButton, (0, _extends2.default)({
|
|
77
77
|
ref: handleRef,
|
|
78
|
-
color: "primary",
|
|
79
78
|
size: "small",
|
|
80
79
|
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.components.ExportIcon, {}),
|
|
81
80
|
"aria-expanded": open ? 'true' : undefined,
|
|
@@ -136,7 +136,6 @@ const GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolb
|
|
|
136
136
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.components.BaseButton, (0, _extends2.default)({
|
|
137
137
|
ref: ref,
|
|
138
138
|
size: "small",
|
|
139
|
-
color: "primary",
|
|
140
139
|
"aria-label": apiRef.current.getLocaleText('toolbarFiltersLabel'),
|
|
141
140
|
startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Badge.default, {
|
|
142
141
|
badgeContent: activeFilters.length,
|
|
@@ -17,6 +17,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
17
17
|
|
|
18
18
|
var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
|
|
19
19
|
|
|
20
|
+
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
21
|
+
|
|
20
22
|
var _styles = require("@mui/material/styles");
|
|
21
23
|
|
|
22
24
|
var _utils = require("@mui/material/utils");
|
|
@@ -25,9 +27,15 @@ var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
|
|
|
25
27
|
|
|
26
28
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
27
29
|
|
|
30
|
+
var _useGridSelector = require("../../hooks/utils/useGridSelector");
|
|
31
|
+
|
|
32
|
+
var _filter = require("../../hooks/features/filter");
|
|
33
|
+
|
|
34
|
+
var _utils2 = require("../../utils/utils");
|
|
35
|
+
|
|
28
36
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
37
|
|
|
30
|
-
const _excluded = ["quickFilterParser", "debounceMs"];
|
|
38
|
+
const _excluded = ["quickFilterParser", "quickFilterFormatter", "debounceMs"];
|
|
31
39
|
|
|
32
40
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
41
|
|
|
@@ -42,27 +50,54 @@ const GridToolbarQuickFilterRoot = (0, _styles.styled)(_TextField.default, {
|
|
|
42
50
|
}) => ({
|
|
43
51
|
width: 'auto',
|
|
44
52
|
paddingBottom: theme.spacing(0.5),
|
|
45
|
-
'&
|
|
46
|
-
|
|
53
|
+
'& input': {
|
|
54
|
+
marginLeft: theme.spacing(0.5)
|
|
47
55
|
},
|
|
48
56
|
'& .MuiInput-underline:before': {
|
|
49
57
|
borderBottom: `1px solid ${theme.palette.divider}`
|
|
58
|
+
},
|
|
59
|
+
[`& input[type=search]::-ms-clear,
|
|
60
|
+
& input[type=search]::-ms-reveal`]: {
|
|
61
|
+
/* clears the 'X' icon from IE */
|
|
62
|
+
display: 'none',
|
|
63
|
+
width: 0,
|
|
64
|
+
height: 0
|
|
65
|
+
},
|
|
66
|
+
[`& input[type="search"]::-webkit-search-decoration,
|
|
67
|
+
& input[type="search"]::-webkit-search-cancel-button,
|
|
68
|
+
& input[type="search"]::-webkit-search-results-button,
|
|
69
|
+
& input[type="search"]::-webkit-search-results-decoration`]: {
|
|
70
|
+
/* clears the 'X' icon from Chrome */
|
|
71
|
+
display: 'none'
|
|
50
72
|
}
|
|
51
73
|
}));
|
|
52
74
|
|
|
53
75
|
const defaultSearchValueParser = searchText => searchText.split(' ').filter(word => word !== '');
|
|
54
76
|
|
|
77
|
+
const defaultSearchValueFormatter = values => values.join(' ');
|
|
78
|
+
|
|
55
79
|
function GridToolbarQuickFilter(props) {
|
|
56
80
|
var _rootProps$components;
|
|
57
81
|
|
|
58
82
|
const {
|
|
59
83
|
quickFilterParser = defaultSearchValueParser,
|
|
84
|
+
quickFilterFormatter = defaultSearchValueFormatter,
|
|
60
85
|
debounceMs = 500
|
|
61
86
|
} = props,
|
|
62
87
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
63
88
|
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
64
89
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
65
|
-
const
|
|
90
|
+
const quickFilterValues = (0, _useGridSelector.useGridSelector)(apiRef, _filter.gridQuickFilterValuesSelector);
|
|
91
|
+
const [searchValue, setSearchValue] = React.useState(() => quickFilterFormatter(quickFilterValues != null ? quickFilterValues : []));
|
|
92
|
+
const [prevQuickFilterValues, setPrevQuickFilterValues] = React.useState(quickFilterValues);
|
|
93
|
+
React.useEffect(() => {
|
|
94
|
+
if (!(0, _utils2.isDeepEqual)(prevQuickFilterValues, quickFilterValues)) {
|
|
95
|
+
// The model of quick filter value has been updated
|
|
96
|
+
setPrevQuickFilterValues(quickFilterValues); // Update the input value if needed to match the new model
|
|
97
|
+
|
|
98
|
+
setSearchValue(prevSearchValue => (0, _utils2.isDeepEqual)(quickFilterParser(prevSearchValue), quickFilterValues) ? prevSearchValue : quickFilterFormatter(quickFilterValues != null ? quickFilterValues : []));
|
|
99
|
+
}
|
|
100
|
+
}, [prevQuickFilterValues, quickFilterValues, quickFilterFormatter, quickFilterParser]);
|
|
66
101
|
const updateSearchValue = React.useCallback(newSearchValue => {
|
|
67
102
|
apiRef.current.setQuickFilterValues(quickFilterParser(newSearchValue));
|
|
68
103
|
}, [apiRef, quickFilterParser]);
|
|
@@ -72,6 +107,10 @@ function GridToolbarQuickFilter(props) {
|
|
|
72
107
|
setSearchValue(newSearchValue);
|
|
73
108
|
debouncedUpdateSearchValue(newSearchValue);
|
|
74
109
|
}, [debouncedUpdateSearchValue]);
|
|
110
|
+
const handleSearchReset = React.useCallback(() => {
|
|
111
|
+
setSearchValue('');
|
|
112
|
+
updateSearchValue('');
|
|
113
|
+
}, [updateSearchValue]);
|
|
75
114
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridToolbarQuickFilterRoot, (0, _extends2.default)({
|
|
76
115
|
as: rootProps.components.BaseTextField,
|
|
77
116
|
variant: "standard",
|
|
@@ -83,6 +122,17 @@ function GridToolbarQuickFilter(props) {
|
|
|
83
122
|
InputProps: {
|
|
84
123
|
startAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.components.QuickFilterIcon, {
|
|
85
124
|
fontSize: "small"
|
|
125
|
+
}),
|
|
126
|
+
endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
|
|
127
|
+
"aria-label": apiRef.current.getLocaleText('toolbarQuickFilterDeleteIconLabel'),
|
|
128
|
+
size: "small",
|
|
129
|
+
sx: {
|
|
130
|
+
visibility: searchValue ? 'visible' : 'hidden'
|
|
131
|
+
},
|
|
132
|
+
onClick: handleSearchReset,
|
|
133
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.components.QuickFilterClearIcon, {
|
|
134
|
+
fontSize: "small"
|
|
135
|
+
})
|
|
86
136
|
})
|
|
87
137
|
}
|
|
88
138
|
}, other, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.baseTextField));
|
|
@@ -100,6 +150,13 @@ process.env.NODE_ENV !== "production" ? GridToolbarQuickFilter.propTypes = {
|
|
|
100
150
|
*/
|
|
101
151
|
debounceMs: _propTypes.default.number,
|
|
102
152
|
|
|
153
|
+
/**
|
|
154
|
+
* Function responsible for formatting values of quick filter in a string when the model is modified
|
|
155
|
+
* @param {any[]} values The new values passed to the quick filter model
|
|
156
|
+
* @returns {string} The string to display in the text field
|
|
157
|
+
*/
|
|
158
|
+
quickFilterFormatter: _propTypes.default.func,
|
|
159
|
+
|
|
103
160
|
/**
|
|
104
161
|
* Function responsible for parsing text input in an array of independent values for quick filtering.
|
|
105
162
|
* @param {string} input The value entered by the user
|
|
@@ -57,7 +57,8 @@ const DEFAULT_GRID_ICON_SLOTS_COMPONENTS = {
|
|
|
57
57
|
DetailPanelExpandIcon: _components.GridAddIcon,
|
|
58
58
|
DetailPanelCollapseIcon: _components.GridRemoveIcon,
|
|
59
59
|
RowReorderIcon: _components.GridDragIcon,
|
|
60
|
-
QuickFilterIcon: _components.GridSearchIcon
|
|
60
|
+
QuickFilterIcon: _components.GridSearchIcon,
|
|
61
|
+
QuickFilterClearIcon: _components.GridCloseIcon
|
|
61
62
|
};
|
|
62
63
|
/**
|
|
63
64
|
* TODO: Differentiate community and pro value and interface
|
|
@@ -12,5 +12,5 @@ function getDataGridUtilityClass(slot) {
|
|
|
12
12
|
return (0, _material.generateUtilityClass)('MuiDataGrid', slot);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const gridClasses = (0, _material.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']);
|
|
15
|
+
const gridClasses = (0, _material.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']);
|
|
16
16
|
exports.gridClasses = gridClasses;
|
|
@@ -111,6 +111,7 @@ const GRID_DEFAULT_LOCALE_TEXT = {
|
|
|
111
111
|
groupColumn: name => `Group by ${name}`,
|
|
112
112
|
unGroupColumn: name => `Stop grouping by ${name}`,
|
|
113
113
|
// Master/detail
|
|
114
|
+
detailPanelToggle: 'Detail panel toggle',
|
|
114
115
|
expandDetailPanel: 'Expand',
|
|
115
116
|
collapseDetailPanel: 'Collapse',
|
|
116
117
|
// Used core components translation keys
|
|
@@ -28,7 +28,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
28
28
|
const useGridStateInitialization = (apiRef, props) => {
|
|
29
29
|
const controlStateMapRef = React.useRef({});
|
|
30
30
|
const [, rawForceUpdate] = React.useState();
|
|
31
|
-
const
|
|
31
|
+
const registerControlState = React.useCallback(controlStateItem => {
|
|
32
32
|
const {
|
|
33
33
|
stateId
|
|
34
34
|
} = controlStateItem,
|
|
@@ -37,7 +37,7 @@ const useGridStateInitialization = (apiRef, props) => {
|
|
|
37
37
|
stateId
|
|
38
38
|
});
|
|
39
39
|
}, []);
|
|
40
|
-
const setState = React.useCallback(state => {
|
|
40
|
+
const setState = React.useCallback((state, reason) => {
|
|
41
41
|
let newState;
|
|
42
42
|
|
|
43
43
|
if ((0, _utils2.isFunction)(state)) {
|
|
@@ -98,23 +98,36 @@ const useGridStateInitialization = (apiRef, props) => {
|
|
|
98
98
|
|
|
99
99
|
if (controlState.propOnChange && hasPropChanged) {
|
|
100
100
|
const details = props.signature === _useGridApiEventHandler.GridSignature.DataGridPro ? {
|
|
101
|
-
api: apiRef.current
|
|
102
|
-
|
|
101
|
+
api: apiRef.current,
|
|
102
|
+
reason
|
|
103
|
+
} : {
|
|
104
|
+
reason
|
|
105
|
+
};
|
|
103
106
|
controlState.propOnChange(model, details);
|
|
104
107
|
}
|
|
105
108
|
|
|
106
109
|
if (!ignoreSetState) {
|
|
107
|
-
apiRef.current.publishEvent(controlState.changeEvent, model
|
|
110
|
+
apiRef.current.publishEvent(controlState.changeEvent, model, {
|
|
111
|
+
reason
|
|
112
|
+
});
|
|
108
113
|
}
|
|
109
114
|
}
|
|
110
115
|
|
|
111
116
|
return !ignoreSetState;
|
|
112
117
|
}, [apiRef, props.signature]);
|
|
118
|
+
const updateControlState = React.useCallback((key, state, reason) => {
|
|
119
|
+
return apiRef.current.setState(previousState => {
|
|
120
|
+
return (0, _extends2.default)({}, previousState, {
|
|
121
|
+
[key]: state(previousState[key])
|
|
122
|
+
});
|
|
123
|
+
}, reason);
|
|
124
|
+
}, [apiRef]);
|
|
113
125
|
const forceUpdate = React.useCallback(() => rawForceUpdate(() => apiRef.current.state), [apiRef]);
|
|
114
126
|
const stateApi = {
|
|
115
127
|
setState,
|
|
116
128
|
forceUpdate,
|
|
117
|
-
unstable_updateControlState: updateControlState
|
|
129
|
+
unstable_updateControlState: updateControlState,
|
|
130
|
+
unstable_registerControlState: registerControlState
|
|
118
131
|
};
|
|
119
132
|
(0, _utils.useGridApiMethod)(apiRef, stateApi, 'GridStateApi');
|
|
120
133
|
};
|
|
@@ -15,6 +15,8 @@ var _utils = require("../../utils");
|
|
|
15
15
|
|
|
16
16
|
var _columnMenuSelector = require("./columnMenuSelector");
|
|
17
17
|
|
|
18
|
+
var _gridClasses = require("../../../constants/gridClasses");
|
|
19
|
+
|
|
18
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
21
|
|
|
20
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -97,7 +99,28 @@ const useGridColumnMenu = apiRef => {
|
|
|
97
99
|
* EVENTS
|
|
98
100
|
*/
|
|
99
101
|
|
|
102
|
+
const handleColumnHeaderFocus = React.useCallback((params, event) => {
|
|
103
|
+
// Check if the column menu button received focus
|
|
104
|
+
if (!event.target.classList.contains(_gridClasses.gridClasses.menuIconButton)) {
|
|
105
|
+
return;
|
|
106
|
+
} // Check if there's an element which lost focus
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
if (!event.relatedTarget) {
|
|
110
|
+
return;
|
|
111
|
+
} // `true` if the focus was on the column menu itself, not on any item
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
const columnMenuLostFocus = event.relatedTarget.classList.contains(_gridClasses.gridClasses.menuList); // `true` if the focus was on an item from the column menu
|
|
115
|
+
|
|
116
|
+
const columnMenuItemLostFocus = event.relatedTarget.getAttribute('role') === 'menuitem';
|
|
117
|
+
|
|
118
|
+
if (columnMenuLostFocus || columnMenuItemLostFocus) {
|
|
119
|
+
apiRef.current.setColumnHeaderFocus(params.field);
|
|
120
|
+
}
|
|
121
|
+
}, [apiRef]);
|
|
100
122
|
(0, _utils.useGridApiEventHandler)(apiRef, 'columnResizeStart', hideColumnMenu);
|
|
123
|
+
(0, _utils.useGridApiEventHandler)(apiRef, 'columnHeaderFocus', handleColumnHeaderFocus);
|
|
101
124
|
(0, _utils.useGridApiEventHandler)(apiRef, 'virtualScrollerWheel', apiRef.current.hideColumnMenu);
|
|
102
125
|
(0, _utils.useGridApiEventHandler)(apiRef, 'virtualScrollerTouchMove', apiRef.current.hideColumnMenu);
|
|
103
126
|
};
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.useGridColumnSpanning = void 0;
|
|
9
7
|
|
|
10
|
-
var
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
9
|
|
|
12
10
|
var _useGridApiMethod = require("../../utils/useGridApiMethod");
|
|
13
11
|
|
|
14
12
|
var _useGridApiEventHandler = require("../../utils/useGridApiEventHandler");
|
|
15
13
|
|
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
+
|
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
+
|
|
16
18
|
/**
|
|
17
19
|
* @requires useGridColumns (method, event)
|
|
18
20
|
* @requires useGridParamsApi (method)
|
|
19
21
|
*/
|
|
20
22
|
const useGridColumnSpanning = apiRef => {
|
|
21
|
-
const lookup =
|
|
22
|
-
|
|
23
|
-
const setCellColSpanInfo = _react.default.useCallback((rowId, columnIndex, cellColSpanInfo) => {
|
|
23
|
+
const lookup = React.useRef({});
|
|
24
|
+
const setCellColSpanInfo = React.useCallback((rowId, columnIndex, cellColSpanInfo) => {
|
|
24
25
|
const sizes = lookup.current;
|
|
25
26
|
|
|
26
27
|
if (!sizes[rowId]) {
|
|
@@ -29,15 +30,13 @@ const useGridColumnSpanning = apiRef => {
|
|
|
29
30
|
|
|
30
31
|
sizes[rowId][columnIndex] = cellColSpanInfo;
|
|
31
32
|
}, []);
|
|
32
|
-
|
|
33
|
-
const getCellColSpanInfo = _react.default.useCallback((rowId, columnIndex) => {
|
|
33
|
+
const getCellColSpanInfo = React.useCallback((rowId, columnIndex) => {
|
|
34
34
|
var _lookup$current$rowId;
|
|
35
35
|
|
|
36
36
|
return (_lookup$current$rowId = lookup.current[rowId]) == null ? void 0 : _lookup$current$rowId[columnIndex];
|
|
37
37
|
}, []); // Calculate `colSpan` for the cell.
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
const calculateCellColSpan = _react.default.useCallback(params => {
|
|
39
|
+
const calculateCellColSpan = React.useCallback(params => {
|
|
41
40
|
const {
|
|
42
41
|
columnIndex,
|
|
43
42
|
rowId,
|
|
@@ -91,8 +90,7 @@ const useGridColumnSpanning = apiRef => {
|
|
|
91
90
|
};
|
|
92
91
|
}, [apiRef, setCellColSpanInfo]); // Calculate `colSpan` for each cell in the row
|
|
93
92
|
|
|
94
|
-
|
|
95
|
-
const calculateColSpan = _react.default.useCallback(({
|
|
93
|
+
const calculateColSpan = React.useCallback(({
|
|
96
94
|
rowId,
|
|
97
95
|
minFirstColumn,
|
|
98
96
|
maxLastColumn
|
|
@@ -110,18 +108,15 @@ const useGridColumnSpanning = apiRef => {
|
|
|
110
108
|
}
|
|
111
109
|
}
|
|
112
110
|
}, [calculateCellColSpan]);
|
|
113
|
-
|
|
114
111
|
const columnSpanningApi = {
|
|
115
112
|
unstable_getCellColSpanInfo: getCellColSpanInfo,
|
|
116
113
|
unstable_calculateColSpan: calculateColSpan
|
|
117
114
|
};
|
|
118
115
|
(0, _useGridApiMethod.useGridApiMethod)(apiRef, columnSpanningApi, 'GridColumnSpanningAPI');
|
|
119
|
-
|
|
120
|
-
const handleColumnReorderChange = _react.default.useCallback(() => {
|
|
116
|
+
const handleColumnReorderChange = React.useCallback(() => {
|
|
121
117
|
// `colSpan` needs to be recalculated after column reordering
|
|
122
118
|
lookup.current = {};
|
|
123
119
|
}, []);
|
|
124
|
-
|
|
125
120
|
(0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'columnOrderChange', handleColumnReorderChange);
|
|
126
121
|
};
|
|
127
122
|
|