Add focus to menu with dataview items

This commit is contained in:
Julia Radzhabova 2021-09-20 17:38:41 +03:00
parent 302db500de
commit 03069417fb
5 changed files with 20 additions and 11 deletions

View file

@ -701,7 +701,8 @@ define([
} else if (data.keyCode==Common.UI.Keys.UP) {
if (topIdx==0 && this.outerMenu && this.outerMenu.menu) {
this.deselectAll(true);
this.outerMenu.menu.focusOuter(data, this.outerMenu.index);
this.outerMenu.menu.focusOuter && this.outerMenu.menu.focusOuter(data, this.outerMenu.index);
return;
} else
while (idx===undefined) {
topIdx--;
@ -711,7 +712,8 @@ define([
} else {
if (topIdx==this._layoutParams.rows-1 && this.outerMenu && this.outerMenu.menu) {
this.deselectAll(true);
this.outerMenu.menu.focusOuter(data, this.outerMenu.index);
this.outerMenu.menu.focusOuter && this.outerMenu.menu.focusOuter(data, this.outerMenu.index);
return;
} else
while (idx===undefined) {
topIdx++;
@ -1171,7 +1173,8 @@ define([
} else if (data.keyCode==Common.UI.Keys.UP) {
if (topIdx==0 && this.outerMenu && this.outerMenu.menu) {
this.deselectAll(true);
this.outerMenu.menu.focusOuter(data, this.outerMenu.index);
this.outerMenu.menu.focusOuter && this.outerMenu.menu.focusOuter(data, this.outerMenu.index);
return;
} else
while (idx===undefined) {
topIdx--;
@ -1181,7 +1184,8 @@ define([
} else {
if (topIdx==this._layoutParams.rows-1 && this.outerMenu && this.outerMenu.menu) {
this.deselectAll(true);
this.outerMenu.menu.focusOuter(data, this.outerMenu.index);
this.outerMenu.menu.focusOuter && this.outerMenu.menu.focusOuter(data, this.outerMenu.index);
return;
} else
while (idx===undefined) {
topIdx++;

View file

@ -2181,10 +2181,13 @@ define([
}
},
onInsertPageNumberClick: function(picker, item, record) {
onInsertPageNumberClick: function(picker, item, record, e) {
if (this.api)
this.api.put_PageNum(record.get('data').type, record.get('data').subtype);
if (e.type !== 'click')
this.toolbar.btnEditHeader.menu.hide();
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Page Number');
},

View file

@ -2080,9 +2080,11 @@ define([
this.mnuPageNumberPosPicker = new Common.UI.DataView({
el: $('#id-toolbar-menu-pageposition'),
allowScrollbar: false,
parentMenu: this.mnuInsertPageNum.menu,
outerMenu: {menu: this.mnuInsertPageNum.menu, index: 0},
showLast: false,
store: new Common.UI.DataViewStore([
{
allowSelected: false,
iconname: 'page-number-top-left',
data: {
type: c_pageNumPosition.PAGE_NUM_POSITION_TOP,
@ -2090,7 +2092,6 @@ define([
}
},
{
allowSelected: false,
iconname: 'page-number-top-center',
data: {
type: c_pageNumPosition.PAGE_NUM_POSITION_TOP,
@ -2098,7 +2099,6 @@ define([
}
},
{
allowSelected: false,
iconname: 'page-number-top-right',
data: {
type: c_pageNumPosition.PAGE_NUM_POSITION_TOP,
@ -2106,7 +2106,6 @@ define([
}
},
{
allowSelected: false,
iconname: 'page-number-bottom-left',
data: {
type: c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM,
@ -2114,7 +2113,6 @@ define([
}
},
{
allowSelected: false,
iconname: 'page-number-bottom-center',
data: {
type: c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM,
@ -2122,7 +2120,6 @@ define([
}
},
{
allowSelected: false,
iconname: 'page-number-bottom-right',
data: {
type: c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM,
@ -2133,6 +2130,7 @@ define([
itemTemplate: _.template('<div id="<%= id %>" class="item-pagenumber options__icon options__icon-huge <%= iconname %>"></div>')
});
_conf && this.mnuPageNumberPosPicker.setDisabled(_conf.disabled);
this.mnuInsertPageNum.menu.setInnerMenu([{menu: this.mnuPageNumberPosPicker, index: 0}]);
this.mnuTablePicker = new Common.UI.DimensionPicker({
el: $('#id-toolbar-menu-tablepicker'),

View file

@ -3567,6 +3567,7 @@ define([
view.paraBulletsPicker = new Common.UI.DataView({
el : $('#id-docholder-menu-bullets'),
parentMenu : view.menuParagraphBullets.menu,
outerMenu: {menu: view.menuParagraphBullets.menu, index: 0},
groups : view.paraBulletsPicker.groups,
store : view.paraBulletsPicker.store,
itemTemplate: _.template('<% if (type==0) { %>' +
@ -3576,6 +3577,7 @@ define([
'<% } %>')
});
view.paraBulletsPicker.on('item:click', _.bind(this.onSelectBullets, this));
view.menuParagraphBullets.menu.setInnerMenu([{menu: view.paraBulletsPicker, index: 0}]);
_conf && view.paraBulletsPicker.selectRecord(_conf.rec, true);
},

View file

@ -664,11 +664,13 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template',
var picker = new Common.UI.DataView({
el: $('#format-rules-combo-menu-icon-' + (i+1)),
parentMenu: menu,
outerMenu: {menu: menu, index: 1},
store: new Common.UI.DataViewStore(me.iconsList),
itemTemplate: _.template('<img id="<%= id %>" class="item-icon" src="<%= imgUrl %>" style="width: 16px; height: 16px;">'),
type : i
});
picker.on('item:click', _.bind(this.onSelectIcon, this, combo, menu.items[0]));
menu.setInnerMenu([{menu: picker, index: 1}]);
menu.items[0].on('toggle', _.bind(this.onSelectNoIcon, this, combo, picker));
this.iconsControls[i].cmbIcons = combo;