Fix focus

This commit is contained in:
Julia Radzhabova 2020-10-15 20:21:56 +03:00
parent 767c8652f3
commit 7dce6d79ae
3 changed files with 30 additions and 3 deletions

View file

@ -205,6 +205,7 @@ define([
editable : false,
template : _.template(template.join('')),
itemsTemplate: _.template(itemsTemplate.join('')),
takeFocusOnClose: true,
data : [
{ displayValue: this.txtNone, value: Asc.c_oAscNumberingFormat.None },
{ displayValue: '1, 2, 3,...', value: Asc.c_oAscNumberingFormat.Decimal },
@ -274,7 +275,8 @@ define([
{ value: AscCommon.align_Left, displayValue: this.textLeft },
{ value: AscCommon.align_Center, displayValue: this.textCenter },
{ value: AscCommon.align_Right, displayValue: this.textRight }
]
],
takeFocusOnClose: true
});
this.cmbAlign.on('selected', _.bind(function (combo, record) {
if (this._changedProps)
@ -308,7 +310,8 @@ define([
{ value: 48, displayValue: "48" },
{ value: 72, displayValue: "72" },
{ value: 96, displayValue: "96" }
]
],
takeFocusOnClose: true
});
this.cmbSize.on('selected', _.bind(function (combo, record) {
if (this._changedProps) {
@ -326,6 +329,7 @@ define([
this.levelsList = new Common.UI.ListView({
el: $('#levels-list', this.$window),
store: new Common.UI.DataViewStore(levels),
tabindex: 1,
itemTemplate: _.template('<div id="<%= id %>" class="list-item" style="pointer-events:none;overflow: hidden; text-overflow: ellipsis;line-height: 15px;"><%= (value+1) %></div>')
});
this.levelsList.on('item:select', _.bind(this.onSelectLevel, this));
@ -333,6 +337,10 @@ define([
this.afterRender();
},
getFocusedComponents: function() {
return [this.cmbFormat, this.cmbAlign, this.cmbSize, {cmp: this.levelsList, selector: '.listview'}];
},
afterRender: function() {
this.updateThemeColors();
this._setDefaults(this.props);
@ -346,6 +354,15 @@ define([
});
},
show: function() {
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() {
this.colors.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors());
},

View file

@ -120,7 +120,7 @@ define([
'item:select': this.onCellCheck.bind(this)
});
this.columnsList.onKeyDown = _.bind(this.onListKeyDown, this);
this.columnsList.on('entervalue', _.bind(this.onPrimary, this));
this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
this.afterRender();
},
@ -258,6 +258,10 @@ define([
this.chHeaders.setValue(!!props.asc_getHasHeaders(), true);
this.updateColumnsList();
}
var me = this;
_.delay(function () {
me.columnsList.focus();
}, 100, this);
},
getSettings: function () {

View file

@ -99,6 +99,7 @@ define([
'item:select': this.onCellCheck.bind(this)
});
this.columnsList.onKeyDown = _.bind(this.onListKeyDown, this);
this.columnsList.on('entervalue', _.bind(this.onPrimary, this));
this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
this.afterRender();
@ -191,6 +192,11 @@ define([
if (props) {
this.updateColumnsList(props);
}
var me = this;
_.delay(function () {
me.columnsList.focus();
}, 100, this);
},
getSettings: function () {