[DE] Fix focus for overlapping windows
This commit is contained in:
parent
1cb3bcdea9
commit
198c25e580
|
@ -131,7 +131,8 @@ Common.UI.FocusManager = function (tabindex, parent) {
|
||||||
|
|
||||||
Common.UI.FocusManager2 = new(function() {
|
Common.UI.FocusManager2 = new(function() {
|
||||||
var _tabindex = 1,
|
var _tabindex = 1,
|
||||||
_windows = [];
|
_windows = [],
|
||||||
|
_count = 0;
|
||||||
|
|
||||||
var register = function(fields) {
|
var register = function(fields) {
|
||||||
var arr = [];
|
var arr = [];
|
||||||
|
@ -184,6 +185,17 @@ Common.UI.FocusManager2 = new(function() {
|
||||||
current.traps = [trapFirst, trapLast];
|
current.traps = [trapFirst, trapLast];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var updateTabIndexes = function(increment) {
|
||||||
|
var step = increment ? 1 : -1;
|
||||||
|
for (var cid in _windows) {
|
||||||
|
if (_windows.hasOwnProperty(cid)) {
|
||||||
|
var item = _windows[cid];
|
||||||
|
if (item && item.index < _count-1 && item.traps)
|
||||||
|
item.traps[1].attr('tabindex', (parseInt(item.traps[1].attr('tabindex')) + step).toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
var _add = function(e, fields) {
|
var _add = function(e, fields) {
|
||||||
if (e && e.cid) {
|
if (e && e.cid) {
|
||||||
if (_windows[e.cid]) {
|
if (_windows[e.cid]) {
|
||||||
|
@ -192,7 +204,8 @@ Common.UI.FocusManager2 = new(function() {
|
||||||
_windows[e.cid] = {
|
_windows[e.cid] = {
|
||||||
parent: e,
|
parent: e,
|
||||||
fields: register(fields),
|
fields: register(fields),
|
||||||
hidden: false
|
hidden: false,
|
||||||
|
index: _count++
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
addTraps(_windows[e.cid]);
|
addTraps(_windows[e.cid]);
|
||||||
|
@ -207,8 +220,10 @@ Common.UI.FocusManager2 = new(function() {
|
||||||
} else {
|
} else {
|
||||||
_windows[e.cid] = {
|
_windows[e.cid] = {
|
||||||
parent: e,
|
parent: e,
|
||||||
hidden: false
|
hidden: false,
|
||||||
|
index: _count++
|
||||||
};
|
};
|
||||||
|
updateTabIndexes(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -220,7 +235,9 @@ Common.UI.FocusManager2 = new(function() {
|
||||||
},
|
},
|
||||||
'modal:close': function(e, last) {
|
'modal:close': function(e, last) {
|
||||||
if (e && e.cid && _windows[e.cid]) {
|
if (e && e.cid && _windows[e.cid]) {
|
||||||
|
updateTabIndexes(false);
|
||||||
delete _windows[e.cid];
|
delete _windows[e.cid];
|
||||||
|
_count--;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'modal:hide': function(e, last) {
|
'modal:hide': function(e, last) {
|
||||||
|
|
|
@ -53,8 +53,7 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template',
|
||||||
contentWidth: 310,
|
contentWidth: 310,
|
||||||
height: 392,
|
height: 392,
|
||||||
toggleGroup: 'control-adv-settings-group',
|
toggleGroup: 'control-adv-settings-group',
|
||||||
storageName: 'de-control-settings-adv-category',
|
storageName: 'de-control-settings-adv-category'
|
||||||
focusManager: true
|
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize : function(options) {
|
initialize : function(options) {
|
||||||
|
@ -350,20 +349,17 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template',
|
||||||
this.spnWidth.setDisabled(!checked);
|
this.spnWidth.setDisabled(!checked);
|
||||||
}, this));
|
}, this));
|
||||||
|
|
||||||
// 0 tab
|
|
||||||
this.focusManager.add([this.txtName, this.txtTag, this.txtPlaceholder, this.cmbShow], '.form-control');
|
|
||||||
|
|
||||||
// 2 tab
|
|
||||||
this.focusManager.add([this.list], '.listview');
|
|
||||||
|
|
||||||
// 3 tab
|
|
||||||
this.focusManager.add([this.txtDate], '.form-control');
|
|
||||||
this.focusManager.add([this.listFormats], '.listview');
|
|
||||||
this.focusManager.add([this.cmbLang], '.form-control');
|
|
||||||
|
|
||||||
this.afterRender();
|
this.afterRender();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getFocusedComponents: function() {
|
||||||
|
return [
|
||||||
|
this.txtName, this.txtTag, this.txtPlaceholder, this.cmbShow, // 0 tab
|
||||||
|
{cmp: this.list, selector: '.listview'}, // 2 tab
|
||||||
|
this.txtDate, {cmp: this.listFormats, selector: '.listview'}, this.cmbLang // 3 tab
|
||||||
|
];
|
||||||
|
},
|
||||||
|
|
||||||
onCategoryClick: function(btn, index) {
|
onCategoryClick: function(btn, index) {
|
||||||
Common.Views.AdvancedSettingsWindow.prototype.onCategoryClick.call(this, btn, index);
|
Common.Views.AdvancedSettingsWindow.prototype.onCategoryClick.call(this, btn, index);
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,7 @@ define([
|
||||||
width: 330,
|
width: 330,
|
||||||
header: false,
|
header: false,
|
||||||
cls: 'modal-dlg',
|
cls: 'modal-dlg',
|
||||||
buttons: ['ok', 'cancel'],
|
buttons: ['ok', 'cancel']
|
||||||
focusManager: true
|
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize : function(options) {
|
initialize : function(options) {
|
||||||
|
@ -124,8 +123,10 @@ define([
|
||||||
|
|
||||||
var $window = this.getChild();
|
var $window = this.getChild();
|
||||||
$window.find('.btn').on('click', _.bind(this.onBtnClick, this));
|
$window.find('.btn').on('click', _.bind(this.onBtnClick, this));
|
||||||
|
},
|
||||||
|
|
||||||
this.focusManager.add([this.inputName, this.inputValue], '.form-control');
|
getFocusedComponents: function() {
|
||||||
|
return [this.inputName, this.inputValue];
|
||||||
},
|
},
|
||||||
|
|
||||||
show: function() {
|
show: function() {
|
||||||
|
|
Loading…
Reference in a new issue