@vunk/graph 0.0.1 → 0.0.2
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PropType } from 'vue';
|
|
2
|
-
import type { DefaultOptions } from './types';
|
|
2
|
+
import type { DefaultOptions, LoadEvent } from './types';
|
|
3
3
|
export declare const props: {
|
|
4
4
|
/**
|
|
5
5
|
* Sigma.js 的初始化配置项
|
|
@@ -9,4 +9,6 @@ export declare const props: {
|
|
|
9
9
|
default: () => {};
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
|
-
export declare const emits: {
|
|
12
|
+
export declare const emits: {
|
|
13
|
+
load: (e: LoadEvent) => LoadEvent;
|
|
14
|
+
};
|
|
@@ -10,8 +10,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
10
10
|
type: import("vue").PropType<import("./types").DefaultOptions>;
|
|
11
11
|
default: () => {};
|
|
12
12
|
};
|
|
13
|
-
}>> & Readonly<{
|
|
14
|
-
|
|
13
|
+
}>> & Readonly<{
|
|
14
|
+
onLoad?: ((e: import("./types").LoadEvent) => any) | undefined;
|
|
15
|
+
}> & {}>;
|
|
16
|
+
emit: (event: "load", e: import("./types").LoadEvent) => void;
|
|
15
17
|
elRef: Ref<HTMLDivElement, HTMLDivElement>;
|
|
16
18
|
graph: import("graphology").default<import("graphology-types").Attributes, import("graphology-types").Attributes, import("graphology-types").Attributes>;
|
|
17
19
|
ready: Ref<boolean, boolean>;
|
|
@@ -63,12 +65,16 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
63
65
|
[key: string]: any;
|
|
64
66
|
}>[][], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
65
67
|
}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
66
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
68
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
69
|
+
load: (e: import("./types").LoadEvent) => import("./types").LoadEvent;
|
|
70
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
67
71
|
defaultOptions: {
|
|
68
72
|
type: import("vue").PropType<import("./types").DefaultOptions>;
|
|
69
73
|
default: () => {};
|
|
70
74
|
};
|
|
71
|
-
}>> & Readonly<{
|
|
75
|
+
}>> & Readonly<{
|
|
76
|
+
onLoad?: ((e: import("./types").LoadEvent) => any) | undefined;
|
|
77
|
+
}>, {
|
|
72
78
|
defaultOptions: Partial<import("sigma/dist/declarations/src/settings").Settings<import("graphology-types").Attributes, import("graphology-types").Attributes, import("graphology-types").Attributes>> | undefined;
|
|
73
79
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
74
80
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent, shallowRef, computed, onMounted, onBeforeUnmount, createBlock, openBlock, unref, withCtx, createElementVNode, renderSlot, resolveComponent, withDirectives, createVNode, resolveDynamicComponent, vShow } from 'vue';
|
|
2
|
-
import { useSigma } from '@vunk/graph/composables';
|
|
1
|
+
import { defineComponent, shallowRef, ref, computed, onMounted, onBeforeUnmount, createBlock, openBlock, unref, withCtx, createElementVNode, mergeProps, renderSlot, resolveComponent, withDirectives, createVNode, resolveDynamicComponent, vShow } from 'vue';
|
|
2
|
+
import { useSigma, useGraph } from '@vunk/graph/composables';
|
|
3
3
|
import { createGlobalRenderer } from '@vunk/core/components/global-renderer';
|
|
4
4
|
import { VkGraphViewUi } from '@vunk/graph/components/graph-view-ui';
|
|
5
5
|
import { _ as _export_sfc } from '../_plugin-vue_export-helper.mjs';
|
|
@@ -26,8 +26,11 @@ const emits = {
|
|
|
26
26
|
"update:modelValue": null
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
const _hoisted_1$1 = { class: "vkg-popup" };
|
|
30
29
|
var _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
30
|
+
...{
|
|
31
|
+
name: "VkPopup",
|
|
32
|
+
inheritAttrs: false
|
|
33
|
+
},
|
|
31
34
|
__name: "index",
|
|
32
35
|
props: props,
|
|
33
36
|
emits,
|
|
@@ -35,18 +38,25 @@ var _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
35
38
|
const props = __props;
|
|
36
39
|
const emit = __emit;
|
|
37
40
|
const sigma = useSigma();
|
|
41
|
+
const graph = useGraph();
|
|
38
42
|
const coordinates = shallowRef([0, 0]);
|
|
43
|
+
const currentNode = ref("");
|
|
44
|
+
const attributes = ref({});
|
|
39
45
|
const state = computed(() => ({
|
|
46
|
+
node: currentNode.value,
|
|
47
|
+
attributes: attributes.value,
|
|
40
48
|
visible: props.modelValue,
|
|
41
49
|
coordinates: coordinates.value
|
|
42
50
|
}));
|
|
43
51
|
function onClickNode(e) {
|
|
44
52
|
const { node } = e;
|
|
45
|
-
const
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
const attrs = graph.getNodeAttributes(node);
|
|
54
|
+
if (typeof attrs.x !== "number" || typeof attrs.y !== "number")
|
|
55
|
+
return;
|
|
56
|
+
currentNode.value = node;
|
|
57
|
+
attributes.value = attrs;
|
|
58
|
+
coordinates.value = [attrs.x, attrs.y];
|
|
59
|
+
emit("update:modelValue", true);
|
|
50
60
|
}
|
|
51
61
|
function onClickStage() {
|
|
52
62
|
emit("update:modelValue", false);
|
|
@@ -65,9 +75,20 @@ var _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
65
75
|
data: state.value
|
|
66
76
|
}, {
|
|
67
77
|
default: withCtx(() => [
|
|
68
|
-
createElementVNode(
|
|
69
|
-
|
|
70
|
-
|
|
78
|
+
createElementVNode(
|
|
79
|
+
"div",
|
|
80
|
+
mergeProps({ class: "vkg-popup" }, _ctx.$attrs),
|
|
81
|
+
[
|
|
82
|
+
renderSlot(_ctx.$slots, "default", {
|
|
83
|
+
node: state.value.node,
|
|
84
|
+
attributes: state.value.attributes,
|
|
85
|
+
coordinates: state.value.coordinates,
|
|
86
|
+
visible: state.value.visible
|
|
87
|
+
})
|
|
88
|
+
],
|
|
89
|
+
16
|
|
90
|
+
/* FULL_PROPS */
|
|
91
|
+
)
|
|
71
92
|
]),
|
|
72
93
|
_: 3
|
|
73
94
|
/* FORWARDED */
|
|
@@ -22,8 +22,13 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
22
22
|
}> & {}>;
|
|
23
23
|
emit: (event: "update:modelValue", ...args: any[]) => void;
|
|
24
24
|
sigma: import("sigma").default<import("graphology-types").Attributes, import("graphology-types").Attributes, import("graphology-types").Attributes>;
|
|
25
|
+
graph: import("graphology").default<import("graphology-types").Attributes, import("graphology-types").Attributes, import("graphology-types").Attributes>;
|
|
25
26
|
coordinates: import("vue").ShallowRef<number[], number[]>;
|
|
27
|
+
currentNode: import("vue").Ref<string, string>;
|
|
28
|
+
attributes: import("vue").Ref<{}, {}>;
|
|
26
29
|
state: import("vue").ComputedRef<{
|
|
30
|
+
node: string;
|
|
31
|
+
attributes: {};
|
|
27
32
|
visible: boolean;
|
|
28
33
|
coordinates: number[];
|
|
29
34
|
}>;
|