Refactoring focus manager

This commit is contained in:
Julia Radzhabova 2021-04-14 01:30:54 +03:00
parent ff39f7d581
commit 1949441c55
8 changed files with 12 additions and 7 deletions

View file

@ -58,7 +58,6 @@ Common.UI.FocusManager = new(function() {
}
fields.forEach(function(field) {
if (field) {
// var item = (field.cmp && typeof field.selector == 'string') ? field : {cmp: field, selector: '.form-control'};
var item = {};
if (field.cmp && typeof field.selector == 'string')
item = field;
@ -68,6 +67,8 @@ Common.UI.FocusManager = new(function() {
item.selector = '.listview';
else if (field instanceof Common.UI.CheckBox)
item.selector = '.checkbox-indeterminate';
else if (field instanceof Common.UI.TreeView)
item.selector = '.treeview';
else
item.selector = '.form-control';
}

View file

@ -188,7 +188,7 @@ define([
},
getFocusedComponents: function() {
return [this.inputUrl, {cmp: this.internalList, selector: '.treeview'}, this.inputDisplay, this.inputTip];
return [this.inputUrl, this.internalList, this.inputDisplay, this.inputTip];
},
ShowHideElem: function(value) {

View file

@ -191,7 +191,7 @@ define([
},
getFocusedComponents: function() {
return [this.inputUrl, {cmp: this.internalList, selector: '.treeview'}, this.inputDisplay, this.inputTip];
return [this.inputUrl, this.internalList, this.inputDisplay, this.inputTip];
},
setSettings: function (props) {

View file

@ -807,6 +807,7 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template',
});
this.chIconShow.on('change', function(field, newValue, oldValue, eOpts){
});
Common.UI.FocusManager.add(this, this.chIconShow);
this.btnReverse = new Common.UI.Button({
el: $('#format-rules-edit-btn-icon-reverse')
@ -916,6 +917,7 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template',
this.chFill.on('change', function(field, newValue, oldValue, eOpts){
me.btnNegFill.setDisabled(field.getValue()=='checked');
});
Common.UI.FocusManager.add(this, this.chFill);
// Border
this.cmbBorder = new Common.UI.ComboBox({
@ -966,6 +968,7 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template',
this.chBorder.on('change', function(field, newValue, oldValue, eOpts){
me.btnNegBorder.setDisabled(field.getValue()=='checked');
});
Common.UI.FocusManager.add(this, this.chBorder);
// Axis
this.cmbBarDirection = new Common.UI.ComboBox({
@ -993,6 +996,7 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template',
el: $('#format-rules-edit-chk-show-bar'),
labelText: this.textShowBar
});
Common.UI.FocusManager.add(this, this.chShowBar);
this.cmbAxisPos = new Common.UI.ComboBox({
el : $('#format-rules-edit-combo-axis-pos'),

View file

@ -213,7 +213,7 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesManagerDlg.templa
_setDefaults: function (props) {
Common.UI.FocusManager.add(this, this.cmbScope);
Common.UI.FocusManager.add(this, {cmp: this.rulesList, selector: '.listview'});
Common.UI.FocusManager.add(this, this.rulesList);
this.rulesList.on('item:add', _.bind(this.addControls, this));
this.rulesList.on('item:change', _.bind(this.addControls, this));

View file

@ -125,7 +125,7 @@ define([
},
getFocusedComponents: function() {
return [this.inputSearch, this.cmbFuncGroup, {cmp: this.cmbListFunctions, selector: '.listview'}];
return [this.inputSearch, this.cmbFuncGroup, this.cmbListFunctions];
},
getDefaultFocusableComponent: function () {

View file

@ -255,7 +255,7 @@ define([
},
getFocusedComponents: function() {
return [this.inputUrl, {cmp: this.internalList, selector: '.treeview'}, this.inputRange, this.inputDisplay, this.inputTip];
return [this.inputUrl, this.internalList, this.inputRange, this.inputDisplay, this.inputTip];
},
setSettings: function(settings) {

View file

@ -172,7 +172,7 @@ define([ 'text!spreadsheeteditor/main/app/template/NameManagerDlg.template',
},
getFocusedComponents: function() {
return [ this.cmbFilter, {cmp: this.rangeList, selector: '.listview'} ];
return [ this.cmbFilter, this.rangeList ];
},
getDefaultFocusableComponent: function () {