mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-20 07:14:23 +00:00
Merge branch 'fix/lihao-bugs' into 'release/0.9.6'
Fix/lihao bugs See merge request !939843
This commit is contained in:
commit
3fc1ff8be6
@ -208,13 +208,13 @@ export class ComponentMeta {
|
|||||||
return result as any;
|
return result as any;
|
||||||
}
|
}
|
||||||
|
|
||||||
isRootComponent() {
|
isRootComponent(includeBlock: boolean = true) {
|
||||||
return this.componentName === 'Page' || this.componentName === 'Block' || this.componentName === 'Component';
|
return this.componentName === 'Page' || this.componentName === 'Component' || (includeBlock && this.componentName === 'Block');
|
||||||
}
|
}
|
||||||
|
|
||||||
@computed get availableActions() {
|
@computed get availableActions() {
|
||||||
let { disableBehaviors, actions } = this._transformedMetadata?.configure.component || {};
|
let { disableBehaviors, actions } = this._transformedMetadata?.configure.component || {};
|
||||||
const disabled = ensureAList(disableBehaviors) || (this.isRootComponent() ? ['copy', 'remove'] : null);
|
const disabled = ensureAList(disableBehaviors) || (this.isRootComponent(false) ? ['copy', 'remove'] : null);
|
||||||
actions = builtinComponentActions.concat(this.designer.getGlobalComponentActions() || [], actions || []);
|
actions = builtinComponentActions.concat(this.designer.getGlobalComponentActions() || [], actions || []);
|
||||||
|
|
||||||
if (disabled) {
|
if (disabled) {
|
||||||
|
|||||||
@ -105,8 +105,6 @@ export class DocumentModel {
|
|||||||
|
|
||||||
if (!schema) {
|
if (!schema) {
|
||||||
this._blank = true;
|
this._blank = true;
|
||||||
} else {
|
|
||||||
this.id = project.getSchema()?.id || this.id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.rootNode = this.createNode<RootNode>(
|
this.rootNode = this.createNode<RootNode>(
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { designer } from './editor';
|
|
||||||
import { RootSchema } from '@ali/lowcode-types';
|
import { RootSchema } from '@ali/lowcode-types';
|
||||||
import { DocumentModel } from '@ali/lowcode-designer';
|
import { DocumentModel } from '@ali/lowcode-designer';
|
||||||
|
import { designer } from './editor';
|
||||||
import NodeCacheVisitor from './rootNodeVisitor';
|
import NodeCacheVisitor from './rootNodeVisitor';
|
||||||
|
|
||||||
const { project } = designer;
|
const { project } = designer;
|
||||||
@ -86,7 +86,12 @@ const pages = Object.assign(project, {
|
|||||||
page.active();
|
page.active();
|
||||||
},
|
},
|
||||||
getCurrentPage() {
|
getCurrentPage() {
|
||||||
return project.currentDocument;
|
if (!project.currentDocument) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const currentPage = { ...project.currentDocument, id: project.getSchema().id };
|
||||||
|
Object.setPrototypeOf(currentPage, Object.getPrototypeOf(project.currentDocument || {}));
|
||||||
|
return currentPage;
|
||||||
},
|
},
|
||||||
onPagesChange() {
|
onPagesChange() {
|
||||||
// noop
|
// noop
|
||||||
@ -101,7 +106,7 @@ const pages = Object.assign(project, {
|
|||||||
|
|
||||||
Object.defineProperty(pages, 'currentPage', {
|
Object.defineProperty(pages, 'currentPage', {
|
||||||
get() {
|
get() {
|
||||||
return project.currentDocument;
|
return pages.getCurrentPage();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user