[SSE] Formula tab: fix position for menu item 'Additional'
This commit is contained in:
parent
dcce78dcbb
commit
00075d0148
|
@ -409,6 +409,10 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onAfterKeydownMenu: function(e) {
|
onAfterKeydownMenu: function(e) {
|
||||||
|
this.trigger('keydown:before', this, e);
|
||||||
|
if (e.isDefaultPrevented())
|
||||||
|
return;
|
||||||
|
|
||||||
if (e.keyCode == Common.UI.Keys.RETURN) {
|
if (e.keyCode == Common.UI.Keys.RETURN) {
|
||||||
var li = $(e.target).closest('li');
|
var li = $(e.target).closest('li');
|
||||||
if (li.length<=0) li = $(e.target).parent().find('li .dataview');
|
if (li.length<=0) li = $(e.target).parent().find('li .dataview');
|
||||||
|
|
|
@ -16,6 +16,15 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.internal-menu {
|
||||||
|
border: none;
|
||||||
|
border-radius: 0;
|
||||||
|
.box-shadow(none);
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
li {
|
li {
|
||||||
& > a {
|
& > a {
|
||||||
padding: 5px 20px;
|
padding: 5px 20px;
|
||||||
|
|
|
@ -262,27 +262,59 @@ define([
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (arr.length) {
|
if (arr.length) {
|
||||||
arr.push(new Common.UI.MenuItem({
|
|
||||||
caption: '--'
|
|
||||||
}));
|
|
||||||
arr.push(new Common.UI.MenuItem({
|
|
||||||
caption: me.txtAdditional,
|
|
||||||
value: 'more'
|
|
||||||
}));
|
|
||||||
|
|
||||||
if (btn.menu && btn.menu.rendered) {
|
if (btn.menu && btn.menu.rendered) {
|
||||||
btn.menu.removeAll();
|
var menu = btn.menu.items[0]._internalMenu;
|
||||||
arr.forEach(function(item){
|
if (menu) {
|
||||||
btn.menu.addItem(item);
|
menu.removeAll();
|
||||||
});
|
arr.forEach(function(item){
|
||||||
|
menu.addItem(item);
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
btn.setMenu(new Common.UI.Menu({
|
btn.setMenu(new Common.UI.Menu({
|
||||||
restoreHeight: 415,
|
items: [
|
||||||
items: arr
|
{template: _.template('<div id="id-toolbar-formula-menu-'+ name +'" style="display: flex;" class="open"></div>')},
|
||||||
|
{ caption: '--' },
|
||||||
|
{
|
||||||
|
caption: me.txtAdditional,
|
||||||
|
value: 'more'
|
||||||
|
}
|
||||||
|
]
|
||||||
}));
|
}));
|
||||||
btn.menu.on('item:click', function (menu, item, e) {
|
btn.menu.items[2].on('click', function (item, e) {
|
||||||
me.fireEvent('function:apply', [{name: item.caption, origin: item.value}, false, name]);
|
me.fireEvent('function:apply', [{name: item.caption, origin: item.value}, false, name]);
|
||||||
});
|
});
|
||||||
|
btn.menu.on('show:after', function (menu, e) {
|
||||||
|
var internalMenu = menu.items[0]._internalMenu;
|
||||||
|
internalMenu.scroller.update({alwaysVisibleY: true});
|
||||||
|
_.delay(function() {
|
||||||
|
menu.items[0]._internalMenu && menu.items[0]._internalMenu.cmpEl.focus();
|
||||||
|
}, 10);
|
||||||
|
}).on('keydown:before', function(menu, e) {
|
||||||
|
if (e.keyCode == Common.UI.Keys.RETURN) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
var menuContainer = btn.menu.items[0].cmpEl.children(':first');
|
||||||
|
var menu = new Common.UI.Menu({
|
||||||
|
maxHeight: 300,
|
||||||
|
cls: 'internal-menu',
|
||||||
|
items: arr
|
||||||
|
});
|
||||||
|
menu.render(menuContainer);
|
||||||
|
menu.cmpEl.css({
|
||||||
|
display : 'block',
|
||||||
|
position : 'relative',
|
||||||
|
left : 0,
|
||||||
|
top : 0
|
||||||
|
});
|
||||||
|
menu.cmpEl.attr({tabindex: "-1"});
|
||||||
|
menu.on('item:click', function (menu, item, e) {
|
||||||
|
me.fireEvent('function:apply', [{name: item.caption, origin: item.value}, false, name]);
|
||||||
|
});
|
||||||
|
btn.menu.items[0]._internalMenu = menu;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
btn.setDisabled(arr.length<1);
|
btn.setDisabled(arr.length<1);
|
||||||
|
|
Loading…
Reference in a new issue