|
|
|
@ -172,20 +172,6 @@ const generateCalendar = <DateType extends AnyObject>(generateConfig: GenerateCo
|
|
|
|
|
onSelect?.(date, { source });
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// ====================== Locale ======================
|
|
|
|
|
const getDefaultLocale = () => {
|
|
|
|
|
const { locale } = props;
|
|
|
|
|
const result = {
|
|
|
|
|
...enUS,
|
|
|
|
|
...locale,
|
|
|
|
|
};
|
|
|
|
|
result.lang = {
|
|
|
|
|
...result.lang,
|
|
|
|
|
...locale?.lang,
|
|
|
|
|
};
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// ====================== Render ======================
|
|
|
|
|
const dateRender = React.useCallback(
|
|
|
|
|
(date: DateType, info: CellRenderInfo<DateType>): React.ReactNode => {
|
|
|
|
@ -244,7 +230,9 @@ const generateCalendar = <DateType extends AnyObject>(generateConfig: GenerateCo
|
|
|
|
|
[monthFullCellRender, monthCellRender, cellRender, fullCellRender],
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const [contextLocale] = useLocale('Calendar', getDefaultLocale);
|
|
|
|
|
const [contextLocale] = useLocale('Calendar', enUS);
|
|
|
|
|
|
|
|
|
|
const locale = { ...contextLocale, ...props.locale! };
|
|
|
|
|
|
|
|
|
|
const mergedCellRender: RcBasePickerPanelProps['cellRender'] = (current, info) => {
|
|
|
|
|
if (info.type === 'date') {
|
|
|
|
@ -254,7 +242,7 @@ const generateCalendar = <DateType extends AnyObject>(generateConfig: GenerateCo
|
|
|
|
|
if (info.type === 'month') {
|
|
|
|
|
return monthRender(current, {
|
|
|
|
|
...info,
|
|
|
|
|
locale: contextLocale?.lang,
|
|
|
|
|
locale: locale?.lang,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@ -292,7 +280,7 @@ const generateCalendar = <DateType extends AnyObject>(generateConfig: GenerateCo
|
|
|
|
|
generateConfig={generateConfig}
|
|
|
|
|
mode={mergedMode}
|
|
|
|
|
fullscreen={fullscreen}
|
|
|
|
|
locale={contextLocale?.lang}
|
|
|
|
|
locale={locale?.lang}
|
|
|
|
|
validRange={validRange}
|
|
|
|
|
onChange={onInternalSelect}
|
|
|
|
|
onModeChange={triggerModeChange}
|
|
|
|
@ -301,7 +289,7 @@ const generateCalendar = <DateType extends AnyObject>(generateConfig: GenerateCo
|
|
|
|
|
<RCPickerPanel
|
|
|
|
|
value={mergedValue}
|
|
|
|
|
prefixCls={prefixCls}
|
|
|
|
|
locale={contextLocale?.lang}
|
|
|
|
|
locale={locale?.lang}
|
|
|
|
|
generateConfig={generateConfig}
|
|
|
|
|
cellRender={mergedCellRender}
|
|
|
|
|
onSelect={(nextDate) => {
|
|
|
|
|