mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-11 18:42:56 +00:00
feat: added detailed definition of some skeleton.add parameters
This commit is contained in:
parent
ac211009b4
commit
c905aa27c3
@ -26,6 +26,7 @@ import {
|
||||
PluginClassSet,
|
||||
IPublicTypeWidgetBaseConfig,
|
||||
IPublicTypeWidgetConfigArea,
|
||||
IPublicTypeSkeletonConfig,
|
||||
} from '@alilc/lowcode-types';
|
||||
|
||||
const logger = new Logger({ level: 'warn', bizName: 'skeleton' });
|
||||
@ -66,6 +67,8 @@ export class Skeleton {
|
||||
|
||||
readonly stages: Area<StageConfig, Stage>;
|
||||
|
||||
readonly widgets: IWidget[] = [];
|
||||
|
||||
constructor(readonly editor: Editor, readonly viewName: string = 'global') {
|
||||
makeObservable(this);
|
||||
this.leftArea = new Area(
|
||||
@ -179,6 +182,7 @@ export class Skeleton {
|
||||
this.setupPlugins();
|
||||
this.setupEvents();
|
||||
}
|
||||
|
||||
/**
|
||||
* setup events
|
||||
*
|
||||
@ -277,8 +281,6 @@ export class Skeleton {
|
||||
this.editor.eventBus.emit(event, ...args);
|
||||
}
|
||||
|
||||
readonly widgets: IWidget[] = [];
|
||||
|
||||
createWidget(config: IPublicTypeWidgetBaseConfig | IWidget) {
|
||||
if (isWidget(config)) {
|
||||
return config;
|
||||
@ -377,7 +379,7 @@ export class Skeleton {
|
||||
return restConfig;
|
||||
}
|
||||
|
||||
add(config: IPublicTypeWidgetBaseConfig, extraConfig?: Record<string, any>) {
|
||||
add(config: IPublicTypeSkeletonConfig, extraConfig?: Record<string, any>) {
|
||||
const parsedConfig = {
|
||||
...this.parseConfig(config),
|
||||
...extraConfig,
|
||||
|
||||
@ -6,6 +6,7 @@ import {
|
||||
TipContent,
|
||||
IPublicTypeWidgetConfigArea,
|
||||
IPublicTypeWidgetBaseConfig,
|
||||
IPublicTypePanelDockPanelProps,
|
||||
} from '@alilc/lowcode-types';
|
||||
import { IWidget } from './widget/widget';
|
||||
|
||||
@ -63,8 +64,8 @@ export function isDockConfig(obj: any): obj is DockConfig {
|
||||
export interface DialogDockConfig extends IDockBaseConfig {
|
||||
type: 'DialogDock';
|
||||
dialogProps?: {
|
||||
title?: IPublicTypeTitleContent;
|
||||
[key: string]: any;
|
||||
title?: IPublicTypeTitleContent;
|
||||
};
|
||||
}
|
||||
|
||||
@ -85,16 +86,11 @@ export function isPanelConfig(obj: any): obj is PanelConfig {
|
||||
|
||||
export type HelpTipConfig = string | { url?: string; content?: string | ReactElement };
|
||||
|
||||
export interface PanelProps {
|
||||
export interface PanelProps extends IPublicTypePanelDockPanelProps {
|
||||
title?: IPublicTypeTitleContent;
|
||||
icon?: any; // 冗余字段
|
||||
description?: string | IPublicTypeI18nData;
|
||||
hideTitleBar?: boolean; // panel.props 兼容,不暴露
|
||||
help?: HelpTipConfig; // 显示问号帮助
|
||||
width?: number; // panel.props
|
||||
height?: number; // panel.props
|
||||
maxWidth?: number; // panel.props
|
||||
maxHeight?: number; // panel.props
|
||||
hiddenWhenInit?: boolean; // when this is true, by default will be hidden
|
||||
condition?: (widget: IWidget) => any;
|
||||
onInit?: (widget: IWidget) => any;
|
||||
|
||||
@ -4,7 +4,7 @@ import {
|
||||
SkeletonEvents,
|
||||
} from '@alilc/lowcode-editor-skeleton';
|
||||
import { skeletonSymbol } from '../symbols';
|
||||
import { IPublicApiSkeleton, IPublicTypeDisposable, IPublicTypeWidgetBaseConfig, IPublicTypeWidgetConfigArea } from '@alilc/lowcode-types';
|
||||
import { IPublicApiSkeleton, IPublicTypeDisposable, IPublicTypeSkeletonConfig, IPublicTypeWidgetConfigArea } from '@alilc/lowcode-types';
|
||||
|
||||
const innerSkeletonSymbol = Symbol('skeleton');
|
||||
export class Skeleton implements IPublicApiSkeleton {
|
||||
@ -38,7 +38,7 @@ export class Skeleton implements IPublicApiSkeleton {
|
||||
* @param extraConfig
|
||||
* @returns
|
||||
*/
|
||||
add(config: IPublicTypeWidgetBaseConfig, extraConfig?: Record<string, any>) {
|
||||
add(config: IPublicTypeSkeletonConfig, extraConfig?: Record<string, any>) {
|
||||
const configWithName = {
|
||||
...config,
|
||||
pluginName: this.pluginName,
|
||||
@ -51,7 +51,7 @@ export class Skeleton implements IPublicApiSkeleton {
|
||||
* @param config
|
||||
* @returns
|
||||
*/
|
||||
remove(config: IPublicTypeWidgetBaseConfig): number | undefined {
|
||||
remove(config: IPublicTypeSkeletonConfig): number | undefined {
|
||||
const { area, name } = config;
|
||||
const skeleton = this[skeletonSymbol];
|
||||
if (!normalizeArea(area)) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { IPublicTypeDisposable, IPublicTypeWidgetBaseConfig } from '../type';
|
||||
import { IPublicTypeDisposable, IPublicTypeSkeletonConfig } from '../type';
|
||||
|
||||
export interface IPublicApiSkeleton {
|
||||
|
||||
@ -9,7 +9,7 @@ export interface IPublicApiSkeleton {
|
||||
* @param extraConfig
|
||||
* @returns
|
||||
*/
|
||||
add(config: IPublicTypeWidgetBaseConfig, extraConfig?: Record<string, any>): any;
|
||||
add(config: IPublicTypeSkeletonConfig, extraConfig?: Record<string, any>): any;
|
||||
|
||||
/**
|
||||
* 移除一个面板实例
|
||||
@ -17,7 +17,7 @@ export interface IPublicApiSkeleton {
|
||||
* @param config
|
||||
* @returns
|
||||
*/
|
||||
remove(config: IPublicTypeWidgetBaseConfig): number | undefined;
|
||||
remove(config: IPublicTypeSkeletonConfig): number | undefined;
|
||||
|
||||
/**
|
||||
* 展示指定 Panel 实例
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user