element-plus/types/cascader-panel.d.ts
2020-10-30 23:26:33 +08:00

76 lines
1.6 KiB
TypeScript

import { h } from 'vue'
import type { VNode } from 'vue'
import type { ElementUIComponent } from './component'
type H = typeof h
/** Trigger mode of expanding current item */
export type ExpandTrigger = 'click' | 'hover'
/** Cascader Option */
export interface CascaderOption {
label: string
value: any
children?: CascaderOption[]
disabled?: boolean
leaf?: boolean
}
/** Cascader Props */
export interface CascaderProps<V, D> {
expandTrigger?: ExpandTrigger
multiple?: boolean
checkStrictly?: boolean
emitPath?: boolean
lazy?: boolean
lazyLoad?: (node: CascaderNode<V, D>, resolve: Resolve<D>) => void
value?: string
label?: string
children?: string
disabled?: string
leaf?: string
}
/** Cascader Node */
export interface CascaderNode<V, D> {
uid: number
data: D
value: V
label: string
level: number
isDisabled: boolean
isLeaf: boolean
parent: CascaderNode<V, D> | null
children: CascaderNode<V, D>[]
config: CascaderProps<V, D>
}
type Resolve<D> = (dataList?: D[]) => void
export interface CascaderPanelSlots {
/** Custom label content */
default: VNode[]
[key: string]: VNode[]
}
/** CascaderPanel Component */
export declare class ElCascaderPanel<V = any, D = CascaderOption> extends ElementUIComponent {
/** Selected value */
value: V | V[]
/** Data of the options */
options: D[]
/** Configuration options */
props: CascaderProps<V, D>
/** Whether to add border */
border: boolean
/** Render function of custom label content */
renderLabel: (h: H, context: { node: CascaderNode<V, D>; data: D; }) => VNode
$slots: CascaderPanelSlots
}