@mui/x-data-grid 5.7.0 → 5.8.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 +74 -0
- package/DataGrid/DataGrid.d.ts +8 -3
- package/DataGrid/DataGrid.js +27 -4
- package/DataGrid/useDataGridComponent.js +2 -4
- package/DataGrid/useDataGridProps.d.ts +2 -1
- package/colDef/gridBooleanColDef.d.ts +1 -1
- package/colDef/gridBooleanOperators.d.ts +1 -1
- package/colDef/gridDateColDef.d.ts +5 -9
- package/colDef/gridDateColDef.js +2 -2
- package/colDef/gridDateOperators.d.ts +1 -1
- package/{models/colDef → colDef}/gridDefaultColumnTypes.d.ts +1 -1
- package/{models/colDef → colDef}/gridDefaultColumnTypes.js +6 -6
- package/colDef/gridNumericColDef.d.ts +1 -1
- package/colDef/gridNumericOperators.d.ts +2 -2
- package/colDef/gridStringColDef.d.ts +1 -1
- package/colDef/gridStringOperators.d.ts +1 -1
- package/colDef/index.d.ts +1 -0
- package/colDef/index.js +2 -1
- package/components/GridRow.js +1 -1
- package/components/cell/GridCell.d.ts +4 -4
- package/components/cell/GridCell.js +2 -2
- package/components/cell/GridEditInputCell.js +2 -2
- package/components/cell/GridEditSingleSelectCell.js +2 -2
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.d.ts +12 -0
- package/components/columnHeaders/{ColumnHeaderFilterIcon.js → GridColumnHeaderFilterIconButton.js} +22 -4
- package/components/columnHeaders/GridColumnHeaderItem.js +5 -5
- package/components/columnHeaders/index.d.ts +1 -0
- package/components/columnHeaders/index.js +1 -0
- package/components/columnSelection/GridCellCheckboxRenderer.js +2 -2
- package/components/columnSelection/GridHeaderCheckbox.d.ts +1 -1
- package/components/containers/GridRoot.js +29 -17
- package/components/menu/columnMenu/GridColumnMenu.js +1 -1
- package/components/panel/GridPanel.d.ts +2 -2
- package/components/panel/GridPreferencesPanel.js +1 -1
- package/constants/defaultGridSlotsComponents.js +2 -1
- package/constants/gridClasses.d.ts +15 -3
- package/hooks/core/index.d.ts +1 -1
- package/hooks/core/{preProcessing/gridPreProcessingApi.d.ts → pipeProcessing/gridPipeProcessingApi.d.ts} +19 -18
- package/hooks/core/{preProcessing/gridPreProcessingApi.js → pipeProcessing/gridPipeProcessingApi.js} +0 -0
- package/hooks/core/pipeProcessing/index.d.ts +3 -0
- package/hooks/core/pipeProcessing/index.js +3 -0
- package/hooks/core/pipeProcessing/useGridPipeProcessing.d.ts +27 -0
- package/hooks/core/pipeProcessing/useGridPipeProcessing.js +74 -0
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +7 -0
- package/hooks/core/{preProcessing/useGridRegisterPreProcessor.js → pipeProcessing/useGridRegisterPipeProcessor.js} +2 -2
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.d.ts +27 -16
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.js +26 -15
- package/hooks/core/useGridInitialization.js +2 -2
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -1
- package/hooks/features/columns/gridColumnsSelector.d.ts +6 -6
- package/hooks/features/columns/gridColumnsUtils.d.ts +3 -3
- package/hooks/features/columns/gridColumnsUtils.js +49 -17
- package/hooks/features/columns/useGridColumns.js +36 -27
- package/hooks/features/dimensions/gridDimensionsApi.d.ts +5 -0
- package/hooks/features/dimensions/useGridDimensions.js +2 -1
- package/hooks/features/editRows/useGridCellEditing.new.d.ts +1 -1
- package/hooks/features/editRows/useGridCellEditing.new.js +22 -7
- package/hooks/features/editRows/useGridRowEditing.new.d.ts +1 -1
- package/hooks/features/editRows/useGridRowEditing.new.js +22 -7
- package/hooks/features/events/useGridEvents.d.ts +1 -1
- package/hooks/features/events/useGridEvents.js +2 -0
- package/hooks/features/filter/gridFilterSelector.d.ts +3 -9
- package/hooks/features/filter/useGridFilter.js +4 -4
- package/hooks/features/{keyboard → keyboardNavigation}/useGridKeyboardNavigation.d.ts +2 -5
- package/hooks/features/{keyboard → keyboardNavigation}/useGridKeyboardNavigation.js +27 -6
- package/hooks/features/pagination/gridPaginationSelector.d.ts +1 -3
- package/hooks/features/pagination/useGridPage.js +9 -4
- package/hooks/features/pagination/useGridPageSize.js +3 -3
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +18 -5
- package/hooks/features/rows/gridRowsSelector.d.ts +1 -1
- package/hooks/features/rows/gridRowsUtils.d.ts +8 -0
- package/hooks/features/rows/gridRowsUtils.js +11 -0
- package/hooks/features/rows/index.d.ts +1 -0
- package/hooks/features/rows/index.js +1 -1
- package/hooks/features/rows/useGridRows.js +3 -3
- package/hooks/features/rows/useGridRowsMeta.js +3 -3
- package/hooks/features/scroll/useGridScroll.js +4 -13
- package/hooks/features/selection/gridSelectionSelector.d.ts +1 -3
- package/hooks/features/selection/useGridSelection.d.ts +4 -2
- package/hooks/features/selection/useGridSelection.js +72 -25
- package/hooks/features/selection/useGridSelectionPreProcessors.js +2 -2
- package/hooks/features/sorting/gridSortingSelector.d.ts +1 -3
- package/hooks/features/sorting/gridSortingUtils.d.ts +1 -2
- package/hooks/features/sorting/useGridSorting.js +3 -3
- package/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
- package/hooks/utils/useGridRootProps.d.ts +1 -1
- package/hooks/utils/useGridVisibleRows.d.ts +2 -2
- package/index.js +1 -1
- package/internals/index.d.ts +3 -6
- package/internals/index.js +2 -3
- package/legacy/DataGrid/DataGrid.js +27 -4
- package/legacy/DataGrid/useDataGridComponent.js +2 -4
- package/legacy/colDef/gridDateColDef.js +2 -2
- package/legacy/{models/colDef → colDef}/gridDefaultColumnTypes.js +6 -6
- package/legacy/colDef/index.js +2 -1
- package/legacy/components/GridRow.js +1 -1
- package/legacy/components/cell/GridCell.js +2 -2
- package/legacy/components/cell/GridEditInputCell.js +2 -2
- package/legacy/components/cell/GridEditSingleSelectCell.js +2 -2
- package/legacy/components/columnHeaders/{ColumnHeaderFilterIcon.js → GridColumnHeaderFilterIconButton.js} +22 -4
- package/legacy/components/columnHeaders/GridColumnHeaderItem.js +5 -5
- package/legacy/components/columnHeaders/index.js +1 -0
- package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +2 -2
- package/legacy/components/containers/GridRoot.js +34 -17
- package/legacy/components/menu/columnMenu/GridColumnMenu.js +1 -1
- package/legacy/components/panel/GridPreferencesPanel.js +1 -1
- package/legacy/constants/defaultGridSlotsComponents.js +2 -1
- package/legacy/hooks/core/{preProcessing/gridPreProcessingApi.js → pipeProcessing/gridPipeProcessingApi.js} +0 -0
- package/legacy/hooks/core/pipeProcessing/index.js +3 -0
- package/legacy/hooks/core/pipeProcessing/useGridPipeProcessing.js +83 -0
- package/legacy/hooks/core/{preProcessing/useGridRegisterPreProcessor.js → pipeProcessing/useGridRegisterPipeProcessor.js} +2 -2
- package/legacy/hooks/core/strategyProcessing/useGridStrategyProcessing.js +26 -15
- package/legacy/hooks/core/useGridInitialization.js +2 -2
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -1
- package/legacy/hooks/features/columns/gridColumnsUtils.js +49 -18
- package/legacy/hooks/features/columns/useGridColumns.js +36 -27
- package/legacy/hooks/features/dimensions/useGridDimensions.js +2 -1
- package/legacy/hooks/features/editRows/useGridCellEditing.new.js +22 -7
- package/legacy/hooks/features/editRows/useGridRowEditing.new.js +22 -7
- package/legacy/hooks/features/events/useGridEvents.js +2 -0
- package/legacy/hooks/features/filter/useGridFilter.js +4 -4
- package/legacy/hooks/features/{keyboard → keyboardNavigation}/useGridKeyboardNavigation.js +27 -6
- package/legacy/hooks/features/pagination/useGridPage.js +11 -4
- package/legacy/hooks/features/pagination/useGridPageSize.js +3 -3
- package/legacy/hooks/features/preferencesPanel/useGridPreferencesPanel.js +18 -5
- package/legacy/hooks/features/rows/gridRowsUtils.js +13 -0
- package/legacy/hooks/features/rows/index.js +1 -1
- package/legacy/hooks/features/rows/useGridRows.js +5 -5
- package/legacy/hooks/features/rows/useGridRowsMeta.js +3 -3
- package/legacy/hooks/features/scroll/useGridScroll.js +4 -13
- package/legacy/hooks/features/selection/useGridSelection.js +74 -25
- package/legacy/hooks/features/selection/useGridSelectionPreProcessors.js +2 -2
- package/legacy/hooks/features/sorting/useGridSorting.js +3 -3
- package/legacy/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +2 -3
- package/legacy/locales/daDK.js +36 -32
- package/legacy/models/colDef/index.js +1 -2
- package/legacy/models/events/gridEvents.js +4 -2
- package/legacy/models/gridRows.js +1 -33
- package/legacy/models/index.js +2 -2
- package/{modern/hooks/core/preProcessing/gridPreProcessingApi.js → legacy/models/params/gridPreferencePanelParams.js} +0 -0
- package/legacy/models/params/index.js +2 -1
- package/locales/daDK.js +32 -32
- package/models/api/gridApiCommon.d.ts +2 -2
- package/models/api/gridEditingApi.d.ts +2 -2
- package/models/api/gridParamsApi.d.ts +5 -5
- package/models/api/gridRowApi.d.ts +2 -2
- package/models/colDef/gridColDef.d.ts +33 -28
- package/models/colDef/index.d.ts +0 -1
- package/models/colDef/index.js +1 -2
- package/models/events/gridEventLookup.d.ts +12 -6
- package/models/events/gridEvents.d.ts +11 -5
- package/models/events/gridEvents.js +4 -2
- package/models/gridCell.d.ts +1 -0
- package/models/gridEditRowModel.d.ts +1 -1
- package/models/gridFilterOperator.d.ts +3 -2
- package/models/gridRows.d.ts +10 -18
- package/models/gridRows.js +1 -31
- package/models/gridSlotsComponent.d.ts +5 -0
- package/models/gridSlotsComponentsProps.d.ts +1 -0
- package/models/gridSortModel.d.ts +3 -4
- package/models/index.d.ts +1 -1
- package/models/index.js +2 -2
- package/models/params/gridCellParams.d.ts +14 -14
- package/models/params/gridColumnHeaderParams.d.ts +3 -2
- package/models/params/gridEditCellParams.d.ts +2 -3
- package/models/params/gridPreferencePanelParams.d.ts +3 -0
- package/models/params/gridPreferencePanelParams.js +1 -0
- package/models/params/gridRowParams.d.ts +7 -8
- package/models/params/gridValueOptionsParams.d.ts +3 -3
- package/models/params/index.d.ts +1 -0
- package/models/params/index.js +2 -1
- package/models/props/DataGridProps.d.ts +36 -16
- package/modern/DataGrid/DataGrid.js +27 -4
- package/modern/DataGrid/useDataGridComponent.js +2 -4
- package/modern/colDef/gridDateColDef.js +2 -2
- package/modern/{models/colDef → colDef}/gridDefaultColumnTypes.js +6 -6
- package/modern/colDef/index.js +2 -1
- package/modern/components/GridRow.js +1 -1
- package/modern/components/cell/GridCell.js +2 -2
- package/modern/components/cell/GridEditInputCell.js +2 -2
- package/modern/components/cell/GridEditSingleSelectCell.js +2 -2
- package/modern/components/columnHeaders/{ColumnHeaderFilterIcon.js → GridColumnHeaderFilterIconButton.js} +22 -4
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +3 -3
- package/modern/components/columnHeaders/index.js +1 -0
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +2 -2
- package/modern/components/containers/GridRoot.js +29 -17
- package/modern/components/menu/columnMenu/GridColumnMenu.js +1 -1
- package/modern/components/panel/GridPreferencesPanel.js +1 -1
- package/modern/constants/defaultGridSlotsComponents.js +2 -1
- package/modern/hooks/core/pipeProcessing/gridPipeProcessingApi.js +1 -0
- package/modern/hooks/core/pipeProcessing/index.js +3 -0
- package/modern/hooks/core/pipeProcessing/useGridPipeProcessing.js +74 -0
- package/modern/hooks/core/{preProcessing/useGridRegisterPreProcessor.js → pipeProcessing/useGridRegisterPipeProcessor.js} +2 -2
- package/modern/hooks/core/strategyProcessing/useGridStrategyProcessing.js +26 -15
- package/modern/hooks/core/useGridInitialization.js +2 -2
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -1
- package/modern/hooks/features/columns/gridColumnsUtils.js +49 -17
- package/modern/hooks/features/columns/useGridColumns.js +36 -27
- package/modern/hooks/features/dimensions/useGridDimensions.js +2 -1
- package/modern/hooks/features/editRows/useGridCellEditing.new.js +22 -7
- package/modern/hooks/features/editRows/useGridRowEditing.new.js +22 -7
- package/modern/hooks/features/events/useGridEvents.js +2 -0
- package/modern/hooks/features/filter/useGridFilter.js +4 -4
- package/modern/hooks/features/{keyboard → keyboardNavigation}/useGridKeyboardNavigation.js +27 -6
- package/modern/hooks/features/pagination/useGridPage.js +9 -4
- package/modern/hooks/features/pagination/useGridPageSize.js +3 -3
- package/modern/hooks/features/preferencesPanel/useGridPreferencesPanel.js +18 -5
- package/modern/hooks/features/rows/gridRowsUtils.js +11 -0
- package/modern/hooks/features/rows/index.js +1 -1
- package/modern/hooks/features/rows/useGridRows.js +1 -1
- package/modern/hooks/features/rows/useGridRowsMeta.js +3 -3
- package/modern/hooks/features/scroll/useGridScroll.js +4 -9
- package/modern/hooks/features/selection/useGridSelection.js +72 -25
- package/modern/hooks/features/selection/useGridSelectionPreProcessors.js +2 -2
- package/modern/hooks/features/sorting/useGridSorting.js +3 -3
- package/modern/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
- package/modern/index.js +1 -1
- package/modern/internals/index.js +2 -3
- package/modern/locales/daDK.js +32 -32
- package/modern/models/colDef/index.js +1 -2
- package/modern/models/events/gridEvents.js +4 -2
- package/modern/models/gridRows.js +1 -31
- package/modern/models/index.js +2 -2
- package/modern/models/params/gridPreferencePanelParams.js +1 -0
- package/modern/models/params/index.js +2 -1
- package/node/DataGrid/DataGrid.js +27 -4
- package/node/DataGrid/useDataGridComponent.js +2 -5
- package/node/colDef/gridDateColDef.js +2 -2
- package/node/{models/colDef → colDef}/gridDefaultColumnTypes.js +6 -6
- package/node/colDef/index.js +13 -0
- package/node/components/GridRow.js +1 -1
- package/node/components/cell/GridCell.js +2 -2
- package/node/components/cell/GridEditInputCell.js +2 -2
- package/node/components/cell/GridEditSingleSelectCell.js +2 -2
- package/node/components/columnHeaders/{ColumnHeaderFilterIcon.js → GridColumnHeaderFilterIconButton.js} +23 -5
- package/node/components/columnHeaders/GridColumnHeaderItem.js +5 -6
- package/node/components/columnHeaders/index.js +13 -0
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +2 -2
- package/node/components/containers/GridRoot.js +28 -17
- package/node/components/menu/columnMenu/GridColumnMenu.js +1 -1
- package/node/components/panel/GridPreferencesPanel.js +1 -1
- package/node/constants/defaultGridSlotsComponents.js +1 -0
- package/node/hooks/core/{preProcessing/gridPreProcessingApi.js → pipeProcessing/gridPipeProcessingApi.js} +0 -0
- package/node/hooks/core/pipeProcessing/index.js +44 -0
- package/node/hooks/core/pipeProcessing/useGridPipeProcessing.js +93 -0
- package/node/hooks/core/{preProcessing/useGridRegisterPreProcessor.js → pipeProcessing/useGridRegisterPipeProcessor.js} +4 -4
- package/node/hooks/core/strategyProcessing/useGridStrategyProcessing.js +26 -15
- package/node/hooks/core/useGridInitialization.js +2 -2
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +1 -1
- package/node/hooks/features/columns/gridColumnsUtils.js +54 -21
- package/node/hooks/features/columns/useGridColumns.js +36 -27
- package/node/hooks/features/dimensions/useGridDimensions.js +2 -1
- package/node/hooks/features/editRows/useGridCellEditing.new.js +24 -7
- package/node/hooks/features/editRows/useGridRowEditing.new.js +24 -7
- package/node/hooks/features/events/useGridEvents.js +2 -0
- package/node/hooks/features/filter/useGridFilter.js +4 -4
- package/node/hooks/features/{keyboard → keyboardNavigation}/useGridKeyboardNavigation.js +29 -6
- package/node/hooks/features/pagination/useGridPage.js +8 -3
- package/node/hooks/features/pagination/useGridPageSize.js +3 -3
- package/node/hooks/features/preferencesPanel/useGridPreferencesPanel.js +20 -5
- package/node/hooks/features/rows/gridRowsUtils.js +18 -0
- package/node/hooks/features/rows/index.js +15 -1
- package/node/hooks/features/rows/useGridRows.js +5 -5
- package/node/hooks/features/rows/useGridRowsMeta.js +3 -3
- package/node/hooks/features/scroll/useGridScroll.js +3 -13
- package/node/hooks/features/selection/useGridSelection.js +71 -24
- package/node/hooks/features/selection/useGridSelectionPreProcessors.js +2 -2
- package/node/hooks/features/sorting/useGridSorting.js +3 -3
- package/node/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
- package/node/index.js +1 -1
- package/node/internals/index.js +4 -12
- package/node/locales/daDK.js +32 -32
- package/node/models/colDef/index.js +0 -13
- package/node/models/events/gridEvents.js +4 -2
- package/node/models/gridRows.js +1 -34
- package/node/models/index.js +13 -13
- package/node/models/params/gridPreferencePanelParams.js +5 -0
- package/node/models/params/index.js +13 -0
- package/package.json +1 -1
- package/components/columnHeaders/ColumnHeaderFilterIcon.d.ts +0 -5
- package/hooks/core/preProcessing/index.d.ts +0 -3
- package/hooks/core/preProcessing/index.js +0 -3
- package/hooks/core/preProcessing/useGridPreProcessing.d.ts +0 -6
- package/hooks/core/preProcessing/useGridPreProcessing.js +0 -53
- package/hooks/core/preProcessing/useGridRegisterPreProcessor.d.ts +0 -7
- package/hooks/features/keyboard/useGridKeyboard.d.ts +0 -10
- package/hooks/features/keyboard/useGridKeyboard.js +0 -70
- package/legacy/hooks/core/preProcessing/index.js +0 -3
- package/legacy/hooks/core/preProcessing/useGridPreProcessing.js +0 -62
- package/legacy/hooks/features/keyboard/useGridKeyboard.js +0 -70
- package/modern/hooks/core/preProcessing/index.js +0 -3
- package/modern/hooks/core/preProcessing/useGridPreProcessing.js +0 -53
- package/modern/hooks/features/keyboard/useGridKeyboard.js +0 -70
- package/node/hooks/core/preProcessing/index.js +0 -44
- package/node/hooks/core/preProcessing/useGridPreProcessing.js +0 -72
- package/node/hooks/features/keyboard/useGridKeyboard.js +0 -91
|
@@ -5,7 +5,7 @@ import { InternalStandardProps as StandardProps } from '@mui/material';
|
|
|
5
5
|
import { PopperProps } from '@mui/material/Popper';
|
|
6
6
|
export interface GridPanelClasses {
|
|
7
7
|
/** Styles applied to the root element. */
|
|
8
|
-
|
|
8
|
+
panel: string;
|
|
9
9
|
/** Styles applied to the paper element. */
|
|
10
10
|
paper: string;
|
|
11
11
|
}
|
|
@@ -17,6 +17,6 @@ export interface GridPanelProps extends StandardProps<MUIStyledCommonProps<Theme
|
|
|
17
17
|
classes?: Partial<GridPanelClasses>;
|
|
18
18
|
open: boolean;
|
|
19
19
|
}
|
|
20
|
-
export declare const gridPanelClasses: Record<
|
|
20
|
+
export declare const gridPanelClasses: Record<keyof GridPanelClasses, string>;
|
|
21
21
|
declare const GridPanel: React.ForwardRefExoticComponent<Pick<GridPanelProps, "hidden" | "color" | "style" | "open" | "translate" | "transition" | "slot" | "title" | "children" | "as" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "theme" | "classes" | "container" | "disablePortal" | "keepMounted" | "anchorEl" | "placement" | "modifiers" | "popperOptions" | "popperRef"> & React.RefAttributes<HTMLDivElement>>;
|
|
22
22
|
export { GridPanel };
|
|
@@ -14,7 +14,7 @@ export const GridPreferencesPanel = /*#__PURE__*/React.forwardRef(function GridP
|
|
|
14
14
|
const columns = useGridSelector(apiRef, gridColumnDefinitionsSelector);
|
|
15
15
|
const rootProps = useGridRootProps();
|
|
16
16
|
const preferencePanelState = useGridSelector(apiRef, gridPreferencePanelStateSelector);
|
|
17
|
-
const panelContent = apiRef.current.
|
|
17
|
+
const panelContent = apiRef.current.unstable_applyPipeProcessors('preferencePanel', null, (_preferencePanelState = preferencePanelState.openedPanelValue) != null ? _preferencePanelState : GridPreferencePanelsValue.filters);
|
|
18
18
|
return /*#__PURE__*/_jsx(rootProps.components.Panel, _extends({
|
|
19
19
|
ref: ref,
|
|
20
20
|
as: rootProps.components.BasePopper,
|
|
@@ -7,7 +7,7 @@ import MUISwitch from '@mui/material/Switch';
|
|
|
7
7
|
import MUIButton from '@mui/material/Button';
|
|
8
8
|
import MUITooltip from '@mui/material/Tooltip';
|
|
9
9
|
import MUIPopper from '@mui/material/Popper';
|
|
10
|
-
import { GridArrowDownwardIcon, GridArrowUpwardIcon, GridCell, GridCheckIcon, GridCloseIcon, GridColumnIcon, GridColumnMenu, GridColumnsPanel, GridFilterAltIcon, GridFilterListIcon, GridFilterPanel, GridFooter, GridHeader, GridLoadingOverlay, GridNoRowsOverlay, GridPagination, GridPanel, GridPreferencesPanel, GridRow, GridSaveAltIcon, GridSeparatorIcon, GridTableRowsIcon, GridTripleDotsVerticalIcon, GridViewHeadlineIcon, GridViewStreamIcon, GridMoreVertIcon, GridExpandMoreIcon, GridKeyboardArrowRight, GridAddIcon, GridRemoveIcon } from '../components';
|
|
10
|
+
import { GridArrowDownwardIcon, GridArrowUpwardIcon, GridCell, GridCheckIcon, GridCloseIcon, GridColumnIcon, GridColumnMenu, GridColumnsPanel, GridFilterAltIcon, GridFilterListIcon, GridFilterPanel, GridFooter, GridHeader, GridLoadingOverlay, GridNoRowsOverlay, GridPagination, GridPanel, GridPreferencesPanel, GridRow, GridSaveAltIcon, GridSeparatorIcon, GridTableRowsIcon, GridTripleDotsVerticalIcon, GridViewHeadlineIcon, GridViewStreamIcon, GridMoreVertIcon, GridExpandMoreIcon, GridKeyboardArrowRight, GridAddIcon, GridRemoveIcon, GridColumnHeaderFilterIconButton } from '../components';
|
|
11
11
|
import { GridColumnUnsortedIcon } from '../components/columnHeaders/GridColumnUnsortedIcon';
|
|
12
12
|
import { ErrorOverlay } from '../components/ErrorOverlay';
|
|
13
13
|
import { GridNoResultsOverlay } from '../components/GridNoResultsOverlay';
|
|
@@ -49,6 +49,7 @@ export const DATA_GRID_DEFAULT_SLOTS_COMPONENTS = _extends({}, DEFAULT_GRID_ICON
|
|
|
49
49
|
BaseTooltip: MUITooltip,
|
|
50
50
|
BasePopper: MUIPopper,
|
|
51
51
|
Cell: GridCell,
|
|
52
|
+
ColumnHeaderFilterIconButton: GridColumnHeaderFilterIconButton,
|
|
52
53
|
ColumnMenu: GridColumnMenu,
|
|
53
54
|
ErrorOverlay,
|
|
54
55
|
Footer: GridFooter,
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export interface GridClasses {
|
|
2
|
+
/**
|
|
3
|
+
* Styles applied to the root element of the cell with type="actions"
|
|
4
|
+
*/
|
|
5
|
+
actionsCell: string;
|
|
2
6
|
/**
|
|
3
7
|
* Styles applied to the root element if `autoHeight={true}`.
|
|
4
8
|
*/
|
|
@@ -365,14 +369,22 @@ export interface GridClasses {
|
|
|
365
369
|
*/
|
|
366
370
|
withBorder: string;
|
|
367
371
|
/**
|
|
368
|
-
* Styles applied to the root of the grouping
|
|
372
|
+
* Styles applied to the root of the grouping cell of the tree data.
|
|
369
373
|
*/
|
|
370
374
|
treeDataGroupingCell: string;
|
|
371
375
|
/**
|
|
372
|
-
* Styles applied to the toggle of the grouping
|
|
376
|
+
* Styles applied to the toggle of the grouping cell of the tree data.
|
|
373
377
|
*/
|
|
374
378
|
treeDataGroupingCellToggle: string;
|
|
379
|
+
/**
|
|
380
|
+
* Styles applied to the root element of the grouping criteria cell
|
|
381
|
+
*/
|
|
382
|
+
groupingCriteriaCell: string;
|
|
383
|
+
/**
|
|
384
|
+
* Styles applied to the toggle of the grouping criteria cell
|
|
385
|
+
*/
|
|
386
|
+
groupingCriteriaCellToggle: string;
|
|
375
387
|
}
|
|
376
388
|
export declare type GridClassKey = keyof GridClasses;
|
|
377
389
|
export declare function getDataGridUtilityClass(slot: string): string;
|
|
378
|
-
export declare const gridClasses: Record<
|
|
390
|
+
export declare const gridClasses: Record<keyof GridClasses, string>;
|
package/hooks/core/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export type {
|
|
1
|
+
export type { GridPipeProcessingLookup } from './pipeProcessing';
|
|
@@ -6,8 +6,8 @@ import { GridRestoreStatePreProcessingContext, GridRestoreStatePreProcessingValu
|
|
|
6
6
|
import { GridHydrateColumnsValue } from '../../features/columns/gridColumnsInterfaces';
|
|
7
7
|
import { GridRowEntry } from '../../../models/gridRows';
|
|
8
8
|
import { GridPreferencePanelsValue } from '../../features/preferencesPanel';
|
|
9
|
-
export declare type
|
|
10
|
-
export interface
|
|
9
|
+
export declare type GridPipeProcessorGroup = keyof GridPipeProcessingLookup;
|
|
10
|
+
export interface GridPipeProcessingLookup {
|
|
11
11
|
hydrateColumns: {
|
|
12
12
|
value: GridHydrateColumnsValue;
|
|
13
13
|
};
|
|
@@ -35,33 +35,34 @@ export interface GridPreProcessingGroupLookup {
|
|
|
35
35
|
context: GridPreferencePanelsValue;
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
export declare type
|
|
38
|
+
export declare type GridPipeProcessor<P extends GridPipeProcessorGroup> = (value: GridPipeProcessingLookup[P]['value'], context: GridPipeProcessingLookup[P] extends {
|
|
39
39
|
context: any;
|
|
40
|
-
} ?
|
|
41
|
-
declare type
|
|
40
|
+
} ? GridPipeProcessingLookup[P]['context'] : undefined) => GridPipeProcessingLookup[P]['value'];
|
|
41
|
+
declare type GridPipeProcessorsApplierArgs<P extends GridPipeProcessorGroup, T extends {
|
|
42
42
|
value: any;
|
|
43
43
|
}> = T extends {
|
|
44
44
|
context: any;
|
|
45
45
|
} ? [P, T['value'], T['context']] : [P, T['value']];
|
|
46
|
-
declare type
|
|
47
|
-
export interface
|
|
46
|
+
declare type GridPipeProcessorsApplier = <P extends GridPipeProcessorGroup>(...params: GridPipeProcessorsApplierArgs<P, GridPipeProcessingLookup[P]>) => GridPipeProcessingLookup[P]['value'];
|
|
47
|
+
export interface GridPipeProcessingApi {
|
|
48
48
|
/**
|
|
49
49
|
* Register a pre-processor and emit an event to notify the agents to re-apply the pre-processors.
|
|
50
|
-
* @param {
|
|
51
|
-
* @param {number} id An unique and static identifier of the
|
|
52
|
-
* @param {
|
|
53
|
-
* @returns {() => void} A function to unregister the
|
|
50
|
+
* @param {GridPipeProcessorGroup} group The group on which this processor should be applied.
|
|
51
|
+
* @param {number} id An unique and static identifier of the processor.
|
|
52
|
+
* @param {GridPipeProcessor} processor The processor to register.
|
|
53
|
+
* @returns {() => void} A function to unregister the processor.
|
|
54
54
|
* @ignore - do not document.
|
|
55
55
|
*/
|
|
56
|
-
|
|
56
|
+
unstable_registerPipeProcessor: <G extends GridPipeProcessorGroup>(processorName: GridPipeProcessorGroup, id: string, callback: GridPipeProcessor<G>) => () => void;
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
59
|
-
* @
|
|
60
|
-
* @param {
|
|
61
|
-
* @param {
|
|
62
|
-
* @
|
|
58
|
+
* Run all the processors registered for the given group.
|
|
59
|
+
* @template T
|
|
60
|
+
* @param {GridPipeProcessorGroup} group The group from which we want to apply the processors.
|
|
61
|
+
* @param {T['value']} value The initial value to pass to the first processor.
|
|
62
|
+
* @param {T['context]} context Context object that will be passed to each processor.
|
|
63
|
+
* @returns {T['value]} The value after passing through all pre-processors.
|
|
63
64
|
* @ignore - do not document.
|
|
64
65
|
*/
|
|
65
|
-
|
|
66
|
+
unstable_applyPipeProcessors: GridPipeProcessorsApplier;
|
|
66
67
|
}
|
|
67
68
|
export {};
|
package/hooks/core/{preProcessing/gridPreProcessingApi.js → pipeProcessing/gridPipeProcessingApi.js}
RENAMED
|
File without changes
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { GridApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
3
|
+
/**
|
|
4
|
+
* Implement the Pipeline Pattern
|
|
5
|
+
*
|
|
6
|
+
* More information and detailed example in (TODO add link to technical doc when ready)
|
|
7
|
+
*
|
|
8
|
+
* Some plugins contains custom logic to enrich data provided by other plugins or components.
|
|
9
|
+
* For instance, the row grouping plugin needs to add / remove the grouping columns when the grid columns are updated.
|
|
10
|
+
*
|
|
11
|
+
* =====================================================================================================================
|
|
12
|
+
*
|
|
13
|
+
* The plugin containing the custom logic must use:
|
|
14
|
+
*
|
|
15
|
+
* - `useGridRegisterPipeProcessor` to register their processor.
|
|
16
|
+
* When the processor changes, it will fire `GridEvents.pipeProcessorRegister` to re-apply the whole pipe.
|
|
17
|
+
*
|
|
18
|
+
* =====================================================================================================================
|
|
19
|
+
*
|
|
20
|
+
* The plugin or component that needs to enrich its data must use:
|
|
21
|
+
*
|
|
22
|
+
* - `apiRef.current.unstable_applyPipeProcessors` to run in chain all the processors of a given group.
|
|
23
|
+
*
|
|
24
|
+
* - `GridEvents.pipeProcessorRegister` to re-apply the whole pipe when a processor of this pipe changes.
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
export declare const useGridPipeProcessing: (apiRef: React.MutableRefObject<GridApiCommunity>) => void;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
|
+
import _toPropertyKey from "@babel/runtime/helpers/esm/toPropertyKey";
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
6
|
+
import { GridEvents } from '../../../models/events';
|
|
7
|
+
/**
|
|
8
|
+
* Implement the Pipeline Pattern
|
|
9
|
+
*
|
|
10
|
+
* More information and detailed example in (TODO add link to technical doc when ready)
|
|
11
|
+
*
|
|
12
|
+
* Some plugins contains custom logic to enrich data provided by other plugins or components.
|
|
13
|
+
* For instance, the row grouping plugin needs to add / remove the grouping columns when the grid columns are updated.
|
|
14
|
+
*
|
|
15
|
+
* =====================================================================================================================
|
|
16
|
+
*
|
|
17
|
+
* The plugin containing the custom logic must use:
|
|
18
|
+
*
|
|
19
|
+
* - `useGridRegisterPipeProcessor` to register their processor.
|
|
20
|
+
* When the processor changes, it will fire `GridEvents.pipeProcessorRegister` to re-apply the whole pipe.
|
|
21
|
+
*
|
|
22
|
+
* =====================================================================================================================
|
|
23
|
+
*
|
|
24
|
+
* The plugin or component that needs to enrich its data must use:
|
|
25
|
+
*
|
|
26
|
+
* - `apiRef.current.unstable_applyPipeProcessors` to run in chain all the processors of a given group.
|
|
27
|
+
*
|
|
28
|
+
* - `GridEvents.pipeProcessorRegister` to re-apply the whole pipe when a processor of this pipe changes.
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
export const useGridPipeProcessing = apiRef => {
|
|
33
|
+
const processorsCache = React.useRef({});
|
|
34
|
+
const registerPipeProcessor = React.useCallback((group, id, processor) => {
|
|
35
|
+
if (!processorsCache.current[group]) {
|
|
36
|
+
processorsCache.current[group] = {};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const groupProcessors = processorsCache.current[group];
|
|
40
|
+
const oldProcessor = groupProcessors[id];
|
|
41
|
+
|
|
42
|
+
if (oldProcessor !== processor) {
|
|
43
|
+
processorsCache.current[group] = _extends({}, groupProcessors, {
|
|
44
|
+
[id]: processor
|
|
45
|
+
});
|
|
46
|
+
apiRef.current.publishEvent(GridEvents.pipeProcessorRegister, group);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return () => {
|
|
50
|
+
const _ref = processorsCache.current[group],
|
|
51
|
+
otherProcessors = _objectWithoutPropertiesLoose(_ref, [id].map(_toPropertyKey));
|
|
52
|
+
|
|
53
|
+
processorsCache.current[group] = otherProcessors;
|
|
54
|
+
apiRef.current.publishEvent(GridEvents.pipeProcessorUnregister, group);
|
|
55
|
+
};
|
|
56
|
+
}, [apiRef]);
|
|
57
|
+
const applyPipeProcessors = React.useCallback((...args) => {
|
|
58
|
+
const [group, value, context] = args;
|
|
59
|
+
|
|
60
|
+
if (!processorsCache.current[group]) {
|
|
61
|
+
return value;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const preProcessors = Object.values(processorsCache.current[group]);
|
|
65
|
+
return preProcessors.reduce((acc, preProcessor) => {
|
|
66
|
+
return preProcessor(acc, context);
|
|
67
|
+
}, value);
|
|
68
|
+
}, []);
|
|
69
|
+
const preProcessingApi = {
|
|
70
|
+
unstable_registerPipeProcessor: registerPipeProcessor,
|
|
71
|
+
unstable_applyPipeProcessors: applyPipeProcessors
|
|
72
|
+
};
|
|
73
|
+
useGridApiMethod(apiRef, preProcessingApi, 'GridPipeProcessingApi');
|
|
74
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { GridApiCommon } from '../../../models/api/gridApiCommon';
|
|
3
|
+
import { GridPipeProcessor } from './gridPipeProcessingApi';
|
|
4
|
+
/**
|
|
5
|
+
* TODO: Rename `useGridRegisterPipeProcessor`
|
|
6
|
+
*/
|
|
7
|
+
export declare const useGridRegisterPipeProcessor: <Api extends GridApiCommon, G extends keyof import("./gridPipeProcessingApi").GridPipeProcessingLookup>(apiRef: React.MutableRefObject<Api>, group: G, callback: GridPipeProcessor<G>) => void;
|
|
@@ -4,11 +4,11 @@ import { useFirstRender } from '../../utils/useFirstRender';
|
|
|
4
4
|
/**
|
|
5
5
|
* TODO: Rename `useGridRegisterPipeProcessor`
|
|
6
6
|
*/
|
|
7
|
-
export const
|
|
7
|
+
export const useGridRegisterPipeProcessor = (apiRef, group, callback) => {
|
|
8
8
|
const cleanup = React.useRef();
|
|
9
9
|
const id = React.useRef(`mui-${Math.round(Math.random() * 1e9)}`);
|
|
10
10
|
const registerPreProcessor = React.useCallback(() => {
|
|
11
|
-
cleanup.current = apiRef.current.
|
|
11
|
+
cleanup.current = apiRef.current.unstable_registerPipeProcessor(group, id.current, callback);
|
|
12
12
|
}, [apiRef, callback, group]);
|
|
13
13
|
useFirstRender(() => {
|
|
14
14
|
registerPreProcessor();
|
|
@@ -8,30 +8,41 @@ export declare const GRID_STRATEGIES_PROCESSORS: {
|
|
|
8
8
|
/**
|
|
9
9
|
* Implements a variant of the Strategy Pattern (see https://en.wikipedia.org/wiki/Strategy_pattern)
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
11
|
+
* More information and detailed example in (TODO add link to technical doc when ready)
|
|
12
|
+
*
|
|
13
|
+
* Some plugins contains custom logic that must only be applied if the right strategy is active.
|
|
14
|
+
* For instance, the row grouping plugin has a custom filtering algorithm.
|
|
15
|
+
* This algorithm must be applied by the filtering plugin if the row grouping is the current way of grouping rows,
|
|
16
|
+
* but not if the tree data is the current way of grouping rows.
|
|
17
|
+
*
|
|
18
|
+
* =====================================================================================================================
|
|
19
|
+
*
|
|
20
|
+
* The plugin containing the custom logic must use:
|
|
21
|
+
*
|
|
22
|
+
* - `useGridRegisterStrategyProcessor` to register their processor.
|
|
23
|
+
* When the processor of the active strategy changes, it will fire `GridEvents.activeStrategyProcessorChange` to re-apply the processor.
|
|
24
|
+
*
|
|
19
25
|
* - `apiRef.current.unstable_setStrategyAvailability` to tell if their strategy can be used.
|
|
20
26
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* -
|
|
27
|
+
* =====================================================================================================================
|
|
28
|
+
*
|
|
29
|
+
* The plugin or component that needs to apply the custom logic of the current strategy must use:
|
|
30
|
+
*
|
|
31
|
+
* - `apiRef.current.unstable_applyStrategyProcessor` to run the processor of the active strategy for a given processor name.
|
|
26
32
|
*
|
|
27
|
-
* These hooks must use:
|
|
28
|
-
* - `apiRef.current.unstable_applyStrategyProcessor` to run a processor.
|
|
29
33
|
* - `GridEvents.strategyAvailabilityChange` to update something when the active strategy changes.
|
|
30
34
|
* Warning: Be careful not to apply the processor several times.
|
|
31
35
|
* For instance `GridEvents.rowsSet` is fired by `useGridRows` whenever the active strategy changes.
|
|
32
36
|
* So listening to both would most likely run your logic twice.
|
|
33
|
-
*
|
|
37
|
+
*
|
|
38
|
+
* - `GridEvents.activeStrategyProcessorChange` to update something when the processor of the active strategy changes.
|
|
39
|
+
*
|
|
40
|
+
* =====================================================================================================================
|
|
34
41
|
*
|
|
35
42
|
* Each processor name is part of a strategy group which can only have one active strategy at the time.
|
|
43
|
+
* For now, there is only one strategy group named `rowTree` which customize
|
|
44
|
+
* - row tree creation algorithm.
|
|
45
|
+
* - sorting algorithm.
|
|
46
|
+
* - filtering algorithm.
|
|
36
47
|
*/
|
|
37
48
|
export declare const useGridStrategyProcessing: (apiRef: React.MutableRefObject<GridApiCommunity>) => void;
|
|
@@ -13,31 +13,42 @@ export const GRID_STRATEGIES_PROCESSORS = {
|
|
|
13
13
|
/**
|
|
14
14
|
* Implements a variant of the Strategy Pattern (see https://en.wikipedia.org/wiki/Strategy_pattern)
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
16
|
+
* More information and detailed example in (TODO add link to technical doc when ready)
|
|
17
|
+
*
|
|
18
|
+
* Some plugins contains custom logic that must only be applied if the right strategy is active.
|
|
19
|
+
* For instance, the row grouping plugin has a custom filtering algorithm.
|
|
20
|
+
* This algorithm must be applied by the filtering plugin if the row grouping is the current way of grouping rows,
|
|
21
|
+
* but not if the tree data is the current way of grouping rows.
|
|
22
|
+
*
|
|
23
|
+
* =====================================================================================================================
|
|
24
|
+
*
|
|
25
|
+
* The plugin containing the custom logic must use:
|
|
26
|
+
*
|
|
27
|
+
* - `useGridRegisterStrategyProcessor` to register their processor.
|
|
28
|
+
* When the processor of the active strategy changes, it will fire `GridEvents.activeStrategyProcessorChange` to re-apply the processor.
|
|
21
29
|
*
|
|
22
|
-
* These plugins must use:
|
|
23
|
-
* - `apiRef.current.unstable_registerStrategyProcessor` to register their processors.
|
|
24
30
|
* - `apiRef.current.unstable_setStrategyAvailability` to tell if their strategy can be used.
|
|
25
31
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* -
|
|
32
|
+
* =====================================================================================================================
|
|
33
|
+
*
|
|
34
|
+
* The plugin or component that needs to apply the custom logic of the current strategy must use:
|
|
35
|
+
*
|
|
36
|
+
* - `apiRef.current.unstable_applyStrategyProcessor` to run the processor of the active strategy for a given processor name.
|
|
31
37
|
*
|
|
32
|
-
* These hooks must use:
|
|
33
|
-
* - `apiRef.current.unstable_applyStrategyProcessor` to run a processor.
|
|
34
38
|
* - `GridEvents.strategyAvailabilityChange` to update something when the active strategy changes.
|
|
35
39
|
* Warning: Be careful not to apply the processor several times.
|
|
36
40
|
* For instance `GridEvents.rowsSet` is fired by `useGridRows` whenever the active strategy changes.
|
|
37
41
|
* So listening to both would most likely run your logic twice.
|
|
38
|
-
*
|
|
42
|
+
*
|
|
43
|
+
* - `GridEvents.activeStrategyProcessorChange` to update something when the processor of the active strategy changes.
|
|
44
|
+
*
|
|
45
|
+
* =====================================================================================================================
|
|
39
46
|
*
|
|
40
47
|
* Each processor name is part of a strategy group which can only have one active strategy at the time.
|
|
48
|
+
* For now, there is only one strategy group named `rowTree` which customize
|
|
49
|
+
* - row tree creation algorithm.
|
|
50
|
+
* - sorting algorithm.
|
|
51
|
+
* - filtering algorithm.
|
|
41
52
|
*/
|
|
42
53
|
export const useGridStrategyProcessing = apiRef => {
|
|
43
54
|
const availableStrategies = React.useRef(new Map());
|
|
@@ -2,7 +2,7 @@ import { useGridLoggerFactory } from './useGridLoggerFactory';
|
|
|
2
2
|
import { useGridApiInitialization } from './useGridApiInitialization';
|
|
3
3
|
import { useGridErrorHandler } from './useGridErrorHandler';
|
|
4
4
|
import { useGridLocaleText } from './useGridLocaleText';
|
|
5
|
-
import {
|
|
5
|
+
import { useGridPipeProcessing } from './pipeProcessing';
|
|
6
6
|
import { useGridStrategyProcessing } from './strategyProcessing';
|
|
7
7
|
import { useGridStateInitialization } from './useGridStateInitialization';
|
|
8
8
|
/**
|
|
@@ -14,7 +14,7 @@ export const useGridInitialization = (inputApiRef, props) => {
|
|
|
14
14
|
useGridLoggerFactory(apiRef, props);
|
|
15
15
|
useGridErrorHandler(apiRef, props);
|
|
16
16
|
useGridStateInitialization(apiRef, props);
|
|
17
|
-
|
|
17
|
+
useGridPipeProcessing(apiRef);
|
|
18
18
|
useGridStrategyProcessing(apiRef);
|
|
19
19
|
useGridLocaleText(apiRef, props);
|
|
20
20
|
return apiRef;
|
|
@@ -115,7 +115,7 @@ export const useGridColumnHeaders = props => {
|
|
|
115
115
|
column: column,
|
|
116
116
|
colIndex: columnIndex,
|
|
117
117
|
isResizing: resizeCol === column.field,
|
|
118
|
-
isLastColumn: columnIndex ===
|
|
118
|
+
isLastColumn: columnIndex === visibleColumns.length - 1,
|
|
119
119
|
extendRowFullWidth: !rootProps.disableExtendRowFullWidth,
|
|
120
120
|
hasFocus: hasFocus,
|
|
121
121
|
tabIndex: tabIndex
|
|
@@ -21,7 +21,7 @@ export declare const gridColumnLookupSelector: import("../../../utils/createSele
|
|
|
21
21
|
* Get the columns as an array.
|
|
22
22
|
* @category Columns
|
|
23
23
|
*/
|
|
24
|
-
export declare const gridColumnDefinitionsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridStateColDef[]>;
|
|
24
|
+
export declare const gridColumnDefinitionsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridStateColDef<any, any, any>[]>;
|
|
25
25
|
/**
|
|
26
26
|
* Get the column visibility model, containing the visibility status of each column.
|
|
27
27
|
* If a column is not registered in the model, it is visible.
|
|
@@ -32,7 +32,7 @@ export declare const gridColumnVisibilityModelSelector: import("../../../utils/c
|
|
|
32
32
|
* Get the visible columns as a lookup (an object containing the field for keys and the definition for values).
|
|
33
33
|
* @category Visible Columns
|
|
34
34
|
*/
|
|
35
|
-
export declare const gridVisibleColumnDefinitionsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridStateColDef[]>;
|
|
35
|
+
export declare const gridVisibleColumnDefinitionsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridStateColDef<any, any, any>[]>;
|
|
36
36
|
/**
|
|
37
37
|
* Get the field of each visible column.
|
|
38
38
|
* @category Visible Columns
|
|
@@ -52,7 +52,7 @@ export declare const gridColumnsTotalWidthSelector: import("../../../utils/creat
|
|
|
52
52
|
* Get the filterable columns as an array.
|
|
53
53
|
* @category Columns
|
|
54
54
|
*/
|
|
55
|
-
export declare const gridFilterableColumnDefinitionsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridStateColDef[]>;
|
|
55
|
+
export declare const gridFilterableColumnDefinitionsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridStateColDef<any, any, any>[]>;
|
|
56
56
|
/**
|
|
57
57
|
* Get the filterable columns as a lookup (an object containing the field for keys and the definition for values).
|
|
58
58
|
* @category Columns
|
|
@@ -69,19 +69,19 @@ export declare const allGridColumnsFieldsSelector: import("../../../utils/create
|
|
|
69
69
|
* @deprecated Use `gridColumnDefinitionsSelector` instead.
|
|
70
70
|
* @ignore - do not document.
|
|
71
71
|
*/
|
|
72
|
-
export declare const allGridColumnsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridStateColDef[]> | ((...args: any[]) => any);
|
|
72
|
+
export declare const allGridColumnsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridStateColDef<any, any, any>[]> | ((...args: any[]) => any);
|
|
73
73
|
/**
|
|
74
74
|
* @category Visible Columns
|
|
75
75
|
* @deprecated Use `gridVisibleColumnDefinitionsSelector` instead.
|
|
76
76
|
* @ignore - do not document.
|
|
77
77
|
*/
|
|
78
|
-
export declare const visibleGridColumnsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridStateColDef[]> | ((...args: any[]) => any);
|
|
78
|
+
export declare const visibleGridColumnsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridStateColDef<any, any, any>[]> | ((...args: any[]) => any);
|
|
79
79
|
/**
|
|
80
80
|
* @category Columns
|
|
81
81
|
* @deprecated Use `gridFilterableColumnDefinitionsSelector` instead.
|
|
82
82
|
* @ignore - do not document.
|
|
83
83
|
*/
|
|
84
|
-
export declare const filterableGridColumnsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridStateColDef[]> | ((...args: any[]) => any);
|
|
84
|
+
export declare const filterableGridColumnsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridStateColDef<any, any, any>[]> | ((...args: any[]) => any);
|
|
85
85
|
/**
|
|
86
86
|
* @category Columns
|
|
87
87
|
* @deprecated Use `gridFilterableColumnLookupSelector` instead (not the same return format).
|
|
@@ -41,11 +41,11 @@ export declare const applyInitialState: (columnsState: Omit<GridColumnsRawState,
|
|
|
41
41
|
/**
|
|
42
42
|
* @deprecated Should have been internal only, you can inline the logic.
|
|
43
43
|
*/
|
|
44
|
-
export declare const getGridColDef: (columnTypes: GridColumnTypesRecord, type: GridColType | undefined) => import("../../../models").GridColTypeDef
|
|
45
|
-
export declare const createColumnsState: ({ apiRef, columnsToUpsert, initialState,
|
|
44
|
+
export declare const getGridColDef: (columnTypes: GridColumnTypesRecord, type: GridColType | undefined) => import("../../../models").GridColTypeDef<any, any>;
|
|
45
|
+
export declare const createColumnsState: ({ apiRef, columnsToUpsert, initialState, columnTypes, currentColumnVisibilityModel, shouldRegenColumnVisibilityModelFromColumns, keepOnlyColumnsToUpsert, }: {
|
|
46
46
|
columnsToUpsert: GridColDef[];
|
|
47
47
|
initialState: GridColumnsInitialState | undefined;
|
|
48
|
-
|
|
48
|
+
columnTypes: GridColumnTypesRecord;
|
|
49
49
|
currentColumnVisibilityModel?: GridColumnVisibilityModel | undefined;
|
|
50
50
|
shouldRegenColumnVisibilityModelFromColumns: boolean;
|
|
51
51
|
keepOnlyColumnsToUpsert: boolean;
|