Files
auto-solution/modeler/src/views/decision/builder/element.ts
2026-02-08 20:41:49 +08:00

100 lines
2.1 KiB
TypeScript

/*
* 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';
export interface DraggableElement {
id: number | null,
key?: NullableString,
name: NullableString,
description: NullableString,
category: NullableString,
draggable: boolean,
parent?: DraggableElement,
children: DraggableElement[]
[key: string]: unknown;
}
export type ElementStatus = 'default' | 'success' | 'failed' | 'running' | string | null
export interface ElementParameter {
id: number,
templateId: number,
paramKey: NullableString,
dataType: NullableString,
defaultValue: NullableString,
description: NullableString,
templateType: NullableString,
}
export interface GraphPosition {
x: number;
y: number;
}
export interface ElementVariable {
key: NullableString;
name: NullableString;
value: NullableString;
defaults: NullableString;
unit: NullableString;
}
export interface BaseElement {
id: number;
key: NullableString;
name: NullableString;
type: NullableString;
width: number;
height: number;
position: GraphPosition;
category: NullableString;
element?: DraggableElement;
[key: string]: unknown;
}
export interface GraphTaskRect {
width?: number;
height?: number;
x?: number;
y?: number;
}
export interface GraphTaskElement extends BaseElement {
template: number;
inputs: any;
outputs: any;
variables: ElementVariable[];
parameters: ElementParameter[];
children?: GraphTaskElement[],
[key: string]: unknown;
}
export interface ModelElement extends BaseElement {
edges: GraphEdgeElement[];
}
export interface GraphEdgeElement {
id: number;
key: NullableString;
source: NullableString;
target: NullableString;
attrs: Record<any, any>;
router: Record<any, any>;
connector: any;
[key: string]: unknown;
}
export interface NodeGraph {
edges: GraphEdgeElement[];
nodes: GraphTaskElement[];
}