chore: fix ts def (#42218)

* chore: fix ts def

* chore: fix ts
This commit is contained in:
二货爱吃白萝卜 2023-05-08 17:37:04 +08:00 committed by GitHub
parent 613077ac8e
commit 711c9d6754
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 9 deletions

View File

@ -288,7 +288,8 @@ const Dropdown: CompoundedComponent = (props) => {
mouseEnterDelay={mouseEnterDelay}
mouseLeaveDelay={mouseLeaveDelay}
visible={mergedOpen}
builtinPlacements={builtinPlacements}
// TODO: remove `as any` when `rc-dropdown` upgrade to use `@rc-component/trigger`
builtinPlacements={builtinPlacements as any}
arrow={!!arrow}
overlayClassName={overlayClassNameCustomized}
prefixCls={prefixCls}

View File

@ -1,17 +1,14 @@
import type { BuildInPlacements, AlignType } from '@rc-component/trigger';
import type { AlignType, BuildInPlacements } from '@rc-component/trigger';
import classNames from 'classnames';
import RcTooltip from 'rc-tooltip';
import type { placements as Placements } from 'rc-tooltip/lib/placements';
import type {
TooltipProps as RcTooltipProps,
TooltipRef as RcTooltipRef,
} from 'rc-tooltip/lib/Tooltip';
import type { placements as Placements } from 'rc-tooltip/lib/placements';
import useMergedState from 'rc-util/lib/hooks/useMergedState';
import type { CSSProperties } from 'react';
import * as React from 'react';
import { ConfigContext } from '../config-provider';
import { NoCompactStyle } from '../space/Compact';
import theme from '../theme';
import type { PresetColorType } from '../_util/colors';
import { getTransitionName } from '../_util/motion';
import type { AdjustOverflow, PlacementsConfig } from '../_util/placements';
@ -19,6 +16,9 @@ import getPlacements from '../_util/placements';
import { cloneElement, isFragment, isValidElement } from '../_util/reactNode';
import type { LiteralUnion } from '../_util/type';
import warning from '../_util/warning';
import { ConfigContext } from '../config-provider';
import { NoCompactStyle } from '../space/Compact';
import theme from '../theme';
import PurePanel from './PurePanel';
import useStyle from './style';
import { parseColor } from './util';
@ -311,12 +311,12 @@ const Tooltip = React.forwardRef<TooltipRef, TooltipProps>((props, ref) => {
const transformOrigin: React.CSSProperties = { top: '50%', left: '50%' };
if (/top|Bottom/.test(placement)) {
transformOrigin.top = `${rect.height - align.offset![1]}px`;
transformOrigin.top = `${rect.height - (align.offset![1] as number)}px`;
} else if (/Top|bottom/.test(placement)) {
transformOrigin.top = `${-align.offset![1]}px`;
}
if (/left|Right/.test(placement)) {
transformOrigin.left = `${rect.width - align.offset![0]}px`;
transformOrigin.left = `${rect.width - (align.offset![0] as number)}px`;
} else if (/right|Left/.test(placement)) {
transformOrigin.left = `${-align.offset![0]}px`;
}

View File

@ -115,7 +115,7 @@
"@ctrl/tinycolor": "^3.6.0",
"@rc-component/mutate-observer": "^1.0.0",
"@rc-component/tour": "~1.8.0",
"@rc-component/trigger": "^1.7.0",
"@rc-component/trigger": "^1.11.0",
"classnames": "^2.2.6",
"copy-to-clipboard": "^3.2.0",
"dayjs": "^1.11.1",