fix: 修复 Dialog 错误地添加到非 Page 节点下

fix: scrollToNode 时, 兼容 comment 类型的节点
fix: 修复明细组件点击扩展配置时白屏
This commit is contained in:
力皓 2021-03-08 10:57:28 +08:00
parent 2908bbe927
commit 28d7960c52
5 changed files with 16 additions and 4 deletions

View File

@ -26,5 +26,6 @@ module.exports = {
'@typescript-eslint/no-inferrable-types': 0,
'no-proto': 0,
'prefer-const': 0,
'eol-last': 0,
}
};

View File

@ -40,7 +40,7 @@ import clipboard from '../designer/clipboard';
import { LiveEditing } from './live-editing/live-editing';
import { Project } from '../project';
import { Scroller } from '../designer/scroller';
import { isDOMNodeVisible } from '../utils/misc';
import { isElementNode, isDOMNodeVisible } from '../utils/misc';
export interface LibraryItem {
package: string;
@ -196,7 +196,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
get(key: string): any {
if (key === 'device') {
return this.designer?.editor?.get('deviceMapper')?.transform?.(this._props.device) || this._props.device
return this.designer?.editor?.get('deviceMapper')?.transform?.(this._props.device) || this._props.device;
}
return this._props[key];
}
@ -847,7 +847,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
if (!componentInstance) return;
const domNode = this.findDOMNodes(componentInstance)?.[0] as Element;
if (!domNode) return;
if (!isDOMNodeVisible(domNode, this.viewport)) {
if (isElementNode(domNode) && !isDOMNodeVisible(domNode, this.viewport)) {
const { left, top } = domNode.getBoundingClientRect();
const { scrollTop = 0, scrollLeft = 0 } = this.contentDocument?.documentElement!;
opt.left = left + scrollLeft;

View File

@ -929,6 +929,10 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
return null;
}
if (node.componentMeta?.getMetadata().configure.component?.isModal) {
return { container: this.document.rootNode, ref };
}
const canDropIn = this.componentMeta?.prototype?.options?.canDropIn;
if (this.isContainer()) {
if (canDropIn === undefined ||

View File

@ -1,5 +1,9 @@
import Viewport from '../builtin-simulator/viewport';
export function isElementNode(domNode: Element) {
return domNode.nodeType === Node.ELEMENT_NODE;
}
export function isDOMNodeVisible(domNode: Element, viewport: Viewport) {
const domNodeRect = domNode.getBoundingClientRect();
const { width, height } = viewport.contentBounds;

View File

@ -3,6 +3,7 @@ import React, { Component } from 'react';
import classNames from 'classnames';
import Icons from '@ali/ve-icons';
import { Stage as StageWidget } from '../../widget/stage';
import { isTitleConfig } from '@ali/lowcode-types';
export const StageDefaultProps = {
current: false,
@ -55,6 +56,8 @@ export default class Stage extends Component<StageProps> {
render() {
const { stage, current, direction } = this.props;
const content = stage?.getContent();
const { title } = stage!;
const newTitle = isTitleConfig(title) ? title.label : title;
if (current) {
if (direction) {
@ -75,7 +78,7 @@ export default class Stage extends Component<StageProps> {
const stageBacker = stage?.hasBack() ? (
<div className="skeleton-stagebox-stagebacker">
<Icons name="arrow" className="skeleton-stagebox-stage-arrow" size="medium" data-stage-target="stageback" />
<span className="skeleton-stagebox-stage-title">{stage.title}</span>
<span className="skeleton-stagebox-stage-title">{newTitle}</span>
<Icons name="exit" className="skeleton-stagebox-stage-exit" size="medium" data-stage-target="stageexit" />
</div>
) : null;