[PE] Add focus manager to advanced settings

This commit is contained in:
Julia Radzhabova 2020-10-13 22:49:04 +03:00
parent e1c0b951aa
commit 761384b877
6 changed files with 181 additions and 13 deletions

View file

@ -104,6 +104,25 @@ define([ 'text!presentationeditor/main/app/template/ChartSettingsAdvanced.tem
}
},
getFocusedComponents: function() {
return [
this.inputAltTitle, this.textareaAltDescription // 0 tab
];
},
onCategoryClick: function(btn, index) {
Common.Views.AdvancedSettingsWindow.prototype.onCategoryClick.call(this, btn, index);
var me = this;
setTimeout(function(){
switch (index) {
case 0:
me.inputAltTitle.focus();
break;
}
}, 10);
},
_setDefaults: function(props) {
if (props ){
var value = props.asc_getTitle();

View file

@ -138,7 +138,8 @@ define(['text!presentationeditor/main/app/template/HeaderFooterDialog.template',
editable : false,
data : data,
search: true,
scrollAlwaysVisible: true
scrollAlwaysVisible: true,
takeFocusOnClose: true
});
this.cmbLang.setValue(0x0409);
this.cmbLang.on('selected', _.bind(function(combo, record) {
@ -151,7 +152,8 @@ define(['text!presentationeditor/main/app/template/HeaderFooterDialog.template',
menuStyle : 'min-width: 100%; max-height: 185px;',
cls : 'input-group-nr',
editable : false,
data : []
data : [],
takeFocusOnClose: true
});
this.dateControls.push(this.cmbFormat);
@ -185,6 +187,27 @@ define(['text!presentationeditor/main/app/template/HeaderFooterDialog.template',
this.afterRender();
},
getFocusedComponents: function() {
return [ this.cmbFormat, this.cmbLang, this.inputFixed, this.inputFooter ];
},
focusControls: function() {
var me = this;
setTimeout(function(){
if (!me.cmbFormat.isDisabled())
me.cmbFormat.focus();
else if (!me.inputFixed.isDisabled())
me.inputFixed.focus();
else if (!me.inputFooter.isDisabled())
me.inputFooter.focus();
}, 10);
},
show: function() {
Common.Views.AdvancedSettingsWindow.prototype.show.apply(this, arguments);
this.focusControls();
},
afterRender: function() {
var me = this,
value = Common.Utils.InternalSettings.get("pe-settings-datetime-default"),
@ -207,6 +230,7 @@ define(['text!presentationeditor/main/app/template/HeaderFooterDialog.template',
});
newValue && this.setDateTimeType(this.radioFixed.getValue() ? 'fixed' : 'update', null, true);
this.props.put_ShowDateTime(newValue);
this.focusControls();
} else if (type == 'slide') {
this.props.put_ShowSlideNum(newValue);
} else if (type == 'footer') {
@ -243,10 +267,7 @@ define(['text!presentationeditor/main/app/template/HeaderFooterDialog.template',
this.cmbLang.setDisabled(type == 'fixed');
this.cmbFormat.setDisabled(type == 'fixed');
this.inputFixed.setDisabled(type == 'update');
(type == 'fixed') && setTimeout(function(){
me.inputFixed.cmpEl.find('input').focus();
},50);
this.focusControls();
}
},

View file

@ -220,6 +220,33 @@ define([ 'text!presentationeditor/main/app/template/ImageSettingsAdvanced.tem
this.afterRender();
},
getFocusedComponents: function() {
return [
this.spnWidth, this.spnHeight, this.spnX, this.spnY,// 0 tab
this.spnAngle, // 1 tab
this.inputAltTitle, this.textareaAltDescription // 2 tab
];
},
onCategoryClick: function(btn, index) {
Common.Views.AdvancedSettingsWindow.prototype.onCategoryClick.call(this, btn, index);
var me = this;
setTimeout(function(){
switch (index) {
case 0:
me.spnWidth.focus();
break;
case 1:
me.spnAngle.focus();
break;
case 2:
me.inputAltTitle.focus();
break;
}
}, 10);
},
afterRender: function() {
this.updateMetricUnit();
this._setDefaults(this._originalProps);

View file

@ -127,7 +127,8 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
editable: false,
data: this._arrTextAlignment,
style: 'width: 173px;',
menuStyle : 'min-width: 173px;'
menuStyle : 'min-width: 173px;',
takeFocusOnClose: true
});
this.cmbTextAlignment.setValue('');
@ -176,7 +177,8 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
editable: false,
data: this._arrSpecial,
style: 'width: 85px;',
menuStyle : 'min-width: 85px;'
menuStyle : 'min-width: 85px;',
takeFocusOnClose: true
});
this.cmbSpecial.setValue('');
this.cmbSpecial.on('selected', _.bind(this.onSpecialSelect, this));
@ -240,7 +242,8 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
editable: false,
data: this._arrLineRule,
style: 'width: 85px;',
menuStyle : 'min-width: 85px;'
menuStyle : 'min-width: 85px;',
takeFocusOnClose: true
});
this.cmbLineRule.setValue(this.CurLineRuleIdx);
this.cmbLineRule.on('selected', _.bind(this.onLineRuleSelect, this));
@ -355,7 +358,8 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
'<div style="width: 117px;display: inline-block;"><%= value %></div>',
'<div style="display: inline-block;"><%= displayTabAlign %></div>',
'</div>'
].join(''))
].join('')),
tabindex: 1
});
this.tabList.store.comparator = function(rec) {
return rec.get("tabPos");
@ -376,7 +380,8 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
menuStyle : 'min-width: 108px;',
editable : false,
cls : 'input-group-nr',
data : this._arrTabAlign
data : this._arrTabAlign,
takeFocusOnClose: true
});
this.cmbAlign.setValue(Asc.c_oAscTabType.Left);
@ -398,6 +403,34 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced
this.afterRender();
},
getFocusedComponents: function() {
return [
this.cmbTextAlignment, this.numIndentsLeft, this.numIndentsRight, this.cmbSpecial, this.numSpecialBy,
this.numSpacingBefore, this.numSpacingAfter, this.cmbLineRule, this.numLineHeight, // 0 tab
this.numSpacing, // 1 tab
this.numDefaultTab, this.numTab, this.cmbAlign, {cmp: this.tabList, selector: '.listview'} // 2 tab
];
},
onCategoryClick: function(btn, index) {
Common.Views.AdvancedSettingsWindow.prototype.onCategoryClick.call(this, btn, index);
var me = this;
setTimeout(function(){
switch (index) {
case 0:
me.cmbTextAlignment.focus();
break;
case 1:
me.numSpacing.focus();
break;
case 2:
me.numDefaultTab.focus();
break;
}
}, 10);
},
getSettings: function() {
if ( this._tabListChanged ) {
if (this._changedProps.get_Tabs()===null || this._changedProps.get_Tabs()===undefined)

View file

@ -289,7 +289,8 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem
cls: 'input-group-nr',
menuStyle: 'min-width: 100px;',
editable: false,
data: this._arrCapType
data: this._arrCapType,
takeFocusOnClose: true
});
this.cmbCapType.setValue(Asc.c_oAscLineCapType.Flat);
this.cmbCapType.on('selected', _.bind(function(combo, record){
@ -311,7 +312,8 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem
cls: 'input-group-nr',
menuStyle: 'min-width: 100px;',
editable: false,
data: this._arrJoinType
data: this._arrJoinType,
takeFocusOnClose: true
});
this.cmbJoinType.setValue(Asc.c_oAscLineJoinType.Round);
this.cmbJoinType.on('selected', _.bind(function(combo, record){
@ -517,6 +519,45 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem
this.afterRender();
},
getFocusedComponents: function() {
return [
this.spnWidth, this.spnHeight, // 0 tab
this.spnAngle, // 1 tab
this.cmbCapType, this.cmbJoinType, // 2 tab
this.spnMarginTop, this.spnMarginLeft, this.spnMarginBottom, this.spnMarginRight, // 3 tab
this.spnColumns, this.spnSpacing, // 4 tab
this.inputAltTitle, this.textareaAltDescription // 5 tab
];
},
onCategoryClick: function(btn, index) {
Common.Views.AdvancedSettingsWindow.prototype.onCategoryClick.call(this, btn, index);
var me = this;
setTimeout(function(){
switch (index) {
case 0:
me.spnWidth.focus();
break;
case 1:
me.spnAngle.focus();
break;
case 2:
me.cmbCapType.focus();
break;
case 3:
me.spnMarginTop.focus();
break;
case 4:
me.spnColumns.focus();
break;
case 5:
me.inputAltTitle.focus();
break;
}
}, 10);
},
afterRender: function() {
this.updateMetricUnit();
this._setDefaults(this._originalProps);

View file

@ -315,6 +315,33 @@ define([ 'text!presentationeditor/main/app/template/TableSettingsAdvanced.tem
this.afterRender();
},
getFocusedComponents: function() {
return [
this.spnMarginTop, this.spnMarginLeft, this.spnMarginBottom, this.spnMarginRight,
this.spnTableMarginTop, this.spnTableMarginLeft, this.spnTableMarginBottom, this.spnTableMarginRight, // 0 tab
this.inputAltTitle, this.textareaAltDescription // 1 tab
];
},
onCategoryClick: function(btn, index) {
Common.Views.AdvancedSettingsWindow.prototype.onCategoryClick.call(this, btn, index);
var me = this;
setTimeout(function(){
switch (index) {
case 0:
if (!me.spnMarginTop.isDisabled())
me.spnMarginTop.focus();
else
me.spnTableMarginTop.focus();
break;
case 1:
me.inputAltTitle.focus();
break;
}
}, 10);
},
afterRender: function() {
this.updateMetricUnit();
this._setDefaults(this._originalProps);