@farris/devkit-vue
Version:
161 lines (160 loc) • 3.11 kB
TypeScript
/**
* 表达式绑定字段类型(表达式绑定到实体、UIState?)
*/
export declare enum ExpressionBindingType {
State = "State",
Field = "Field",
Button = "Button",
Container = "Container"
}
/**
* 表达式类型
*/
export declare enum ExpressionType {
/**
* 必填表达式
*/
Required = "required",
/**
* 只读表达式
*/
Readonly = "readonly",
/**
* 计算表达式
*/
Compute = "compute",
/**
* 依赖表达式
*/
Dependency = "dependency",
/**
* 是否可见
*/
Visible = "visible",
/**
* 关联表达式
*/
Relative = "relative",
/**
* 校验表达式
*/
Validate = "validate",
/**
* 帮助前
*/
DataPicking = "dataPicking",
/**
* 禁用
*/
Disabled = "disabled",
/**
* BAP: BA统一查询平台数据转换
*/
DataTransformation = "dataTransformation"
}
export declare enum ExpressionMessageType {
error = "error",
info = "info",
warning = "warning"
}
export interface ExpressionRule {
id: string;
type: ExpressionType;
value: string;
elementId?: string;
message?: string;
messageType?: string;
}
export interface ExpressionConfig {
target: string;
targetType: ExpressionBindingType;
rules: ExpressionRule[];
[prop: string]: any;
}
/**
* 表达式对象
*/
export interface ExpressionObject {
/**
* 表达式唯一标识
*/
id: string;
/**
* 表达式绑定的路径
*/
path: string;
/**
* 表达式绑定类型State|Entity|Element
*/
bindingType: ExpressionBindingType;
/**
* 表达式类型
*/
type: ExpressionType;
/**
* 表达式
*/
expression: string;
/**
* 表达式依赖
*/
deps?: string[] | null;
/**
* 表达式namespace
*/
ns: string;
/**
* 表达式计算结果
*/
result?: any;
/**
* 结果作用路径
*/
effectPaths?: string[];
/**
* 提示信息
*/
message?: string | null;
/**
* 提示消息类型
*/
messageType?: string | null;
/**
* 表达式计算函数
*/
factory?: any;
elementId?: string;
/**
* BAP: BA统一查询平台表因为支持多个entity,所以表达式配置项新增了dataSource字段,用于标识表达式绑定的实体
*/
dataSource?: string;
}
/**
* 表达式执行器
*/
export interface Executor {
compile(expressionObject: ExpressionObject, context?: {
[prop: string]: any;
}): any;
}
export declare const DEFAULT_EXPRESSION_VALIDATE_MESSAGE: {
'zh-CHS': {
required: string;
validate: string;
dataPicking: string;
};
en: {
required: string;
validate: string;
dataPicking: string;
};
'zh-CHT': {
required: string;
validate: string;
dataPicking: string;
};
};
export interface ExpressionResultChange {
id: string;
result: any;
}