@wufengteam/baguaeditor
Version:
低零融合编辑器封装
57 lines (56 loc) • 1.54 kB
TypeScript
import type { Component } from '@wufengteam/core/dist/cjs/types';
export interface FormField {
label: string;
name: string;
component?: Component;
}
export type ConditionOperatorString = 'empty' | 'notEmpty' | 'contains' | 'notContains' | 'equals' | 'notEquals' | 'range';
export interface ConditionOperator {
operator: ConditionOperatorString;
name: string;
}
export interface Condition {
field: FormField;
operator: ConditionOperator;
value: any;
valueType: any;
}
export type LogicalOperatorString = 'AND' | 'OR';
export interface Operator {
operator: LogicalOperatorString;
name: string;
}
export interface Node {
id: string;
type: 'condition' | 'operator';
value: Condition | Operator;
}
export type ActionType = 'show' | 'hide' | 'editable' | 'readonly' | 'prompt' | 'required';
export interface Action {
id: string;
type: ActionType;
fields?: string[];
hint?: string;
}
/**
* 状态:00A-启用,00X-未启用
*/
export type RuleState = '00A' | '00X';
export interface Rule {
id?: string;
name: string;
expressions: Node[];
actions: Action[];
state: RuleState;
}
/**
* 服务端返回的 Rule 数据
*/
export interface FormShowRuleDto {
busiObjectId?: string;
appId?: string;
attrShowRuleId?: string;
attrRuleJson: string;
statusCd?: RuleState;
}
export type ShowRuleResult = Record<string, Partial<Record<'hidden' | 'readonly' | 'hint', boolean | string>>>;