import type { OioTreeNode } from '@oinone/kunlun-shared'; import type { PropType } from 'vue'; import type { TreeData } from '../../typing'; const DefaultTreeSearchProps = { enableSearch: { type: Boolean, default: false }, searchPlaceHolder: { type: String, default: '请输入关键字' }, searchRootNode: { type: Object as PropType> }, searchValue: { type: String }, onUpdateSearchValue: { type: Function as PropType<(val: string) => void> }, onSearch: { type: Function as PropType<(val: string) => void> } }; const DefaultTreeSelectProps = { selectable: { type: Boolean, default: undefined }, selectedKeys: { type: Array as PropType }, onUpdateSelectedKeys: { type: Function as PropType<(val: string[]) => void> }, onSelected: { type: Function as PropType<(node: OioTreeNode, selected: boolean) => Promise> } }; const DefaultTreeExpandProps = { expandedKeys: { type: Array as PropType }, onUpdateExpandedKeys: { type: Function as PropType<(val: string[]) => void> }, onExpanded: { type: Function as PropType<(val: string[]) => void> } }; const DefaultTreeCheckProps = { checkable: { type: Boolean, default: undefined }, checkStrictly: { type: Boolean, default: undefined }, checkedKeys: { type: Array as PropType }, onUpdateCheckedKeys: { type: Function as PropType<(val: string[]) => void> }, halfCheckedKeys: { type: Array as PropType }, onUpdateHalfCheckedKeys: { type: Function as PropType<(val: string[]) => void> }, onChecked: { type: Function as PropType<(node: OioTreeNode, checked: boolean) => Promise> }, checkAll: { type: Boolean, default: false }, checkAllLabel: { type: String, default: '选择全部' }, onCheckedAll: { type: Function as PropType<(checkedAll: boolean) => Promise> }, nodeCheckedAll: { type: [Boolean, Function] as PropType) => boolean)>, default: undefined }, nodeCheckedAllLabel: { type: String, default: '全选' }, nodeUncheckedAllLabel: { type: String, default: '反选' }, onNodeCheckedAll: { type: Function as PropType<(node: OioTreeNode, selected: boolean) => Promise> } }; const DefaultTreeLoadProps = { rootNode: { type: Object as PropType> }, loadData: { type: Function as PropType<(node: OioTreeNode) => Promise> }, loadMoreData: { type: Function as PropType<(node: OioTreeNode) => Promise> }, loadedKeys: { type: Array as PropType }, onUpdateLoadedKeys: { type: Function as PropType<(val: string[]) => void> } }; export const DefaultTreeProps = { ...DefaultTreeSearchProps, ...DefaultTreeLoadProps, ...DefaultTreeSelectProps, ...DefaultTreeExpandProps, ...DefaultTreeCheckProps, invisible: { type: Boolean, default: false }, loading: { type: Boolean, default: undefined } };