|
|
@ -55,7 +55,7 @@ async function onDrop2(ev) { |
|
|
|
if ( |
|
|
|
data |
|
|
|
) { |
|
|
|
const isSuccess = (await props.dropFn?.(ENiuTreeStatus.DragIn, data, props.list)) |
|
|
|
const isSuccess = (await props.dropFn?.(ENiuTreeStatus.DragIn, data, undefined)) |
|
|
|
if (isSuccess == undefined || isSuccess) { |
|
|
|
removeByKey(sourceKey, props.list) |
|
|
|
props.list.push(data) |
|
|
@ -73,7 +73,7 @@ const props = withDefaults( |
|
|
|
justOpenOne?: boolean |
|
|
|
sort?: boolean |
|
|
|
level?: number |
|
|
|
dropFn?(status: ENiuTreeStatus, data: INiuTreeData, targetDataList: INiuTreeData[]): boolean | Promise<boolean> |
|
|
|
dropFn?(status: ENiuTreeStatus, data: INiuTreeData, targetDataList?: INiuTreeData): boolean | Promise<boolean> |
|
|
|
}>(), |
|
|
|
{ |
|
|
|
justOpenOne: false, |
|
|
@ -152,7 +152,7 @@ async function onDrop(key: INiuTreeKey, status?: ENiuTreeStatus) { |
|
|
|
sourceKey != key && |
|
|
|
!isChildOf(key, sourceKey, props.list) |
|
|
|
) { |
|
|
|
const isSuccess = (await props.dropFn?.(status, data, parentData?.children ?? props.list)) |
|
|
|
const isSuccess = (await props.dropFn?.(status, data, parentData)) |
|
|
|
if (isSuccess == undefined || isSuccess) { |
|
|
|
removeByKey(sourceKey, props.list) |
|
|
|
if(parentData){ |
|
|
@ -175,7 +175,7 @@ async function onDrop(key: INiuTreeKey, status?: ENiuTreeStatus) { |
|
|
|
!isChildOf(key, sourceKey, props.list) && |
|
|
|
targetData.children |
|
|
|
) { |
|
|
|
const isSuccess = (await props.dropFn?.(status, data, targetData.children)) |
|
|
|
const isSuccess = (await props.dropFn?.(status, data, targetData)) |
|
|
|
if (isSuccess == undefined || isSuccess) { |
|
|
|
removeByKey(sourceKey, props.list) |
|
|
|
targetData.children.push(data) |
|
|
@ -194,7 +194,7 @@ async function onDrop(key: INiuTreeKey, status?: ENiuTreeStatus) { |
|
|
|
sourceKey != key && |
|
|
|
!isChildOf(key, sourceKey, props.list) |
|
|
|
) { |
|
|
|
const isSuccess = (await props.dropFn?.(status, data, targetData.children)) |
|
|
|
const isSuccess = (await props.dropFn?.(status, data, targetData)) |
|
|
|
if (isSuccess == undefined || isSuccess) { |
|
|
|
removeByKey(sourceKey, props.list) |
|
|
|
insertAfterByKey(key, data, props.list) |
|
|
@ -210,7 +210,7 @@ async function onDrop(key: INiuTreeKey, status?: ENiuTreeStatus) { |
|
|
|
sourceKey != key && |
|
|
|
!isChildOf(key, sourceKey, props.list) |
|
|
|
) { |
|
|
|
const isSuccess = (await props.dropFn?.(status, data, targetData.children)) |
|
|
|
const isSuccess = (await props.dropFn?.(status, data, targetData)) |
|
|
|
if (isSuccess == undefined || isSuccess) { |
|
|
|
removeByKey(sourceKey, props.list) |
|
|
|
insertBeforeByKey(key, data, props.list) |
|
|
|