Skip to content

Commit

Permalink
chore: tooltip type fix (#3242)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajuner authored Nov 23, 2020
1 parent 04f72ed commit 2d6b502
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 3 additions & 3 deletions components/tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default defineComponent({
},
},
methods: {
handleVisibleChange(visible) {
handleVisibleChange(visible: boolean) {
if (!hasProp(this, 'visible')) {
this.sVisible = this.isNoTitle() ? false : visible;
}
Expand Down Expand Up @@ -85,7 +85,7 @@ export default defineComponent({
// Fix Tooltip won't hide at disabled button
// mouse events don't trigger at disabled button in Chrome
// https://github.com/react-component/tooltip/issues/18
getDisabledCompatibleChildren(ele) {
getDisabledCompatibleChildren(ele: any) {
if (
((typeof ele.type === 'object' &&
(ele.type.__ANT_BUTTON === true ||
Expand Down Expand Up @@ -143,7 +143,7 @@ export default defineComponent({
},

// 动态设置动画点
onPopupAlign(domNode, align) {
onPopupAlign(domNode: HTMLElement, align: any) {
const placements = this.getPlacements();
// 当前返回的位置
const placement = Object.keys(placements).filter(
Expand Down
12 changes: 10 additions & 2 deletions components/tooltip/placements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@ const autoAdjustOverflowDisabled = {

const targetOffset = [0, 0];

export function getOverflowOptions(autoAdjustOverflow) {
interface PlacementsConfig {
arrowPointAtCenter: boolean;
arrowWidth?: number;
verticalArrowShift?: number;
horizontalArrowShift?: number;
autoAdjustOverflow?: boolean | Object;
}

export function getOverflowOptions(autoAdjustOverflow: boolean | Object) {
if (typeof autoAdjustOverflow === 'boolean') {
return autoAdjustOverflow ? autoAdjustOverflowEnabled : autoAdjustOverflowDisabled;
}
Expand All @@ -22,7 +30,7 @@ export function getOverflowOptions(autoAdjustOverflow) {
};
}

export default function getPlacements(config) {
export default function getPlacements(config: PlacementsConfig) {
const {
arrowWidth = 5,
horizontalArrowShift = 16,
Expand Down

0 comments on commit 2d6b502

Please sign in to comment.