Refactoring focus manager for disabled components

This commit is contained in:
Julia Radzhabova 2020-09-26 00:43:43 +03:00
parent 2272003f44
commit 82ec0ba7a4
4 changed files with 17 additions and 7 deletions

View file

@ -100,7 +100,7 @@ Common.UI.FocusManager = function (tabindex, parent) {
this.trapFirst.on('focus', function() {
for (var i=0; i<me.fields.length; i++) {
var field = me.fields[i];
if (field.cmp.isVisible ? field.cmp.isVisible() : field.cmp.is(':visible')) {
if ((field.cmp.isVisible ? field.cmp.isVisible() : field.cmp.is(':visible')) && !(field.cmp.isDisabled && field.cmp.isDisabled())) {
var el = (field.selector) ? (field.cmp.$el || $(field.cmp.el)).find(field.selector).addBack().filter(field.selector) : field.el;
el.focus();
break;
@ -113,7 +113,7 @@ Common.UI.FocusManager = function (tabindex, parent) {
this.trapLast.on('focus', function() {
for (var i=me.fields.length-1; i>=0; i--) {
var field = me.fields[i];
if (field.cmp.isVisible ? field.cmp.isVisible() : field.cmp.is(':visible')) {
if ((field.cmp.isVisible ? field.cmp.isVisible() : field.cmp.is(':visible')) && !(field.cmp.isDisabled && field.cmp.isDisabled())) {
var el = (field.selector) ? (field.cmp.$el || $(field.cmp.el)).find(field.selector).addBack().filter(field.selector) : field.el;
el.focus();
break;

View file

@ -47,7 +47,8 @@ define([
options: {
width: 330,
cls: 'modal-dlg',
buttons: ['ok', 'cancel']
buttons: ['ok', 'cancel'],
focusManager: true
},
initialize : function(options) {
@ -95,6 +96,8 @@ define([
var $window = this.getChild();
$window.find('.btn').on('click', _.bind(this.onBtnClick, this));
this.focusManager.add([this.inputDecimalSeparator, this.inputThousandsSeparator], '.form-control');
this.afterRender();
},

View file

@ -48,7 +48,8 @@ define([
SSE.Views.CreatePivotDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({
options: {
contentWidth: 310,
height: 250
height: 250,
focusManager: true
},
initialize : function(options) {
@ -161,6 +162,8 @@ define([
me.txtDestRange.cmpEl.find('input').focus();
});
this.focusManager.add([this.txtSourceRange, this.txtDestRange], '.form-control');
this.afterRender();
},

View file

@ -52,7 +52,8 @@ define([
options: {
alias: 'NamedRangeEditDlg',
contentWidth: 380,
height: 250
height: 250,
focusManager: true
},
initialize: function (options) {
@ -150,7 +151,8 @@ define([
menuStyle : 'min-width: 100%;max-height: 280px;',
editable : false,
cls : 'input-group-nr',
data : []
data : [],
takeFocusOnClose: true
});
this.txtDataRange = new Common.UI.InputFieldBtn({
@ -171,6 +173,8 @@ define([
});
this.txtDataRange.on('button:click', _.bind(this.onSelectData, this));
this.focusManager.add([this.inputName, this.cmbScope, this.txtDataRange], '.form-control');
this.afterRender();
},