MCPcopy Index your code
hub / github.com/alibaba/lowcode-engine / createWidget

Method createWidget

packages/editor-skeleton/src/skeleton.ts:356–385  ·  view source on GitHub ↗
(config: IPublicTypeWidgetBaseConfig | IWidget)

Source from the content-addressed store, hash-verified

354 }
355
356 createWidget(config: IPublicTypeWidgetBaseConfig | IWidget) {
357 if (isWidget(config)) {
358 return config;
359 }
360
361 config = this.parseConfig(config);
362 let widget: IWidget;
363 if (isDockConfig(config)) {
364 if (isPanelDockConfig(config)) {
365 widget = new PanelDock(this, config);
366 } else if (false) {
367 // DialogDock
368 // others...
369 } else {
370 widget = new Dock(this, config);
371 }
372 } else if (isDividerConfig(config)) {
373 widget = new Widget(this, {
374 ...config,
375 type: 'Widget',
376 content: Divider,
377 });
378 } else if (isPanelConfig(config)) {
379 widget = this.createPanel(config);
380 } else {
381 widget = new Widget(this, config as WidgetConfig);
382 }
383 this.widgets.push(widget);
384 return widget;
385 }
386
387 getWidget(name: string): IWidget | undefined {
388 return this.widgets.find(widget => widget.name === name);

Callers 1

constructorMethod · 0.95

Calls 8

parseConfigMethod · 0.95
createPanelMethod · 0.95
isWidgetFunction · 0.90
isDockConfigFunction · 0.90
isPanelDockConfigFunction · 0.90
isDividerConfigFunction · 0.90
isPanelConfigFunction · 0.90
pushMethod · 0.80

Tested by

no test coverage detected