Fix positon option in et2_dialog widget

This commit is contained in:
Hadi Nategh 2020-04-07 14:51:46 +02:00
parent 599393ffbe
commit 99a9513236
2 changed files with 19 additions and 7 deletions

View File

@ -348,6 +348,12 @@ var et2_dialog = /** @class */ (function (_super) {
this.set_dialog_type(this.options.dialog_type);
}
this.set_buttons(typeof this.options.buttons == "number" ? this._buttons[this.options.buttons] : this.options.buttons);
var position_my, position_at = '';
if (this.options.position) {
var positions = this.options.position.split(',');
position_my = positions[0] ? positions[0].trim() : 'center';
position_at = positions[1] ? positions[1].trim() : position_my;
}
var options = {
// Pass the internal object, not the option
buttons: this.options.buttons,
@ -363,8 +369,8 @@ var et2_dialog = /** @class */ (function (_super) {
jQuery(this).parents('.ui-dialog-buttonpane button[default]').focus();
window.setTimeout(function () {
jQuery(this).dialog('option', 'position', {
my: "center",
at: "center",
my: position_my,
at: position_at,
of: window
});
}.bind(this), 0);
@ -374,7 +380,7 @@ var et2_dialog = /** @class */ (function (_super) {
}, this),
beforeClose: this.options.beforeClose,
closeText: this.egw().lang('close'),
position: { my: this.options.position, at: this.options.position, of: window }
position: { my: "center", at: "center", of: window }
};
// Leaving width unset lets it size itself according to contents
if (this.options.width) {

View File

@ -479,7 +479,13 @@ export class et2_dialog extends et2_widget {
this.set_dialog_type(this.options.dialog_type);
}
this.set_buttons(typeof this.options.buttons == "number" ? this._buttons[this.options.buttons] : this.options.buttons);
let position_my, position_at = '';
if (this.options.position)
{
let positions = this.options.position.split(',');
position_my = positions[0] ? positions[0].trim() : 'center';
position_at = positions[1] ? positions[1].trim() : position_my;
}
let options = {
// Pass the internal object, not the option
buttons: this.options.buttons,
@ -495,8 +501,8 @@ export class et2_dialog extends et2_widget {
jQuery(this).parents('.ui-dialog-buttonpane button[default]').focus();
window.setTimeout(function () {
jQuery(this).dialog('option', 'position', {
my: "center",
at: "center",
my: position_my,
at: position_at,
of: window
});
}.bind(this), 0);
@ -506,7 +512,7 @@ export class et2_dialog extends et2_widget {
}, this),
beforeClose: this.options.beforeClose,
closeText: this.egw().lang('close'),
position: {my: this.options.position, at: this.options.position, of: window}
position: {my: "center", at: "center", of: window}
};
// Leaving width unset lets it size itself according to contents
if (this.options.width) {