[DE] Add focus manager

This commit is contained in:
Julia Radzhabova 2020-09-27 13:48:53 +03:00
parent 296d270348
commit 0edd55e5f2
4 changed files with 49 additions and 7 deletions

View file

@ -50,7 +50,8 @@ define([
options: { options: {
contentWidth: 300, contentWidth: 300,
height: 380, height: 380,
buttons: null buttons: null,
focusManager: true
}, },
initialize : function(options) { initialize : function(options) {
@ -159,6 +160,9 @@ define([
this.radioFootnote.on('change', function(field, newValue, eOpts) { this.radioFootnote.on('change', function(field, newValue, eOpts) {
if (newValue) { if (newValue) {
me.changeNoteType(false); me.changeNoteType(false);
setTimeout(function(){
me.cmbFootnote.focus();
}, 1);
} }
}); });
@ -170,6 +174,9 @@ define([
this.radioEndnote.on('change', function(field, newValue, eOpts) { this.radioEndnote.on('change', function(field, newValue, eOpts) {
if (newValue) { if (newValue) {
me.changeNoteType(true); me.changeNoteType(true);
setTimeout(function(){
me.cmbEndnote.focus();
}, 1);
} }
}); });
@ -178,6 +185,7 @@ define([
cls: 'input-group-nr', cls: 'input-group-nr',
menuStyle: 'min-width: 150px;', menuStyle: 'min-width: 150px;',
editable: false, editable: false,
takeFocusOnClose: true,
data: [ data: [
{ displayValue: this.textPageBottom, value: Asc.c_oAscFootnotePos.PageBottom }, { displayValue: this.textPageBottom, value: Asc.c_oAscFootnotePos.PageBottom },
{ displayValue: this.textTextBottom, value: Asc.c_oAscFootnotePos.BeneathText } { displayValue: this.textTextBottom, value: Asc.c_oAscFootnotePos.BeneathText }
@ -190,6 +198,7 @@ define([
cls: 'input-group-nr', cls: 'input-group-nr',
menuStyle: 'min-width: 150px;', menuStyle: 'min-width: 150px;',
editable: false, editable: false,
takeFocusOnClose: true,
data: [ data: [
{ displayValue: this.textSectEnd, value: Asc.c_oAscFootnotePos.SectEnd }, { displayValue: this.textSectEnd, value: Asc.c_oAscFootnotePos.SectEnd },
{ displayValue: this.textPageBottom, value: Asc.c_oAscFootnotePos.PageBottom } { displayValue: this.textPageBottom, value: Asc.c_oAscFootnotePos.PageBottom }
@ -202,6 +211,7 @@ define([
cls: 'input-group-nr', cls: 'input-group-nr',
menuStyle: 'min-width: 150px;', menuStyle: 'min-width: 150px;',
editable: false, editable: false,
takeFocusOnClose: true,
data: [ data: [
{ displayValue: '1, 2, 3,...', value: Asc.c_oAscNumberingFormat.Decimal, maskExp: /[0-9]/, defValue: 1 }, { displayValue: '1, 2, 3,...', value: Asc.c_oAscNumberingFormat.Decimal, maskExp: /[0-9]/, defValue: 1 },
{ displayValue: 'a, b, c,...', value: Asc.c_oAscNumberingFormat.LowerLetter, maskExp: /[a-z]/, defValue: 'a' }, { displayValue: 'a, b, c,...', value: Asc.c_oAscNumberingFormat.LowerLetter, maskExp: /[a-z]/, defValue: 'a' },
@ -235,6 +245,7 @@ define([
cls: 'input-group-nr', cls: 'input-group-nr',
menuStyle: 'min-width: 150px;', menuStyle: 'min-width: 150px;',
editable: false, editable: false,
takeFocusOnClose: true,
data: this._arrNumbering data: this._arrNumbering
}); });
this.cmbNumbering.setValue(Asc.c_oAscFootnoteRestart.Continuous); this.cmbNumbering.setValue(Asc.c_oAscFootnoteRestart.Continuous);
@ -257,6 +268,7 @@ define([
cls: 'input-group-nr', cls: 'input-group-nr',
menuStyle: 'min-width: 150px;', menuStyle: 'min-width: 150px;',
editable: false, editable: false,
takeFocusOnClose: true,
data: [ data: [
{ displayValue: this.textDocument, value: 1 }, { displayValue: this.textDocument, value: 1 },
{ displayValue: this.textSection, value: 0 } { displayValue: this.textSection, value: 0 }
@ -273,6 +285,12 @@ define([
afterRender: function() { afterRender: function() {
this._setDefaults(this.props); this._setDefaults(this.props);
this.focusManager.add([this.cmbFootnote, this.cmbEndnote, this.cmbFormat, this.spnStart, this.cmbNumbering, this.txtCustom, this.cmbApply], '.form-control');
var me = this;
setTimeout(function(){
me.cmbFormat.focus();
}, 100);
}, },
show: function() { show: function() {

View file

@ -50,7 +50,8 @@ define([
style: 'min-width: 404px;', style: 'min-width: 404px;',
cls: 'modal-dlg', cls: 'modal-dlg',
id: 'window-page-margins', id: 'window-page-margins',
buttons: ['ok', 'cancel'] buttons: ['ok', 'cancel'],
focusManager: true
}, },
initialize : function(options) { initialize : function(options) {
@ -213,6 +214,7 @@ define([
menuStyle : 'min-width: 86px;', menuStyle : 'min-width: 86px;',
style : 'width: 86px;', style : 'width: 86px;',
editable : false, editable : false,
takeFocusOnClose: true,
cls : 'input-group-nr', cls : 'input-group-nr',
data : [ data : [
{ value: 0, displayValue: this.textLeft }, { value: 0, displayValue: this.textLeft },
@ -232,6 +234,7 @@ define([
menuStyle : 'min-width: 180px;', menuStyle : 'min-width: 180px;',
style : 'width: 180px;', style : 'width: 180px;',
editable : false, editable : false,
takeFocusOnClose: true,
cls : 'input-group-nr', cls : 'input-group-nr',
data : [ data : [
{ value: 0, displayValue: this.textPortrait }, { value: 0, displayValue: this.textPortrait },
@ -275,6 +278,7 @@ define([
menuStyle : 'min-width: 180px;', menuStyle : 'min-width: 180px;',
style : 'width: 180px;', style : 'width: 180px;',
editable : false, editable : false,
takeFocusOnClose: true,
cls : 'input-group-nr', cls : 'input-group-nr',
data : [ data : [
{ value: 0, displayValue: this.textNormal }, { value: 0, displayValue: this.textNormal },
@ -303,6 +307,12 @@ define([
this.window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); this.window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
this.updateMetricUnit(); this.updateMetricUnit();
this.focusManager.add([this.spnTop, this.spnBottom, this.spnLeft, this.spnRight, this.spnGutter, this.cmbGutterPosition, this.cmbOrientation, this.cmbMultiplePages], '.form-control');
var me = this;
setTimeout(function(){
me.spnTop.focus();
}, 100);
}, },
_handleInput: function(state) { _handleInput: function(state) {

View file

@ -50,7 +50,8 @@ define([
style: 'min-width: 216px;', style: 'min-width: 216px;',
cls: 'modal-dlg', cls: 'modal-dlg',
id: 'window-page-size', id: 'window-page-size',
buttons: ['ok', 'cancel'] buttons: ['ok', 'cancel'],
focusManager: true
}, },
initialize : function(options) { initialize : function(options) {
@ -129,6 +130,7 @@ define([
cls: 'input-group-nr', cls: 'input-group-nr',
menuStyle: 'min-width: 183px;max-height: 208px;', menuStyle: 'min-width: 183px;max-height: 208px;',
editable: false, editable: false,
takeFocusOnClose: true,
scrollAlwaysVisible: true, scrollAlwaysVisible: true,
data: [ data: [
{ value: 0, displayValue: 'US Letter', size: [215.9, 279.4]}, { value: 0, displayValue: 'US Letter', size: [215.9, 279.4]},
@ -166,6 +168,12 @@ define([
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); $window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
this.updateMetricUnit(); this.updateMetricUnit();
this.focusManager.add([this.cmbPreset, this.spnWidth, this.spnHeight], '.form-control');
var me = this;
setTimeout(function(){
me.cmbPreset.focus();
}, 100);
}, },
_handleInput: function(state) { _handleInput: function(state) {

View file

@ -48,7 +48,8 @@ define([
width: 300, width: 300,
style: 'min-width: 230px;', style: 'min-width: 230px;',
cls: 'modal-dlg', cls: 'modal-dlg',
buttons: ['ok', 'cancel'] buttons: ['ok', 'cancel'],
focusManager: true
}, },
initialize : function(options) { initialize : function(options) {
@ -96,7 +97,8 @@ define([
this.cmbFormat = new Common.UI.ComboBox({ this.cmbFormat = new Common.UI.ComboBox({
el : $('#id-dlg-formula-format'), el : $('#id-dlg-formula-format'),
cls : 'input-group-nr', cls : 'input-group-nr',
menuStyle : 'min-width: 100%; max-height: 200px;' menuStyle : 'min-width: 100%; max-height: 200px;',
takeFocusOnClose: true
}); });
this.cmbFunction = new Common.UI.ComboBox({ this.cmbFunction = new Common.UI.ComboBox({
@ -104,6 +106,7 @@ define([
cls : 'input-group-nr', cls : 'input-group-nr',
menuStyle : 'min-width: 100%; max-height: 150px;', menuStyle : 'min-width: 100%; max-height: 150px;',
editable : false, editable : false,
takeFocusOnClose: true,
scrollAlwaysVisible: true, scrollAlwaysVisible: true,
data: [ data: [
{displayValue: 'ABS', value: 1}, {displayValue: 'ABS', value: 1},
@ -141,7 +144,8 @@ define([
el : $('#id-dlg-formula-bookmark'), el : $('#id-dlg-formula-bookmark'),
cls : 'input-group-nr', cls : 'input-group-nr',
menuStyle : 'min-width: 100%; max-height: 150px;', menuStyle : 'min-width: 100%; max-height: 150px;',
editable : false editable : false,
takeFocusOnClose: true
}); });
this.cmbBookmark.on('selected', _.bind(function(combo, record) { this.cmbBookmark.on('selected', _.bind(function(combo, record) {
combo.setValue(this.textBookmark); combo.setValue(this.textBookmark);
@ -160,6 +164,8 @@ define([
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); $window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
this.afterRender(); this.afterRender();
this.focusManager.add([this.inputFormula, this.cmbFormat, this.cmbFunction, this.cmbBookmark], '.form-control');
}, },
onSelectItem: function(picker, item, record, e){ onSelectItem: function(picker, item, record, e){
@ -171,7 +177,7 @@ define([
var me = this; var me = this;
_.delay(function(){ _.delay(function(){
me.inputFormula.cmpEl.find('input').focus(); me.inputFormula.focus();
},500); },500);
}, },