|
@@ -998,6 +998,7 @@ const SpreadJsObj = {
|
|
|
* @returns {TipCellType}
|
|
|
*/
|
|
|
getTipCellType: function () {
|
|
|
+ const maxHintWidth = 200;
|
|
|
const TipCellType = function () {};
|
|
|
// 继承 SpreadJs定义的 普通的TextCellType
|
|
|
TipCellType.prototype = new spreadNS.CellTypes.Text();
|
|
@@ -1031,7 +1032,6 @@ const SpreadJsObj = {
|
|
|
cellRect: cellRect,
|
|
|
sheet: context.sheet,
|
|
|
sheetArea: context.sheetArea,
|
|
|
- ctx: context.sheet.getParent().xs,
|
|
|
};
|
|
|
};
|
|
|
/**
|
|
@@ -1062,8 +1062,9 @@ const SpreadJsObj = {
|
|
|
document.body.insertBefore(div, null);
|
|
|
}
|
|
|
this._toolTipElement = div;
|
|
|
+ const validWidth = Math.min($(window).width() - (pos.x + hitinfo.x + 15) - 10, maxHintWidth);
|
|
|
$(this._toolTipElement).text(text).css("top", pos.y + hitinfo.y + 15).css("left", pos.x + hitinfo.x + 15)
|
|
|
- .css("width", $(window).width() - (pos.x + hitinfo.x + 15) - 10);
|
|
|
+ .css("max-width", validWidth);
|
|
|
$(this._toolTipElement).show("fast");
|
|
|
}
|
|
|
}
|
|
@@ -1082,6 +1083,7 @@ const SpreadJsObj = {
|
|
|
return new TipCellType();
|
|
|
},
|
|
|
getAutoTipCellType: function () {
|
|
|
+ const maxHintWidth = 200;
|
|
|
const TipCellType = function () {};
|
|
|
// 继承 SpreadJs定义的 普通的TextCellType
|
|
|
TipCellType.prototype = new spreadNS.CellTypes.Text();
|
|
@@ -1129,26 +1131,27 @@ const SpreadJsObj = {
|
|
|
text = col.getTip(sortData[hitinfo.row]);
|
|
|
}
|
|
|
const pos = SpreadJsObj.getObjPos(hitinfo.sheet.getParent().qo);
|
|
|
- if (pos && showTip(hitinfo, text)) {
|
|
|
- if (!this._toolTipElement) {
|
|
|
- let div = $('#autoTip')[0];
|
|
|
- if (!div) {
|
|
|
- div = document.createElement("div");
|
|
|
- $(div).css("position", "absolute")
|
|
|
- .css("border", "1px #C0C0C0 solid")
|
|
|
- .css("box-shadow", "1px 2px 5px rgba(0,0,0,0.4)")
|
|
|
- .css("font", "9pt Arial")
|
|
|
- .css("background", "white")
|
|
|
- .css("padding", 5).css("z-index", 99).css("word-wrap", "break-word")
|
|
|
- .attr("id", 'autoTip');
|
|
|
- //$(div).hide();
|
|
|
- document.body.insertBefore(div, null);
|
|
|
- }
|
|
|
- this._toolTipElement = div;
|
|
|
- $(this._toolTipElement).text(text).css("top", pos.y + hitinfo.y + 15).css("left", pos.x + hitinfo.x + 15)
|
|
|
- .css("width", $(window).width() - (pos.x + hitinfo.x + 15) - 10);
|
|
|
- $(this._toolTipElement).show("fast");
|
|
|
+ if (!this._toolTipElement) {
|
|
|
+ let div = $('#autoTip')[0];
|
|
|
+ if (!div) {
|
|
|
+ div = document.createElement("div");
|
|
|
+ $(div).css("position", "absolute")
|
|
|
+ .css("border", "1px #C0C0C0 solid")
|
|
|
+ .css("box-shadow", "1px 2px 5px rgba(0,0,0,0.4)")
|
|
|
+ .css("font", "9pt Arial")
|
|
|
+ .css("background", "white")
|
|
|
+ .css("padding", 5).css("z-index", 99).css("word-wrap", "break-word")
|
|
|
+ .attr("id", 'autoTip');
|
|
|
+ //$(div).hide();
|
|
|
+ document.body.insertBefore(div, null);
|
|
|
}
|
|
|
+ this._toolTipElement = div;
|
|
|
+ const validWidth = Math.min($(window).width() - (pos.x + hitinfo.x + 15) - 10, maxHintWidth);
|
|
|
+ $(this._toolTipElement).text(text).css("top", pos.y + hitinfo.y + 15).css("left", pos.x + hitinfo.x + 15)
|
|
|
+ .css("max-width", validWidth);
|
|
|
+ $(this._toolTipElement).show("fast");
|
|
|
+ }
|
|
|
+ if (pos && showTip(hitinfo, text)) {
|
|
|
}
|
|
|
};
|
|
|
/**
|