[SSE] [SSE] Refactoring tooltips for filters, hyperlinks, nested functions

This commit is contained in:
Julia Radzhabova 2019-03-15 16:11:37 +03:00
parent 1526ef778e
commit 3b0c440640

View file

@ -843,15 +843,16 @@ define([
} }
}, },
hideHyperlinkTip: function(callback) { hideHyperlinkTip: function() {
if (!this.tooltips.hyperlink.isHidden && this.tooltips.hyperlink.ref) { if (!this.tooltips.hyperlink.isHidden && this.tooltips.hyperlink.ref) {
this.tooltips.hyperlink.ref.hide(callback); this.tooltips.hyperlink.ref.hide();
this.tooltips.hyperlink.ref = undefined;
this.tooltips.hyperlink.text = '';
this.tooltips.hyperlink.isHidden = true; this.tooltips.hyperlink.isHidden = true;
} }
}, },
onApiMouseMove: function(dataarray) { onApiMouseMove: function(dataarray) {
var darray = dataarray;
if (!this._isFullscreenMenu && dataarray.length) { if (!this._isFullscreenMenu && dataarray.length) {
var index_hyperlink, var index_hyperlink,
/** coauthoring begin **/ /** coauthoring begin **/
@ -897,24 +898,17 @@ define([
pos = [ pos = [
me.documentHolder.cmpEl.offset().left - $(window).scrollLeft(), me.documentHolder.cmpEl.offset().left - $(window).scrollLeft(),
me.documentHolder.cmpEl.offset().top - $(window).scrollTop() me.documentHolder.cmpEl.offset().top - $(window).scrollTop()
], ];
need_return = false;
if (this._state.index_hyperlink !== index_hyperlink ||this._state.index_comments !== index_comments || //close all tooltips
this._state.index_locked !== index_locked || this._state.index_column !== index_column ||
this._state.index_row !== index_row || this._state.index_filter !== index_filter) {
if (!index_hyperlink) { if (!index_hyperlink) {
need_return = true; me.hideHyperlinkTip();
me.hideHyperlinkTip(function () {
me.onApiMouseMove(darray);
});
} }
if (index_column===undefined && index_row===undefined) { if (index_column===undefined && index_row===undefined) {
if (!row_columnTip.isHidden && row_columnTip.ref) { if (!row_columnTip.isHidden && row_columnTip.ref) {
need_return = true; row_columnTip.ref.hide();
row_columnTip.ref.hide(function () { row_columnTip.ref = undefined;
me.onApiMouseMove(darray); row_columnTip.text = '';
});
row_columnTip.isHidden = true; row_columnTip.isHidden = true;
} }
} }
@ -941,23 +935,14 @@ define([
} }
if (index_filter===undefined || (me.dlgFilter && me.dlgFilter.isVisible()) || (me.currentMenu && me.currentMenu.isVisible())) { if (index_filter===undefined || (me.dlgFilter && me.dlgFilter.isVisible()) || (me.currentMenu && me.currentMenu.isVisible())) {
if (!filterTip.isHidden && filterTip.ref) { if (!filterTip.isHidden && filterTip.ref) {
need_return = true; filterTip.ref.hide();
filterTip.ref.hide(function () { filterTip.ref = undefined;
me.onApiMouseMove(darray); filterTip.text = '';
});
filterTip.isHidden = true; filterTip.isHidden = true;
} }
} }
this._state.index_hyperlink = index_hyperlink;
this._state.index_comments = index_comments;
this._state.index_locked = index_locked;
this._state.index_column = index_column;
this._state.index_row = index_row;
this._state.index_filter = index_filter;
if (need_return) return;
}
// show tooltips
/** coauthoring begin **/ /** coauthoring begin **/
var getUserName = function(id){ var getUserName = function(id){
var usersStore = SSE.getCollection('Common.Collections.Users'); var usersStore = SSE.getCollection('Common.Collections.Users');
@ -989,6 +974,8 @@ define([
if (hyperlinkTip.ref && hyperlinkTip.ref.isVisible()) { if (hyperlinkTip.ref && hyperlinkTip.ref.isVisible()) {
if (hyperlinkTip.text != linkstr) { if (hyperlinkTip.text != linkstr) {
hyperlinkTip.ref.hide(); hyperlinkTip.ref.hide();
hyperlinkTip.ref = undefined;
hyperlinkTip.text = '';
hyperlinkTip.isHidden = true; hyperlinkTip.isHidden = true;
} }
} }
@ -999,10 +986,6 @@ define([
owner : me.documentHolder, owner : me.documentHolder,
html : true, html : true,
title : linkstr title : linkstr
}).on('tooltip:hide', function(tip) {
if (tip !== hyperlinkTip) return;
hyperlinkTip.ref = undefined;
hyperlinkTip.text = '';
}); });
hyperlinkTip.ref.show([-10000, -10000]); hyperlinkTip.ref.show([-10000, -10000]);
@ -1041,10 +1024,6 @@ define([
owner : me.documentHolder, owner : me.documentHolder,
html : true, html : true,
title : str title : str
}).on('tooltip:hide', function(tip) {
if (tip !== row_columnTip) return;
row_columnTip.ref = undefined;
row_columnTip.text = '';
}); });
row_columnTip.ref.show([-10000, -10000]); row_columnTip.ref.show([-10000, -10000]);
@ -1063,7 +1042,7 @@ define([
left: showPoint[0] + 'px' left: showPoint[0] + 'px'
}); });
} }
} else }
if (me.permissions.isEdit || me.permissions.canViewComments) { if (me.permissions.isEdit || me.permissions.canViewComments) {
if (index_comments && !this.popupmenu) { if (index_comments && !this.popupmenu) {
@ -1167,10 +1146,6 @@ define([
html : true, html : true,
title : str, title : str,
cls: 'auto-tooltip' cls: 'auto-tooltip'
}).on('tooltip:hide', function(tip) {
if (tip !== filterTip) return;
filterTip.ref = undefined;
filterTip.text = '';
}); });
filterTip.ref.show([-10000, -10000]); filterTip.ref.show([-10000, -10000]);
@ -1227,6 +1202,8 @@ define([
var me = this; var me = this;
if (!me.tooltips.filter.isHidden && me.tooltips.filter.ref) { if (!me.tooltips.filter.isHidden && me.tooltips.filter.ref) {
me.tooltips.filter.ref.hide(); me.tooltips.filter.ref.hide();
me.tooltips.filter.ref = undefined;
me.tooltips.filter.text = '';
me.tooltips.filter.isHidden = true; me.tooltips.filter.isHidden = true;
} }
if (me.permissions.isEdit && !me.dlgFilter) { if (me.permissions.isEdit && !me.dlgFilter) {
@ -2049,7 +2026,6 @@ define([
onFormulaInfo: function(name) { onFormulaInfo: function(name) {
var functip = this.tooltips.func_arg; var functip = this.tooltips.func_arg;
functip.isHidden = false;
if (name) { if (name) {
var funcdesc = SSE.Views.FormulaLang.getDescription(Common.Utils.InternalSettings.get("sse-settings-func-locale")), var funcdesc = SSE.Views.FormulaLang.getDescription(Common.Utils.InternalSettings.get("sse-settings-func-locale")),
@ -2058,6 +2034,8 @@ define([
if (functip.ref && functip.ref.isVisible()) { if (functip.ref && functip.ref.isVisible()) {
if (functip.text != hint) { if (functip.text != hint) {
functip.ref.hide(); functip.ref.hide();
functip.ref = undefined;
functip.text = '';
functip.isHidden = true; functip.isHidden = true;
} }
} }
@ -2069,10 +2047,6 @@ define([
html : true, html : true,
title : hint, title : hint,
cls: 'auto-tooltip' cls: 'auto-tooltip'
}).on('tooltip:hide', function(tip) {
if (tip !== functip) return;
functip.ref = undefined;
functip.text = '';
}); });
functip.ref.show([-10000, -10000]); functip.ref.show([-10000, -10000]);
@ -2096,6 +2070,8 @@ define([
} else { } else {
if (!functip.isHidden && functip.ref) { if (!functip.isHidden && functip.ref) {
functip.ref.hide(); functip.ref.hide();
functip.ref = undefined;
functip.text = '';
functip.isHidden = true; functip.isHidden = true;
} }
} }