Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add position in tooltip config #2869 #2896

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@visactor/vtable",
"comment": "feat: add position in tooltip config #2869",
"type": "none"
}
],
"packageName": "@visactor/vtable"
}
3 changes: 2 additions & 1 deletion packages/vtable/examples/interactive/tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ export function createTable() {
tooltip: {
renderMode: 'html',
isShowOverflowTextTooltip: true,
overflowTextTooltipDisappearDelay: 1000
overflowTextTooltipDisappearDelay: 1000,
position: VTable.TYPES.Placement.top
}
};

Expand Down
6 changes: 3 additions & 3 deletions packages/vtable/src/components/tooltip/TooltipHandler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { CellRange, RectProps } from '../../ts-types';
import { Placement } from '../../ts-types';
import type { Placement } from '../../ts-types';
import type { BaseTooltip } from './BaseTooltip';
import { BubbleTooltip } from './Tooltip';
import { cellInRange } from '../../tools/helper';
Expand Down Expand Up @@ -196,7 +196,7 @@ export class TooltipHandler {
tooltipOption = {
content: headerDescription,
referencePosition: {
placement: Placement.bottom,
placement: table.internalProps.tooltip.position,
rect
},
disappearDelay: table.internalProps.tooltip.overflowTextTooltipDisappearDelay ?? 0,
Expand All @@ -216,7 +216,7 @@ export class TooltipHandler {
${overflowText}`
: overflowText,
referencePosition: {
placement: Placement.bottom,
placement: table.internalProps.tooltip.position,
rect
},
disappearDelay: table.internalProps.tooltip.overflowTextTooltipDisappearDelay ?? 0,
Expand Down
9 changes: 6 additions & 3 deletions packages/vtable/src/core/BaseTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ import {
type LayoutObjectId,
type HeightModeDef,
type ITableThemeDefine,
InteractionState
InteractionState,
Placement
} from '../ts-types';
import type {
AnyFunction,
Expand Down Expand Up @@ -461,7 +462,8 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI {
parentElement: this.getElement(),
renderMode: 'html',
isShowOverflowTextTooltip: false,
confine: true
confine: true,
position: Placement.bottom
},
options.tooltip
);
Expand Down Expand Up @@ -2375,7 +2377,8 @@ export abstract class BaseTable extends EventTarget implements BaseTableAPI {
parentElement: this.getElement(),
renderMode: 'html',
isShowOverflowTextTooltip: false,
confine: true
confine: true,
position: Placement.bottom
},
options.tooltip
);
Expand Down
5 changes: 4 additions & 1 deletion packages/vtable/src/ts-types/base-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ import type {
HeightAdaptiveModeDef,
ColumnInfo,
RowInfo,
CellAddressWithBound
CellAddressWithBound,
Placement
} from '.';
import type { TooltipOptions } from './tooltip';
import type { IWrapTextGraphicAttribute } from '../scenegraph/graphic/text';
Expand Down Expand Up @@ -211,6 +212,7 @@ export interface IBaseTableProtected {
overflowTextTooltipDisappearDelay?: number;
/** 弹框是否需要限定在表格区域内 */
confine: boolean;
position: Placement;
};

dataSourceEventIds?: EventListenerId[];
Expand Down Expand Up @@ -402,6 +404,7 @@ export interface BaseTableConstructorOptions {
overflowTextTooltipDisappearDelay?: number;
/** 是否将 tooltip 框限制在画布区域内,默认开启。针对renderMode:"html"有效 */
confine?: boolean;
position?: Placement;
};
/**
* Theme
Expand Down
Loading