2020-09-03 23:02:28 +02:00
|
|
|
<template>
|
|
|
|
<div class="treenode">
|
|
|
|
<button v-on:click="debugShow = !debugShow">Ladící data</button>
|
|
|
|
<div v-if="debugShow">
|
|
|
|
<pre>{{ item.node.polymorphic_ctype.model }}</pre>
|
|
|
|
<pre>{{ item }}</pre>
|
|
|
|
</div>
|
|
|
|
<component :is='item.node.polymorphic_ctype.model' :item='item'></component>
|
|
|
|
<div v-if="item.children.length === 0">
|
|
|
|
<div v-if="item.appendable_children.length > 0">
|
2020-09-03 23:09:30 +02:00
|
|
|
<b>Vložit jako syna</b>
|
2020-09-05 22:30:45 +02:00
|
|
|
<addnewnode :types="item.appendable_siblings" where="syn" />
|
2020-09-03 23:02:28 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-09-05 06:57:54 +02:00
|
|
|
<div v-if="item.children.length > 0 && item.children[0].appendable_siblings.length > 0">
|
|
|
|
<b>Vložit před</b>
|
2020-09-05 22:30:45 +02:00
|
|
|
<addnewnode :types="item.children[0].appendable_siblings" where="pred" />
|
2020-09-05 06:57:54 +02:00
|
|
|
</div>
|
2020-09-03 23:02:28 +02:00
|
|
|
|
|
|
|
<ul>
|
2020-09-05 06:57:54 +02:00
|
|
|
<li v-for="(chld, index) in item.children" v-bind:key="chld.nazev" >
|
2020-09-03 23:02:28 +02:00
|
|
|
<TreeNode :item="chld">
|
|
|
|
</TreeNode>
|
2020-09-05 06:57:54 +02:00
|
|
|
<div v-if="chld.appendable_siblings.length > 0">
|
|
|
|
<b v-if="index < (item.children.length - 1)">Vložit mezi</b>
|
|
|
|
<b v-else>Vložit za</b>
|
2020-09-05 22:30:45 +02:00
|
|
|
<addnewnode :types="chld.appendable_siblings" where="za" />
|
2020-09-05 06:57:54 +02:00
|
|
|
</div>
|
2020-09-03 23:02:28 +02:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
import rocniknode from './RocnikNode.vue'
|
|
|
|
import cislonode from './CisloNode.vue'
|
|
|
|
import temavcislenode from './TemaVCisleNode.vue'
|
|
|
|
import castnode from './CastNode.vue'
|
|
|
|
import textnode from './TextNode.vue'
|
|
|
|
import ulohazadaninode from './UlohaZadaniNode.vue'
|
|
|
|
import ulohavzoraknode from './UlohaVzorakNode.vue'
|
2020-09-05 22:30:45 +02:00
|
|
|
import addnewnode from './AddNewNode.vue'
|
2020-09-03 23:02:28 +02:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'TreeNode',
|
|
|
|
components: {
|
|
|
|
rocniknode,
|
|
|
|
cislonode,
|
|
|
|
temavcislenode,
|
|
|
|
castnode,
|
|
|
|
textnode,
|
|
|
|
ulohazadaninode,
|
|
|
|
ulohavzoraknode,
|
2020-09-05 22:30:45 +02:00
|
|
|
addnewnode
|
2020-09-03 23:02:28 +02:00
|
|
|
},
|
|
|
|
data: () => ({
|
|
|
|
debugShow: false,
|
|
|
|
}),
|
|
|
|
props: {
|
|
|
|
item: Object
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
|
|
|
<style scoped>
|
|
|
|
h3 {
|
|
|
|
margin: 40px 0 0;
|
|
|
|
}
|
|
|
|
ul {
|
|
|
|
/* list-style-type: none;*/
|
|
|
|
padding: 0;
|
|
|
|
}
|
|
|
|
li {
|
|
|
|
/*display: inline-block;*/
|
|
|
|
margin: 0 10px;
|
|
|
|
}
|
|
|
|
a {
|
|
|
|
color: #42b983;
|
|
|
|
}
|
2020-09-05 06:57:54 +02:00
|
|
|
|
|
|
|
.treenode {
|
|
|
|
border: 1px solid;
|
|
|
|
border-color: "black";
|
|
|
|
margin: 5px;
|
|
|
|
}
|
2020-09-03 23:02:28 +02:00
|
|
|
</style>
|