v-nuxt-ui 0.1.9 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -0
- package/dist/runtime/components/date-picker/index.d.vue.ts +2 -1
- package/dist/runtime/components/date-picker/index.vue +1 -1
- package/dist/runtime/components/date-picker/index.vue.d.ts +2 -1
- package/dist/runtime/components/form/create-modal-template/WithApi.d.vue.ts +2 -2
- package/dist/runtime/components/form/create-modal-template/WithApi.vue.d.ts +2 -2
- package/dist/runtime/components/form/create-modal-template/index.d.vue.ts +2 -2
- package/dist/runtime/components/form/create-modal-template/index.vue.d.ts +2 -2
- package/dist/runtime/composables/api/index.d.ts +0 -1
- package/dist/runtime/composables/api/index.js +0 -1
- package/dist/runtime/composables/api/sys/useAuthApi.d.ts +4 -4
- package/dist/runtime/composables/api/sys/useCompanyApi.d.ts +2 -1
- package/dist/runtime/composables/api/sys/useDepartmentApi.d.ts +2 -2
- package/dist/runtime/composables/api/sys/useJobTitleApi.d.ts +2 -1
- package/dist/runtime/composables/api/sys/useLoginApi.d.ts +4 -4
- package/dist/runtime/composables/api/sys/useMenuApi.d.ts +2 -2
- package/dist/runtime/composables/api/sys/useRoleApi.d.ts +2 -2
- package/dist/runtime/composables/api/sys/useRowRecord.d.ts +4 -4
- package/dist/runtime/composables/api/sys/useUserApi.d.ts +3 -3
- package/dist/runtime/composables/api/useModel.d.ts +2 -1
- package/dist/runtime/composables/index.js +1 -1
- package/dist/runtime/composables/useAuth.d.ts +112 -5
- package/dist/runtime/composables/useAuth.js +1 -1
- package/dist/runtime/composables/useDate.d.ts +2 -1
- package/dist/runtime/composables/useForm.d.ts +2 -2
- package/dist/runtime/composables/useForm.js +1 -1
- package/dist/runtime/composables/usePermission.d.ts +3 -2
- package/dist/runtime/composables/useSidebarMenu.d.ts +37 -19
- package/dist/runtime/constants/columns.d.ts +3 -3
- package/dist/runtime/constants/time.d.ts +1 -0
- package/dist/runtime/plugins/05.api.d.ts +6 -0
- package/dist/runtime/plugins/05.api.js +157 -0
- package/dist/runtime/types/cmds/index.d.ts +3 -0
- package/dist/runtime/types/cmds/index.js +3 -0
- package/dist/runtime/types/cmds/login.d.ts +19 -23
- package/dist/runtime/types/cmds/login.js +0 -0
- package/dist/runtime/types/cmds/sys.d.ts +7 -10
- package/dist/runtime/types/cmds/sys.js +0 -0
- package/dist/runtime/types/cmds/user.d.ts +4 -8
- package/dist/runtime/types/cmds/user.js +0 -0
- package/dist/runtime/types/index.d.ts +2 -0
- package/dist/runtime/types/index.js +2 -0
- package/dist/runtime/types/models/base.d.ts +12 -15
- package/dist/runtime/types/models/base.js +0 -0
- package/dist/runtime/types/models/index.d.ts +2 -0
- package/dist/runtime/types/models/index.js +2 -0
- package/dist/runtime/types/models/sys.d.ts +84 -107
- package/dist/runtime/types/models/sys.js +0 -0
- package/dist/runtime/types/storage.d.ts +13 -0
- package/package.json +3 -2
- package/dist/runtime/composables/api/flow/index.d.ts +0 -3
- package/dist/runtime/composables/api/flow/index.js +0 -3
- package/dist/runtime/composables/api/flow/useFlowApi.d.ts +0 -1
- package/dist/runtime/composables/api/flow/useFlowApi.js +0 -3
- package/dist/runtime/composables/api/flow/useFlowNodeApi.d.ts +0 -1
- package/dist/runtime/composables/api/flow/useFlowNodeApi.js +0 -3
- package/dist/runtime/composables/api/flow/useFlowNodeLinkApi.d.ts +0 -1
- package/dist/runtime/composables/api/flow/useFlowNodeLinkApi.js +0 -3
- package/dist/runtime/composables/flow/index.d.ts +0 -3
- package/dist/runtime/composables/flow/index.js +0 -3
- package/dist/runtime/composables/flow/useFlow.d.ts +0 -46
- package/dist/runtime/composables/flow/useFlow.js +0 -162
- package/dist/runtime/composables/flow/useFlowResize.d.ts +0 -56
- package/dist/runtime/composables/flow/useFlowResize.js +0 -148
- package/dist/runtime/types/constants/time.d.ts +0 -5
- package/dist/runtime/types/localStorage.d.ts +0 -15
- package/dist/runtime/types/models/flow.d.ts +0 -31
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import { ref, watch } from "vue";
|
|
2
|
-
import { MarkerType } from "@vue-flow/core";
|
|
3
|
-
import { useFlowApi, useFlowNodeApi, useFlowNodeLinkApi } from "#v/composables";
|
|
4
|
-
export function useFlow(options) {
|
|
5
|
-
const { flow, onUpdateModel } = options;
|
|
6
|
-
const GRID_SIZE = 16;
|
|
7
|
-
const DEFAULT_NODE_WIDTH = GRID_SIZE * 10;
|
|
8
|
-
const DEFAULT_NODE_HEIGHT = GRID_SIZE * 6;
|
|
9
|
-
const flowApi = useFlowApi();
|
|
10
|
-
const flowNodeApi = useFlowNodeApi();
|
|
11
|
-
const flowNodeLinkApi = useFlowNodeLinkApi();
|
|
12
|
-
const nodes = ref([]);
|
|
13
|
-
const edges = ref([]);
|
|
14
|
-
const cleanHandleId = (handleId) => handleId?.replace(/-(source|target)$/, "");
|
|
15
|
-
const refreshFlow = async () => {
|
|
16
|
-
if (!flow?.value?.id) return;
|
|
17
|
-
const { data } = await flowApi.getById(flow.value.id);
|
|
18
|
-
if (data.value?.data && onUpdateModel?.value) {
|
|
19
|
-
onUpdateModel.value(data.value.data);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
const transformNode = (node, handlers) => ({
|
|
23
|
-
id: String(node.id),
|
|
24
|
-
type: "custom",
|
|
25
|
-
position: { x: node.positionX || 0, y: node.positionY || 0 },
|
|
26
|
-
label: node.name || "",
|
|
27
|
-
selectable: true,
|
|
28
|
-
style: {
|
|
29
|
-
width: node.width ? `${node.width}px` : void 0,
|
|
30
|
-
height: node.height ? `${node.height}px` : void 0
|
|
31
|
-
},
|
|
32
|
-
data: {
|
|
33
|
-
...node,
|
|
34
|
-
...handlers
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
const transformEdge = (link, styleOptions) => ({
|
|
38
|
-
id: String(link.id),
|
|
39
|
-
type: "custom",
|
|
40
|
-
source: String(link.parentId),
|
|
41
|
-
sourceHandle: link.parentHandlePos ? cleanHandleId(link.parentHandlePos) : null,
|
|
42
|
-
target: String(link.childId),
|
|
43
|
-
targetHandle: link.childHandlePos ? cleanHandleId(link.childHandlePos) : null,
|
|
44
|
-
label: link.label || "",
|
|
45
|
-
selectable: true,
|
|
46
|
-
style: styleOptions?.strokeWidth ? { strokeWidth: styleOptions.strokeWidth } : void 0,
|
|
47
|
-
markerStart: styleOptions?.markerStart ? MarkerType.Arrow : void 0,
|
|
48
|
-
markerEnd: styleOptions?.markerEnd ? MarkerType.Arrow : void 0,
|
|
49
|
-
data: { ...link }
|
|
50
|
-
});
|
|
51
|
-
const syncNodes = (nodeHandlers) => {
|
|
52
|
-
if (!flow?.value) return;
|
|
53
|
-
nodes.value = (flow.value.nodes || []).map(
|
|
54
|
-
(node) => transformNode(node, nodeHandlers ? nodeHandlers(String(node.id)) : void 0)
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
const syncEdges = (styleOptions) => {
|
|
58
|
-
if (!flow?.value) return;
|
|
59
|
-
edges.value = (flow.value.links || []).map((link) => transformEdge(link, styleOptions));
|
|
60
|
-
};
|
|
61
|
-
const applyEdgeStyles = (styleOptions) => {
|
|
62
|
-
syncEdges(styleOptions);
|
|
63
|
-
};
|
|
64
|
-
const updateNode = async (updatedNode) => {
|
|
65
|
-
await flowNodeApi.update(updatedNode);
|
|
66
|
-
await refreshFlow();
|
|
67
|
-
};
|
|
68
|
-
const deleteNode = async (nodeId) => {
|
|
69
|
-
const node = flow?.value?.nodes?.find((n) => String(n.id) === nodeId);
|
|
70
|
-
if (!node?.id) return;
|
|
71
|
-
const relatedLinkIds = flow?.value?.links?.filter((link) => link.parentId === node.id || link.childId === node.id)?.map((link) => link.id)?.filter((id) => id !== void 0) || [];
|
|
72
|
-
if (relatedLinkIds.length > 0) {
|
|
73
|
-
await flowNodeLinkApi.batchDelete({ ids: relatedLinkIds });
|
|
74
|
-
}
|
|
75
|
-
await flowNodeApi.deleteById(node.id);
|
|
76
|
-
await refreshFlow();
|
|
77
|
-
};
|
|
78
|
-
const deleteEdge = async (edgeId) => {
|
|
79
|
-
const link = flow?.value?.links?.find((l) => String(l.id) === edgeId);
|
|
80
|
-
if (!link?.id) return;
|
|
81
|
-
await flowNodeLinkApi.deleteById(link.id);
|
|
82
|
-
await refreshFlow();
|
|
83
|
-
};
|
|
84
|
-
const createEdge = async (params) => {
|
|
85
|
-
if (!flow?.value) return;
|
|
86
|
-
const newLink = {
|
|
87
|
-
id: 0,
|
|
88
|
-
flowId: flow.value.id,
|
|
89
|
-
parentId: Number(params.source),
|
|
90
|
-
parentHandlePos: cleanHandleId(params.sourceHandle),
|
|
91
|
-
childId: Number(params.target),
|
|
92
|
-
childHandlePos: cleanHandleId(params.targetHandle),
|
|
93
|
-
label: ""
|
|
94
|
-
};
|
|
95
|
-
await flowNodeLinkApi.create(newLink);
|
|
96
|
-
await refreshFlow();
|
|
97
|
-
};
|
|
98
|
-
const updateNodePosition = async (nodeId, x, y) => {
|
|
99
|
-
const originalNode = flow?.value?.nodes?.find((n) => String(n.id) === nodeId);
|
|
100
|
-
if (!originalNode) return;
|
|
101
|
-
await flowNodeApi.update({
|
|
102
|
-
id: originalNode.id,
|
|
103
|
-
version: originalNode.version,
|
|
104
|
-
positionX: x,
|
|
105
|
-
positionY: y
|
|
106
|
-
});
|
|
107
|
-
await refreshFlow();
|
|
108
|
-
};
|
|
109
|
-
const updateNodeDimensions = async (nodeId, dimensions) => {
|
|
110
|
-
const node = flow?.value?.nodes?.find((n) => String(n.id) === nodeId);
|
|
111
|
-
if (!node) return;
|
|
112
|
-
await flowNodeApi.update({
|
|
113
|
-
id: node.id,
|
|
114
|
-
version: node.version,
|
|
115
|
-
...dimensions
|
|
116
|
-
});
|
|
117
|
-
await refreshFlow();
|
|
118
|
-
};
|
|
119
|
-
const createNode = async () => {
|
|
120
|
-
if (!flow?.value) return;
|
|
121
|
-
const nodeCount = flow.value.nodes?.length || 0;
|
|
122
|
-
const newNode = {
|
|
123
|
-
id: 0,
|
|
124
|
-
flowId: flow.value.id,
|
|
125
|
-
name: `\u8282\u70B9 ${nodeCount + 1}`,
|
|
126
|
-
positionX: GRID_SIZE * (10 + nodeCount * 3),
|
|
127
|
-
positionY: GRID_SIZE * (10 + nodeCount * 3),
|
|
128
|
-
width: DEFAULT_NODE_WIDTH,
|
|
129
|
-
height: DEFAULT_NODE_HEIGHT
|
|
130
|
-
};
|
|
131
|
-
await flowNodeApi.create(newNode);
|
|
132
|
-
await refreshFlow();
|
|
133
|
-
};
|
|
134
|
-
watch(
|
|
135
|
-
() => flow?.value,
|
|
136
|
-
(newFlow) => {
|
|
137
|
-
if (!newFlow) return;
|
|
138
|
-
syncEdges();
|
|
139
|
-
},
|
|
140
|
-
{ immediate: true, deep: true }
|
|
141
|
-
);
|
|
142
|
-
return {
|
|
143
|
-
// 状态
|
|
144
|
-
nodes,
|
|
145
|
-
edges,
|
|
146
|
-
GRID_SIZE,
|
|
147
|
-
// 前端操作方法(仅更新前端状态)
|
|
148
|
-
syncNodes,
|
|
149
|
-
syncEdges,
|
|
150
|
-
applyEdgeStyles,
|
|
151
|
-
transformNode,
|
|
152
|
-
// 后端操作方法(调用 API 更新后端)
|
|
153
|
-
refreshFlow,
|
|
154
|
-
updateNode,
|
|
155
|
-
updateNodePosition,
|
|
156
|
-
updateNodeDimensions,
|
|
157
|
-
createNode,
|
|
158
|
-
deleteNode,
|
|
159
|
-
deleteEdge,
|
|
160
|
-
createEdge
|
|
161
|
-
};
|
|
162
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { type Ref } from 'vue';
|
|
2
|
-
type EdgePosition = 'top' | 'right' | 'bottom' | 'left' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
3
|
-
type FlowResizeNode = {
|
|
4
|
-
id: string | number;
|
|
5
|
-
position: {
|
|
6
|
-
x: number;
|
|
7
|
-
y: number;
|
|
8
|
-
};
|
|
9
|
-
style?: any;
|
|
10
|
-
data?: Record<string, any>;
|
|
11
|
-
};
|
|
12
|
-
export interface UseFlowResizeDimensions {
|
|
13
|
-
width: number;
|
|
14
|
-
height: number;
|
|
15
|
-
positionX: number;
|
|
16
|
-
positionY: number;
|
|
17
|
-
}
|
|
18
|
-
export interface UseFlowResizeOptions {
|
|
19
|
-
gridSize: number;
|
|
20
|
-
minWidth?: number;
|
|
21
|
-
maxWidth?: number;
|
|
22
|
-
minHeight?: number;
|
|
23
|
-
maxHeight?: number;
|
|
24
|
-
nodes: Ref<FlowResizeNode[]>;
|
|
25
|
-
getViewport: () => {
|
|
26
|
-
zoom: number;
|
|
27
|
-
} | undefined;
|
|
28
|
-
onResizeEnd?: (nodeId: string, dimensions: UseFlowResizeDimensions) => void;
|
|
29
|
-
}
|
|
30
|
-
export interface UseFlowResizeReturn {
|
|
31
|
-
resizingNode: Ref<ResizeState | null>;
|
|
32
|
-
hoveredNodeId: Ref<string | null>;
|
|
33
|
-
hoveredNodeEdge: Ref<EdgePosition | null>;
|
|
34
|
-
detectEdge: (event: MouseEvent, element: HTMLElement) => EdgePosition | null;
|
|
35
|
-
getCursorStyle: (edge: EdgePosition | null) => string;
|
|
36
|
-
startResize: (event: MouseEvent, nodeId: string, nodeData: any, edge: EdgePosition) => void;
|
|
37
|
-
handleMouseMove: (event: MouseEvent) => void;
|
|
38
|
-
handleMouseUp: () => void;
|
|
39
|
-
createNodeHandlers: (nodeId: string) => {
|
|
40
|
-
onMouseEnter: () => void;
|
|
41
|
-
onMouseLeave: () => void;
|
|
42
|
-
onMouseMove: (event: MouseEvent, element: HTMLElement) => void;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
interface ResizeState {
|
|
46
|
-
id: string;
|
|
47
|
-
startX: number;
|
|
48
|
-
startY: number;
|
|
49
|
-
startWidth: number;
|
|
50
|
-
startHeight: number;
|
|
51
|
-
startPosX: number;
|
|
52
|
-
startPosY: number;
|
|
53
|
-
edge: EdgePosition;
|
|
54
|
-
}
|
|
55
|
-
export declare function useFlowResize(options: UseFlowResizeOptions): UseFlowResizeReturn;
|
|
56
|
-
export {};
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { ref } from "vue";
|
|
2
|
-
export function useFlowResize(options) {
|
|
3
|
-
const {
|
|
4
|
-
gridSize,
|
|
5
|
-
minWidth = gridSize * 2,
|
|
6
|
-
maxWidth = gridSize * 20,
|
|
7
|
-
minHeight = gridSize * 2,
|
|
8
|
-
maxHeight = gridSize * 20,
|
|
9
|
-
nodes,
|
|
10
|
-
getViewport,
|
|
11
|
-
onResizeEnd
|
|
12
|
-
} = options;
|
|
13
|
-
const EDGE_THRESHOLD = 8;
|
|
14
|
-
const CURSOR_MAP = {
|
|
15
|
-
"top": "ns-resize",
|
|
16
|
-
"bottom": "ns-resize",
|
|
17
|
-
"left": "ew-resize",
|
|
18
|
-
"right": "ew-resize",
|
|
19
|
-
"top-left": "nwse-resize",
|
|
20
|
-
"top-right": "nesw-resize",
|
|
21
|
-
"bottom-left": "nesw-resize",
|
|
22
|
-
"bottom-right": "nwse-resize"
|
|
23
|
-
};
|
|
24
|
-
const resizingNode = ref(null);
|
|
25
|
-
const hoveredNodeId = ref(null);
|
|
26
|
-
const hoveredNodeEdge = ref(null);
|
|
27
|
-
const detectEdge = (event, element) => {
|
|
28
|
-
const rect = element.getBoundingClientRect();
|
|
29
|
-
const x = event.clientX - rect.left;
|
|
30
|
-
const y = event.clientY - rect.top;
|
|
31
|
-
const nearTop = y <= EDGE_THRESHOLD;
|
|
32
|
-
const nearBottom = y >= rect.height - EDGE_THRESHOLD;
|
|
33
|
-
const nearLeft = x <= EDGE_THRESHOLD;
|
|
34
|
-
const nearRight = x >= rect.width - EDGE_THRESHOLD;
|
|
35
|
-
if (nearTop && nearLeft) return "top-left";
|
|
36
|
-
if (nearTop && nearRight) return "top-right";
|
|
37
|
-
if (nearBottom && nearLeft) return "bottom-left";
|
|
38
|
-
if (nearBottom && nearRight) return "bottom-right";
|
|
39
|
-
if (nearTop) return "top";
|
|
40
|
-
if (nearBottom) return "bottom";
|
|
41
|
-
if (nearLeft) return "left";
|
|
42
|
-
if (nearRight) return "right";
|
|
43
|
-
return null;
|
|
44
|
-
};
|
|
45
|
-
const getCursorStyle = (edge) => edge ? CURSOR_MAP[edge] : "default";
|
|
46
|
-
const snapToGrid = (value) => Math.round(value / gridSize) * gridSize;
|
|
47
|
-
const calculateNewDimensions = (edge, deltaX, deltaY, startWidth, startHeight, startPosX, startPosY) => {
|
|
48
|
-
let newWidth = startWidth;
|
|
49
|
-
let newHeight = startHeight;
|
|
50
|
-
let newPosX = startPosX;
|
|
51
|
-
let newPosY = startPosY;
|
|
52
|
-
if (edge.includes("left")) {
|
|
53
|
-
const rawWidth = startWidth - deltaX;
|
|
54
|
-
newWidth = snapToGrid(Math.max(minWidth, Math.min(maxWidth, rawWidth)));
|
|
55
|
-
newPosX = startPosX + (startWidth - newWidth);
|
|
56
|
-
} else if (edge.includes("right")) {
|
|
57
|
-
const rawWidth = startWidth + deltaX;
|
|
58
|
-
newWidth = snapToGrid(Math.max(minWidth, Math.min(maxWidth, rawWidth)));
|
|
59
|
-
}
|
|
60
|
-
if (edge.includes("top")) {
|
|
61
|
-
const rawHeight = startHeight - deltaY;
|
|
62
|
-
newHeight = snapToGrid(Math.max(minHeight, Math.min(maxHeight, rawHeight)));
|
|
63
|
-
newPosY = startPosY + (startHeight - newHeight);
|
|
64
|
-
} else if (edge.includes("bottom")) {
|
|
65
|
-
const rawHeight = startHeight + deltaY;
|
|
66
|
-
newHeight = snapToGrid(Math.max(minHeight, Math.min(maxHeight, rawHeight)));
|
|
67
|
-
}
|
|
68
|
-
return { newWidth, newHeight, newPosX, newPosY };
|
|
69
|
-
};
|
|
70
|
-
const startResize = (event, nodeId, nodeData, edge) => {
|
|
71
|
-
event.stopPropagation();
|
|
72
|
-
event.preventDefault();
|
|
73
|
-
resizingNode.value = {
|
|
74
|
-
id: nodeId,
|
|
75
|
-
startX: event.clientX,
|
|
76
|
-
startY: event.clientY,
|
|
77
|
-
startWidth: nodeData.width || gridSize * 10,
|
|
78
|
-
startHeight: nodeData.height || gridSize * 6,
|
|
79
|
-
startPosX: nodeData.positionX || 0,
|
|
80
|
-
startPosY: nodeData.positionY || 0,
|
|
81
|
-
edge
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
const handleMouseMove = (event) => {
|
|
85
|
-
if (!resizingNode.value) return;
|
|
86
|
-
const viewport = getViewport();
|
|
87
|
-
const zoom = viewport?.zoom || 1;
|
|
88
|
-
const deltaX = (event.clientX - resizingNode.value.startX) / zoom;
|
|
89
|
-
const deltaY = (event.clientY - resizingNode.value.startY) / zoom;
|
|
90
|
-
const { newWidth, newHeight, newPosX, newPosY } = calculateNewDimensions(
|
|
91
|
-
resizingNode.value.edge,
|
|
92
|
-
deltaX,
|
|
93
|
-
deltaY,
|
|
94
|
-
resizingNode.value.startWidth,
|
|
95
|
-
resizingNode.value.startHeight,
|
|
96
|
-
resizingNode.value.startPosX,
|
|
97
|
-
resizingNode.value.startPosY
|
|
98
|
-
);
|
|
99
|
-
const nodeIndex = nodes.value.findIndex((n) => String(n.id) === resizingNode.value.id);
|
|
100
|
-
if (nodeIndex < 0) return;
|
|
101
|
-
const node = nodes.value[nodeIndex];
|
|
102
|
-
if (!node) return;
|
|
103
|
-
node.position = { x: newPosX, y: newPosY };
|
|
104
|
-
node.style = { ...node.style, width: `${newWidth}px`, height: `${newHeight}px` };
|
|
105
|
-
node.data = { ...node.data || {}, width: newWidth, height: newHeight, positionX: newPosX, positionY: newPosY };
|
|
106
|
-
};
|
|
107
|
-
const handleMouseUp = () => {
|
|
108
|
-
if (!resizingNode.value) return;
|
|
109
|
-
const updatedNode = nodes.value.find((n) => String(n.id) === resizingNode.value.id);
|
|
110
|
-
if (updatedNode && onResizeEnd) {
|
|
111
|
-
onResizeEnd(String(updatedNode.id), {
|
|
112
|
-
width: Number(updatedNode.data?.width ?? 0),
|
|
113
|
-
height: Number(updatedNode.data?.height ?? 0),
|
|
114
|
-
positionX: updatedNode.position.x,
|
|
115
|
-
positionY: updatedNode.position.y
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
resizingNode.value = null;
|
|
119
|
-
};
|
|
120
|
-
const createNodeHandlers = (nodeId) => ({
|
|
121
|
-
onMouseEnter: () => {
|
|
122
|
-
hoveredNodeId.value = nodeId;
|
|
123
|
-
},
|
|
124
|
-
onMouseLeave: () => {
|
|
125
|
-
hoveredNodeId.value = null;
|
|
126
|
-
hoveredNodeEdge.value = null;
|
|
127
|
-
},
|
|
128
|
-
onMouseMove: (event, element) => {
|
|
129
|
-
if (resizingNode.value) return;
|
|
130
|
-
const edge = detectEdge(event, element);
|
|
131
|
-
hoveredNodeEdge.value = edge;
|
|
132
|
-
element.style.cursor = getCursorStyle(edge);
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
return {
|
|
136
|
-
// 状态
|
|
137
|
-
resizingNode,
|
|
138
|
-
hoveredNodeId,
|
|
139
|
-
hoveredNodeEdge,
|
|
140
|
-
// 方法
|
|
141
|
-
detectEdge,
|
|
142
|
-
getCursorStyle,
|
|
143
|
-
startResize,
|
|
144
|
-
handleMouseMove,
|
|
145
|
-
handleMouseUp,
|
|
146
|
-
createNodeHandlers
|
|
147
|
-
};
|
|
148
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
declare namespace LocalStorage {
|
|
2
|
-
type Column = {
|
|
3
|
-
accessorKey: string
|
|
4
|
-
checked?: boolean
|
|
5
|
-
width?: string | number
|
|
6
|
-
fixed: 'left' | 'right' | 'unfixed'
|
|
7
|
-
}
|
|
8
|
-
type TableSettings<T> = {
|
|
9
|
-
columns?: Column[]
|
|
10
|
-
pageSize?: number
|
|
11
|
-
whereQuery?: import('./query').WhereQuery<T>
|
|
12
|
-
whereQueryOpen?: boolean
|
|
13
|
-
orderQuery?: import('./query').OrderQuery<T>
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
declare namespace Model {
|
|
2
|
-
type Flow = {
|
|
3
|
-
name?: string
|
|
4
|
-
description?: string
|
|
5
|
-
nodes?: FlowNode[]
|
|
6
|
-
links?: FlowNodeLink[]
|
|
7
|
-
} & BaseModel
|
|
8
|
-
|
|
9
|
-
type FlowNode = {
|
|
10
|
-
flowId?: number
|
|
11
|
-
name?: string
|
|
12
|
-
positionX?: number
|
|
13
|
-
positionY?: number
|
|
14
|
-
width?: number
|
|
15
|
-
height?: number
|
|
16
|
-
indicators?: Indicator[]
|
|
17
|
-
parentLinks?: FlowNodeLink[]
|
|
18
|
-
childLinks?: FlowNodeLink[]
|
|
19
|
-
} & BaseModel
|
|
20
|
-
|
|
21
|
-
type FlowNodeLink = {
|
|
22
|
-
flowId?: number
|
|
23
|
-
parentId?: number
|
|
24
|
-
parentHandlePos?: string
|
|
25
|
-
childId?: number
|
|
26
|
-
childHandlePos?: string
|
|
27
|
-
label?: string
|
|
28
|
-
condition?: string
|
|
29
|
-
order?: number
|
|
30
|
-
} & BaseModel
|
|
31
|
-
}
|