44 SkeletonEvents ,
55} from '@alilc/lowcode-editor-skeleton' ;
66import { skeletonSymbol } from '../symbols' ;
7- import { IPublicApiSkeleton , IPublicTypeDisposable , IPublicTypeSkeletonConfig , IPublicTypeWidgetConfigArea } from '@alilc/lowcode-types' ;
7+ import { IPublicApiSkeleton , IPublicModelSkeletonItem , IPublicTypeDisposable , IPublicTypeSkeletonConfig , IPublicTypeWidgetConfigArea } from '@alilc/lowcode-types' ;
88import { getLogger } from '@alilc/lowcode-utils' ;
9+ import { SkeletonItem } from '../model/skeleton-item' ;
910
1011const innerSkeletonSymbol = Symbol ( 'skeleton' ) ;
1112
@@ -46,12 +47,15 @@ export class Skeleton implements IPublicApiSkeleton {
4647 * @param extraConfig
4748 * @returns
4849 */
49- add ( config : IPublicTypeSkeletonConfig , extraConfig ?: Record < string , any > ) {
50+ add ( config : IPublicTypeSkeletonConfig , extraConfig ?: Record < string , any > ) : IPublicModelSkeletonItem | undefined {
5051 const configWithName = {
5152 ...config ,
5253 pluginName : this . pluginName ,
5354 } ;
54- return this [ skeletonSymbol ] . add ( configWithName , extraConfig ) ;
55+ const item = this [ skeletonSymbol ] . add ( configWithName , extraConfig ) ;
56+ if ( item ) {
57+ return new SkeletonItem ( item ) ;
58+ }
5559 }
5660
5761 /**
@@ -68,6 +72,10 @@ export class Skeleton implements IPublicApiSkeleton {
6872 skeleton [ normalizeArea ( area ) ] . container ?. remove ( name ) ;
6973 }
7074
75+ getAreaItems ( areaName : IPublicTypeWidgetConfigArea ) : IPublicModelSkeletonItem [ ] {
76+ return this [ skeletonSymbol ] [ normalizeArea ( areaName ) ] . container . items ?. map ( d => new SkeletonItem ( d ) ) ;
77+ }
78+
7179 /**
7280 * 显示面板
7381 * @param name
@@ -193,7 +201,7 @@ export class Skeleton implements IPublicApiSkeleton {
193201 }
194202}
195203
196- function normalizeArea ( area : IPublicTypeWidgetConfigArea | undefined ) : 'leftArea' | 'rightArea' | 'topArea' | 'toolbar' | 'mainArea' | 'bottomArea' | 'leftFixedArea' | 'leftFloatArea' | 'stages' {
204+ function normalizeArea ( area : IPublicTypeWidgetConfigArea | undefined ) : 'leftArea' | 'rightArea' | 'topArea' | 'toolbar' | 'mainArea' | 'bottomArea' | 'leftFixedArea' | 'leftFloatArea' | 'stages' | 'subTopArea' {
197205 switch ( area ) {
198206 case 'leftArea' :
199207 case 'left' :
@@ -220,6 +228,8 @@ function normalizeArea(area: IPublicTypeWidgetConfigArea | undefined): 'leftArea
220228 return 'leftFloatArea' ;
221229 case 'stages' :
222230 return 'stages' ;
231+ case 'subTopArea' :
232+ return 'subTopArea' ;
223233 default :
224234 throw new Error ( `${ area } not supported` ) ;
225235 }
0 commit comments