import BasicWidget from "../basic_widget.js"; const TPL = `
`; export default class RightDropdownButtonWidget extends BasicWidget { constructor(iconClass, title, dropdownTpl) { super(); this.iconClass = iconClass; this.title = title; this.dropdownTpl = dropdownTpl; } doRender() { this.$widget = $(TPL); const $button = this.$widget.find(".right-dropdown-button") .addClass(this.iconClass) .attr("title", this.title) .tooltip({ trigger: "hover" }) .on("click", () => $button.tooltip("hide")); this.$widget.on('show.bs.dropdown', () => this.dropdown()); this.$dropdownContent = $(this.dropdownTpl); this.$widget.find(".dropdown-menu").append(this.$dropdownContent); } // to be overriden dropdown() {} hideDropdown() { this.$widget.dropdown("hide"); } }