[SSE] Add tooltip for slicer buttons

This commit is contained in:
Julia Radzhabova 2020-05-28 13:58:38 +03:00
parent bebe79c925
commit 6a8e712c8f
5 changed files with 69 additions and 6 deletions

View file

@ -97,6 +97,9 @@ define([
row_column: { row_column: {
ttHeight: 20 ttHeight: 20
}, },
slicer: {
ttHeight: 20
},
filter: {ttHeight: 40}, filter: {ttHeight: 40},
func_arg: {}, func_arg: {},
input_msg: {} input_msg: {}
@ -957,7 +960,8 @@ define([
/** coauthoring end **/ /** coauthoring end **/
index_locked, index_locked,
index_column, index_row, index_column, index_row,
index_filter; index_filter,
index_slicer;
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:
@ -980,6 +984,9 @@ define([
case Asc.c_oAscMouseMoveType.Filter: case Asc.c_oAscMouseMoveType.Filter:
index_filter = i; index_filter = i;
break; break;
case Asc.c_oAscMouseMoveType.Tooltip:
index_slicer = i;
break;
} }
} }
@ -992,6 +999,7 @@ define([
hyperlinkTip = me.tooltips.hyperlink, hyperlinkTip = me.tooltips.hyperlink,
row_columnTip = me.tooltips.row_column, row_columnTip = me.tooltips.row_column,
filterTip = me.tooltips.filter, filterTip = me.tooltips.filter,
slicerTip = me.tooltips.slicer,
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()
@ -1029,6 +1037,14 @@ define([
if (!index_locked) { if (!index_locked) {
me.hideCoAuthTips(); me.hideCoAuthTips();
} }
if (index_slicer===undefined) {
if (!slicerTip.isHidden && slicerTip.ref) {
slicerTip.ref.hide();
slicerTip.ref = undefined;
slicerTip.text = '';
slicerTip.isHidden = true;
}
}
} }
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) {
@ -1038,7 +1054,6 @@ define([
filterTip.isHidden = true; filterTip.isHidden = true;
} }
} }
// show tooltips // show tooltips
/** coauthoring begin **/ /** coauthoring begin **/
var getUserName = function(id){ var getUserName = function(id){
@ -1281,6 +1296,48 @@ define([
}); });
} }
} }
if (index_slicer!==undefined && me.permissions.isEdit) {
if (!slicerTip.parentEl) {
slicerTip.parentEl = $('<div id="tip-container-slicertip" style="position: absolute; z-index: 10000;"></div>');
me.documentHolder.cmpEl.append(slicerTip.parentEl);
}
var data = dataarray[index_slicer-1],
str = data.asc_getTooltip();
if (slicerTip.ref && slicerTip.ref.isVisible()) {
if (slicerTip.text != str) {
slicerTip.text = str;
slicerTip.ref.setTitle(str);
slicerTip.ref.updateTitle();
}
}
if (!slicerTip.ref || !slicerTip.ref.isVisible()) {
slicerTip.text = str;
slicerTip.ref = new Common.UI.Tooltip({
owner : slicerTip.parentEl,
html : true,
title : str
});
slicerTip.ref.show([-10000, -10000]);
slicerTip.isHidden = false;
showPoint = [data.asc_getX(), data.asc_getY()];
showPoint[0] += (pos[0] + 6);
showPoint[1] += (pos[1] - 20 - slicerTip.ttHeight);
var tipwidth = slicerTip.ref.getBSTip().$tip.width();
if (showPoint[0] + tipwidth > me.tooltips.coauth.bodyWidth )
showPoint[0] = me.tooltips.coauth.bodyWidth - tipwidth - 20;
slicerTip.ref.getBSTip().$tip.css({
top : showPoint[1] + 'px',
left: showPoint[0] + 'px'
});
}
}
} }
}, },

View file

@ -127,7 +127,9 @@ define([
'Values': this.txtValues, 'Values': this.txtValues,
'Grand Total': this.txtGrandTotal, 'Grand Total': this.txtGrandTotal,
'Row Labels': this.txtRowLbls, 'Row Labels': this.txtRowLbls,
'Column Labels': this.txtColLbls 'Column Labels': this.txtColLbls,
'Multi-Select (Alt+S)': this.txtMultiSelect,
'Clear Filter (Alt+C)': this.txtClearFilter
}; };
styleNames.forEach(function(item){ styleNames.forEach(function(item){
translate[item] = me['txtStyle_' + item.replace(/ /g, '_')] || item; translate[item] = me['txtStyle_' + item.replace(/ /g, '_')] || item;
@ -2548,7 +2550,9 @@ define([
txtRowLbls: 'Row Labels', txtRowLbls: 'Row Labels',
txtColLbls: 'Column Labels', txtColLbls: 'Column Labels',
errNoDuplicates: 'No duplicate values found.', errNoDuplicates: 'No duplicate values found.',
errRemDuplicates: 'Duplicate values found and deleted: {0}, unique values left: {1}.' errRemDuplicates: 'Duplicate values found and deleted: {0}, unique values left: {1}.',
txtMultiSelect: 'Multi-Select (Alt+S)',
txtClearFilter: 'Clear Filter (Alt+C)'
} }
})(), SSE.Controllers.Main || {})) })(), SSE.Controllers.Main || {}))
}); });

View file

@ -233,7 +233,7 @@ define([
value: '1', value: '1',
allowDecimal: false, allowDecimal: false,
maxValue: 20000, maxValue: 20000,
minValue: 0 minValue: 1
}); });
this.lockedControls.push(this.numCols); this.lockedControls.push(this.numCols);

View file

@ -190,7 +190,7 @@ define([ 'text!spreadsheeteditor/main/app/template/SlicerSettingsAdvanced.tem
value: '1', value: '1',
allowDecimal: false, allowDecimal: false,
maxValue: 20000, maxValue: 20000,
minValue: 0 minValue: 1
}); });
this.numCols.on('change', _.bind(function(field, newValue, oldValue, eOpts){ this.numCols.on('change', _.bind(function(field, newValue, oldValue, eOpts){
var numval = field.getNumberValue(); var numval = field.getNumberValue();

View file

@ -814,6 +814,8 @@
"SSE.Controllers.Main.warnNoLicense": "This version of %1 editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider purchasing a commercial license.", "SSE.Controllers.Main.warnNoLicense": "This version of %1 editors has certain limitations for concurrent connections to the document server.<br>If you need more please consider purchasing a commercial license.",
"SSE.Controllers.Main.warnNoLicenseUsers": "This version of %1 editors has certain limitations for concurrent users.<br>If you need more please consider purchasing a commercial license.", "SSE.Controllers.Main.warnNoLicenseUsers": "This version of %1 editors has certain limitations for concurrent users.<br>If you need more please consider purchasing a commercial license.",
"SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", "SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.",
"SSE.Controllers.Main.txtMultiSelect": "Multi-Select (Alt+S)",
"SSE.Controllers.Main.txtClearFilter": "Clear Filter (Alt+C)",
"SSE.Controllers.Print.strAllSheets": "All Sheets", "SSE.Controllers.Print.strAllSheets": "All Sheets",
"SSE.Controllers.Print.textFirstCol": "First column", "SSE.Controllers.Print.textFirstCol": "First column",
"SSE.Controllers.Print.textFirstRow": "First row", "SSE.Controllers.Print.textFirstRow": "First row",