mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-14 21:12:53 +00:00
feat: add warning message when adding duplicate skeleton
This commit is contained in:
parent
bc5ec03884
commit
e415ff6782
@ -1,9 +1,12 @@
|
||||
/* eslint-disable max-len */
|
||||
import { obx, computed, makeObservable } from '@alilc/lowcode-editor-core';
|
||||
import { Logger } from '@alilc/lowcode-utils';
|
||||
import { IPublicTypeWidgetBaseConfig, IArea } from '@alilc/lowcode-types';
|
||||
import { WidgetContainer } from './widget/widget-container';
|
||||
import { Skeleton } from './skeleton';
|
||||
import { IWidget } from './widget/widget';
|
||||
import { IPublicTypeWidgetBaseConfig, IArea } from '@alilc/lowcode-types';
|
||||
|
||||
const logger = new Logger({ level: 'warn', bizName: 'skeleton:area' });
|
||||
|
||||
export class Area<C extends IPublicTypeWidgetBaseConfig = any, T extends IWidget = IWidget> implements IArea<C, T> {
|
||||
@obx private _visible = true;
|
||||
@ -36,6 +39,7 @@ export class Area<C extends IPublicTypeWidgetBaseConfig = any, T extends IWidget
|
||||
add(config: T | C): T {
|
||||
const item = this.container.get(config.name);
|
||||
if (item) {
|
||||
logger.warn(`The ${config.name} has already been added to skeleton.`);
|
||||
return item;
|
||||
}
|
||||
return this.container.add(config);
|
||||
|
||||
@ -11,7 +11,7 @@ export class Skeleton implements IPublicApiSkeleton {
|
||||
private readonly [innerSkeletonSymbol]: InnerSkeleton;
|
||||
private readonly pluginName: string;
|
||||
|
||||
get [skeletonSymbol]() {
|
||||
get [skeletonSymbol](): InnerSkeleton {
|
||||
if (this.workspaceMode) {
|
||||
return this[innerSkeletonSymbol];
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user