[Common] Add focus method for dataview components.

Fix list focus in modal dialogs
This commit is contained in:
Julia Radzhabova 2020-09-26 20:16:29 +03:00
parent 666e737fa8
commit 67f1c2f05d
15 changed files with 38 additions and 22 deletions

View file

@ -237,7 +237,7 @@ define([
me.yearPicker.store.reset(arrYears); me.yearPicker.store.reset(arrYears);
me.enableKeyEvents && _.delay(function() { me.enableKeyEvents && _.delay(function() {
me.monthPicker.cmpEl.find('.dataview').focus(); me.monthPicker.focus();
}, 10); }, 10);
}, },
@ -312,7 +312,7 @@ define([
me.monthsPicker.store.reset(arrMonths); me.monthsPicker.store.reset(arrMonths);
me.enableKeyEvents && _.delay(function() { me.enableKeyEvents && _.delay(function() {
me.monthPicker.cmpEl.find('.dataview').focus(); me.monthPicker.focus();
}, 10); }, 10);
}, },
@ -435,7 +435,7 @@ define([
me.monthPicker.store.reset(arrDays); me.monthPicker.store.reset(arrDays);
me.enableKeyEvents && _.delay(function() { me.enableKeyEvents && _.delay(function() {
me.monthPicker.cmpEl.find('.dataview').focus(); me.monthPicker.focus();
}, 10); }, 10);
}, },

View file

@ -764,6 +764,10 @@ define([
onResize: function() { onResize: function() {
this._layoutParams = undefined; this._layoutParams = undefined;
},
focus: function() {
this.cmpEl && this.cmpEl.find('.dataview').focus();
} }
}); });
@ -1193,6 +1197,10 @@ define([
onResize: function() { onResize: function() {
this._layoutParams = undefined; this._layoutParams = undefined;
},
focus: function() {
this.cmpEl && this.cmpEl.find('.dataview').focus();
} }
}); });

View file

@ -115,6 +115,10 @@ define([
if (!this.isSuspendEvents) if (!this.isSuspendEvents)
this.trigger('item:add', this, view, record); this.trigger('item:add', this, view, record);
} }
},
focus: function() {
this.cmpEl && this.cmpEl.find('.listview').focus();
} }
} }
})()); })());

View file

@ -280,6 +280,10 @@ define([
this.store.collapseSubItems(record); this.store.collapseSubItems(record);
this.scroller.update({minScrollbarLength: 40, alwaysVisibleY: this.scrollAlwaysVisible}); this.scroller.update({minScrollbarLength: 40, alwaysVisibleY: this.scrollAlwaysVisible});
} }
},
focus: function() {
this.cmpEl && this.cmpEl.find('.treeview').focus();
} }
} }
})()); })());

View file

@ -215,7 +215,7 @@ define([ 'text!common/main/lib/template/AutoCorrectDialog.template',
me.mathList.scrollToRecord(_selectedItem); me.mathList.scrollToRecord(_selectedItem);
} }
_.delay(function(){ _.delay(function(){
me.mathList.cmpEl.find('.listview').focus(); me.mathList.focus();
},10); },10);
} }
@ -295,7 +295,7 @@ define([ 'text!common/main/lib/template/AutoCorrectDialog.template',
me.mathRecList.scrollToRecord(_selectedItem); me.mathRecList.scrollToRecord(_selectedItem);
} }
_.delay(function(){ _.delay(function(){
me.mathRecList.cmpEl.find('.listview').focus(); me.mathRecList.focus();
},10); },10);
} }

View file

@ -1472,7 +1472,7 @@ define([
this.specialPanel.toggleClass('hidden', !special); this.specialPanel.toggleClass('hidden', !special);
var me = this; var me = this;
_.delay(function(){ _.delay(function(){
special ? me.specialList.cmpEl.find('.listview').focus() : me.previewPanel.focus(); special ? me.specialList.focus() : me.previewPanel.focus();
},50); },50);
}, },

View file

@ -679,7 +679,7 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template',
me.disableListButtons(); me.disableListButtons();
} }
} }
me.list.cmpEl.find('.listview').focus(); me.list.focus();
} }
}); });
win.show(); win.show();
@ -699,7 +699,7 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template',
}); });
} }
} }
me.list.cmpEl.find('.listview').focus(); me.list.focus();
} }
}); });
rec && win.show(); rec && win.show();
@ -719,7 +719,7 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template',
} }
} }
this.disableListButtons(); this.disableListButtons();
this.list.cmpEl.find('.listview').focus(); this.list.focus();
}, },
onMoveItem: function(up) { onMoveItem: function(up) {
@ -732,7 +732,7 @@ define([ 'text!documenteditor/main/app/template/ControlSettingsDialog.template',
this.list.selectRecord(rec); this.list.selectRecord(rec);
this.list.scrollToRecord(rec); this.list.scrollToRecord(rec);
} }
this.list.cmpEl.find('.listview').focus(); this.list.focus();
}, },
updateFormats: function(lang) { updateFormats: function(lang) {

View file

@ -1628,7 +1628,7 @@ define([
this.updateCellCheck(listView, record); this.updateCellCheck(listView, record);
_.delay(function () { _.delay(function () {
listView.$el.find('.listview').focus(); listView.focus();
}, 100, this); }, 100, this);
} }
} }

View file

@ -214,7 +214,7 @@ define([
onUpdateFocus: function () { onUpdateFocus: function () {
if (this.cmbListFunctions) { if (this.cmbListFunctions) {
_.delay(function (me) { _.delay(function (me) {
me.cmbListFunctions.$el.find('.listview').focus(); me.cmbListFunctions.focus();
}, 100, this); }, 100, this);
} }
}, },

View file

@ -250,7 +250,7 @@ define([ 'text!spreadsheeteditor/main/app/template/NameManagerDlg.template',
this.rangeList.cmpEl.on('mouseover', _.bind(me.onMouseOverLock, me)).on('mouseout', _.bind(me.onMouseOutLock, me)); this.rangeList.cmpEl.on('mouseover', _.bind(me.onMouseOverLock, me)).on('mouseout', _.bind(me.onMouseOutLock, me));
} }
_.delay(function () { _.delay(function () {
me.rangeList.cmpEl.find('.listview').focus(); me.rangeList.focus();
me.rangeList.scroller.update({alwaysVisibleY: true}); me.rangeList.scroller.update({alwaysVisibleY: true});
}, 100, this); }, 100, this);
}, },
@ -311,7 +311,7 @@ define([ 'text!spreadsheeteditor/main/app/template/NameManagerDlg.template',
}).on('close', function() { }).on('close', function() {
me.show(); me.show();
_.delay(function () { _.delay(function () {
me.rangeList.cmpEl.find('.listview').focus(); me.rangeList.focus();
}, 100, me); }, 100, me);
}); });

View file

@ -187,7 +187,7 @@ define([
var me = this; var me = this;
_.delay(function(){ _.delay(function(){
me.inputName.cmpEl.find('input').focus(); me.inputName.focus();
},200); }, },200); },
show: function() { show: function() {
@ -274,12 +274,12 @@ define([
var checkname = this.inputName.checkValidate(), var checkname = this.inputName.checkValidate(),
checkrange = this.txtDataRange.checkValidate(); checkrange = this.txtDataRange.checkValidate();
if (checkname !== true) { if (checkname !== true) {
this.inputName.cmpEl.find('input').focus(); this.inputName.focus();
this.isInputFirstChange = true; this.isInputFirstChange = true;
return; return;
} }
if (checkrange !== true) { if (checkrange !== true) {
this.txtDataRange.cmpEl.find('input').focus(); this.txtDataRange.focus();
return; return;
} }
this.handler && this.handler.call(this, state, (state == 'ok') ? this.getSettings() : undefined); this.handler && this.handler.call(this, state, (state == 'ok') ? this.getSettings() : undefined);

View file

@ -141,7 +141,7 @@ define([
this.rangeList.scroller.update({alwaysVisibleY: true}); this.rangeList.scroller.update({alwaysVisibleY: true});
_.delay(function () { _.delay(function () {
me.rangeList.cmpEl.find('.listview').focus(); me.rangeList.focus();
}, 100, this); }, 100, this);
} }
}, },

View file

@ -198,7 +198,7 @@ define([
this.updateCellCheck(listView, record); this.updateCellCheck(listView, record);
_.delay(function () { _.delay(function () {
listView.$el.find('.listview').focus(); listView.focus();
}, 100, this); }, 100, this);
} }
} }

View file

@ -153,7 +153,7 @@ define([
this.updateCellCheck(listView, record); this.updateCellCheck(listView, record);
_.delay(function () { _.delay(function () {
listView.$el.find('.listview').focus(); listView.focus();
}, 100, this); }, 100, this);
} }
} }

View file

@ -1014,7 +1014,7 @@ define([
Common.UI.Window.prototype.show.apply(this, arguments); Common.UI.Window.prototype.show.apply(this, arguments);
_.delay(function(me){ _.delay(function(me){
me.listNames.$el.find('.listview').focus(); me.listNames.focus();
}, 100, this); }, 100, this);
}, },
@ -1045,7 +1045,7 @@ define([
onUpdateFocus: function () { onUpdateFocus: function () {
_.delay(function(me){ _.delay(function(me){
me.listNames.$el.find('.listview').focus(); me.listNames.focus();
}, 100, this); }, 100, this);
}, },