MCPcopy Create free account
hub / github.com/alibaba/lowcode-engine / constructor

Method constructor

packages/editor-skeleton/src/widget/panel.ts:83–115  ·  view source on GitHub ↗
(readonly skeleton: ISkeleton, readonly config: IPublicTypePanelConfig)

Source from the content-addressed store, hash-verified

81 @obx.ref public parent?: WidgetContainer;
82
83 constructor(readonly skeleton: ISkeleton, readonly config: IPublicTypePanelConfig) {
84 makeObservable(this);
85 const { name, content, props = {} } = config;
86 const { hideTitleBar, title, icon, description, help } = props;
87 this.name = name;
88 this.id = uniqueId(`pane:${name}$`);
89 this.title = composeTitle(title || name, icon, description);
90 this.plain = hideTitleBar || !title;
91 this.help = help;
92 if (Array.isArray(content)) {
93 this.container = this.skeleton.createContainer(
94 name,
95 (item) => {
96 if (isPanel(item)) {
97 return item;
98 }
99 return this.skeleton.createPanel(item);
100 },
101 true,
102 () => this.visible,
103 true,
104 );
105 content.forEach((item) => this.add(item));
106 }
107 if (props.onInit) {
108 props.onInit.call(this, this);
109 }
110
111 if (typeof content !== 'string' && content && content.onInit) {
112 content.onInit.call(this, this);
113 }
114 // todo: process shortcut
115 }
116
117 setParent(parent: WidgetContainer) {
118 if (parent === this.parent) {

Callers

nothing calls this directly

Calls 7

addMethod · 0.95
composeTitleFunction · 0.90
uniqueIdFunction · 0.85
isPanelFunction · 0.85
createContainerMethod · 0.65
createPanelMethod · 0.65
forEachMethod · 0.65

Tested by

no test coverage detected