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