Skip to content

Commit 4f25baa

Browse files
committed
Added ParentMultiselect
1 parent 58ad7ec commit 4f25baa

File tree

8 files changed

+89
-3
lines changed

8 files changed

+89
-3
lines changed
-169 Bytes
Binary file not shown.
-169 Bytes
Binary file not shown.

build/Release/.binding 2.node.icloud

-162 Bytes
Binary file not shown.

build/Release/.binding.node.icloud

-160 Bytes
Binary file not shown.
-167 Bytes
Binary file not shown.

src/components/home_sidebar_items/ComponentTab/CreateComponent.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Description:
3434
@activeLayer="addNestedNoActive"
3535
/> -->
3636
</div>
37-
<!-- <ParentMultiselect v-if="activeComponent === ''"></ParentMultiselect> -->
37+
<ParentMultiselect v-if="activeComponent === ''"></ParentMultiselect>
3838
<br />
3939

4040
<q-btn
@@ -51,15 +51,15 @@ Description:
5151

5252
<script>
5353
// import Icons from '../Icons'
54-
// import ParentMultiselect from '../ParentMultiselect.vue'
54+
import ParentMultiselect from '../ParentMultiselect.vue'
5555
import { mapState, mapActions } from 'vuex'
5656
5757
5858
export default {
5959
name: 'HomeSidebar',
6060
components: {
6161
// Icons,
62-
// ParentMultiselect
62+
ParentMultiselect
6363
},
6464
computed: {
6565
...mapState([
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<!--
2+
Description:
3+
Displays multiselect dropdown for already existing components in CreateComponent
4+
Functionality includes: selects parent for created component
5+
-->
6+
7+
<template>
8+
<div id="parent-select">
9+
<br />
10+
<multiselect
11+
v-model="value"
12+
placeholder="Parent Component"
13+
:multiple="false"
14+
:close-on-select="true"
15+
:options="options"
16+
@input="selectParent"
17+
@open="resetActiveComponent"
18+
:max-height="90"
19+
:option-height="20"
20+
:searchable="true"
21+
>
22+
<!-- refactor slot syntax here -->
23+
<!-- <span slot='noResult'>No components found.</span> -->
24+
<span class='noResult'>
25+
<slot></slot>
26+
</span>
27+
</multiselect>
28+
</div>
29+
</template>
30+
31+
<script>
32+
import { mapState, mapActions } from 'vuex'
33+
import Multiselect from 'vue-multiselect'
34+
35+
export default {
36+
name: 'ParentMultiselect',
37+
components: {
38+
Multiselect
39+
},
40+
data () {
41+
return { value: '' }
42+
},
43+
computed: {
44+
...mapState([
45+
'routes',
46+
'componentMap',
47+
'activeComponent',
48+
'activeRoute',
49+
'routes'
50+
]),
51+
options () {
52+
return this.routes[this.activeRoute].map(component => component.componentName)
53+
}
54+
},
55+
methods: {
56+
...mapActions(['parentSelected', 'setActiveComponent']),
57+
selectParent (value) {
58+
this.parentSelected(value)
59+
},
60+
// when multiselect is opened activeComponent is deselected to allow for parentSelected action
61+
resetActiveComponent () {
62+
if (this.activeComponent !== '') {
63+
this.setActiveComponent('')
64+
}
65+
}
66+
},
67+
// clears out value in mutiselect on creation of component
68+
watch: {
69+
componentMap: {
70+
handler () {
71+
// console.log('componentMap has changed')
72+
this.value = ''
73+
}
74+
}
75+
}
76+
}
77+
</script>
78+
79+
<style src="vue-multiselect/dist/vue-multiselect.min.css"></style>
80+
<style scoped>
81+
#parent-select {
82+
height: 30px;
83+
margin: 0.75rem;
84+
width: 90%;
85+
}
86+
</style>

test/jest/.jest.setup.js.icloud

-161 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)