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

View file

@ -2181,10 +2181,13 @@ define([
} }
}, },
onInsertPageNumberClick: function(picker, item, record) { onInsertPageNumberClick: function(picker, item, record, e) {
if (this.api) if (this.api)
this.api.put_PageNum(record.get('data').type, record.get('data').subtype); 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.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Page Number'); Common.component.Analytics.trackEvent('ToolBar', 'Page Number');
}, },

View file

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

View file

@ -3567,6 +3567,7 @@ define([
view.paraBulletsPicker = new Common.UI.DataView({ view.paraBulletsPicker = new Common.UI.DataView({
el : $('#id-docholder-menu-bullets'), el : $('#id-docholder-menu-bullets'),
parentMenu : view.menuParagraphBullets.menu, parentMenu : view.menuParagraphBullets.menu,
outerMenu: {menu: view.menuParagraphBullets.menu, index: 0},
groups : view.paraBulletsPicker.groups, groups : view.paraBulletsPicker.groups,
store : view.paraBulletsPicker.store, store : view.paraBulletsPicker.store,
itemTemplate: _.template('<% if (type==0) { %>' + itemTemplate: _.template('<% if (type==0) { %>' +
@ -3576,6 +3577,7 @@ define([
'<% } %>') '<% } %>')
}); });
view.paraBulletsPicker.on('item:click', _.bind(this.onSelectBullets, this)); 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); _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({ var picker = new Common.UI.DataView({
el: $('#format-rules-combo-menu-icon-' + (i+1)), el: $('#format-rules-combo-menu-icon-' + (i+1)),
parentMenu: menu, parentMenu: menu,
outerMenu: {menu: menu, index: 1},
store: new Common.UI.DataViewStore(me.iconsList), store: new Common.UI.DataViewStore(me.iconsList),
itemTemplate: _.template('<img id="<%= id %>" class="item-icon" src="<%= imgUrl %>" style="width: 16px; height: 16px;">'), itemTemplate: _.template('<img id="<%= id %>" class="item-icon" src="<%= imgUrl %>" style="width: 16px; height: 16px;">'),
type : i type : i
}); });
picker.on('item:click', _.bind(this.onSelectIcon, this, combo, menu.items[0])); 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)); menu.items[0].on('toggle', _.bind(this.onSelectNoIcon, this, combo, picker));
this.iconsControls[i].cmbIcons = combo; this.iconsControls[i].cmbIcons = combo;