mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-12 19:52:51 +00:00
feat(workspace): add config for resource shell model
This commit is contained in:
parent
5b1423068e
commit
c3d75b27da
@ -17,6 +17,8 @@ import {
|
|||||||
IPublicTypePluginDeclaration,
|
IPublicTypePluginDeclaration,
|
||||||
IPublicApiCanvas,
|
IPublicApiCanvas,
|
||||||
IPublicApiWorkspace,
|
IPublicApiWorkspace,
|
||||||
|
IPublicEnumPluginRegisterLevel,
|
||||||
|
IPublicModelWindow,
|
||||||
} from '@alilc/lowcode-types';
|
} from '@alilc/lowcode-types';
|
||||||
import {
|
import {
|
||||||
IPluginContextOptions,
|
IPluginContextOptions,
|
||||||
@ -41,6 +43,8 @@ export default class PluginContext implements
|
|||||||
pluginEvent: IPublicApiEvent;
|
pluginEvent: IPublicApiEvent;
|
||||||
canvas: IPublicApiCanvas;
|
canvas: IPublicApiCanvas;
|
||||||
workspace: IPublicApiWorkspace;
|
workspace: IPublicApiWorkspace;
|
||||||
|
registerLevel: IPublicEnumPluginRegisterLevel;
|
||||||
|
editorWindow: IPublicModelWindow;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
options: IPluginContextOptions,
|
options: IPluginContextOptions,
|
||||||
|
|||||||
@ -25,6 +25,10 @@ export class Resource implements IPublicModelResource {
|
|||||||
return this[resourceSymbol].resourceType.name;
|
return this[resourceSymbol].resourceType.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get config() {
|
||||||
|
return this[resourceSymbol].config;
|
||||||
|
}
|
||||||
|
|
||||||
get type() {
|
get type() {
|
||||||
return this[resourceSymbol].resourceType.type;
|
return this[resourceSymbol].resourceType.type;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,8 +44,11 @@ export class Window implements IPublicModelWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get currentEditorView() {
|
get currentEditorView() {
|
||||||
|
if (this[windowSymbol].editorView) {
|
||||||
return new EditorView(this[windowSymbol].editorView).toProxy() as any;
|
return new EditorView(this[windowSymbol].editorView).toProxy() as any;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
get editorViews() {
|
get editorViews() {
|
||||||
return Array.from(this[windowSymbol].editorViews.values()).map(d => new EditorView(d).toProxy() as any);
|
return Array.from(this[windowSymbol].editorViews.values()).map(d => new EditorView(d).toProxy() as any);
|
||||||
|
|||||||
@ -18,6 +18,10 @@ export interface IBaseModelResource<
|
|||||||
get children(): Resource[];
|
get children(): Resource[];
|
||||||
|
|
||||||
get viewName(): string | undefined;
|
get viewName(): string | undefined;
|
||||||
|
|
||||||
|
get config(): {
|
||||||
|
disableBehaviors?: ('copy' | 'remove')[];
|
||||||
|
} | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type IPublicModelResource = IBaseModelResource<IPublicModelResource>;
|
export type IPublicModelResource = IBaseModelResource<IPublicModelResource>;
|
||||||
|
|||||||
@ -23,7 +23,7 @@ export interface IPublicModelWindow<
|
|||||||
* 窗口当前视图
|
* 窗口当前视图
|
||||||
* @since v1.1.7
|
* @since v1.1.7
|
||||||
*/
|
*/
|
||||||
currentEditorView: IPublicModelEditorView;
|
currentEditorView: IPublicModelEditorView | null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 窗口全部视图实例
|
* 窗口全部视图实例
|
||||||
|
|||||||
@ -24,6 +24,10 @@ export interface IPublicResourceData {
|
|||||||
|
|
||||||
/** 资源子元素 */
|
/** 资源子元素 */
|
||||||
children?: IPublicResourceData[];
|
children?: IPublicResourceData[];
|
||||||
|
|
||||||
|
config?: {
|
||||||
|
disableBehaviors?: ('copy' | 'remove')[];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export type IPublicResourceList = IPublicResourceData[];
|
export type IPublicResourceList = IPublicResourceData[];
|
||||||
@ -101,7 +101,7 @@ export class BasicContext implements IBasicContext {
|
|||||||
preference: IPluginPreferenceMananger;
|
preference: IPluginPreferenceMananger;
|
||||||
workspace: IWorkspace;
|
workspace: IWorkspace;
|
||||||
|
|
||||||
constructor(innerWorkspace: IWorkspace, viewName: string, registerLevel: IPublicEnumPluginRegisterLevel, public editorWindow?: IEditorWindow) {
|
constructor(innerWorkspace: IWorkspace, viewName: string, readonly registerLevel: IPublicEnumPluginRegisterLevel, public editorWindow?: IEditorWindow) {
|
||||||
const editor = new Editor(viewName, true);
|
const editor = new Editor(viewName, true);
|
||||||
|
|
||||||
const innerSkeleton = new InnerSkeleton(editor, viewName);
|
const innerSkeleton = new InnerSkeleton(editor, viewName);
|
||||||
|
|||||||
@ -74,6 +74,10 @@ export class Resource implements IResource {
|
|||||||
return this.resourceData?.children?.map(d => new Resource(d, this.workspace.getResourceType(d.resourceName || this.resourceType.name), this.workspace)) || [];
|
return this.resourceData?.children?.map(d => new Resource(d, this.workspace.getResourceType(d.resourceName || this.resourceType.name), this.workspace)) || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get config() {
|
||||||
|
return this.resourceData.config;
|
||||||
|
}
|
||||||
|
|
||||||
constructor(readonly resourceData: IPublicResourceData, readonly resourceType: IResourceType, readonly workspace: IWorkspace) {
|
constructor(readonly resourceData: IPublicResourceData, readonly resourceType: IResourceType, readonly workspace: IWorkspace) {
|
||||||
this.context = new BasicContext(workspace, `resource-${resourceData.resourceName || resourceType.name}`, IPublicEnumPluginRegisterLevel.Resource);
|
this.context = new BasicContext(workspace, `resource-${resourceData.resourceName || resourceType.name}`, IPublicEnumPluginRegisterLevel.Resource);
|
||||||
this.resourceTypeInstance = resourceType.resourceTypeModel(this.context.innerPlugins._getLowCodePluginContext({
|
this.resourceTypeInstance = resourceType.resourceTypeModel(this.context.innerPlugins._getLowCodePluginContext({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user