UNPKG

@lcap/asl

Version:

NetEase Application Specific Language

135 lines (134 loc) 3.06 kB
import { LEVEL_ENUM, Vertex, Schema, Structure, ActionOptions } from '..'; /** * 数据结构属性类 */ export declare class StructureProperty extends Vertex implements Schema { /** * 概念类型 */ level: LEVEL_ENUM; /** * Id */ readonly id: string; /** * 名称 */ readonly name: string; /** * 标签 */ readonly label: string; /** * 描述 */ readonly description: string; /** * type */ readonly type: string; /** * 数据格式 */ readonly format: string; /** * generic 数据格式 */ readonly typeInstantiation: Schema; /** * 是否必须 */ readonly required: boolean; /** * 数据类型 */ readonly $ref: string; /** * 是否为数组,老的 Schema 中仍然用这种形式 */ readonly isArray: boolean; /** * 规则列表 */ readonly rules: any; /** * 默认值 */ readonly defaultValue: string | boolean | number; /** * 父级 Id */ readonly structureId: string; /** * 父级引用 */ root: Structure; /** * 节点是否为叶子节点 * 前端 UI 状态 */ isLeaf: boolean; /** * 周边存在的名称 */ existingNames: Array<string>; /** * @param source 需要合并的部分参数 */ constructor(source?: Partial<StructureProperty>); /** * 添加数据结构属性 */ create(none?: void, actionOptions?: ActionOptions): Promise<this>; /** * 删除数据结构属性 */ delete(none?: void, actionOptions?: ActionOptions): Promise<void>; /** * 修改数据结构属性 */ update(none?: void, actionOptions?: ActionOptions, then?: () => Promise<any>): Promise<this>; /** * 设置数据结构属性名称 * @param name 名称 */ setName(name: string): Promise<void>; /** * 设置数据结构属性标题 * @param label 标题 */ setLabel(label: string): Promise<void>; /** * 设置数据结构属性描述 * @param description 描述 */ setDescription(description: string): Promise<void>; /** * 查找schema 顶点被引用的逻辑顶点列表 */ getSchemaUsage(): Promise<any>; /** * 设置数据结构属性类型 */ setDataType(schema: Schema): Promise<void>; /** * 设置数据结构属性是否为列表 * @param isArray */ setAsList(isArray: boolean): Promise<void>; /** * 设置数据结构属性默认值 */ setDefaultValue(defaultValue: string): Promise<void>; /** * 设置数据结构属性必须 * @param required 必须 */ setRequired(required: boolean): Promise<void>; setRules(rules: any): Promise<void>; /** * 从后端 JSON 生成规范的 StructureProperty 对象 */ static from(source: any, root: Structure): void; } export default StructureProperty;