v-nuxt-ui 0.2.14 → 0.2.16
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/EChart.client.vue +6 -5
- package/dist/runtime/components/flow/FlowEditor.client.d.vue.ts +6 -1
- package/dist/runtime/components/flow/FlowEditor.client.vue +14 -4
- package/dist/runtime/components/flow/FlowEditor.client.vue.d.ts +6 -1
- package/dist/runtime/composables/useEChart.js +30 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
import VChart from "vue-echarts";
|
|
14
14
|
import { useTheme, useApp, useEChart } from "#v/composables";
|
|
15
15
|
import { useColorMode, useLocalStorage } from "@vueuse/core";
|
|
16
|
-
import { ref, useTemplateRef, watch } from "vue";
|
|
16
|
+
import { nextTick, ref, useTemplateRef, watch } from "vue";
|
|
17
17
|
import { StorageKey } from "#v/types";
|
|
18
18
|
const props = defineProps({
|
|
19
19
|
option: { type: null, required: true },
|
|
@@ -69,7 +69,7 @@ const chartRef = useTemplateRef("v-chart");
|
|
|
69
69
|
watch(
|
|
70
70
|
[
|
|
71
71
|
() => props.option,
|
|
72
|
-
colorMode,
|
|
72
|
+
() => colorMode.value,
|
|
73
73
|
() => props.enableXAxis,
|
|
74
74
|
() => props.enableYAxis,
|
|
75
75
|
() => theme.primary.value,
|
|
@@ -77,10 +77,11 @@ watch(
|
|
|
77
77
|
() => app.appConfig.value.radius,
|
|
78
78
|
() => rotateXAxisLabel.value
|
|
79
79
|
],
|
|
80
|
-
|
|
80
|
+
async () => {
|
|
81
|
+
await nextTick();
|
|
81
82
|
updateOption();
|
|
82
|
-
},
|
|
83
|
-
{ immediate: true, deep: true }
|
|
83
|
+
},
|
|
84
|
+
{ immediate: true, deep: true, flush: "post" }
|
|
84
85
|
);
|
|
85
86
|
defineExpose({
|
|
86
87
|
downloadImage: (filenamePrefix) => {
|
|
@@ -22,6 +22,8 @@ type __VLS_Props = {
|
|
|
22
22
|
draggable?: boolean;
|
|
23
23
|
/** 是否可编辑(false 时:工具栏新增按钮禁用、edge 不能增删改、node handles 不显示) */
|
|
24
24
|
editable?: boolean;
|
|
25
|
+
/** 是否允许点击选中节点(默认跟随 editable) */
|
|
26
|
+
nodeSelectable?: boolean;
|
|
25
27
|
/** 是否自动适配填满容器并居中 */
|
|
26
28
|
fitView?: boolean;
|
|
27
29
|
fitViewPadding?: number;
|
|
@@ -35,7 +37,10 @@ type __VLS_Slots = {} & {
|
|
|
35
37
|
} & {
|
|
36
38
|
default?: (props: typeof __VLS_63) => any;
|
|
37
39
|
};
|
|
38
|
-
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
40
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
41
|
+
selectedNode: import("vue").ComputedRef<FlowNodeType | null>;
|
|
42
|
+
selectedNodes: import("vue").ComputedRef<FlowNodeType[]>;
|
|
43
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
39
44
|
"update:modelValue": (value: Flow) => any;
|
|
40
45
|
"edit-node": (node: FlowNodeType) => any;
|
|
41
46
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
@@ -20,6 +20,7 @@ const props = defineProps({
|
|
|
20
20
|
zoomable: { type: Boolean, required: false, default: true },
|
|
21
21
|
draggable: { type: Boolean, required: false, default: true },
|
|
22
22
|
editable: { type: Boolean, required: false, default: true },
|
|
23
|
+
nodeSelectable: { type: Boolean, required: false },
|
|
23
24
|
fitView: { type: Boolean, required: false, default: false },
|
|
24
25
|
fitViewPadding: { type: Number, required: false, default: 0.01 },
|
|
25
26
|
noFlowNodeBorder: { type: Boolean, required: false }
|
|
@@ -90,6 +91,15 @@ const {
|
|
|
90
91
|
handleMouseMove,
|
|
91
92
|
handleMouseUp
|
|
92
93
|
} = resizeLogic;
|
|
94
|
+
const isNodeSelectable = computed(() => props.nodeSelectable ?? props.editable);
|
|
95
|
+
const selectedNodes = computed(() => {
|
|
96
|
+
return getSelectedNodes.value.map((node) => props.modelValue?.nodes?.find((item) => String(item.id) === node.id)).filter((node) => Boolean(node));
|
|
97
|
+
});
|
|
98
|
+
const selectedNode = computed(() => selectedNodes.value[0] ?? null);
|
|
99
|
+
defineExpose({
|
|
100
|
+
selectedNode,
|
|
101
|
+
selectedNodes
|
|
102
|
+
});
|
|
93
103
|
const mousePosition = ref({ x: 0, y: 0 });
|
|
94
104
|
provide(FLOW_MOUSE_POSITION_KEY, mousePosition);
|
|
95
105
|
provide(FLOW_EDITABLE_KEY, toRef(props, "editable"));
|
|
@@ -156,11 +166,11 @@ const handleKeyDown = async (event) => {
|
|
|
156
166
|
event.preventDefault();
|
|
157
167
|
event.stopPropagation();
|
|
158
168
|
event.stopImmediatePropagation();
|
|
159
|
-
const
|
|
169
|
+
const selectedNodes2 = getSelectedNodes.value;
|
|
160
170
|
const selectedEdges = getSelectedEdges.value;
|
|
161
|
-
if (
|
|
171
|
+
if (selectedNodes2.length === 0 && selectedEdges.length === 0) return;
|
|
162
172
|
await Promise.all([
|
|
163
|
-
...
|
|
173
|
+
...selectedNodes2.map((node) => deleteNode(node.id)),
|
|
164
174
|
...selectedEdges.map((edge) => deleteEdge(edge.id))
|
|
165
175
|
]);
|
|
166
176
|
};
|
|
@@ -268,7 +278,7 @@ const isValidConnection = () => true;
|
|
|
268
278
|
:pan-on-scroll="false"
|
|
269
279
|
:nodes-draggable="draggable"
|
|
270
280
|
:nodes-connectable="editable"
|
|
271
|
-
:elements-selectable="
|
|
281
|
+
:elements-selectable="isNodeSelectable"
|
|
272
282
|
:class="{ 'flow-fit-view': fitView }"
|
|
273
283
|
>
|
|
274
284
|
<Background
|
|
@@ -22,6 +22,8 @@ type __VLS_Props = {
|
|
|
22
22
|
draggable?: boolean;
|
|
23
23
|
/** 是否可编辑(false 时:工具栏新增按钮禁用、edge 不能增删改、node handles 不显示) */
|
|
24
24
|
editable?: boolean;
|
|
25
|
+
/** 是否允许点击选中节点(默认跟随 editable) */
|
|
26
|
+
nodeSelectable?: boolean;
|
|
25
27
|
/** 是否自动适配填满容器并居中 */
|
|
26
28
|
fitView?: boolean;
|
|
27
29
|
fitViewPadding?: number;
|
|
@@ -35,7 +37,10 @@ type __VLS_Slots = {} & {
|
|
|
35
37
|
} & {
|
|
36
38
|
default?: (props: typeof __VLS_63) => any;
|
|
37
39
|
};
|
|
38
|
-
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
40
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
|
|
41
|
+
selectedNode: import("vue").ComputedRef<FlowNodeType | null>;
|
|
42
|
+
selectedNodes: import("vue").ComputedRef<FlowNodeType[]>;
|
|
43
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
39
44
|
"update:modelValue": (value: Flow) => any;
|
|
40
45
|
"edit-node": (node: FlowNodeType) => any;
|
|
41
46
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
@@ -214,6 +214,28 @@ const _useEChart = () => {
|
|
|
214
214
|
return merged;
|
|
215
215
|
});
|
|
216
216
|
};
|
|
217
|
+
const getCommonRadarOption = () => ({
|
|
218
|
+
radar: {
|
|
219
|
+
axisName: {
|
|
220
|
+
color: getNormedUiTextColor()
|
|
221
|
+
},
|
|
222
|
+
axisLine: {
|
|
223
|
+
lineStyle: {
|
|
224
|
+
color: getNormedUiBorderColor()
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
splitLine: {
|
|
228
|
+
lineStyle: {
|
|
229
|
+
color: getNormedUiBorderColor()
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
splitArea: {
|
|
233
|
+
areaStyle: {
|
|
234
|
+
color: ["transparent"]
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
});
|
|
217
239
|
const mergeOption = (option, config = {}) => {
|
|
218
240
|
const {
|
|
219
241
|
enableXAxis = true,
|
|
@@ -234,6 +256,14 @@ const _useEChart = () => {
|
|
|
234
256
|
const yAxisDefaults = getCommonYAxisOption(enableYAxis).yAxis;
|
|
235
257
|
merged.yAxis = merged.yAxis.map((axis) => defu(axis, yAxisDefaults));
|
|
236
258
|
}
|
|
259
|
+
if (merged.radar) {
|
|
260
|
+
const radarDefaults = getCommonRadarOption().radar;
|
|
261
|
+
if (Array.isArray(merged.radar)) {
|
|
262
|
+
merged.radar = merged.radar.map((r) => defu(r, radarDefaults));
|
|
263
|
+
} else {
|
|
264
|
+
merged.radar = defu(merged.radar, radarDefaults);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
237
267
|
if (merged.series && Array.isArray(merged.series)) {
|
|
238
268
|
merged.series = mergeSeries(merged.series);
|
|
239
269
|
}
|
package/package.json
CHANGED