You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.3 KiB
37 lines
1.3 KiB
import { PickerMode } from 'rc-picker/lib/interface';
|
|
import { PickerLocale } from './generatePicker';
|
|
|
|
export function getPlaceholder(picker: PickerMode | undefined, locale: PickerLocale): string {
|
|
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) {
|
|
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;
|
|
}
|
|
|