[SSE] Add tooltip with function description
This commit is contained in:
parent
374b28d791
commit
1071360588
|
@ -135,6 +135,7 @@ define([
|
||||||
this.toggleGroup = me.options.toggleGroup;
|
this.toggleGroup = me.options.toggleGroup;
|
||||||
this.template = me.options.template || this.template;
|
this.template = me.options.template || this.template;
|
||||||
this.iconCls = me.options.iconCls;
|
this.iconCls = me.options.iconCls;
|
||||||
|
this.hint = me.options.hint;
|
||||||
this.rendered = false;
|
this.rendered = false;
|
||||||
|
|
||||||
if (this.menu !== null && !(this.menu instanceof Common.UI.Menu)) {
|
if (this.menu !== null && !(this.menu instanceof Common.UI.Menu)) {
|
||||||
|
@ -189,6 +190,14 @@ define([
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (me.options.hint) {
|
||||||
|
el.attr('data-toggle', 'tooltip');
|
||||||
|
el.tooltip({
|
||||||
|
title : me.options.hint,
|
||||||
|
placement : me.options.hintAnchor||'cursor'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (this.disabled)
|
if (this.disabled)
|
||||||
$(this.el).toggleClass('disabled', this.disabled);
|
$(this.el).toggleClass('disabled', this.disabled);
|
||||||
|
|
||||||
|
|
|
@ -165,13 +165,25 @@ function patchDropDownKeyDownAdditional(e) { // only for formula menu when typin
|
||||||
|
|
||||||
if (!$items.length) return;
|
if (!$items.length) return;
|
||||||
|
|
||||||
var index = $items.index($items.filter('.focus'));
|
var index = $items.index($items.filter('.focus')),
|
||||||
|
previndex = index;
|
||||||
if (e.keyCode == 38) { index > 0 ? index-- : ($this.hasClass('no-cyclic') ? (index = 0) : (index = $items.length - 1));} else // up
|
if (e.keyCode == 38) { index > 0 ? index-- : ($this.hasClass('no-cyclic') ? (index = 0) : (index = $items.length - 1));} else // up
|
||||||
if (e.keyCode == 40) { index < $items.length - 1 ? index++ : ($this.hasClass('no-cyclic') ? (index = $items.length - 1) : (index = 0));} // down
|
if (e.keyCode == 40) { index < $items.length - 1 ? index++ : ($this.hasClass('no-cyclic') ? (index = $items.length - 1) : (index = 0));} // down
|
||||||
if (!~index) index=0;
|
if (!~index) index=0;
|
||||||
|
|
||||||
$items.removeClass('focus');
|
$items.removeClass('focus');
|
||||||
$items.eq(index).addClass('focus');
|
$items.eq(index).addClass('focus');
|
||||||
|
|
||||||
|
if (previndex !== index) {
|
||||||
|
var tip = $items.eq(previndex).parent().data('bs.tooltip');
|
||||||
|
if (tip) {
|
||||||
|
tip.hide();
|
||||||
|
}
|
||||||
|
tip = $items.eq(index).parent().data('bs.tooltip');
|
||||||
|
if (tip) {
|
||||||
|
tip.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getParent($this) {
|
function getParent($this) {
|
||||||
|
|
|
@ -1894,9 +1894,13 @@ define([
|
||||||
var me = this,
|
var me = this,
|
||||||
documentHolderView = me.documentHolder,
|
documentHolderView = me.documentHolder,
|
||||||
menu = documentHolderView.funcMenu,
|
menu = documentHolderView.funcMenu,
|
||||||
menuContainer = documentHolderView.cmpEl.find('#menu-formula-selection');
|
menuContainer = documentHolderView.cmpEl.find('#menu-formula-selection'),
|
||||||
|
funcdesc = SSE.Views.FormulaLang.getDescription(Common.Utils.InternalSettings.get("sse-settings-func-locale"));
|
||||||
|
|
||||||
for (var i = 0; i < menu.items.length; i++) {
|
for (var i = 0; i < menu.items.length; i++) {
|
||||||
|
var tip = menu.items[i].cmpEl.data('bs.tooltip');
|
||||||
|
if (tip)
|
||||||
|
tip.hide();
|
||||||
menu.removeItem(menu.items[i]);
|
menu.removeItem(menu.items[i]);
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
|
@ -1909,9 +1913,13 @@ define([
|
||||||
});
|
});
|
||||||
_.each(funcarr, function(menuItem, index) {
|
_.each(funcarr, function(menuItem, index) {
|
||||||
var type = menuItem.asc_getType(),
|
var type = menuItem.asc_getType(),
|
||||||
|
name = menuItem.asc_getName(),
|
||||||
|
origname = me.api.asc_getFormulaNameByLocale(name),
|
||||||
mnu = new Common.UI.MenuItem({
|
mnu = new Common.UI.MenuItem({
|
||||||
iconCls: (type==Asc.c_oAscPopUpSelectorType.Func) ? 'mnu-popup-func': ((type==Asc.c_oAscPopUpSelectorType.Table) ? 'mnu-popup-table' : 'mnu-popup-range') ,
|
iconCls: (type==Asc.c_oAscPopUpSelectorType.Func) ? 'mnu-popup-func': ((type==Asc.c_oAscPopUpSelectorType.Table) ? 'mnu-popup-table' : 'mnu-popup-range') ,
|
||||||
caption: menuItem.asc_getName()
|
caption: name,
|
||||||
|
hint : (funcdesc && funcdesc[origname]) ? funcdesc[origname].d : '',
|
||||||
|
hintAnchor: 'right'
|
||||||
}).on('click', function(item, e) {
|
}).on('click', function(item, e) {
|
||||||
setTimeout(function(){ me.api.asc_insertFormula(item.caption, type, false ); }, 10);
|
setTimeout(function(){ me.api.asc_insertFormula(item.caption, type, false ); }, 10);
|
||||||
});
|
});
|
||||||
|
@ -1958,6 +1966,13 @@ define([
|
||||||
Common.UI.Menu.Manager.hideAll();
|
Common.UI.Menu.Manager.hideAll();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
menu.on('hide:after', function(){
|
||||||
|
for (var i = 0; i < menu.items.length; i++) {
|
||||||
|
var tip = menu.items[i].cmpEl.data('bs.tooltip');
|
||||||
|
if (tip)
|
||||||
|
tip.hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
menu.render(menuContainer);
|
menu.render(menuContainer);
|
||||||
menu.cmpEl.attr({tabindex: "-1"});
|
menu.cmpEl.attr({tabindex: "-1"});
|
||||||
|
@ -1982,7 +1997,11 @@ define([
|
||||||
me.cellEditor.focus();
|
me.cellEditor.focus();
|
||||||
menu.cmpEl.toggleClass('from-cell-edit', infocus);
|
menu.cmpEl.toggleClass('from-cell-edit', infocus);
|
||||||
_.delay(function() {
|
_.delay(function() {
|
||||||
menu.cmpEl.find('li:first a').addClass('focus');
|
var a = menu.cmpEl.find('li:first a');
|
||||||
|
a.addClass('focus');
|
||||||
|
var tip = a.parent().data('bs.tooltip');
|
||||||
|
if (tip)
|
||||||
|
tip.show();
|
||||||
}, 10);
|
}, 10);
|
||||||
if (!infocus)
|
if (!infocus)
|
||||||
_.delay(function() {
|
_.delay(function() {
|
||||||
|
|
Loading…
Reference in a new issue