[DE] added base class method

This commit is contained in:
Maxim Kadushkin 2020-10-21 11:10:11 +03:00
parent dd0359ce90
commit 1a6ef58774
4 changed files with 11 additions and 16 deletions

View file

@ -143,17 +143,17 @@ Common.UI.FocusManager = new(function() {
updateTabIndexes(true); updateTabIndexes(true);
} }
} }
if ( e.getDefaultFocusedComponent )
setTimeout(function(){
e.getDefaultFocusedComponent().focus();
}, 100);
}, },
'window:show': function(e){ 'window:show': function(e){
if (e && e.cid && _windows[e.cid] && !_windows[e.cid].fields) { if (e && e.cid && _windows[e.cid] && !_windows[e.cid].fields) {
_windows[e.cid].fields = register(e.getFocusedComponents()); _windows[e.cid].fields = register(e.getFocusedComponents());
addTraps(_windows[e.cid]); addTraps(_windows[e.cid]);
} }
if (e && e.getDefaultFocusableComponent())
setTimeout(function(){
e.getDefaultFocusableComponent().focus();
}, 100);
}, },
'modal:close': function(e, last) { 'modal:close': function(e, last) {
if (e && e.cid && _windows[e.cid]) { if (e && e.cid && _windows[e.cid]) {

View file

@ -984,6 +984,10 @@ define([
return []; return [];
}, },
getDefaultFocusableComponent: function() {
return undefined;
},
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',
okButtonText: 'OK', okButtonText: 'OK',
yesButtonText: 'Yes', yesButtonText: 'Yes',

View file

@ -128,17 +128,13 @@ define([
this.getChild().find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); this.getChild().find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
this.updateMetricUnit(); this.updateMetricUnit();
// setTimeout(function(){
// me.spnColumns.focus();
// }, 100);
}, },
getFocusedComponents: function() { getFocusedComponents: function() {
return [this.spnColumns, this.spnSpacing]; return [this.spnColumns, this.spnSpacing];
}, },
getDefaultFocusedComponent: function () { getDefaultFocusableComponent: function () {
return this.spnColumns; return this.spnColumns;
}, },

View file

@ -341,7 +341,7 @@ define([
return [this.cmbFormat, this.cmbAlign, this.cmbSize, {cmp: this.levelsList, selector: '.listview'}]; return [this.cmbFormat, this.cmbAlign, this.cmbSize, {cmp: this.levelsList, selector: '.listview'}];
}, },
getDefaultFocusedComponent: function () { getDefaultFocusableComponent: function () {
return this.type > 0 ? this.cmbFormat : this.cmbAlign; return this.type > 0 ? this.cmbFormat : this.cmbAlign;
}, },
@ -360,11 +360,6 @@ define([
show: function() { show: function() {
Common.UI.Window.prototype.show.apply(this, arguments); Common.UI.Window.prototype.show.apply(this, arguments);
// var me = this;
// _.delay(function(){
// (me.type>0) ? me.cmbFormat.focus() : me.cmbAlign.focus();
// },100);
}, },
updateThemeColors: function() { updateThemeColors: function() {