@@ -13,8 +13,40 @@ Description:
13
13
>
14
14
<!-- This is the actual component box -->
15
15
<!-- https://www.npmjs.com/package/vue-draggable-resizable -->
16
- <VueDraggableResizable
17
- class-name =" component-box"
16
+
17
+ <!-- // ***************** Without draggable resizable, this works *********** -->
18
+ <!-- <div
19
+ class="component-box"
20
+ v-for="componentData in activeRouteArray"
21
+ ref="boxes"
22
+ :key="componentData.componentName"
23
+ :id="componentData.componentName"
24
+ :x="componentData.x"
25
+ :y="componentData.y"
26
+ :z="componentData.z"
27
+ :w="componentData.w"
28
+ :h="componentData.h"
29
+ :parent="true"
30
+ :preventDeactivation="true"
31
+ @activated="onActivated(componentData)"
32
+ @click="onActivated(componentData)"
33
+ @deactivated="onDeactivated(componentData)"
34
+ @dragstop="finishedDrag"
35
+ @resizestop="finishedResize"
36
+ :onDragStart="recordInitialPosition"
37
+ :onResizeStart="recordInitialSize"
38
+ >
39
+ {{ componentData.componentName }}
40
+ {{ componentData.w }}
41
+ {{ componentData.x }}
42
+ {{ componentData.y }}
43
+ {{ componentData.z }}
44
+ {{ componentData.h }}
45
+ </div> -->
46
+
47
+ <!-- ************************** Old vue draggable resizable *************** -->
48
+ <!-- <vue-draggable-resizable
49
+ class="component-box"
18
50
v-for="componentData in activeRouteArray"
19
51
ref="boxes"
20
52
:key="componentData.componentName"
@@ -69,9 +101,15 @@ Description:
69
101
</q-item>
70
102
</q-list>
71
103
</q-menu>
72
- </VueDraggableResizable >
104
+ </vue-draggable-resizable> -->
105
+
73
106
74
107
108
+ <!-- ************************ Vue3 draggable resizable ******************* -->
109
+
110
+
111
+
112
+ <!-- ********************* This part works, don't touch it *************** -->
75
113
<div >
76
114
<q-dialog v-model =" modalOpen" >
77
115
<q-select
@@ -92,16 +130,20 @@ Description:
92
130
</template >
93
131
94
132
<script >
133
+ import { defineComponent } from " vue"
95
134
import { mapState , mapActions } from " vuex" ;
96
- import VueDraggableResizable from " vue-draggable-resizable" ;
97
- const cloneDeep = require (' lodash.clonedeep' )
135
+ // import Vue3DraggableResizable from 'vue3-draggable-resizable';
136
+
137
+ // import { DraggableContainer } from 'vue3-draggable-resizable'
138
+ // import VueDraggableResizable from "vue-draggable-resizable";
98
139
// import "vue-draggable-resizable/dist/VueDraggableResizable.css";
99
- // import Vue3DraggableResizable from "vue3-draggable-resizable";
100
- // import "vue3-draggable-resizable/dist/Vue3DraggableResizable.css";
140
+ const cloneDeep = require (' lodash.clonedeep' )
141
+
142
+
101
143
export default {
102
144
name: " ComponentDisplay" ,
103
145
components: {
104
- VueDraggableResizable
146
+ // Vue3DraggableResizable
105
147
},
106
148
data () {
107
149
// console.log("Current Component Map is: ", this.componentMap);
@@ -156,7 +198,6 @@ export default {
156
198
]),
157
199
// used in VueDraggableResizeable component
158
200
activeRouteArray () {
159
- // console.log(this.routes[this.activeRoute]);
160
201
return this .routes [this .activeRoute ];
161
202
},
162
203
// used to delete active component
@@ -214,25 +255,33 @@ export default {
214
255
}
215
256
},
216
257
updated () {
258
+ // console.log(this.$refs.boxes);
217
259
// if there are no active components, all boxes are unhighlighted
218
260
if (this .activeComponent === " " ) {
219
261
if (this .$refs .boxes ) {
220
262
this .$refs .boxes .forEach (element => {
221
263
element .enabled = false ;
222
- element .$emit (" deactivated" );
223
- element .$emit (" update:active" , false );
264
+
265
+ // element.$emit("deactivated");
266
+ // element.$emit("update:active", false);
267
+ this .$emit (" deactivated" );
268
+ this .$emit (" update:active" , false );
224
269
});
225
270
}
226
271
} else {
227
272
// if a component is set to active, highlight it
228
273
this .$refs .boxes .forEach (element => {
229
274
if (
230
- this .activeComponent === element .$attrs .id &&
275
+ // this.activeComponent === element.$attrs.id &&
276
+ // element.enabled === false
277
+ this .activeComponent === element .id &&
231
278
element .enabled === false
232
279
) {
233
280
element .enabled = true ;
234
- element .$emit (" activated" );
235
- element .$emit (" update:active" , true );
281
+ // element.$emit("activated");
282
+ // element.$emit("update:active", true);
283
+ this .$emit (" activated" );
284
+ this .$emit (" update:active" , true );
236
285
}
237
286
});
238
287
}
@@ -329,14 +378,19 @@ export default {
329
378
*/
330
379
// unhighlights all inactive components
331
380
onActivated (componentData ) {
381
+ console .log (' This is ACTIVATED' )
332
382
// console.log('onActivated - comp display, componentData', componentData)
333
383
if (this .$refs .boxes ) {
334
384
this .$refs .boxes .forEach (element => {
335
- if (element .$attrs .id !== componentData .componentName ) {
385
+ if (element .id !== componentData .componentName ) {
386
+ console .log (' Emit' )
336
387
element .enabled = false ;
337
- element .$emit (" deactivated" );
338
- // this.setActiveComponent(componentData.componentName)
339
- element .$emit (" update:active" , false );
388
+ // element.$emit("deactivated");
389
+
390
+ // element.$emit("update:active", false);
391
+ this .$emit (" deactivated" );
392
+
393
+ this .$emit (" update:active" , false );
340
394
}
341
395
});
342
396
}
@@ -347,6 +401,7 @@ export default {
347
401
},
348
402
// deactivated is emitted before activated
349
403
onDeactivated () {
404
+ console .log (' This is DEACTIVATED' )
350
405
if (this .activeComponent !== " " ) {
351
406
this .activeComponentData .isActive = false ;
352
407
}
@@ -395,7 +450,7 @@ export default {
395
450
}
396
451
}
397
452
}
398
- };
453
+ }
399
454
</script >
400
455
401
456
<style scoped>
0 commit comments