feat: datepicker add rangeQuarterPlaceholder

This commit is contained in:
tangjinzhou 2022-04-14 16:17:59 +08:00
parent a7da435079
commit 93c1d400c1
9 changed files with 73 additions and 3 deletions

View File

@ -47,6 +47,7 @@ export type AdditionalPickerLocaleLangProps = {
monthPlaceholder?: string;
weekPlaceholder?: string;
rangeYearPlaceholder?: [string, string];
rangeQuarterPlaceholder?: [string, string];
rangeMonthPlaceholder?: [string, string];
rangeWeekPlaceholder?: [string, string];
rangePlaceholder?: [string, string];

View File

@ -12,6 +12,7 @@ const locale: PickerLocale = {
weekPlaceholder: 'Select week',
rangePlaceholder: ['Start date', 'End date'],
rangeYearPlaceholder: ['Start year', 'End year'],
rangeQuarterPlaceholder: ['Start quarter', 'End quarter'],
rangeMonthPlaceholder: ['Start month', 'End month'],
rangeWeekPlaceholder: ['Start week', 'End week'],
...CalendarLocale,

View File

@ -12,6 +12,7 @@ const locale: PickerLocale = {
weekPlaceholder: 'Select week',
rangePlaceholder: ['Start date', 'End date'],
rangeYearPlaceholder: ['Start year', 'End year'],
rangeQuarterPlaceholder: ['Start quarter', 'End quarter'],
rangeMonthPlaceholder: ['Start month', 'End month'],
rangeWeekPlaceholder: ['Start week', 'End week'],
...CalendarLocale,

View File

@ -13,6 +13,7 @@ const locale: PickerLocale = {
rangePlaceholder: ['开始日期', '结束日期'],
rangeYearPlaceholder: ['开始年份', '结束年份'],
rangeMonthPlaceholder: ['开始月份', '结束月份'],
rangeQuarterPlaceholder: ['开始季度', '结束季度'],
rangeWeekPlaceholder: ['开始周', '结束周'],
...CalendarLocale,
},

View File

@ -13,6 +13,7 @@ const locale: PickerLocale = {
rangePlaceholder: ['開始日期', '結束日期'],
rangeYearPlaceholder: ['開始年份', '結束年份'],
rangeMonthPlaceholder: ['開始月份', '結束月份'],
rangeQuarterPlaceholder: ['開始季度', '結束季度'],
rangeWeekPlaceholder: ['開始周', '結束周'],
...CalendarLocale,
},

View File

@ -993,7 +993,9 @@ function RangerPicker<DateType>() {
arrowLeft >
panelDivRef.value.offsetWidth -
arrowRef.value.offsetWidth -
(direction === 'rtl' ? 0 : arrowRef.value.offsetLeft)
(direction === 'rtl' || arrowRef.value.offsetLeft > arrowLeft
? 0
: arrowRef.value.offsetLeft)
) {
panelLeft = arrowLeft;
}

View File

@ -28,9 +28,70 @@ dayjs.extend((_o, c) => {
type IlocaleMapObject = Record<string, string>;
const localeMap: IlocaleMapObject = {
// ar_EG:
// az_AZ:
// bg_BG:
bn_BD: 'bn-bd',
by_BY: 'be',
// ca_ES:
// cs_CZ:
// da_DK:
// de_DE:
// el_GR:
en_GB: 'en-gb',
en_US: 'en',
// es_ES:
// et_EE:
// fa_IR:
// fi_FI:
fr_BE: 'fr', // todo: dayjs has no fr_BE locale, use fr at present
fr_CA: 'fr-ca',
// fr_FR:
// ga_IE:
// gl_ES:
// he_IL:
// hi_IN:
// hr_HR:
// hu_HU:
hy_AM: 'hy-am',
// id_ID:
// is_IS:
// it_IT:
// ja_JP:
// ka_GE:
// kk_KZ:
// km_KH:
kmr_IQ: 'ku',
// kn_IN:
// ko_KR:
// ku_IQ: // previous ku in antd
// lt_LT:
// lv_LV:
// mk_MK:
// ml_IN:
// mn_MN:
// ms_MY:
// nb_NO:
// ne_NP:
nl_BE: 'nl-be',
// nl_NL:
// pl_PL:
pt_BR: 'pt-br',
// pt_PT:
// ro_RO:
// ru_RU:
// sk_SK:
// sl_SI:
// sr_RS:
// sv_SE:
// ta_IN:
// th_TH:
// tr_TR:
// uk_UA:
// ur_PK:
// vi_VN:
zh_CN: 'zh-cn',
zh_HK: 'zh-hk',
zh_TW: 'zh-tw',
};
@ -47,7 +108,7 @@ const parseNoMatchNotice = () => {
const generateConfig: GenerateConfig<Dayjs> = {
// get
getNow: () => dayjs(),
getFixedDate: string => dayjs(string, 'YYYY-MM-DD'),
getFixedDate: string => dayjs(string, ['YYYY-M-DD', 'YYYY-MM-DD']),
getEndDate: date => date.endOf('month'),
getWeekDay: date => {
const clone = date.locale('en');

View File

@ -1,4 +1,4 @@
// 2.6.4
// 2.6.7
import type { PickerProps } from './Picker';
import Picker from './Picker';
import PickerPanel from './PickerPanel';

View File

@ -27,6 +27,8 @@ const locale: Locale = {
nextDecade: 'Década seguinte',
previousCentury: 'Século anterior',
nextCentury: 'Século seguinte',
shortWeekDays: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'],
shortMonths: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
};
export default locale;