forked from extern/egroupware
Fix positon option in et2_dialog widget
This commit is contained in:
parent
599393ffbe
commit
99a9513236
@ -348,6 +348,12 @@ var et2_dialog = /** @class */ (function (_super) {
|
|||||||
this.set_dialog_type(this.options.dialog_type);
|
this.set_dialog_type(this.options.dialog_type);
|
||||||
}
|
}
|
||||||
this.set_buttons(typeof this.options.buttons == "number" ? this._buttons[this.options.buttons] : this.options.buttons);
|
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 = {
|
var options = {
|
||||||
// Pass the internal object, not the option
|
// Pass the internal object, not the option
|
||||||
buttons: this.options.buttons,
|
buttons: this.options.buttons,
|
||||||
@ -363,8 +369,8 @@ var et2_dialog = /** @class */ (function (_super) {
|
|||||||
jQuery(this).parents('.ui-dialog-buttonpane button[default]').focus();
|
jQuery(this).parents('.ui-dialog-buttonpane button[default]').focus();
|
||||||
window.setTimeout(function () {
|
window.setTimeout(function () {
|
||||||
jQuery(this).dialog('option', 'position', {
|
jQuery(this).dialog('option', 'position', {
|
||||||
my: "center",
|
my: position_my,
|
||||||
at: "center",
|
at: position_at,
|
||||||
of: window
|
of: window
|
||||||
});
|
});
|
||||||
}.bind(this), 0);
|
}.bind(this), 0);
|
||||||
@ -374,7 +380,7 @@ var et2_dialog = /** @class */ (function (_super) {
|
|||||||
}, this),
|
}, this),
|
||||||
beforeClose: this.options.beforeClose,
|
beforeClose: this.options.beforeClose,
|
||||||
closeText: this.egw().lang('close'),
|
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
|
// Leaving width unset lets it size itself according to contents
|
||||||
if (this.options.width) {
|
if (this.options.width) {
|
||||||
|
@ -479,7 +479,13 @@ export class et2_dialog extends et2_widget {
|
|||||||
this.set_dialog_type(this.options.dialog_type);
|
this.set_dialog_type(this.options.dialog_type);
|
||||||
}
|
}
|
||||||
this.set_buttons(typeof this.options.buttons == "number" ? this._buttons[this.options.buttons] : this.options.buttons);
|
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 = {
|
let options = {
|
||||||
// Pass the internal object, not the option
|
// Pass the internal object, not the option
|
||||||
buttons: this.options.buttons,
|
buttons: this.options.buttons,
|
||||||
@ -495,8 +501,8 @@ export class et2_dialog extends et2_widget {
|
|||||||
jQuery(this).parents('.ui-dialog-buttonpane button[default]').focus();
|
jQuery(this).parents('.ui-dialog-buttonpane button[default]').focus();
|
||||||
window.setTimeout(function () {
|
window.setTimeout(function () {
|
||||||
jQuery(this).dialog('option', 'position', {
|
jQuery(this).dialog('option', 'position', {
|
||||||
my: "center",
|
my: position_my,
|
||||||
at: "center",
|
at: position_at,
|
||||||
of: window
|
of: window
|
||||||
});
|
});
|
||||||
}.bind(this), 0);
|
}.bind(this), 0);
|
||||||
@ -506,7 +512,7 @@ export class et2_dialog extends et2_widget {
|
|||||||
}, this),
|
}, this),
|
||||||
beforeClose: this.options.beforeClose,
|
beforeClose: this.options.beforeClose,
|
||||||
closeText: this.egw().lang('close'),
|
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
|
// Leaving width unset lets it size itself according to contents
|
||||||
if (this.options.width) {
|
if (this.options.width) {
|
||||||
|
Loading…
Reference in New Issue
Block a user