mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-12 19:52:51 +00:00
feat: resourceList children support different resourceName
This commit is contained in:
parent
a645af7e0b
commit
ebe21c4d07
@ -16,6 +16,7 @@ import {
|
||||
ILowCodePluginManager,
|
||||
} from '@alilc/lowcode-designer';
|
||||
import {
|
||||
ISkeleton,
|
||||
Skeleton as InnerSkeleton,
|
||||
} from '@alilc/lowcode-editor-skeleton';
|
||||
import {
|
||||
@ -65,7 +66,7 @@ export interface IBasicContext extends Omit<IPublicModelPluginContext, 'workspac
|
||||
designer: IDesigner;
|
||||
registerInnerPlugins: () => Promise<void>;
|
||||
innerSetters: InnerSetters;
|
||||
innerSkeleton: InnerSkeleton;
|
||||
innerSkeleton: ISkeleton;
|
||||
innerHotkey: IHotKey;
|
||||
innerPlugins: ILowCodePluginManager;
|
||||
canvas: IPublicApiCanvas;
|
||||
|
||||
@ -2,7 +2,7 @@ import { IPublicModelPluginContext } from '@alilc/lowcode-types';
|
||||
|
||||
export function DesignerView(props: {
|
||||
url: string;
|
||||
viewName: string;
|
||||
viewName?: string;
|
||||
}) {
|
||||
return (
|
||||
<div className="lc-designer lowcode-plugin-designer">
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import { ISkeleton } from '@alilc/lowcode-editor-skeleton';
|
||||
import { IPublicTypeEditorView, IPublicResourceData, IPublicResourceTypeConfig, IBaseModelResource } from '@alilc/lowcode-types';
|
||||
import { Logger } from '@alilc/lowcode-utils';
|
||||
import { BasicContext, IBasicContext } from './context/base-context';
|
||||
@ -9,6 +10,8 @@ const logger = new Logger({ level: 'warn', bizName: 'workspace:resource' });
|
||||
export interface IBaseResource<T> extends IBaseModelResource<T> {
|
||||
readonly resourceType: ResourceType;
|
||||
|
||||
skeleton: ISkeleton;
|
||||
|
||||
get editorViews(): IPublicTypeEditorView[];
|
||||
|
||||
get defaultViewType(): string;
|
||||
@ -68,7 +71,7 @@ export class Resource implements IResource {
|
||||
}
|
||||
|
||||
get children(): IResource[] {
|
||||
return this.resourceData?.children?.map(d => new Resource(d, this.resourceType, this.workspace)) || [];
|
||||
return this.resourceData?.children?.map(d => new Resource(d, this.workspace.getResourceType(d.resourceName || this.resourceType.name), this.workspace)) || [];
|
||||
}
|
||||
|
||||
constructor(readonly resourceData: IPublicResourceData, readonly resourceType: IResourceType, readonly workspace: IWorkspace) {
|
||||
|
||||
@ -2,14 +2,14 @@ import { PureComponent } from 'react';
|
||||
import { EditorView } from './editor-view';
|
||||
import { observer } from '@alilc/lowcode-editor-core';
|
||||
import TopArea from '../layouts/top-area';
|
||||
import { Resource } from '../resource';
|
||||
import { EditorWindow } from '../window';
|
||||
import { IResource } from '../resource';
|
||||
import { IEditorWindow } from '../window';
|
||||
import './resource-view.less';
|
||||
|
||||
@observer
|
||||
export class ResourceView extends PureComponent<{
|
||||
window: EditorWindow;
|
||||
resource: Resource;
|
||||
window: IEditorWindow;
|
||||
resource: IResource;
|
||||
}, any> {
|
||||
render() {
|
||||
const { skeleton } = this.props.resource;
|
||||
|
||||
@ -15,6 +15,8 @@ interface IWindowCOnfig {
|
||||
export interface IEditorWindow extends Omit<IPublicModelWindow<IResource>, 'changeViewType'> {
|
||||
readonly resource: IResource;
|
||||
|
||||
editorViews: Map<string, Context>;
|
||||
|
||||
changeViewType: (name: string, ignoreEmit?: boolean) => void;
|
||||
}
|
||||
|
||||
|
||||
@ -27,6 +27,8 @@ export interface IWorkspace extends Omit<IPublicApiWorkspace<
|
||||
plugins: ILowCodePluginManager;
|
||||
|
||||
getResourceList(): IResource[];
|
||||
|
||||
getResourceType(resourceName: string): IResourceType;
|
||||
}
|
||||
|
||||
export class Workspace implements IWorkspace {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user