veui
Version:
Baidu Enterprise UI for Vue.js.
72 lines (63 loc) • 1.76 kB
TypeScript
import {
VeuiDefineComponent,
VeuiDefineInstance,
UiMixin,
InputMixin,
TreeMixin,
ControllableMixin
} from '../common'
import { SlotProps as TreeSlotProps, LooseTreeItem } from './tree'
type Item = {
label: string
value: unknown // slot 中丢失
hidden?: boolean
disabled?: boolean
children?: Array<Item> | null
}
type Props<T extends Item> = {
datasource?: Array<T>
searchable?: boolean
filter?: (type: 'candidate', keyword: string, item: T) => boolean
selected?: Array<T['value']>
candidatePlaceholder?: string
selectedPlaceholder?: string
candidateTitle?: string
selectedTitle?: string
selectedShowMode?: 'tree' | 'flat'
keys?: string | ((item: T) => string)
}
type Emits = {}
type Mixins = [
UiMixin,
InputMixin,
TreeMixin,
ControllableMixin<{
select(value: Array<unknown>): void
}>
]
type SlotProps = { count: number }
type Slots = {
'candidate-head'(slotScope: SlotProps): unknown
'candidate-title'(slotScope: SlotProps): unknown
'candidate-no-data'(): unknown
'candidate-item'(slotScope: TreeSlotProps): unknown
'candidate-item-label'(
slotScope: TreeSlotProps & { keyword: string }
): unknown
'selected-head'(slotScope: SlotProps): unknown
'selected-title'(slotScope: SlotProps): unknown
'selected-no-data'(): unknown
'selected-item'(slotScope: TreeSlotProps): unknown
'selected-item-label'(slotScope: TreeSlotProps & { keyword: string }): unknown
candidate(slotScope: { datasource: LooseTreeItem }): unknown
selected(slotScope: { datasource: LooseTreeItem }): unknown
}
type Transfer = VeuiDefineComponent<{
new <T extends Item = Item>(...args: any[]): VeuiDefineInstance<
Props<T>,
Emits,
Slots,
Mixins
>
}>
export default Transfer