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.
Files changed (72) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +1 -0
  3. package/dist/runtime/components/Watermark.d.vue.ts +3 -3
  4. package/dist/runtime/components/Watermark.vue.d.ts +3 -3
  5. package/dist/runtime/components/button/CircleColor.d.vue.ts +17 -0
  6. package/dist/runtime/components/button/CircleColor.vue +37 -0
  7. package/dist/runtime/components/button/CircleColor.vue.d.ts +17 -0
  8. package/dist/runtime/components/flow/FlowEdge.client.vue +170 -41
  9. package/dist/runtime/components/flow/FlowEditor.client.d.vue.ts +51 -0
  10. package/dist/runtime/components/flow/FlowEditor.client.vue +294 -0
  11. package/dist/runtime/components/flow/FlowEditor.client.vue.d.ts +51 -0
  12. package/dist/runtime/components/flow/FlowNode.client.d.vue.ts +13 -2
  13. package/dist/runtime/components/flow/FlowNode.client.vue +44 -48
  14. package/dist/runtime/components/flow/FlowNode.client.vue.d.ts +13 -2
  15. package/dist/runtime/components/flow/FlowToolbar.d.vue.ts +41 -5
  16. package/dist/runtime/components/flow/FlowToolbar.vue +554 -88
  17. package/dist/runtime/components/flow/FlowToolbar.vue.d.ts +41 -5
  18. package/dist/runtime/components/flow/FlowToolbarItemWrapper.d.vue.ts +17 -0
  19. package/dist/runtime/components/flow/FlowToolbarItemWrapper.vue +16 -0
  20. package/dist/runtime/components/flow/FlowToolbarItemWrapper.vue.d.ts +17 -0
  21. package/dist/runtime/components/sys/flow/CreateModal.d.vue.ts +13 -0
  22. package/dist/runtime/components/sys/flow/CreateModal.vue +32 -0
  23. package/dist/runtime/components/sys/flow/CreateModal.vue.d.ts +13 -0
  24. package/dist/runtime/components/sys/flow/EditNodeModal.d.vue.ts +13 -0
  25. package/dist/runtime/components/sys/flow/EditNodeModal.vue +30 -0
  26. package/dist/runtime/components/sys/flow/EditNodeModal.vue.d.ts +13 -0
  27. package/dist/runtime/components/sys/flow/Table.d.vue.ts +3 -0
  28. package/dist/runtime/components/sys/flow/Table.vue +98 -0
  29. package/dist/runtime/components/sys/flow/Table.vue.d.ts +3 -0
  30. package/dist/runtime/components/sys/table/CreateModal.vue +9 -191
  31. package/dist/runtime/components/sys/table/Table.vue +0 -11
  32. package/dist/runtime/components/sys/table/TableColumnList.d.vue.ts +54 -0
  33. package/dist/runtime/components/sys/table/TableColumnList.vue +196 -0
  34. package/dist/runtime/components/sys/table/TableColumnList.vue.d.ts +54 -0
  35. package/dist/runtime/components/sys/table/TableColumnModal.d.vue.ts +3 -13
  36. package/dist/runtime/components/sys/table/TableColumnModal.vue +32 -100
  37. package/dist/runtime/components/sys/table/TableColumnModal.vue.d.ts +3 -13
  38. package/dist/runtime/components/table/query/order/Item.d.vue.ts +2 -2
  39. package/dist/runtime/components/table/query/order/Item.vue.d.ts +2 -2
  40. package/dist/runtime/composables/api/sys/index.d.ts +3 -0
  41. package/dist/runtime/composables/api/sys/index.js +3 -0
  42. package/dist/runtime/composables/api/sys/useFlowApi.d.ts +2 -0
  43. package/dist/runtime/composables/api/sys/useFlowApi.js +5 -0
  44. package/dist/runtime/composables/api/sys/useFlowEdgeApi.d.ts +2 -0
  45. package/dist/runtime/composables/api/sys/useFlowEdgeApi.js +3 -0
  46. package/dist/runtime/composables/api/sys/useFlowNodeApi.d.ts +2 -0
  47. package/dist/runtime/composables/api/sys/useFlowNodeApi.js +3 -0
  48. package/dist/runtime/composables/flow/index.d.ts +3 -0
  49. package/dist/runtime/composables/flow/index.js +3 -0
  50. package/dist/runtime/composables/flow/useFlow.d.ts +33 -0
  51. package/dist/runtime/composables/flow/useFlow.js +401 -0
  52. package/dist/runtime/composables/flow/useFlowNode.d.ts +17 -0
  53. package/dist/runtime/composables/flow/useFlowNode.js +106 -0
  54. package/dist/runtime/composables/flow/useFlowResize.d.ts +21 -0
  55. package/dist/runtime/composables/flow/useFlowResize.js +84 -0
  56. package/dist/runtime/composables/flow/useFlowStyles.d.ts +62 -9
  57. package/dist/runtime/composables/flow/useFlowStyles.js +127 -23
  58. package/dist/runtime/composables/table/useTableColumnPermission.d.ts +36 -0
  59. package/dist/runtime/composables/useSidebarMenu.js +0 -2
  60. package/dist/runtime/composables/useTheme.d.ts +1 -1
  61. package/dist/runtime/composables/useTheme.js +0 -1
  62. package/dist/runtime/constants/flow.d.ts +166 -0
  63. package/dist/runtime/constants/flow.js +171 -0
  64. package/dist/runtime/index.css +1 -1
  65. package/dist/runtime/types/models/flow.d.ts +61 -0
  66. package/dist/runtime/types/models/flow.js +0 -0
  67. package/dist/runtime/types/models/index.d.ts +1 -0
  68. package/dist/runtime/types/models/index.js +1 -0
  69. package/dist/runtime/types/models/table.d.ts +1 -0
  70. package/dist/runtime/types/storage.d.ts +3 -4
  71. package/dist/runtime/types/storage.js +3 -4
  72. package/package.json +3 -2
@@ -1,16 +1,75 @@
1
1
  <script setup>
2
- import ButtonTheme from "#v/components/button/Theme.vue";
2
+ import { ref } from "vue";
3
+ import {
4
+ FLOW_COLORS,
5
+ FLOW_WIDTH_ITEMS,
6
+ FLOW_STROKE_TYPE_ITEMS,
7
+ FLOW_PATH_TYPE_ITEMS,
8
+ FLOW_ARROW_TYPE_ITEMS,
9
+ FLOW_BORDER_RADIUS_ITEMS,
10
+ FLOW_FONT_SIZE_ITEMS,
11
+ FLOW_HANDLE_SIZE_ITEMS,
12
+ FLOW_PATH_PREVIEW,
13
+ FLOW_ARROW_PREVIEW_START,
14
+ FLOW_ARROW_PREVIEW_END
15
+ } from "#v/constants";
16
+ import FlowToolbarItemWrapper from "./FlowToolbarItemWrapper.vue";
17
+ import CircleColor from "#v/components/button/CircleColor.vue";
18
+ const settingsOpen = ref(false);
3
19
  defineProps({
4
20
  onAddNode: { type: Function, required: false },
21
+ loading: { type: Boolean, required: false },
5
22
  edgeStrokeWidth: { type: Number, required: false },
6
- edgeMarkerStart: { type: Boolean, required: false },
7
- edgeMarkerEnd: { type: Boolean, required: false },
23
+ edgeStrokeType: { type: String, required: false },
24
+ edgePathType: { type: String, required: false },
25
+ edgeMarkerStart: { type: String, required: false },
26
+ edgeMarkerEnd: { type: String, required: false },
27
+ edgeAnimated: { type: Boolean, required: false },
28
+ edgeColor: { type: String, required: false },
29
+ edgeLabelColor: { type: String, required: false },
8
30
  nodeBorderWidth: { type: Number, required: false },
9
- onEdgeStrokeWidthChange: { type: Function, required: false },
10
- onToggleEdgeMarkerStart: { type: Function, required: false },
11
- onToggleEdgeMarkerEnd: { type: Function, required: false },
12
- onNodeBorderWidthChange: { type: Function, required: false }
31
+ nodeBorderRadius: { type: Number, required: false },
32
+ nodeBorderColor: { type: String, required: false },
33
+ nodeBgColor: { type: String, required: false },
34
+ nodeFontColor: { type: String, required: false },
35
+ nodeFontSize: { type: Number, required: false },
36
+ nodeHandleSize: { type: Number, required: false },
37
+ nodeHandleColor: { type: String, required: false },
38
+ colorMode: { type: String, required: false },
39
+ unifiedColor: { type: String, required: false },
40
+ isUnifiedMode: { type: Boolean, required: false },
41
+ onEdgeStrokeWidthChange: { type: Function, required: true },
42
+ onEdgeStrokeTypeChange: { type: Function, required: false },
43
+ onEdgePathTypeChange: { type: Function, required: false },
44
+ onEdgeMarkerStartChange: { type: Function, required: false },
45
+ onEdgeMarkerEndChange: { type: Function, required: false },
46
+ onToggleEdgeAnimated: { type: Function, required: false },
47
+ onEdgeColorChange: { type: Function, required: false },
48
+ onEdgeLabelColorChange: { type: Function, required: false },
49
+ onNodeBorderWidthChange: { type: Function, required: false },
50
+ onNodeBorderRadiusChange: { type: Function, required: false },
51
+ onNodeBorderColorChange: { type: Function, required: false },
52
+ onNodeBgColorChange: { type: Function, required: false },
53
+ onNodeFontColorChange: { type: Function, required: false },
54
+ onNodeFontSizeChange: { type: Function, required: false },
55
+ onNodeHandleSizeChange: { type: Function, required: false },
56
+ onNodeHandleColorChange: { type: Function, required: false },
57
+ onColorModeChange: { type: Function, required: false },
58
+ onUnifiedColorChange: { type: Function, required: false }
13
59
  });
60
+ const tabItems = [
61
+ { label: "\u989C\u8272\u8BBE\u7F6E", value: "color", slot: "color" },
62
+ { label: "\u8282\u70B9\u8BBE\u7F6E", value: "node", slot: "node" },
63
+ { label: "\u8FDE\u63A5\u7EBF\u8BBE\u7F6E", value: "edge", slot: "edge" }
64
+ ];
65
+ const colorModeTabItems = [
66
+ { label: "\u7EDF\u4E00", value: "unified" },
67
+ { label: "\u81EA\u5B9A\u4E49", value: "custom" }
68
+ ];
69
+ const itemSize = "sm";
70
+ function getStrokeDasharray(value) {
71
+ return FLOW_STROKE_TYPE_ITEMS.find((i) => i.value === value)?.dasharray || "none";
72
+ }
14
73
  </script>
15
74
 
16
75
  <template>
@@ -21,93 +80,500 @@ defineProps({
21
80
  icon="i-lucide-circle-plus"
22
81
  size="sm"
23
82
  variant="subtle"
83
+ :disabled="loading"
84
+ :loading="loading"
24
85
  @click="onAddNode?.()"
25
86
  />
26
87
 
27
88
  <!-- 样式设置 -->
28
- <UPopover :content="{ side: 'top' }" :ui="{ content: 'px-6 py-4 flex flex-col gap-4' }">
29
- <UButton
30
- label="设置"
31
- icon="i-lucide-settings"
32
- size="sm"
33
- variant="subtle"
34
- />
35
- <template #content>
36
- <fieldset>
37
- <legend class="text-[11px] leading-none font-semibold mb-2">
38
- 连接线粗细
39
- </legend>
40
-
41
- <div class="grid grid-cols-5 gap-2 -mx-2">
42
- <ButtonTheme
43
- v-for="width in [1, 2, 3, 4, 5]"
44
- :key="width"
45
- :label="width.toString()"
46
- :selected="edgeStrokeWidth === width"
47
- class="justify-center min-w-10"
48
- @click="onEdgeStrokeWidthChange?.(width)"
49
- >
50
- <template #leading>
51
- <div class="flex flex-col gap-px">
52
- <div
53
- v-for="i in width"
54
- :key="i"
55
- class="w-4 h-0.5 bg-current rounded-full"
56
- />
57
- </div>
58
- </template>
59
- </ButtonTheme>
60
- </div>
61
- </fieldset>
62
-
63
- <fieldset>
64
- <legend class="text-[11px] leading-none font-semibold mb-2">
65
- 连接线箭头
66
- </legend>
67
-
68
- <div class="grid grid-cols-2 gap-2 -mx-2">
69
- <ButtonTheme
70
- label="起点"
71
- :icon="edgeMarkerStart ? 'i-lucide-arrow-left' : 'i-lucide-minus'"
72
- :selected="edgeMarkerStart"
73
- @click="onToggleEdgeMarkerStart?.()"
74
- />
75
- <ButtonTheme
76
- label="终点"
77
- :icon="edgeMarkerEnd ? 'i-lucide-arrow-right' : 'i-lucide-minus'"
78
- :selected="edgeMarkerEnd"
79
- @click="onToggleEdgeMarkerEnd?.()"
80
- />
81
- </div>
82
- </fieldset>
83
-
84
- <fieldset>
85
- <legend class="text-[11px] leading-none font-semibold mb-2">
86
- 节点边框粗细
87
- </legend>
88
-
89
- <div class="grid grid-cols-5 gap-2 -mx-2">
90
- <ButtonTheme
91
- v-for="width in [1, 2, 3, 4, 5]"
92
- :key="width"
93
- :label="width.toString()"
94
- :selected="nodeBorderWidth === width"
95
- class="justify-center"
96
- @click="onNodeBorderWidthChange?.(width)"
97
- >
98
- <template #leading>
99
- <div class="flex flex-col gap-px">
100
- <div
101
- v-for="i in width"
102
- :key="i"
103
- class="w-4 h-0.5 bg-current rounded-full"
89
+ <UButton
90
+ icon="i-lucide-settings"
91
+ size="sm"
92
+ variant="subtle"
93
+ @click="settingsOpen = true"
94
+ />
95
+
96
+ <USlideover
97
+ v-model:open="settingsOpen"
98
+ title="样式设置"
99
+ side="right"
100
+ inset
101
+ :overlay="false"
102
+ :ui="{
103
+ content: 'w-fit'
104
+ }"
105
+ >
106
+ <template #body>
107
+ <UTabs
108
+ :items="tabItems"
109
+ size="xs"
110
+ color="neutral"
111
+ default-value="node"
112
+ :unmount-on-hide="false"
113
+ :ui="{
114
+ content: 'pt-3'
115
+ }"
116
+ >
117
+ <template #color>
118
+ <div class="flex flex-col gap-4">
119
+ <!-- 模式切换 -->
120
+ <FlowToolbarItemWrapper label="颜色模式">
121
+ <UTabs
122
+ :model-value="colorMode"
123
+ :items="colorModeTabItems"
124
+ :content="false"
125
+ size="xs"
126
+ @update:model-value="(newColorMode) => onColorModeChange?.(newColorMode)"
127
+ />
128
+ </FlowToolbarItemWrapper>
129
+
130
+ <!-- 统一颜色选择 -->
131
+ <div :class="{ 'opacity-40 pointer-events-none': !isUnifiedMode }">
132
+ <FlowToolbarItemWrapper label="统一颜色">
133
+ <div class="grid grid-cols-9 gap-2">
134
+ <CircleColor
135
+ v-for="opt in FLOW_COLORS"
136
+ :key="opt.color"
137
+ :chip="opt.chip"
138
+ :shade="500"
139
+ :selected="unifiedColor === opt.color"
140
+ :title="opt.chip || 'default'"
141
+ @click="onUnifiedColorChange?.(opt.color)"
142
+ />
143
+ </div>
144
+ </FlowToolbarItemWrapper>
145
+ </div>
146
+ </div>
147
+ </template>
148
+
149
+ <template #node>
150
+ <div class="flex flex-col gap-4">
151
+ <!-- 边框粗细 -->
152
+ <FlowToolbarItemWrapper label="边框粗细">
153
+ <USelect
154
+ :model-value="nodeBorderWidth"
155
+ :items="FLOW_WIDTH_ITEMS"
156
+ :size="itemSize"
157
+ trailing-icon=""
158
+ @update:model-value="(v) => onNodeBorderWidthChange?.(v)"
159
+ >
160
+ <template #item-leading="{ item }">
161
+ <div
162
+ class="w-4 bg-current rounded-full"
163
+ :style="{
164
+ height: `${item.value}px`
165
+ }"
166
+ />
167
+ </template>
168
+ <template #leading="{ modelValue }">
169
+ <div
170
+ class="w-4 bg-current rounded-full"
171
+ :style="{
172
+ height: `${modelValue}px`
173
+ }"
174
+ />
175
+ </template>
176
+ </USelect>
177
+ </FlowToolbarItemWrapper>
178
+
179
+ <!-- 边框颜色 -->
180
+ <div :class="{ 'opacity-40 pointer-events-none': isUnifiedMode }">
181
+ <FlowToolbarItemWrapper label="边框颜色">
182
+ <div class="grid grid-cols-9 gap-2">
183
+ <CircleColor
184
+ v-for="opt in FLOW_COLORS"
185
+ :key="opt.color"
186
+ :chip="opt.chip"
187
+ :shade="500"
188
+ :selected="nodeBorderColor === opt.color"
189
+ :title="opt.chip || 'default'"
190
+ @click="onNodeBorderColorChange?.(opt.color)"
191
+ />
192
+ </div>
193
+ </FlowToolbarItemWrapper>
194
+ </div>
195
+
196
+ <USeparator class="py-2" />
197
+
198
+ <!-- 背景色 -->
199
+ <div :class="{ 'opacity-40 pointer-events-none': isUnifiedMode }">
200
+ <FlowToolbarItemWrapper label="背景色">
201
+ <div class="grid grid-cols-9 gap-2">
202
+ <CircleColor
203
+ v-for="opt in FLOW_COLORS"
204
+ :key="opt.color"
205
+ :chip="opt.chip"
206
+ :shade="50"
207
+ :selected="nodeBgColor === opt.color"
208
+ :title="opt.chip || 'default'"
209
+ @click="onNodeBgColorChange?.(opt.color)"
210
+ />
211
+ </div>
212
+ </FlowToolbarItemWrapper>
213
+ </div>
214
+
215
+ <USeparator class="py-2" />
216
+
217
+ <!-- 字号 -->
218
+ <FlowToolbarItemWrapper label="字号">
219
+ <USelect
220
+ :model-value="nodeFontSize"
221
+ :items="FLOW_FONT_SIZE_ITEMS"
222
+ :size="itemSize"
223
+ trailing-icon=""
224
+ @update:model-value="(v) => onNodeFontSizeChange?.(v)"
225
+ >
226
+ <template #item-leading="{ item }">
227
+ <span :class="item.twClass">A</span>
228
+ </template>
229
+ </USelect>
230
+ </FlowToolbarItemWrapper>
231
+
232
+ <!-- 字体颜色 -->
233
+ <div :class="{ 'opacity-40 pointer-events-none': isUnifiedMode }">
234
+ <FlowToolbarItemWrapper label="字体颜色">
235
+ <div class="grid grid-cols-9 gap-2">
236
+ <CircleColor
237
+ v-for="opt in FLOW_COLORS"
238
+ :key="opt.color"
239
+ :chip="opt.chip"
240
+ :shade="600"
241
+ :selected="nodeFontColor === opt.color"
242
+ :title="opt.chip || 'default'"
243
+ @click="onNodeFontColorChange?.(opt.color)"
244
+ />
245
+ </div>
246
+ </FlowToolbarItemWrapper>
247
+ </div>
248
+
249
+ <USeparator class="py-2" />
250
+
251
+ <!-- 连接点大小 -->
252
+ <FlowToolbarItemWrapper label="连接点大小">
253
+ <USelect
254
+ :model-value="nodeHandleSize"
255
+ :items="FLOW_HANDLE_SIZE_ITEMS"
256
+ :size="itemSize"
257
+ trailing-icon=""
258
+ class="min-h-7"
259
+ @update:model-value="(v) => onNodeHandleSizeChange?.(v)"
260
+ >
261
+ <template #default="{ modelValue }">
262
+ <div
263
+ v-if="modelValue"
264
+ class="rounded-full bg-current"
265
+ :style="{ width: `${modelValue}px`, height: `${modelValue}px` }"
266
+ />
267
+ </template>
268
+ <template #item-leading="{ item }">
269
+ <div
270
+ class="rounded-full bg-current"
271
+ :style="{ width: `${item.value}px`, height: `${item.value}px` }"
272
+ />
273
+ </template>
274
+ </USelect>
275
+ </FlowToolbarItemWrapper>
276
+
277
+ <!-- 连接点颜色 -->
278
+ <div :class="{ 'opacity-40 pointer-events-none': isUnifiedMode }">
279
+ <FlowToolbarItemWrapper label="连接点颜色">
280
+ <div class="grid grid-cols-9 gap-2">
281
+ <CircleColor
282
+ v-for="opt in FLOW_COLORS"
283
+ :key="opt.color"
284
+ :chip="opt.chip"
285
+ :shade="500"
286
+ :selected="nodeHandleColor === opt.color"
287
+ :title="opt.chip || 'default'"
288
+ @click="onNodeHandleColorChange?.(opt.color)"
289
+ />
290
+ </div>
291
+ </FlowToolbarItemWrapper>
292
+ </div>
293
+
294
+ <USeparator class="py-2" />
295
+
296
+ <!-- 圆角 -->
297
+ <FlowToolbarItemWrapper label="圆角">
298
+ <USelect
299
+ :model-value="nodeBorderRadius"
300
+ :items="FLOW_BORDER_RADIUS_ITEMS"
301
+ :size="itemSize"
302
+ trailing-icon=""
303
+ @update:model-value="(v) => onNodeBorderRadiusChange?.(v)"
304
+ >
305
+ <template #leading="{ modelValue }">
306
+ <div
307
+ v-if="modelValue != null"
308
+ class="w-4 h-3 border-[1.5px] border-current"
309
+ :style="{ borderRadius: `${modelValue}px` }"
310
+ />
311
+ </template>
312
+ <template #item-leading="{ item }">
313
+ <div
314
+ class="w-4 h-3 border-[1.5px] border-current"
315
+ :style="{ borderRadius: `${item.value}px` }"
316
+ />
317
+ </template>
318
+ </USelect>
319
+ </FlowToolbarItemWrapper>
320
+ </div>
321
+ </template>
322
+
323
+ <template #edge>
324
+ <div class="flex flex-col gap-4">
325
+ <!-- 起点箭头 -->
326
+ <FlowToolbarItemWrapper label="起点箭头">
327
+ <USelect
328
+ :model-value="edgeMarkerStart"
329
+ :items="FLOW_ARROW_TYPE_ITEMS"
330
+ :size="itemSize"
331
+ trailing-icon=""
332
+ @update:model-value="(v) => onEdgeMarkerStartChange?.(v)"
333
+ >
334
+ <template #leading="{ modelValue }">
335
+ <svg
336
+ v-if="modelValue"
337
+ width="20"
338
+ height="10"
339
+ class="shrink-0"
340
+ >
341
+ <component
342
+ :is="el.tag"
343
+ v-for="(el, idx) in FLOW_ARROW_PREVIEW_START[modelValue]"
344
+ :key="idx"
345
+ v-bind="el.attrs"
346
+ />
347
+ </svg>
348
+ </template>
349
+ <template #item-leading="{ item }">
350
+ <svg width="20" height="10" class="shrink-0">
351
+ <component
352
+ :is="el.tag"
353
+ v-for="(el, idx) in FLOW_ARROW_PREVIEW_START[item.value]"
354
+ :key="idx"
355
+ v-bind="el.attrs"
356
+ />
357
+ </svg>
358
+ </template>
359
+ </USelect>
360
+ </FlowToolbarItemWrapper>
361
+
362
+ <!-- 终点箭头 -->
363
+ <FlowToolbarItemWrapper label="终点箭头">
364
+ <USelect
365
+ :model-value="edgeMarkerEnd"
366
+ :items="FLOW_ARROW_TYPE_ITEMS"
367
+ :size="itemSize"
368
+ trailing-icon=""
369
+ @update:model-value="(v) => onEdgeMarkerEndChange?.(v)"
370
+ >
371
+ <template #leading="{ modelValue }">
372
+ <svg
373
+ v-if="modelValue"
374
+ width="20"
375
+ height="10"
376
+ class="shrink-0"
377
+ >
378
+ <component
379
+ :is="el.tag"
380
+ v-for="(el, idx) in FLOW_ARROW_PREVIEW_END[modelValue]"
381
+ :key="idx"
382
+ v-bind="el.attrs"
383
+ />
384
+ </svg>
385
+ </template>
386
+ <template #item-leading="{ item }">
387
+ <svg width="20" height="10" class="shrink-0">
388
+ <component
389
+ :is="el.tag"
390
+ v-for="(el, idx) in FLOW_ARROW_PREVIEW_END[item.value]"
391
+ :key="idx"
392
+ v-bind="el.attrs"
393
+ />
394
+ </svg>
395
+ </template>
396
+ </USelect>
397
+ </FlowToolbarItemWrapper>
398
+
399
+ <USeparator class="py-2" />
400
+
401
+ <!-- 粗细 -->
402
+ <FlowToolbarItemWrapper label="粗细">
403
+ <USelect
404
+ :model-value="edgeStrokeWidth"
405
+ :items="FLOW_WIDTH_ITEMS"
406
+ :size="itemSize"
407
+ trailing-icon=""
408
+ @update:model-value="(v) => onEdgeStrokeWidthChange?.(v)"
409
+ >
410
+ <template #leading="{ modelValue }">
411
+ <div
412
+ class="w-4 bg-current rounded-full"
413
+ :style="{
414
+ height: `${modelValue}px`
415
+ }"
416
+ />
417
+ </template>
418
+ <template #item-leading="{ item }">
419
+ <div
420
+ class="w-4 bg-current rounded-full"
421
+ :style="{
422
+ height: `${item.value}px`
423
+ }"
424
+ />
425
+ </template>
426
+ </USelect>
427
+ </FlowToolbarItemWrapper>
428
+
429
+ <!-- 线型 -->
430
+ <FlowToolbarItemWrapper label="线型">
431
+ <USelect
432
+ :model-value="edgeStrokeType"
433
+ :items="FLOW_STROKE_TYPE_ITEMS"
434
+ :size="itemSize"
435
+ trailing-icon=""
436
+ @update:model-value="(v) => onEdgeStrokeTypeChange?.(v)"
437
+ >
438
+ <template #leading="{ modelValue }">
439
+ <svg
440
+ v-if="modelValue"
441
+ width="20"
442
+ height="10"
443
+ class="shrink-0"
444
+ >
445
+ <line
446
+ x1="0"
447
+ y1="5"
448
+ x2="20"
449
+ y2="5"
450
+ stroke="currentColor"
451
+ stroke-width="2"
452
+ :stroke-dasharray="getStrokeDasharray(modelValue)"
453
+ />
454
+ </svg>
455
+ </template>
456
+ <template #item-leading="{ item }">
457
+ <svg width="20" height="10" class="shrink-0">
458
+ <line
459
+ x1="0"
460
+ y1="5"
461
+ x2="20"
462
+ y2="5"
463
+ stroke="currentColor"
464
+ stroke-width="2"
465
+ :stroke-dasharray="item.dasharray || 'none'"
466
+ />
467
+ </svg>
468
+ </template>
469
+ </USelect>
470
+ </FlowToolbarItemWrapper>
471
+
472
+ <!-- 路径 -->
473
+ <FlowToolbarItemWrapper label="路径">
474
+ <USelect
475
+ :model-value="edgePathType"
476
+ :items="FLOW_PATH_TYPE_ITEMS"
477
+ :size="itemSize"
478
+ trailing-icon=""
479
+ @update:model-value="(v) => onEdgePathTypeChange?.(v)"
480
+ >
481
+ <template #leading="{ modelValue }">
482
+ <svg
483
+ v-if="modelValue"
484
+ width="20"
485
+ height="14"
486
+ class="shrink-0"
487
+ >
488
+ <template v-if="FLOW_PATH_PREVIEW[modelValue]?.shape === 'path'">
489
+ <path
490
+ :d="FLOW_PATH_PREVIEW[modelValue].d"
491
+ fill="none"
492
+ stroke="currentColor"
493
+ stroke-width="2"
494
+ />
495
+ </template>
496
+ <template v-else>
497
+ <line
498
+ v-bind="{ x1: FLOW_PATH_PREVIEW[modelValue].x1, y1: FLOW_PATH_PREVIEW[modelValue].y1, x2: FLOW_PATH_PREVIEW[modelValue].x2, y2: FLOW_PATH_PREVIEW[modelValue].y2 }"
499
+ stroke="currentColor"
500
+ stroke-width="2"
501
+ />
502
+ </template>
503
+ </svg>
504
+ </template>
505
+ <template #item-leading="{ item }">
506
+ <svg width="20" height="14" class="shrink-0">
507
+ <template v-if="FLOW_PATH_PREVIEW[item.value]?.shape === 'path'">
508
+ <path
509
+ :d="FLOW_PATH_PREVIEW[item.value].d"
510
+ fill="none"
511
+ stroke="currentColor"
512
+ stroke-width="2"
513
+ />
514
+ </template>
515
+ <template v-else>
516
+ <line
517
+ v-bind="{ x1: FLOW_PATH_PREVIEW[item.value].x1, y1: FLOW_PATH_PREVIEW[item.value].y1, x2: FLOW_PATH_PREVIEW[item.value].x2, y2: FLOW_PATH_PREVIEW[item.value].y2 }"
518
+ stroke="currentColor"
519
+ stroke-width="2"
520
+ />
521
+ </template>
522
+ </svg>
523
+ </template>
524
+ </USelect>
525
+ </FlowToolbarItemWrapper>
526
+
527
+ <!-- 动画 -->
528
+ <FlowToolbarItemWrapper label="流动动画">
529
+ <div class="flex items-center h-7">
530
+ <USwitch
531
+ :model-value="edgeAnimated"
532
+ size="lg"
533
+ @update:model-value="onToggleEdgeAnimated?.()"
104
534
  />
105
535
  </div>
106
- </template>
107
- </ButtonTheme>
108
- </div>
109
- </fieldset>
536
+ </FlowToolbarItemWrapper>
537
+
538
+ <!-- 连接线颜色 -->
539
+ <div :class="{ 'opacity-40 pointer-events-none': isUnifiedMode }">
540
+ <FlowToolbarItemWrapper label="连接线颜色">
541
+ <div class="grid grid-cols-9 gap-2">
542
+ <CircleColor
543
+ v-for="opt in FLOW_COLORS"
544
+ :key="opt.color"
545
+ :chip="opt.chip"
546
+ :shade="500"
547
+ :selected="edgeColor === opt.color"
548
+ :title="opt.chip || 'default'"
549
+ @click="onEdgeColorChange?.(opt.color)"
550
+ />
551
+ </div>
552
+ </FlowToolbarItemWrapper>
553
+ </div>
554
+
555
+ <USeparator class="py-2" />
556
+
557
+ <!-- 标签颜色 -->
558
+ <div :class="{ 'opacity-40 pointer-events-none': isUnifiedMode }">
559
+ <FlowToolbarItemWrapper label="标签颜色">
560
+ <div class="grid grid-cols-9 gap-2">
561
+ <CircleColor
562
+ v-for="opt in FLOW_COLORS"
563
+ :key="opt.color"
564
+ :chip="opt.chip"
565
+ :shade="600"
566
+ :selected="edgeLabelColor === opt.color"
567
+ :title="opt.chip || 'default'"
568
+ @click="onEdgeLabelColorChange?.(opt.color)"
569
+ />
570
+ </div>
571
+ </FlowToolbarItemWrapper>
572
+ </div>
573
+ </div>
574
+ </template>
575
+ </UTabs>
110
576
  </template>
111
- </UPopover>
577
+ </USlideover>
112
578
  </div>
113
579
  </template>