feat: Adding option to centre frappe dialog box [skip docs]
This commit is contained in:
parent
95372df01a
commit
00453d7958
2 changed files with 12 additions and 1 deletions
|
|
@ -14,7 +14,7 @@ frappe.ui.Dialog = class Dialog extends frappe.ui.FieldGroup {
|
|||
this.is_dialog = true;
|
||||
this.last_focus = null;
|
||||
|
||||
$.extend(this, { animate: true, size: null, auto_make: true }, opts);
|
||||
$.extend(this, { animate: true, size: null, auto_make: true, centered: false }, opts);
|
||||
if (this.auto_make) {
|
||||
this.make();
|
||||
}
|
||||
|
|
@ -34,6 +34,7 @@ frappe.ui.Dialog = class Dialog extends frappe.ui.FieldGroup {
|
|||
if (!this.size) this.set_modal_size();
|
||||
|
||||
this.wrapper = this.$wrapper.find(".modal-dialog").get(0);
|
||||
if (this.centered) $(this.wrapper).addClass("modal-dialog-centered");
|
||||
if (this.size == "small") $(this.wrapper).addClass("modal-sm");
|
||||
else if (this.size == "large") $(this.wrapper).addClass("modal-lg");
|
||||
else if (this.size == "extra-large") $(this.wrapper).addClass("modal-xl");
|
||||
|
|
|
|||
|
|
@ -345,3 +345,13 @@ body.modal-open[style^="padding-right"] {
|
|||
}
|
||||
}
|
||||
}
|
||||
.modal-dialog-centered {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-height: calc(100% - 1rem);
|
||||
}
|
||||
@media (min-width: 576px) {
|
||||
.modal-dialog-centered {
|
||||
min-height: calc(100% - 3.5rem);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue