chore: [tree] export types (#19846)

* chore: [tree] export type and fix the type error of the docs

* revert: revert

* revert: revert
This commit is contained in:
jiaxiang
2025-02-17 09:10:47 +08:00
committed by GitHub
parent 6dddd4ed54
commit d676ca4897
2 changed files with 23 additions and 24 deletions

View File

@@ -7,4 +7,5 @@ export const ElTree: SFCWithInstall<typeof Tree> = withInstall(Tree)
export default ElTree
export type { TreeInstance } from './src/instance'
export * from './src/tree.type'
export * from './src/instance'

View File

@@ -18,33 +18,31 @@ export interface RootTreeType {
instance: ComponentInternalInstance
}
export declare type hType = typeof h
export declare type TreeData = TreeNodeData[]
export declare type TreeKey = string | number
export declare interface FakeNode {
export type hType = typeof h
export type TreeData = TreeNodeData[]
export type TreeKey = string | number
export interface FakeNode {
data: TreeNodeData
}
export declare interface TreeNodeData {
[key: string]: any
}
export declare interface TreeNodeLoadedDefaultProps {
export type TreeNodeData = Record<string, any>
export interface TreeNodeLoadedDefaultProps {
checked?: boolean
}
export declare interface TreeNodeChildState {
export interface TreeNodeChildState {
all: boolean
none: boolean
allWithoutDisable: boolean
half: boolean
}
export declare interface TreeNodeOptions {
export interface TreeNodeOptions {
data: TreeNodeData
store: TreeStore
parent?: Node
}
export declare interface TreeStoreNodesMap {
export interface TreeStoreNodesMap {
[key: string]: Node
}
export declare interface TreeStoreOptions {
export interface TreeStoreOptions {
key: TreeKey
data: TreeData
lazy: boolean
@@ -59,7 +57,7 @@ export declare interface TreeStoreOptions {
defaultExpandAll: boolean
filterNodeMethod: FilterNodeMethodFunction
}
export declare interface TreeOptionProps {
export interface TreeOptionProps {
children?: string
label?: string | ((data: TreeNodeData, node: Node) => string)
disabled?: string | ((data: TreeNodeData, node: Node) => boolean)
@@ -69,35 +67,35 @@ export declare interface TreeOptionProps {
node: Node
) => string | { [key: string]: boolean }
}
export declare type RenderContentFunction = (
export type RenderContentFunction = (
h: hType,
context: RenderContentContext
) => VNode | VNode[]
export declare interface RenderContentContext {
export interface RenderContentContext {
_self: ComponentInternalInstance
node: Node
data: TreeNodeData
store: TreeStore
}
export declare type AllowDragFunction = (node: Node) => boolean
export declare type AllowDropType = 'inner' | 'prev' | 'next'
export declare type AllowDropFunction = (
export type AllowDragFunction = (node: Node) => boolean
export type AllowDropType = 'inner' | 'prev' | 'next'
export type AllowDropFunction = (
draggingNode: Node,
dropNode: Node,
type: AllowDropType
) => boolean
export declare type LoadFunction = (
export type LoadFunction = (
rootNode: Node,
loadedCallback: (data: TreeData) => void,
stopLoading: () => void
) => void
export declare type FilterValue = any
export declare type FilterNodeMethodFunction = (
export type FilterValue = any
export type FilterNodeMethodFunction = (
value: FilterValue,
data: TreeNodeData,
child: Node
) => boolean
export declare interface TreeComponentProps {
export interface TreeComponentProps {
data: TreeData
emptyText: string
renderAfterExpand: boolean
@@ -126,4 +124,4 @@ export declare interface TreeComponentProps {
icon: string | Component
}
export declare type NodeDropType = 'before' | 'after' | 'inner' | 'none'
export type NodeDropType = 'before' | 'after' | 'inner' | 'none'