mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-10 09:56:20 +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.sensing = true;
|
||||||
this.scroller.scrolling(e);
|
this.scroller.scrolling(e);
|
||||||
const dropContainer = this.getDropContainer(e);
|
const dropContainer = this.getDropContainer(e);
|
||||||
if (
|
|
||||||
!dropContainer ||
|
if (!dropContainer) {
|
||||||
// too dirty
|
|
||||||
(typeof dropContainer.container?.componentMeta?.prototype?.options?.canDropIn === 'function' &&
|
|
||||||
!dropContainer.container?.componentMeta?.prototype?.options?.canDropIn(e.dragObject.nodes[0]))
|
|
||||||
) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1116,10 +1112,6 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
|||||||
*/
|
*/
|
||||||
handleAccept({ container, instance }: DropContainer, e: LocateEvent) {
|
handleAccept({ container, instance }: DropContainer, e: LocateEvent) {
|
||||||
const { dragObject } = e;
|
const { dragObject } = e;
|
||||||
if (isRootNode(container)) {
|
|
||||||
return this.document.checkDropTarget(container, dragObject as any);
|
|
||||||
}
|
|
||||||
|
|
||||||
const meta = (container as Node).componentMeta;
|
const meta = (container as Node).componentMeta;
|
||||||
|
|
||||||
// FIXME: get containerInstance for accept logic use
|
// FIXME: get containerInstance for accept logic use
|
||||||
@ -1128,6 +1120,15 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
|||||||
return false;
|
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
|
// first use accept
|
||||||
if (acceptable) {
|
if (acceptable) {
|
||||||
/*
|
/*
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user