Skip to content

Commit cd47a27

Browse files
authored
refactor:calendar (#6269)
* refactor:calendar * docs:update
1 parent adec521 commit cd47a27

File tree

8 files changed

+233
-257
lines changed

8 files changed

+233
-257
lines changed

components/calendar/generateCalendar.tsx

+10-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ import { computed, defineComponent, toRef } from 'vue';
1717
import useConfigInject from '../config-provider/hooks/useConfigInject';
1818
import classNames from '../_util/classNames';
1919

20+
// CSSINJS
21+
import useStyle from './style';
22+
2023
type InjectDefaultProps<Props> = Omit<
2124
Props,
2225
'locale' | 'generateConfig' | 'prevIcon' | 'nextIcon' | 'superPrevIcon' | 'superNextIcon'
@@ -117,6 +120,10 @@ function generateCalendar<
117120
],
118121
setup(props, { emit, slots, attrs }) {
119122
const { prefixCls, direction } = useConfigInject('picker', props);
123+
124+
// style
125+
const [wrapSSR, hashId] = useStyle(prefixCls);
126+
120127
const calendarPrefixCls = computed(() => `${prefixCls.value}-calendar`);
121128
const maybeToString = (date: DateType) => {
122129
return props.valueFormat ? generateConfig.toString(date, props.valueFormat) : date;
@@ -273,7 +280,7 @@ function generateCalendar<
273280
</div>
274281
);
275282
};
276-
return (
283+
return wrapSSR(
277284
<div
278285
{...attrs}
279286
class={classNames(
@@ -284,6 +291,7 @@ function generateCalendar<
284291
[`${calendarPrefixCls.value}-rtl`]: direction.value === 'rtl',
285292
},
286293
attrs.class,
294+
hashId.value,
287295
)}
288296
>
289297
{headerRender ? (
@@ -319,7 +327,7 @@ function generateCalendar<
319327
disabledDate={mergedDisabledDate.value}
320328
hideHeader
321329
/>
322-
</div>
330+
</div>,
323331
);
324332
};
325333
},

components/calendar/index.en-US.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
category: Components
33
type: Data Display
44
title: Calendar
5-
cover: https://gw.alipayobjects.com/zos/antfincdn/dPQmLq08DI/Calendar.svg
5+
cover: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*nF6_To7pDSAAAAAAAAAAAAAADrJ8AQ/original
66
---
77

88
Container for displaying data in calendar form.

components/calendar/index.zh-CN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ category: Components
33
type: 数据展示
44
title: Calendar
55
subtitle: 日历
6-
cover: https://gw.alipayobjects.com/zos/antfincdn/dPQmLq08DI/Calendar.svg
6+
cover: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*nF6_To7pDSAAAAAAAAAAAAAADrJ8AQ/original
77
---
88

99
按照日历形式展示数据的容器。

components/calendar/style/index.less

-195
This file was deleted.

0 commit comments

Comments
 (0)