mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
fix: 处理 function component 无法选中的问题,本质上是没有 ref
fix: 处理 filter 组件在每次重绘时 fieldId 变更的 bug
This commit is contained in:
parent
16b427ba87
commit
fa94aab3cb
@ -461,9 +461,9 @@ export class DocumentModel {
|
||||
* 从项目中移除
|
||||
*/
|
||||
remove() {
|
||||
this.designer.postEvent('document.remove', { id: this.id });
|
||||
this.purge();
|
||||
this.project.removeDocument(this);
|
||||
this.designer.postEvent('document.remove', { id: this.id });
|
||||
}
|
||||
|
||||
purge() {
|
||||
|
||||
@ -69,8 +69,6 @@ export default class Bundle {
|
||||
|
||||
// invoke prototype mocker while the prototype does not exist
|
||||
Object.keys(this.viewsMap).forEach((viewName) => {
|
||||
const test = this;
|
||||
// console.log(test, viewName);
|
||||
if (!this.prototypeList.find((proto) => proto.getComponentName() === viewName)) {
|
||||
const mockedPrototype = trunk.mockComponentPrototype(this.viewsMap[viewName]);
|
||||
if (mockedPrototype) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { ComponentType, ReactElement } from 'react';
|
||||
import { ComponentType, ReactElement, Component, FunctionComponent } from 'react';
|
||||
import { ComponentMetadata, FieldConfig, InitialItem, FilterItem, AutorunItem, isI18nData } from '@ali/lowcode-types';
|
||||
import {
|
||||
ComponentMeta,
|
||||
@ -220,14 +220,14 @@ class Prototype {
|
||||
readonly isPrototype = true;
|
||||
readonly meta: ComponentMeta;
|
||||
readonly options: OldPrototypeConfig | ComponentMetadata;
|
||||
view: ComponentType;
|
||||
// componentName: string;
|
||||
get componentName() {
|
||||
return this.getId();
|
||||
}
|
||||
get packageName() {
|
||||
return this.meta.npm?.package;
|
||||
}
|
||||
// 兼容原 vision 用法
|
||||
view: ComponentType | undefined;
|
||||
|
||||
constructor(input: OldPrototypeConfig | ComponentMetadata | ComponentMeta, extraConfigs: any = null, lookup: boolean = false) {
|
||||
if (lookup) {
|
||||
@ -327,19 +327,30 @@ class Prototype {
|
||||
}
|
||||
|
||||
setView(view: ComponentType<any>) {
|
||||
this.view = view;
|
||||
let wrappedView = view;
|
||||
if (!view?.prototype?.isReactComponent) {
|
||||
const ViewComponentClass = class extends Component {
|
||||
render() {
|
||||
return (view as FunctionComponent)(this.props);
|
||||
}
|
||||
} as any;
|
||||
ViewComponentClass.displayName = view.displayName;
|
||||
wrappedView = ViewComponentClass;
|
||||
}
|
||||
this.view = wrappedView;
|
||||
const metadata = this.meta.getMetadata();
|
||||
if (!metadata.experimental) {
|
||||
metadata.experimental = {
|
||||
view,
|
||||
view: wrappedView,
|
||||
};
|
||||
} else {
|
||||
metadata.experimental.view = view;
|
||||
metadata.experimental.view = wrappedView;
|
||||
}
|
||||
}
|
||||
|
||||
getView() {
|
||||
return (
|
||||
this.view ||
|
||||
this.meta.getMetadata().experimental?.view ||
|
||||
designer.currentDocument?.simulator?.getComponent(this.getComponentName())
|
||||
);
|
||||
|
||||
@ -106,7 +106,8 @@ designer.addPropsReducer((props, node) => {
|
||||
fieldIds.push(fieldId);
|
||||
}
|
||||
});
|
||||
if (fieldIds.indexOf(props.fieldId) >= 0) {
|
||||
// 全局的关闭 uniqueIdChecker 信号,在 ve-utils 中实现
|
||||
if (fieldIds.indexOf(props.fieldId) >= 0 && !window.__disable_unique_id_checker__) {
|
||||
newProps.fieldId = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,7 +98,6 @@ export class TreeMaster {
|
||||
return this.treeMap.get(id)!;
|
||||
}
|
||||
const tree = new Tree(doc);
|
||||
// TODO: listen purge event to remove
|
||||
this.treeMap.set(id, tree);
|
||||
return tree;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user