Initial commit
This commit is contained in:
88
modeler/src/views/decision/builder/element.ts
Normal file
88
modeler/src/views/decision/builder/element.ts
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* 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';
|
||||
import type { NodeSetting } from '@/views/decision/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 ElementPosition {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
export interface ElementVariable {
|
||||
key: NullableString;
|
||||
name: NullableString;
|
||||
value: NullableString;
|
||||
defaults: NullableString;
|
||||
unit: NullableString;
|
||||
}
|
||||
|
||||
export interface BaseElement {
|
||||
id: number;
|
||||
key: NullableString;
|
||||
type: NullableString;
|
||||
status: ElementStatus;
|
||||
}
|
||||
|
||||
export interface TaskNodeRect {
|
||||
width?: number;
|
||||
height?: number;
|
||||
x?: number;
|
||||
y?: number;
|
||||
}
|
||||
|
||||
export interface TaskNodeElement extends BaseElement {
|
||||
template: number;
|
||||
name: NullableString;
|
||||
description: NullableString;
|
||||
width: number;
|
||||
height: number;
|
||||
position: ElementPosition;
|
||||
inputs: any;
|
||||
outputs: any;
|
||||
variables: ElementVariable[];
|
||||
parameters: Record<any, any>;
|
||||
|
||||
children?: TaskNodeElement[],
|
||||
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export interface SettingTaskNodeElement extends TaskNodeElement {
|
||||
settings: NodeSetting[];
|
||||
}
|
||||
|
||||
|
||||
export interface EdgeNodeElement extends BaseElement {
|
||||
source: NullableString;
|
||||
target: NullableString;
|
||||
attrs: Record<any, any>;
|
||||
router: Record<any, any>;
|
||||
connector: any;
|
||||
}
|
||||
|
||||
export interface NodeGraph {
|
||||
edges: EdgeNodeElement[];
|
||||
nodes: TaskNodeElement[];
|
||||
}
|
||||
Reference in New Issue
Block a user