UNPKG

element-easy-form

Version:

vue3.0 的自定义表单,基于element-Plus

171 lines (169 loc) 5.04 kB
import { DragFormType } from './componentAttrsType'; import { AttrType, ComponentType, SelectFuntion } from './enum'; export declare const SPANDEFAULT = 12; export declare const defaultOption: (val?: any) => { value: string; label: string; }; export declare const defaultLabel: (val?: any) => { label: string; }; /** * * @param val 长度 * @returns 随机返回英文字符串 */ export declare const getName: (val?: number) => string; /** * * @param val 长度 * @returns 随机返回中文字符串 */ export declare const getCName: (val?: number) => string; export declare const initPropLabel: (data: DragFormType) => void; export declare const formAndAttrsUpdata: (currentData: DragFormType, data: DragFormType) => void; /** * * @param data 组件属性列表数据 */ export declare const upDateFormItem: (data: DragFormType) => void; /** * * @param data 组件属性列表数据 * @returns moduel 数据 */ export declare const getModel: (data: DragFormType[]) => any; /** * 获取组件列表 */ export declare const getComponents: (data: DragFormType[]) => any; export declare const getRowAttrs: (data: DragFormType[]) => any; export declare const hiddenAttrs: () => { label: string; prop: string; type: AttrType; defaultValue: { matchPattern: SelectFuntion; type: SelectFuntion; dataSelect: never[]; value: boolean; dataJs: string; }; componentName: ComponentType; attrs: { placeholder: string; lang: string; title: string; }; rules: never[]; }; export interface FormItem { label: string; prop: string; } export declare const getCommonEvents: (filters?: any) => { type: AttrType; label: string; prop: string; defaultValue: string; componentName: ComponentType; attrs: { title: string; }; }[]; export declare const elFormItem: (data?: FormItem) => DragFormType[]; export declare const elFormClearable: () => DragFormType; export declare const elFormplaceholder: (msg: String) => DragFormType; export declare const ElSelectOptionDragFormData: (label?: any, value?: any, parentId?: string) => { title: string; componentName: ComponentType; attrs: {}; type: AttrType; attrsJson: { label: string; prop: string; type: AttrType; defaultValue: any; componentName: ComponentType; attrs: { placeholder: string; }; rules: { required: boolean; message: string; trigger: string; }[]; }[]; }; export declare const ElCheckboxDragFormData: (label?: any, value?: any, parentId?: string) => { title: string; componentName: ComponentType; attrs: {}; type: AttrType; parentId: string; attrsJson: { label: string; prop: string; type: AttrType; defaultValue: any; componentName: ComponentType; attrs: { placeholder: string; }; rules: { required: boolean; message: string; trigger: string; }[]; }[]; }; export declare const ElRadioAndCheckboxDragFormData: (label?: any, value?: any, parentId?: string) => { title: string; componentName: ComponentType; attrs: {}; parentId: string; type: AttrType; attrsJson: { label: string; prop: string; type: AttrType; defaultValue: any; componentName: ComponentType; attrs: { placeholder: string; }; rules: { required: boolean; message: string; trigger: string; }[]; }[]; }; /** * 截取{}里面的内容 并且拼装成函数返回 */ export declare const getFunctionTemplate: (str: string) => string; export declare const formatSelectFunction: (element: any) => string; /** * 控制显示隐藏逻辑 */ export declare const hidden: (element: any, model: any) => any; export declare const formatFunction: (element: any, model: any) => any; export declare const formatRules: (element: any) => any[]; export declare const formatSaveData: (props: any) => {}; /** * 多语言文本获取函数 * 根据语言标识和数据列表,获取指定 id 对应的多语言文本 * * @param language - 语言代码(如 'zh-CN', 'en-US'),如果为空则使用第一个可用语言 * @param data - 多语言数据列表,格式为 [{ id: string, [lang]: string, ... }, ...] * @param id - 要查找的文本标识符 * @returns 返回对应语言的文本,如果未找到则返回 id 本身 * * @example * // data = [{ id: 'hello', 'zh-CN': '你好', 'en-US': 'Hello' }] * getLanguage('zh-CN', data, 'hello') // 返回 '你好' * getLanguage('', data, 'hello') // 返回 '你好'(使用第一个可用语言) * getLanguage('en-US', data, 'world') // 返回 'world'(未找到时返回 id) */ export declare const getLanguage: (language: string, data: any, id: string) => string;