Files
auto-solution/modeler/src/views/decision/graph/element.ts

105 lines
2.1 KiB
TypeScript
Raw Normal View History

2026-02-08 15:59:14 +08:00
/*
* This file is part of the kernelstudio package.
*
* (c) 2014-2026 zlin <admin@kernelstudio.com>
*
* For the full copyright and license information, please view the LICENSE file
* that was distributed with this source code.
*/
2026-03-15 19:32:20 +08:00
2026-02-08 15:59:14 +08:00
import type { NullableString } from '@/types';
2026-02-08 17:57:40 +08:00
2026-03-15 19:32:20 +08:00
export interface GraphPosition {
x: number;
y: number;
}
export interface GraphRect {
width?: number;
height?: number;
x?: number;
y?: number;
}
export interface GraphDraggableElement {
2026-02-08 17:57:40 +08:00
id: number | null,
key?: NullableString,
name: NullableString,
description: NullableString,
category: NullableString,
draggable: boolean,
2026-03-15 19:32:20 +08:00
parent?: GraphDraggableElement,
children: GraphDraggableElement[]
[key: string]: unknown;
}
export interface GraphBaseElement {
id: number;
key: NullableString;
name: NullableString;
description: NullableString;
type: NullableString;
width: number;
height: number;
position: GraphPosition;
category: NullableString;
element?: GraphDraggableElement;
2026-02-08 22:31:13 +08:00
2026-02-08 17:57:40 +08:00
[key: string]: unknown;
}
2026-02-08 15:59:14 +08:00
2026-02-08 20:27:40 +08:00
export interface ElementParameter {
id: number,
templateId: number,
paramKey: NullableString,
dataType: NullableString,
defaultValue: NullableString,
description: NullableString,
templateType: NullableString,
}
2026-02-08 15:59:14 +08:00
export interface ElementVariable {
key: NullableString;
name: NullableString;
value: NullableString;
defaults: NullableString;
unit: NullableString;
}
2026-03-15 19:32:20 +08:00
export interface GraphTaskElement extends GraphBaseElement {
2026-02-08 15:59:14 +08:00
template: number;
2026-02-09 14:53:05 +08:00
templateType: NullableString,
2026-02-08 15:59:14 +08:00
inputs: any;
outputs: any;
2026-03-13 10:40:44 +08:00
order: number;
2026-02-08 15:59:14 +08:00
variables: ElementVariable[];
2026-02-08 20:27:40 +08:00
parameters: ElementParameter[];
children?: GraphTaskElement[],
2026-02-08 17:57:40 +08:00
2026-02-08 15:59:14 +08:00
[key: string]: unknown;
}
2026-03-15 19:32:20 +08:00
export interface ModelElement extends GraphBaseElement {
2026-02-08 20:27:40 +08:00
edges: GraphEdgeElement[];
2026-02-08 18:41:38 +08:00
}
2026-02-08 15:59:14 +08:00
2026-02-08 20:27:40 +08:00
export interface GraphEdgeElement {
id: number;
2026-02-08 18:41:38 +08:00
key: NullableString;
2026-02-08 15:59:14 +08:00
source: NullableString;
target: NullableString;
attrs: Record<any, any>;
router: Record<any, any>;
connector: any;
2026-02-08 20:27:40 +08:00
[key: string]: unknown;
2026-02-08 15:59:14 +08:00
}
2026-03-15 19:32:20 +08:00
export interface GraphContainer {
2026-02-08 20:27:40 +08:00
edges: GraphEdgeElement[];
nodes: GraphTaskElement[];
2026-02-08 15:59:14 +08:00
}