Skip to content

Commit c905aa2

Browse files
liujupingJackLian
authored andcommitted
feat: added detailed definition of some skeleton.add parameters
1 parent ac21100 commit c905aa2

File tree

4 files changed

+14
-16
lines changed

4 files changed

+14
-16
lines changed

packages/editor-skeleton/src/skeleton.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
PluginClassSet,
2727
IPublicTypeWidgetBaseConfig,
2828
IPublicTypeWidgetConfigArea,
29+
IPublicTypeSkeletonConfig,
2930
} from '@alilc/lowcode-types';
3031

3132
const logger = new Logger({ level: 'warn', bizName: 'skeleton' });
@@ -66,6 +67,8 @@ export class Skeleton {
6667

6768
readonly stages: Area<StageConfig, Stage>;
6869

70+
readonly widgets: IWidget[] = [];
71+
6972
constructor(readonly editor: Editor, readonly viewName: string = 'global') {
7073
makeObservable(this);
7174
this.leftArea = new Area(
@@ -179,6 +182,7 @@ export class Skeleton {
179182
this.setupPlugins();
180183
this.setupEvents();
181184
}
185+
182186
/**
183187
* setup events
184188
*
@@ -277,8 +281,6 @@ export class Skeleton {
277281
this.editor.eventBus.emit(event, ...args);
278282
}
279283

280-
readonly widgets: IWidget[] = [];
281-
282284
createWidget(config: IPublicTypeWidgetBaseConfig | IWidget) {
283285
if (isWidget(config)) {
284286
return config;
@@ -377,7 +379,7 @@ export class Skeleton {
377379
return restConfig;
378380
}
379381

380-
add(config: IPublicTypeWidgetBaseConfig, extraConfig?: Record<string, any>) {
382+
add(config: IPublicTypeSkeletonConfig, extraConfig?: Record<string, any>) {
381383
const parsedConfig = {
382384
...this.parseConfig(config),
383385
...extraConfig,

packages/editor-skeleton/src/types.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
TipContent,
77
IPublicTypeWidgetConfigArea,
88
IPublicTypeWidgetBaseConfig,
9+
IPublicTypePanelDockPanelProps,
910
} from '@alilc/lowcode-types';
1011
import { IWidget } from './widget/widget';
1112

@@ -63,8 +64,8 @@ export function isDockConfig(obj: any): obj is DockConfig {
6364
export interface DialogDockConfig extends IDockBaseConfig {
6465
type: 'DialogDock';
6566
dialogProps?: {
66-
title?: IPublicTypeTitleContent;
6767
[key: string]: any;
68+
title?: IPublicTypeTitleContent;
6869
};
6970
}
7071

@@ -85,16 +86,11 @@ export function isPanelConfig(obj: any): obj is PanelConfig {
8586

8687
export type HelpTipConfig = string | { url?: string; content?: string | ReactElement };
8788

88-
export interface PanelProps {
89+
export interface PanelProps extends IPublicTypePanelDockPanelProps {
8990
title?: IPublicTypeTitleContent;
9091
icon?: any; // 冗余字段
9192
description?: string | IPublicTypeI18nData;
92-
hideTitleBar?: boolean; // panel.props 兼容,不暴露
9393
help?: HelpTipConfig; // 显示问号帮助
94-
width?: number; // panel.props
95-
height?: number; // panel.props
96-
maxWidth?: number; // panel.props
97-
maxHeight?: number; // panel.props
9894
hiddenWhenInit?: boolean; // when this is true, by default will be hidden
9995
condition?: (widget: IWidget) => any;
10096
onInit?: (widget: IWidget) => any;

packages/shell/src/api/skeleton.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
SkeletonEvents,
55
} from '@alilc/lowcode-editor-skeleton';
66
import { skeletonSymbol } from '../symbols';
7-
import { IPublicApiSkeleton, IPublicTypeDisposable, IPublicTypeWidgetBaseConfig, IPublicTypeWidgetConfigArea } from '@alilc/lowcode-types';
7+
import { IPublicApiSkeleton, IPublicTypeDisposable, IPublicTypeSkeletonConfig, IPublicTypeWidgetConfigArea } from '@alilc/lowcode-types';
88

99
const innerSkeletonSymbol = Symbol('skeleton');
1010
export class Skeleton implements IPublicApiSkeleton {
@@ -38,7 +38,7 @@ export class Skeleton implements IPublicApiSkeleton {
3838
* @param extraConfig
3939
* @returns
4040
*/
41-
add(config: IPublicTypeWidgetBaseConfig, extraConfig?: Record<string, any>) {
41+
add(config: IPublicTypeSkeletonConfig, extraConfig?: Record<string, any>) {
4242
const configWithName = {
4343
...config,
4444
pluginName: this.pluginName,
@@ -51,7 +51,7 @@ export class Skeleton implements IPublicApiSkeleton {
5151
* @param config
5252
* @returns
5353
*/
54-
remove(config: IPublicTypeWidgetBaseConfig): number | undefined {
54+
remove(config: IPublicTypeSkeletonConfig): number | undefined {
5555
const { area, name } = config;
5656
const skeleton = this[skeletonSymbol];
5757
if (!normalizeArea(area)) {

packages/types/src/shell/api/skeleton.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { IPublicTypeDisposable, IPublicTypeWidgetBaseConfig } from '../type';
1+
import { IPublicTypeDisposable, IPublicTypeSkeletonConfig } from '../type';
22

33
export interface IPublicApiSkeleton {
44

@@ -9,15 +9,15 @@ export interface IPublicApiSkeleton {
99
* @param extraConfig
1010
* @returns
1111
*/
12-
add(config: IPublicTypeWidgetBaseConfig, extraConfig?: Record<string, any>): any;
12+
add(config: IPublicTypeSkeletonConfig, extraConfig?: Record<string, any>): any;
1313

1414
/**
1515
* 移除一个面板实例
1616
* remove a panel
1717
* @param config
1818
* @returns
1919
*/
20-
remove(config: IPublicTypeWidgetBaseConfig): number | undefined;
20+
remove(config: IPublicTypeSkeletonConfig): number | undefined;
2121

2222
/**
2323
* 展示指定 Panel 实例

0 commit comments

Comments
 (0)