import { Callback } from "maishu-toolkit"; import React from "react"; import { EditorPanelContext } from "../context"; import type { Editors } from "../component-editors/property-editors/object-editor"; import { ComponentData } from "../parsers"; import { SizeType } from "antd/es/config-provider/SizeContext"; interface Props { storageId: string; editors?: Editors | (() => Editors); typeField: string; /** * 当前正在编辑的数组,生成 id 时作为「已存在 id」的判重来源之一。 * 缺少页面上下文(EditorPanelContext)时,可保证新增项与本数组已有项不冲突。 */ items?: any[]; setPropertyValue: (target: any, key: string, value: any) => void; defaultObjects?: Record; size?: SizeType; style?: React.CSSProperties; onAdd?: (typeName: string, item: any) => void; } interface State { selectedTypeName?: string; typeNames: string[]; } export interface Appender { added: Callback<{ typeName: string; item: any; }>; } /** * 组件数据追加器,用于在数组组件在面板中追加新的组件数据项 */ export declare class ObjectAppender extends React.Component { private typeListModal; static contextType?: React.Context<{ componentData: ComponentData; currentComponentData?: ComponentData; } | undefined> | undefined; context: React.ContextType; static defaultProps: { size: string; }; constructor(props: Props); private getComponentEditors; /** * 生成友好的 id:类型名 + 序号(Button1、Button2 …)。 * @param pageData 页面(或所属组件)数据,保证 id 在页面内唯一;不可用时可为空。 * @param items 当前正在编辑的数组,避免新增项与数组已有项 id 冲突。 */ static newId(pageData: ComponentData | undefined, typeName: string, items?: any[]): string; static existId(pageData: ComponentData, key: string): boolean; static assignChildIds(pageData: ComponentData): void; private addItem; componentDidMount(): void; render(): React.JSX.Element; } export {};