Skip to content

refactor:calendar #6269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions components/calendar/generateCalendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import { computed, defineComponent, toRef } from 'vue';
import useConfigInject from '../config-provider/hooks/useConfigInject';
import classNames from '../_util/classNames';

// CSSINJS
import useStyle from './style';

type InjectDefaultProps<Props> = Omit<
Props,
'locale' | 'generateConfig' | 'prevIcon' | 'nextIcon' | 'superPrevIcon' | 'superNextIcon'
Expand Down Expand Up @@ -117,6 +120,10 @@ function generateCalendar<
],
setup(props, { emit, slots, attrs }) {
const { prefixCls, direction } = useConfigInject('picker', props);

// style
const [wrapSSR, hashId] = useStyle(prefixCls);

const calendarPrefixCls = computed(() => `${prefixCls.value}-calendar`);
const maybeToString = (date: DateType) => {
return props.valueFormat ? generateConfig.toString(date, props.valueFormat) : date;
Expand Down Expand Up @@ -273,7 +280,7 @@ function generateCalendar<
</div>
);
};
return (
return wrapSSR(
<div
{...attrs}
class={classNames(
Expand All @@ -284,6 +291,7 @@ function generateCalendar<
[`${calendarPrefixCls.value}-rtl`]: direction.value === 'rtl',
},
attrs.class,
hashId.value,
)}
>
{headerRender ? (
Expand Down Expand Up @@ -319,7 +327,7 @@ function generateCalendar<
disabledDate={mergedDisabledDate.value}
hideHeader
/>
</div>
</div>,
);
};
},
Expand Down
2 changes: 1 addition & 1 deletion components/calendar/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
category: Components
type: Data Display
title: Calendar
cover: https://gw.alipayobjects.com/zos/antfincdn/dPQmLq08DI/Calendar.svg
cover: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*nF6_To7pDSAAAAAAAAAAAAAADrJ8AQ/original
---

Container for displaying data in calendar form.
Expand Down
2 changes: 1 addition & 1 deletion components/calendar/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ category: Components
type: 数据展示
title: Calendar
subtitle: 日历
cover: https://gw.alipayobjects.com/zos/antfincdn/dPQmLq08DI/Calendar.svg
cover: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*nF6_To7pDSAAAAAAAAAAAAAADrJ8AQ/original
---

按照日历形式展示数据的容器。
Expand Down
195 changes: 0 additions & 195 deletions components/calendar/style/index.less

This file was deleted.

Loading