Browse Source

type: simplify getPlacement return type (#40775)

pull/40795/head
lijianan 2 years ago
committed by GitHub
parent
commit
de82a15b22
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      components/select/index.tsx

12
components/select/index.tsx

@ -1,7 +1,7 @@
// TODO: 4.0 - codemod should help to change `filterOption` to support node props. // TODO: 4.0 - codemod should help to change `filterOption` to support node props.
import classNames from 'classnames'; import classNames from 'classnames';
import type { BaseSelectRef, SelectProps as RcSelectProps } from 'rc-select';
import RcSelect, { OptGroup, Option } from 'rc-select'; import RcSelect, { OptGroup, Option } from 'rc-select';
import type { SelectProps as RcSelectProps, BaseSelectRef } from 'rc-select';
import type { OptionProps } from 'rc-select/lib/Option'; import type { OptionProps } from 'rc-select/lib/Option';
import type { BaseOptionType, DefaultOptionType } from 'rc-select/lib/Select'; import type { BaseOptionType, DefaultOptionType } from 'rc-select/lib/Select';
import omit from 'rc-util/lib/omit'; import omit from 'rc-util/lib/omit';
@ -18,10 +18,10 @@ import type { InputStatus } from '../_util/statusUtils';
import { getMergedStatus, getStatusClassNames } from '../_util/statusUtils'; import { getMergedStatus, getStatusClassNames } from '../_util/statusUtils';
import getIcons from './utils/iconUtil'; import getIcons from './utils/iconUtil';
import useStyle from './style'; import { useCompactItemContext } from '../space/Compact';
import genPurePanel from '../_util/PurePanel'; import genPurePanel from '../_util/PurePanel';
import warning from '../_util/warning'; import warning from '../_util/warning';
import { useCompactItemContext } from '../space/Compact'; import useStyle from './style';
type RawValue = string | number; type RawValue = string | number;
@ -182,13 +182,11 @@ const InternalSelect = <OptionType extends BaseOptionType | DefaultOptionType =
); );
// ===================== Placement ===================== // ===================== Placement =====================
const getPlacement = () => { const getPlacement = (): SelectCommonPlacement => {
if (placement !== undefined) { if (placement !== undefined) {
return placement; return placement;
} }
return direction === 'rtl' return direction === 'rtl' ? 'bottomRight' : 'bottomLeft';
? ('bottomRight' as SelectCommonPlacement)
: ('bottomLeft' as SelectCommonPlacement);
}; };
// ====================== Warning ====================== // ====================== Warning ======================

Loading…
Cancel
Save