-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TreeView] Improve TypeScript for plugins (mui#13380)
- Loading branch information
1 parent
86f1a8d
commit a60647d
Showing
36 changed files
with
275 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export { DEFAULT_TREE_VIEW_PRO_PLUGINS } from './defaultPlugins'; | ||
export type { DefaultTreeViewProPlugins } from './defaultPlugins'; | ||
export type { DefaultTreeViewProPluginSignatures } from './defaultPlugins'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import * as React from 'react'; | ||
import { TreeViewAnyPluginSignature, TreeViewPublicAPI } from '../internals/models'; | ||
import { DefaultTreeViewPlugins } from '../internals'; | ||
import { DefaultTreeViewPluginSignatures } from '../internals'; | ||
|
||
/** | ||
* Hook that instantiates a [[TreeViewApiRef]]. | ||
*/ | ||
export const useTreeViewApiRef = < | ||
TPlugins extends readonly TreeViewAnyPluginSignature[] = DefaultTreeViewPlugins, | ||
>() => React.useRef(undefined) as React.MutableRefObject<TreeViewPublicAPI<TPlugins> | undefined>; | ||
TSignatures extends readonly TreeViewAnyPluginSignature[] = DefaultTreeViewPluginSignatures, | ||
>() => | ||
React.useRef(undefined) as React.MutableRefObject<TreeViewPublicAPI<TSignatures> | undefined>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
export { TreeViewProvider } from './TreeViewProvider'; | ||
export type { TreeViewProviderProps, TreeViewContextValue } from './TreeViewProvider.types'; | ||
export type { | ||
TreeViewProviderProps, | ||
TreeViewContextValue, | ||
TreeViewItemPluginsRunner, | ||
} from './TreeViewProvider.types'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
packages/x-tree-view/src/internals/corePlugins/corePlugins.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import { useTreeViewInstanceEvents } from './useTreeViewInstanceEvents'; | ||
import { ConvertPluginsIntoSignatures, MergePlugins } from '../models'; | ||
import { ConvertPluginsIntoSignatures } 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 type TreeViewCorePluginsSignature = MergePlugins< | ||
ConvertPluginsIntoSignatures<typeof TREE_VIEW_CORE_PLUGINS> | ||
export type TreeViewCorePluginSignatures = ConvertPluginsIntoSignatures< | ||
typeof TREE_VIEW_CORE_PLUGINS | ||
>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export { TREE_VIEW_CORE_PLUGINS } from './corePlugins'; | ||
export type { TreeViewCorePluginsSignature } from './corePlugins'; | ||
export type { TreeViewCorePluginSignatures } from './corePlugins'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.