fix(ux): hide card if clicked outside
This commit is contained in:
parent
2ae0da7903
commit
4040841fd1
2 changed files with 16 additions and 5 deletions
|
|
@ -52,5 +52,10 @@ export class InfoCard {
|
|||
event.preventDefault();
|
||||
me.card.toggle();
|
||||
});
|
||||
$(document).on("click", function (e) {
|
||||
if (!e.originalEvent.composedPath().includes(me.label_area)) {
|
||||
me.card.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,14 +38,20 @@ frappe.ui.SidebarCard = class SidebarCard {
|
|||
}
|
||||
toggle() {
|
||||
if (this.display) {
|
||||
this.display = false;
|
||||
this.parent.removeAttr("data-show");
|
||||
this.hide();
|
||||
} else {
|
||||
this.display = true;
|
||||
this.parent.attr("data-show", "");
|
||||
this.popper.update();
|
||||
this.show();
|
||||
}
|
||||
}
|
||||
hide() {
|
||||
this.display = false;
|
||||
this.parent.removeAttr("data-show");
|
||||
}
|
||||
show() {
|
||||
this.display = true;
|
||||
this.parent.attr("data-show", "");
|
||||
this.popper.update();
|
||||
}
|
||||
setup_primary_action() {
|
||||
const me = this;
|
||||
this.card.find(".sidebar-card-button").on("click", function (event) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue