diff --git a/package-lock.json b/package-lock.json
index 6daad32..154a29d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -12,6 +12,7 @@
"@vue-flow/core": "^1.48.2",
"axios": "^1.3.6",
"crypto-js": "^4.2.0",
+ "dagre": "^0.8.5",
"element-plus": "^2.13.2",
"gsap": "^3.13.0",
"markdown-it": "^14.1.0",
@@ -2401,6 +2402,16 @@
"node": ">=12"
}
},
+ "node_modules/dagre": {
+ "version": "0.8.5",
+ "resolved": "https://registry.npmmirror.com/dagre/-/dagre-0.8.5.tgz",
+ "integrity": "sha512-/aTqmnRta7x7MCCpExk7HQL2O4owCT2h8NT//9I1OQ9vt29Pa0BzSAkR5lwFUcQ7491yVi/3CXU9jQ5o0Mn2Sw==",
+ "license": "MIT",
+ "dependencies": {
+ "graphlib": "^2.1.8",
+ "lodash": "^4.17.15"
+ }
+ },
"node_modules/data-view-buffer": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/data-view-buffer/-/data-view-buffer-1.0.2.tgz",
@@ -3680,6 +3691,15 @@
"integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==",
"dev": true
},
+ "node_modules/graphlib": {
+ "version": "2.1.8",
+ "resolved": "https://registry.npmmirror.com/graphlib/-/graphlib-2.1.8.tgz",
+ "integrity": "sha512-jcLLfkpoVGmH7/InMC/1hIvOPSUh38oJtGhvrOFGzioE1DZ+0YW16RgmOJhHiuWTvGiJQ9Z1Ik43JvkRPRvE+A==",
+ "license": "MIT",
+ "dependencies": {
+ "lodash": "^4.17.15"
+ }
+ },
"node_modules/gsap": {
"version": "3.13.0",
"resolved": "https://registry.npmmirror.com/gsap/-/gsap-3.13.0.tgz",
@@ -10373,6 +10393,15 @@
"d3-transition": "2 - 3"
}
},
+ "dagre": {
+ "version": "0.8.5",
+ "resolved": "https://registry.npmmirror.com/dagre/-/dagre-0.8.5.tgz",
+ "integrity": "sha512-/aTqmnRta7x7MCCpExk7HQL2O4owCT2h8NT//9I1OQ9vt29Pa0BzSAkR5lwFUcQ7491yVi/3CXU9jQ5o0Mn2Sw==",
+ "requires": {
+ "graphlib": "^2.1.8",
+ "lodash": "^4.17.15"
+ }
+ },
"data-view-buffer": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/data-view-buffer/-/data-view-buffer-1.0.2.tgz",
@@ -11359,6 +11388,14 @@
"integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==",
"dev": true
},
+ "graphlib": {
+ "version": "2.1.8",
+ "resolved": "https://registry.npmmirror.com/graphlib/-/graphlib-2.1.8.tgz",
+ "integrity": "sha512-jcLLfkpoVGmH7/InMC/1hIvOPSUh38oJtGhvrOFGzioE1DZ+0YW16RgmOJhHiuWTvGiJQ9Z1Ik43JvkRPRvE+A==",
+ "requires": {
+ "lodash": "^4.17.15"
+ }
+ },
"gsap": {
"version": "3.13.0",
"resolved": "https://registry.npmmirror.com/gsap/-/gsap-3.13.0.tgz",
diff --git a/package.json b/package.json
index 850d9a5..adefe3f 100644
--- a/package.json
+++ b/package.json
@@ -16,6 +16,7 @@
"@vue-flow/core": "^1.48.2",
"axios": "^1.3.6",
"crypto-js": "^4.2.0",
+ "dagre": "^0.8.5",
"element-plus": "^2.13.2",
"gsap": "^3.13.0",
"markdown-it": "^14.1.0",
diff --git a/src/assets/css/style.css b/src/assets/css/style.css
index d39654a..7eb5c5b 100644
--- a/src/assets/css/style.css
+++ b/src/assets/css/style.css
@@ -1,3 +1,18 @@
+<<<<<<< HEAD
+=======
+body,
+html,
+p,
+ul,
+ol,
+li {
+ margin: 0;
+ padding: 0;
+}
+* {
+ box-sizing: border-box;
+}
+>>>>>>> 92ef11cd6d1f41ef95ef0cc8190c4f45f931f003
html,
body,
#app {
@@ -13,8 +28,11 @@ body,
transform: rotate(360deg);
}
}
+<<<<<<< HEAD
.background-pink {
background-color: #f8f7f5;
background-image: url('@/assets/images/home-bg.png');
background-size: 100% 100%;
}
+=======
+>>>>>>> 92ef11cd6d1f41ef95ef0cc8190c4f45f931f003
diff --git a/src/assets/css/style.less b/src/assets/css/style.less
index 759e77a..9b967c2 100644
--- a/src/assets/css/style.less
+++ b/src/assets/css/style.less
@@ -1,3 +1,20 @@
+body,
+html,
+div,
+ul,
+li,
+h1,
+h2,
+h3,
+p {
+ margin: 0;
+ padding: 0;
+}
+
+*{
+ box-sizing: border-box;
+}
+
html,
body,
#app {
diff --git a/src/views/home/versionTree/index.vue b/src/views/home/versionTree/index.vue
index 49c1059..c48983b 100644
--- a/src/views/home/versionTree/index.vue
+++ b/src/views/home/versionTree/index.vue
@@ -14,7 +14,7 @@ const props = defineProps({
})
//const emit = defineEmits([
//])
-const treeState = ref(false)//
+const treeState = ref(true)//
const openTree = ()=>{
treeState.value = !treeState.value
@@ -65,6 +65,13 @@ const {} = toRefs(data);
\ No newline at end of file
diff --git a/src/views/home/versionTree/tree/view2/primaryNode.vue b/src/views/home/versionTree/tree/view2/primaryNode.vue
new file mode 100644
index 0000000..e6003ac
--- /dev/null
+++ b/src/views/home/versionTree/tree/view2/primaryNode.vue
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
{{ props.data.id }}
+
+
+
+
diff --git a/src/views/home/versionTree/tree/view2/secondaryNode.vue b/src/views/home/versionTree/tree/view2/secondaryNode.vue
new file mode 100644
index 0000000..0833c83
--- /dev/null
+++ b/src/views/home/versionTree/tree/view2/secondaryNode.vue
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
{{ props.data.id }}
+
+
+
+
diff --git a/src/views/home/versionTree/tree/view2/speciaiNode.vue b/src/views/home/versionTree/tree/view2/speciaiNode.vue
deleted file mode 100644
index cafd797..0000000
--- a/src/views/home/versionTree/tree/view2/speciaiNode.vue
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-
-
-
-
-
diff --git a/src/views/home/versionTree/tree/view2/tools/tools.js b/src/views/home/versionTree/tree/view2/tools/tools.js
new file mode 100644
index 0000000..d28814d
--- /dev/null
+++ b/src/views/home/versionTree/tree/view2/tools/tools.js
@@ -0,0 +1,57 @@
+// import dagre from '@dagrejs/dagre'
+import dagre from 'dagre'
+import { Position, useVueFlow } from '@vue-flow/core'
+import { ref } from 'vue'
+
+/**
+ * Composable to run the layout algorithm on the graph.
+ * It uses the `dagre` library to calculate the layout of the nodes and edges.
+ */
+export function useLayout() {
+ const { findNode } = useVueFlow()
+
+ const graph = ref(new dagre.graphlib.Graph())
+
+ const previousDirection = ref('LR')
+
+ function layout(nodes, edges, direction) {
+ // we create a new graph instance, in case some nodes/edges were removed, otherwise dagre would act as if they were still there
+ const dagreGraph = new dagre.graphlib.Graph()
+
+ graph.value = dagreGraph
+
+ dagreGraph.setDefaultEdgeLabel(() => ({}))
+
+ const isHorizontal = direction === 'LR'
+ dagreGraph.setGraph({ rankdir: direction })
+
+ previousDirection.value = direction
+
+ for (const node of nodes) {
+ // if you need width+height of nodes for your layout, you can use the dimensions property of the internal node (`GraphNode` type)
+ const graphNode = findNode(node.id)
+
+ dagreGraph.setNode(node.id, { width: graphNode.dimensions.width || 150, height: graphNode.dimensions.height || 50 })
+ }
+
+ for (const edge of edges) {
+ dagreGraph.setEdge(edge.source, edge.target)
+ }
+
+ dagre.layout(dagreGraph)
+
+ // set nodes with updated positions
+ return nodes.map((node) => {
+ const nodeWithPosition = dagreGraph.node(node.id)
+
+ return {
+ ...node,
+ targetPosition: isHorizontal ? Position.Left : Position.Top,
+ sourcePosition: isHorizontal ? Position.Right : Position.Bottom,
+ position: { x: nodeWithPosition.x, y: nodeWithPosition.y },
+ }
+ })
+ }
+
+ return { graph, layout, previousDirection }
+}
diff --git a/src/views/home/versionTree/tree/view2/tools/versionsData.js b/src/views/home/versionTree/tree/view2/tools/versionsData.js
new file mode 100644
index 0000000..63d043f
--- /dev/null
+++ b/src/views/home/versionTree/tree/view2/tools/versionsData.js
@@ -0,0 +1,61 @@
+export const versionsList = [
+ {
+ id: '1',
+ name:'V1',
+ child:[
+ {
+ id: '1-1',
+ name:'V1-1',
+ child:[
+ {
+ id: '1-1-1',
+ name:'V1-1-1',
+ }
+ ]
+ },{
+ id: '1-2',
+ name:'V1-2',
+ child:[
+ {
+ id: '1-2-1',
+ name:'V1-2-1',
+ },{
+ id: '1-2-2',
+ name:'V1-2-2',
+ }
+ ]
+ },{
+ id: '1-2',
+ name:'V1-2',
+ child:[
+ {
+ id: '1-2-1',
+ name:'V1-2-1',
+ child:[
+ {
+ id: '1-2-1-1',
+ name:'V1-2-1-1',
+ }
+ ]
+ },{
+ id: '1-2-2',
+ name:'V1-2-2',
+ child:[
+ {
+ id: '1-2-2-1',
+ name:'V1-2-2-1',
+ },{
+ id: '1-2-2-2',
+ name:'V1-2-2-2',
+ }
+ ]
+ },
+ ]
+ },{
+ id: '1-3',
+ name:'V1-3',
+ }
+ ]
+ }
+ ]
+
\ No newline at end of file