@lcap/asl
Version:
NetEase Application Specific Language
80 lines (79 loc) • 1.98 kB
TypeScript
import { LEVEL_ENUM, Vertex, Element, ExpressionNode, ActionOptions } from '..';
/**
* 前端组件属性
* 纯组件属性,不包含事件、指令等
* @examples
* - 纯字符串:color="primary"
* - 静态表达式::min="23"
* - 静态表达式::data="[{ text: '选项1', value: '选项1' }, { text: '选项2', value: '选项2' }]"
* - 动态表达式::expr="$utils.LowerCase(a + b)"
*/
export declare class Attr extends Vertex {
/**
* 概念类型
*/
readonly level: LEVEL_ENUM;
/**
* 属性类型
*/
readonly type: 'string' | 'static' | 'dynamic';
/**
* 属性 Id
*/
readonly id: string;
/**
* 属性名
*/
readonly name: string;
/**
* 属性原始值
* 用户输入框中填入的值,同样也是 HTML 中 "" 中间的字符串
* 和 ASTElement 中的有区别
*/
readonly value: string;
/**
* model 是否开启
*/
readonly model?: boolean;
/**
* sync 是否开启
*/
readonly sync?: boolean;
/**
* 关联的动态表达式
*/
readonly expression?: ExpressionNode;
/**
* 所属元素 Id
*/
readonly elementId: string;
/**
* 所属元素
*/
readonly element: Element;
/**
* @param source 需要合并的部分参数
*/
constructor(source?: Partial<Attr>);
/**
* 转换成 Vue 的模板格式
*/
toVue(placeholder?: any, finalCode?: boolean): string;
/**
* 从后端 JSON 生成规范的 Attr 对象
*/
static from(source: any, element: Element): Attr;
/**
* 添加组件属性
*/
create(none?: void, actionOptions?: ActionOptions): Promise<this>;
/**
* 删除组件属性
*/
delete(none?: void, actionOptions?: ActionOptions): Promise<this>;
/**
* 修改组件属性
*/
update(data?: Attr, actionOptions?: ActionOptions): Promise<this>;
}
export default Attr;