mirror of
https://github.com/VisActor/VTable
synced 2024-11-22 01:52:03 +00:00
feat: isShowOverflowTextTooltip support function
This commit is contained in:
parent
72422d2317
commit
ed5d72cd66
@ -0,0 +1,10 @@
|
||||
{
|
||||
"changes": [
|
||||
{
|
||||
"packageName": "@visactor/vtable",
|
||||
"comment": "feat: isShowOverflowTextTooltip support function",
|
||||
"type": "none"
|
||||
}
|
||||
],
|
||||
"packageName": "@visactor/vtable"
|
||||
}
|
@ -8,6 +8,7 @@ import { isMobile } from '../../tools/util';
|
||||
import type { TooltipOptions } from '../../ts-types/tooltip';
|
||||
import { TABLE_EVENT_TYPE } from '../../core/TABLE_EVENT_TYPE';
|
||||
import type { BaseTableAPI } from '../../ts-types/base-table';
|
||||
import { isFunction } from '@visactor/vutils';
|
||||
const TOOLTIP_INSTANCE_FACTORY = {
|
||||
// tooltip(table: BaseTableAPI): BaseTooltip {
|
||||
// return new Tooltip(table);
|
||||
@ -201,7 +202,11 @@ export class TooltipHandler {
|
||||
disappearDelay: table.internalProps.tooltip.overflowTextTooltipDisappearDelay ?? 0,
|
||||
style: table.theme.tooltipStyle
|
||||
};
|
||||
} else if (table.internalProps.tooltip?.isShowOverflowTextTooltip) {
|
||||
} else if (
|
||||
(isFunction(table.internalProps.tooltip?.isShowOverflowTextTooltip) &&
|
||||
table.internalProps.tooltip.isShowOverflowTextTooltip(col, row, table)) ||
|
||||
table.internalProps.tooltip.isShowOverflowTextTooltip
|
||||
) {
|
||||
const overflowText = table.getCellOverflowText(col, row);
|
||||
const rect = table.getCellRangeRelativeRect({ col, row });
|
||||
if (overflowText) {
|
||||
|
@ -206,7 +206,7 @@ export interface IBaseTableProtected {
|
||||
parentElement: HTMLElement;
|
||||
renderMode: 'html' | 'canvas';
|
||||
/** 代替原来hover:isShowTooltip配置 */
|
||||
isShowOverflowTextTooltip: boolean;
|
||||
isShowOverflowTextTooltip: boolean | ((col: number, row: number, table: BaseTableAPI) => boolean);
|
||||
/** 缩略文字提示框 延迟消失时间 */
|
||||
overflowTextTooltipDisappearDelay?: number;
|
||||
/** 弹框是否需要限定在表格区域内 */
|
||||
@ -397,7 +397,7 @@ export interface BaseTableConstructorOptions {
|
||||
/** html目前实现较完整 先默认html渲染方式 */
|
||||
renderMode?: 'html'; // 目前暂不支持canvas方案
|
||||
/** 是否显示缩略文字提示框。 代替原来hover:isShowTooltip配置 暂时需要将renderMode配置为html才能显示,canvas的还未开发*/
|
||||
isShowOverflowTextTooltip?: boolean;
|
||||
isShowOverflowTextTooltip?: boolean | ((col: number, row: number, table: BaseTableAPI) => boolean);
|
||||
/** 缩略文字提示框 延迟消失时间 */
|
||||
overflowTextTooltipDisappearDelay?: number;
|
||||
/** 是否将 tooltip 框限制在画布区域内,默认开启。针对renderMode:"html"有效 */
|
||||
|
Loading…
Reference in New Issue
Block a user