@@ -6,7 +6,7 @@ Description:
6
6
7
7
<template >
8
8
<div class =" input-container" >
9
- <q-input
9
+ <!-- < q-input
10
10
standout="bg-secondary text-white"
11
11
bottom-slots
12
12
v-model="text"
@@ -17,7 +17,7 @@ Description:
17
17
<template v-slot:append>
18
18
<q-btn round dense flat icon="add" />
19
19
</template>
20
- </q-input >
20
+ </q-input> -->
21
21
<q-input
22
22
standout =" bg-secondary text-white"
23
23
bottom-slots
@@ -27,26 +27,120 @@ Description:
27
27
class =" input-add"
28
28
>
29
29
<template v-slot :append >
30
- <q-btn round dense flat icon =" add" />
30
+ <q-btn
31
+ round dense flat icon =" add"
32
+ @click =" createNewAction(text)"
33
+ />
31
34
</template >
32
35
</q-input >
33
- <q-input
36
+ <!-- < q-input
34
37
standout="bg-secondary text-white"
35
38
bottom-slots
36
39
v-model="text"
37
- label =" Add Mutation "
40
+ label="Select Action "
38
41
dense
39
42
class="input-add"
40
43
>
41
44
<template v-slot:append>
42
45
<q-btn round dense flat icon="add" />
43
46
</template>
44
- </q-input >
47
+ </q-input> -->
48
+ <template >
49
+ <div id =" action-select" >
50
+ <br />
51
+ <multiselect
52
+ v-model =" value"
53
+ placeholder =" Select Action"
54
+ :multiple =" true"
55
+ :close-on-select =" false"
56
+ :options =" options"
57
+ @input =" selectAction"
58
+ :max-height =" 90"
59
+ :option-height =" 20"
60
+ :searchable =" true"
61
+ >
62
+ <span slot =" noResult" >No components found.</span >
63
+ </multiselect >
64
+ </div >
65
+ </template >
45
66
</div >
46
67
</template >
47
68
48
- <style lang="stylus" scoped>
49
- .input-add {
50
- margin : 0em 1em 0em 1em ;
69
+ <script >
70
+ import { mapState , mapActions } from ' vuex'
71
+ import Multiselect from ' vue-multiselect'
72
+
73
+ export default {
74
+ name: ' VuexForm' ,
75
+ components: {
76
+ Multiselect
77
+ },
78
+ data () {
79
+ return {
80
+ text: " " ,
81
+ value: " "
82
+ }
83
+ },
84
+ computed: {
85
+ ... mapState ([
86
+ ' routes' ,
87
+ ' componentMap' ,
88
+ ' activeComponent' ,
89
+ ' activeRoute' ,
90
+ ' routes' ,
91
+ ' userActions'
92
+ ]),
93
+ options (){
94
+ return [" a" , " b" , " c" ];
95
+ }
96
+ },
97
+ methods: {
98
+ ... mapActions ([' setActiveComponent' , ' createAction' , ' addActionSelected' ]),
99
+ selectAction (value ) {
100
+ this .addActionSelected (value)
101
+ },
102
+ createNewAction (text ) {
103
+ console .log (' text:' , text);
104
+ if (! this .$store .state .userActions .includes (text)) {
105
+ this .createAction (text);
106
+ console .log (' userActions' , this .$store .state .userActions );
107
+ console .log (' userActionArray' , this .userActions );
108
+ this .text = " "
109
+ }
110
+ },
111
+ // when multiselect is opened activeComponent is deselected to allow for parentSelected action
112
+ resetActiveComponent () {
113
+ if (this .activeComponent !== ' ' ) {
114
+ this .setActiveComponent (' ' )
115
+ }
116
+ }
117
+ },
118
+ // clears out value in mutiselect on creation of component
119
+ watch: {
120
+ componentMap: {
121
+ handler () {
122
+ // console.log('componentMap has changed')
123
+ this .value = ' '
124
+ }
125
+ }
126
+ }
51
127
}
128
+ </script >
129
+
130
+ <style src="vue-multiselect/dist/vue-multiselect.min .css "></style >
131
+ <style scoped>
132
+ #parent-select {
133
+ height : 30px ;
134
+ margin : 0.75rem ;
135
+ width : 90% ;
136
+ }
137
+ </style >
138
+
139
+
140
+ </script >
141
+
142
+
143
+ < style lang= " stylus" scoped>
144
+ .input - add
145
+ margin 0 1em
52
146
< / style>
0 commit comments