Skip to content

Commit 383a44c

Browse files
committed
right click popup for choosing child, not functional yet
2 parents 0eb9a75 + 6e68587 commit 383a44c

File tree

8 files changed

+1077
-11
lines changed

8 files changed

+1077
-11
lines changed

package-lock.json

Lines changed: 970 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,19 @@
1717
"mousetrap": "^1.6.3",
1818
"quasar": "^1.0.0",
1919
"vue-custom-context-menu": "^3.0.1",
20+
"vue-drag-resize": "^1.3.2",
2021
"vue-draggable-resizable": "^2.0.0-rc2",
2122
"vue-multiselect": "^2.1.6",
22-
"vued3tree": "^3.7.1"
23+
"vued3tree": "^3.7.1",
24+
"vuex": "^3.1.1"
2325
},
2426
"devDependencies": {
2527
"@quasar/app": "^1.0.0",
2628
"@vue/eslint-config-standard": "^4.0.0",
2729
"babel-eslint": "^10.0.1",
2830
"devtron": "^1.4.0",
2931
"electron": "^5.0.6",
32+
"electron-builder": "^20.44.4",
3033
"electron-debug": "^3.0.1",
3134
"electron-devtools-installer": "^2.2.4",
3235
"eslint": "^5.10.0",

quasar.conf.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ module.exports = function (ctx) {
5252
'QTabs',
5353
'QTab',
5454
'QRouteTab',
55-
'QTabPanels'
55+
'QTabPanels',
56+
'QDialog',
57+
'QSelect'
5658
],
5759

5860
directives: [
@@ -147,7 +149,7 @@ module.exports = function (ctx) {
147149
},
148150

149151
electron: {
150-
// bundler: 'builder', // or 'packager'
152+
bundler: 'builder', // or 'packager'
151153

152154
extendWebpack (cfg) {
153155
// do something with Electron main process Webpack cfg
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<template>
2+
<div id="child-select" style="min-width: 500px; min-height: 500px;">
3+
<br />
4+
<multiselect
5+
placeholder="Select child components"
6+
:multiple="true"
7+
:close-on-select="false"
8+
:options="options"
9+
:value="componentChildrenMultiselectValue"
10+
@input="handleSelect"
11+
:max-height="150"
12+
:option-height="20"
13+
:searchable="false"
14+
></multiselect>
15+
<!-- <q-select
16+
:options="options"
17+
label="Select children"
18+
multiple
19+
/> -->
20+
</div>
21+
</template>
22+
23+
<script>
24+
import { mapState, mapActions } from 'vuex'
25+
import Multiselect from 'vue-multiselect'
26+
27+
export default {
28+
components: {
29+
Multiselect
30+
},
31+
computed: {
32+
...mapState([
33+
'routes',
34+
// comes from store/state/index.js
35+
'componentMap',
36+
'activeComponent',
37+
'componentChildrenMultiselectValue',
38+
'modalOpen'
39+
]),
40+
options () {
41+
const routes = Object.keys(this.routes)
42+
const exceptions = new Set(['App', this.activeComponent, ...routes])
43+
console.log('exceptions', exceptions)
44+
return Object.keys(this.componentMap).filter(component => {
45+
if (!exceptions.has(component)) return component
46+
})
47+
}
48+
},
49+
methods: {
50+
...mapActions([
51+
'updateComponentChildrenMultiselectValue',
52+
'updateActiveComponentChildrenValue'
53+
]),
54+
//
55+
handleSelect (value) {
56+
// if (this.modalOpen) this.updateActiveComponentChildrenValue(value)
57+
console.log('Multiselect: ', value)
58+
this.updateActiveComponentChildrenValue(value)
59+
this.updateComponentChildrenMultiselectValue(value)
60+
}
61+
}
62+
}
63+
</script>
64+
65+
<!-- New step!
66+
Add Multiselect CSS. Can be added as a static asset or inside a component. -->
67+
<style src="vue-multiselect/dist/vue-multiselect.min.css"></style>
68+
<style scoped>
69+
/* your styles */
70+
</style>

src/components/ComponentDisplay.vue

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<template>
22
<div class="component-display">
33
<context-menu ref="component-options">
4-
<context-menu-item>Add a Child</context-menu-item>
4+
<context-menu-item :action="handleAddChild">Add a Child</context-menu-item>
5+
<context-menu-item><button>Delete a Child</button></context-menu-item>
56
</context-menu>
67
<VueDraggableResizable
78
class-name="component-box"
@@ -17,25 +18,29 @@
1718
@dragging="onDrag"
1819
@resizing="onResize"
1920
@dblclick.native="onDoubleClick(componentData)"
20-
@contextmenu.native.prevent="'component-options'"
21+
v-context-menu="'component-options'"
2122
>
2223
<h3>{{ componentData.componentName }}</h3>
2324
</VueDraggableResizable>
25+
<q-dialog v-model="modalOpen" style="width: 700px">
26+
<ChildrenMultiselect />
27+
</q-dialog>
2428
</div>
2529
</template>
2630
<script>
2731
import { mapState, mapActions } from 'vuex'
2832
import VueDraggableResizable from 'vue-draggable-resizable'
29-
import VCCM from 'vue-custom-context-menu'
33+
import ChildrenMultiselect from '../components/ChildrenMultiselect'
3034
3135
export default {
3236
name: 'ComponentDisplay',
3337
components: {
3438
VueDraggableResizable,
35-
VCCM,
39+
ChildrenMultiselect
3640
},
3741
data () {
3842
return {
43+
modalOpen: false,
3944
abilityToDelete: false
4045
}
4146
},
@@ -86,8 +91,9 @@ export default {
8691
this.setActiveComponent(compData.componentName)
8792
this.activeComponentData.isActive = true
8893
},
89-
onRightClick () {
90-
alert('Holy fucc, u right clicc')
94+
handleAddChild () {
95+
// render modal with childrenmultiselect in it
96+
this.modalOpen = true
9197
}
9298
}
9399
}

src/components/FooterTabView.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
<script>
3737
export default {
38+
name: 'FooterTabView.vue',
3839
data () {
3940
return {
4041
tab: 'tree'

src/components/TopMenuBar.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,17 @@
8787
</q-bar>
8888
</div>
8989
</template>
90+
91+
<script>
92+
export default {
93+
name: 'TopMenuBar',
94+
components: {
95+
QMenu,
96+
QItem,
97+
QSeparator,
98+
QItemSection,
99+
QList,
100+
QBtn
101+
}
102+
}
103+
</script>

src/router/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import Vue from 'vue'
22
import VueRouter from 'vue-router'
3+
import VCCM from 'vue-custom-context-menu'
34

45
import routes from './routes'
56

67
Vue.use(VueRouter)
8+
Vue.use(VCCM)
79

810
/*
911
* If not building with SSR mode, you can

0 commit comments

Comments
 (0)