mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
Merge branch 'fix/render-error-style' into 'release/0.9.3'
fix: 卡片内容不可用拖动 See merge request !932256
This commit is contained in:
commit
c806602e2e
@ -839,22 +839,35 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
||||
this.scroller.cancel();
|
||||
}
|
||||
|
||||
// ========= drag location logic: hepler for locate ==========
|
||||
// ========= drag location logic: helper for locate ==========
|
||||
|
||||
/**
|
||||
* @see ISensor
|
||||
*/
|
||||
locate(e: LocateEvent): any {
|
||||
const { dragObject } = e;
|
||||
const { nodes } = dragObject;
|
||||
|
||||
const operationalNodes = nodes?.filter((node: any) => {
|
||||
const onMoveHook = node.componentMeta?.getMetadata()?.experimental?.callbacks?.onMoveHook;
|
||||
const canMove = onMoveHook && typeof onMoveHook === 'function' ? onMoveHook() : true;
|
||||
|
||||
return canMove;
|
||||
});
|
||||
|
||||
if (!operationalNodes || operationalNodes.length === 0) {
|
||||
return;
|
||||
}
|
||||
this.sensing = true;
|
||||
this.scroller.scrolling(e);
|
||||
const dropContainer = this.getDropContainer(e);
|
||||
const canDropIn = dropContainer.container?.componentMeta?.prototype?.options?.canDropIn;
|
||||
const canDropIn = dropContainer?.container?.componentMeta?.prototype?.options?.canDropIn;
|
||||
|
||||
if (
|
||||
!dropContainer ||
|
||||
canDropIn === false ||
|
||||
// too dirty
|
||||
(typeof canDropIn === 'function' &&
|
||||
!canDropIn(e.dragObject.nodes[0]))
|
||||
(typeof canDropIn === 'function' && !canDropIn(operationalNodes[0]))
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
@ -886,7 +899,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
||||
event: e,
|
||||
};
|
||||
|
||||
if (e.dragObject.type === 'node' && e.dragObject.nodes[0]?.getPrototype()?.isModal()) {
|
||||
if (dragObject.type === 'node' && operationalNodes[0]?.getPrototype()?.isModal()) {
|
||||
return this.designer.createLocation({
|
||||
target: this.document.rootNode,
|
||||
detail: {
|
||||
|
||||
@ -137,13 +137,13 @@ export class ComponentMeta {
|
||||
}
|
||||
}
|
||||
|
||||
private parseMetadata(metadta: ComponentMetadata) {
|
||||
const { componentName, npm } = metadta;
|
||||
private parseMetadata(metadata: ComponentMetadata) {
|
||||
const { componentName, npm } = metadata;
|
||||
this._npm = npm;
|
||||
this._componentName = componentName;
|
||||
|
||||
// 额外转换逻辑
|
||||
this._transformedMetadata = this.transformMetadata(metadta);
|
||||
this._transformedMetadata = this.transformMetadata(metadata);
|
||||
|
||||
const title = this._transformedMetadata.title;
|
||||
if (title) {
|
||||
|
||||
@ -122,20 +122,32 @@ export class OutlineMain implements ISensor, ITreeBoard, IScrollable {
|
||||
locate(e: LocateEvent): DropLocation | undefined | null {
|
||||
this.sensing = true;
|
||||
this.scroller?.scrolling(e);
|
||||
const { globalY, dragObject } = e;
|
||||
const { nodes } = dragObject;
|
||||
|
||||
const tree = this._master?.currentTree;
|
||||
if (!tree || !this._shell) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const operationalNodes = nodes?.filter((node: any) => {
|
||||
const onMoveHook = node.componentMeta?.getMetadata()?.experimental?.callbacks?.onMoveHook;
|
||||
const canMove = onMoveHook && typeof onMoveHook === 'function' ? onMoveHook() : true;
|
||||
|
||||
return canMove;
|
||||
});
|
||||
|
||||
if (!operationalNodes || operationalNodes.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const document = tree.document;
|
||||
const designer = document.designer;
|
||||
const { globalY, dragObject } = e;
|
||||
const pos = getPosFromEvent(e, this._shell);
|
||||
const irect = this.getInsertionRect();
|
||||
const originLoc = document.dropLocation;
|
||||
|
||||
if (e.dragObject.type === 'node' && e.dragObject.nodes[0].getPrototype().isModal()) {
|
||||
if (dragObject.type === 'node' && operationalNodes[0].getPrototype().isModal()) {
|
||||
return designer.createLocation({
|
||||
target: document.rootNode,
|
||||
detail: {
|
||||
@ -195,7 +207,7 @@ export class OutlineMain implements ISensor, ITreeBoard, IScrollable {
|
||||
let focusSlots = pos.focusSlots;
|
||||
let { node } = treeNode;
|
||||
if (isDragNodeObject(dragObject)) {
|
||||
const nodes = dragObject.nodes;
|
||||
const nodes = operationalNodes;
|
||||
let i = nodes.length;
|
||||
let p: any = node;
|
||||
while (i-- > 0) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user