import { ComponentData } from "../parsers/index"; export declare class ComponentDataHelper { static generatedIds: Record; static create(root: ComponentData, typeName: string, props?: any): ComponentData; private static checkRoot; private static isRoot; static generateId(pageData: ComponentData, typeName: string): string; /** 判断组件内是否存在 id */ static existId(pageData: ComponentData, key: string): boolean; /** 收集数据中已存在的全部 id(含嵌套 children),空字符串视为未设置,不计入 */ static collectIds(target: any): Set; /** * 生成友好的 id:组件类型名 + 序号(Button1、Button2 …),并避开已存在的 id。 * 不依赖页面上下文,因此独立使用属性编辑器(如演示页)时也能生成可读的 id,而不是 guid。 * typeName 为空时按历史行为退化为纯序号(1、2 …)。 * @param typeName 组件类型名 * @param sources 判重来源,可传页面数据、当前正在编辑的数组等 * @param taken 额外的已占用 id 集合 */ static generateFriendlyId(typeName: string, sources?: any[], taken?: Set): string; /** * 递归遍历对象所有属性 * @deprecated 请使用 objectTravel 方法代替。该方法已经被废弃,将在下一个版本中移除。 */ static travel(target: any, callback: (body: any, key: string, value: any) => any): any; /** * 在组件树中查找第一个带 selected 标记的节点,返回其 props.id。 * 设计器属性面板里,当前正在编辑的组件即 selected 节点。 * 找不到返回 null。 */ static findSelectedComponentId(root: ComponentData | undefined): string | null; static childrenToArray(children: ComponentData["props"]["children"]): (ComponentData | string)[]; static appendChild(parent: ComponentData, typeName: string, props?: any, root?: ComponentData): ComponentData; static removeChild(parent: ComponentData, child: ComponentData | string): boolean; } export default ComponentDataHelper;