refactor: datepicker type

pull/6246/head^2
tangjinzhou 2023-02-12 11:18:49 +08:00
parent 80918cba98
commit 1d774507c0
67 changed files with 173 additions and 144 deletions

View File

@ -15,13 +15,14 @@ import type { CommonProps, RangePickerProps } from './props';
import { commonProps, rangePickerProps } from './props'; import { commonProps, rangePickerProps } from './props';
import type { PanelMode, RangeValue } from '../../vc-picker/interface'; import type { PanelMode, RangeValue } from '../../vc-picker/interface';
import type { RangePickerSharedProps } from '../../vc-picker/RangePicker'; import type { RangePickerSharedProps } from '../../vc-picker/RangePicker';
import devWarning from '../../vc-util/devWarning';
import { FormItemInputContext, useInjectFormItemContext } from '../../form/FormItemContext'; import { FormItemInputContext, useInjectFormItemContext } from '../../form/FormItemContext';
import omit from '../../_util/omit'; import omit from '../../_util/omit';
import { getMergedStatus, getStatusClassNames } from '../../_util/statusUtils'; import { getMergedStatus, getStatusClassNames } from '../../_util/statusUtils';
//CSSINJS //CSSINJS
import useStyle from '../style'; import useStyle from '../style';
import { useCompactItemContext } from '../../space/Compact';
import devWarning from '../../vc-util/devWarning';
export default function generateRangePicker<DateType, ExtraProps = {}>( export default function generateRangePicker<DateType, ExtraProps = {}>(
generateConfig: GenerateConfig<DateType>, generateConfig: GenerateConfig<DateType>,
@ -52,19 +53,27 @@ export default function generateRangePicker<DateType, ExtraProps = {}>(
const props = _props as unknown as CommonProps<DateType> & RangePickerProps<DateType>; const props = _props as unknown as CommonProps<DateType> & RangePickerProps<DateType>;
const formItemContext = useInjectFormItemContext(); const formItemContext = useInjectFormItemContext();
const formItemInputContext = FormItemInputContext.useInject(); const formItemInputContext = FormItemInputContext.useInject();
// =================== Warning =====================
if (process.env.NODE_ENV !== 'production') {
devWarning(
!props.dropdownClassName,
'RangePicker',
'`dropdownClassName` is deprecated. Please use `popupClassName` instead.',
);
devWarning( devWarning(
!attrs.getCalendarContainer, !attrs.getCalendarContainer,
'DatePicker', 'DatePicker',
'`getCalendarContainer` is deprecated. Please use `getPopupContainer"` instead.', '`getCalendarContainer` is deprecated. Please use `getPopupContainer"` instead.',
); );
const { prefixCls, direction, getPopupContainer, size, rootPrefixCls } = useConfigInject( }
'picker',
props,
);
const { prefixCls, direction, getPopupContainer, size, rootPrefixCls, disabled } =
useConfigInject('picker', props);
const { compactSize, compactItemClassnames } = useCompactItemContext(prefixCls, direction);
const mergedSize = computed(() => compactSize.value || size.value);
// style // style
const [wrapSSR, hashId] = useStyle(prefixCls); const [wrapSSR, hashId] = useStyle(prefixCls);
const pickerRef = ref(); const pickerRef = ref();
expose({ expose({
focus: () => { focus: () => {
@ -186,13 +195,14 @@ export default function generateRangePicker<DateType, ExtraProps = {}>(
} }
ref={pickerRef} ref={pickerRef}
dropdownAlign={transPlacement2DropdownAlign(direction.value, props.placement)} dropdownAlign={transPlacement2DropdownAlign(direction.value, props.placement)}
placeholder={getRangePlaceholder(picker, locale, placeholder as [string, string])} placeholder={getRangePlaceholder(locale, picker, placeholder as [string, string])}
suffixIcon={suffixNode} suffixIcon={suffixNode}
clearIcon={clearIcon || <CloseCircleFilled />} clearIcon={clearIcon || <CloseCircleFilled />}
allowClear={allowClear} allowClear={allowClear}
transitionName={transitionName || `${rootPrefixCls.value}-slide-up`} transitionName={transitionName || `${rootPrefixCls.value}-slide-up`}
{...restProps} {...restProps}
{...additionalOverrideProps} {...additionalOverrideProps}
disabled={disabled.value}
id={id} id={id}
value={value.value} value={value.value}
defaultValue={defaultValue.value} defaultValue={defaultValue.value}
@ -200,7 +210,7 @@ export default function generateRangePicker<DateType, ExtraProps = {}>(
picker={picker} picker={picker}
class={classNames( class={classNames(
{ {
[`${pre}-${size.value}`]: size.value, [`${pre}-${mergedSize.value}`]: mergedSize.value,
[`${pre}-borderless`]: !bordered, [`${pre}-borderless`]: !bordered,
}, },
getStatusClassNames( getStatusClassNames(
@ -210,6 +220,7 @@ export default function generateRangePicker<DateType, ExtraProps = {}>(
), ),
attrs.class, attrs.class,
hashId.value, hashId.value,
compactItemClassnames.value,
)} )}
locale={locale!.lang} locale={locale!.lang}
prefixCls={pre} prefixCls={pre}
@ -221,7 +232,11 @@ export default function generateRangePicker<DateType, ExtraProps = {}>(
superNextIcon={slots.superNextIcon?.() || <span class={`${pre}-super-next-icon`} />} superNextIcon={slots.superNextIcon?.() || <span class={`${pre}-super-next-icon`} />}
components={Components} components={Components}
direction={direction.value} direction={direction.value}
dropdownClassName={classNames(hashId.value)} dropdownClassName={classNames(
hashId.value,
props.popupClassName,
props.dropdownClassName,
)}
onChange={onChange} onChange={onChange}
onOpenChange={onOpenChange} onOpenChange={onOpenChange}
onFocus={onFocus} onFocus={onFocus}

View File

@ -17,6 +17,7 @@ import { commonProps, datePickerProps } from './props';
import devWarning from '../../vc-util/devWarning'; import devWarning from '../../vc-util/devWarning';
import { FormItemInputContext, useInjectFormItemContext } from '../../form/FormItemContext'; import { FormItemInputContext, useInjectFormItemContext } from '../../form/FormItemContext';
import { getMergedStatus, getStatusClassNames } from '../../_util/statusUtils'; import { getMergedStatus, getStatusClassNames } from '../../_util/statusUtils';
import { useCompactItemContext } from '../../space/Compact';
//CSSINJS //CSSINJS
import useStyle from '../style'; import useStyle from '../style';
@ -55,22 +56,36 @@ export default function generateSinglePicker<DateType, ExtraProps = {}>(
ExtraProps; ExtraProps;
const formItemContext = useInjectFormItemContext(); const formItemContext = useInjectFormItemContext();
const formItemInputContext = FormItemInputContext.useInject(); const formItemInputContext = FormItemInputContext.useInject();
// =================== Warning =====================
if (process.env.NODE_ENV !== 'production') {
devWarning(
picker !== 'quarter',
displayName || 'DatePicker',
`DatePicker.${displayName} is legacy usage. Please use DatePicker[picker='${picker}'] directly.`,
);
devWarning(
!props.dropdownClassName,
displayName || 'DatePicker',
'`dropdownClassName` is deprecated. Please use `popupClassName` instead.',
);
devWarning( devWarning(
!(props.monthCellContentRender || slots.monthCellContentRender), !(props.monthCellContentRender || slots.monthCellContentRender),
'DatePicker', displayName || 'DatePicker',
'`monthCellContentRender` is deprecated. Please use `monthCellRender"` instead.', '`monthCellContentRender` is deprecated. Please use `monthCellRender"` instead.',
); );
devWarning( devWarning(
!attrs.getCalendarContainer, !attrs.getCalendarContainer,
'DatePicker', displayName || 'DatePicker',
'`getCalendarContainer` is deprecated. Please use `getPopupContainer"` instead.', '`getCalendarContainer` is deprecated. Please use `getPopupContainer"` instead.',
); );
const { prefixCls, direction, getPopupContainer, size, rootPrefixCls } = useConfigInject( }
'picker',
props,
);
const { prefixCls, direction, getPopupContainer, size, rootPrefixCls, disabled } =
useConfigInject('picker', props);
const { compactSize, compactItemClassnames } = useCompactItemContext(prefixCls, direction);
const mergedSize = computed(() => compactSize.value || size.value);
// style // style
const [wrapSSR, hashId] = useStyle(prefixCls); const [wrapSSR, hashId] = useStyle(prefixCls);
@ -198,7 +213,7 @@ export default function generateSinglePicker<DateType, ExtraProps = {}>(
dateRender={dateRender} dateRender={dateRender}
renderExtraFooter={renderExtraFooter} renderExtraFooter={renderExtraFooter}
ref={pickerRef} ref={pickerRef}
placeholder={getPlaceholder(mergedPicker, locale, placeholder)} placeholder={getPlaceholder(locale, mergedPicker, placeholder)}
suffixIcon={suffixNode} suffixIcon={suffixNode}
dropdownAlign={transPlacement2DropdownAlign(direction.value, props.placement)} dropdownAlign={transPlacement2DropdownAlign(direction.value, props.placement)}
clearIcon={clearIcon || <CloseCircleFilled />} clearIcon={clearIcon || <CloseCircleFilled />}
@ -215,7 +230,7 @@ export default function generateSinglePicker<DateType, ExtraProps = {}>(
locale={locale!.lang} locale={locale!.lang}
class={classNames( class={classNames(
{ {
[`${pre}-${size.value}`]: size.value, [`${pre}-${mergedSize.value}`]: mergedSize.value,
[`${pre}-borderless`]: !bordered, [`${pre}-borderless`]: !bordered,
}, },
getStatusClassNames( getStatusClassNames(
@ -225,7 +240,9 @@ export default function generateSinglePicker<DateType, ExtraProps = {}>(
), ),
attrs.class, attrs.class,
hashId.value, hashId.value,
compactItemClassnames.value,
)} )}
disabled={disabled.value}
prefixCls={pre} prefixCls={pre}
getPopupContainer={attrs.getCalendarContainer || getPopupContainer.value} getPopupContainer={attrs.getCalendarContainer || getPopupContainer.value}
generateConfig={generateConfig} generateConfig={generateConfig}
@ -235,7 +252,11 @@ export default function generateSinglePicker<DateType, ExtraProps = {}>(
superNextIcon={slots.superNextIcon?.() || <span class={`${pre}-super-next-icon`} />} superNextIcon={slots.superNextIcon?.() || <span class={`${pre}-super-next-icon`} />}
components={Components} components={Components}
direction={direction.value} direction={direction.value}
dropdownClassName={classNames(hashId.value)} dropdownClassName={classNames(
hashId.value,
props.popupClassName,
props.dropdownClassName,
)}
onChange={onChange} onChange={onChange}
onOpenChange={onOpenChange} onOpenChange={onOpenChange}
onFocus={onFocus} onFocus={onFocus}

View File

@ -1,5 +1,5 @@
import type { FocusEventHandler, MouseEventHandler } from '../../_util/EventInterface'; import type { FocusEventHandler, MouseEventHandler } from '../../_util/EventInterface';
import type { CSSProperties, PropType } from 'vue'; import type { CSSProperties } from 'vue';
import type { PickerLocale } from '.'; import type { PickerLocale } from '.';
import type { SizeType } from '../../config-provider'; import type { SizeType } from '../../config-provider';
import type { import type {
@ -16,27 +16,39 @@ import type { MonthCellRender } from '../../vc-picker/panels/MonthPanel/MonthBod
import type { SharedTimeProps } from '../../vc-picker/panels/TimePanel'; import type { SharedTimeProps } from '../../vc-picker/panels/TimePanel';
import type { RangeDateRender, RangeInfo, RangeType } from '../../vc-picker/RangePicker'; import type { RangeDateRender, RangeInfo, RangeType } from '../../vc-picker/RangePicker';
import type { VueNode } from '../../_util/type'; import type { VueNode } from '../../_util/type';
import { tuple } from '../../_util/type'; import {
stringType,
arrayType,
someType,
booleanType,
objectType,
functionType,
} from '../../_util/type';
import type { InputStatus } from '../../_util/statusUtils'; import type { InputStatus } from '../../_util/statusUtils';
const DataPickerPlacements = tuple('bottomLeft', 'bottomRight', 'topLeft', 'topRight'); const DataPickerPlacements = ['bottomLeft', 'bottomRight', 'topLeft', 'topRight'] as const;
type DataPickerPlacement = typeof DataPickerPlacements[number]; type DataPickerPlacement = (typeof DataPickerPlacements)[number];
function commonProps<DateType = any>() { function commonProps<DateType = any>() {
return { return {
id: String, id: String,
/**
* @deprecated `dropdownClassName` is deprecated which will be removed in next major
* version.Please use `popupClassName` instead.
*/
dropdownClassName: String, dropdownClassName: String,
popupStyle: { type: Object as PropType<CSSProperties> }, popupClassName: String,
popupStyle: objectType<CSSProperties>(),
transitionName: String, transitionName: String,
placeholder: String, placeholder: String,
allowClear: { type: Boolean, default: undefined }, allowClear: booleanType(),
autofocus: { type: Boolean, default: undefined }, autofocus: booleanType(),
disabled: { type: Boolean, default: undefined }, disabled: booleanType(),
tabindex: Number, tabindex: Number,
open: { type: Boolean, default: undefined }, open: booleanType(),
defaultOpen: { type: Boolean, default: undefined }, defaultOpen: booleanType(),
/** Make input readOnly to avoid popup keyboard in mobile */ /** Make input readOnly to avoid popup keyboard in mobile */
inputReadOnly: { type: Boolean, default: undefined }, inputReadOnly: booleanType(),
// Value // Value
// format: string | CustomFormat<DateType> | (string | CustomFormat<DateType>)[]; // format: string | CustomFormat<DateType> | (string | CustomFormat<DateType>)[];
// Render // Render
@ -46,61 +58,59 @@ function commonProps<DateType = any>() {
// nextIcon?: VueNode; // nextIcon?: VueNode;
// superPrevIcon?: VueNode; // superPrevIcon?: VueNode;
// superNextIcon?: VueNode; // superNextIcon?: VueNode;
getPopupContainer: { type: Function as PropType<(node: HTMLElement) => HTMLElement> }, getPopupContainer: functionType<(node: HTMLElement) => HTMLElement>(),
panelRender: { type: Function as PropType<(originPanel: VueNode) => VueNode> }, panelRender: functionType<(originPanel: VueNode) => VueNode>(),
// // Events // // Events
onChange: { onChange: functionType<(value: DateType | string | null, dateString: string) => void>(),
type: Function as PropType<(value: DateType | string | null, dateString: string) => void>, 'onUpdate:value': functionType<(value: DateType | string | null) => void>(),
}, onOk: functionType<(value: DateType | string | null) => void>(),
'onUpdate:value': { type: Function as PropType<(value: DateType | string | null) => void> }, onOpenChange: functionType<(open: boolean) => void>(),
onOk: { type: Function as PropType<(value: DateType | string | null) => void> }, 'onUpdate:open': functionType<(open: boolean) => void>(),
onOpenChange: { type: Function as PropType<(open: boolean) => void> }, onFocus: functionType<FocusEventHandler>(),
'onUpdate:open': { type: Function as PropType<(open: boolean) => void> }, onBlur: functionType<FocusEventHandler>(),
onFocus: { type: Function as PropType<FocusEventHandler> }, onMousedown: functionType<MouseEventHandler>(),
onBlur: { type: Function as PropType<FocusEventHandler> }, onMouseup: functionType<MouseEventHandler>(),
onMousedown: { type: Function as PropType<MouseEventHandler> }, onMouseenter: functionType<MouseEventHandler>(),
onMouseup: { type: Function as PropType<MouseEventHandler> }, onMouseleave: functionType<MouseEventHandler>(),
onMouseenter: { type: Function as PropType<MouseEventHandler> }, onClick: functionType<MouseEventHandler>(),
onMouseleave: { type: Function as PropType<MouseEventHandler> }, onContextmenu: functionType<MouseEventHandler>(),
onClick: { type: Function as PropType<MouseEventHandler> }, onKeydown: functionType<(event: KeyboardEvent, preventDefault: () => void) => void>(),
onContextmenu: { type: Function as PropType<MouseEventHandler> },
onKeydown: {
type: Function as PropType<(event: KeyboardEvent, preventDefault: () => void) => void>,
},
// WAI-ARIA // WAI-ARIA
role: String, role: String,
name: String, name: String,
autocomplete: String, autocomplete: String,
direction: { type: String as PropType<'ltr' | 'rtl'> }, direction: stringType<'ltr' | 'rtl'>(),
showToday: { type: Boolean, default: undefined }, showToday: booleanType(),
showTime: { showTime: someType<boolean | SharedTimeProps<DateType>>([Boolean, Object]),
type: [Boolean, Object] as PropType<boolean | SharedTimeProps<DateType>>, locale: objectType<PickerLocale>(),
default: undefined, size: stringType<SizeType>(),
}, bordered: booleanType(),
locale: { type: Object as PropType<PickerLocale> }, dateRender: functionType<DateRender<DateType>>(),
size: { type: String as PropType<SizeType> }, disabledDate: functionType<(date: DateType) => boolean>(),
bordered: { type: Boolean, default: undefined }, mode: stringType<PanelMode>(),
dateRender: { type: Function as PropType<DateRender<DateType>> }, picker: stringType<PickerMode>(),
disabledDate: { type: Function as PropType<(date: DateType) => boolean> },
mode: { type: String as PropType<PanelMode> },
picker: { type: String as PropType<PickerMode> },
valueFormat: String, valueFormat: String,
placement: String as PropType<DataPickerPlacement>, placement: stringType<DataPickerPlacement>(),
status: String as PropType<InputStatus>, status: stringType<InputStatus>(),
/** @deprecated Please use `disabledTime` instead. */ /** @deprecated Please use `disabledTime` instead. */
disabledHours: Function as PropType<DisabledTimes['disabledHours']>, disabledHours: functionType<DisabledTimes['disabledHours']>(),
/** @deprecated Please use `disabledTime` instead. */ /** @deprecated Please use `disabledTime` instead. */
disabledMinutes: Function as PropType<DisabledTimes['disabledMinutes']>, disabledMinutes: functionType<DisabledTimes['disabledMinutes']>(),
/** @deprecated Please use `disabledTime` instead. */ /** @deprecated Please use `disabledTime` instead. */
disabledSeconds: Function as PropType<DisabledTimes['disabledSeconds']>, disabledSeconds: functionType<DisabledTimes['disabledSeconds']>(),
}; };
} }
export interface CommonProps<DateType> { export interface CommonProps<DateType> {
id?: string; id?: string;
prefixCls?: string; prefixCls?: string;
/**
* @deprecated `dropdownClassName` is deprecated which will be removed in next major
* version.Please use `popupClassName` instead.
*/
dropdownClassName?: string; dropdownClassName?: string;
popupClassName?: string;
popupStyle?: CSSProperties; popupStyle?: CSSProperties;
transitionName?: string; transitionName?: string;
placeholder?: string; placeholder?: string;
@ -153,20 +163,20 @@ export interface CommonProps<DateType> {
function datePickerProps<DateType = any>() { function datePickerProps<DateType = any>() {
return { return {
defaultPickerValue: { type: [String, Object] as PropType<DateType | string> }, defaultPickerValue: someType<DateType | string>([Object, String]),
defaultValue: { type: [String, Object] as PropType<DateType | string> }, defaultValue: someType<DateType | string>([Object, String]),
value: { type: [String, Object] as PropType<DateType | string> }, value: someType<DateType | string>([Object, String]),
disabledTime: { type: Function as PropType<DisabledTime<DateType>> }, disabledTime: functionType<DisabledTime<DateType>>(),
format: { format: someType<string | CustomFormat<DateType> | (string | CustomFormat<DateType>)[]>([
type: [String, Function, Array] as PropType< String,
string | CustomFormat<DateType> | (string | CustomFormat<DateType>)[] Function,
>, Array,
}, ]),
renderExtraFooter: { type: Function as PropType<(mode: PanelMode) => VueNode> }, renderExtraFooter: functionType<(mode: PanelMode) => VueNode>(),
showNow: { type: Boolean, default: undefined }, showNow: booleanType(),
monthCellRender: { type: Function as PropType<MonthCellRender<DateType>> }, monthCellRender: functionType<MonthCellRender<DateType>>(),
// deprecated Please use `monthCellRender"` instead.', // deprecated Please use `monthCellRender"` instead.',
monthCellContentRender: { type: Function as PropType<MonthCellRender<DateType>> }, monthCellContentRender: functionType<MonthCellRender<DateType>>(),
}; };
} }
@ -185,58 +195,47 @@ export interface DatePickerProps<DateType> {
function rangePickerProps<DateType>() { function rangePickerProps<DateType>() {
return { return {
allowEmpty: { type: Array as unknown as PropType<[boolean, boolean]> }, allowEmpty: arrayType<[boolean, boolean]>(),
dateRender: { type: Function as PropType<RangeDateRender<DateType>> }, dateRender: functionType<RangeDateRender<DateType>>(),
defaultPickerValue: { defaultPickerValue: arrayType<RangeValue<DateType> | RangeValue<string>>(),
type: Array as unknown as PropType<RangeValue<DateType> | RangeValue<string>>, defaultValue: arrayType<RangeValue<DateType> | RangeValue<string>>(),
}, value: arrayType<RangeValue<DateType> | RangeValue<string>>(),
defaultValue: { type: Array as unknown as PropType<RangeValue<DateType> | RangeValue<string>> }, disabledTime: functionType<(date: EventValue<DateType>, type: RangeType) => DisabledTimes>(),
value: { type: Array as unknown as PropType<RangeValue<DateType> | RangeValue<string>> }, disabled: someType<boolean | [boolean, boolean]>([Boolean, Array]),
disabledTime: {
type: Function as PropType<(date: EventValue<DateType>, type: RangeType) => DisabledTimes>,
},
disabled: { type: [Boolean, Array] as unknown as PropType<boolean | [boolean, boolean]> },
format: String, format: String,
renderExtraFooter: { type: Function as PropType<() => VueNode> }, renderExtraFooter: functionType<() => VueNode>(),
separator: { type: String }, separator: { type: String },
ranges: { ranges:
type: Object as PropType< objectType<
Record< Record<
string, string,
Exclude<RangeValue<DateType>, null> | (() => Exclude<RangeValue<DateType>, null>) Exclude<RangeValue<DateType>, null> | (() => Exclude<RangeValue<DateType>, null>)
> >
>, >(),
}, placeholder: arrayType<string[]>(),
placeholder: Array, mode: arrayType<[PanelMode, PanelMode]>(),
mode: { type: Array as unknown as PropType<[PanelMode, PanelMode]> }, onChange:
onChange: { functionType<
type: Function as PropType<
( (
value: RangeValue<DateType> | RangeValue<string> | null, value: RangeValue<DateType> | RangeValue<string> | null,
dateString: [string, string], dateString: [string, string],
) => void ) => void
>, >(),
}, 'onUpdate:value':
'onUpdate:value': { functionType<(value: RangeValue<DateType> | RangeValue<string> | null) => void>(),
type: Function as PropType<(value: RangeValue<DateType> | RangeValue<string> | null) => void>, onCalendarChange:
}, functionType<
onCalendarChange: {
type: Function as PropType<
( (
values: RangeValue<DateType> | RangeValue<string>, values: RangeValue<DateType> | RangeValue<string>,
formatString: [string, string], formatString: [string, string],
info: RangeInfo, info: RangeInfo,
) => void ) => void
>, >(),
}, onPanelChange:
onPanelChange: { functionType<
type: Function as PropType<
(values: RangeValue<DateType> | RangeValue<string>, modes: [PanelMode, PanelMode]) => void (values: RangeValue<DateType> | RangeValue<string>, modes: [PanelMode, PanelMode]) => void
>, >(),
}, onOk: functionType<(dates: RangeValue<DateType> | RangeValue<string>) => void>(),
onOk: {
type: Function as PropType<(dates: RangeValue<DateType> | RangeValue<string>) => void>,
},
}; };
} }

View File

@ -2,7 +2,7 @@
category: Components category: Components
type: Data Entry type: Data Entry
title: DatePicker title: DatePicker
cover: https://gw.alipayobjects.com/zos/alicdn/RT_USzA48/DatePicker.svg cover: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*xXA9TJ8BTioAAAAAAAAAAAAADrJ8AQ/original
--- ---
To select or input a date. To select or input a date.

View File

@ -3,7 +3,7 @@ category: Components
type: 数据录入 type: 数据录入
title: DatePicker title: DatePicker
subtitle: 日期选择框 subtitle: 日期选择框
cover: https://gw.alipayobjects.com/zos/alicdn/RT_USzA48/DatePicker.svg cover: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*xXA9TJ8BTioAAAAAAAAAAAAADrJ8AQ/original
--- ---
输入或选择日期的控件。 输入或选择日期的控件。

View File

@ -4,8 +4,8 @@ import type { PickerLocale } from './generatePicker';
import type { DirectionType } from '../config-provider'; import type { DirectionType } from '../config-provider';
export function getPlaceholder( export function getPlaceholder(
picker: PickerMode | undefined,
locale: PickerLocale, locale: PickerLocale,
picker: PickerMode,
customizePlaceholder?: string, customizePlaceholder?: string,
): string { ): string {
if (customizePlaceholder !== undefined) { if (customizePlaceholder !== undefined) {
@ -31,8 +31,8 @@ export function getPlaceholder(
} }
export function getRangePlaceholder( export function getRangePlaceholder(
picker: PickerMode | undefined,
locale: PickerLocale, locale: PickerLocale,
picker: PickerMode,
customizePlaceholder?: [string, string], customizePlaceholder?: [string, string],
) { ) {
if (customizePlaceholder !== undefined) { if (customizePlaceholder !== undefined) {
@ -92,14 +92,8 @@ export function transPlacement2DropdownAlign(
}; };
} }
default: { default: {
return direction === 'rtl' return {
? { points: direction === 'rtl' ? ['tr', 'br'] : ['tl', 'bl'],
points: ['tr', 'br'],
offset: [0, 4],
overflow,
}
: {
points: ['tl', 'bl'],
offset: [0, 4], offset: [0, 4],
overflow, overflow,
}; };