v-nuxt-ui 0.1.36 → 0.2.1
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/Watermark.d.vue.ts +3 -3
- package/dist/runtime/components/Watermark.vue.d.ts +3 -3
- package/dist/runtime/components/button/CircleColor.d.vue.ts +17 -0
- package/dist/runtime/components/button/CircleColor.vue +37 -0
- package/dist/runtime/components/button/CircleColor.vue.d.ts +17 -0
- package/dist/runtime/components/flow/FlowEdge.client.vue +170 -41
- package/dist/runtime/components/flow/FlowEditor.client.d.vue.ts +51 -0
- package/dist/runtime/components/flow/FlowEditor.client.vue +294 -0
- package/dist/runtime/components/flow/FlowEditor.client.vue.d.ts +51 -0
- package/dist/runtime/components/flow/FlowNode.client.d.vue.ts +13 -2
- package/dist/runtime/components/flow/FlowNode.client.vue +44 -48
- package/dist/runtime/components/flow/FlowNode.client.vue.d.ts +13 -2
- package/dist/runtime/components/flow/FlowToolbar.d.vue.ts +41 -5
- package/dist/runtime/components/flow/FlowToolbar.vue +554 -88
- package/dist/runtime/components/flow/FlowToolbar.vue.d.ts +41 -5
- package/dist/runtime/components/flow/FlowToolbarItemWrapper.d.vue.ts +17 -0
- package/dist/runtime/components/flow/FlowToolbarItemWrapper.vue +16 -0
- package/dist/runtime/components/flow/FlowToolbarItemWrapper.vue.d.ts +17 -0
- package/dist/runtime/components/sys/flow/CreateModal.d.vue.ts +13 -0
- package/dist/runtime/components/sys/flow/CreateModal.vue +32 -0
- package/dist/runtime/components/sys/flow/CreateModal.vue.d.ts +13 -0
- package/dist/runtime/components/sys/flow/EditNodeModal.d.vue.ts +13 -0
- package/dist/runtime/components/sys/flow/EditNodeModal.vue +30 -0
- package/dist/runtime/components/sys/flow/EditNodeModal.vue.d.ts +13 -0
- package/dist/runtime/components/sys/flow/Table.d.vue.ts +3 -0
- package/dist/runtime/components/sys/flow/Table.vue +98 -0
- package/dist/runtime/components/sys/flow/Table.vue.d.ts +3 -0
- package/dist/runtime/components/sys/table/CreateModal.vue +9 -191
- package/dist/runtime/components/sys/table/Table.vue +0 -11
- package/dist/runtime/components/sys/table/TableColumnList.d.vue.ts +54 -0
- package/dist/runtime/components/sys/table/TableColumnList.vue +196 -0
- package/dist/runtime/components/sys/table/TableColumnList.vue.d.ts +54 -0
- package/dist/runtime/components/sys/table/TableColumnModal.d.vue.ts +3 -13
- package/dist/runtime/components/sys/table/TableColumnModal.vue +32 -100
- package/dist/runtime/components/sys/table/TableColumnModal.vue.d.ts +3 -13
- package/dist/runtime/components/table/query/order/Item.d.vue.ts +2 -2
- package/dist/runtime/components/table/query/order/Item.vue.d.ts +2 -2
- package/dist/runtime/composables/api/sys/index.d.ts +3 -0
- package/dist/runtime/composables/api/sys/index.js +3 -0
- package/dist/runtime/composables/api/sys/useFlowApi.d.ts +2 -0
- package/dist/runtime/composables/api/sys/useFlowApi.js +5 -0
- package/dist/runtime/composables/api/sys/useFlowEdgeApi.d.ts +2 -0
- package/dist/runtime/composables/api/sys/useFlowEdgeApi.js +3 -0
- package/dist/runtime/composables/api/sys/useFlowNodeApi.d.ts +2 -0
- package/dist/runtime/composables/api/sys/useFlowNodeApi.js +3 -0
- package/dist/runtime/composables/flow/index.d.ts +3 -0
- package/dist/runtime/composables/flow/index.js +3 -0
- package/dist/runtime/composables/flow/useFlow.d.ts +33 -0
- package/dist/runtime/composables/flow/useFlow.js +401 -0
- package/dist/runtime/composables/flow/useFlowNode.d.ts +17 -0
- package/dist/runtime/composables/flow/useFlowNode.js +106 -0
- package/dist/runtime/composables/flow/useFlowResize.d.ts +21 -0
- package/dist/runtime/composables/flow/useFlowResize.js +84 -0
- package/dist/runtime/composables/flow/useFlowStyles.d.ts +62 -9
- package/dist/runtime/composables/flow/useFlowStyles.js +127 -23
- package/dist/runtime/composables/table/useTableColumnPermission.d.ts +36 -0
- package/dist/runtime/composables/useSidebarMenu.js +0 -2
- package/dist/runtime/composables/useTheme.d.ts +1 -1
- package/dist/runtime/composables/useTheme.js +0 -1
- package/dist/runtime/constants/flow.d.ts +166 -0
- package/dist/runtime/constants/flow.js +171 -0
- package/dist/runtime/index.css +1 -1
- package/dist/runtime/types/models/flow.d.ts +61 -0
- package/dist/runtime/types/models/flow.js +0 -0
- package/dist/runtime/types/models/index.d.ts +1 -0
- package/dist/runtime/types/models/index.js +1 -0
- package/dist/runtime/types/models/table.d.ts +1 -0
- package/dist/runtime/types/storage.d.ts +3 -4
- package/dist/runtime/types/storage.js +3 -4
- package/package.json +3 -2
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -22,13 +22,13 @@ type __VLS_Slots = {} & {
|
|
|
22
22
|
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
23
23
|
disabled: boolean;
|
|
24
24
|
text: string | string[];
|
|
25
|
+
opacity: number;
|
|
26
|
+
rotate: number;
|
|
27
|
+
fontColor: string;
|
|
25
28
|
fontSize: number;
|
|
26
29
|
fontWeight: string | number;
|
|
27
|
-
fontColor: string;
|
|
28
30
|
lineHeight: number;
|
|
29
|
-
rotate: number;
|
|
30
31
|
gap: number;
|
|
31
|
-
opacity: number;
|
|
32
32
|
debug: boolean;
|
|
33
33
|
textAlign: "left" | "center" | "right";
|
|
34
34
|
xOffset: number;
|
|
@@ -22,13 +22,13 @@ type __VLS_Slots = {} & {
|
|
|
22
22
|
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
23
23
|
disabled: boolean;
|
|
24
24
|
text: string | string[];
|
|
25
|
+
opacity: number;
|
|
26
|
+
rotate: number;
|
|
27
|
+
fontColor: string;
|
|
25
28
|
fontSize: number;
|
|
26
29
|
fontWeight: string | number;
|
|
27
|
-
fontColor: string;
|
|
28
30
|
lineHeight: number;
|
|
29
|
-
rotate: number;
|
|
30
31
|
gap: number;
|
|
31
|
-
opacity: number;
|
|
32
32
|
debug: boolean;
|
|
33
33
|
textAlign: "left" | "center" | "right";
|
|
34
34
|
xOffset: number;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
/** Tailwind 颜色名 (e.g. 'red', 'blue'),空字符串表示默认 */
|
|
3
|
+
chip?: string;
|
|
4
|
+
/** 色阶 (默认 500) */
|
|
5
|
+
shade?: number;
|
|
6
|
+
/** 是否选中 */
|
|
7
|
+
selected?: boolean;
|
|
8
|
+
/** 标题提示 */
|
|
9
|
+
title?: string;
|
|
10
|
+
};
|
|
11
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
+
click: () => any;
|
|
13
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
14
|
+
onClick?: (() => any) | undefined;
|
|
15
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { useColorMode } from "@vueuse/core";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
chip: { type: String, required: false },
|
|
6
|
+
shade: { type: Number, required: false },
|
|
7
|
+
selected: { type: Boolean, required: false },
|
|
8
|
+
title: { type: String, required: false }
|
|
9
|
+
});
|
|
10
|
+
defineEmits(["click"]);
|
|
11
|
+
const colorMode = useColorMode();
|
|
12
|
+
const backgroundStyle = computed(() => {
|
|
13
|
+
if (!props.chip || props.chip === "primary") return void 0;
|
|
14
|
+
const shade = props.shade ?? (colorMode.value === "dark" ? 400 : 500);
|
|
15
|
+
return `background-color: var(--color-${props.chip}-${shade})`;
|
|
16
|
+
});
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<button
|
|
21
|
+
type="button"
|
|
22
|
+
class="w-3 h-3 rounded-full transition-transform transition-shadow flex items-center justify-center shrink-0"
|
|
23
|
+
:class="[
|
|
24
|
+
selected ? 'ring-2 ring-primary ring-offset-2 ring-offset-[var(--ui-bg)] scale-110' : 'hover:scale-110 hover:ring-1 hover:ring-muted'
|
|
25
|
+
]"
|
|
26
|
+
:style="backgroundStyle"
|
|
27
|
+
:title="title"
|
|
28
|
+
@click="$emit('click')"
|
|
29
|
+
>
|
|
30
|
+
<template v-if="!chip || chip === 'primary'">
|
|
31
|
+
<span class="relative w-full h-full flex items-center justify-center">
|
|
32
|
+
<span class="absolute w-3 h-3 rounded-full border-2 border-muted" />
|
|
33
|
+
<span class="absolute w-[1px] h-3 bg-muted rotate-45" />
|
|
34
|
+
</span>
|
|
35
|
+
</template>
|
|
36
|
+
</button>
|
|
37
|
+
</template>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
/** Tailwind 颜色名 (e.g. 'red', 'blue'),空字符串表示默认 */
|
|
3
|
+
chip?: string;
|
|
4
|
+
/** 色阶 (默认 500) */
|
|
5
|
+
shade?: number;
|
|
6
|
+
/** 是否选中 */
|
|
7
|
+
selected?: boolean;
|
|
8
|
+
/** 标题提示 */
|
|
9
|
+
title?: string;
|
|
10
|
+
};
|
|
11
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
+
click: () => any;
|
|
13
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
14
|
+
onClick?: (() => any) | undefined;
|
|
15
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed } from "vue";
|
|
2
|
+
import { ref, computed, nextTick } from "vue";
|
|
3
3
|
import { useFlowStyles } from "#v/composables/flow/useFlowStyles";
|
|
4
|
-
import {
|
|
4
|
+
import { FLOW_EDGE_STROKE_TYPES } from "#v/constants";
|
|
5
|
+
import { EdgeLabelRenderer, getSmoothStepPath, getBezierPath, getStraightPath, BaseEdge } from "@vue-flow/core";
|
|
5
6
|
const props = defineProps({
|
|
6
7
|
id: { type: String, required: true },
|
|
7
8
|
sourceNode: { type: Object, required: true },
|
|
@@ -34,52 +35,151 @@ const props = defineProps({
|
|
|
34
35
|
targetX: { type: Number, required: true },
|
|
35
36
|
targetY: { type: Number, required: true }
|
|
36
37
|
});
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
38
|
+
const {
|
|
39
|
+
edgeMarkerStart,
|
|
40
|
+
edgeMarkerEnd,
|
|
41
|
+
edgePathType,
|
|
42
|
+
edgeAnimated,
|
|
43
|
+
edgeStrokeType,
|
|
44
|
+
effectiveEdgeColor,
|
|
45
|
+
effectiveEdgeLabelColor,
|
|
46
|
+
effectiveNodeBorderColor
|
|
47
|
+
} = useFlowStyles();
|
|
48
|
+
const path = computed(() => {
|
|
49
|
+
switch (edgePathType.value) {
|
|
50
|
+
case "bezier":
|
|
51
|
+
return getBezierPath(props);
|
|
52
|
+
case "step":
|
|
53
|
+
return getSmoothStepPath({ ...props, borderRadius: 0 });
|
|
54
|
+
case "straight":
|
|
55
|
+
return getStraightPath(props);
|
|
56
|
+
case "smoothstep":
|
|
57
|
+
default:
|
|
58
|
+
return getSmoothStepPath(props);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
function markerUrl(type, direction) {
|
|
62
|
+
if (type === "none") return void 0;
|
|
63
|
+
return `url(#marker-${type}-${direction}-${props.id})`;
|
|
64
|
+
}
|
|
65
|
+
const customMarkerEnd = computed(() => markerUrl(edgeMarkerEnd.value, "end"));
|
|
66
|
+
const customMarkerStart = computed(() => markerUrl(edgeMarkerStart.value, "start"));
|
|
67
|
+
const strokeColor = computed(() => {
|
|
68
|
+
if (props.selected) return "var(--ui-primary)";
|
|
69
|
+
return effectiveEdgeColor.value || "var(--ui-text-dimmed)";
|
|
70
|
+
});
|
|
71
|
+
const MARKER_DEFS = {
|
|
72
|
+
"arrow": {
|
|
73
|
+
// end: tip at (10,5); refX=8 → line ends 2px inside triangle, stroke fully covered by fill
|
|
74
|
+
end: { viewBox: "-1 -1 12 12", refX: 8, refY: 5, shape: "path", d: "M 0 0 L 10 5 L 0 10 z", filled: true },
|
|
75
|
+
// start: tip at (0,5); refX=2 → line ends 2px inside triangle, stroke fully covered by fill
|
|
76
|
+
start: { viewBox: "-1 -1 12 12", refX: 2, refY: 5, shape: "path", d: "M 10 0 L 0 5 L 10 10 z", filled: true }
|
|
77
|
+
},
|
|
78
|
+
"diamond": {
|
|
79
|
+
// end: rightmost at x=12; refX=10 → line ends 2px inside diamond
|
|
80
|
+
end: { viewBox: "-2 -2 16 12", refX: 10, refY: 4, shape: "path", d: "M 0 4 L 6 0 L 12 4 L 6 8 z", filled: true },
|
|
81
|
+
// start: leftmost at x=0; refX=2 → line ends 2px inside diamond
|
|
82
|
+
start: { viewBox: "-2 -2 16 12", refX: 2, refY: 4, shape: "path", d: "M 0 4 L 6 0 L 12 4 L 6 8 z", filled: true }
|
|
83
|
+
},
|
|
84
|
+
"diamond-open": {
|
|
85
|
+
end: { viewBox: "-2 -2 16 12", refX: 10, refY: 4, shape: "path", d: "M 0 4 L 6 0 L 12 4 L 6 8 z", filled: false },
|
|
86
|
+
start: { viewBox: "-2 -2 16 12", refX: 2, refY: 4, shape: "path", d: "M 0 4 L 6 0 L 12 4 L 6 8 z", filled: false }
|
|
87
|
+
},
|
|
88
|
+
"circle": {
|
|
89
|
+
// end: right edge at x=8; refX=6 → line ends 2px inside circle
|
|
90
|
+
end: { viewBox: "-2 -2 12 12", refX: 6, refY: 4, shape: "circle", cx: 4, cy: 4, r: 4, filled: true },
|
|
91
|
+
// start: left edge at x=0; refX=2 → line ends 2px inside circle
|
|
92
|
+
start: { viewBox: "-2 -2 12 12", refX: 2, refY: 4, shape: "circle", cx: 4, cy: 4, r: 4, filled: true }
|
|
93
|
+
},
|
|
94
|
+
"circle-open": {
|
|
95
|
+
end: { viewBox: "-2 -2 12 12", refX: 6, refY: 4, shape: "circle", cx: 4, cy: 4, r: 4, filled: false },
|
|
96
|
+
start: { viewBox: "-2 -2 12 12", refX: 2, refY: 4, shape: "circle", cx: 4, cy: 4, r: 4, filled: false }
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const markersToRender = computed(() => {
|
|
100
|
+
const markers = [];
|
|
101
|
+
const startType = edgeMarkerStart.value;
|
|
102
|
+
const endType = edgeMarkerEnd.value;
|
|
103
|
+
if (startType !== "none") {
|
|
104
|
+
const defs = MARKER_DEFS[startType];
|
|
105
|
+
markers.push({ id: `marker-${startType}-start-${props.id}`, def: defs.start });
|
|
106
|
+
}
|
|
107
|
+
if (endType !== "none") {
|
|
108
|
+
const defs = MARKER_DEFS[endType];
|
|
109
|
+
markers.push({ id: `marker-${endType}-end-${props.id}`, def: defs.end });
|
|
110
|
+
}
|
|
111
|
+
return markers;
|
|
112
|
+
});
|
|
113
|
+
const edgeStyle = computed(() => {
|
|
114
|
+
const base = {
|
|
115
|
+
...props.style,
|
|
116
|
+
stroke: strokeColor.value
|
|
117
|
+
};
|
|
118
|
+
if (edgeAnimated.value) {
|
|
119
|
+
const strokeOpt = FLOW_EDGE_STROKE_TYPES.find((t) => t.type === edgeStrokeType.value);
|
|
120
|
+
const dasharray = strokeOpt?.dasharray || "";
|
|
121
|
+
const animDash = dasharray || "8 4";
|
|
122
|
+
const total = animDash.split(/\s+/).reduce((sum, n) => sum + Number(n), 0);
|
|
123
|
+
base.strokeDasharray = animDash;
|
|
124
|
+
base["--flow-dash-len"] = `${total}`;
|
|
125
|
+
base.animation = `flow-dash ${Math.max(total * 0.05, 0.3)}s linear infinite`;
|
|
126
|
+
}
|
|
127
|
+
return base;
|
|
128
|
+
});
|
|
129
|
+
const editingLabel = ref(false);
|
|
130
|
+
const tempLabel = ref("");
|
|
131
|
+
const inputRef = ref(null);
|
|
132
|
+
const startEditing = () => {
|
|
133
|
+
editingLabel.value = true;
|
|
134
|
+
tempLabel.value = typeof props.label === "string" ? props.label : "";
|
|
135
|
+
nextTick(() => {
|
|
136
|
+
inputRef.value?.focus();
|
|
137
|
+
inputRef.value?.select();
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
const saveLabel = () => {
|
|
141
|
+
if (!editingLabel.value) return;
|
|
142
|
+
editingLabel.value = false;
|
|
143
|
+
const newLabel = tempLabel.value.trim();
|
|
144
|
+
props.data?.onUpdateLabel?.(newLabel);
|
|
145
|
+
};
|
|
146
|
+
const cancelEditing = () => {
|
|
147
|
+
editingLabel.value = false;
|
|
148
|
+
};
|
|
149
|
+
const labelColorStyle = computed(() => effectiveEdgeLabelColor.value ? { color: effectiveEdgeLabelColor.value } : {});
|
|
150
|
+
const labelBorderColorStyle = computed(() => effectiveNodeBorderColor.value ? { borderColor: effectiveNodeBorderColor.value } : {});
|
|
49
151
|
</script>
|
|
50
152
|
|
|
51
153
|
<template>
|
|
52
154
|
<svg style="position: absolute; width: 0; height: 0">
|
|
53
155
|
<defs>
|
|
54
|
-
<!-- 自定义箭头 - 终点 -->
|
|
55
|
-
<marker
|
|
56
|
-
:id="`custom-arrow-end-${id}`"
|
|
57
|
-
viewBox="-4 -4 14 18"
|
|
58
|
-
refX="7"
|
|
59
|
-
refY="5"
|
|
60
|
-
markerWidth="5"
|
|
61
|
-
markerHeight="5"
|
|
62
|
-
orient="auto-start-reverse"
|
|
63
|
-
>
|
|
64
|
-
<path
|
|
65
|
-
d="M -4 -4 L 10 5 L -4 14 z"
|
|
66
|
-
:fill="strokeColor"
|
|
67
|
-
/>
|
|
68
|
-
</marker>
|
|
69
|
-
|
|
70
|
-
<!-- 自定义箭头 - 起点 -->
|
|
71
156
|
<marker
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
157
|
+
v-for="m in markersToRender"
|
|
158
|
+
:id="m.id"
|
|
159
|
+
:key="m.id"
|
|
160
|
+
:viewBox="m.def.viewBox"
|
|
161
|
+
:refX="m.def.refX"
|
|
162
|
+
:refY="m.def.refY"
|
|
163
|
+
markerWidth="12"
|
|
164
|
+
markerHeight="12"
|
|
165
|
+
markerUnits="userSpaceOnUse"
|
|
78
166
|
orient="auto"
|
|
79
167
|
>
|
|
80
168
|
<path
|
|
81
|
-
|
|
82
|
-
:
|
|
169
|
+
v-if="m.def.shape === 'path'"
|
|
170
|
+
:d="m.def.d"
|
|
171
|
+
:fill="m.def.filled ? strokeColor : 'var(--ui-bg)'"
|
|
172
|
+
:stroke="strokeColor"
|
|
173
|
+
:stroke-width="m.def.filled ? 0 : 1.5"
|
|
174
|
+
/>
|
|
175
|
+
<circle
|
|
176
|
+
v-else-if="m.def.shape === 'circle'"
|
|
177
|
+
:cx="m.def.cx"
|
|
178
|
+
:cy="m.def.cy"
|
|
179
|
+
:r="m.def.r"
|
|
180
|
+
:fill="m.def.filled ? strokeColor : 'var(--ui-bg)'"
|
|
181
|
+
:stroke="strokeColor"
|
|
182
|
+
:stroke-width="m.def.filled ? 0 : 1.5"
|
|
83
183
|
/>
|
|
84
184
|
</marker>
|
|
85
185
|
</defs>
|
|
@@ -92,19 +192,48 @@ const edgeStyle = computed(() => ({
|
|
|
92
192
|
:marker-end="customMarkerEnd"
|
|
93
193
|
:marker-start="customMarkerStart"
|
|
94
194
|
/>
|
|
195
|
+
|
|
95
196
|
<EdgeLabelRenderer>
|
|
96
197
|
<div
|
|
97
|
-
v-if="label"
|
|
98
198
|
:style="{
|
|
99
199
|
position: 'absolute',
|
|
100
200
|
transform: `translate(-50%, -50%) translate(${path[1]}px,${path[2]}px)`,
|
|
101
201
|
pointerEvents: 'all'
|
|
102
202
|
}"
|
|
103
203
|
class="nodrag nopan"
|
|
204
|
+
@dblclick.stop="startEditing"
|
|
104
205
|
>
|
|
105
|
-
|
|
206
|
+
<!-- Editing mode -->
|
|
207
|
+
<input
|
|
208
|
+
v-if="editingLabel"
|
|
209
|
+
ref="inputRef"
|
|
210
|
+
v-model="tempLabel"
|
|
211
|
+
class="bg-default border border-default rounded px-2 py-1 text-xs outline-none"
|
|
212
|
+
:style="{ minWidth: '16px', ...labelColorStyle }"
|
|
213
|
+
@keydown.enter="saveLabel"
|
|
214
|
+
@keydown.escape="cancelEditing"
|
|
215
|
+
@blur="saveLabel"
|
|
216
|
+
>
|
|
217
|
+
<!-- Display mode: show label or invisible placeholder for no-label edges -->
|
|
218
|
+
<div
|
|
219
|
+
v-else-if="label"
|
|
220
|
+
class="bg-default border border-default rounded px-2 py-1 text-xs shadow-sm"
|
|
221
|
+
:style="{
|
|
222
|
+
...labelColorStyle,
|
|
223
|
+
...labelBorderColorStyle
|
|
224
|
+
}"
|
|
225
|
+
>
|
|
106
226
|
{{ label }}
|
|
107
227
|
</div>
|
|
228
|
+
<!-- Invisible placeholder for edges without label -->
|
|
229
|
+
<div
|
|
230
|
+
v-else
|
|
231
|
+
class="w-6 h-4 opacity-0 hover:opacity-30 hover:bg-muted rounded transition-opacity"
|
|
232
|
+
/>
|
|
108
233
|
</div>
|
|
109
234
|
</EdgeLabelRenderer>
|
|
110
235
|
</template>
|
|
236
|
+
|
|
237
|
+
<style>
|
|
238
|
+
@keyframes flow-dash{to{stroke-dashoffset:calc(var(--flow-dash-len)*-1px)}}
|
|
239
|
+
</style>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Flow, FlowNode as FlowNodeType, FlowApi } from '#v/types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** Flow 数据模型 (v-model) */
|
|
4
|
+
modelValue?: Flow;
|
|
5
|
+
/** CRUD API 回调,节点/边增删改时调用 */
|
|
6
|
+
api?: FlowApi;
|
|
7
|
+
/** 是否显示背景网格 */
|
|
8
|
+
showBackground?: boolean;
|
|
9
|
+
/** 是否显示工具栏 */
|
|
10
|
+
showToolbar?: boolean;
|
|
11
|
+
/** 是否显示统计面板 */
|
|
12
|
+
showStats?: boolean;
|
|
13
|
+
/** 最小缩放 */
|
|
14
|
+
minZoom?: number;
|
|
15
|
+
/** 最大缩放 */
|
|
16
|
+
maxZoom?: number;
|
|
17
|
+
/** 默认缩放 */
|
|
18
|
+
defaultZoom?: number;
|
|
19
|
+
};
|
|
20
|
+
declare var __VLS_21: {
|
|
21
|
+
data: any;
|
|
22
|
+
}, __VLS_62: {};
|
|
23
|
+
type __VLS_Slots = {} & {
|
|
24
|
+
node?: (props: typeof __VLS_21) => any;
|
|
25
|
+
} & {
|
|
26
|
+
default?: (props: typeof __VLS_62) => any;
|
|
27
|
+
};
|
|
28
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
29
|
+
"update:modelValue": (value: Flow) => any;
|
|
30
|
+
"edit-node": (node: FlowNodeType) => any;
|
|
31
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
32
|
+
"onUpdate:modelValue"?: ((value: Flow) => any) | undefined;
|
|
33
|
+
"onEdit-node"?: ((node: FlowNodeType) => any) | undefined;
|
|
34
|
+
}>, {
|
|
35
|
+
modelValue: Flow;
|
|
36
|
+
api: FlowApi;
|
|
37
|
+
showBackground: boolean;
|
|
38
|
+
showToolbar: boolean;
|
|
39
|
+
showStats: boolean;
|
|
40
|
+
minZoom: number;
|
|
41
|
+
maxZoom: number;
|
|
42
|
+
defaultZoom: number;
|
|
43
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
44
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
45
|
+
declare const _default: typeof __VLS_export;
|
|
46
|
+
export default _default;
|
|
47
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
48
|
+
new (): {
|
|
49
|
+
$slots: S;
|
|
50
|
+
};
|
|
51
|
+
};
|