chore: tooltip type fix (#3242)

pull/3244/head
ajuner 2020-11-23 13:47:26 +08:00 committed by GitHub
parent 04f72ed2cf
commit 2d6b50242c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 5 deletions

View File

@ -56,7 +56,7 @@ export default defineComponent({
}, },
}, },
methods: { methods: {
handleVisibleChange(visible) { handleVisibleChange(visible: boolean) {
if (!hasProp(this, 'visible')) { if (!hasProp(this, 'visible')) {
this.sVisible = this.isNoTitle() ? false : visible; this.sVisible = this.isNoTitle() ? false : visible;
} }
@ -85,7 +85,7 @@ export default defineComponent({
// Fix Tooltip won't hide at disabled button // Fix Tooltip won't hide at disabled button
// mouse events don't trigger at disabled button in Chrome // mouse events don't trigger at disabled button in Chrome
// https://github.com/react-component/tooltip/issues/18 // https://github.com/react-component/tooltip/issues/18
getDisabledCompatibleChildren(ele) { getDisabledCompatibleChildren(ele: any) {
if ( if (
((typeof ele.type === 'object' && ((typeof ele.type === 'object' &&
(ele.type.__ANT_BUTTON === true || (ele.type.__ANT_BUTTON === true ||
@ -143,7 +143,7 @@ export default defineComponent({
}, },
// //
onPopupAlign(domNode, align) { onPopupAlign(domNode: HTMLElement, align: any) {
const placements = this.getPlacements(); const placements = this.getPlacements();
// //
const placement = Object.keys(placements).filter( const placement = Object.keys(placements).filter(

View File

@ -12,7 +12,15 @@ const autoAdjustOverflowDisabled = {
const targetOffset = [0, 0]; 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') { if (typeof autoAdjustOverflow === 'boolean') {
return autoAdjustOverflow ? autoAdjustOverflowEnabled : autoAdjustOverflowDisabled; return autoAdjustOverflow ? autoAdjustOverflowEnabled : autoAdjustOverflowDisabled;
} }
@ -22,7 +30,7 @@ export function getOverflowOptions(autoAdjustOverflow) {
}; };
} }
export default function getPlacements(config) { export default function getPlacements(config: PlacementsConfig) {
const { const {
arrowWidth = 5, arrowWidth = 5,
horizontalArrowShift = 16, horizontalArrowShift = 16,