|
@@ -627,7 +627,8 @@ const SpreadJsObj = {
|
|
}
|
|
}
|
|
if(colSetting.cellType === 'ellipsisAutoTip') {
|
|
if(colSetting.cellType === 'ellipsisAutoTip') {
|
|
if (!sheet.extendCellType.ellipsisAutoTip) {
|
|
if (!sheet.extendCellType.ellipsisAutoTip) {
|
|
- sheet.extendCellType.ellipsisAutoTip = this.CellType.getEllipsisTextAutoTipCellType();
|
|
|
|
|
|
+ const scrollHeightClass = colSetting.scrollHeightClass ? colSetting.scrollHeightClass : false;
|
|
|
|
+ sheet.extendCellType.ellipsisAutoTip = this.CellType.getEllipsisTextAutoTipCellType(scrollHeightClass);
|
|
}
|
|
}
|
|
sheet.getRange(-1, col, -1, 1).cellType(sheet.extendCellType.ellipsisAutoTip);
|
|
sheet.getRange(-1, col, -1, 1).cellType(sheet.extendCellType.ellipsisAutoTip);
|
|
}
|
|
}
|
|
@@ -1554,7 +1555,7 @@ const SpreadJsObj = {
|
|
* 获取 带悬浮提示的CellType
|
|
* 获取 带悬浮提示的CellType
|
|
* @returns {TipCellType}
|
|
* @returns {TipCellType}
|
|
*/
|
|
*/
|
|
- getTipCellType: function () {
|
|
|
|
|
|
+ getTipCellType: function (scrollHeightClass = false) {
|
|
const maxHintWidth = 200, indent = 15, borderIndent = 10;
|
|
const maxHintWidth = 200, indent = 15, borderIndent = 10;
|
|
const TipCellType = function () {};
|
|
const TipCellType = function () {};
|
|
// 继承 SpreadJs定义的 普通的TextCellType
|
|
// 继承 SpreadJs定义的 普通的TextCellType
|
|
@@ -1626,12 +1627,13 @@ const SpreadJsObj = {
|
|
}
|
|
}
|
|
const validWidth = $(window).width() - (pos.x + hitinfo.x + indent) - borderIndent;
|
|
const validWidth = $(window).width() - (pos.x + hitinfo.x + indent) - borderIndent;
|
|
const textWidth = this.getTextDisplayWidth(hitinfo, text, "9pt Arial");
|
|
const textWidth = this.getTextDisplayWidth(hitinfo, text, "9pt Arial");
|
|
|
|
+ const scrollTop = scrollHeightClass ? $(scrollHeightClass).scrollTop() : 0;
|
|
if (validWidth >= maxHintWidth || textWidth <= validWidth) {
|
|
if (validWidth >= maxHintWidth || textWidth <= validWidth) {
|
|
- $(div).html(text).css("top", pos.y + hitinfo.y + indent).css("left", pos.x + hitinfo.x + indent);
|
|
|
|
|
|
+ $(div).html(text).css("top", pos.y + hitinfo.y - scrollTop + indent).css("left", pos.x + hitinfo.x + indent);
|
|
} else if (textWidth > maxHintWidth) {
|
|
} else if (textWidth > maxHintWidth) {
|
|
- $(div).html(text).css("top", pos.y + hitinfo.y + indent).css("left", pos.x + hitinfo.x - indent - maxHintWidth);
|
|
|
|
|
|
+ $(div).html(text).css("top", pos.y + hitinfo.y - scrollTop + indent).css("left", pos.x + hitinfo.x - indent - maxHintWidth);
|
|
} else {
|
|
} else {
|
|
- $(div).html(text).css("top", pos.y + hitinfo.y + indent).css("left", pos.x + hitinfo.x - indent - textWidth);
|
|
|
|
|
|
+ $(div).html(text).css("top", pos.y + hitinfo.y - scrollTop + indent).css("left", pos.x + hitinfo.x - indent - textWidth);
|
|
}
|
|
}
|
|
this._toolTipElement = div;
|
|
this._toolTipElement = div;
|
|
$(div).show("fast");
|
|
$(div).show("fast");
|
|
@@ -1651,10 +1653,10 @@ const SpreadJsObj = {
|
|
|
|
|
|
return new TipCellType();
|
|
return new TipCellType();
|
|
},
|
|
},
|
|
- getAutoTipCellType: function () {
|
|
|
|
|
|
+ getAutoTipCellType: function (scrollHeightClass) {
|
|
const AutoTipCellType = function () {};
|
|
const AutoTipCellType = function () {};
|
|
// 继承 TipCellType
|
|
// 继承 TipCellType
|
|
- AutoTipCellType.prototype = SpreadJsObj.CellType.getTipCellType();
|
|
|
|
|
|
+ AutoTipCellType.prototype = SpreadJsObj.CellType.getTipCellType(scrollHeightClass);
|
|
const proto = AutoTipCellType.prototype;
|
|
const proto = AutoTipCellType.prototype;
|
|
proto.showTip = function (hitinfo, text) {
|
|
proto.showTip = function (hitinfo, text) {
|
|
return text && text !== '' && this.getTextDisplayWidth(hitinfo, text) > hitinfo.cellRect.width;
|
|
return text && text !== '' && this.getTextDisplayWidth(hitinfo, text) > hitinfo.cellRect.width;
|
|
@@ -2342,10 +2344,10 @@ const SpreadJsObj = {
|
|
};
|
|
};
|
|
return new EllipsisTextCellType();
|
|
return new EllipsisTextCellType();
|
|
},
|
|
},
|
|
- getEllipsisTextAutoTipCellType: function () {
|
|
|
|
|
|
+ getEllipsisTextAutoTipCellType: function (scrollHeightClass) {
|
|
const CellType = function () {};
|
|
const CellType = function () {};
|
|
// 继承 TipCellType
|
|
// 继承 TipCellType
|
|
- CellType.prototype = SpreadJsObj.CellType.getAutoTipCellType();
|
|
|
|
|
|
+ CellType.prototype = SpreadJsObj.CellType.getAutoTipCellType(scrollHeightClass);
|
|
const proto = CellType.prototype;
|
|
const proto = CellType.prototype;
|
|
const ellipsisTextCellType = SpreadJsObj.CellType.getEllipsisTextCellType();
|
|
const ellipsisTextCellType = SpreadJsObj.CellType.getEllipsisTextCellType();
|
|
proto.getEllipsisText = ellipsisTextCellType.getEllipsisText;
|
|
proto.getEllipsisText = ellipsisTextCellType.getEllipsisText;
|