Initial commit
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
import type { NullableString } from '@/types';
|
||||
import type { ModelParameters } from '@/views/ai/model/types';
|
||||
|
||||
export interface DraggableElement {
|
||||
id: number | null,
|
||||
@@ -19,4 +20,42 @@ export interface DraggableElement {
|
||||
parent?: DraggableElement,
|
||||
children: DraggableElement[]
|
||||
[key: string]: unknown;
|
||||
}
|
||||
}
|
||||
|
||||
export interface ModelElementPosition {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
export interface ModelElementEdge {
|
||||
key: NullableString;
|
||||
sourceKey: NullableString;
|
||||
sourceName: NullableString;
|
||||
targetKey: NullableString;
|
||||
targetName: NullableString;
|
||||
}
|
||||
|
||||
export interface ModelBaseElement {
|
||||
key: string;
|
||||
name: string;
|
||||
type: string;
|
||||
width: number;
|
||||
height: number;
|
||||
position: ModelElementPosition;
|
||||
category: NullableString;
|
||||
element?: DraggableElement;
|
||||
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export interface ModelElement extends ModelBaseElement {
|
||||
// 连线
|
||||
edges: ModelElementEdge[];
|
||||
// 模型参数设置
|
||||
parameters: ModelParameters;
|
||||
}
|
||||
|
||||
export interface SavedGraphData {
|
||||
nodes: ModelElement[];
|
||||
edges: any[];
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
*/
|
||||
|
||||
import { Edge, Graph, Path, Selection } from '@antv/x6';
|
||||
import type { ModelElement } from '../model/types';
|
||||
import type { ModelElement } from './element';
|
||||
import type { Connecting } from '@antv/x6/lib/graph/options';
|
||||
import {createLineOptions} from './line'
|
||||
import { createLineOptions } from './line';
|
||||
|
||||
Graph.registerConnector(
|
||||
'sequenceFlowConnector',
|
||||
|
||||
@@ -12,7 +12,8 @@ import { type Dom, Graph, Node } from '@antv/x6';
|
||||
import type { NodeViewPositionEventArgs } from '@antv/x6/es/view/node/type';
|
||||
import { createGraphCanvas } from './graph';
|
||||
import { EventListener } from '@/utils/event';
|
||||
import type { ModelElement } from '../model/types';
|
||||
import type { ModelElement } from './element';
|
||||
|
||||
// import {createLineOptions} from './line'
|
||||
|
||||
export interface UseGraphCanvas {
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
<script lang="ts">
|
||||
import { defineComponent, onMounted, onUnmounted, ref } from 'vue';
|
||||
import { elementProps } from './props';
|
||||
import type { ModelElement } from '../model/types';
|
||||
import type { ModelElement } from './element';
|
||||
import { DeleteOutlined, SettingOutlined } from '@ant-design/icons-vue';
|
||||
import type { Graph } from '@antv/x6';
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
import { Graph, Node } from '@antv/x6';
|
||||
import { type ExtractPropTypes, type PropType } from 'vue';
|
||||
import type { ModelElement } from '../model/types';
|
||||
import type { ModelElement } from './element';
|
||||
|
||||
export const elementProps = {
|
||||
node: {
|
||||
|
||||
Reference in New Issue
Block a user