GeezerVison is showing github.com — feat: added detailed definition of some skeleton.add parameters · flydoing/lowcode-engine@c905aa2
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: packages/editor-skeleton/src/skeleton.ts +5-3Lines changed: 5 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -26,6 +26,7 @@ import { | 26 | 26 | PluginClassSet, | 27 | 27 | IPublicTypeWidgetBaseConfig, | 28 | 28 | IPublicTypeWidgetConfigArea, | | 29 | + IPublicTypeSkeletonConfig, | 29 | 30 | } from '@alilc/lowcode-types'; | 30 | 31 |
| 31 | 32 | const logger = new Logger({ level: 'warn', bizName: 'skeleton' }); | @@ -66,6 +67,8 @@ export class Skeleton { | 66 | 67 |
| 67 | 68 | readonly stages: Area<StageConfig, Stage>; | 68 | 69 |
| | 70 | + readonly widgets: IWidget[] = []; | | 71 | + | 69 | 72 | constructor(readonly editor: Editor, readonly viewName: string = 'global') { | 70 | 73 | makeObservable(this); | 71 | 74 | this.leftArea = new Area( | @@ -179,6 +182,7 @@ export class Skeleton { | 179 | 182 | this.setupPlugins(); | 180 | 183 | this.setupEvents(); | 181 | 184 | } | | 185 | + | 182 | 186 | /** | 183 | 187 | * setup events | 184 | 188 | * | @@ -277,8 +281,6 @@ export class Skeleton { | 277 | 281 | this.editor.eventBus.emit(event, ...args); | 278 | 282 | } | 279 | 283 |
| 280 | | - readonly widgets: IWidget[] = []; | 281 | | - | 282 | 284 | createWidget(config: IPublicTypeWidgetBaseConfig | IWidget) { | 283 | 285 | if (isWidget(config)) { | 284 | 286 | return config; | @@ -377,7 +379,7 @@ export class Skeleton { | 377 | 379 | return restConfig; | 378 | 380 | } | 379 | 381 |
| 380 | | - add(config: IPublicTypeWidgetBaseConfig, extraConfig?: Record<string, any>) { | | 382 | + add(config: IPublicTypeSkeletonConfig, extraConfig?: Record<string, any>) { | 381 | 383 | const parsedConfig = { | 382 | 384 | ...this.parseConfig(config), | 383 | 385 | ...extraConfig, | |
Collapse file Copy file name to clipboardExpand all lines: packages/editor-skeleton/src/types.ts +3-7Lines changed: 3 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 6 | 6 | TipContent, | 7 | 7 | IPublicTypeWidgetConfigArea, | 8 | 8 | IPublicTypeWidgetBaseConfig, | | 9 | + IPublicTypePanelDockPanelProps, | 9 | 10 | } from '@alilc/lowcode-types'; | 10 | 11 | import { IWidget } from './widget/widget'; | 11 | 12 |
| @@ -63,8 +64,8 @@ export function isDockConfig(obj: any): obj is DockConfig { | 63 | 64 | export interface DialogDockConfig extends IDockBaseConfig { | 64 | 65 | type: 'DialogDock'; | 65 | 66 | dialogProps?: { | 66 | | - title?: IPublicTypeTitleContent; | 67 | 67 | [key: string]: any; | | 68 | + title?: IPublicTypeTitleContent; | 68 | 69 | }; | 69 | 70 | } | 70 | 71 |
| @@ -85,16 +86,11 @@ export function isPanelConfig(obj: any): obj is PanelConfig { | 85 | 86 |
| 86 | 87 | export type HelpTipConfig = string | { url?: string; content?: string | ReactElement }; | 87 | 88 |
| 88 | | -export interface PanelProps { | | 89 | +export interface PanelProps extends IPublicTypePanelDockPanelProps { | 89 | 90 | title?: IPublicTypeTitleContent; | 90 | 91 | icon?: any; // 冗余字段 | 91 | 92 | description?: string | IPublicTypeI18nData; | 92 | | - hideTitleBar?: boolean; // panel.props 兼容,不暴露 | 93 | 93 | help?: HelpTipConfig; // 显示问号帮助 | 94 | | - width?: number; // panel.props | 95 | | - height?: number; // panel.props | 96 | | - maxWidth?: number; // panel.props | 97 | | - maxHeight?: number; // panel.props | 98 | 94 | hiddenWhenInit?: boolean; // when this is true, by default will be hidden | 99 | 95 | condition?: (widget: IWidget) => any; | 100 | 96 | onInit?: (widget: IWidget) => any; | |
Collapse file Copy file name to clipboardExpand all lines: packages/shell/src/api/skeleton.ts +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 4 | 4 | SkeletonEvents, | 5 | 5 | } from '@alilc/lowcode-editor-skeleton'; | 6 | 6 | import { skeletonSymbol } from '../symbols'; | 7 | | -import { IPublicApiSkeleton, IPublicTypeDisposable, IPublicTypeWidgetBaseConfig, IPublicTypeWidgetConfigArea } from '@alilc/lowcode-types'; | | 7 | +import { IPublicApiSkeleton, IPublicTypeDisposable, IPublicTypeSkeletonConfig, IPublicTypeWidgetConfigArea } from '@alilc/lowcode-types'; | 8 | 8 |
| 9 | 9 | const innerSkeletonSymbol = Symbol('skeleton'); | 10 | 10 | export class Skeleton implements IPublicApiSkeleton { | @@ -38,7 +38,7 @@ export class Skeleton implements IPublicApiSkeleton { | 38 | 38 | * @param extraConfig | 39 | 39 | * @returns | 40 | 40 | */ | 41 | | - add(config: IPublicTypeWidgetBaseConfig, extraConfig?: Record<string, any>) { | | 41 | + add(config: IPublicTypeSkeletonConfig, extraConfig?: Record<string, any>) { | 42 | 42 | const configWithName = { | 43 | 43 | ...config, | 44 | 44 | pluginName: this.pluginName, | @@ -51,7 +51,7 @@ export class Skeleton implements IPublicApiSkeleton { | 51 | 51 | * @param config | 52 | 52 | * @returns | 53 | 53 | */ | 54 | | - remove(config: IPublicTypeWidgetBaseConfig): number | undefined { | | 54 | + remove(config: IPublicTypeSkeletonConfig): number | undefined { | 55 | 55 | const { area, name } = config; | 56 | 56 | const skeleton = this[skeletonSymbol]; | 57 | 57 | if (!normalizeArea(area)) { | |
Collapse file Copy file name to clipboardExpand all lines: packages/types/src/shell/api/skeleton.ts +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -import { IPublicTypeDisposable, IPublicTypeWidgetBaseConfig } from '../type'; | | 1 | +import { IPublicTypeDisposable, IPublicTypeSkeletonConfig } from '../type'; | 2 | 2 |
| 3 | 3 | export interface IPublicApiSkeleton { | 4 | 4 |
| @@ -9,15 +9,15 @@ export interface IPublicApiSkeleton { | 9 | 9 | * @param extraConfig | 10 | 10 | * @returns | 11 | 11 | */ | 12 | | - add(config: IPublicTypeWidgetBaseConfig, extraConfig?: Record<string, any>): any; | | 12 | + add(config: IPublicTypeSkeletonConfig, extraConfig?: Record<string, any>): any; | 13 | 13 |
| 14 | 14 | /** | 15 | 15 | * 移除一个面板实例 | 16 | 16 | * remove a panel | 17 | 17 | * @param config | 18 | 18 | * @returns | 19 | 19 | */ | 20 | | - remove(config: IPublicTypeWidgetBaseConfig): number | undefined; | | 20 | + remove(config: IPublicTypeSkeletonConfig): number | undefined; | 21 | 21 |
| 22 | 22 | /** | 23 | 23 | * 展示指定 Panel 实例 | |
|