Skip to content

Commit f0695b5

Browse files
committed
basic add child func w right click
2 parents 415c62c + 7d582c7 commit f0695b5

13 files changed

+146
-48
lines changed

quasar.conf.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,16 @@ module.exports = function (ctx) {
5858
'QTabPanel',
5959
'QFab',
6060
'QFabAction',
61-
'QMenu'
61+
'QMenu',
62+
'QUploader',
63+
'QEditor',
64+
'QCard',
65+
'QChip'
6266
],
6367

6468
directives: [
65-
'Ripple'
69+
'Ripple',
70+
'ClosePopup'
6671
],
6772

6873
// Quasar plugins

src/components/CodeSnippet.vue

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<template>
2+
<div class="snip">
3+
<q-editor
4+
v-model="editor"
5+
:definitions="{
6+
bold: {label: 'Bold', icon: null, tip: 'My bold tooltip'}
7+
}"
8+
/>
9+
</div>
10+
</template>
11+
12+
<script>
13+
export default {
14+
data () {
15+
return {
16+
editor: 'Here we are overriding the <b>bold</b> command to include a label instead of an icon and also changing its tooltip.'
17+
}
18+
}
19+
}
20+
</script>
21+
22+
<style>
23+
.snip{
24+
height: 150px;
25+
}
26+
</style>

src/components/ComponentDisplay.vue

Lines changed: 45 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
<template>
22
<div class="component-display">
3-
<!-- <context-menu ref="component-options">
4-
<context-menu-item :action="handleAddChild"><button>Add a Child</button></context-menu-item>
5-
<context-menu-item><button>Delete a Child</button></context-menu-item>
6-
</context-menu> -->
73
<VueDraggableResizable
84
class-name="component-box"
95
v-for="componentData in activeRouteArray"
@@ -18,43 +14,56 @@
1814
@dragging="onDrag"
1915
@resizing="onResize"
2016
@dblclick.native="onDoubleClick(componentData)"
21-
v-context-menu="'component-options'"
2217
>
2318
<h3>{{ componentData.componentName }}</h3>
2419
<q-menu context-menu>
2520
<q-list>
26-
<q-item clickable v-ripple @click="handleAddChild">
21+
<q-item clickable v-ripple v-close-popup @click="handleAddChild">
2722
<q-item-section>Add Children</q-item-section>
2823
<q-item-section avatar><q-icon color="primary" name="add"/></q-item-section>
2924
</q-item>
30-
<q-item clickable v-ripple>
25+
<q-item clickable v-ripple v-close-popup auto-close>
3126
<q-item-section>Delete Children</q-item-section>
3227
<q-item-section avatar><q-icon color="primary" name="delete"/></q-item-section>
3328
</q-item>
3429
</q-list>
3530
</q-menu>
3631
</VueDraggableResizable>
37-
<q-dialog id="select-child-modal" v-model="modalOpen">
38-
<ChildrenMultiselect />
39-
</q-dialog>
32+
<div>
33+
<q-dialog v-model="modalOpen">
34+
<q-select
35+
@input="handleSelect"
36+
id="dropdown"
37+
filled
38+
v-model="testModel"
39+
multiple
40+
:options="options"
41+
use-chips
42+
stack-label
43+
label="Select children"
44+
style="width: 250px"
45+
/>
46+
</q-dialog>
47+
</div>
4048
</div>
4149
</template>
4250
<script>
4351
import { mapState, mapActions } from 'vuex'
4452
import VueDraggableResizable from 'vue-draggable-resizable'
45-
import ChildrenMultiselect from '../components/ChildrenMultiselect'
53+
// import ChildrenMultiselect from '../components/ChildrenMultiselect'
4654
import 'vue-draggable-resizable/dist/VueDraggableResizable.css'
4755
4856
export default {
4957
name: 'ComponentDisplay',
5058
components: {
51-
VueDraggableResizable,
52-
ChildrenMultiselect
59+
VueDraggableResizable
5360
},
5461
data () {
5562
return {
5663
modalOpen: false,
57-
abilityToDelete: false
64+
abilityToDelete: false,
65+
testOptions: ['parent', 'child', 'grandchild'],
66+
testModel: []
5867
}
5968
},
6069
mounted () {
@@ -68,7 +77,7 @@ export default {
6877
})
6978
},
7079
computed: {
71-
...mapState(['routes', 'activeRoute', 'activeComponent', 'componentMap']),
80+
...mapState(['routes', 'activeRoute', 'activeComponent', 'componentMap', 'componentChildrenMultiselectValue']),
7281
// used in VueDraggableResizeable component
7382
activeRouteArray () {
7483
// console.log('active route array method', this.routes[this.activeRoute])
@@ -80,10 +89,21 @@ export default {
8089
return this.activeRouteArray.filter(componentData => {
8190
return componentData.componentName === this.activeComponent
8291
})[0]
92+
},
93+
options () {
94+
// PROBLEM: the objects on childrenmultiselectvalue are applied
95+
const routes = Object.keys(this.routes)
96+
const exceptions = new Set(['App', this.activeComponent, ...routes])
97+
return Object.keys(this.componentMap).filter(component => {
98+
if (!exceptions.has(component)) return component
99+
})
83100
}
84101
},
85102
methods: {
86-
...mapActions(['setActiveComponent']),
103+
...mapActions([
104+
'setActiveComponent',
105+
'updateComponentChildrenMultiselectValue',
106+
'updateActiveComponentChildrenValue']),
87107
onResize: function (x, y, width, height) {
88108
this.activeComponentData.x = x
89109
this.activeComponentData.y = y
@@ -108,6 +128,12 @@ export default {
108128
handleAddChild () {
109129
// render modal with childrenmultiselect in it
110130
this.modalOpen = true
131+
},
132+
handleSelect (value) {
133+
// if (this.modalOpen) this.updateActiveComponentChildrenValue(value)
134+
console.log('Multiselect: ', value)
135+
this.updateActiveComponentChildrenValue(value)
136+
// this.updateComponentChildrenMultiselectValue(value)
111137
}
112138
// @dblclick.native="onDoubleClick(componentData)"
113139
// onDoubleClick (compData) {
@@ -155,11 +181,10 @@ export default {
155181
156182
.component-box {
157183
color: white;
158-
border: 3px dashed rgb(227, 203, 71);
184+
border: 1px dashed rgb(227, 203, 71);
159185
background-color: rgba(186, 99, 99, 0.529);
160186
}
161-
162-
.select-child-modal {
163-
background-color: red;
187+
.active {
188+
background-color: rgba(57, 63, 84, 0.5);
164189
}
165190
</style>

src/components/CreateComponent.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import Icons from './Icons'
2727
import ParentMultiselect from '../components/ParentMultiselect'
2828
import { mapState, mapActions } from 'vuex'
29-
// import * as types from '../store/types.js'
3029
3130
export default {
3231
name: 'HomeSidebar',

src/components/Footer.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222

2323
<q-tab-panels v-model="tab" animated class="bg-primary text-white">
2424
<q-tab-panel name="code">
25-
<div class="text-h6">Code Snippet</div>Code Snippet Component Here
26-
<br />asdfadsfasdf
2725
</q-tab-panel>
2826

2927
<q-tab-panel name="tree">
@@ -40,10 +38,12 @@
4038

4139
<script>
4240
import Tree from './Tree'
41+
// import CodeSnippet from './CodeSnippet'
4342
4443
export default {
4544
components: {
4645
Tree
46+
// CodeSnippet
4747
},
4848
data () {
4949
return {

src/components/ParentMultiselect.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div id="parent-select">
33
<br />
44
<multiselect
5-
placeholder="Choose Parent (if applicable)"
5+
placeholder="Parent Component"
66
:multiple="false"
77
:close-on-select="true"
88
:options="options"
@@ -52,5 +52,9 @@ export default {
5252

5353
<style src="vue-multiselect/dist/vue-multiselect.min.css"></style>
5454
<style scoped>
55-
55+
#parent-select{
56+
height: 30px;
57+
margin: 0.75rem;
58+
width: 90%;
59+
}
5660
</style>

src/components/RouteDisplay.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
2-
<div class="route-display">
3-
<q-input
2+
<div>
3+
<q-input
44
@keyup.enter.native="handleEnterKeyPress"
55
standout="bg-teal text-white"
66
bottom-slots
@@ -10,6 +10,10 @@
1010
class="input-add"
1111
>
1212
</q-input>
13+
<!--<div class="route-display">-->
14+
<!--
15+
16+
-->
1317
<Routes></Routes>
1418
</div>
1519
</template>

src/components/Routes.vue

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
<template>
2-
<div class="route-view">
2+
<div>
3+
<!--<div class="route-view">-->
34
<a
45
:class="route === activeRoute ? 'panel-block is-active' : 'panel-block'"
56
v-for="route in Object.keys(routes)"
67
:key="route"
78
@click="handleClick(route)"
89
>
10+
<!--
911
<span class="panel-icon">
1012
<i class="fas fa-location-arrow" aria-hidden="true"></i>
1113
</span>
12-
{{ route }}
14+
-->
15+
<q-list bordered separator>
16+
<q-item clickable v-ripple>
17+
<q-item-section>{{route}}</q-item-section>
18+
19+
</q-item>
20+
21+
</q-list>
22+
1323
</a>
1424
</div>
25+
1526
</template>
1627

1728
<script>

src/components/Toolbar.vue

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<template>
2+
<div class="home-sidebar">
3+
<q-btn-group>
4+
<q-btn color="secondary" icon="timeline" />
5+
<q-btn color="secondary" icon="visibility" />
6+
<q-btn color="secondary" icon="update" />
7+
</q-btn-group>
8+
</div>
9+
</template>
10+
11+
<style>
12+
.home-sidebar {
13+
margin: 1rem;
14+
border-radius: 5px;
15+
}
16+
</style>

src/components/Tree.vue

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export default {
3434
},
3535
methods: {
3636
formatComponentMap (compMap) {
37-
console.log('\n Map : ', compMap, '\n')
3837
let result = []
3938
Object.values(compMap).forEach(compData => {
4039
result.push({
@@ -49,29 +48,16 @@ export default {
4948
const nodes = {}
5049
const formattedData = this.formatComponentMap(data)
5150
52-
// console.log('\n >>>> Formatted data <<<<');
53-
// console.log('FormattedData: ', formattedData, '\n');
54-
55-
// console.log('\n >>>> TRANSFORM TO TREE <<<< \n');
56-
5751
formattedData.forEach(component => {
5852
if (!nodes[component.name]) {
5953
nodes[component.name] = { name: component.name, children: [] }
6054
result = nodes
6155
}
62-
// console.log('CURRENT COMPONENT: ', component.name);
6356
component.children.forEach(child => {
64-
// if(typeof child === 'object') child = child.componentName;
6557
nodes[child] = { name: child, children: [] }
6658
nodes[component.name].children.push(nodes[child])
67-
// console.log('Adding child: ', typeof child, child);
68-
// console.log('\n');
6959
})
7060
})
71-
72-
console.log('\n >>>> RESULTS <<<< ')
73-
console.log(result)
74-
console.log('\n >>>> ______ <<<<')
7561
return result
7662
},
7763
@@ -96,7 +82,7 @@ export default {
9682
cursor: pointer;
9783
text-shadow: none !important;
9884
font-weight: bold;
99-
85+
fill: #FFF;
10086
/* none of these classes work
10187
color: white !important;
10288
background: white;

0 commit comments

Comments
 (0)