mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-01 22:10:27 +00:00
refactor: canDropIn 逻辑换到 handleAccept
This commit is contained in:
parent
20fcfe6b29
commit
6e17762863
@ -842,12 +842,8 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
||||
this.sensing = true;
|
||||
this.scroller.scrolling(e);
|
||||
const dropContainer = this.getDropContainer(e);
|
||||
if (
|
||||
!dropContainer ||
|
||||
// too dirty
|
||||
(typeof dropContainer.container?.componentMeta?.prototype?.options?.canDropIn === 'function' &&
|
||||
!dropContainer.container?.componentMeta?.prototype?.options?.canDropIn(e.dragObject.nodes[0]))
|
||||
) {
|
||||
|
||||
if (!dropContainer) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -1116,10 +1112,6 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
||||
*/
|
||||
handleAccept({ container, instance }: DropContainer, e: LocateEvent) {
|
||||
const { dragObject } = e;
|
||||
if (isRootNode(container)) {
|
||||
return this.document.checkDropTarget(container, dragObject as any);
|
||||
}
|
||||
|
||||
const meta = (container as Node).componentMeta;
|
||||
|
||||
// FIXME: get containerInstance for accept logic use
|
||||
@ -1128,6 +1120,15 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
||||
return false;
|
||||
}
|
||||
|
||||
if (typeof meta.prototype?.options?.canDropIn === 'function' &&
|
||||
!meta.prototype?.options?.canDropIn(dragObject.nodes[0])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isRootNode(container)) {
|
||||
return this.document.checkDropTarget(container, dragObject as any);
|
||||
}
|
||||
|
||||
// first use accept
|
||||
if (acceptable) {
|
||||
/*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user