From 9e8c681972e43491b80d47a9f12ede2f9d139882 Mon Sep 17 00:00:00 2001 From: delangle Date: Thu, 25 Jan 2024 13:55:15 +0100 Subject: [PATCH] [TreeView] Move all mandatory plugins to the core plugins --- .../TreeViewProvider.types.ts | 10 ++++++---- .../src/internals/corePlugins/corePlugins.ts | 12 +++++++++++- .../src/internals/corePlugins/index.ts | 2 +- .../useTreeViewId/index.ts | 0 .../useTreeViewId/useTreeViewId.ts | 0 .../useTreeViewId/useTreeViewId.types.ts | 0 .../useTreeViewNodes/index.ts | 0 .../useTreeViewNodes.test.tsx | 0 .../useTreeViewNodes/useTreeViewNodes.ts | 0 .../useTreeViewNodes.types.ts | 0 packages/x-tree-view/src/internals/index.ts | 3 +-- .../src/internals/models/treeView.ts | 3 ++- .../src/internals/plugins/defaultPlugins.ts | 8 ++------ .../useTreeViewExpansion.types.ts | 2 -- .../useTreeViewFocus.types.ts | 9 +-------- .../useTreeViewIcons.types.ts | 3 +-- .../useTreeViewJSXNodes.types.ts | 3 +-- .../useTreeViewKeyboardNavigation.types.ts | 2 -- .../useTreeViewSelection.types.ts | 7 +------ .../useTreeViewSelection.utils.ts | 2 +- .../src/internals/useTreeView/useTreeView.ts | 19 ++++++++++++------- .../useTreeView/useTreeView.types.ts | 2 ++ .../useTreeView/useTreeView.utils.ts | 2 +- .../utils/extractPluginParamsFromProps.ts | 4 +++- 24 files changed, 46 insertions(+), 47 deletions(-) rename packages/x-tree-view/src/internals/{plugins => corePlugins}/useTreeViewId/index.ts (100%) rename packages/x-tree-view/src/internals/{plugins => corePlugins}/useTreeViewId/useTreeViewId.ts (100%) rename packages/x-tree-view/src/internals/{plugins => corePlugins}/useTreeViewId/useTreeViewId.types.ts (100%) rename packages/x-tree-view/src/internals/{plugins => corePlugins}/useTreeViewNodes/index.ts (100%) rename packages/x-tree-view/src/internals/{plugins => corePlugins}/useTreeViewNodes/useTreeViewNodes.test.tsx (100%) rename packages/x-tree-view/src/internals/{plugins => corePlugins}/useTreeViewNodes/useTreeViewNodes.ts (100%) rename packages/x-tree-view/src/internals/{plugins => corePlugins}/useTreeViewNodes/useTreeViewNodes.types.ts (100%) diff --git a/packages/x-tree-view/src/internals/TreeViewProvider/TreeViewProvider.types.ts b/packages/x-tree-view/src/internals/TreeViewProvider/TreeViewProvider.types.ts index 0ef0c989b4ba..654338fcba57 100644 --- a/packages/x-tree-view/src/internals/TreeViewProvider/TreeViewProvider.types.ts +++ b/packages/x-tree-view/src/internals/TreeViewProvider/TreeViewProvider.types.ts @@ -6,12 +6,14 @@ import { TreeViewItemPluginOptions, TreeViewItemPluginResponse, } from '../models'; +import { TreeViewCorePluginsSignature } from '../corePlugins'; export type TreeViewContextValue = - MergePluginsProperty & { - instance: TreeViewInstance; - runItemPlugins: (options: TreeViewItemPluginOptions) => Required; - }; + MergePluginsProperty & + TreeViewCorePluginsSignature['contextValue'] & { + instance: TreeViewInstance; + runItemPlugins: (options: TreeViewItemPluginOptions) => Required; + }; export interface TreeViewProviderProps { value: TreeViewContextValue; diff --git a/packages/x-tree-view/src/internals/corePlugins/corePlugins.ts b/packages/x-tree-view/src/internals/corePlugins/corePlugins.ts index feb26ae78c80..d0ade33ebf3d 100644 --- a/packages/x-tree-view/src/internals/corePlugins/corePlugins.ts +++ b/packages/x-tree-view/src/internals/corePlugins/corePlugins.ts @@ -1,12 +1,22 @@ import { useTreeViewInstanceEvents } from './useTreeViewInstanceEvents'; +import { useTreeViewId, UseTreeViewIdParameters } from './useTreeViewId'; +import { useTreeViewNodes, UseTreeViewNodesParameters } from './useTreeViewNodes'; import { ConvertPluginsIntoSignatures, MergePlugins } from '../models'; /** * Internal plugins that create the tools used by the other plugins. * These plugins are used by the tree view components. */ -export const TREE_VIEW_CORE_PLUGINS = [useTreeViewInstanceEvents] as const; +export const TREE_VIEW_CORE_PLUGINS = [ + useTreeViewInstanceEvents, + useTreeViewId, + useTreeViewNodes, +] as const; export type TreeViewCorePluginsSignature = MergePlugins< ConvertPluginsIntoSignatures >; + +export interface TreeViewCorePluginsParameters + extends UseTreeViewIdParameters, + UseTreeViewNodesParameters {} diff --git a/packages/x-tree-view/src/internals/corePlugins/index.ts b/packages/x-tree-view/src/internals/corePlugins/index.ts index 556277c739ce..4ddaa66f0c6c 100644 --- a/packages/x-tree-view/src/internals/corePlugins/index.ts +++ b/packages/x-tree-view/src/internals/corePlugins/index.ts @@ -1,2 +1,2 @@ export { TREE_VIEW_CORE_PLUGINS } from './corePlugins'; -export type { TreeViewCorePluginsSignature } from './corePlugins'; +export type { TreeViewCorePluginsSignature, TreeViewCorePluginsParameters } from './corePlugins'; diff --git a/packages/x-tree-view/src/internals/plugins/useTreeViewId/index.ts b/packages/x-tree-view/src/internals/corePlugins/useTreeViewId/index.ts similarity index 100% rename from packages/x-tree-view/src/internals/plugins/useTreeViewId/index.ts rename to packages/x-tree-view/src/internals/corePlugins/useTreeViewId/index.ts diff --git a/packages/x-tree-view/src/internals/plugins/useTreeViewId/useTreeViewId.ts b/packages/x-tree-view/src/internals/corePlugins/useTreeViewId/useTreeViewId.ts similarity index 100% rename from packages/x-tree-view/src/internals/plugins/useTreeViewId/useTreeViewId.ts rename to packages/x-tree-view/src/internals/corePlugins/useTreeViewId/useTreeViewId.ts diff --git a/packages/x-tree-view/src/internals/plugins/useTreeViewId/useTreeViewId.types.ts b/packages/x-tree-view/src/internals/corePlugins/useTreeViewId/useTreeViewId.types.ts similarity index 100% rename from packages/x-tree-view/src/internals/plugins/useTreeViewId/useTreeViewId.types.ts rename to packages/x-tree-view/src/internals/corePlugins/useTreeViewId/useTreeViewId.types.ts diff --git a/packages/x-tree-view/src/internals/plugins/useTreeViewNodes/index.ts b/packages/x-tree-view/src/internals/corePlugins/useTreeViewNodes/index.ts similarity index 100% rename from packages/x-tree-view/src/internals/plugins/useTreeViewNodes/index.ts rename to packages/x-tree-view/src/internals/corePlugins/useTreeViewNodes/index.ts diff --git a/packages/x-tree-view/src/internals/plugins/useTreeViewNodes/useTreeViewNodes.test.tsx b/packages/x-tree-view/src/internals/corePlugins/useTreeViewNodes/useTreeViewNodes.test.tsx similarity index 100% rename from packages/x-tree-view/src/internals/plugins/useTreeViewNodes/useTreeViewNodes.test.tsx rename to packages/x-tree-view/src/internals/corePlugins/useTreeViewNodes/useTreeViewNodes.test.tsx diff --git a/packages/x-tree-view/src/internals/plugins/useTreeViewNodes/useTreeViewNodes.ts b/packages/x-tree-view/src/internals/corePlugins/useTreeViewNodes/useTreeViewNodes.ts similarity index 100% rename from packages/x-tree-view/src/internals/plugins/useTreeViewNodes/useTreeViewNodes.ts rename to packages/x-tree-view/src/internals/corePlugins/useTreeViewNodes/useTreeViewNodes.ts diff --git a/packages/x-tree-view/src/internals/plugins/useTreeViewNodes/useTreeViewNodes.types.ts b/packages/x-tree-view/src/internals/corePlugins/useTreeViewNodes/useTreeViewNodes.types.ts similarity index 100% rename from packages/x-tree-view/src/internals/plugins/useTreeViewNodes/useTreeViewNodes.types.ts rename to packages/x-tree-view/src/internals/corePlugins/useTreeViewNodes/useTreeViewNodes.types.ts diff --git a/packages/x-tree-view/src/internals/index.ts b/packages/x-tree-view/src/internals/index.ts index 9ae35c05e9d7..675896e76a4a 100644 --- a/packages/x-tree-view/src/internals/index.ts +++ b/packages/x-tree-view/src/internals/index.ts @@ -9,14 +9,13 @@ export type { DefaultTreeViewPluginSlots, DefaultTreeViewPluginSlotProps, } from './plugins/defaultPlugins'; + export type { DefaultTreeViewPluginParameters } from './plugins/defaultPlugins'; export type { UseTreeViewExpansionSignature } from './plugins/useTreeViewExpansion'; export type { UseTreeViewSelectionSignature } from './plugins/useTreeViewSelection'; export type { UseTreeViewFocusSignature } from './plugins/useTreeViewFocus'; export type { UseTreeViewKeyboardNavigationSignature } from './plugins/useTreeViewKeyboardNavigation'; -export type { UseTreeViewIdSignature } from './plugins/useTreeViewId'; export type { UseTreeViewIconsSignature } from './plugins/useTreeViewIcons'; -export type { UseTreeViewNodesSignature } from './plugins/useTreeViewNodes'; export type { UseTreeViewJSXNodesSignature } from './plugins/useTreeViewJSXNodes'; export { extractPluginParamsFromProps } from './utils/extractPluginParamsFromProps'; diff --git a/packages/x-tree-view/src/internals/models/treeView.ts b/packages/x-tree-view/src/internals/models/treeView.ts index c7ee9a8d8c36..80ff6979f87c 100644 --- a/packages/x-tree-view/src/internals/models/treeView.ts +++ b/packages/x-tree-view/src/internals/models/treeView.ts @@ -1,5 +1,6 @@ import type { TreeViewAnyPluginSignature } from './plugin'; import type { MergePluginsProperty } from './helpers'; +import type { TreeViewCorePluginsSignature } from '../corePlugins'; export interface TreeViewNode { id: string; @@ -28,4 +29,4 @@ export interface TreeViewModel { } export type TreeViewInstance = - MergePluginsProperty; + TreeViewCorePluginsSignature['instance'] & MergePluginsProperty; diff --git a/packages/x-tree-view/src/internals/plugins/defaultPlugins.ts b/packages/x-tree-view/src/internals/plugins/defaultPlugins.ts index c0c92e6bff0d..be69b2ebf1de 100644 --- a/packages/x-tree-view/src/internals/plugins/defaultPlugins.ts +++ b/packages/x-tree-view/src/internals/plugins/defaultPlugins.ts @@ -1,15 +1,12 @@ -import { useTreeViewId, UseTreeViewIdParameters } from './useTreeViewId'; -import { useTreeViewNodes, UseTreeViewNodesParameters } from './useTreeViewNodes'; import { useTreeViewExpansion, UseTreeViewExpansionParameters } from './useTreeViewExpansion'; import { useTreeViewSelection, UseTreeViewSelectionParameters } from './useTreeViewSelection'; import { useTreeViewFocus, UseTreeViewFocusParameters } from './useTreeViewFocus'; import { useTreeViewKeyboardNavigation } from './useTreeViewKeyboardNavigation'; import { useTreeViewIcons, UseTreeViewIconsParameters } from './useTreeViewIcons'; import { ConvertPluginsIntoSignatures, MergePluginsProperty } from '../models'; +import { TreeViewCorePluginsParameters } from '../corePlugins'; export const DEFAULT_TREE_VIEW_PLUGINS = [ - useTreeViewId, - useTreeViewNodes, useTreeViewExpansion, useTreeViewSelection, useTreeViewFocus, @@ -28,8 +25,7 @@ export type DefaultTreeViewPluginSlotProps = MergePluginsProperty< // We can't infer this type from the plugin, otherwise we would lose the generics. export interface DefaultTreeViewPluginParameters - extends UseTreeViewIdParameters, - UseTreeViewNodesParameters, + extends TreeViewCorePluginsParameters, UseTreeViewExpansionParameters, UseTreeViewFocusParameters, UseTreeViewSelectionParameters, diff --git a/packages/x-tree-view/src/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.types.ts b/packages/x-tree-view/src/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.types.ts index 46a2e2c80fa5..e4af6e1f0558 100644 --- a/packages/x-tree-view/src/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.types.ts +++ b/packages/x-tree-view/src/internals/plugins/useTreeViewExpansion/useTreeViewExpansion.types.ts @@ -1,6 +1,5 @@ import * as React from 'react'; import { DefaultizedProps, TreeViewPluginSignature } from '../../models'; -import { UseTreeViewNodesSignature } from '../useTreeViewNodes'; export interface UseTreeViewExpansionInstance { isNodeExpanded: (nodeId: string) => boolean; @@ -50,5 +49,4 @@ export type UseTreeViewExpansionSignature = TreeViewPluginSignature<{ defaultizedParams: UseTreeViewExpansionDefaultizedParameters; instance: UseTreeViewExpansionInstance; modelNames: 'expandedNodes'; - dependantPlugins: [UseTreeViewNodesSignature]; }>; diff --git a/packages/x-tree-view/src/internals/plugins/useTreeViewFocus/useTreeViewFocus.types.ts b/packages/x-tree-view/src/internals/plugins/useTreeViewFocus/useTreeViewFocus.types.ts index e7a181d86c19..b305e633bff9 100644 --- a/packages/x-tree-view/src/internals/plugins/useTreeViewFocus/useTreeViewFocus.types.ts +++ b/packages/x-tree-view/src/internals/plugins/useTreeViewFocus/useTreeViewFocus.types.ts @@ -1,7 +1,5 @@ import * as React from 'react'; import { TreeViewPluginSignature } from '../../models'; -import { UseTreeViewIdSignature } from '../useTreeViewId/useTreeViewId.types'; -import type { UseTreeViewNodesSignature } from '../useTreeViewNodes'; import type { UseTreeViewSelectionSignature } from '../useTreeViewSelection'; import { UseTreeViewExpansionSignature } from '../useTreeViewExpansion'; @@ -32,10 +30,5 @@ export type UseTreeViewFocusSignature = TreeViewPluginSignature<{ defaultizedParams: UseTreeViewFocusDefaultizedParameters; instance: UseTreeViewFocusInstance; state: UseTreeViewFocusState; - dependantPlugins: [ - UseTreeViewIdSignature, - UseTreeViewNodesSignature, - UseTreeViewSelectionSignature, - UseTreeViewExpansionSignature, - ]; + dependantPlugins: [UseTreeViewSelectionSignature, UseTreeViewExpansionSignature]; }>; diff --git a/packages/x-tree-view/src/internals/plugins/useTreeViewIcons/useTreeViewIcons.types.ts b/packages/x-tree-view/src/internals/plugins/useTreeViewIcons/useTreeViewIcons.types.ts index 8090beb113c3..79f8fdecf782 100644 --- a/packages/x-tree-view/src/internals/plugins/useTreeViewIcons/useTreeViewIcons.types.ts +++ b/packages/x-tree-view/src/internals/plugins/useTreeViewIcons/useTreeViewIcons.types.ts @@ -1,7 +1,6 @@ import * as React from 'react'; import { SlotComponentProps } from '@mui/base/utils'; import { TreeViewPluginSignature } from '../../models'; -import { UseTreeViewNodesSignature } from '../useTreeViewNodes'; import { UseTreeViewSelectionSignature } from '../useTreeViewSelection'; export interface UseTreeViewIconsParameters {} @@ -43,5 +42,5 @@ export type UseTreeViewIconsSignature = TreeViewPluginSignature<{ contextValue: UseTreeViewIconsContextValue; slots: UseTreeViewIconsSlots; slotProps: UseTreeViewIconsSlotProps; - dependantPlugins: [UseTreeViewNodesSignature, UseTreeViewSelectionSignature]; + dependantPlugins: [UseTreeViewSelectionSignature]; }>; diff --git a/packages/x-tree-view/src/internals/plugins/useTreeViewJSXNodes/useTreeViewJSXNodes.types.ts b/packages/x-tree-view/src/internals/plugins/useTreeViewJSXNodes/useTreeViewJSXNodes.types.ts index e5aa62ec412b..bbdb01ba7304 100644 --- a/packages/x-tree-view/src/internals/plugins/useTreeViewJSXNodes/useTreeViewJSXNodes.types.ts +++ b/packages/x-tree-view/src/internals/plugins/useTreeViewJSXNodes/useTreeViewJSXNodes.types.ts @@ -1,5 +1,4 @@ import { TreeViewNode, TreeViewPluginSignature } from '../../models'; -import { UseTreeViewNodesSignature } from '../useTreeViewNodes'; import { UseTreeViewKeyboardNavigationSignature } from '../useTreeViewKeyboardNavigation'; export interface UseTreeViewNodesInstance { @@ -16,5 +15,5 @@ export type UseTreeViewJSXNodesSignature = TreeViewPluginSignature<{ params: UseTreeViewNodesParameters; defaultizedParams: UseTreeViewNodesDefaultizedParameters; instance: UseTreeViewNodesInstance; - dependantPlugins: [UseTreeViewNodesSignature, UseTreeViewKeyboardNavigationSignature]; + dependantPlugins: [UseTreeViewKeyboardNavigationSignature]; }>; diff --git a/packages/x-tree-view/src/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.types.ts b/packages/x-tree-view/src/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.types.ts index a3502830bdcb..c564fff89d54 100644 --- a/packages/x-tree-view/src/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.types.ts +++ b/packages/x-tree-view/src/internals/plugins/useTreeViewKeyboardNavigation/useTreeViewKeyboardNavigation.types.ts @@ -1,5 +1,4 @@ import { TreeViewPluginSignature } from '../../models'; -import { UseTreeViewNodesSignature } from '../useTreeViewNodes'; import { UseTreeViewSelectionSignature } from '../useTreeViewSelection'; import { UseTreeViewFocusSignature } from '../useTreeViewFocus'; import { UseTreeViewExpansionSignature } from '../useTreeViewExpansion'; @@ -11,7 +10,6 @@ export interface UseTreeViewKeyboardNavigationInstance { export type UseTreeViewKeyboardNavigationSignature = TreeViewPluginSignature<{ instance: UseTreeViewKeyboardNavigationInstance; dependantPlugins: [ - UseTreeViewNodesSignature, UseTreeViewSelectionSignature, UseTreeViewFocusSignature, UseTreeViewExpansionSignature, diff --git a/packages/x-tree-view/src/internals/plugins/useTreeViewSelection/useTreeViewSelection.types.ts b/packages/x-tree-view/src/internals/plugins/useTreeViewSelection/useTreeViewSelection.types.ts index 6afbfaaafd8e..8635d00ebee1 100644 --- a/packages/x-tree-view/src/internals/plugins/useTreeViewSelection/useTreeViewSelection.types.ts +++ b/packages/x-tree-view/src/internals/plugins/useTreeViewSelection/useTreeViewSelection.types.ts @@ -1,6 +1,5 @@ import * as React from 'react'; import type { DefaultizedProps, TreeViewItemRange, TreeViewPluginSignature } from '../../models'; -import { UseTreeViewNodesSignature } from '../useTreeViewNodes'; import { UseTreeViewExpansionSignature } from '../useTreeViewExpansion'; export interface UseTreeViewSelectionInstance { @@ -75,9 +74,5 @@ export type UseTreeViewSelectionSignature = TreeViewPluginSignature<{ instance: UseTreeViewSelectionInstance; contextValue: UseTreeViewSelectionContextValue; modelNames: 'selectedNodes'; - dependantPlugins: [ - UseTreeViewNodesSignature, - UseTreeViewExpansionSignature, - UseTreeViewNodesSignature, - ]; + dependantPlugins: [UseTreeViewExpansionSignature]; }>; diff --git a/packages/x-tree-view/src/internals/plugins/useTreeViewSelection/useTreeViewSelection.utils.ts b/packages/x-tree-view/src/internals/plugins/useTreeViewSelection/useTreeViewSelection.utils.ts index 7bfd556d6ba9..5ec5b025aeeb 100644 --- a/packages/x-tree-view/src/internals/plugins/useTreeViewSelection/useTreeViewSelection.utils.ts +++ b/packages/x-tree-view/src/internals/plugins/useTreeViewSelection/useTreeViewSelection.utils.ts @@ -1,5 +1,5 @@ import { TreeViewInstance } from '../../models'; -import { UseTreeViewNodesSignature } from '../useTreeViewNodes'; +import { UseTreeViewNodesSignature } from '../../corePlugins/useTreeViewNodes'; /** * This is used to determine the start and end of a selection range so diff --git a/packages/x-tree-view/src/internals/useTreeView/useTreeView.ts b/packages/x-tree-view/src/internals/useTreeView/useTreeView.ts index 06d6d9e0ca64..d6cb1c2a0d45 100644 --- a/packages/x-tree-view/src/internals/useTreeView/useTreeView.ts +++ b/packages/x-tree-view/src/internals/useTreeView/useTreeView.ts @@ -16,12 +16,17 @@ import { } from './useTreeView.types'; import { useTreeViewModels } from './useTreeViewModels'; import { TreeViewContextValue } from '../TreeViewProvider'; -import { TREE_VIEW_CORE_PLUGINS } from '../corePlugins'; - -export const useTreeView = []>( - inParams: UseTreeViewParameters, -): UseTreeViewReturnValue> => { - const plugins = [...TREE_VIEW_CORE_PLUGINS, ...inParams.plugins]; +import { TREE_VIEW_CORE_PLUGINS, TreeViewCorePluginsSignature } from '../corePlugins'; + +export const useTreeView = < + InPlugins extends readonly TreeViewPlugin[], +>( + inParams: UseTreeViewParameters, +): UseTreeViewReturnValue< + [TreeViewCorePluginsSignature, ...ConvertPluginsIntoSignatures] +> => { + const plugins = [...TREE_VIEW_CORE_PLUGINS, ...inParams.plugins] as const; + type Plugins = typeof plugins; type Signatures = ConvertPluginsIntoSignatures; const params = plugins.reduce((acc, plugin) => { @@ -49,7 +54,7 @@ export const useTreeView = ), + plugin.getInitialState(params as UseTreeViewDefaultizedParameters), ); } }); diff --git a/packages/x-tree-view/src/internals/useTreeView/useTreeView.types.ts b/packages/x-tree-view/src/internals/useTreeView/useTreeView.types.ts index 020a8a6c7165..7bf3ab90206f 100644 --- a/packages/x-tree-view/src/internals/useTreeView/useTreeView.types.ts +++ b/packages/x-tree-view/src/internals/useTreeView/useTreeView.types.ts @@ -8,10 +8,12 @@ import { MergePluginsProperty, TreeViewInstance, } from '../models'; +import { TreeViewCorePluginsSignature } from '../corePlugins'; export type UseTreeViewParameters< TPlugins extends readonly TreeViewPlugin[], > = UseTreeViewBaseParameters & + TreeViewCorePluginsSignature['params'] & MergePluginsProperty, 'params'>; export interface UseTreeViewBaseParameters< diff --git a/packages/x-tree-view/src/internals/useTreeView/useTreeView.utils.ts b/packages/x-tree-view/src/internals/useTreeView/useTreeView.utils.ts index 0215d05ab79b..cfbe223c58a9 100644 --- a/packages/x-tree-view/src/internals/useTreeView/useTreeView.utils.ts +++ b/packages/x-tree-view/src/internals/useTreeView/useTreeView.utils.ts @@ -1,6 +1,6 @@ import { TreeViewAnyPluginSignature, TreeViewInstance, TreeViewUsedInstance } from '../models'; import type { UseTreeViewExpansionSignature } from '../plugins/useTreeViewExpansion'; -import type { UseTreeViewNodesSignature } from '../plugins/useTreeViewNodes'; +import type { UseTreeViewNodesSignature } from '../corePlugins/useTreeViewNodes'; export const getPreviousNode = ( instance: TreeViewInstance<[UseTreeViewNodesSignature, UseTreeViewExpansionSignature]>, diff --git a/packages/x-tree-view/src/internals/utils/extractPluginParamsFromProps.ts b/packages/x-tree-view/src/internals/utils/extractPluginParamsFromProps.ts index 81200813402b..3b581429c94d 100644 --- a/packages/x-tree-view/src/internals/utils/extractPluginParamsFromProps.ts +++ b/packages/x-tree-view/src/internals/utils/extractPluginParamsFromProps.ts @@ -1,6 +1,7 @@ import * as React from 'react'; import { ConvertPluginsIntoSignatures, MergePluginsProperty, TreeViewPlugin } from '../models'; import { UseTreeViewBaseParameters } from '../useTreeView/useTreeView.types'; +import { TreeViewCorePluginsSignature } from '@mui/x-tree-view/internals/corePlugins'; export const extractPluginParamsFromProps = < TPlugins extends readonly TreeViewPlugin[], @@ -16,7 +17,8 @@ export const extractPluginParamsFromProps = < plugins: TPlugins; rootRef?: React.Ref; }) => { - type PluginParams = MergePluginsProperty, 'params'>; + type PluginParams = TreeViewCorePluginsSignature['params'] & + MergePluginsProperty, 'params'>; const paramsLookup = {} as Record; plugins.forEach((plugin) => {