various widget refactorings

This commit is contained in:
zadam
2020-02-02 20:02:08 +01:00
parent 62a80ef016
commit 7c6cd63a53
17 changed files with 158 additions and 157 deletions

View File

@@ -1,4 +1,3 @@
import utils from "../services/utils.js";
import TabAwareWidget from "./tab_aware_widget.js";
const WIDGET_TPL = `
@@ -21,7 +20,7 @@ const WIDGET_TPL = `
</div>
`;
class CollapsibleWidget extends TabAwareWidget {
export default class CollapsibleWidget extends TabAwareWidget {
getWidgetTitle() { return "Untitled widget"; }
getHeaderActions() { return []; }
@@ -30,7 +29,7 @@ class CollapsibleWidget extends TabAwareWidget {
getMaxHeight() { return null; }
render() {
doRender() {
this.$widget = $(WIDGET_TPL);
this.$widget.find('[data-target]').attr('data-target', "#" + this.componentId);
@@ -69,23 +68,15 @@ class CollapsibleWidget extends TabAwareWidget {
this.$headerActions = this.$widget.find('.widget-header-actions');
this.$headerActions.append(...this.getHeaderActions());
this.initialized = this.renderBody();
this.initialized = this.doRenderBody();
return this.$widget;
}
async renderBody() {
await this.doRenderBody();
}
/** for overriding */
async doRenderBody() {}
isExpanded() {
return this.$bodyWrapper.hasClass("show");
}
cleanup() {}
}
export default CollapsibleWidget;
}