@mui/x-data-grid 7.0.0-beta.2 → 7.0.0-beta.4
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 +298 -23
- package/DataGrid/DataGrid.js +0 -6
- package/colDef/gridActionsColDef.js +1 -0
- package/colDef/gridBooleanColDef.js +1 -0
- package/colDef/gridCheckboxSelectionColDef.js +1 -0
- package/components/GridRow.d.ts +3 -1
- package/components/GridRow.js +10 -2
- package/components/GridScrollbarFillerCell.js +6 -21
- package/components/cell/GridCell.js +10 -12
- package/components/columnSelection/GridCellCheckboxRenderer.js +1 -2
- package/components/containers/GridRootStyles.js +51 -23
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputBoolean.js +6 -4
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +8 -2
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +6 -4
- package/components/panel/filterPanel/GridFilterInputValue.js +4 -3
- package/components/virtualization/GridVirtualScrollerRenderZone.js +10 -3
- package/constants/gridClasses.d.ts +24 -8
- package/constants/gridClasses.js +1 -1
- package/hooks/features/clipboard/useGridClipboard.js +1 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +5 -5
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +46 -48
- package/hooks/features/editing/useGridCellEditing.js +3 -4
- package/hooks/features/editing/useGridRowEditing.js +3 -4
- package/hooks/features/sorting/useGridSorting.js +1 -2
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +9 -0
- package/hooks/features/virtualization/gridVirtualizationSelectors.js +7 -0
- package/hooks/features/virtualization/useGridVirtualScroller.js +19 -16
- package/hooks/features/virtualization/useGridVirtualization.d.ts +8 -0
- package/hooks/features/virtualization/useGridVirtualization.js +6 -1
- package/index.js +1 -1
- package/internals/index.d.ts +1 -1
- package/internals/index.js +1 -1
- package/models/colDef/gridColDef.d.ts +6 -0
- package/models/events/gridEventLookup.d.ts +1 -8
- package/models/props/DataGridProps.d.ts +0 -6
- package/modern/DataGrid/DataGrid.js +0 -6
- package/modern/colDef/gridActionsColDef.js +1 -0
- package/modern/colDef/gridBooleanColDef.js +1 -0
- package/modern/colDef/gridCheckboxSelectionColDef.js +1 -0
- package/modern/components/GridRow.js +10 -2
- package/modern/components/GridScrollbarFillerCell.js +6 -21
- package/modern/components/cell/GridCell.js +10 -12
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +1 -2
- package/modern/components/containers/GridRootStyles.js +51 -23
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +6 -4
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +8 -2
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +6 -4
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +4 -3
- package/modern/components/virtualization/GridVirtualScrollerRenderZone.js +10 -3
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/features/clipboard/useGridClipboard.js +1 -1
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +46 -48
- package/modern/hooks/features/editing/useGridCellEditing.js +3 -4
- package/modern/hooks/features/editing/useGridRowEditing.js +3 -4
- package/modern/hooks/features/sorting/useGridSorting.js +1 -2
- package/modern/hooks/features/virtualization/gridVirtualizationSelectors.js +7 -0
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +18 -14
- package/modern/hooks/features/virtualization/useGridVirtualization.js +6 -1
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -1
- package/modern/utils/keyboardUtils.js +20 -11
- package/node/DataGrid/DataGrid.js +0 -6
- package/node/colDef/gridActionsColDef.js +1 -0
- package/node/colDef/gridBooleanColDef.js +1 -0
- package/node/colDef/gridCheckboxSelectionColDef.js +1 -0
- package/node/components/GridRow.js +10 -2
- package/node/components/GridScrollbarFillerCell.js +5 -20
- package/node/components/cell/GridCell.js +10 -12
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +1 -2
- package/node/components/containers/GridRootStyles.js +51 -23
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +6 -4
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +8 -2
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +6 -4
- package/node/components/panel/filterPanel/GridFilterInputValue.js +4 -3
- package/node/components/virtualization/GridVirtualScrollerRenderZone.js +10 -3
- package/node/constants/gridClasses.js +1 -1
- package/node/hooks/features/clipboard/useGridClipboard.js +1 -1
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +45 -47
- package/node/hooks/features/editing/useGridCellEditing.js +2 -3
- package/node/hooks/features/editing/useGridRowEditing.js +2 -3
- package/node/hooks/features/sorting/useGridSorting.js +1 -2
- package/node/hooks/features/virtualization/gridVirtualizationSelectors.js +8 -1
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +17 -13
- package/node/hooks/features/virtualization/useGridVirtualization.js +7 -2
- package/node/index.js +1 -1
- package/node/internals/index.js +7 -0
- package/node/utils/keyboardUtils.js +25 -20
- package/package.json +3 -3
- package/utils/keyboardUtils.d.ts +7 -6
- package/utils/keyboardUtils.js +20 -11
- package/legacy/DataGrid/DataGrid.js +0 -670
- package/legacy/DataGrid/index.js +0 -2
- package/legacy/DataGrid/useDataGridComponent.js +0 -81
- package/legacy/DataGrid/useDataGridProps.js +0 -98
- package/legacy/colDef/gridActionsColDef.js +0 -18
- package/legacy/colDef/gridBooleanColDef.js +0 -42
- package/legacy/colDef/gridBooleanOperators.js +0 -16
- package/legacy/colDef/gridCheckboxSelectionColDef.js +0 -33
- package/legacy/colDef/gridDateColDef.js +0 -62
- package/legacy/colDef/gridDateOperators.js +0 -115
- package/legacy/colDef/gridDefaultColumnTypes.js +0 -19
- package/legacy/colDef/gridNumericColDef.js +0 -19
- package/legacy/colDef/gridNumericOperators.js +0 -145
- package/legacy/colDef/gridSingleSelectColDef.js +0 -64
- package/legacy/colDef/gridSingleSelectOperators.js +0 -46
- package/legacy/colDef/gridStringColDef.js +0 -27
- package/legacy/colDef/gridStringOperators.js +0 -112
- package/legacy/colDef/index.js +0 -13
- package/legacy/components/GridApiContext.js +0 -5
- package/legacy/components/GridColumnHeaders.js +0 -94
- package/legacy/components/GridDetailPanels.js +0 -4
- package/legacy/components/GridFooter.js +0 -42
- package/legacy/components/GridHeader.js +0 -13
- package/legacy/components/GridHeaders.js +0 -53
- package/legacy/components/GridLoadingOverlay.js +0 -21
- package/legacy/components/GridNoResultsOverlay.js +0 -14
- package/legacy/components/GridNoRowsOverlay.js +0 -23
- package/legacy/components/GridPagination.js +0 -85
- package/legacy/components/GridPinnedRows.js +0 -4
- package/legacy/components/GridRow.js +0 -457
- package/legacy/components/GridRowCount.js +0 -63
- package/legacy/components/GridScrollbarFillerCell.js +0 -34
- package/legacy/components/GridSelectedRowCount.js +0 -66
- package/legacy/components/base/GridBody.js +0 -2
- package/legacy/components/base/GridFooterPlaceholder.js +0 -12
- package/legacy/components/base/GridOverlays.js +0 -122
- package/legacy/components/base/index.js +0 -3
- package/legacy/components/cell/GridActionsCell.js +0 -294
- package/legacy/components/cell/GridActionsCellItem.js +0 -69
- package/legacy/components/cell/GridBooleanCell.js +0 -121
- package/legacy/components/cell/GridCell.js +0 -350
- package/legacy/components/cell/GridEditBooleanCell.js +0 -174
- package/legacy/components/cell/GridEditDateCell.js +0 -230
- package/legacy/components/cell/GridEditInputCell.js +0 -198
- package/legacy/components/cell/GridEditSingleSelectCell.js +0 -231
- package/legacy/components/cell/GridSkeletonCell.js +0 -52
- package/legacy/components/cell/index.js +0 -9
- package/legacy/components/columnHeaders/ColumnHeaderMenuIcon.js +0 -59
- package/legacy/components/columnHeaders/GridBaseColumnHeaders.js +0 -41
- package/legacy/components/columnHeaders/GridColumnGroupHeader.js +0 -132
- package/legacy/components/columnHeaders/GridColumnHeaderFilterIconButton.js +0 -93
- package/legacy/components/columnHeaders/GridColumnHeaderItem.js +0 -212
- package/legacy/components/columnHeaders/GridColumnHeaderSeparator.js +0 -71
- package/legacy/components/columnHeaders/GridColumnHeaderSortIcon.js +0 -79
- package/legacy/components/columnHeaders/GridColumnHeaderTitle.js +0 -84
- package/legacy/components/columnHeaders/GridColumnHeadersInner.js +0 -55
- package/legacy/components/columnHeaders/GridGenericColumnHeaderItem.js +0 -107
- package/legacy/components/columnHeaders/GridIconButtonContainer.js +0 -41
- package/legacy/components/columnHeaders/index.js +0 -5
- package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +0 -160
- package/legacy/components/columnSelection/GridHeaderCheckbox.js +0 -134
- package/legacy/components/columnSelection/index.js +0 -2
- package/legacy/components/columnsManagement/GridColumnsManagement.js +0 -307
- package/legacy/components/columnsManagement/index.js +0 -1
- package/legacy/components/columnsManagement/utils.js +0 -22
- package/legacy/components/containers/GridFooterContainer.js +0 -50
- package/legacy/components/containers/GridOverlay.js +0 -52
- package/legacy/components/containers/GridRoot.js +0 -79
- package/legacy/components/containers/GridRootStyles.js +0 -398
- package/legacy/components/containers/GridToolbarContainer.js +0 -59
- package/legacy/components/containers/index.js +0 -4
- package/legacy/components/index.js +0 -19
- package/legacy/components/menu/GridMenu.js +0 -132
- package/legacy/components/menu/columnMenu/GridColumnHeaderMenu.js +0 -61
- package/legacy/components/menu/columnMenu/GridColumnMenu.js +0 -81
- package/legacy/components/menu/columnMenu/GridColumnMenuContainer.js +0 -56
- package/legacy/components/menu/columnMenu/GridColumnMenuItemProps.js +0 -1
- package/legacy/components/menu/columnMenu/GridColumnMenuProps.js +0 -1
- package/legacy/components/menu/columnMenu/index.js +0 -9
- package/legacy/components/menu/columnMenu/menuItems/GridColumnMenuColumnsItem.js +0 -21
- package/legacy/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.js +0 -41
- package/legacy/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.js +0 -60
- package/legacy/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.js +0 -41
- package/legacy/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +0 -80
- package/legacy/components/menu/columnMenu/menuItems/index.js +0 -5
- package/legacy/components/menu/index.js +0 -2
- package/legacy/components/panel/GridColumnsPanel.js +0 -22
- package/legacy/components/panel/GridPanel.js +0 -137
- package/legacy/components/panel/GridPanelContent.js +0 -49
- package/legacy/components/panel/GridPanelFooter.js +0 -50
- package/legacy/components/panel/GridPanelHeader.js +0 -48
- package/legacy/components/panel/GridPanelWrapper.js +0 -64
- package/legacy/components/panel/GridPreferencesPanel.js +0 -26
- package/legacy/components/panel/filterPanel/GridFilterForm.js +0 -528
- package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +0 -115
- package/legacy/components/panel/filterPanel/GridFilterInputDate.js +0 -121
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -116
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleValue.js +0 -102
- package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +0 -146
- package/legacy/components/panel/filterPanel/GridFilterInputValue.js +0 -104
- package/legacy/components/panel/filterPanel/GridFilterInputValueProps.js +0 -1
- package/legacy/components/panel/filterPanel/GridFilterPanel.js +0 -264
- package/legacy/components/panel/filterPanel/filterPanelUtils.js +0 -22
- package/legacy/components/panel/filterPanel/index.js +0 -9
- package/legacy/components/panel/index.js +0 -7
- package/legacy/components/reexportable.js +0 -1
- package/legacy/components/toolbar/GridToolbar.js +0 -64
- package/legacy/components/toolbar/GridToolbarColumnsButton.js +0 -68
- package/legacy/components/toolbar/GridToolbarDensitySelector.js +0 -142
- package/legacy/components/toolbar/GridToolbarExport.js +0 -80
- package/legacy/components/toolbar/GridToolbarExportContainer.js +0 -105
- package/legacy/components/toolbar/GridToolbarFilterButton.js +0 -136
- package/legacy/components/toolbar/GridToolbarQuickFilter.js +0 -164
- package/legacy/components/toolbar/index.js +0 -7
- package/legacy/components/virtualization/GridBottomContainer.js +0 -25
- package/legacy/components/virtualization/GridMainContainer.js +0 -20
- package/legacy/components/virtualization/GridTopContainer.js +0 -35
- package/legacy/components/virtualization/GridVirtualScrollbar.js +0 -129
- package/legacy/components/virtualization/GridVirtualScroller.js +0 -93
- package/legacy/components/virtualization/GridVirtualScrollerContent.js +0 -35
- package/legacy/components/virtualization/GridVirtualScrollerFiller.js +0 -70
- package/legacy/components/virtualization/GridVirtualScrollerRenderZone.js +0 -42
- package/legacy/constants/defaultGridSlotsComponents.js +0 -33
- package/legacy/constants/envConstants.js +0 -19
- package/legacy/constants/gridClasses.js +0 -5
- package/legacy/constants/gridDetailPanelToggleField.js +0 -2
- package/legacy/constants/index.js +0 -3
- package/legacy/constants/localeTextConstants.js +0 -158
- package/legacy/context/GridContextProvider.js +0 -21
- package/legacy/context/GridRootPropsContext.js +0 -6
- package/legacy/context/index.js +0 -1
- package/legacy/hooks/core/gridCoreSelector.js +0 -7
- package/legacy/hooks/core/index.js +0 -1
- package/legacy/hooks/core/pipeProcessing/gridPipeProcessingApi.js +0 -1
- package/legacy/hooks/core/pipeProcessing/index.js +0 -4
- package/legacy/hooks/core/pipeProcessing/useGridPipeProcessing.js +0 -114
- package/legacy/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +0 -26
- package/legacy/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +0 -26
- package/legacy/hooks/core/strategyProcessing/gridStrategyProcessingApi.js +0 -1
- package/legacy/hooks/core/strategyProcessing/index.js +0 -3
- package/legacy/hooks/core/strategyProcessing/useGridRegisterStrategyProcessor.js +0 -18
- package/legacy/hooks/core/strategyProcessing/useGridStrategyProcessing.js +0 -116
- package/legacy/hooks/core/useGridApiInitialization.js +0 -124
- package/legacy/hooks/core/useGridInitialization.js +0 -26
- package/legacy/hooks/core/useGridLocaleText.js +0 -12
- package/legacy/hooks/core/useGridLoggerFactory.js +0 -51
- package/legacy/hooks/core/useGridRefs.js +0 -13
- package/legacy/hooks/core/useGridStateInitialization.js +0 -106
- package/legacy/hooks/core/useGridTheme.js +0 -21
- package/legacy/hooks/features/clipboard/useGridClipboard.js +0 -92
- package/legacy/hooks/features/columnGrouping/gridColumnGroupsInterfaces.js +0 -1
- package/legacy/hooks/features/columnGrouping/gridColumnGroupsSelector.js +0 -24
- package/legacy/hooks/features/columnGrouping/gridColumnGroupsUtils.js +0 -92
- package/legacy/hooks/features/columnGrouping/index.js +0 -2
- package/legacy/hooks/features/columnGrouping/useGridColumnGrouping.js +0 -140
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +0 -275
- package/legacy/hooks/features/columnMenu/columnMenuInterfaces.js +0 -1
- package/legacy/hooks/features/columnMenu/columnMenuSelector.js +0 -3
- package/legacy/hooks/features/columnMenu/index.js +0 -2
- package/legacy/hooks/features/columnMenu/useGridColumnMenu.js +0 -108
- package/legacy/hooks/features/columnMenu/useGridColumnMenuSlots.js +0 -71
- package/legacy/hooks/features/columns/gridColumnsInterfaces.js +0 -9
- package/legacy/hooks/features/columns/gridColumnsSelector.js +0 -174
- package/legacy/hooks/features/columns/gridColumnsUtils.js +0 -338
- package/legacy/hooks/features/columns/index.js +0 -2
- package/legacy/hooks/features/columns/useGridColumnSpanning.js +0 -105
- package/legacy/hooks/features/columns/useGridColumns.js +0 -319
- package/legacy/hooks/features/density/densitySelector.js +0 -10
- package/legacy/hooks/features/density/densityState.js +0 -1
- package/legacy/hooks/features/density/index.js +0 -2
- package/legacy/hooks/features/density/useGridDensity.js +0 -48
- package/legacy/hooks/features/dimensions/gridDimensionsApi.js +0 -1
- package/legacy/hooks/features/dimensions/gridDimensionsSelectors.js +0 -3
- package/legacy/hooks/features/dimensions/index.js +0 -2
- package/legacy/hooks/features/dimensions/useGridDimensions.js +0 -302
- package/legacy/hooks/features/editing/gridEditingSelectors.js +0 -4
- package/legacy/hooks/features/editing/useGridCellEditing.js +0 -456
- package/legacy/hooks/features/editing/useGridEditing.js +0 -145
- package/legacy/hooks/features/editing/useGridRowEditing.js +0 -567
- package/legacy/hooks/features/events/useGridEvents.js +0 -23
- package/legacy/hooks/features/export/serializers/csvSerializer.js +0 -155
- package/legacy/hooks/features/export/useGridCsvExport.js +0 -75
- package/legacy/hooks/features/export/useGridPrintExport.js +0 -313
- package/legacy/hooks/features/export/utils.js +0 -49
- package/legacy/hooks/features/filter/gridFilterSelector.js +0 -165
- package/legacy/hooks/features/filter/gridFilterState.js +0 -20
- package/legacy/hooks/features/filter/gridFilterUtils.js +0 -330
- package/legacy/hooks/features/filter/index.js +0 -2
- package/legacy/hooks/features/filter/useGridFilter.js +0 -378
- package/legacy/hooks/features/focus/gridFocusState.js +0 -1
- package/legacy/hooks/features/focus/gridFocusStateSelector.js +0 -31
- package/legacy/hooks/features/focus/index.js +0 -2
- package/legacy/hooks/features/focus/useGridFocus.js +0 -408
- package/legacy/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +0 -10
- package/legacy/hooks/features/headerFiltering/index.js +0 -1
- package/legacy/hooks/features/headerFiltering/useGridHeaderFiltering.js +0 -93
- package/legacy/hooks/features/index.js +0 -16
- package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +0 -565
- package/legacy/hooks/features/pagination/gridPaginationInterfaces.js +0 -1
- package/legacy/hooks/features/pagination/gridPaginationSelector.js +0 -115
- package/legacy/hooks/features/pagination/gridPaginationUtils.js +0 -31
- package/legacy/hooks/features/pagination/index.js +0 -2
- package/legacy/hooks/features/pagination/useGridPagination.js +0 -175
- package/legacy/hooks/features/preferencesPanel/gridPreferencePanelSelector.js +0 -3
- package/legacy/hooks/features/preferencesPanel/gridPreferencePanelState.js +0 -1
- package/legacy/hooks/features/preferencesPanel/gridPreferencePanelsValue.js +0 -6
- package/legacy/hooks/features/preferencesPanel/index.js +0 -3
- package/legacy/hooks/features/preferencesPanel/useGridPreferencesPanel.js +0 -125
- package/legacy/hooks/features/rowSelection/gridRowSelectionSelector.js +0 -19
- package/legacy/hooks/features/rowSelection/index.js +0 -1
- package/legacy/hooks/features/rowSelection/useGridRowSelection.js +0 -419
- package/legacy/hooks/features/rowSelection/useGridRowSelectionPreProcessors.js +0 -45
- package/legacy/hooks/features/rowSelection/utils.js +0 -8
- package/legacy/hooks/features/rows/gridRowsInterfaces.js +0 -1
- package/legacy/hooks/features/rows/gridRowsMetaSelector.js +0 -3
- package/legacy/hooks/features/rows/gridRowsMetaState.js +0 -1
- package/legacy/hooks/features/rows/gridRowsSelector.js +0 -90
- package/legacy/hooks/features/rows/gridRowsUtils.js +0 -294
- package/legacy/hooks/features/rows/index.js +0 -4
- package/legacy/hooks/features/rows/useGridParamsApi.js +0 -142
- package/legacy/hooks/features/rows/useGridRows.js +0 -466
- package/legacy/hooks/features/rows/useGridRowsMeta.js +0 -236
- package/legacy/hooks/features/rows/useGridRowsPreProcessors.js +0 -82
- package/legacy/hooks/features/scroll/useGridScroll.js +0 -133
- package/legacy/hooks/features/sorting/gridSortingSelector.js +0 -56
- package/legacy/hooks/features/sorting/gridSortingState.js +0 -1
- package/legacy/hooks/features/sorting/gridSortingUtils.js +0 -154
- package/legacy/hooks/features/sorting/index.js +0 -2
- package/legacy/hooks/features/sorting/useGridSorting.js +0 -276
- package/legacy/hooks/features/statePersistence/gridStatePersistenceInterface.js +0 -1
- package/legacy/hooks/features/statePersistence/index.js +0 -1
- package/legacy/hooks/features/statePersistence/useGridStatePersistence.js +0 -25
- package/legacy/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -52
- package/legacy/hooks/features/virtualization/index.js +0 -2
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +0 -643
- package/legacy/hooks/features/virtualization/useGridVirtualization.js +0 -58
- package/legacy/hooks/index.js +0 -3
- package/legacy/hooks/utils/index.js +0 -9
- package/legacy/hooks/utils/useFirstRender.js +0 -8
- package/legacy/hooks/utils/useGridApiContext.js +0 -9
- package/legacy/hooks/utils/useGridApiEventHandler.js +0 -105
- package/legacy/hooks/utils/useGridApiMethod.js +0 -11
- package/legacy/hooks/utils/useGridApiRef.js +0 -7
- package/legacy/hooks/utils/useGridAriaAttributes.js +0 -25
- package/legacy/hooks/utils/useGridInitializeState.js +0 -8
- package/legacy/hooks/utils/useGridLogger.js +0 -10
- package/legacy/hooks/utils/useGridNativeEventListener.js +0 -32
- package/legacy/hooks/utils/useGridPrivateApiContext.js +0 -12
- package/legacy/hooks/utils/useGridRootProps.js +0 -9
- package/legacy/hooks/utils/useGridSelector.js +0 -54
- package/legacy/hooks/utils/useGridVisibleRows.js +0 -42
- package/legacy/hooks/utils/useLazyRef.js +0 -11
- package/legacy/hooks/utils/useOnMount.js +0 -7
- package/legacy/hooks/utils/useResizeObserver.js +0 -36
- package/legacy/hooks/utils/useRunOnce.js +0 -18
- package/legacy/hooks/utils/useTimeout.js +0 -38
- package/legacy/index.js +0 -38
- package/legacy/internals/index.js +0 -68
- package/legacy/internals/utils/computeSlots.js +0 -17
- package/legacy/internals/utils/index.js +0 -3
- package/legacy/internals/utils/propValidation.js +0 -21
- package/legacy/internals/utils/useProps.js +0 -32
- package/legacy/joy/icons.js +0 -432
- package/legacy/joy/index.js +0 -2
- package/legacy/joy/joySlots.js +0 -420
- package/legacy/locales/arSD.js +0 -160
- package/legacy/locales/beBY.js +0 -184
- package/legacy/locales/bgBG.js +0 -160
- package/legacy/locales/coreLocales.js +0 -62
- package/legacy/locales/csCZ.js +0 -181
- package/legacy/locales/daDK.js +0 -160
- package/legacy/locales/deDE.js +0 -160
- package/legacy/locales/elGR.js +0 -160
- package/legacy/locales/enUS.js +0 -4
- package/legacy/locales/esES.js +0 -160
- package/legacy/locales/faIR.js +0 -160
- package/legacy/locales/fiFI.js +0 -160
- package/legacy/locales/frFR.js +0 -160
- package/legacy/locales/heIL.js +0 -160
- package/legacy/locales/hrHR.js +0 -160
- package/legacy/locales/huHU.js +0 -160
- package/legacy/locales/index.js +0 -35
- package/legacy/locales/itIT.js +0 -160
- package/legacy/locales/jaJP.js +0 -160
- package/legacy/locales/koKR.js +0 -162
- package/legacy/locales/nbNO.js +0 -162
- package/legacy/locales/nlNL.js +0 -160
- package/legacy/locales/plPL.js +0 -163
- package/legacy/locales/ptBR.js +0 -160
- package/legacy/locales/ptPT.js +0 -160
- package/legacy/locales/roRO.js +0 -160
- package/legacy/locales/ruRU.js +0 -181
- package/legacy/locales/skSK.js +0 -181
- package/legacy/locales/svSE.js +0 -160
- package/legacy/locales/trTR.js +0 -161
- package/legacy/locales/ukUA.js +0 -182
- package/legacy/locales/urPK.js +0 -160
- package/legacy/locales/viVN.js +0 -160
- package/legacy/locales/zhCN.js +0 -160
- package/legacy/locales/zhHK.js +0 -160
- package/legacy/locales/zhTW.js +0 -160
- package/legacy/material/components/MUISelectOption.js +0 -14
- package/legacy/material/icons/GridColumnUnsortedIcon.js +0 -16
- package/legacy/material/icons/index.js +0 -89
- package/legacy/material/index.js +0 -69
- package/legacy/models/api/gridApiCommon.js +0 -1
- package/legacy/models/api/gridApiCommunity.js +0 -1
- package/legacy/models/api/gridCallbackDetails.js +0 -1
- package/legacy/models/api/gridColumnApi.js +0 -1
- package/legacy/models/api/gridColumnGroupingApi.js +0 -1
- package/legacy/models/api/gridColumnMenuApi.js +0 -1
- package/legacy/models/api/gridColumnSpanning.js +0 -1
- package/legacy/models/api/gridCoreApi.js +0 -1
- package/legacy/models/api/gridCsvExportApi.js +0 -1
- package/legacy/models/api/gridDensityApi.js +0 -1
- package/legacy/models/api/gridEditingApi.js +0 -1
- package/legacy/models/api/gridFilterApi.js +0 -1
- package/legacy/models/api/gridFocusApi.js +0 -1
- package/legacy/models/api/gridHeaderFilteringApi.js +0 -1
- package/legacy/models/api/gridLocaleTextApi.js +0 -1
- package/legacy/models/api/gridLoggerApi.js +0 -1
- package/legacy/models/api/gridParamsApi.js +0 -1
- package/legacy/models/api/gridPreferencesPanelApi.js +0 -1
- package/legacy/models/api/gridPrintExportApi.js +0 -1
- package/legacy/models/api/gridRowApi.js +0 -1
- package/legacy/models/api/gridRowSelectionApi.js +0 -1
- package/legacy/models/api/gridRowsMetaApi.js +0 -1
- package/legacy/models/api/gridScrollApi.js +0 -1
- package/legacy/models/api/gridSortApi.js +0 -1
- package/legacy/models/api/gridStateApi.js +0 -1
- package/legacy/models/api/gridVirtualizationApi.js +0 -1
- package/legacy/models/api/index.js +0 -16
- package/legacy/models/colDef/gridColDef.js +0 -1
- package/legacy/models/colDef/gridColType.js +0 -1
- package/legacy/models/colDef/gridColumnTypesRecord.js +0 -1
- package/legacy/models/colDef/index.js +0 -6
- package/legacy/models/controlStateItem.js +0 -1
- package/legacy/models/cursorCoordinates.js +0 -1
- package/legacy/models/elementSize.js +0 -1
- package/legacy/models/events/gridEventListener.js +0 -1
- package/legacy/models/events/gridEventLookup.js +0 -1
- package/legacy/models/events/gridEventPublisher.js +0 -1
- package/legacy/models/events/index.js +0 -3
- package/legacy/models/gridApiCaches.js +0 -1
- package/legacy/models/gridCell.js +0 -1
- package/legacy/models/gridCellClass.js +0 -1
- package/legacy/models/gridColumnGrouping.js +0 -11
- package/legacy/models/gridColumnHeaderClass.js +0 -1
- package/legacy/models/gridColumnSpanning.js +0 -1
- package/legacy/models/gridDensity.js +0 -1
- package/legacy/models/gridEditRowModel.js +0 -16
- package/legacy/models/gridExport.js +0 -1
- package/legacy/models/gridFeatureMode.js +0 -1
- package/legacy/models/gridFilterItem.js +0 -11
- package/legacy/models/gridFilterModel.js +0 -1
- package/legacy/models/gridFilterOperator.js +0 -1
- package/legacy/models/gridHeaderFilteringModel.js +0 -1
- package/legacy/models/gridIconSlotsComponent.js +0 -1
- package/legacy/models/gridPaginationProps.js +0 -1
- package/legacy/models/gridRenderContextProps.js +0 -1
- package/legacy/models/gridRowSelectionModel.js +0 -1
- package/legacy/models/gridRows.js +0 -1
- package/legacy/models/gridSlotsComponent.js +0 -1
- package/legacy/models/gridSlotsComponentsProps.js +0 -1
- package/legacy/models/gridSortModel.js +0 -1
- package/legacy/models/gridStateCommunity.js +0 -1
- package/legacy/models/index.js +0 -29
- package/legacy/models/logger.js +0 -1
- package/legacy/models/muiEvent.js +0 -1
- package/legacy/models/params/gridCellParams.js +0 -1
- package/legacy/models/params/gridColumnGroupHeaderParams.js +0 -1
- package/legacy/models/params/gridColumnHeaderParams.js +0 -1
- package/legacy/models/params/gridColumnOrderChangeParams.js +0 -1
- package/legacy/models/params/gridColumnResizeParams.js +0 -1
- package/legacy/models/params/gridEditCellParams.js +0 -27
- package/legacy/models/params/gridHeaderSelectionCheckboxParams.js +0 -1
- package/legacy/models/params/gridMenuParams.js +0 -1
- package/legacy/models/params/gridPreferencePanelParams.js +0 -1
- package/legacy/models/params/gridRowParams.js +0 -44
- package/legacy/models/params/gridRowSelectionCheckboxParams.js +0 -1
- package/legacy/models/params/gridScrollParams.js +0 -1
- package/legacy/models/params/gridValueOptionsParams.js +0 -1
- package/legacy/models/params/index.js +0 -13
- package/legacy/models/props/DataGridProps.js +0 -1
- package/legacy/themeAugmentation/index.js +0 -4
- package/legacy/themeAugmentation/overrides.js +0 -1
- package/legacy/themeAugmentation/props.js +0 -1
- package/legacy/utils/EventManager.js +0 -91
- package/legacy/utils/Store.js +0 -34
- package/legacy/utils/cleanupTracking/CleanupTracking.js +0 -1
- package/legacy/utils/cleanupTracking/FinalizationRegistryBasedCleanupTracking.js +0 -29
- package/legacy/utils/cleanupTracking/TimerBasedCleanupTracking.js +0 -52
- package/legacy/utils/createControllablePromise.js +0 -11
- package/legacy/utils/createSelector.js +0 -120
- package/legacy/utils/doesSupportPreventScroll.js +0 -13
- package/legacy/utils/domUtils.js +0 -49
- package/legacy/utils/exportAs.js +0 -40
- package/legacy/utils/fastMemo.js +0 -5
- package/legacy/utils/fastObjectShallowCompare.js +0 -32
- package/legacy/utils/getGridLocalization.js +0 -15
- package/legacy/utils/getPublicApiRef.js +0 -5
- package/legacy/utils/index.js +0 -1
- package/legacy/utils/keyboardUtils.js +0 -60
- package/legacy/utils/utils.js +0 -189
- package/legacy/utils/warning.js +0 -25
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { createSelector, createSelectorMemoized } from '../../../utils/createSelector';
|
|
2
|
-
import { gridSortedRowEntriesSelector } from '../sorting/gridSortingSelector';
|
|
3
|
-
import { gridColumnLookupSelector } from '../columns/gridColumnsSelector';
|
|
4
|
-
import { gridRowMaximumTreeDepthSelector, gridRowTreeSelector } from '../rows/gridRowsSelector';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @category Filtering
|
|
8
|
-
*/
|
|
9
|
-
var gridFilterStateSelector = function gridFilterStateSelector(state) {
|
|
10
|
-
return state.filter;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Get the current filter model.
|
|
15
|
-
* @category Filtering
|
|
16
|
-
*/
|
|
17
|
-
export var gridFilterModelSelector = createSelector(gridFilterStateSelector, function (filterState) {
|
|
18
|
-
return filterState.filterModel;
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Get the current quick filter values.
|
|
23
|
-
* @category Filtering
|
|
24
|
-
*/
|
|
25
|
-
export var gridQuickFilterValuesSelector = createSelector(gridFilterModelSelector, function (filterModel) {
|
|
26
|
-
return filterModel.quickFilterValues;
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @category Visible rows
|
|
31
|
-
* @ignore - do not document.
|
|
32
|
-
*/
|
|
33
|
-
export var gridVisibleRowsLookupSelector = function gridVisibleRowsLookupSelector(state) {
|
|
34
|
-
return state.visibleRowsLookup;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @category Filtering
|
|
39
|
-
* @ignore - do not document.
|
|
40
|
-
*/
|
|
41
|
-
export var gridFilteredRowsLookupSelector = createSelector(gridFilterStateSelector, function (filterState) {
|
|
42
|
-
return filterState.filteredRowsLookup;
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* @category Filtering
|
|
47
|
-
* @ignore - do not document.
|
|
48
|
-
*/
|
|
49
|
-
export var gridFilteredDescendantCountLookupSelector = createSelector(gridFilterStateSelector, function (filterState) {
|
|
50
|
-
return filterState.filteredDescendantCountLookup;
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Get the id and the model of the rows accessible after the filtering process.
|
|
55
|
-
* Does not contain the collapsed children.
|
|
56
|
-
* @category Filtering
|
|
57
|
-
*/
|
|
58
|
-
export var gridExpandedSortedRowEntriesSelector = createSelectorMemoized(gridVisibleRowsLookupSelector, gridSortedRowEntriesSelector, function (visibleRowsLookup, sortedRows) {
|
|
59
|
-
return sortedRows.filter(function (row) {
|
|
60
|
-
return visibleRowsLookup[row.id] !== false;
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Get the id of the rows accessible after the filtering process.
|
|
66
|
-
* Does not contain the collapsed children.
|
|
67
|
-
* @category Filtering
|
|
68
|
-
*/
|
|
69
|
-
export var gridExpandedSortedRowIdsSelector = createSelectorMemoized(gridExpandedSortedRowEntriesSelector, function (visibleSortedRowEntries) {
|
|
70
|
-
return visibleSortedRowEntries.map(function (row) {
|
|
71
|
-
return row.id;
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Get the id and the model of the rows accessible after the filtering process.
|
|
77
|
-
* Contains the collapsed children.
|
|
78
|
-
* @category Filtering
|
|
79
|
-
*/
|
|
80
|
-
export var gridFilteredSortedRowEntriesSelector = createSelectorMemoized(gridFilteredRowsLookupSelector, gridSortedRowEntriesSelector, function (filteredRowsLookup, sortedRows) {
|
|
81
|
-
return sortedRows.filter(function (row) {
|
|
82
|
-
return filteredRowsLookup[row.id] !== false;
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Get the id of the rows accessible after the filtering process.
|
|
88
|
-
* Contains the collapsed children.
|
|
89
|
-
* @category Filtering
|
|
90
|
-
*/
|
|
91
|
-
export var gridFilteredSortedRowIdsSelector = createSelectorMemoized(gridFilteredSortedRowEntriesSelector, function (filteredSortedRowEntries) {
|
|
92
|
-
return filteredSortedRowEntries.map(function (row) {
|
|
93
|
-
return row.id;
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Get the id and the model of the top level rows accessible after the filtering process.
|
|
99
|
-
* @category Filtering
|
|
100
|
-
*/
|
|
101
|
-
export var gridFilteredSortedTopLevelRowEntriesSelector = createSelectorMemoized(gridExpandedSortedRowEntriesSelector, gridRowTreeSelector, gridRowMaximumTreeDepthSelector, function (visibleSortedRows, rowTree, rowTreeDepth) {
|
|
102
|
-
if (rowTreeDepth < 2) {
|
|
103
|
-
return visibleSortedRows;
|
|
104
|
-
}
|
|
105
|
-
return visibleSortedRows.filter(function (row) {
|
|
106
|
-
var _rowTree$row$id;
|
|
107
|
-
return ((_rowTree$row$id = rowTree[row.id]) == null ? void 0 : _rowTree$row$id.depth) === 0;
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Get the amount of rows accessible after the filtering process.
|
|
113
|
-
* @category Filtering
|
|
114
|
-
*/
|
|
115
|
-
export var gridExpandedRowCountSelector = createSelector(gridExpandedSortedRowEntriesSelector, function (visibleSortedRows) {
|
|
116
|
-
return visibleSortedRows.length;
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Get the amount of top level rows accessible after the filtering process.
|
|
121
|
-
* @category Filtering
|
|
122
|
-
*/
|
|
123
|
-
export var gridFilteredTopLevelRowCountSelector = createSelector(gridFilteredSortedTopLevelRowEntriesSelector, function (visibleSortedTopLevelRows) {
|
|
124
|
-
return visibleSortedTopLevelRows.length;
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* @category Filtering
|
|
129
|
-
* @ignore - do not document.
|
|
130
|
-
*/
|
|
131
|
-
export var gridFilterActiveItemsSelector = createSelectorMemoized(gridFilterModelSelector, gridColumnLookupSelector, function (filterModel, columnLookup) {
|
|
132
|
-
var _filterModel$items;
|
|
133
|
-
return (_filterModel$items = filterModel.items) == null ? void 0 : _filterModel$items.filter(function (item) {
|
|
134
|
-
var _column$filterOperato, _item$value;
|
|
135
|
-
if (!item.field) {
|
|
136
|
-
return false;
|
|
137
|
-
}
|
|
138
|
-
var column = columnLookup[item.field];
|
|
139
|
-
if (!(column != null && column.filterOperators) || (column == null || (_column$filterOperato = column.filterOperators) == null ? void 0 : _column$filterOperato.length) === 0) {
|
|
140
|
-
return false;
|
|
141
|
-
}
|
|
142
|
-
var filterOperator = column.filterOperators.find(function (operator) {
|
|
143
|
-
return operator.value === item.operator;
|
|
144
|
-
});
|
|
145
|
-
if (!filterOperator) {
|
|
146
|
-
return false;
|
|
147
|
-
}
|
|
148
|
-
return !filterOperator.InputComponent || item.value != null && ((_item$value = item.value) == null ? void 0 : _item$value.toString()) !== '';
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
|
-
/**
|
|
152
|
-
* @category Filtering
|
|
153
|
-
* @ignore - do not document.
|
|
154
|
-
*/
|
|
155
|
-
export var gridFilterActiveItemsLookupSelector = createSelectorMemoized(gridFilterActiveItemsSelector, function (activeFilters) {
|
|
156
|
-
var result = activeFilters.reduce(function (res, filterItem) {
|
|
157
|
-
if (!res[filterItem.field]) {
|
|
158
|
-
res[filterItem.field] = [filterItem];
|
|
159
|
-
} else {
|
|
160
|
-
res[filterItem.field].push(filterItem);
|
|
161
|
-
}
|
|
162
|
-
return res;
|
|
163
|
-
}, {});
|
|
164
|
-
return result;
|
|
165
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { GridLogicOperator } from '../../../models/gridFilterItem';
|
|
2
|
-
export var getDefaultGridFilterModel = function getDefaultGridFilterModel() {
|
|
3
|
-
return {
|
|
4
|
-
items: [],
|
|
5
|
-
logicOperator: GridLogicOperator.And,
|
|
6
|
-
quickFilterValues: [],
|
|
7
|
-
quickFilterLogicOperator: GridLogicOperator.And
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @param {GridRowId} rowId The id of the row we want to filter.
|
|
13
|
-
* @param {(filterItem: GridFilterItem) => boolean} shouldApplyItem An optional callback to allow the filtering engine to only apply some items.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Visibility status for each row.
|
|
18
|
-
* A row is visible if it is passing the filters AND if its parents are expanded.
|
|
19
|
-
* If a row is not registered in this lookup, it is visible.
|
|
20
|
-
*/
|
|
@@ -1,330 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { GridLogicOperator } from '../../../models';
|
|
3
|
-
import { getDefaultGridFilterModel } from './gridFilterState';
|
|
4
|
-
import { buildWarning } from '../../../utils/warning';
|
|
5
|
-
import { getPublicApiRef } from '../../../utils/getPublicApiRef';
|
|
6
|
-
import { gridColumnFieldsSelector, gridColumnLookupSelector, gridVisibleColumnFieldsSelector } from '../columns';
|
|
7
|
-
var hasEval;
|
|
8
|
-
function getHasEval() {
|
|
9
|
-
if (hasEval !== undefined) {
|
|
10
|
-
return hasEval;
|
|
11
|
-
}
|
|
12
|
-
try {
|
|
13
|
-
hasEval = new Function('return true')();
|
|
14
|
-
} catch (_) {
|
|
15
|
-
hasEval = false;
|
|
16
|
-
}
|
|
17
|
-
return hasEval;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Adds default values to the optional fields of a filter items.
|
|
21
|
-
* @param {GridFilterItem} item The raw filter item.
|
|
22
|
-
* @param {React.MutableRefObject<GridPrivateApiCommunity>} apiRef The API of the grid.
|
|
23
|
-
* @return {GridFilterItem} The clean filter item with an uniq ID and an always-defined operator.
|
|
24
|
-
* TODO: Make the typing reflect the different between GridFilterInputItem and GridFilterItem.
|
|
25
|
-
*/
|
|
26
|
-
export var cleanFilterItem = function cleanFilterItem(item, apiRef) {
|
|
27
|
-
var cleanItem = _extends({}, item);
|
|
28
|
-
if (cleanItem.id == null) {
|
|
29
|
-
cleanItem.id = Math.round(Math.random() * 1e5);
|
|
30
|
-
}
|
|
31
|
-
if (cleanItem.operator == null) {
|
|
32
|
-
// Selects a default operator
|
|
33
|
-
// We don't use `apiRef.current.getColumn` because it is not ready during state initialization
|
|
34
|
-
var column = gridColumnLookupSelector(apiRef)[cleanItem.field];
|
|
35
|
-
cleanItem.operator = column && column.filterOperators[0].value;
|
|
36
|
-
}
|
|
37
|
-
return cleanItem;
|
|
38
|
-
};
|
|
39
|
-
var filterModelDisableMultiColumnsFilteringWarning = buildWarning(['MUI X: The `filterModel` can only contain a single item when the `disableMultipleColumnsFiltering` prop is set to `true`.', 'If you are using the community version of the `DataGrid`, this prop is always `true`.'], 'error');
|
|
40
|
-
var filterModelMissingItemIdWarning = buildWarning('MUI X: The `id` field is required on `filterModel.items` when you use multiple filters.', 'error');
|
|
41
|
-
var filterModelMissingItemOperatorWarning = buildWarning('MUI X: The `operator` field is required on `filterModel.items`, one or more of your filtering item has no `operator` provided.', 'error');
|
|
42
|
-
export var sanitizeFilterModel = function sanitizeFilterModel(model, disableMultipleColumnsFiltering, apiRef) {
|
|
43
|
-
var hasSeveralItems = model.items.length > 1;
|
|
44
|
-
var items;
|
|
45
|
-
if (hasSeveralItems && disableMultipleColumnsFiltering) {
|
|
46
|
-
filterModelDisableMultiColumnsFilteringWarning();
|
|
47
|
-
items = [model.items[0]];
|
|
48
|
-
} else {
|
|
49
|
-
items = model.items;
|
|
50
|
-
}
|
|
51
|
-
var hasItemsWithoutIds = hasSeveralItems && items.some(function (item) {
|
|
52
|
-
return item.id == null;
|
|
53
|
-
});
|
|
54
|
-
var hasItemWithoutOperator = items.some(function (item) {
|
|
55
|
-
return item.operator == null;
|
|
56
|
-
});
|
|
57
|
-
if (hasItemsWithoutIds) {
|
|
58
|
-
filterModelMissingItemIdWarning();
|
|
59
|
-
}
|
|
60
|
-
if (hasItemWithoutOperator) {
|
|
61
|
-
filterModelMissingItemOperatorWarning();
|
|
62
|
-
}
|
|
63
|
-
if (hasItemWithoutOperator || hasItemsWithoutIds) {
|
|
64
|
-
return _extends({}, model, {
|
|
65
|
-
items: items.map(function (item) {
|
|
66
|
-
return cleanFilterItem(item, apiRef);
|
|
67
|
-
})
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
if (model.items !== items) {
|
|
71
|
-
return _extends({}, model, {
|
|
72
|
-
items: items
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
return model;
|
|
76
|
-
};
|
|
77
|
-
export var mergeStateWithFilterModel = function mergeStateWithFilterModel(filterModel, disableMultipleColumnsFiltering, apiRef) {
|
|
78
|
-
return function (filteringState) {
|
|
79
|
-
return _extends({}, filteringState, {
|
|
80
|
-
filterModel: sanitizeFilterModel(filterModel, disableMultipleColumnsFiltering, apiRef)
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
export var removeDiacritics = function removeDiacritics(value) {
|
|
85
|
-
if (typeof value === 'string') {
|
|
86
|
-
return value.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
|
|
87
|
-
}
|
|
88
|
-
return value;
|
|
89
|
-
};
|
|
90
|
-
var getFilterCallbackFromItem = function getFilterCallbackFromItem(filterItem, apiRef) {
|
|
91
|
-
if (!filterItem.field || !filterItem.operator) {
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
94
|
-
var column = apiRef.current.getColumn(filterItem.field);
|
|
95
|
-
if (!column) {
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
var parsedValue;
|
|
99
|
-
if (column.valueParser) {
|
|
100
|
-
var _filterItem$value;
|
|
101
|
-
var parser = column.valueParser;
|
|
102
|
-
parsedValue = Array.isArray(filterItem.value) ? (_filterItem$value = filterItem.value) == null ? void 0 : _filterItem$value.map(function (x) {
|
|
103
|
-
return parser(x, undefined, column, apiRef);
|
|
104
|
-
}) : parser(filterItem.value, undefined, column, apiRef);
|
|
105
|
-
} else {
|
|
106
|
-
parsedValue = filterItem.value;
|
|
107
|
-
}
|
|
108
|
-
var ignoreDiacritics = apiRef.current.rootProps.ignoreDiacritics;
|
|
109
|
-
if (ignoreDiacritics) {
|
|
110
|
-
parsedValue = removeDiacritics(parsedValue);
|
|
111
|
-
}
|
|
112
|
-
var newFilterItem = _extends({}, filterItem, {
|
|
113
|
-
value: parsedValue
|
|
114
|
-
});
|
|
115
|
-
var filterOperators = column.filterOperators;
|
|
116
|
-
if (!(filterOperators != null && filterOperators.length)) {
|
|
117
|
-
throw new Error("MUI X: No filter operators found for column '".concat(column.field, "'."));
|
|
118
|
-
}
|
|
119
|
-
var filterOperator = filterOperators.find(function (operator) {
|
|
120
|
-
return operator.value === newFilterItem.operator;
|
|
121
|
-
});
|
|
122
|
-
if (!filterOperator) {
|
|
123
|
-
throw new Error("MUI X: No filter operator found for column '".concat(column.field, "' and operator value '").concat(newFilterItem.operator, "'."));
|
|
124
|
-
}
|
|
125
|
-
var publicApiRef = getPublicApiRef(apiRef);
|
|
126
|
-
var applyFilterOnRow = filterOperator.getApplyFilterFn(newFilterItem, column);
|
|
127
|
-
if (typeof applyFilterOnRow !== 'function') {
|
|
128
|
-
return null;
|
|
129
|
-
}
|
|
130
|
-
return {
|
|
131
|
-
item: newFilterItem,
|
|
132
|
-
fn: function fn(row) {
|
|
133
|
-
var value = apiRef.current.getRowValue(row, column);
|
|
134
|
-
if (ignoreDiacritics) {
|
|
135
|
-
value = removeDiacritics(value);
|
|
136
|
-
}
|
|
137
|
-
return applyFilterOnRow(value, row, column, publicApiRef);
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
};
|
|
141
|
-
var filterItemsApplierId = 1;
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Generates a method to easily check if a row is matching the current filter model.
|
|
145
|
-
* @param {GridFilterModel} filterModel The model with which we want to filter the rows.
|
|
146
|
-
* @param {React.MutableRefObject<GridPrivateApiCommunity>} apiRef The API of the grid.
|
|
147
|
-
* @returns {GridAggregatedFilterItemApplier | null} A method that checks if a row is matching the current filter model. If `null`, we consider that all the rows are matching the filters.
|
|
148
|
-
*/
|
|
149
|
-
var buildAggregatedFilterItemsApplier = function buildAggregatedFilterItemsApplier(filterModel, apiRef, disableEval) {
|
|
150
|
-
var items = filterModel.items;
|
|
151
|
-
var appliers = items.map(function (item) {
|
|
152
|
-
return getFilterCallbackFromItem(item, apiRef);
|
|
153
|
-
}).filter(function (callback) {
|
|
154
|
-
return !!callback;
|
|
155
|
-
});
|
|
156
|
-
if (appliers.length === 0) {
|
|
157
|
-
return null;
|
|
158
|
-
}
|
|
159
|
-
if (disableEval || !getHasEval()) {
|
|
160
|
-
// This is the original logic, which is used if `eval()` is not supported (aka prevented by CSP).
|
|
161
|
-
return function (row, shouldApplyFilter) {
|
|
162
|
-
var resultPerItemId = {};
|
|
163
|
-
for (var i = 0; i < appliers.length; i += 1) {
|
|
164
|
-
var applier = appliers[i];
|
|
165
|
-
if (!shouldApplyFilter || shouldApplyFilter(applier.item.field)) {
|
|
166
|
-
resultPerItemId[applier.item.id] = applier.fn(row);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
return resultPerItemId;
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// We generate a new function with `new Function()` to avoid expensive patterns for JS engines
|
|
174
|
-
// such as a dynamic object assignment, e.g. `{ [dynamicKey]: value }`.
|
|
175
|
-
var filterItemCore = new Function('appliers', 'row', 'shouldApplyFilter', "\"use strict\";\n".concat(appliers.map(function (applier, i) {
|
|
176
|
-
return "const shouldApply".concat(i, " = !shouldApplyFilter || shouldApplyFilter(").concat(JSON.stringify(applier.item.field), ");");
|
|
177
|
-
}).join('\n'), "\n\nconst result$$ = {\n").concat(appliers.map(function (applier, i) {
|
|
178
|
-
return " ".concat(JSON.stringify(String(applier.item.id)), ": !shouldApply").concat(i, " ? false : appliers[").concat(i, "].fn(row),");
|
|
179
|
-
}).join('\n'), "\n};\n\nreturn result$$;").replaceAll('$$', String(filterItemsApplierId)));
|
|
180
|
-
filterItemsApplierId += 1;
|
|
181
|
-
|
|
182
|
-
// Assign to the arrow function a name to help debugging
|
|
183
|
-
var filterItem = function filterItem(row, shouldApplyItem) {
|
|
184
|
-
return filterItemCore(appliers, row, shouldApplyItem);
|
|
185
|
-
};
|
|
186
|
-
return filterItem;
|
|
187
|
-
};
|
|
188
|
-
export var shouldQuickFilterExcludeHiddenColumns = function shouldQuickFilterExcludeHiddenColumns(filterModel) {
|
|
189
|
-
var _filterModel$quickFil;
|
|
190
|
-
return (_filterModel$quickFil = filterModel.quickFilterExcludeHiddenColumns) != null ? _filterModel$quickFil : true;
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Generates a method to easily check if a row is matching the current quick filter.
|
|
195
|
-
* @param {any[]} filterModel The model with which we want to filter the rows.
|
|
196
|
-
* @param {React.MutableRefObject<GridPrivateApiCommunity>} apiRef The API of the grid.
|
|
197
|
-
* @returns {GridAggregatedFilterItemApplier | null} A method that checks if a row is matching the current filter model. If `null`, we consider that all the rows are matching the filters.
|
|
198
|
-
*/
|
|
199
|
-
var buildAggregatedQuickFilterApplier = function buildAggregatedQuickFilterApplier(filterModel, apiRef) {
|
|
200
|
-
var _filterModel$quickFil2, _filterModel$quickFil3;
|
|
201
|
-
var quickFilterValues = (_filterModel$quickFil2 = (_filterModel$quickFil3 = filterModel.quickFilterValues) == null ? void 0 : _filterModel$quickFil3.filter(Boolean)) != null ? _filterModel$quickFil2 : [];
|
|
202
|
-
if (quickFilterValues.length === 0) {
|
|
203
|
-
return null;
|
|
204
|
-
}
|
|
205
|
-
var columnFields = shouldQuickFilterExcludeHiddenColumns(filterModel) ? gridVisibleColumnFieldsSelector(apiRef) : gridColumnFieldsSelector(apiRef);
|
|
206
|
-
var appliersPerField = [];
|
|
207
|
-
var ignoreDiacritics = apiRef.current.rootProps.ignoreDiacritics;
|
|
208
|
-
var publicApiRef = getPublicApiRef(apiRef);
|
|
209
|
-
columnFields.forEach(function (field) {
|
|
210
|
-
var column = apiRef.current.getColumn(field);
|
|
211
|
-
var getApplyQuickFilterFn = column == null ? void 0 : column.getApplyQuickFilterFn;
|
|
212
|
-
if (getApplyQuickFilterFn) {
|
|
213
|
-
appliersPerField.push({
|
|
214
|
-
column: column,
|
|
215
|
-
appliers: quickFilterValues.map(function (quickFilterValue) {
|
|
216
|
-
var value = ignoreDiacritics ? removeDiacritics(quickFilterValue) : quickFilterValue;
|
|
217
|
-
return {
|
|
218
|
-
fn: getApplyQuickFilterFn(value, column, publicApiRef)
|
|
219
|
-
};
|
|
220
|
-
})
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
return function isRowMatchingQuickFilter(row, shouldApplyFilter) {
|
|
225
|
-
var result = {};
|
|
226
|
-
|
|
227
|
-
/* eslint-disable no-restricted-syntax, no-labels */
|
|
228
|
-
outer: for (var v = 0; v < quickFilterValues.length; v += 1) {
|
|
229
|
-
var filterValue = quickFilterValues[v];
|
|
230
|
-
for (var i = 0; i < appliersPerField.length; i += 1) {
|
|
231
|
-
var _appliersPerField$i = appliersPerField[i],
|
|
232
|
-
column = _appliersPerField$i.column,
|
|
233
|
-
appliers = _appliersPerField$i.appliers;
|
|
234
|
-
var _field = column.field;
|
|
235
|
-
if (shouldApplyFilter && !shouldApplyFilter(_field)) {
|
|
236
|
-
continue;
|
|
237
|
-
}
|
|
238
|
-
var applier = appliers[v];
|
|
239
|
-
var value = apiRef.current.getRowValue(row, column);
|
|
240
|
-
if (applier.fn === null) {
|
|
241
|
-
continue;
|
|
242
|
-
}
|
|
243
|
-
if (ignoreDiacritics) {
|
|
244
|
-
value = removeDiacritics(value);
|
|
245
|
-
}
|
|
246
|
-
var isMatching = applier.fn(value, row, column, publicApiRef);
|
|
247
|
-
if (isMatching) {
|
|
248
|
-
result[filterValue] = true;
|
|
249
|
-
continue outer;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
result[filterValue] = false;
|
|
253
|
-
}
|
|
254
|
-
/* eslint-enable no-restricted-syntax, no-labels */
|
|
255
|
-
|
|
256
|
-
return result;
|
|
257
|
-
};
|
|
258
|
-
};
|
|
259
|
-
export var buildAggregatedFilterApplier = function buildAggregatedFilterApplier(filterModel, apiRef, disableEval) {
|
|
260
|
-
var isRowMatchingFilterItems = buildAggregatedFilterItemsApplier(filterModel, apiRef, disableEval);
|
|
261
|
-
var isRowMatchingQuickFilter = buildAggregatedQuickFilterApplier(filterModel, apiRef);
|
|
262
|
-
return function isRowMatchingFilters(row, shouldApplyFilter, result) {
|
|
263
|
-
var _isRowMatchingFilterI, _isRowMatchingQuickFi;
|
|
264
|
-
result.passingFilterItems = (_isRowMatchingFilterI = isRowMatchingFilterItems == null ? void 0 : isRowMatchingFilterItems(row, shouldApplyFilter)) != null ? _isRowMatchingFilterI : null;
|
|
265
|
-
result.passingQuickFilterValues = (_isRowMatchingQuickFi = isRowMatchingQuickFilter == null ? void 0 : isRowMatchingQuickFilter(row, shouldApplyFilter)) != null ? _isRowMatchingQuickFi : null;
|
|
266
|
-
};
|
|
267
|
-
};
|
|
268
|
-
var isNotNull = function isNotNull(result) {
|
|
269
|
-
return result != null;
|
|
270
|
-
};
|
|
271
|
-
var filterModelItems = function filterModelItems(cache, apiRef, items) {
|
|
272
|
-
if (!cache.cleanedFilterItems) {
|
|
273
|
-
cache.cleanedFilterItems = items.filter(function (item) {
|
|
274
|
-
return getFilterCallbackFromItem(item, apiRef) !== null;
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
return cache.cleanedFilterItems;
|
|
278
|
-
};
|
|
279
|
-
export var passFilterLogic = function passFilterLogic(allFilterItemResults, allQuickFilterResults, filterModel, apiRef, cache) {
|
|
280
|
-
var cleanedFilterItems = filterModelItems(cache, apiRef, filterModel.items);
|
|
281
|
-
var cleanedFilterItemResults = allFilterItemResults.filter(isNotNull);
|
|
282
|
-
var cleanedQuickFilterResults = allQuickFilterResults.filter(isNotNull);
|
|
283
|
-
|
|
284
|
-
// get result for filter items model
|
|
285
|
-
if (cleanedFilterItemResults.length > 0) {
|
|
286
|
-
var _filterModel$logicOpe;
|
|
287
|
-
// Return true if the item pass with one of the rows
|
|
288
|
-
var filterItemPredicate = function filterItemPredicate(item) {
|
|
289
|
-
return cleanedFilterItemResults.some(function (filterItemResult) {
|
|
290
|
-
return filterItemResult[item.id];
|
|
291
|
-
});
|
|
292
|
-
};
|
|
293
|
-
var logicOperator = (_filterModel$logicOpe = filterModel.logicOperator) != null ? _filterModel$logicOpe : getDefaultGridFilterModel().logicOperator;
|
|
294
|
-
if (logicOperator === GridLogicOperator.And) {
|
|
295
|
-
var passesAllFilters = cleanedFilterItems.every(filterItemPredicate);
|
|
296
|
-
if (!passesAllFilters) {
|
|
297
|
-
return false;
|
|
298
|
-
}
|
|
299
|
-
} else {
|
|
300
|
-
var passesSomeFilters = cleanedFilterItems.some(filterItemPredicate);
|
|
301
|
-
if (!passesSomeFilters) {
|
|
302
|
-
return false;
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
// get result for quick filter model
|
|
308
|
-
if (cleanedQuickFilterResults.length > 0 && filterModel.quickFilterValues != null) {
|
|
309
|
-
var _filterModel$quickFil4;
|
|
310
|
-
// Return true if the item pass with one of the rows
|
|
311
|
-
var quickFilterValuePredicate = function quickFilterValuePredicate(value) {
|
|
312
|
-
return cleanedQuickFilterResults.some(function (quickFilterValueResult) {
|
|
313
|
-
return quickFilterValueResult[value];
|
|
314
|
-
});
|
|
315
|
-
};
|
|
316
|
-
var quickFilterLogicOperator = (_filterModel$quickFil4 = filterModel.quickFilterLogicOperator) != null ? _filterModel$quickFil4 : getDefaultGridFilterModel().quickFilterLogicOperator;
|
|
317
|
-
if (quickFilterLogicOperator === GridLogicOperator.And) {
|
|
318
|
-
var passesAllQuickFilterValues = filterModel.quickFilterValues.every(quickFilterValuePredicate);
|
|
319
|
-
if (!passesAllQuickFilterValues) {
|
|
320
|
-
return false;
|
|
321
|
-
}
|
|
322
|
-
} else {
|
|
323
|
-
var passesSomeQuickFilterValues = filterModel.quickFilterValues.some(quickFilterValuePredicate);
|
|
324
|
-
if (!passesSomeQuickFilterValues) {
|
|
325
|
-
return false;
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
return true;
|
|
330
|
-
};
|