11<template >
22 <Draggable
3+ v-if =" showDraggable && modelItems.length > 0"
34 tag =" td"
45 :list =" modelItems"
5- :group =" { name: 'sharted ', pull: true, put: true }"
6+ :group =" { name: 'shared ', pull: true, put: true }"
67 :ghost-class =" 'pvtPlaceholder'"
78 :prevent-on-filter =" false"
89 :class =" classes"
4041</template >
4142
4243<script setup>
43- import { ref , onMounted , computed } from ' vue'
44+ import { ref , onMounted , computed , watch , nextTick , onBeforeUnmount } from ' vue'
4445import { VueDraggableNext as Draggable } from ' vue-draggable-next'
4546import VDraggableAttribute from ' ./VDraggableAttribute.vue'
4647
@@ -95,6 +96,7 @@ const props = defineProps({
9596})
9697
9798const modelItems = ref ([])
99+ const showDraggable = ref (false )
98100
99101const onDragMove = (event ) => {
100102 const draggedItem = event .draggedContext .element
@@ -118,8 +120,22 @@ const onDragEnd = () => {
118120
119121onMounted (() => {
120122 modelItems .value = [... props .attributeNames ]
123+ nextTick (() => {
124+ showDraggable .value = true
125+ })
121126})
122127
128+ onBeforeUnmount (() => {
129+ showDraggable .value = false
130+ })
131+
132+ watch (
133+ () => props .attributeNames ,
134+ (newVal ) => {
135+ modelItems .value = [... newVal]
136+ }
137+ )
138+
123139const hideDropDownForUnused = computed (() => {
124140 return props .cellType === ' unused' && props .hideFilterBoxOfUnusedAttributes
125141})
0 commit comments