@mui/x-data-grid 7.0.0-beta.6 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +311 -12
- package/DataGrid/DataGrid.js +57 -17
- package/DataGrid/useDataGridComponent.js +3 -0
- package/DataGrid/useDataGridProps.js +6 -7
- package/README.md +1 -1
- package/components/GridColumnHeaders.d.ts +1 -2
- package/components/GridColumnHeaders.js +6 -17
- package/components/GridFooter.js +2 -3
- package/components/GridHeader.js +1 -2
- package/components/GridHeaders.js +1 -4
- package/components/GridPagination.d.ts +6 -5
- package/components/GridPagination.js +14 -11
- package/components/GridRow.d.ts +1 -1
- package/components/GridRow.js +17 -36
- package/components/GridScrollArea.d.ts +10 -0
- package/components/GridScrollArea.js +150 -0
- package/components/base/GridFooterPlaceholder.js +1 -2
- package/components/base/GridOverlays.js +3 -6
- package/components/cell/GridActionsCell.js +4 -6
- package/components/cell/GridActionsCellItem.d.ts +8 -25
- package/components/cell/GridActionsCellItem.js +8 -5
- package/components/cell/GridBooleanCell.d.ts +1 -0
- package/components/cell/GridBooleanCell.js +3 -2
- package/components/cell/GridCell.d.ts +7 -0
- package/components/cell/GridCell.js +18 -11
- package/components/cell/GridEditBooleanCell.js +1 -2
- package/components/cell/GridEditDateCell.js +2 -3
- package/components/cell/GridEditInputCell.js +2 -2
- package/components/cell/GridEditSingleSelectCell.js +5 -8
- package/components/columnHeaders/ColumnHeaderMenuIcon.js +2 -3
- package/components/columnHeaders/GridBaseColumnHeaders.js +1 -0
- package/components/columnHeaders/GridColumnGroupHeader.d.ts +5 -0
- package/components/columnHeaders/GridColumnGroupHeader.js +22 -13
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.js +2 -3
- package/components/columnHeaders/GridColumnHeaderItem.d.ts +5 -0
- package/components/columnHeaders/GridColumnHeaderItem.js +26 -12
- package/components/columnHeaders/GridColumnHeaderSortIcon.js +1 -2
- package/components/columnHeaders/GridColumnHeaderTitle.js +2 -3
- package/components/columnHeaders/GridGenericColumnHeaderItem.d.ts +1 -0
- package/components/columnHeaders/GridGenericColumnHeaderItem.js +7 -6
- package/components/columnSelection/GridCellCheckboxRenderer.js +3 -5
- package/components/columnSelection/GridHeaderCheckbox.js +1 -2
- package/components/columnsManagement/GridColumnsManagement.js +17 -21
- package/components/containers/GridRoot.js +3 -3
- package/components/containers/GridRootStyles.js +12 -20
- package/components/menu/GridMenu.js +4 -6
- package/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
- package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +2 -3
- package/components/panel/GridColumnsPanel.js +1 -2
- package/components/panel/GridPanel.d.ts +1 -10
- package/components/panel/GridPanel.js +1 -2
- package/components/panel/GridPreferencesPanel.js +2 -3
- package/components/panel/filterPanel/GridFilterForm.js +24 -27
- package/components/panel/filterPanel/GridFilterInputBoolean.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputBoolean.js +6 -7
- package/components/panel/filterPanel/GridFilterInputDate.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputDate.js +3 -4
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +11 -15
- package/components/panel/filterPanel/GridFilterInputMultipleValue.js +10 -14
- package/components/panel/filterPanel/GridFilterInputSingleSelect.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +10 -11
- package/components/panel/filterPanel/GridFilterInputValue.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputValue.js +5 -7
- package/components/panel/filterPanel/GridFilterPanel.js +5 -9
- package/components/panel/filterPanel/filterPanelUtils.js +1 -1
- package/components/toolbar/GridToolbarColumnsButton.js +3 -5
- package/components/toolbar/GridToolbarDensitySelector.js +8 -10
- package/components/toolbar/GridToolbarExport.js +2 -2
- package/components/toolbar/GridToolbarExportContainer.js +3 -5
- package/components/toolbar/GridToolbarFilterButton.js +3 -5
- package/components/toolbar/GridToolbarQuickFilter.js +4 -5
- package/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/components/virtualization/GridVirtualScroller.js +6 -1
- package/components/virtualization/GridVirtualScrollerContent.js +1 -2
- package/components/virtualization/GridVirtualScrollerFiller.js +2 -1
- package/components/virtualization/GridVirtualScrollerRenderZone.js +1 -2
- package/constants/gridClasses.d.ts +6 -32
- package/constants/gridClasses.js +1 -1
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +5 -1
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.js +1 -2
- package/hooks/core/useGridApiInitialization.js +4 -6
- package/hooks/features/clipboard/useGridClipboard.js +6 -5
- package/hooks/features/columnGrouping/gridColumnGroupsSelector.js +4 -16
- package/hooks/features/columnGrouping/gridColumnGroupsUtils.js +4 -8
- package/hooks/features/columnGrouping/useGridColumnGrouping.js +12 -23
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +23 -7
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +186 -101
- package/hooks/features/columnMenu/useGridColumnMenuSlots.js +2 -2
- package/hooks/features/columnResize/columnResizeSelector.d.ts +3 -0
- package/hooks/features/columnResize/columnResizeSelector.js +3 -0
- package/hooks/features/columnResize/columnResizeState.d.ts +3 -0
- package/hooks/features/columnResize/columnResizeState.js +1 -0
- package/hooks/features/columnResize/gridColumnResizeApi.d.ts +44 -0
- package/hooks/features/columnResize/gridColumnResizeApi.js +10 -0
- package/hooks/features/columnResize/index.d.ts +3 -0
- package/hooks/features/columnResize/index.js +3 -0
- package/hooks/features/columnResize/useGridColumnResize.d.ts +10 -0
- package/hooks/features/columnResize/useGridColumnResize.js +553 -0
- package/hooks/features/columns/gridColumnsSelector.js +1 -2
- package/hooks/features/columns/gridColumnsUtils.d.ts +0 -9
- package/hooks/features/columns/gridColumnsUtils.js +5 -22
- package/hooks/features/columns/useGridColumnSpanning.js +1 -2
- package/hooks/features/columns/useGridColumns.js +11 -19
- package/hooks/features/density/densitySelector.d.ts +4 -2
- package/hooks/features/density/densitySelector.js +8 -2
- package/hooks/features/density/densityState.d.ts +1 -4
- package/hooks/features/density/useGridDensity.d.ts +2 -4
- package/hooks/features/density/useGridDensity.js +21 -29
- package/hooks/features/dimensions/useGridDimensions.js +7 -10
- package/hooks/features/editing/useGridCellEditing.js +25 -8
- package/hooks/features/editing/useGridEditing.js +1 -2
- package/hooks/features/editing/useGridRowEditing.js +4 -6
- package/hooks/features/export/serializers/csvSerializer.d.ts +2 -0
- package/hooks/features/export/serializers/csvSerializer.js +25 -16
- package/hooks/features/export/useGridCsvExport.js +9 -10
- package/hooks/features/export/useGridPrintExport.js +17 -22
- package/hooks/features/export/utils.js +2 -3
- package/hooks/features/filter/gridFilterSelector.js +15 -22
- package/hooks/features/filter/gridFilterUtils.js +10 -16
- package/hooks/features/filter/useGridFilter.js +9 -15
- package/hooks/features/focus/useGridFocus.js +5 -6
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +1 -0
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +3 -0
- package/hooks/features/headerFiltering/useGridHeaderFiltering.js +23 -5
- package/hooks/features/index.d.ts +1 -0
- package/hooks/features/index.js +1 -0
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +1 -2
- package/hooks/features/pagination/gridPaginationInterfaces.d.ts +19 -2
- package/hooks/features/pagination/gridPaginationSelector.d.ts +5 -0
- package/hooks/features/pagination/gridPaginationSelector.js +9 -4
- package/hooks/features/pagination/useGridPagination.d.ts +1 -6
- package/hooks/features/pagination/useGridPagination.js +9 -158
- package/hooks/features/pagination/useGridPaginationModel.d.ts +11 -0
- package/hooks/features/pagination/useGridPaginationModel.js +165 -0
- package/hooks/features/pagination/useGridRowCount.d.ts +8 -0
- package/hooks/features/pagination/useGridRowCount.js +94 -0
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +7 -12
- package/hooks/features/rowSelection/useGridRowSelection.js +11 -16
- package/hooks/features/rows/gridRowsSelector.js +11 -19
- package/hooks/features/rows/gridRowsUtils.js +7 -9
- package/hooks/features/rows/useGridParamsApi.js +1 -1
- package/hooks/features/rows/useGridRows.js +4 -13
- package/hooks/features/rows/useGridRowsMeta.js +7 -13
- package/hooks/features/scroll/useGridScroll.js +3 -4
- package/hooks/features/sorting/gridSortingSelector.js +4 -7
- package/hooks/features/sorting/useGridSorting.js +8 -14
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +4 -4
- package/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -2
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +3 -3
- package/hooks/features/virtualization/useGridVirtualScroller.js +220 -71
- package/hooks/utils/useGridApiEventHandler.js +5 -10
- package/hooks/utils/useGridNativeEventListener.js +1 -2
- package/hooks/utils/useLazyRef.d.ts +1 -2
- package/hooks/utils/useLazyRef.js +1 -11
- package/hooks/utils/useOnMount.d.ts +1 -2
- package/hooks/utils/useOnMount.js +1 -7
- package/hooks/utils/useTimeout.d.ts +1 -11
- package/hooks/utils/useTimeout.js +1 -36
- package/index.js +1 -1
- package/internals/index.d.ts +3 -1
- package/internals/index.js +2 -1
- package/internals/utils/getPinnedCellOffset.d.ts +3 -0
- package/internals/utils/getPinnedCellOffset.js +17 -0
- package/internals/utils/useProps.js +1 -2
- package/joy/joySlots.js +18 -63
- package/locales/jaJP.js +3 -4
- package/material/index.js +0 -2
- package/models/api/gridApiCommon.d.ts +3 -3
- package/models/api/gridCoreApi.d.ts +1 -5
- package/models/api/gridRowsMetaApi.d.ts +1 -1
- package/models/api/index.d.ts +1 -1
- package/models/api/index.js +0 -1
- package/models/events/gridEventLookup.d.ts +13 -0
- package/models/gridExport.d.ts +6 -0
- package/models/gridHeaderFilteringModel.d.ts +1 -0
- package/models/gridSlotsComponent.d.ts +0 -5
- package/models/gridStateCommunity.d.ts +3 -0
- package/models/params/gridScrollParams.d.ts +5 -3
- package/models/props/DataGridProps.d.ts +58 -28
- package/modern/DataGrid/DataGrid.js +57 -17
- package/modern/DataGrid/useDataGridComponent.js +3 -0
- package/modern/DataGrid/useDataGridProps.js +6 -7
- package/modern/components/GridColumnHeaders.js +6 -17
- package/modern/components/GridHeaders.js +1 -4
- package/modern/components/GridPagination.js +13 -6
- package/modern/components/GridRow.js +4 -19
- package/modern/components/GridScrollArea.js +150 -0
- package/modern/components/cell/GridActionsCell.js +1 -1
- package/modern/components/cell/GridActionsCellItem.js +4 -0
- package/modern/components/cell/GridBooleanCell.js +3 -2
- package/modern/components/cell/GridCell.js +11 -3
- package/modern/components/columnHeaders/GridBaseColumnHeaders.js +1 -0
- package/modern/components/columnHeaders/GridColumnGroupHeader.js +18 -8
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +21 -6
- package/modern/components/columnHeaders/GridGenericColumnHeaderItem.js +6 -5
- package/modern/components/containers/GridRoot.js +3 -3
- package/modern/components/containers/GridRootStyles.js +12 -20
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputDate.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +1 -1
- package/modern/components/toolbar/GridToolbarDensitySelector.js +5 -5
- package/modern/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/modern/components/virtualization/GridVirtualScroller.js +6 -1
- package/modern/components/virtualization/GridVirtualScrollerFiller.js +2 -1
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/features/clipboard/useGridClipboard.js +4 -2
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +184 -97
- package/modern/hooks/features/columnResize/columnResizeSelector.js +3 -0
- package/modern/hooks/features/columnResize/columnResizeState.js +1 -0
- package/modern/hooks/features/columnResize/gridColumnResizeApi.js +10 -0
- package/modern/hooks/features/columnResize/index.js +3 -0
- package/modern/hooks/features/columnResize/useGridColumnResize.js +553 -0
- package/modern/hooks/features/columns/gridColumnsUtils.js +4 -20
- package/modern/hooks/features/density/densitySelector.js +8 -2
- package/modern/hooks/features/density/useGridDensity.js +21 -29
- package/modern/hooks/features/dimensions/useGridDimensions.js +4 -5
- package/modern/hooks/features/editing/useGridCellEditing.js +22 -3
- package/modern/hooks/features/editing/useGridRowEditing.js +1 -1
- package/modern/hooks/features/export/serializers/csvSerializer.js +23 -12
- package/modern/hooks/features/export/useGridCsvExport.js +2 -1
- package/modern/hooks/features/export/useGridPrintExport.js +8 -7
- package/modern/hooks/features/filter/gridFilterUtils.js +1 -1
- package/modern/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +3 -0
- package/modern/hooks/features/headerFiltering/useGridHeaderFiltering.js +21 -2
- package/modern/hooks/features/index.js +1 -0
- package/modern/hooks/features/pagination/gridPaginationSelector.js +8 -2
- package/modern/hooks/features/pagination/useGridPagination.js +8 -149
- package/modern/hooks/features/pagination/useGridPaginationModel.js +165 -0
- package/modern/hooks/features/pagination/useGridRowCount.js +94 -0
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +3 -2
- package/modern/hooks/features/scroll/useGridScroll.js +1 -1
- package/modern/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -2
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +211 -57
- package/modern/hooks/utils/useLazyRef.js +1 -11
- package/modern/hooks/utils/useOnMount.js +1 -7
- package/modern/hooks/utils/useTimeout.js +1 -36
- package/modern/index.js +1 -1
- package/modern/internals/index.js +2 -1
- package/modern/internals/utils/getPinnedCellOffset.js +17 -0
- package/modern/joy/joySlots.js +11 -50
- package/modern/locales/jaJP.js +3 -4
- package/modern/material/index.js +0 -2
- package/modern/models/api/index.js +0 -1
- package/modern/utils/cellBorderUtils.js +8 -0
- package/modern/utils/createSelector.js +1 -1
- package/modern/utils/domUtils.js +144 -0
- package/modern/utils/keyboardUtils.js +1 -1
- package/node/DataGrid/DataGrid.js +57 -17
- package/node/DataGrid/useDataGridComponent.js +3 -0
- package/node/DataGrid/useDataGridProps.js +6 -7
- package/node/components/GridColumnHeaders.js +6 -16
- package/node/components/GridHeaders.js +1 -4
- package/node/components/GridPagination.js +10 -4
- package/node/components/GridRow.js +3 -18
- package/node/components/GridScrollArea.js +158 -0
- package/node/components/cell/GridActionsCell.js +1 -1
- package/node/components/cell/GridActionsCellItem.js +4 -0
- package/node/components/cell/GridBooleanCell.js +3 -2
- package/node/components/cell/GridCell.js +12 -4
- package/node/components/columnHeaders/GridBaseColumnHeaders.js +1 -0
- package/node/components/columnHeaders/GridColumnGroupHeader.js +18 -8
- package/node/components/columnHeaders/GridColumnHeaderItem.js +21 -6
- package/node/components/columnHeaders/GridGenericColumnHeaderItem.js +6 -5
- package/node/components/containers/GridRoot.js +2 -2
- package/node/components/containers/GridRootStyles.js +12 -20
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputDate.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputValue.js +1 -1
- package/node/components/toolbar/GridToolbarDensitySelector.js +4 -4
- package/node/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/node/components/virtualization/GridVirtualScroller.js +6 -1
- package/node/components/virtualization/GridVirtualScrollerFiller.js +2 -1
- package/node/constants/gridClasses.js +1 -1
- package/node/hooks/features/clipboard/useGridClipboard.js +4 -2
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +190 -103
- package/node/hooks/features/columnResize/columnResizeSelector.js +10 -0
- package/node/hooks/features/columnResize/columnResizeState.js +5 -0
- package/node/hooks/features/columnResize/gridColumnResizeApi.js +16 -0
- package/node/hooks/features/columnResize/index.js +38 -0
- package/node/hooks/features/columnResize/useGridColumnResize.js +564 -0
- package/node/hooks/features/columns/gridColumnsUtils.js +4 -21
- package/node/hooks/features/density/densitySelector.js +9 -3
- package/node/hooks/features/density/useGridDensity.js +22 -30
- package/node/hooks/features/dimensions/useGridDimensions.js +4 -5
- package/node/hooks/features/editing/useGridCellEditing.js +22 -3
- package/node/hooks/features/editing/useGridRowEditing.js +1 -1
- package/node/hooks/features/export/serializers/csvSerializer.js +23 -12
- package/node/hooks/features/export/useGridCsvExport.js +2 -1
- package/node/hooks/features/export/useGridPrintExport.js +8 -7
- package/node/hooks/features/filter/gridFilterUtils.js +1 -1
- package/node/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +4 -1
- package/node/hooks/features/headerFiltering/useGridHeaderFiltering.js +21 -2
- package/node/hooks/features/index.js +11 -0
- package/node/hooks/features/pagination/gridPaginationSelector.js +8 -2
- package/node/hooks/features/pagination/useGridPagination.js +9 -153
- package/node/hooks/features/pagination/useGridPaginationModel.js +176 -0
- package/node/hooks/features/pagination/useGridRowCount.js +103 -0
- package/node/hooks/features/rowSelection/useGridRowSelection.js +2 -1
- package/node/hooks/features/scroll/useGridScroll.js +1 -1
- package/node/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -2
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +211 -57
- package/node/hooks/utils/useLazyRef.js +7 -13
- package/node/hooks/utils/useOnMount.js +8 -10
- package/node/hooks/utils/useTimeout.js +7 -37
- package/node/index.js +1 -1
- package/node/internals/index.js +27 -8
- package/node/internals/utils/getPinnedCellOffset.js +24 -0
- package/node/joy/joySlots.js +11 -50
- package/node/locales/jaJP.js +3 -4
- package/node/material/index.js +0 -2
- package/node/models/api/index.js +0 -11
- package/node/utils/cellBorderUtils.js +16 -0
- package/node/utils/createSelector.js +1 -1
- package/node/utils/domUtils.js +155 -0
- package/node/utils/keyboardUtils.js +1 -1
- package/package.json +4 -4
- package/utils/cellBorderUtils.d.ts +3 -0
- package/utils/cellBorderUtils.js +8 -0
- package/utils/createSelector.js +9 -9
- package/utils/domUtils.d.ts +14 -1
- package/utils/domUtils.js +144 -0
- package/utils/getGridLocalization.js +9 -12
- package/utils/keyboardUtils.js +1 -1
- package/components/columnHeaders/GridColumnHeadersInner.d.ts +0 -8
- package/components/columnHeaders/GridColumnHeadersInner.js +0 -58
- package/modern/components/columnHeaders/GridColumnHeadersInner.js +0 -58
- package/node/components/columnHeaders/GridColumnHeadersInner.js +0 -67
|
@@ -97,7 +97,6 @@ const getLogicOperatorLocaleKey = logicOperator => {
|
|
|
97
97
|
const getColumnLabel = col => col.headerName || col.field;
|
|
98
98
|
const collator = new Intl.Collator();
|
|
99
99
|
const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(props, ref) {
|
|
100
|
-
var _filterModel$logicOpe, _rootProps$slotProps, _rootProps$slotProps2, _baseSelectProps$nati, _rootProps$slotProps3, _rootProps$slotProps4, _rootProps$slotProps5, _rootProps$slotProps6, _rootProps$slotProps7, _rootProps$slotProps8, _currentColumn$filter2;
|
|
101
100
|
const {
|
|
102
101
|
item,
|
|
103
102
|
hasMultipleFilters,
|
|
@@ -130,13 +129,13 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
130
129
|
const classes = useUtilityClasses(rootProps);
|
|
131
130
|
const valueRef = React.useRef(null);
|
|
132
131
|
const filterSelectorRef = React.useRef(null);
|
|
133
|
-
const multiFilterOperator =
|
|
132
|
+
const multiFilterOperator = filterModel.logicOperator ?? GridLogicOperator.And;
|
|
134
133
|
const hasLogicOperatorColumn = hasMultipleFilters && logicOperators.length > 0;
|
|
135
|
-
const baseFormControlProps =
|
|
136
|
-
const baseSelectProps =
|
|
137
|
-
const isBaseSelectNative =
|
|
138
|
-
const baseInputLabelProps =
|
|
139
|
-
const baseSelectOptionProps =
|
|
134
|
+
const baseFormControlProps = rootProps.slotProps?.baseFormControl || {};
|
|
135
|
+
const baseSelectProps = rootProps.slotProps?.baseSelect || {};
|
|
136
|
+
const isBaseSelectNative = baseSelectProps.native ?? false;
|
|
137
|
+
const baseInputLabelProps = rootProps.slotProps?.baseInputLabel || {};
|
|
138
|
+
const baseSelectOptionProps = rootProps.slotProps?.baseSelectOption || {};
|
|
140
139
|
const {
|
|
141
140
|
InputComponentProps
|
|
142
141
|
} = valueInputProps,
|
|
@@ -164,7 +163,7 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
164
163
|
const filteredFields = filterColumns({
|
|
165
164
|
field: item.field,
|
|
166
165
|
columns: filterableColumns,
|
|
167
|
-
currentFilters:
|
|
166
|
+
currentFilters: filterModel?.items || []
|
|
168
167
|
});
|
|
169
168
|
return {
|
|
170
169
|
filteredColumns: filterableColumns.filter(column => {
|
|
@@ -176,7 +175,7 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
176
175
|
}),
|
|
177
176
|
selectedField: itemField
|
|
178
177
|
};
|
|
179
|
-
}, [filterColumns, filterModel
|
|
178
|
+
}, [filterColumns, filterModel?.items, filterableColumns, item.field, columnLookup]);
|
|
180
179
|
const sortedFilteredColumns = React.useMemo(() => {
|
|
181
180
|
switch (columnsSort) {
|
|
182
181
|
case 'asc':
|
|
@@ -189,11 +188,10 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
189
188
|
}, [filteredColumns, columnsSort]);
|
|
190
189
|
const currentColumn = item.field ? apiRef.current.getColumn(item.field) : null;
|
|
191
190
|
const currentOperator = React.useMemo(() => {
|
|
192
|
-
var _currentColumn$filter;
|
|
193
191
|
if (!item.operator || !currentColumn) {
|
|
194
192
|
return null;
|
|
195
193
|
}
|
|
196
|
-
return
|
|
194
|
+
return currentColumn.filterOperators?.find(operator => operator.value === item.operator);
|
|
197
195
|
}, [item, currentColumn]);
|
|
198
196
|
const changeColumn = React.useCallback(event => {
|
|
199
197
|
const field = event.target.value;
|
|
@@ -207,7 +205,7 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
207
205
|
const newOperator = column.filterOperators.find(operator => operator.value === item.operator) || column.filterOperators[0];
|
|
208
206
|
|
|
209
207
|
// Erase filter value if the input component or filtered column type is modified
|
|
210
|
-
const eraseFilterValue = !newOperator.InputComponent || newOperator.InputComponent !==
|
|
208
|
+
const eraseFilterValue = !newOperator.InputComponent || newOperator.InputComponent !== currentOperator?.InputComponent || column.type !== currentColumn.type;
|
|
211
209
|
let filterValue = eraseFilterValue ? undefined : item.value;
|
|
212
210
|
|
|
213
211
|
// Check filter value against the new valueOptions
|
|
@@ -218,10 +216,10 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
218
216
|
filterValue = filterValue.filter(val => {
|
|
219
217
|
return (
|
|
220
218
|
// Only keep values that are in the new value options
|
|
221
|
-
getValueFromValueOptions(val, valueOptions, colDef
|
|
219
|
+
getValueFromValueOptions(val, valueOptions, colDef?.getOptionValue) !== undefined
|
|
222
220
|
);
|
|
223
221
|
});
|
|
224
|
-
} else if (getValueFromValueOptions(item.value, valueOptions, colDef
|
|
222
|
+
} else if (getValueFromValueOptions(item.value, valueOptions, colDef?.getOptionValue) === undefined) {
|
|
225
223
|
// Reset the filter value if it is not in the new value options
|
|
226
224
|
filterValue = undefined;
|
|
227
225
|
}
|
|
@@ -234,8 +232,8 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
234
232
|
}, [apiRef, applyFilterChanges, item, currentColumn, currentOperator]);
|
|
235
233
|
const changeOperator = React.useCallback(event => {
|
|
236
234
|
const operator = event.target.value;
|
|
237
|
-
const newOperator = currentColumn
|
|
238
|
-
const eraseItemValue = !
|
|
235
|
+
const newOperator = currentColumn?.filterOperators.find(op => op.value === operator);
|
|
236
|
+
const eraseItemValue = !newOperator?.InputComponent || newOperator?.InputComponent !== currentOperator?.InputComponent;
|
|
239
237
|
applyFilterChanges(_extends({}, item, {
|
|
240
238
|
operator,
|
|
241
239
|
value: eraseItemValue ? undefined : item.value
|
|
@@ -261,9 +259,8 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
261
259
|
};
|
|
262
260
|
React.useImperativeHandle(focusElementRef, () => ({
|
|
263
261
|
focus: () => {
|
|
264
|
-
if (currentOperator
|
|
265
|
-
|
|
266
|
-
valueRef == null || (_valueRef$current = valueRef.current) == null || _valueRef$current.focus();
|
|
262
|
+
if (currentOperator?.InputComponent) {
|
|
263
|
+
valueRef?.current?.focus();
|
|
267
264
|
} else {
|
|
268
265
|
filterSelectorRef.current.focus();
|
|
269
266
|
}
|
|
@@ -287,7 +284,7 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
287
284
|
onClick: handleDeleteFilter,
|
|
288
285
|
size: "small",
|
|
289
286
|
disabled: readOnly
|
|
290
|
-
},
|
|
287
|
+
}, rootProps.slotProps?.baseIconButton, {
|
|
291
288
|
children: /*#__PURE__*/_jsx(rootProps.slots.filterPanelDeleteIcon, {
|
|
292
289
|
fontSize: "small"
|
|
293
290
|
})
|
|
@@ -306,11 +303,11 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
306
303
|
inputProps: {
|
|
307
304
|
'aria-label': apiRef.current.getLocaleText('filterPanelLogicOperator')
|
|
308
305
|
},
|
|
309
|
-
value: multiFilterOperator
|
|
306
|
+
value: multiFilterOperator ?? '',
|
|
310
307
|
onChange: changeLogicOperator,
|
|
311
308
|
disabled: !!disableMultiFilterOperator || logicOperators.length === 1,
|
|
312
309
|
native: isBaseSelectNative
|
|
313
|
-
},
|
|
310
|
+
}, rootProps.slotProps?.baseSelect, {
|
|
314
311
|
children: logicOperators.map(logicOperator => /*#__PURE__*/_createElement(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
315
312
|
native: isBaseSelectNative,
|
|
316
313
|
key: logicOperator.toString(),
|
|
@@ -331,11 +328,11 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
331
328
|
labelId: columnSelectLabelId,
|
|
332
329
|
id: columnSelectId,
|
|
333
330
|
label: apiRef.current.getLocaleText('filterPanelColumns'),
|
|
334
|
-
value: selectedField
|
|
331
|
+
value: selectedField ?? '',
|
|
335
332
|
onChange: changeColumn,
|
|
336
333
|
native: isBaseSelectNative,
|
|
337
334
|
disabled: readOnly
|
|
338
|
-
},
|
|
335
|
+
}, rootProps.slotProps?.baseSelect, {
|
|
339
336
|
children: sortedFilteredColumns.map(col => /*#__PURE__*/_createElement(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
340
337
|
native: isBaseSelectNative,
|
|
341
338
|
key: col.field,
|
|
@@ -361,8 +358,8 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
361
358
|
native: isBaseSelectNative,
|
|
362
359
|
inputRef: filterSelectorRef,
|
|
363
360
|
disabled: readOnly
|
|
364
|
-
},
|
|
365
|
-
children: currentColumn
|
|
361
|
+
}, rootProps.slotProps?.baseSelect, {
|
|
362
|
+
children: currentColumn?.filterOperators?.map(operator => /*#__PURE__*/_createElement(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
366
363
|
native: isBaseSelectNative,
|
|
367
364
|
key: operator.value,
|
|
368
365
|
value: operator.value
|
|
@@ -374,7 +371,7 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
374
371
|
}, baseFormControlProps, valueInputPropsOther, {
|
|
375
372
|
className: clsx(classes.valueInput, baseFormControlProps.className, valueInputPropsOther.className),
|
|
376
373
|
ownerState: rootProps,
|
|
377
|
-
children: currentOperator
|
|
374
|
+
children: currentOperator?.InputComponent ? /*#__PURE__*/_jsx(currentOperator.InputComponent, _extends({
|
|
378
375
|
apiRef: apiRef,
|
|
379
376
|
item: item,
|
|
380
377
|
applyValue: applyFilterChanges,
|
|
@@ -5,7 +5,7 @@ export type GridFilterInputBooleanProps = GridFilterInputValueProps & TextFieldP
|
|
|
5
5
|
clearButton?: React.ReactNode | null;
|
|
6
6
|
/**
|
|
7
7
|
* It is `true` if the filter either has a value or an operator with no value
|
|
8
|
-
* required is selected (
|
|
8
|
+
* required is selected (for example `isEmpty`)
|
|
9
9
|
*/
|
|
10
10
|
isFilterActive?: boolean;
|
|
11
11
|
};
|
|
@@ -17,7 +17,6 @@ const BooleanOperatorContainer = styled('div')({
|
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
function GridFilterInputBoolean(props) {
|
|
20
|
-
var _rootProps$slotProps, _baseSelectProps$nati, _rootProps$slotProps2, _rootProps$slotProps3;
|
|
21
20
|
const {
|
|
22
21
|
item,
|
|
23
22
|
applyValue,
|
|
@@ -33,9 +32,9 @@ function GridFilterInputBoolean(props) {
|
|
|
33
32
|
const rootProps = useGridRootProps();
|
|
34
33
|
const labelId = useId();
|
|
35
34
|
const selectId = useId();
|
|
36
|
-
const baseSelectProps =
|
|
37
|
-
const isSelectNative =
|
|
38
|
-
const baseSelectOptionProps =
|
|
35
|
+
const baseSelectProps = rootProps.slotProps?.baseSelect || {};
|
|
36
|
+
const isSelectNative = baseSelectProps.native ?? false;
|
|
37
|
+
const baseSelectOptionProps = rootProps.slotProps?.baseSelectOption || {};
|
|
39
38
|
const onFilterChange = React.useCallback(event => {
|
|
40
39
|
const value = event.target.value;
|
|
41
40
|
setFilterValueState(value);
|
|
@@ -46,11 +45,11 @@ function GridFilterInputBoolean(props) {
|
|
|
46
45
|
React.useEffect(() => {
|
|
47
46
|
setFilterValueState(item.value || '');
|
|
48
47
|
}, [item.value]);
|
|
49
|
-
const label = labelProp
|
|
48
|
+
const label = labelProp ?? apiRef.current.getLocaleText('filterPanelInputLabel');
|
|
50
49
|
return /*#__PURE__*/_jsxs(BooleanOperatorContainer, {
|
|
51
50
|
children: [/*#__PURE__*/_jsxs(rootProps.slots.baseFormControl, {
|
|
52
51
|
fullWidth: true,
|
|
53
|
-
children: [/*#__PURE__*/_jsx(rootProps.slots.baseInputLabel, _extends({},
|
|
52
|
+
children: [/*#__PURE__*/_jsx(rootProps.slots.baseInputLabel, _extends({}, rootProps.slotProps?.baseInputLabel, {
|
|
54
53
|
id: labelId,
|
|
55
54
|
shrink: true,
|
|
56
55
|
variant: variant,
|
|
@@ -100,7 +99,7 @@ process.env.NODE_ENV !== "production" ? GridFilterInputBoolean.propTypes = {
|
|
|
100
99
|
focusElementRef: refType,
|
|
101
100
|
/**
|
|
102
101
|
* It is `true` if the filter either has a value or an operator with no value
|
|
103
|
-
* required is selected (
|
|
102
|
+
* required is selected (for example `isEmpty`)
|
|
104
103
|
*/
|
|
105
104
|
isFilterActive: PropTypes.bool,
|
|
106
105
|
item: PropTypes.shape({
|
|
@@ -6,7 +6,7 @@ export type GridFilterInputDateProps = GridFilterInputValueProps & TextFieldProp
|
|
|
6
6
|
clearButton?: React.ReactNode | null;
|
|
7
7
|
/**
|
|
8
8
|
* It is `true` if the filter either has a value or an operator with no value
|
|
9
|
-
* required is selected (
|
|
9
|
+
* required is selected (for example `isEmpty`)
|
|
10
10
|
*/
|
|
11
11
|
isFilterActive?: boolean;
|
|
12
12
|
};
|
|
@@ -25,7 +25,6 @@ function convertFilterItemValueToInputValue(itemValue, inputType) {
|
|
|
25
25
|
return dateCopy.toISOString().substring(0, 10);
|
|
26
26
|
}
|
|
27
27
|
function GridFilterInputDate(props) {
|
|
28
|
-
var _rootProps$slotProps;
|
|
29
28
|
const {
|
|
30
29
|
item,
|
|
31
30
|
applyValue,
|
|
@@ -83,9 +82,9 @@ function GridFilterInputDate(props) {
|
|
|
83
82
|
inputProps: _extends({
|
|
84
83
|
max: type === 'datetime-local' ? '9999-12-31T23:59' : '9999-12-31',
|
|
85
84
|
tabIndex
|
|
86
|
-
}, InputProps
|
|
85
|
+
}, InputProps?.inputProps)
|
|
87
86
|
})
|
|
88
|
-
}, other,
|
|
87
|
+
}, other, rootProps.slotProps?.baseTextField));
|
|
89
88
|
}
|
|
90
89
|
process.env.NODE_ENV !== "production" ? GridFilterInputDate.propTypes = {
|
|
91
90
|
// ----------------------------- Warning --------------------------------
|
|
@@ -100,7 +99,7 @@ process.env.NODE_ENV !== "production" ? GridFilterInputDate.propTypes = {
|
|
|
100
99
|
focusElementRef: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.func, PropTypes.object]),
|
|
101
100
|
/**
|
|
102
101
|
* It is `true` if the filter either has a value or an operator with no value
|
|
103
|
-
* required is selected (
|
|
102
|
+
* required is selected (for example `isEmpty`)
|
|
104
103
|
*/
|
|
105
104
|
isFilterActive: PropTypes.bool,
|
|
106
105
|
item: PropTypes.shape({
|
|
@@ -10,7 +10,6 @@ import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
const filter = createFilterOptions();
|
|
12
12
|
function GridFilterInputMultipleSingleSelect(props) {
|
|
13
|
-
var _resolvedColumn, _resolvedColumn2;
|
|
14
13
|
const {
|
|
15
14
|
item,
|
|
16
15
|
applyValue,
|
|
@@ -39,8 +38,8 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
39
38
|
resolvedColumn = column;
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
|
-
const getOptionValue =
|
|
43
|
-
const getOptionLabel =
|
|
41
|
+
const getOptionValue = resolvedColumn?.getOptionValue;
|
|
42
|
+
const getOptionLabel = resolvedColumn?.getOptionLabel;
|
|
44
43
|
const isOptionEqualToValue = React.useCallback((option, value) => getOptionValue(option) === getOptionValue(value), [getOptionValue]);
|
|
45
44
|
const resolvedValueOptions = React.useMemo(() => {
|
|
46
45
|
return getValueOptions(resolvedColumn) || [];
|
|
@@ -81,18 +80,15 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
81
80
|
}, getTagProps({
|
|
82
81
|
index
|
|
83
82
|
})))),
|
|
84
|
-
renderInput: params => {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
type: "singleSelect"
|
|
94
|
-
}, TextFieldProps, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.baseTextField));
|
|
95
|
-
}
|
|
83
|
+
renderInput: params => /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({}, params, {
|
|
84
|
+
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
85
|
+
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
86
|
+
InputLabelProps: _extends({}, params.InputLabelProps, {
|
|
87
|
+
shrink: true
|
|
88
|
+
}),
|
|
89
|
+
inputRef: focusElementRef,
|
|
90
|
+
type: "singleSelect"
|
|
91
|
+
}, TextFieldProps, rootProps.slotProps?.baseTextField))
|
|
96
92
|
}, other));
|
|
97
93
|
}
|
|
98
94
|
process.env.NODE_ENV !== "production" ? GridFilterInputMultipleSingleSelect.propTypes = {
|
|
@@ -32,8 +32,7 @@ function GridFilterInputMultipleValue(props) {
|
|
|
32
32
|
const id = useId();
|
|
33
33
|
const rootProps = useGridRootProps();
|
|
34
34
|
React.useEffect(() => {
|
|
35
|
-
|
|
36
|
-
const itemValue = (_item$value = item.value) != null ? _item$value : [];
|
|
35
|
+
const itemValue = item.value ?? [];
|
|
37
36
|
setFilterValueState(itemValue.map(String));
|
|
38
37
|
}, [item.value]);
|
|
39
38
|
const handleChange = React.useCallback((event, value) => {
|
|
@@ -62,18 +61,15 @@ function GridFilterInputMultipleValue(props) {
|
|
|
62
61
|
}, getTagProps({
|
|
63
62
|
index
|
|
64
63
|
})))),
|
|
65
|
-
renderInput: params => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
type: type || 'text'
|
|
75
|
-
}, TextFieldProps, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.baseTextField));
|
|
76
|
-
}
|
|
64
|
+
renderInput: params => /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({}, params, {
|
|
65
|
+
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
66
|
+
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
67
|
+
InputLabelProps: _extends({}, params.InputLabelProps, {
|
|
68
|
+
shrink: true
|
|
69
|
+
}),
|
|
70
|
+
inputRef: focusElementRef,
|
|
71
|
+
type: type || 'text'
|
|
72
|
+
}, TextFieldProps, rootProps.slotProps?.baseTextField))
|
|
77
73
|
}, other));
|
|
78
74
|
}
|
|
79
75
|
process.env.NODE_ENV !== "production" ? GridFilterInputMultipleValue.propTypes = {
|
|
@@ -5,7 +5,7 @@ export type GridFilterInputSingleSelectProps = GridFilterInputValueProps & TextF
|
|
|
5
5
|
clearButton?: React.ReactNode | null;
|
|
6
6
|
/**
|
|
7
7
|
* It is `true` if the filter either has a value or an operator with no value
|
|
8
|
-
* required is selected (
|
|
8
|
+
* required is selected (for example `isEmpty`)
|
|
9
9
|
*/
|
|
10
10
|
isFilterActive?: boolean;
|
|
11
11
|
type?: 'singleSelect';
|
|
@@ -41,7 +41,6 @@ const SingleSelectOperatorContainer = styled('div')({
|
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
43
|
function GridFilterInputSingleSelect(props) {
|
|
44
|
-
var _item$value, _rootProps$slotProps$, _rootProps$slotProps, _resolvedColumn, _resolvedColumn2, _rootProps$slotProps2, _rootProps$slotProps3, _rootProps$slotProps4;
|
|
45
44
|
const {
|
|
46
45
|
item,
|
|
47
46
|
applyValue,
|
|
@@ -55,11 +54,11 @@ function GridFilterInputSingleSelect(props) {
|
|
|
55
54
|
clearButton
|
|
56
55
|
} = props,
|
|
57
56
|
others = _objectWithoutPropertiesLoose(props, _excluded);
|
|
58
|
-
const filterValue =
|
|
57
|
+
const filterValue = item.value ?? '';
|
|
59
58
|
const id = useId();
|
|
60
59
|
const labelId = useId();
|
|
61
60
|
const rootProps = useGridRootProps();
|
|
62
|
-
const isSelectNative =
|
|
61
|
+
const isSelectNative = rootProps.slotProps?.baseSelect?.native ?? false;
|
|
63
62
|
let resolvedColumn = null;
|
|
64
63
|
if (item.field) {
|
|
65
64
|
const column = apiRef.current.getColumn(item.field);
|
|
@@ -67,8 +66,8 @@ function GridFilterInputSingleSelect(props) {
|
|
|
67
66
|
resolvedColumn = column;
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
|
-
const getOptionValue =
|
|
71
|
-
const getOptionLabel =
|
|
69
|
+
const getOptionValue = resolvedColumn?.getOptionValue;
|
|
70
|
+
const getOptionLabel = resolvedColumn?.getOptionLabel;
|
|
72
71
|
const currentValueOptions = React.useMemo(() => {
|
|
73
72
|
return getValueOptions(resolvedColumn);
|
|
74
73
|
}, [resolvedColumn]);
|
|
@@ -84,11 +83,11 @@ function GridFilterInputSingleSelect(props) {
|
|
|
84
83
|
if (!isSingleSelectColDef(resolvedColumn)) {
|
|
85
84
|
return null;
|
|
86
85
|
}
|
|
87
|
-
const label = labelProp
|
|
86
|
+
const label = labelProp ?? apiRef.current.getLocaleText('filterPanelInputLabel');
|
|
88
87
|
return /*#__PURE__*/_jsxs(SingleSelectOperatorContainer, {
|
|
89
88
|
children: [/*#__PURE__*/_jsxs(rootProps.slots.baseFormControl, {
|
|
90
89
|
fullWidth: true,
|
|
91
|
-
children: [/*#__PURE__*/_jsx(rootProps.slots.baseInputLabel, _extends({},
|
|
90
|
+
children: [/*#__PURE__*/_jsx(rootProps.slots.baseInputLabel, _extends({}, rootProps.slotProps?.baseInputLabel, {
|
|
92
91
|
id: labelId,
|
|
93
92
|
htmlFor: id,
|
|
94
93
|
shrink: true,
|
|
@@ -105,18 +104,18 @@ function GridFilterInputSingleSelect(props) {
|
|
|
105
104
|
inputProps: {
|
|
106
105
|
tabIndex,
|
|
107
106
|
ref: focusElementRef,
|
|
108
|
-
placeholder: placeholder
|
|
107
|
+
placeholder: placeholder ?? apiRef.current.getLocaleText('filterPanelInputPlaceholder')
|
|
109
108
|
},
|
|
110
109
|
native: isSelectNative,
|
|
111
110
|
notched: variant === 'outlined' ? true : undefined
|
|
112
|
-
}, others /* FIXME: typing error */,
|
|
111
|
+
}, others /* FIXME: typing error */, rootProps.slotProps?.baseSelect, {
|
|
113
112
|
children: renderSingleSelectOptions({
|
|
114
113
|
column: resolvedColumn,
|
|
115
114
|
OptionComponent: rootProps.slots.baseSelectOption,
|
|
116
115
|
getOptionLabel,
|
|
117
116
|
getOptionValue,
|
|
118
117
|
isSelectNative,
|
|
119
|
-
baseSelectOptionProps:
|
|
118
|
+
baseSelectOptionProps: rootProps.slotProps?.baseSelectOption
|
|
120
119
|
})
|
|
121
120
|
}))]
|
|
122
121
|
}), clearButton]
|
|
@@ -135,7 +134,7 @@ process.env.NODE_ENV !== "production" ? GridFilterInputSingleSelect.propTypes =
|
|
|
135
134
|
focusElementRef: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.func, PropTypes.object]),
|
|
136
135
|
/**
|
|
137
136
|
* It is `true` if the filter either has a value or an operator with no value
|
|
138
|
-
* required is selected (
|
|
137
|
+
* required is selected (for example `isEmpty`)
|
|
139
138
|
*/
|
|
140
139
|
isFilterActive: PropTypes.bool,
|
|
141
140
|
item: PropTypes.shape({
|
|
@@ -6,7 +6,7 @@ export type GridTypeFilterInputValueProps = GridFilterInputValueProps & TextFiel
|
|
|
6
6
|
clearButton?: React.ReactNode | null;
|
|
7
7
|
/**
|
|
8
8
|
* It is `true` if the filter either has a value or an operator with no value
|
|
9
|
-
* required is selected (
|
|
9
|
+
* required is selected (for example `isEmpty`)
|
|
10
10
|
*/
|
|
11
11
|
isFilterActive?: boolean;
|
|
12
12
|
};
|
|
@@ -8,7 +8,6 @@ import { useTimeout } from '../../../hooks/utils/useTimeout';
|
|
|
8
8
|
import { useGridRootProps } from '../../../hooks/utils/useGridRootProps';
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
function GridFilterInputValue(props) {
|
|
11
|
-
var _item$value, _rootProps$slotProps;
|
|
12
11
|
const {
|
|
13
12
|
item,
|
|
14
13
|
applyValue,
|
|
@@ -23,7 +22,7 @@ function GridFilterInputValue(props) {
|
|
|
23
22
|
} = props,
|
|
24
23
|
others = _objectWithoutPropertiesLoose(props, _excluded);
|
|
25
24
|
const filterTimeout = useTimeout();
|
|
26
|
-
const [filterValueState, setFilterValueState] = React.useState(
|
|
25
|
+
const [filterValueState, setFilterValueState] = React.useState(item.value ?? '');
|
|
27
26
|
const [applying, setIsApplying] = React.useState(false);
|
|
28
27
|
const id = useId();
|
|
29
28
|
const rootProps = useGridRootProps();
|
|
@@ -45,8 +44,7 @@ function GridFilterInputValue(props) {
|
|
|
45
44
|
React.useEffect(() => {
|
|
46
45
|
const itemPlusTag = item;
|
|
47
46
|
if (itemPlusTag.fromInput !== id || item.value === undefined) {
|
|
48
|
-
|
|
49
|
-
setFilterValueState(String((_item$value2 = item.value) != null ? _item$value2 : ''));
|
|
47
|
+
setFilterValueState(String(item.value ?? ''));
|
|
50
48
|
}
|
|
51
49
|
}, [id, item]);
|
|
52
50
|
return /*#__PURE__*/_jsx(rootProps.slots.baseTextField, _extends({
|
|
@@ -67,13 +65,13 @@ function GridFilterInputValue(props) {
|
|
|
67
65
|
}, InputProps, {
|
|
68
66
|
inputProps: _extends({
|
|
69
67
|
tabIndex
|
|
70
|
-
}, InputProps
|
|
68
|
+
}, InputProps?.inputProps)
|
|
71
69
|
}),
|
|
72
70
|
InputLabelProps: {
|
|
73
71
|
shrink: true
|
|
74
72
|
},
|
|
75
73
|
inputRef: focusElementRef
|
|
76
|
-
}, others,
|
|
74
|
+
}, others, rootProps.slotProps?.baseTextField));
|
|
77
75
|
}
|
|
78
76
|
process.env.NODE_ENV !== "production" ? GridFilterInputValue.propTypes = {
|
|
79
77
|
// ----------------------------- Warning --------------------------------
|
|
@@ -88,7 +86,7 @@ process.env.NODE_ENV !== "production" ? GridFilterInputValue.propTypes = {
|
|
|
88
86
|
focusElementRef: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.func, PropTypes.object]),
|
|
89
87
|
/**
|
|
90
88
|
* It is `true` if the filter either has a value or an operator with no value
|
|
91
|
-
* required is selected (
|
|
89
|
+
* required is selected (for example `isEmpty`)
|
|
92
90
|
*/
|
|
93
91
|
isFilterActive: PropTypes.bool,
|
|
94
92
|
item: PropTypes.shape({
|
|
@@ -21,7 +21,6 @@ const getGridFilter = col => ({
|
|
|
21
21
|
id: Math.round(Math.random() * 1e5)
|
|
22
22
|
});
|
|
23
23
|
const GridFilterPanel = /*#__PURE__*/React.forwardRef(function GridFilterPanel(props, ref) {
|
|
24
|
-
var _rootProps$slotProps, _rootProps$slotProps2;
|
|
25
24
|
const apiRef = useGridApiContext();
|
|
26
25
|
const rootProps = useGridRootProps();
|
|
27
26
|
const filterModel = useGridSelector(apiRef, gridFilterModelSelector);
|
|
@@ -47,7 +46,7 @@ const GridFilterPanel = /*#__PURE__*/React.forwardRef(function GridFilterPanel(p
|
|
|
47
46
|
if (getColumnForNewFilter && typeof getColumnForNewFilter === 'function') {
|
|
48
47
|
// To allow override the column for default (first) filter
|
|
49
48
|
const nextFieldName = getColumnForNewFilter({
|
|
50
|
-
currentFilters:
|
|
49
|
+
currentFilters: filterModel?.items || [],
|
|
51
50
|
columns: filterableColumns
|
|
52
51
|
});
|
|
53
52
|
if (nextFieldName === null) {
|
|
@@ -57,16 +56,13 @@ const GridFilterPanel = /*#__PURE__*/React.forwardRef(function GridFilterPanel(p
|
|
|
57
56
|
field
|
|
58
57
|
}) => field === nextFieldName);
|
|
59
58
|
} else {
|
|
60
|
-
nextColumnWithOperator = filterableColumns.find(colDef =>
|
|
61
|
-
var _colDef$filterOperato;
|
|
62
|
-
return (_colDef$filterOperato = colDef.filterOperators) == null ? void 0 : _colDef$filterOperato.length;
|
|
63
|
-
});
|
|
59
|
+
nextColumnWithOperator = filterableColumns.find(colDef => colDef.filterOperators?.length);
|
|
64
60
|
}
|
|
65
61
|
if (!nextColumnWithOperator) {
|
|
66
62
|
return null;
|
|
67
63
|
}
|
|
68
64
|
return getGridFilter(nextColumnWithOperator);
|
|
69
|
-
}, [filterModel
|
|
65
|
+
}, [filterModel?.items, filterableColumns, getColumnForNewFilter]);
|
|
70
66
|
const getNewFilter = React.useCallback(() => {
|
|
71
67
|
if (getColumnForNewFilter === undefined || typeof getColumnForNewFilter !== 'function') {
|
|
72
68
|
return getDefaultFilter();
|
|
@@ -178,12 +174,12 @@ const GridFilterPanel = /*#__PURE__*/React.forwardRef(function GridFilterPanel(p
|
|
|
178
174
|
children: [!disableAddFilterButton ? /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
179
175
|
onClick: addNewFilter,
|
|
180
176
|
startIcon: /*#__PURE__*/_jsx(rootProps.slots.filterPanelAddIcon, {})
|
|
181
|
-
},
|
|
177
|
+
}, rootProps.slotProps?.baseButton, {
|
|
182
178
|
children: apiRef.current.getLocaleText('filterPanelAddFilter')
|
|
183
179
|
})) : /*#__PURE__*/_jsx("span", {}), !disableRemoveAllButton && validFilters.length > 0 ? /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
184
180
|
onClick: handleRemoveAll,
|
|
185
181
|
startIcon: /*#__PURE__*/_jsx(rootProps.slots.filterPanelRemoveAllIcon, {})
|
|
186
|
-
},
|
|
182
|
+
}, rootProps.slotProps?.baseButton, {
|
|
187
183
|
children: apiRef.current.getLocaleText('filterPanelRemoveAll')
|
|
188
184
|
})) : null]
|
|
189
185
|
}) : null]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
export function isSingleSelectColDef(colDef) {
|
|
3
|
-
return
|
|
3
|
+
return colDef?.type === 'singleSelect';
|
|
4
4
|
}
|
|
5
5
|
export function getValueOptions(column, additionalParams) {
|
|
6
6
|
if (!column) {
|
|
@@ -9,7 +9,6 @@ import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
|
9
9
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
const GridToolbarColumnsButton = /*#__PURE__*/React.forwardRef(function GridToolbarColumnsButton(props, ref) {
|
|
12
|
-
var _rootProps$slotProps, _rootProps$slotProps2;
|
|
13
12
|
const {
|
|
14
13
|
slotProps = {}
|
|
15
14
|
} = props;
|
|
@@ -21,13 +20,12 @@ const GridToolbarColumnsButton = /*#__PURE__*/React.forwardRef(function GridTool
|
|
|
21
20
|
const rootProps = useGridRootProps();
|
|
22
21
|
const preferencePanel = useGridSelector(apiRef, gridPreferencePanelStateSelector);
|
|
23
22
|
const showColumns = event => {
|
|
24
|
-
var _buttonProps$onClick;
|
|
25
23
|
if (preferencePanel.open && preferencePanel.openedPanelValue === GridPreferencePanelsValue.columns) {
|
|
26
24
|
apiRef.current.hidePreferences();
|
|
27
25
|
} else {
|
|
28
26
|
apiRef.current.showPreferences(GridPreferencePanelsValue.columns, columnPanelId, columnButtonId);
|
|
29
27
|
}
|
|
30
|
-
|
|
28
|
+
buttonProps.onClick?.(event);
|
|
31
29
|
};
|
|
32
30
|
|
|
33
31
|
// Disable the button if the corresponding is disabled
|
|
@@ -38,7 +36,7 @@ const GridToolbarColumnsButton = /*#__PURE__*/React.forwardRef(function GridTool
|
|
|
38
36
|
return /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, _extends({
|
|
39
37
|
title: apiRef.current.getLocaleText('toolbarColumnsLabel'),
|
|
40
38
|
enterDelay: 1000
|
|
41
|
-
}, tooltipProps,
|
|
39
|
+
}, tooltipProps, rootProps.slotProps?.baseTooltip, {
|
|
42
40
|
children: /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
43
41
|
ref: ref,
|
|
44
42
|
id: columnButtonId,
|
|
@@ -50,7 +48,7 @@ const GridToolbarColumnsButton = /*#__PURE__*/React.forwardRef(function GridTool
|
|
|
50
48
|
startIcon: /*#__PURE__*/_jsx(rootProps.slots.columnSelectorIcon, {})
|
|
51
49
|
}, buttonProps, {
|
|
52
50
|
onClick: showColumns
|
|
53
|
-
},
|
|
51
|
+
}, rootProps.slotProps?.baseButton, {
|
|
54
52
|
children: apiRef.current.getLocaleText('toolbarColumns')
|
|
55
53
|
}))
|
|
56
54
|
}));
|