[SSE] Fix Bug 18052

This commit is contained in:
Julia Radzhabova 2018-05-31 10:27:38 +03:00
parent 98ac37d9f1
commit 3a600d8e64
3 changed files with 211 additions and 4 deletions

View file

@ -54,3 +54,7 @@
.link-tooltip .tooltip-inner { .link-tooltip .tooltip-inner {
max-width: 500px; max-width: 500px;
} }
.auto-tooltip .tooltip-inner {
max-width: none;
}

View file

@ -73,7 +73,8 @@ define([
}, },
row_column: { row_column: {
ttHeight: 20 ttHeight: 20
} },
filter: {ttHeight: 40}
}; };
me.mouse = {}; me.mouse = {};
me.popupmenu = false; me.popupmenu = false;
@ -821,7 +822,8 @@ define([
index_comments, index_comments,
/** coauthoring end **/ /** coauthoring end **/
index_locked, index_locked,
index_column, index_row; index_column, index_row,
index_filter;
for (var i = dataarray.length; i > 0; i--) { for (var i = dataarray.length; i > 0; i--) {
switch (dataarray[i-1].asc_getType()) { switch (dataarray[i-1].asc_getType()) {
case Asc.c_oAscMouseMoveType.Hyperlink: case Asc.c_oAscMouseMoveType.Hyperlink:
@ -841,6 +843,9 @@ define([
case Asc.c_oAscMouseMoveType.ResizeRow: case Asc.c_oAscMouseMoveType.ResizeRow:
index_row = i; index_row = i;
break; break;
case Asc.c_oAscMouseMoveType.Filter:
index_filter = i;
break;
} }
} }
@ -851,7 +856,8 @@ define([
commentTip = me.tooltips.comment, commentTip = me.tooltips.comment,
/** coauthoring end **/ /** coauthoring end **/
hyperlinkTip = me.tooltips.hyperlink, hyperlinkTip = me.tooltips.hyperlink,
row_columnTip = me.tooltips.row_column, row_columnTip = me.tooltips.row_column,
filterTip = me.tooltips.filter,
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()
@ -859,6 +865,7 @@ define([
hyperlinkTip.isHidden = false; hyperlinkTip.isHidden = false;
row_columnTip.isHidden = false; row_columnTip.isHidden = false;
filterTip.isHidden = false;
/** coauthoring begin **/ /** coauthoring begin **/
var getUserName = function(id){ var getUserName = function(id){
@ -1069,6 +1076,56 @@ define([
me.hideCoAuthTips(); me.hideCoAuthTips();
} }
} }
if (index_filter!==undefined && !(me.dlgFilter && me.dlgFilter.isVisible())) {
var data = dataarray[index_filter-1],
str = me.makeFilterTip(data.asc_getFilter());
if (filterTip.ref && filterTip.ref.isVisible()) {
if (filterTip.text != str) {
filterTip.text = str;
filterTip.ref.setTitle(str);
filterTip.ref.updateTitle();
}
}
if (!filterTip.ref || !filterTip.ref.isVisible()) {
filterTip.text = str;
filterTip.ref = new Common.UI.Tooltip({
owner : me.documentHolder,
html : true,
title : str,
cls: 'auto-tooltip'
}).on('tooltip:hide', function(tip) {
filterTip.ref = undefined;
filterTip.text = '';
});
filterTip.ref.show([-10000, -10000]);
filterTip.isHidden = false;
showPoint = [data.asc_getX() + pos[0] - 10, data.asc_getY() + pos[1] + 20];
var tipheight = filterTip.ref.getBSTip().$tip.width();
if (showPoint[1] + filterTip.ttHeight > me.tooltips.coauth.bodyHeight ) {
showPoint[1] = me.tooltips.coauth.bodyHeight - filterTip.ttHeight - 5;
showPoint[0] += 20;
}
var tipwidth = filterTip.ref.getBSTip().$tip.width();
if (showPoint[0] + tipwidth > me.tooltips.coauth.bodyWidth )
showPoint[0] = me.tooltips.coauth.bodyWidth - tipwidth - 20;
filterTip.ref.getBSTip().$tip.css({
top : showPoint[1] + 'px',
left: showPoint[0] + 'px'
});
}
} else {
if (!filterTip.isHidden && filterTip.ref) {
filterTip.ref.hide();
filterTip.isHidden = true;
}
}
} }
}, },
@ -1100,6 +1157,10 @@ define([
onApiAutofilter: function(config) { onApiAutofilter: function(config) {
var me = this; var me = this;
if (!me.tooltips.filter.isHidden && me.tooltips.filter.ref) {
me.tooltips.filter.ref.hide();
me.tooltips.filter.isHidden = true;
}
if (me.permissions.isEdit && !me.dlgFilter) { if (me.permissions.isEdit && !me.dlgFilter) {
me.dlgFilter = new SSE.Views.AutoFilterDialog({api: this.api}).on({ me.dlgFilter = new SSE.Views.AutoFilterDialog({api: this.api}).on({
'close': function () { 'close': function () {
@ -1130,6 +1191,99 @@ define([
} }
}, },
makeFilterTip: function(props) {
var filterObj = props.asc_getFilterObj(),
filterType = filterObj.asc_getType(),
isTextFilter = props.asc_getIsTextFilter(),
colorsFill = props.asc_getColorsFill(),
colorsFont = props.asc_getColorsFont(),
str = "";
if (filterType === Asc.c_oAscAutoFilterTypes.CustomFilters) {
var customFilter = filterObj.asc_getFilter(),
customFilters = customFilter.asc_getCustomFilters();
str = this.getFilterName(Asc.c_oAscAutoFilterTypes.CustomFilters, customFilters[0].asc_getOperator()) + " \"" + customFilters[0].asc_getVal() + "\"";
if (customFilters.length>1) {
str += (customFilter.asc_getAnd() ? this.txtAnd : this.txtOr);
str = str + " " + this.getFilterName(Asc.c_oAscAutoFilterTypes.CustomFilters, customFilters[1].asc_getOperator()) + " \"" + customFilters[1].asc_getVal() + "\"";
}
} else if (filterType === Asc.c_oAscAutoFilterTypes.ColorFilter) {
var colorFilter = filterObj.asc_getFilter();
if ( colorFilter.asc_getCellColor()===null ) { // cell color
str = this.txtEqualsToCellColor;
} else if (colorFilter.asc_getCellColor()===false) { // font color
str = this.txtEqualsToFontColor;
}
} else if (filterType === Asc.c_oAscAutoFilterTypes.DynamicFilter) {
str = this.getFilterName(Asc.c_oAscAutoFilterTypes.DynamicFilter, filterObj.asc_getFilter().asc_getType());
} else if (filterType === Asc.c_oAscAutoFilterTypes.Top10) {
var top10Filter = filterObj.asc_getFilter(),
percent = top10Filter.asc_getPercent();
str = this.getFilterName(Asc.c_oAscAutoFilterTypes.Top10, top10Filter.asc_getTop());
str += " " + top10Filter.asc_getVal() + " " + ((percent || percent===null) ? this.txtPercent : this.txtItems);
} else if (filterType === Asc.c_oAscAutoFilterTypes.Filters) {
var strlen = 0, visibleItems = 0, isBlankVisible = undefined,
values = props.asc_getValues();
values.forEach(function (item) {
if (item.asc_getVisible()) {
visibleItems++;
if (strlen<100 && item.asc_getText()) {
str += item.asc_getText() + "; ";
strlen = str.length;
}
}
if (!item.asc_getText())
isBlankVisible = item.asc_getVisible();
});
if (visibleItems == values.length)
str = this.txtAll;
else if (visibleItems==1 && isBlankVisible)
str = this.txtEquals + " \"" + this.txtBlanks + "\"";
else if (visibleItems == values.length-1 && (isBlankVisible==false))
str = this.txtNotEquals + " \"" + this.txtBlanks + "\"";
else {
isBlankVisible && (str += this.txtBlanks + "; ");
str = this.txtEquals + " \"" + str.substring(0, str.length-2) + "\"";
}
} else if (filterType === Asc.c_oAscAutoFilterTypes.None) {
str = this.txtAll;
}
if (str.length>100)
str = str.substring(0, 100) + '...';
str = "<b>" + props.asc_getColumnName() + ":</b><br>" + str;
return str;
},
getFilterName: function(type, subtype) {
var str = '';
if (type == Asc.c_oAscAutoFilterTypes.CustomFilters) {
switch (subtype) {
case Asc.c_oAscCustomAutoFilter.equals: str = this.txtEquals; break;
case Asc.c_oAscCustomAutoFilter.isGreaterThan: str = this.txtGreater; break;
case Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo: str = this.txtGreaterEquals; break;
case Asc.c_oAscCustomAutoFilter.isLessThan: str = this.txtLess; break;
case Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo: str = this.txtLessEquals; break;
case Asc.c_oAscCustomAutoFilter.doesNotEqual: str = this.txtNotEquals; break;
case Asc.c_oAscCustomAutoFilter.beginsWith: str = this.txtBegins; break;
case Asc.c_oAscCustomAutoFilter.doesNotBeginWith: str = this.txtNotBegins; break;
case Asc.c_oAscCustomAutoFilter.endsWith: str = this.txtEnds; break;
case Asc.c_oAscCustomAutoFilter.doesNotEndWith: str = this.txtNotEnds; break;
case Asc.c_oAscCustomAutoFilter.contains: str = this.txtContains; break;
case Asc.c_oAscCustomAutoFilter.doesNotContain: str = this.txtNotContains; break;
}
} else if (type == Asc.c_oAscAutoFilterTypes.DynamicFilter) {
switch (subtype) {
case Asc.c_oAscDynamicAutoFilter.aboveAverage: str = this.txtAboveAve; break;
case Asc.c_oAscDynamicAutoFilter.belowAverage: str = this.txtBelowAve; break;
}
} else if (type == Asc.c_oAscAutoFilterTypes.Top10) {
str = (subtype || subtype===null) ? this.txtFilterTop : this.txtFilterBottom;
}
return str;
},
onUndo: function() { onUndo: function() {
if (this.api) { if (this.api) {
this.api.asc_Undo(); this.api.asc_Undo();
@ -1157,6 +1311,7 @@ define([
me.tooltips.coauth.apiHeight = me.documentHolder.cmpEl.height(); me.tooltips.coauth.apiHeight = me.documentHolder.cmpEl.height();
me.tooltips.coauth.rightMenuWidth = $('#right-menu').width(); me.tooltips.coauth.rightMenuWidth = $('#right-menu').width();
me.tooltips.coauth.bodyWidth = $(window).width(); me.tooltips.coauth.bodyWidth = $(window).width();
me.tooltips.coauth.bodyHeight = $(window).height();
} }
}, },
@ -2838,7 +2993,31 @@ define([
txtPasteSourceFormat: 'Source formatting', txtPasteSourceFormat: 'Source formatting',
txtPasteDestFormat: 'Destination formatting', txtPasteDestFormat: 'Destination formatting',
txtUndoExpansion: 'Undo table autoexpansion', txtUndoExpansion: 'Undo table autoexpansion',
txtRedoExpansion: 'Redo table autoexpansion' txtRedoExpansion: 'Redo table autoexpansion',
txtAnd: 'and',
txtOr: 'or',
txtEquals : "Equals",
txtNotEquals : "Does not equal",
txtGreater : "Greater than",
txtGreaterEquals : "Greater than or equal to",
txtLess : "Less than",
txtLessEquals : "Less than or equal to",
txtAboveAve : 'Above average',
txtBelowAve : 'Below average',
txtBegins : "Begins with",
txtNotBegins : "Does not begin with",
txtEnds : "Ends with",
txtNotEnds : "Does not end with",
txtContains : "Contains",
txtNotContains : "Does not contain",
txtFilterTop: 'Top',
txtFilterBottom: 'Bottom',
txtItems: 'items',
txtPercent: 'percent',
txtEqualsToCellColor: 'Equals to cell color',
txtEqualsToFontColor: 'Equals to font color',
txtAll: '(All)',
txtBlanks: '(Blanks)'
}, SSE.Controllers.DocumentHolder || {})); }, SSE.Controllers.DocumentHolder || {}));
}); });

View file

@ -330,6 +330,30 @@
"SSE.Controllers.DocumentHolder.txtUnderbar": "Bar under text", "SSE.Controllers.DocumentHolder.txtUnderbar": "Bar under text",
"SSE.Controllers.DocumentHolder.txtUndoExpansion": "Undo table autoexpansion", "SSE.Controllers.DocumentHolder.txtUndoExpansion": "Undo table autoexpansion",
"SSE.Controllers.DocumentHolder.txtWidth": "Width", "SSE.Controllers.DocumentHolder.txtWidth": "Width",
"SSE.Controllers.DocumentHolder.txtAnd": "and",
"SSE.Controllers.DocumentHolder.txtOr": "or",
"SSE.Controllers.DocumentHolder.txtFilterTop": "Top",
"SSE.Controllers.DocumentHolder.txtFilterBottom": "Bottom",
"SSE.Controllers.DocumentHolder.txtItems": "items",
"SSE.Controllers.DocumentHolder.txtPercent": "percent",
"SSE.Controllers.DocumentHolder.txtAll": "(All)",
"SSE.Controllers.DocumentHolder.txtBlanks": "(Blanks)",
"SSE.Controllers.DocumentHolder.txtAboveAve": "Above average",
"SSE.Controllers.DocumentHolder.txtBegins": "Begins with",
"SSE.Controllers.DocumentHolder.txtBelowAve": "Below average",
"SSE.Controllers.DocumentHolder.txtContains": "Contains",
"SSE.Controllers.DocumentHolder.txtEnds": "Ends with",
"SSE.Controllers.DocumentHolder.txtEquals": "Equals",
"SSE.Controllers.DocumentHolder.txtEqualsToCellColor": "Equal to cell color",
"SSE.Controllers.DocumentHolder.txtEqualsToFontColor": "Equal to font color",
"SSE.Controllers.DocumentHolder.txtGreater": "Greater than",
"SSE.Controllers.DocumentHolder.txtGreaterEquals": "Greater than or equal to",
"SSE.Controllers.DocumentHolder.txtLess": "Less than",
"SSE.Controllers.DocumentHolder.txtLessEquals": "Less than or equal to",
"SSE.Controllers.DocumentHolder.txtNotBegins": "Does not begin with",
"SSE.Controllers.DocumentHolder.txtNotContains": "Does not contain",
"SSE.Controllers.DocumentHolder.txtNotEnds": "Does not end with",
"SSE.Controllers.DocumentHolder.txtNotEquals": "Does not equal",
"SSE.Controllers.LeftMenu.newDocumentTitle": "Unnamed spreadsheet", "SSE.Controllers.LeftMenu.newDocumentTitle": "Unnamed spreadsheet",
"SSE.Controllers.LeftMenu.textByColumns": "By columns", "SSE.Controllers.LeftMenu.textByColumns": "By columns",
"SSE.Controllers.LeftMenu.textByRows": "By rows", "SSE.Controllers.LeftMenu.textByRows": "By rows",