Skip to content

Commit

Permalink
Discard changes to packages/renderless/src/tree/index.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
necoxrr authored Oct 27, 2024
1 parent 47513b3 commit d19f14d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/renderless/src/tree/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ export const dragStart =
emit('node-drag-start', treeNode.node, event)
}


const getDropType = (dropPrev, dropInner, dropNext, dropNode) => {
let dropType
const targetPosition = dropNode.$el.getBoundingClientRect()
Expand Down Expand Up @@ -229,7 +228,7 @@ export const dragEnd =
(event) => {
const dragState = state.dragState
const { draggingNode, dropType, dropNode } = dragState

event.preventDefault()

if (!event.dataTransfer) {
Expand Down Expand Up @@ -441,8 +440,8 @@ export const filter =
if (!props.filterNodeMethod) {
throw new Error('[Tree] filterNodeMethod is required when filter')
}

state.store.filter(value)
api.updateFlattenedTreeData()
// tiny 新增: 移除了watch,所以要手动调用一下该方法
if (props.willChangeView) {
api.initPlainNodeStore()
Expand Down Expand Up @@ -485,7 +484,6 @@ export const getCheckedKeys = (state) => (leafOnly) => state.store.getCheckedKey

export const getCurrentNode = (state) => () => {
const currentNode = state.store.getCurrentNode()

return currentNode ? currentNode.data : null
}

Expand Down Expand Up @@ -1058,10 +1056,8 @@ export const computedFlattenedTreeData = () => (props, state) => {
const node = stack.pop()!
if (!node.visible) continue
newData.push(node)

if (!node.expanded) continue
stack.push(...(node.childNodes.slice() || []).reverse().filter((v) => v.expanded || v.visible))
}
return newData
}

0 comments on commit d19f14d

Please sign in to comment.