[PE] Add focus manager

This commit is contained in:
Julia Radzhabova 2020-09-27 14:09:49 +03:00
parent 0edd55e5f2
commit f417bcaecd
3 changed files with 40 additions and 14 deletions

View file

@ -50,7 +50,8 @@ define([
width: 350,
style: 'min-width: 230px;',
cls: 'modal-dlg',
buttons: ['ok', 'cancel']
buttons: ['ok', 'cancel'],
focusManager: true
},
initialize : function (options) {
@ -102,6 +103,7 @@ define([
menuStyle : 'min-width: 100%; max-height: 185px;',
cls : 'input-group-nr',
editable : false,
takeFocusOnClose: true,
data : data,
search: true,
scrollAlwaysVisible: true
@ -122,13 +124,13 @@ define([
this.listFormats = new Common.UI.ListView({
el: $('#datetime-dlg-format'),
store: new Common.UI.DataViewStore(),
scrollAlwaysVisible: true
scrollAlwaysVisible: true,
tabindex: 1
});
this.listFormats.on('item:select', _.bind(this.onSelectFormat, this));
this.listFormats.on('item:dblclick', _.bind(this.onDblClickFormat, this));
this.listFormats.on('entervalue', _.bind(this.onPrimary, this));
this.listFormats.$el.find('.listview').focus();
this.btnDefault = new Common.UI.Button({
el: $('#datetime-dlg-default')
@ -172,6 +174,11 @@ define([
});
this._setDefaults();
this.focusManager.add([this.cmbLang, this.listFormats], '.form-control');
setTimeout(function(){
me.cmbLang.focus();
}, 100);
},
_setDefaults: function () {

View file

@ -60,7 +60,8 @@ define([
style: 'min-width: 230px;',
cls: 'modal-dlg',
id: 'window-hyperlink-settings',
buttons: ['ok', 'cancel']
buttons: ['ok', 'cancel'],
focusManager: true
},
initialize : function(options) {
@ -171,7 +172,8 @@ define([
me.internalList = new Common.UI.TreeView({
el: $('#id-dlg-hyperlink-list'),
store: new Common.UI.TreeViewStore(),
enableKeyEvents: true
enableKeyEvents: true,
tabindex: 1
});
me.internalList.on('item:select', _.bind(this.onSelectItem, this));
@ -184,6 +186,10 @@ define([
me.internalList.on('entervalue', _.bind(me.onPrimary, me));
me.externalPanel = $window.find('#id-external-link');
me.internalPanel = $window.find('#id-internal-link');
this.focusManager.add(this.inputUrl, '.form-control');
this.focusManager.add(this.internalList, '.treeview');
this.focusManager.add([this.inputDisplay, this.inputTip], '.form-control');
},
setSettings: function (props) {
@ -205,11 +211,6 @@ define([
this.isTextChanged = false;
this.inputTip.setValue(props.get_ToolTip());
if (type==c_oHyperlinkType.WebLink) {
_.delay(function(){
me.inputUrl.cmpEl.find('input').focus();
},50);
}
me._originalProps = props;
}
},
@ -269,11 +270,11 @@ define([
checkdisp = this.inputDisplay.checkValidate();
if (checkurl !== true) {
this.isInputFirstChange = true;
this.inputUrl.cmpEl.find('input').focus();
this.inputUrl.focus();
return;
}
if (checkdisp !== true) {
this.inputDisplay.cmpEl.find('input').focus();
this.inputDisplay.focus();
return;
}
!this._originalProps.get_Value() && Common.Utils.InternalSettings.set("pe-settings-link-type", this.btnInternal.isActive());
@ -372,8 +373,17 @@ define([
var rec = this.internalList.getSelectedRec();
rec && this.internalList.scrollToRecord(rec);
this.btnOk.setDisabled(!rec || rec.get('index')==4);
} else
var me = this;
_.delay(function(){
me.inputDisplay.focus();
},50);
} else {
this.btnOk.setDisabled($.trim(this.inputUrl.getValue())=='');
var me = this;
_.delay(function(){
me.inputUrl.focus();
},50);
}
},
onLinkTypeClick: function(type, btn, event) {

View file

@ -50,7 +50,8 @@ define([
style: 'min-width: 250px;',
cls: 'modal-dlg',
id: 'window-slide-size-settings',
buttons: ['ok', 'cancel']
buttons: ['ok', 'cancel'],
focusManager: true
},
initialize : function(options) {
@ -101,6 +102,7 @@ define([
style: 'width: 100%;',
menuStyle: 'min-width: 218px;',
editable: false,
takeFocusOnClose: true,
data: [
{value:0, displayValue: this.txtStandard , size: [254, 190.5]},
{value:1, displayValue: this.txtWidescreen1 , size: [254, 143]},
@ -179,6 +181,7 @@ define([
style: 'width: 100%;',
menuStyle: 'min-width: 218px;',
editable: false,
takeFocusOnClose: true,
data: [
{value:0, displayValue: this.strPortrait},
{value:1, displayValue: this.strLandscape}
@ -200,6 +203,12 @@ define([
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
this.updateMetricUnit();
this.focusManager.add([this.cmbSlideSize, this.spnWidth, this.spnHeight, this.cmbSlideOrientation], '.form-control');
var me = this;
setTimeout(function(){
me.cmbSlideSize.focus();
}, 100);
},
_handleInput: function(state) {