/** * 编辑表格中各个单元格的值 */ export interface CellValue { [key: string]: ValueItem | FragmentItem; } /** * 值占位符对应的当前值 */ export interface ValueItem { id: string; type: UniInputType; value: string; realValue?: string; displayValue?: string; detail?: any; popover?: boolean; editor: Editor; enableI18N?: boolean; } export interface Editor { name: string; desc?: string; placeholder: string; types: string[]; fieldPrefix?: string; needBracket?: boolean; required?: boolean; enums?: { text: string; value: string; }[]; defaultValue?: string; disableI18N?: boolean; defaultEnableI18N?: boolean; } /** * 片段占位符对应的当前值 */ export interface FragmentItem { itemGroupArr: { id: string; item: ValueItem; }[][]; editorMap?: EditorMap; uncopyable?: boolean; } /** * 片段占位符内值占位符的id到编辑器配置的映射 */ export interface EditorMap { [id: string]: Editor; } /** * 模板描述结构 */ export interface TemplateDesc { templateClass?: string; templateName?: string; templateGrid: TemplateCellDesc[][]; } /** * 模板单元格描述结构 */ export interface TemplateCellDesc { name: string; width?: string | number; colspan?: number; rowspan?: number; type: "value" | "fragment"; value?: ValueItemDesc; fragment?: FragmentItemDesc; initValue?: any; } export interface ValueItemDesc { id: string; editor: Editor; } export interface FragmentItemDesc { id: string; uncopyable?: boolean; initialAmount?: number; maxAmount?: number; displayItem?: string; children: ValueItemDesc[]; } /** * 执行替换操作后生成HTML片段的结果 */ export interface GenerateResult { success: boolean; error?: string; log?: TemplateLog; } /** * 用于保存模板生成的结果 * 最终被保存至json文件中 */ export interface TemplateLog { customMode: boolean; templateClass?: string; templateName?: string; cellValue?: CellValue; html?: string; } /** * 用户输入类型 * @description * 常量:枚举 * 自定义:用户键入字符串 * 变量:分为表单变量和组件变量 */ export declare enum UniInputType { Const = "Const", Custom = "Custom", LocalVariable = "LocalVariable", RemoteVariable = "RemoteVariable", Field = "Field" } export declare const UniInputTypeText: { [UniInputType.Const]: string; [UniInputType.Custom]: string; [UniInputType.LocalVariable]: string; [UniInputType.RemoteVariable]: string; [UniInputType.Field]: string; }; /** * 供用户编辑表格时选择的资源数据 * @description * 由外部传入,均为树结构数据(farris树) */ export interface ResourceData { localVariable?: any[]; remoteVariable?: any[]; field?: any[]; } /** * 与表单设计器集成 * 通过该类型识别是否模板编辑器参数 */ export declare const TYPE = "TemplateEditorLog";