@@ -13,40 +13,8 @@ Description:
1313 >
1414 <!-- This is the actual component box -->
1515 <!-- 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"
5018 v-for =" componentData in activeRouteArray"
5119 ref =" boxes"
5220 :key =" componentData.componentName"
@@ -56,7 +24,6 @@ Description:
5624 :z =" componentData.z"
5725 :w =" componentData.w"
5826 :h =" componentData.h"
59- :parent="true"
6027 :preventDeactivation =" true"
6128 @activated =" onActivated(componentData)"
6229 @deactivated =" onDeactivated(componentData)"
@@ -101,15 +68,7 @@ Description:
10168 </q-item >
10269 </q-list >
10370 </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 >
11372 <div >
11473 <q-dialog v-model =" modalOpen" >
11574 <q-select
@@ -130,20 +89,16 @@ Description:
13089</template >
13190
13291<script >
133- import { defineComponent } from " vue"
13492import { 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'
13695
137- // import { DraggableContainer } from 'vue3-draggable-resizable'
138- // import VueDraggableResizable from "vue-draggable-resizable";
139- // import "vue-draggable-resizable/dist/VueDraggableResizable.css";
14096const cloneDeep = require (' lodash.clonedeep' )
14197
142-
14398export default {
14499 name: " ComponentDisplay" ,
145100 components: {
146- // Vue3DraggableResizable
101+ VueDraggableResizable
147102 },
148103 data () {
149104 // console.log("Current Component Map is: ", this.componentMap);
@@ -204,6 +159,7 @@ export default {
204159 activeComponentData () {
205160 // Must deep clone this so we are not directly mutating state
206161 return cloneDeep (this .activeComponentObj );
162+ // return this.activeComponentObj;
207163 },
208164 // childList () {
209165 // return this.componentMap[componentData.componentName].children
@@ -262,10 +218,10 @@ export default {
262218 this .$refs .boxes .forEach (element => {
263219 element .enabled = false ;
264220
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);
269225 });
270226 }
271227 } else {
@@ -274,14 +230,14 @@ export default {
274230 if (
275231 // this.activeComponent === element.$attrs.id &&
276232 // element.enabled === false
277- this .activeComponent === element .id &&
233+ this .activeComponent === element .$attrs . id &&
278234 element .enabled === false
279235 ) {
280236 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);
285241 }
286242 });
287243 }
@@ -382,15 +338,13 @@ export default {
382338 // console.log('onActivated - comp display, componentData', componentData)
383339 if (this .$refs .boxes ) {
384340 this .$refs .boxes .forEach (element => {
385- if (element .id !== componentData .componentName ) {
341+ if (element .$attrs . id !== componentData .componentName ) {
386342 console .log (' Emit' )
387343 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);
394348 }
395349 });
396350 }
@@ -400,7 +354,7 @@ export default {
400354 this .activeComponentData .isActive = true ;
401355 },
402356 // deactivated is emitted before activated
403- onDeactivated () {
357+ onDeactivated (type ) {
404358 console .log (' This is DEACTIVATED' )
405359 if (this .activeComponent !== " " ) {
406360 this .activeComponentData .isActive = false ;
@@ -446,7 +400,7 @@ export default {
446400 if (this .activeComponent ) {
447401 this .onActivated (this .activeComponentObj );
448402 } else {
449- this .onDeactivated ();
403+ this .onDeactivated (' bgClick ' );
450404 }
451405 }
452406 }
0 commit comments