@dataloop-ai/components 0.20.166 → 0.20.167
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -355,6 +355,7 @@ export default defineComponent({
|
|
|
355
355
|
const hasFlatTreeData = true
|
|
356
356
|
const draggedRow = ref<DlTableRow | null>(null)
|
|
357
357
|
const targetRow = ref<DlTableRow | null>(null)
|
|
358
|
+
const storedValidTarget = ref<DlTableRow | null>(null)
|
|
358
359
|
|
|
359
360
|
const vue2h = ref()
|
|
360
361
|
|
|
@@ -783,24 +784,38 @@ export default defineComponent({
|
|
|
783
784
|
}
|
|
784
785
|
|
|
785
786
|
const handleEndEvent = (event: SortableJs.SortableEvent) => {
|
|
787
|
+
let finalTarget = targetRow.value
|
|
788
|
+
let shouldSkipValidation = false
|
|
789
|
+
|
|
790
|
+
if (storedValidTarget.value && targetRow.value) {
|
|
791
|
+
const targetParent = findParentForChild(targetRow.value.id, tableRows.value)
|
|
792
|
+
if (targetParent === storedValidTarget.value.id) {
|
|
793
|
+
finalTarget = storedValidTarget.value
|
|
794
|
+
shouldSkipValidation = true
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
|
|
786
798
|
emit('row-drag-end', {
|
|
787
799
|
draggedRow: draggedRow.value,
|
|
788
|
-
targetRow:
|
|
800
|
+
targetRow: finalTarget
|
|
789
801
|
})
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
targetRow.value
|
|
793
|
-
)
|
|
802
|
+
|
|
803
|
+
const isDragValid = shouldSkipValidation || checkParentCondition(draggedRow.value, finalTarget)
|
|
794
804
|
if (isDragValid) {
|
|
805
|
+
const smartSortingMovement = {
|
|
806
|
+
...sortingMovement.value,
|
|
807
|
+
lastId: finalTarget?.id || sortingMovement.value.lastId
|
|
808
|
+
}
|
|
795
809
|
emit(
|
|
796
810
|
'row-reorder',
|
|
797
|
-
moveNestedRow(tableRows.value, event,
|
|
811
|
+
moveNestedRow(tableRows.value, event, smartSortingMovement)
|
|
798
812
|
)
|
|
799
813
|
} else {
|
|
800
814
|
mainTableKey.value = v4()
|
|
801
815
|
}
|
|
802
816
|
draggedRow.value = null
|
|
803
817
|
targetRow.value = null
|
|
818
|
+
storedValidTarget.value = null
|
|
804
819
|
}
|
|
805
820
|
|
|
806
821
|
const handleChangeEvent = (event: any) => {
|
|
@@ -905,7 +920,17 @@ export default defineComponent({
|
|
|
905
920
|
return false
|
|
906
921
|
}
|
|
907
922
|
|
|
908
|
-
|
|
923
|
+
|
|
924
|
+
if (targetRow.disableDraggable) {
|
|
925
|
+
return false
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
const isValid = checkParentCondition(draggedRow.value, targetRow)
|
|
929
|
+
|
|
930
|
+
if (isValid) {
|
|
931
|
+
storedValidTarget.value = targetRow
|
|
932
|
+
}
|
|
933
|
+
return isValid
|
|
909
934
|
}
|
|
910
935
|
|
|
911
936
|
const getTargetRowFromMoveEvent = (
|