v-nuxt-ui 0.2.4 → 0.2.5
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/runtime/components/AsyncSelect.d.vue.ts +25 -0
- package/dist/runtime/components/AsyncSelect.vue +178 -0
- package/dist/runtime/components/AsyncSelect.vue.d.ts +25 -0
- package/dist/runtime/components/AsyncTreeSelect.d.vue.ts +23 -0
- package/dist/runtime/components/AsyncTreeSelect.vue +151 -0
- package/dist/runtime/components/AsyncTreeSelect.vue.d.ts +23 -0
- package/dist/runtime/components/Empty.d.vue.ts +1 -1
- package/dist/runtime/components/Empty.vue.d.ts +1 -1
- package/dist/runtime/components/date-picker/Input.d.vue.ts +2 -2
- package/dist/runtime/components/date-picker/Input.vue.d.ts +2 -2
- package/dist/runtime/components/flow/FlowEdge.client.vue +6 -4
- package/dist/runtime/components/flow/FlowEditor.client.d.vue.ts +14 -0
- package/dist/runtime/components/flow/FlowEditor.client.vue +43 -7
- package/dist/runtime/components/flow/FlowEditor.client.vue.d.ts +14 -0
- package/dist/runtime/components/flow/FlowNode.client.vue +32 -25
- package/dist/runtime/components/flow/FlowToolbar.d.vue.ts +3 -0
- package/dist/runtime/components/flow/FlowToolbar.vue +16 -1
- package/dist/runtime/components/flow/FlowToolbar.vue.d.ts +3 -0
- package/dist/runtime/components/form/field/AsyncObjectSelect.d.vue.ts +4 -2
- package/dist/runtime/components/form/field/AsyncObjectSelect.vue +16 -13
- package/dist/runtime/components/form/field/AsyncObjectSelect.vue.d.ts +4 -2
- package/dist/runtime/components/form/field/AsyncSelect.d.vue.ts +8 -12
- package/dist/runtime/components/form/field/AsyncSelect.vue +31 -146
- package/dist/runtime/components/form/field/AsyncSelect.vue.d.ts +8 -12
- package/dist/runtime/components/form/field/AsyncTreeSelect.d.vue.ts +3 -5
- package/dist/runtime/components/form/field/AsyncTreeSelect.vue +31 -112
- package/dist/runtime/components/form/field/AsyncTreeSelect.vue.d.ts +3 -5
- package/dist/runtime/components/form/field/index.vue +3 -41
- package/dist/runtime/components/sys/department/CreateModal.vue +9 -9
- package/dist/runtime/components/sys/menu/CreateModal.vue +3 -3
- package/dist/runtime/components/sys/user/CreateModal.vue +9 -7
- package/dist/runtime/components/sys/user/Table.vue +3 -3
- package/dist/runtime/components/table/query/where/simple/item/opr/AsyncSelect.d.vue.ts +2 -6
- package/dist/runtime/components/table/query/where/simple/item/opr/AsyncSelect.vue +28 -122
- package/dist/runtime/components/table/query/where/simple/item/opr/AsyncSelect.vue.d.ts +2 -6
- package/dist/runtime/components/table/query/where/simple/item/opr/index.vue +2 -2
- package/dist/runtime/components/table/settings/UserTableColumnModal.d.vue.ts +2 -2
- package/dist/runtime/components/table/settings/UserTableColumnModal.vue.d.ts +2 -2
- package/dist/runtime/composables/flow/useFlowStyles.d.ts +2 -0
- package/dist/runtime/composables/flow/useFlowStyles.js +3 -0
- package/dist/runtime/constants/columns.js +2 -2
- package/dist/runtime/constants/flow.d.ts +4 -0
- package/dist/runtime/constants/flow.js +1 -0
- package/dist/runtime/types/components/async-select.d.ts +30 -0
- package/dist/runtime/types/components/async-select.js +0 -0
- package/dist/runtime/types/components/form/field.d.ts +8 -25
- package/dist/runtime/types/components/index.d.ts +1 -0
- package/dist/runtime/types/components/index.js +1 -0
- package/dist/runtime/types/components/table/column.d.ts +3 -27
- package/package.json +18 -18
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { ref, computed, provide, watchEffect, onMounted, onBeforeUnmount } from "vue";
|
|
2
|
+
import { ref, computed, provide, watchEffect, watch, nextTick, onMounted, onBeforeUnmount, toRef } from "vue";
|
|
3
3
|
import { VueFlow, useVueFlow, Panel } from "@vue-flow/core";
|
|
4
4
|
import { Background } from "@vue-flow/background";
|
|
5
|
-
import { FLOW_MOUSE_POSITION_KEY, FLOW_EDGE_STROKE_TYPES } from "#v/constants";
|
|
5
|
+
import { FLOW_MOUSE_POSITION_KEY, FLOW_EDITABLE_KEY, FLOW_EDGE_STROKE_TYPES } from "#v/constants";
|
|
6
6
|
import FlowNode from "./FlowNode.client.vue";
|
|
7
7
|
import FlowEdge from "./FlowEdge.client.vue";
|
|
8
8
|
import FlowToolbar from "./FlowToolbar.vue";
|
|
@@ -16,7 +16,12 @@ const props = defineProps({
|
|
|
16
16
|
showStats: { type: Boolean, required: false, default: true },
|
|
17
17
|
minZoom: { type: Number, required: false, default: 0.2 },
|
|
18
18
|
maxZoom: { type: Number, required: false, default: 4 },
|
|
19
|
-
defaultZoom: { type: Number, required: false, default: 1 }
|
|
19
|
+
defaultZoom: { type: Number, required: false, default: 1 },
|
|
20
|
+
zoomable: { type: Boolean, required: false, default: true },
|
|
21
|
+
draggable: { type: Boolean, required: false, default: true },
|
|
22
|
+
editable: { type: Boolean, required: false, default: true },
|
|
23
|
+
fitView: { type: Boolean, required: false, default: false },
|
|
24
|
+
fitViewPadding: { type: Number, required: false, default: 0.01 }
|
|
20
25
|
});
|
|
21
26
|
const emit = defineEmits(["update:modelValue", "edit-node"]);
|
|
22
27
|
const handleUpdateModel = (model) => {
|
|
@@ -50,6 +55,7 @@ const {
|
|
|
50
55
|
edgePathType,
|
|
51
56
|
edgeColor,
|
|
52
57
|
edgeLabelColor,
|
|
58
|
+
nodeShowBorder,
|
|
53
59
|
nodeBorderWidth,
|
|
54
60
|
nodeBorderRadius,
|
|
55
61
|
nodeBorderColor,
|
|
@@ -67,7 +73,7 @@ const {
|
|
|
67
73
|
effectiveNodeHandleColor,
|
|
68
74
|
effectiveEdgeColor
|
|
69
75
|
} = useFlowStyles();
|
|
70
|
-
const { onConnect, onNodeDragStop, onEdgeUpdate, getSelectedNodes, getSelectedEdges, getViewport } = useVueFlow();
|
|
76
|
+
const { onConnect, onNodeDragStop, onEdgeUpdate, getSelectedNodes, getSelectedEdges, getViewport, fitView: vueFlowFitView } = useVueFlow();
|
|
71
77
|
const handleResizeEnd = async (nodeId, dimensions) => {
|
|
72
78
|
await updateNodeDimensions(nodeId, dimensions);
|
|
73
79
|
};
|
|
@@ -84,6 +90,7 @@ const {
|
|
|
84
90
|
} = resizeLogic;
|
|
85
91
|
const mousePosition = ref({ x: 0, y: 0 });
|
|
86
92
|
provide(FLOW_MOUSE_POSITION_KEY, mousePosition);
|
|
93
|
+
provide(FLOW_EDITABLE_KEY, toRef(props, "editable"));
|
|
87
94
|
const handleEditNode = (nodeId) => {
|
|
88
95
|
const flowNode = props.modelValue?.nodes?.find((n) => String(n.id) === nodeId);
|
|
89
96
|
if (flowNode) {
|
|
@@ -94,6 +101,7 @@ watchEffect(() => {
|
|
|
94
101
|
flowLogic.syncNodes((nodeId) => ({
|
|
95
102
|
onEdit: () => handleEditNode(nodeId),
|
|
96
103
|
onDelete: () => deleteNode(nodeId),
|
|
104
|
+
showBorder: nodeShowBorder.value,
|
|
97
105
|
borderWidth: nodeBorderWidth.value,
|
|
98
106
|
borderRadius: nodeBorderRadius.value,
|
|
99
107
|
borderColor: effectiveNodeBorderColor.value,
|
|
@@ -103,6 +111,7 @@ watchEffect(() => {
|
|
|
103
111
|
handleSize: nodeHandleSize.value,
|
|
104
112
|
handleColor: effectiveNodeHandleColor.value,
|
|
105
113
|
onResizeStart: (event, edge) => {
|
|
114
|
+
if (!props.editable) return;
|
|
106
115
|
const node = props.modelValue?.nodes?.find((n) => String(n.id) === nodeId);
|
|
107
116
|
if (node) {
|
|
108
117
|
startResize(event, nodeId, node, edge);
|
|
@@ -138,6 +147,7 @@ const isEditableTarget = (target) => {
|
|
|
138
147
|
return element.isContentEditable || tagName === "INPUT" || tagName === "TEXTAREA" || tagName === "SELECT";
|
|
139
148
|
};
|
|
140
149
|
const handleKeyDown = async (event) => {
|
|
150
|
+
if (!props.editable) return;
|
|
141
151
|
if (!isDeleteKey(event)) return;
|
|
142
152
|
if (isEditableTarget(event.target)) return;
|
|
143
153
|
event.preventDefault();
|
|
@@ -159,6 +169,9 @@ onMounted(() => {
|
|
|
159
169
|
document.addEventListener("keydown", handleKeyDown, true);
|
|
160
170
|
window.addEventListener("mousemove", handleGlobalMouseMove);
|
|
161
171
|
window.addEventListener("mouseup", handleMouseUp);
|
|
172
|
+
if (props.fitView) {
|
|
173
|
+
setTimeout(() => vueFlowFitView({ padding: props.fitViewPadding }), 100);
|
|
174
|
+
}
|
|
162
175
|
onBeforeUnmount(() => {
|
|
163
176
|
document.removeEventListener("keydown", handleKeyDown, true);
|
|
164
177
|
window.removeEventListener("mousemove", handleGlobalMouseMove);
|
|
@@ -170,13 +183,25 @@ onNodeDragStop(async (event) => {
|
|
|
170
183
|
await updateNodePosition(node.id, node.position.x, node.position.y);
|
|
171
184
|
});
|
|
172
185
|
onConnect(async (params) => {
|
|
186
|
+
if (!props.editable) return;
|
|
173
187
|
await createEdge(params);
|
|
174
188
|
});
|
|
175
189
|
onEdgeUpdate(({ edge, connection }) => {
|
|
190
|
+
if (!props.editable) return;
|
|
176
191
|
if (connection.source && connection.target) {
|
|
177
192
|
reconnectEdge(edge.id, connection);
|
|
178
193
|
}
|
|
179
194
|
});
|
|
195
|
+
watch(
|
|
196
|
+
[
|
|
197
|
+
() => props.fitView,
|
|
198
|
+
() => nodes.value.map((n) => `${n.id}:${n.position?.x}:${n.position?.y}:${n.data?.width}:${n.data?.height}`).join(",")
|
|
199
|
+
],
|
|
200
|
+
() => {
|
|
201
|
+
if (props.fitView) nextTick(() => vueFlowFitView({ padding: props.fitViewPadding }));
|
|
202
|
+
},
|
|
203
|
+
{ flush: "post" }
|
|
204
|
+
);
|
|
180
205
|
const defaultEdgeOptions = computed(() => {
|
|
181
206
|
const dasharray = FLOW_EDGE_STROKE_TYPES.find((t) => t.type === edgeStrokeType.value)?.dasharray || "";
|
|
182
207
|
return {
|
|
@@ -205,8 +230,16 @@ const isValidConnection = () => true;
|
|
|
205
230
|
:snap-grid="[GRID_SIZE, GRID_SIZE]"
|
|
206
231
|
:default-edge-options="defaultEdgeOptions"
|
|
207
232
|
:is-valid-connection="isValidConnection"
|
|
208
|
-
:edges-updatable="
|
|
209
|
-
|
|
233
|
+
:edges-updatable="editable"
|
|
234
|
+
:zoom-on-scroll="zoomable"
|
|
235
|
+
:zoom-on-pinch="zoomable"
|
|
236
|
+
:zoom-on-double-click="zoomable"
|
|
237
|
+
:pan-on-drag="draggable"
|
|
238
|
+
:pan-on-scroll="false"
|
|
239
|
+
:nodes-draggable="draggable"
|
|
240
|
+
:nodes-connectable="editable"
|
|
241
|
+
:elements-selectable="editable"
|
|
242
|
+
:class="{ 'flow-fit-view': fitView }"
|
|
210
243
|
>
|
|
211
244
|
<Background
|
|
212
245
|
v-if="showBackground"
|
|
@@ -231,6 +264,7 @@ const isValidConnection = () => true;
|
|
|
231
264
|
<FlowToolbar
|
|
232
265
|
:on-add-node="createNode"
|
|
233
266
|
:loading="loading"
|
|
267
|
+
:editable="editable"
|
|
234
268
|
:edge-stroke-width="edgeStrokeWidth"
|
|
235
269
|
:edge-stroke-type="edgeStrokeType"
|
|
236
270
|
:edge-path-type="edgePathType"
|
|
@@ -239,6 +273,7 @@ const isValidConnection = () => true;
|
|
|
239
273
|
:edge-animated="edgeAnimated"
|
|
240
274
|
:edge-color="edgeColor"
|
|
241
275
|
:edge-label-color="edgeLabelColor"
|
|
276
|
+
:node-show-border="nodeShowBorder"
|
|
242
277
|
:node-border-width="nodeBorderWidth"
|
|
243
278
|
:node-border-radius="nodeBorderRadius"
|
|
244
279
|
:node-border-color="nodeBorderColor"
|
|
@@ -255,6 +290,7 @@ const isValidConnection = () => true;
|
|
|
255
290
|
:on-toggle-edge-animated="() => edgeAnimated = !edgeAnimated"
|
|
256
291
|
:on-edge-color-change="(v) => edgeColor = v"
|
|
257
292
|
:on-edge-label-color-change="(v) => edgeLabelColor = v"
|
|
293
|
+
:on-toggle-node-show-border="() => nodeShowBorder = !nodeShowBorder"
|
|
258
294
|
:on-node-border-width-change="(v) => nodeBorderWidth = v"
|
|
259
295
|
:on-node-border-radius-change="(v) => nodeBorderRadius = v"
|
|
260
296
|
:on-node-border-color-change="(v) => nodeBorderColor = v"
|
|
@@ -291,5 +327,5 @@ const isValidConnection = () => true;
|
|
|
291
327
|
</template>
|
|
292
328
|
|
|
293
329
|
<style>
|
|
294
|
-
@import "@vue-flow/core/dist/style.css";@import "@vue-flow/core/dist/theme-default.css";.fade-enter-active,.fade-leave-active{transition:opacity .2s ease}.fade-enter-from,.fade-leave-to{opacity:0}
|
|
330
|
+
@import "@vue-flow/core/dist/style.css";@import "@vue-flow/core/dist/theme-default.css";.fade-enter-active,.fade-leave-active{transition:opacity .2s ease}.fade-enter-from,.fade-leave-to{opacity:0}.flow-fit-view{height:100%!important;width:100%!important}
|
|
295
331
|
</style>
|
|
@@ -16,6 +16,15 @@ type __VLS_Props = {
|
|
|
16
16
|
maxZoom?: number;
|
|
17
17
|
/** 默认缩放 */
|
|
18
18
|
defaultZoom?: number;
|
|
19
|
+
/** 是否允许鼠标滚轮缩放 */
|
|
20
|
+
zoomable?: boolean;
|
|
21
|
+
/** 是否允许拖拽画布(平移) */
|
|
22
|
+
draggable?: boolean;
|
|
23
|
+
/** 是否可编辑(false 时:工具栏新增按钮禁用、edge 不能增删改、node handles 不显示) */
|
|
24
|
+
editable?: boolean;
|
|
25
|
+
/** 是否自动适配填满容器并居中 */
|
|
26
|
+
fitView?: boolean;
|
|
27
|
+
fitViewPadding?: number;
|
|
19
28
|
};
|
|
20
29
|
declare var __VLS_21: {
|
|
21
30
|
data: any;
|
|
@@ -33,13 +42,18 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {},
|
|
|
33
42
|
"onEdit-node"?: ((node: FlowNodeType) => any) | undefined;
|
|
34
43
|
}>, {
|
|
35
44
|
modelValue: Flow;
|
|
45
|
+
draggable: boolean;
|
|
36
46
|
api: FlowApi;
|
|
47
|
+
editable: boolean;
|
|
37
48
|
showBackground: boolean;
|
|
38
49
|
showToolbar: boolean;
|
|
39
50
|
showStats: boolean;
|
|
40
51
|
minZoom: number;
|
|
41
52
|
maxZoom: number;
|
|
42
53
|
defaultZoom: number;
|
|
54
|
+
zoomable: boolean;
|
|
55
|
+
fitView: boolean;
|
|
56
|
+
fitViewPadding: number;
|
|
43
57
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
44
58
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
45
59
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed } from "vue";
|
|
2
|
+
import { computed, inject, ref } from "vue";
|
|
3
3
|
import { Handle } from "@vue-flow/core";
|
|
4
|
-
import { FLOW_RESIZE_HANDLES, GRID_SIZE } from "#v/constants";
|
|
4
|
+
import { FLOW_RESIZE_HANDLES, FLOW_EDITABLE_KEY, GRID_SIZE } from "#v/constants";
|
|
5
5
|
import { useFlowNode } from "#v/composables";
|
|
6
6
|
const props = defineProps({
|
|
7
7
|
data: { type: null, required: true },
|
|
8
8
|
selected: { type: Boolean, required: false }
|
|
9
9
|
});
|
|
10
|
+
const editable = inject(FLOW_EDITABLE_KEY, ref(true));
|
|
10
11
|
const {
|
|
11
12
|
nodeRef,
|
|
12
13
|
isHoveredLocal,
|
|
@@ -20,21 +21,23 @@ const {
|
|
|
20
21
|
const setNodeRef = (el) => {
|
|
21
22
|
nodeRef.value = el instanceof HTMLElement ? el : null;
|
|
22
23
|
};
|
|
24
|
+
const showBorder = computed(() => props.data.showBorder !== false);
|
|
23
25
|
</script>
|
|
24
26
|
|
|
25
27
|
<template>
|
|
26
28
|
<div
|
|
27
29
|
:ref="setNodeRef"
|
|
28
|
-
class="bg-background
|
|
30
|
+
class="bg-background relative flex"
|
|
31
|
+
:class="{ border: showBorder }"
|
|
29
32
|
:style="{
|
|
30
33
|
boxSizing: 'border-box',
|
|
31
34
|
width: data.width ? `${data.width}px` : GRID_SIZE * 6 + 'px',
|
|
32
35
|
height: data.height ? `${data.height}px` : 'auto',
|
|
33
36
|
minWidth: GRID_SIZE * 2 + 'px',
|
|
34
37
|
minHeight: GRID_SIZE * 2 + 'px',
|
|
35
|
-
borderWidth: data.borderWidth ? `${data.borderWidth}px` : '2px',
|
|
36
|
-
borderStyle: 'solid',
|
|
37
|
-
borderColor,
|
|
38
|
+
borderWidth: showBorder ? data.borderWidth ? `${data.borderWidth}px` : '2px' : '0px',
|
|
39
|
+
borderStyle: showBorder ? 'solid' : 'none',
|
|
40
|
+
borderColor: showBorder ? borderColor : 'transparent',
|
|
38
41
|
borderRadius: data.borderRadius !== void 0 ? `${data.borderRadius}px` : '6px',
|
|
39
42
|
...data.bgColor ? { backgroundColor: data.bgColor } : {},
|
|
40
43
|
...data.fontColor ? { color: data.fontColor } : {},
|
|
@@ -44,16 +47,18 @@ const setNodeRef = (el) => {
|
|
|
44
47
|
@mouseleave="isHoveredLocal = false"
|
|
45
48
|
@dblclick="data.onEdit?.()"
|
|
46
49
|
>
|
|
47
|
-
<!-- Connection handles
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
<!-- Connection handles:仅在可编辑模式下渲染 -->
|
|
51
|
+
<template v-if="editable">
|
|
52
|
+
<Handle
|
|
53
|
+
v-for="handle in activeHandles"
|
|
54
|
+
:id="`${handle.id}`"
|
|
55
|
+
:key="`${handle.id}`"
|
|
56
|
+
type="source"
|
|
57
|
+
:position="handle.position"
|
|
58
|
+
:style="handleStyle(handle)"
|
|
59
|
+
@mousedown.stop
|
|
60
|
+
/>
|
|
61
|
+
</template>
|
|
57
62
|
|
|
58
63
|
<!-- content -->
|
|
59
64
|
<div class="flex items-center justify-center gap-2 w-full">
|
|
@@ -62,14 +67,16 @@ const setNodeRef = (el) => {
|
|
|
62
67
|
</slot>
|
|
63
68
|
</div>
|
|
64
69
|
|
|
65
|
-
<!-- Resize handles
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
<!-- Resize handles:仅在可编辑模式下渲染 -->
|
|
71
|
+
<template v-if="editable">
|
|
72
|
+
<div
|
|
73
|
+
v-for="rh in FLOW_RESIZE_HANDLES"
|
|
74
|
+
:key="rh.edge"
|
|
75
|
+
class="absolute nodrag"
|
|
76
|
+
:class="rh.class"
|
|
77
|
+
:style="{ zIndex: rh.zIndex, cursor: rh.cursor }"
|
|
78
|
+
@mousedown.stop.prevent="data.onResizeStart?.($event, rh.edge)"
|
|
79
|
+
/>
|
|
80
|
+
</template>
|
|
74
81
|
</div>
|
|
75
82
|
</template>
|
|
@@ -12,6 +12,8 @@ type __VLS_Props = {
|
|
|
12
12
|
edgeAnimated?: boolean;
|
|
13
13
|
edgeColor?: string;
|
|
14
14
|
edgeLabelColor?: string;
|
|
15
|
+
editable?: boolean;
|
|
16
|
+
nodeShowBorder?: boolean;
|
|
15
17
|
nodeBorderWidth?: number;
|
|
16
18
|
nodeBorderRadius?: number;
|
|
17
19
|
nodeBorderColor?: string;
|
|
@@ -34,6 +36,7 @@ type __VLS_Props = {
|
|
|
34
36
|
onToggleEdgeAnimated?: () => void;
|
|
35
37
|
onEdgeColorChange?: (color: string) => void;
|
|
36
38
|
onEdgeLabelColorChange?: (color: string) => void;
|
|
39
|
+
onToggleNodeShowBorder?: () => void;
|
|
37
40
|
onNodeBorderWidthChange?: (width: number) => void;
|
|
38
41
|
onNodeBorderRadiusChange?: (radius: number) => void;
|
|
39
42
|
onNodeBorderColorChange?: (color: string) => void;
|
|
@@ -27,6 +27,8 @@ defineProps({
|
|
|
27
27
|
edgeAnimated: { type: Boolean, required: false },
|
|
28
28
|
edgeColor: { type: String, required: false },
|
|
29
29
|
edgeLabelColor: { type: String, required: false },
|
|
30
|
+
editable: { type: Boolean, required: false },
|
|
31
|
+
nodeShowBorder: { type: Boolean, required: false },
|
|
30
32
|
nodeBorderWidth: { type: Number, required: false },
|
|
31
33
|
nodeBorderRadius: { type: Number, required: false },
|
|
32
34
|
nodeBorderColor: { type: String, required: false },
|
|
@@ -46,6 +48,7 @@ defineProps({
|
|
|
46
48
|
onToggleEdgeAnimated: { type: Function, required: false },
|
|
47
49
|
onEdgeColorChange: { type: Function, required: false },
|
|
48
50
|
onEdgeLabelColorChange: { type: Function, required: false },
|
|
51
|
+
onToggleNodeShowBorder: { type: Function, required: false },
|
|
49
52
|
onNodeBorderWidthChange: { type: Function, required: false },
|
|
50
53
|
onNodeBorderRadiusChange: { type: Function, required: false },
|
|
51
54
|
onNodeBorderColorChange: { type: Function, required: false },
|
|
@@ -80,7 +83,7 @@ function getStrokeDasharray(value) {
|
|
|
80
83
|
icon="i-lucide-circle-plus"
|
|
81
84
|
size="sm"
|
|
82
85
|
variant="subtle"
|
|
83
|
-
:disabled="loading"
|
|
86
|
+
:disabled="loading || editable === false"
|
|
84
87
|
:loading="loading"
|
|
85
88
|
@click="onAddNode?.()"
|
|
86
89
|
/>
|
|
@@ -148,6 +151,17 @@ function getStrokeDasharray(value) {
|
|
|
148
151
|
|
|
149
152
|
<template #node>
|
|
150
153
|
<div class="flex flex-col gap-4">
|
|
154
|
+
<!-- 显示边框 -->
|
|
155
|
+
<FlowToolbarItemWrapper label="显示边框">
|
|
156
|
+
<div class="flex items-center h-7">
|
|
157
|
+
<USwitch
|
|
158
|
+
:model-value="nodeShowBorder"
|
|
159
|
+
size="lg"
|
|
160
|
+
@update:model-value="onToggleNodeShowBorder?.()"
|
|
161
|
+
/>
|
|
162
|
+
</div>
|
|
163
|
+
</FlowToolbarItemWrapper>
|
|
164
|
+
|
|
151
165
|
<!-- 边框粗细 -->
|
|
152
166
|
<FlowToolbarItemWrapper label="边框粗细">
|
|
153
167
|
<USelect
|
|
@@ -155,6 +169,7 @@ function getStrokeDasharray(value) {
|
|
|
155
169
|
:items="FLOW_WIDTH_ITEMS"
|
|
156
170
|
:size="itemSize"
|
|
157
171
|
trailing-icon=""
|
|
172
|
+
:disabled="!nodeShowBorder"
|
|
158
173
|
@update:model-value="(v) => onNodeBorderWidthChange?.(v)"
|
|
159
174
|
>
|
|
160
175
|
<template #item-leading="{ item }">
|
|
@@ -12,6 +12,8 @@ type __VLS_Props = {
|
|
|
12
12
|
edgeAnimated?: boolean;
|
|
13
13
|
edgeColor?: string;
|
|
14
14
|
edgeLabelColor?: string;
|
|
15
|
+
editable?: boolean;
|
|
16
|
+
nodeShowBorder?: boolean;
|
|
15
17
|
nodeBorderWidth?: number;
|
|
16
18
|
nodeBorderRadius?: number;
|
|
17
19
|
nodeBorderColor?: string;
|
|
@@ -34,6 +36,7 @@ type __VLS_Props = {
|
|
|
34
36
|
onToggleEdgeAnimated?: () => void;
|
|
35
37
|
onEdgeColorChange?: (color: string) => void;
|
|
36
38
|
onEdgeLabelColorChange?: (color: string) => void;
|
|
39
|
+
onToggleNodeShowBorder?: () => void;
|
|
37
40
|
onNodeBorderWidthChange?: (width: number) => void;
|
|
38
41
|
onNodeBorderRadiusChange?: (radius: number) => void;
|
|
39
42
|
onNodeBorderColorChange?: (color: string) => void;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type { VFormFieldAsyncSelectProps } from '#v/types';
|
|
2
1
|
declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
|
-
props: import("vue").PublicProps & __VLS_PrettifyLocal<(
|
|
2
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<({
|
|
3
|
+
initModel?: any | any[];
|
|
4
|
+
onUpdateInitModel?(model: any | any[] | undefined): void;
|
|
5
|
+
} & import("#v/types").VAsyncSelectProps<T> & {
|
|
4
6
|
modelValue: T[] | undefined;
|
|
5
7
|
}) & {
|
|
6
8
|
"onUpdate:modelValue"?: ((value: T[] | undefined) => any) | undefined;
|
|
@@ -2,33 +2,38 @@
|
|
|
2
2
|
import { ref, watch } from "vue";
|
|
3
3
|
import AsyncSelect from "./AsyncSelect.vue";
|
|
4
4
|
const props = defineProps({
|
|
5
|
+
initModel: { type: null, required: false },
|
|
6
|
+
onUpdateInitModel: { type: Function, required: false },
|
|
7
|
+
label: { type: String, required: false },
|
|
8
|
+
floatingPlaceholder: { type: Boolean, required: false },
|
|
9
|
+
disabled: { type: Boolean, required: false },
|
|
10
|
+
placeholder: { type: String, required: false },
|
|
11
|
+
size: { type: null, required: false },
|
|
12
|
+
icon: { type: null, required: false },
|
|
5
13
|
listApi: { type: Function, required: true },
|
|
14
|
+
searchFields: { type: Function, required: false },
|
|
15
|
+
likeSearchFields: { type: Array, required: false },
|
|
6
16
|
extraQuery: { type: Object, required: false },
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
searchFields: { type: Array, required: true },
|
|
10
|
-
extraSearchFieldFn: { type: Function, required: false },
|
|
11
|
-
labelField: { type: null, required: false },
|
|
17
|
+
fetchAll: { type: Boolean, required: false },
|
|
18
|
+
labelField: { type: null, required: true },
|
|
12
19
|
valueField: { type: null, required: true },
|
|
13
20
|
labelRenderFn: { type: Function, required: false },
|
|
14
21
|
enableEmptyOption: { type: Boolean, required: false },
|
|
15
|
-
disableOprSelector: { type: Boolean, required: false },
|
|
16
22
|
multiple: { type: Boolean, required: false },
|
|
17
|
-
|
|
18
|
-
size: { type: null, required: false },
|
|
23
|
+
afterSelect: { type: Function, required: false },
|
|
19
24
|
canCreate: { type: Boolean, required: false },
|
|
20
25
|
createModalComponent: { type: null, required: false },
|
|
21
26
|
createModalOpenProps: { type: Object, required: false }
|
|
22
27
|
});
|
|
23
28
|
const modelValue = defineModel("modelValue", { type: null, ...{ required: true } });
|
|
24
|
-
const initModelValue = ref(modelValue.value);
|
|
25
29
|
const modelValueWithValueField = ref(modelValue.value?.map((item) => item[props.valueField]));
|
|
26
30
|
watch(
|
|
27
|
-
[
|
|
31
|
+
[props.initModel, modelValueWithValueField],
|
|
28
32
|
() => {
|
|
29
33
|
const newModelValue = [];
|
|
30
34
|
modelValueWithValueField.value?.forEach((value) => {
|
|
31
|
-
const
|
|
35
|
+
const initModelArray = Array.isArray(props.initModel) ? props.initModel : [props.initModel].filter(Boolean);
|
|
36
|
+
const item = initModelArray.find((innerItem) => innerItem[props.valueField] === value);
|
|
32
37
|
if (item) {
|
|
33
38
|
newModelValue.push(item);
|
|
34
39
|
}
|
|
@@ -43,7 +48,5 @@ watch(
|
|
|
43
48
|
<AsyncSelect
|
|
44
49
|
v-bind="props"
|
|
45
50
|
v-model="modelValueWithValueField"
|
|
46
|
-
:init-model-values="initModelValue"
|
|
47
|
-
@update-init-model-values="(newInitModelValues) => initModelValue = newInitModelValues"
|
|
48
51
|
/>
|
|
49
52
|
</template>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type { VFormFieldAsyncSelectProps } from '#v/types';
|
|
2
1
|
declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
|
-
props: import("vue").PublicProps & __VLS_PrettifyLocal<(
|
|
2
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<({
|
|
3
|
+
initModel?: any | any[];
|
|
4
|
+
onUpdateInitModel?(model: any | any[] | undefined): void;
|
|
5
|
+
} & import("#v/types").VAsyncSelectProps<T> & {
|
|
4
6
|
modelValue: T[] | undefined;
|
|
5
7
|
}) & {
|
|
6
8
|
"onUpdate:modelValue"?: ((value: T[] | undefined) => any) | undefined;
|
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { VFormFieldAsyncSelectProps } from '#v/types';
|
|
1
|
+
import type { AsyncSelectValue } from '#v/types';
|
|
3
2
|
declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
|
-
props: import("vue").PublicProps & __VLS_PrettifyLocal<(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
createModalOpenProps?: Record<string, any>;
|
|
10
|
-
} & {
|
|
11
|
-
modelValue: string[] | number[] | number | string | null | undefined;
|
|
3
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<({
|
|
4
|
+
initModel?: any | any[];
|
|
5
|
+
onUpdateInitModel?(model: any | any[] | undefined): void;
|
|
6
|
+
} & import("#v/types").VAsyncSelectProps<T> & {
|
|
7
|
+
modelValue: AsyncSelectValue;
|
|
12
8
|
}) & {
|
|
13
|
-
"onUpdate:modelValue"?: ((value:
|
|
9
|
+
"onUpdate:modelValue"?: ((value: AsyncSelectValue) => any) | undefined;
|
|
14
10
|
}> & (typeof globalThis extends {
|
|
15
11
|
__VLS_PROPS_FALLBACK: infer P;
|
|
16
12
|
} ? P : {});
|
|
17
13
|
expose: (exposed: {}) => void;
|
|
18
14
|
attrs: any;
|
|
19
15
|
slots: {};
|
|
20
|
-
emit: (event: "update:modelValue", value:
|
|
16
|
+
emit: (event: "update:modelValue", value: AsyncSelectValue) => void;
|
|
21
17
|
}>) => import("vue").VNode & {
|
|
22
18
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
23
19
|
};
|