import { ClassValue, StyleValue } from '@wakeadmin/element-adapter'; import { OurComponentInstance } from '../utils'; /** * 节点渲染参数 */ export interface FatLogicTreeNodeMethods { /** * 当前节点是否为分组 */ isGroup: boolean; /** * 子孙中是否包含了分组 */ hasGroupOnDescendant: boolean; /** * 当前项的索引 */ index: number; /** * 完整的索引 */ indexs: number[]; /** * 树的深度 */ depth: number; /** * 当前项的完整路径 */ path: string; /** * 当前节点 */ current: Item; /** * 父节点 */ parent?: Item; /** * 当前逻辑类型 */ logicType: LogicType; /** * 删除当前节点 */ remove(): void; /** * 在当前节点之前插入 * @param item */ insertBefore(...item: Item[]): void; /** * 在当前节点之后插入 * @param item */ insertAfter(...item: Item[]): void; /** * 设置逻辑类型 * @param type * @note 仅分组支持 */ setLogicType(type: LogicType): void; /** * 添加追加子级 * @note 仅分组支持 */ append(...item: Item[]): void; } /** * 插槽声明 */ export interface FatLogicTreeSlots { /** * 渲染选择树节点 * @param props * @returns */ renderNode?: (props: FatLogicTreeNodeMethods) => any; /** * 渲染分组 * @param props * @returns */ renderGroup?: (props: FatLogicTreeNodeMethods & { vdom: any; }) => any; } export interface FatLogicTreeEvents { 'onUpdate:modelValue'?: (value: Item) => void; } export interface FatLogicTreeMethods { } export declare enum LogicType { AND = "AND", OR = "OR" } /** * 声明树的结构 */ export interface FatLogicTreeStruct { /** * 唯一标识符, 默认为 id */ id?: string; /** * 子级列表, 默认为 children */ children?: string; /** * 判断是否为分组, 默认根据 children 来判断,存在 children 则为分组 * @param item * @returns */ isGroup?: (item: Item) => boolean; /** * 判断分组逻辑类型, 默认从 type 中获取,如果没有则为 AND */ getLogicType?: (item: Item) => LogicType; /** * 切换逻辑分类, 返回一个新的对象 */ setLogicType?: (item: Item, type: LogicType) => Item; } export interface FatLogicTreeProps extends FatLogicTreeSlots, FatLogicTreeEvents { /** * 基础路径。例如 a.b.c、b[0] * 如果和 FatForm 配合使用,会自动拼接上 prop */ basePath?: string; /** * 树结构的描述 */ treeStruct?: FatLogicTreeStruct; /** * 树数据 */ modelValue?: any; /** * AND 文案 */ andText?: any; /** * OR 文案 */ orText?: any; /** * AND 颜色 * 默认为主色 */ andColor?: string; /** * OR 颜色 * 默认为辅助色 */ orColor?: string; /** * 节点 class */ nodeClass?: ClassValue; /** * 分组 class */ groupClass?: ClassValue; /** * 节点 style */ nodeStyle?: StyleValue; /** * 节点 style */ groupStyle?: StyleValue; } export declare const FatLogicTree: new (props: FatLogicTreeProps) => OurComponentInstance, FatLogicTreeSlots, FatLogicTreeEvents, FatLogicTreeMethods>; //# sourceMappingURL=fat-logic-tree.d.ts.map