Feat:将节点实例的isParent方法改名为isAncestor

This commit is contained in:
wanglin2 2023-11-21 10:40:00 +08:00
parent 6723250266
commit d32588763c
3 changed files with 4 additions and 4 deletions

View File

@ -903,7 +903,7 @@ class Node {
}
// 检测当前节点是否是某个节点的祖先节点
isParent(node) {
isAncestor(node) {
if (this.uid === node.uid) {
return false
}

View File

@ -677,7 +677,7 @@ class Drag extends Base {
// 检查某个节点是否在被拖拽节点内
checkIsInBeingDragNodeList(node) {
return !!this.beingDragNodeList.find(item => {
return item.uid === node.uid || item.isParent(node)
return item.uid === node.uid || item.isAncestor(node)
})
}
}

View File

@ -713,7 +713,7 @@ export const getTopAncestorsFomNodeList = list => {
list.forEach(node => {
if (
!list.find(item => {
return item.uid !== node.uid && item.isParent(node)
return item.uid !== node.uid && item.isAncestor(node)
})
) {
res.push(node)
@ -728,7 +728,7 @@ export const checkHasSupSubRelation = list => {
const cur = list[i]
if (
list.find(item => {
return item.uid !== cur.uid && cur.isParent(item)
return item.uid !== cur.uid && cur.isAncestor(item)
})
) {
return true