mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-05 21:48:19 +08:00
6b1a48d5ed
This reverts commit40433f357d
, reversing changes made to27a498e021
.
54 lines
1.6 KiB
TypeScript
54 lines
1.6 KiB
TypeScript
import { PickerMode } from 'rc-picker/lib/interface';
|
|
import { PickerLocale } from './generatePicker';
|
|
|
|
export function getPlaceholder(
|
|
picker: PickerMode | undefined,
|
|
locale: PickerLocale,
|
|
customizePlaceholder?: string,
|
|
): string {
|
|
if (customizePlaceholder !== undefined) {
|
|
return customizePlaceholder;
|
|
}
|
|
|
|
if (picker === 'year' && locale.lang.yearPlaceholder) {
|
|
return locale.lang.yearPlaceholder;
|
|
}
|
|
if (picker === 'quarter' && locale.lang.quarterPlaceholder) {
|
|
return locale.lang.quarterPlaceholder;
|
|
}
|
|
if (picker === 'month' && locale.lang.monthPlaceholder) {
|
|
return locale.lang.monthPlaceholder;
|
|
}
|
|
if (picker === 'week' && locale.lang.weekPlaceholder) {
|
|
return locale.lang.weekPlaceholder;
|
|
}
|
|
if (picker === 'time' && locale.timePickerLocale.placeholder) {
|
|
return locale!.timePickerLocale.placeholder;
|
|
}
|
|
return locale.lang.placeholder;
|
|
}
|
|
|
|
export function getRangePlaceholder(
|
|
picker: PickerMode | undefined,
|
|
locale: PickerLocale,
|
|
customizePlaceholder?: [string, string],
|
|
) {
|
|
if (customizePlaceholder !== undefined) {
|
|
return customizePlaceholder;
|
|
}
|
|
|
|
if (picker === 'year' && locale.lang.yearPlaceholder) {
|
|
return locale.lang.rangeYearPlaceholder;
|
|
}
|
|
if (picker === 'month' && locale.lang.monthPlaceholder) {
|
|
return locale.lang.rangeMonthPlaceholder;
|
|
}
|
|
if (picker === 'week' && locale.lang.weekPlaceholder) {
|
|
return locale.lang.rangeWeekPlaceholder;
|
|
}
|
|
if (picker === 'time' && locale.timePickerLocale.placeholder) {
|
|
return locale!.timePickerLocale.rangePlaceholder;
|
|
}
|
|
return locale.lang.rangePlaceholder;
|
|
}
|