2020-02-05 05:46:17 +08:00
|
|
|
import BasicWidget from "./basic_widget.js";
|
2020-02-06 05:08:45 +08:00
|
|
|
import options from "../services/options.js";
|
2020-02-05 05:46:17 +08:00
|
|
|
|
|
|
|
export default class SidePaneContainer extends BasicWidget {
|
|
|
|
constructor(appContext, side, widgets) {
|
|
|
|
super(appContext);
|
|
|
|
|
|
|
|
this.side = side;
|
|
|
|
this.children = widgets;
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
this.$widget = $(`<div id="${this.side}-pane" style="display: flex; flex-direction: column;">`);
|
|
|
|
|
|
|
|
for (const widget of this.children) {
|
|
|
|
this.$widget.append(widget.render());
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.$widget;
|
|
|
|
}
|
|
|
|
|
2020-02-06 05:08:45 +08:00
|
|
|
eventReceived(name, data, sync = false) {
|
2020-02-05 05:46:17 +08:00
|
|
|
if (options.is(this.side + 'PaneVisible')) {
|
|
|
|
super.eventReceived(name, data, sync);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sidebarVisibilityChangedListener({side, show}) {
|
|
|
|
if (this.side === side) {
|
|
|
|
this.toggle(show);
|
|
|
|
|
|
|
|
this.eventReceived('lazyLoaded');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|