mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-12 11:20:11 +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,
|
||||
IPublicApiCanvas,
|
||||
IPublicApiWorkspace,
|
||||
IPublicEnumPluginRegisterLevel,
|
||||
IPublicModelWindow,
|
||||
} from '@alilc/lowcode-types';
|
||||
import {
|
||||
IPluginContextOptions,
|
||||
@ -41,6 +43,8 @@ export default class PluginContext implements
|
||||
pluginEvent: IPublicApiEvent;
|
||||
canvas: IPublicApiCanvas;
|
||||
workspace: IPublicApiWorkspace;
|
||||
registerLevel: IPublicEnumPluginRegisterLevel;
|
||||
editorWindow: IPublicModelWindow;
|
||||
|
||||
constructor(
|
||||
options: IPluginContextOptions,
|
||||
|
||||
@ -25,6 +25,10 @@ export class Resource implements IPublicModelResource {
|
||||
return this[resourceSymbol].resourceType.name;
|
||||
}
|
||||
|
||||
get config() {
|
||||
return this[resourceSymbol].config;
|
||||
}
|
||||
|
||||
get type() {
|
||||
return this[resourceSymbol].resourceType.type;
|
||||
}
|
||||
|
||||
@ -44,8 +44,11 @@ export class Window implements IPublicModelWindow {
|
||||
}
|
||||
|
||||
get currentEditorView() {
|
||||
if (this[windowSymbol].editorView) {
|
||||
return new EditorView(this[windowSymbol].editorView).toProxy() as any;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
get editorViews() {
|
||||
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 viewName(): string | undefined;
|
||||
|
||||
get config(): {
|
||||
disableBehaviors?: ('copy' | 'remove')[];
|
||||
} | undefined;
|
||||
}
|
||||
|
||||
export type IPublicModelResource = IBaseModelResource<IPublicModelResource>;
|
||||
|
||||
@ -23,7 +23,7 @@ export interface IPublicModelWindow<
|
||||
* 窗口当前视图
|
||||
* @since v1.1.7
|
||||
*/
|
||||
currentEditorView: IPublicModelEditorView;
|
||||
currentEditorView: IPublicModelEditorView | null;
|
||||
|
||||
/**
|
||||
* 窗口全部视图实例
|
||||
|
||||
@ -24,6 +24,10 @@ export interface IPublicResourceData {
|
||||
|
||||
/** 资源子元素 */
|
||||
children?: IPublicResourceData[];
|
||||
|
||||
config?: {
|
||||
disableBehaviors?: ('copy' | 'remove')[];
|
||||
};
|
||||
}
|
||||
|
||||
export type IPublicResourceList = IPublicResourceData[];
|
||||
@ -101,7 +101,7 @@ export class BasicContext implements IBasicContext {
|
||||
preference: IPluginPreferenceMananger;
|
||||
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 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)) || [];
|
||||
}
|
||||
|
||||
get config() {
|
||||
return this.resourceData.config;
|
||||
}
|
||||
|
||||
constructor(readonly resourceData: IPublicResourceData, readonly resourceType: IResourceType, readonly workspace: IWorkspace) {
|
||||
this.context = new BasicContext(workspace, `resource-${resourceData.resourceName || resourceType.name}`, IPublicEnumPluginRegisterLevel.Resource);
|
||||
this.resourceTypeInstance = resourceType.resourceTypeModel(this.context.innerPlugins._getLowCodePluginContext({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user