import type { ConditionExpression } from '@cloudpss/expression/definitions'; import type { ResourceContext } from '../context.js'; import type { FuncId } from '../function/index.js'; import type { DiagramPoint, DiagramSize } from './implements/diagram.js'; /** 模型类型 */ export const ModelCategory = Object.freeze(['simple', 'normal', 'component'] as const); /** 模型类型 */ export type ModelCategory = (typeof ModelCategory)[number]; /** @inheritdoc */ export interface ModelContext extends ResourceContext { /** 当前活动参数方案 */ currentConfig?: number; /** 当前活动计算方案 */ currentJob?: number; /** 当前活动计算方案类型 */ currentJobFilter?: FuncId; /** 模型类型 */ category?: ModelCategory; /** {@linkcode category}`: 'component'` 类型项目的分组信息 */ tag?: string; /** 图形上下文 */ graphic?: ModelContextGraphic; } /** 模型图形编辑时节点数据 */ export interface ModelContextGraphicNode { /** 节点 ID */ id: string; /** 节点显示的条件 */ condition?: ConditionExpression; /** 节点类型 */ shape: string; /** 节点位置 */ position?: DiagramPoint; /** 节点大小 */ size?: DiagramSize; /** 节点旋转角度,顺时针,0-360 */ angle?: number; } /** 模型图形编辑时数据 */ export interface ModelContextGraphic { /** 包含的节点 */ nodes: Record; /** 缩放时允许用户调整长宽比 */ allowAspectRatio?: boolean; }