@@ -13,40 +13,8 @@ Description:
13
13
>
14
14
<!-- This is the actual component box -->
15
15
<!-- https://www.npmjs.com/package/vue-draggable-resizable -->
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"
16
+ <vue-draggable-resizable
17
+ class-name =" component-box"
50
18
v-for =" componentData in activeRouteArray"
51
19
ref =" boxes"
52
20
:key =" componentData.componentName"
@@ -56,7 +24,6 @@ Description:
56
24
:z =" componentData.z"
57
25
:w =" componentData.w"
58
26
:h =" componentData.h"
59
- :parent="true"
60
27
:preventDeactivation =" true"
61
28
@activated =" onActivated(componentData)"
62
29
@deactivated =" onDeactivated(componentData)"
@@ -101,15 +68,7 @@ Description:
101
68
</q-item >
102
69
</q-list >
103
70
</q-menu >
104
- </vue-draggable-resizable> -->
105
-
106
-
107
-
108
- <!-- ************************ Vue3 draggable resizable ******************* -->
109
-
110
-
111
-
112
- <!-- ********************* This part works, don't touch it *************** -->
71
+ </vue-draggable-resizable >
113
72
<div >
114
73
<q-dialog v-model =" modalOpen" >
115
74
<q-select
@@ -130,20 +89,16 @@ Description:
130
89
</template >
131
90
132
91
<script >
133
- import { defineComponent } from " vue"
134
92
import { mapState , mapActions } from " vuex" ;
135
- // import Vue3DraggableResizable from 'vue3-draggable-resizable';
93
+ import VueDraggableResizable from ' vue-draggable-resizable/src/components/vue-draggable-resizable.vue'
94
+ import ' vue-draggable-resizable/src/components/vue-draggable-resizable.css'
136
95
137
- // import { DraggableContainer } from 'vue3-draggable-resizable'
138
- // import VueDraggableResizable from "vue-draggable-resizable";
139
- // import "vue-draggable-resizable/dist/VueDraggableResizable.css";
140
96
const cloneDeep = require (' lodash.clonedeep' )
141
97
142
-
143
98
export default {
144
99
name: " ComponentDisplay" ,
145
100
components: {
146
- // Vue3DraggableResizable
101
+ VueDraggableResizable
147
102
},
148
103
data () {
149
104
// console.log("Current Component Map is: ", this.componentMap);
@@ -204,6 +159,7 @@ export default {
204
159
activeComponentData () {
205
160
// Must deep clone this so we are not directly mutating state
206
161
return cloneDeep (this .activeComponentObj );
162
+ // return this.activeComponentObj;
207
163
},
208
164
// childList () {
209
165
// return this.componentMap[componentData.componentName].children
@@ -262,10 +218,10 @@ export default {
262
218
this .$refs .boxes .forEach (element => {
263
219
element .enabled = false ;
264
220
265
- // element.$emit("deactivated");
266
- // element.$emit("update:active", false);
267
- this .$emit (" deactivated" );
268
- this .$emit (" update:active" , false );
221
+ element .$emit (" deactivated" );
222
+ element .$emit (" update:active" , false );
223
+ // this.$emit("deactivated");
224
+ // this.$emit("update:active", false);
269
225
});
270
226
}
271
227
} else {
@@ -274,14 +230,14 @@ export default {
274
230
if (
275
231
// this.activeComponent === element.$attrs.id &&
276
232
// element.enabled === false
277
- this .activeComponent === element .id &&
233
+ this .activeComponent === element .$attrs . id &&
278
234
element .enabled === false
279
235
) {
280
236
element .enabled = true ;
281
- // element.$emit("activated");
282
- // element.$emit("update:active", true);
283
- this .$emit (" activated" );
284
- this .$emit (" update:active" , true );
237
+ element .$emit (" activated" );
238
+ element .$emit (" update:active" , true );
239
+ // this.$emit("activated");
240
+ // this.$emit("update:active", true);
285
241
}
286
242
});
287
243
}
@@ -382,15 +338,13 @@ export default {
382
338
// console.log('onActivated - comp display, componentData', componentData)
383
339
if (this .$refs .boxes ) {
384
340
this .$refs .boxes .forEach (element => {
385
- if (element .id !== componentData .componentName ) {
341
+ if (element .$attrs . id !== componentData .componentName ) {
386
342
console .log (' Emit' )
387
343
element .enabled = false ;
388
- // element.$emit("deactivated");
389
-
390
- // element.$emit("update:active", false);
391
- this .$emit (" deactivated" );
392
-
393
- this .$emit (" update:active" , false );
344
+ element .$emit (" deactivated" );
345
+ element .$emit (" update:active" , false );
346
+ // this.$emit("deactivated");
347
+ // this.$emit("update:active", false);
394
348
}
395
349
});
396
350
}
@@ -400,7 +354,7 @@ export default {
400
354
this .activeComponentData .isActive = true ;
401
355
},
402
356
// deactivated is emitted before activated
403
- onDeactivated () {
357
+ onDeactivated (type ) {
404
358
console .log (' This is DEACTIVATED' )
405
359
if (this .activeComponent !== " " ) {
406
360
this .activeComponentData .isActive = false ;
@@ -446,7 +400,7 @@ export default {
446
400
if (this .activeComponent ) {
447
401
this .onActivated (this .activeComponentObj );
448
402
} else {
449
- this .onDeactivated ();
403
+ this .onDeactivated (' bgClick ' );
450
404
}
451
405
}
452
406
}
0 commit comments