60
60
</div >
61
61
</template >
62
62
<script >
63
- import { mapState , mapActions } from " vuex" ;
64
- import VueDraggableResizable from " vue-draggable-resizable" ;
63
+ import { mapState , mapActions } from ' vuex'
64
+ import VueDraggableResizable from ' vue-draggable-resizable'
65
65
// import ChildrenMultiselect from '../components/ChildrenMultiselect'
66
- import " vue-draggable-resizable/dist/VueDraggableResizable.css" ;
66
+ import ' vue-draggable-resizable/dist/VueDraggableResizable.css'
67
67
68
68
export default {
69
- name: " ComponentDisplay" ,
69
+ name: ' ComponentDisplay' ,
70
70
components: {
71
71
VueDraggableResizable
72
72
},
73
- data () {
73
+ data () {
74
74
return {
75
75
modalOpen: false ,
76
76
abilityToDelete: false ,
77
- testOptions: [" parent" , " child" , " grandchild" ],
77
+ testOptions: [' parent' , ' child' , ' grandchild' ],
78
78
testModel: [],
79
79
mockImg: false
80
- };
80
+ }
81
81
},
82
- mounted () {
82
+ mounted () {
83
83
// when component is mounted add ability to delete
84
- window .addEventListener (" keyup" , event => {
85
- if (event .key === " Backspace" ) {
84
+ window .addEventListener (' keyup' , event => {
85
+ if (event .key === ' Backspace' ) {
86
86
if (this .activeComponent && this .activeComponentData .isActive ) {
87
- this .$store .dispatch (" deleteActiveComponent" );
87
+ this .$store .dispatch (' deleteActiveComponent' )
88
88
}
89
89
}
90
- });
90
+ })
91
91
},
92
92
computed: {
93
93
... mapState ([
94
- " routes" ,
95
- " activeRoute" ,
96
- " activeComponent" ,
97
- " componentMap" ,
98
- " componentChildrenMultiselectValue" ,
99
- " imagePath"
94
+ ' routes' ,
95
+ ' activeRoute' ,
96
+ ' activeComponent' ,
97
+ ' componentMap' ,
98
+ ' componentChildrenMultiselectValue' ,
99
+ ' imagePath'
100
100
]),
101
101
// used in VueDraggableResizeable component
102
- activeRouteArray () {
103
- console .log (" active route array method" , this .routes [this .activeRoute ]);
104
- return this .routes [this .activeRoute ];
102
+ activeRouteArray () {
103
+ console .log (' active route array method' , this .routes [this .activeRoute ])
104
+ return this .routes [this .activeRoute ]
105
105
},
106
106
// used to delete components
107
- activeComponentData () {
107
+ activeComponentData () {
108
108
return this .activeRouteArray .filter (componentData => {
109
- return componentData .componentName === this .activeComponent ;
110
- })[0 ];
109
+ return componentData .componentName === this .activeComponent
110
+ })[0 ]
111
111
},
112
- childList () {
113
- return this .componentMap [componentData .componentName ].children ;
112
+ childList () {
113
+ return this .componentMap [componentData .componentName ].children
114
114
},
115
- options () {
115
+ options () {
116
116
// PROBLEM: the objects on childrenmultiselectvalue are applied
117
- const routes = Object .keys (this .routes );
118
- const exceptions = new Set ([" App" , this .activeComponent , ... routes]);
117
+ const routes = Object .keys (this .routes )
118
+ const exceptions = new Set ([' App' , this .activeComponent , ... routes])
119
119
return Object .keys (this .componentMap ).filter (component => {
120
- if (! exceptions .has (component)) return component;
121
- });
120
+ if (! exceptions .has (component)) return component
121
+ })
122
122
},
123
- userImage () {
124
- const imgSrc = this .imagePath .length ? ` file://` + this .imagePath [0 ] : " " ;
123
+ userImage () {
124
+ const imgSrc = this .imagePath .length ? ` file://` + this .imagePath [0 ] : ' '
125
125
// const imgSrc1 = this.imagePath;
126
- console .log (` imgSrc: ${ imgSrc} ` );
127
- return imgSrc;
126
+ console .log (` imgSrc: ${ imgSrc} ` )
127
+ return imgSrc
128
128
},
129
- mockBg () {
129
+ mockBg () {
130
130
return this .imagePath .length
131
131
? {
132
- background: ` url("${ this .userImage } ") no-repeat center` ,
133
- " background-size" : " cover"
134
- }
135
- : {};
132
+ background: ` url("${ this .userImage } ") no-repeat center` ,
133
+ ' background-size' : ' cover'
134
+ }
135
+ : {}
136
136
}
137
137
},
138
138
methods: {
139
139
... mapActions ([
140
- " setActiveComponent" ,
141
- " updateComponentChildrenMultiselectValue" ,
142
- " updateActiveComponentChildrenValue"
140
+ ' setActiveComponent' ,
141
+ ' updateComponentChildrenMultiselectValue' ,
142
+ ' updateActiveComponentChildrenValue'
143
143
]),
144
- onResize : function (x , y , width , height ) {
145
- this .activeComponentData .x = x;
146
- this .activeComponentData .y = y;
147
- this .activeComponentData .w = width;
148
- this .activeComponentData .h = height;
144
+ onResize : function (x , y , width , height ) {
145
+ this .activeComponentData .x = x
146
+ this .activeComponentData .y = y
147
+ this .activeComponentData .w = width
148
+ this .activeComponentData .h = height
149
149
150
- this .componentMap [this .activeComponent ].x = x;
151
- this .componentMap [this .activeComponent ].y = y;
152
- this .componentMap [this .activeComponent ].w = width;
153
- this .componentMap [this .activeComponent ].h = height;
150
+ this .componentMap [this .activeComponent ].x = x
151
+ this .componentMap [this .activeComponent ].y = y
152
+ this .componentMap [this .activeComponent ].w = width
153
+ this .componentMap [this .activeComponent ].h = height
154
154
},
155
- onDrag : function (x , y ) {
156
- this .activeComponentData .x = x;
157
- this .activeComponentData .y = y;
155
+ onDrag : function (x , y ) {
156
+ this .activeComponentData .x = x
157
+ this .activeComponentData .y = y
158
158
159
- this .componentMap [this .activeComponent ].x = x;
160
- this .componentMap [this .activeComponent ].y = y;
161
- this .userImage ;
159
+ this .componentMap [this .activeComponent ].x = x
160
+ this .componentMap [this .activeComponent ].y = y
161
+ this .userImage
162
162
},
163
- onActivated (componentData ) {
164
- this .setActiveComponent (componentData .componentName );
165
- this .activeComponentData .isActive = true ;
163
+ onActivated (componentData ) {
164
+ this .setActiveComponent (componentData .componentName )
165
+ this .activeComponentData .isActive = true
166
166
},
167
- onDeactivated () {
168
- this .activeComponentData .isActive = false ;
167
+ onDeactivated () {
168
+ this .activeComponentData .isActive = false
169
169
},
170
- onDoubleClick (compData ) {
171
- this .setActiveComponent (compData .componentName );
172
- this .activeComponentData .isActive = true ;
170
+ onDoubleClick (compData ) {
171
+ this .setActiveComponent (compData .componentName )
172
+ this .activeComponentData .isActive = true
173
173
},
174
- handleAddChild () {
174
+ handleAddChild () {
175
175
// render modal with childrenmultiselect in it
176
- this .modalOpen = true ;
176
+ this .modalOpen = true
177
177
},
178
- handleSelect (value ) {
178
+ handleSelect (value ) {
179
179
// if (this.modalOpen) this.updateActiveComponentChildrenValue(value)
180
- console .log (" Multiselect: " , value);
181
- this .updateActiveComponentChildrenValue (value);
180
+ console .log (' Multiselect: ' , value)
181
+ this .updateActiveComponentChildrenValue (value)
182
182
// this.updateComponentChildrenMultiselectValue(value)
183
183
}
184
184
// @dblclick.native="onDoubleClick(componentData)"
@@ -187,7 +187,7 @@ export default {
187
187
// this.activeComponentData.isActive = true
188
188
// }
189
189
}
190
- };
190
+ }
191
191
</script >
192
192
193
193
<style scoped>
0 commit comments