| 11 | import { isPanelDock, PanelDock } from './panel-dock'; |
| 12 | |
| 13 | export class Panel implements IWidget { |
| 14 | readonly isWidget = true; |
| 15 | |
| 16 | readonly name: string; |
| 17 | |
| 18 | readonly id: string; |
| 19 | |
| 20 | @obx.ref inited = false; |
| 21 | |
| 22 | @obx.ref private _actived = false; |
| 23 | |
| 24 | private emitter: IEventBus = createModuleEventBus('Panel'); |
| 25 | |
| 26 | @computed get actived(): boolean { |
| 27 | return this._actived; |
| 28 | } |
| 29 | |
| 30 | @computed get visible(): boolean { |
| 31 | if (!this.parent || this.parent.visible) { |
| 32 | const { props } = this.config; |
| 33 | if (props?.condition) { |
| 34 | return props.condition(this); |
| 35 | } |
| 36 | return this._actived; |
| 37 | } |
| 38 | return false; |
| 39 | } |
| 40 | |
| 41 | readonly isPanel = true; |
| 42 | |
| 43 | get body() { |
| 44 | if (this.container) { |
| 45 | return createElement(TabsPanelView, { |
| 46 | container: this.container, |
| 47 | shouldHideSingleTab: true, |
| 48 | }); |
| 49 | } |
| 50 | |
| 51 | const { content, contentProps } = this.config; |
| 52 | return createContent(content, { |
| 53 | ...contentProps, |
| 54 | editor: getEvent(this.skeleton.editor), |
| 55 | config: this.config, |
| 56 | panel: this, |
| 57 | pane: this, |
| 58 | }); |
| 59 | } |
| 60 | |
| 61 | get content(): ReactNode { |
| 62 | const area = this.config?.area || this.parent?.name; |
| 63 | if (this.plain) { |
| 64 | return createElement(PanelView, { |
| 65 | panel: this, |
| 66 | key: this.id, |
| 67 | area, |
| 68 | }); |
| 69 | } |
| 70 | return createElement(TitledPanelView, { panel: this, key: this.id, area }); |
nothing calls this directly
no test coverage detected
searching dependent graphs…