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

100 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.
*/
import type { NullableString } from '@/types';
2026-02-08 17:57:40 +08:00
export interface DraggableElement {
id: number | null,
key?: NullableString,
name: NullableString,
description: NullableString,
category: NullableString,
draggable: boolean,
parent?: DraggableElement,
children: DraggableElement[]
[key: string]: unknown;
}
2026-02-08 15:59:14 +08:00
export type ElementStatus = 'default' | 'success' | 'failed' | 'running' | string | null
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 20:41:49 +08:00
export interface GraphPosition {
2026-02-08 15:59:14 +08:00
x: number;
y: number;
}
export interface ElementVariable {
key: NullableString;
name: NullableString;
value: NullableString;
defaults: NullableString;
unit: NullableString;
}
export interface BaseElement {
2026-02-08 20:27:40 +08:00
id: number;
2026-02-08 20:41:49 +08:00
key: NullableString;
name: NullableString;
type: NullableString;
2026-02-08 18:41:38 +08:00
width: number;
height: number;
2026-02-08 20:41:49 +08:00
position: GraphPosition;
2026-02-08 18:41:38 +08:00
category: NullableString;
element?: DraggableElement;
[key: string]: unknown;
2026-02-08 15:59:14 +08:00
}
2026-02-08 20:41:49 +08:00
export interface GraphTaskRect {
2026-02-08 15:59:14 +08:00
width?: number;
height?: number;
x?: number;
y?: number;
}
2026-02-08 20:27:40 +08:00
export interface GraphTaskElement extends BaseElement {
2026-02-08 15:59:14 +08:00
template: number;
inputs: any;
outputs: any;
variables: ElementVariable[];
2026-02-08 20:27:40 +08:00
parameters: ElementParameter[];
2026-02-08 15:59:14 +08:00
2026-02-08 20:27:40 +08:00
children?: GraphTaskElement[],
2026-02-08 17:57:40 +08:00
2026-02-08 15:59:14 +08:00
[key: string]: unknown;
}
2026-02-08 18:41:38 +08:00
export interface ModelElement extends BaseElement {
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
}
export interface NodeGraph {
2026-02-08 20:27:40 +08:00
edges: GraphEdgeElement[];
nodes: GraphTaskElement[];
2026-02-08 15:59:14 +08:00
}