type: export Calendar CalendarMode type, update docs (#52160)

* feat: export calendar mode

* doc: replace calendar headerRender args type: string to 'year' | 'month' (#52137)

* feat: export CalendarMode in components/index.ts
This commit is contained in:
SummerBetter 2024-12-30 10:00:07 +08:00 committed by GitHub
parent e5f0452f6d
commit 03e3a41ec8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 5 additions and 5 deletions

View File

@ -47,7 +47,7 @@ Common props ref[Common props](/docs/react/common-props)
| disabledDate | Function that specifies the dates that cannot be selected, `currentDate` is same dayjs object as `value` prop which you shouldn't mutate it](https://github.com/ant-design/ant-design/issues/30987) | (currentDate: Dayjs) => boolean | - | | | disabledDate | Function that specifies the dates that cannot be selected, `currentDate` is same dayjs object as `value` prop which you shouldn't mutate it](https://github.com/ant-design/ant-design/issues/30987) | (currentDate: Dayjs) => boolean | - | |
| fullscreen | Whether to display in full-screen | boolean | true | | | fullscreen | Whether to display in full-screen | boolean | true | |
| showWeek | Whether to display week number | boolean | false | 5.23.0 | | showWeek | Whether to display week number | boolean | false | 5.23.0 |
| headerRender | Render custom header in panel | function(object:{value: Dayjs, type: string, onChange: f(), onTypeChange: f()}) | - | | | headerRender | Render custom header in panel | function(object:{value: Dayjs, type: 'year' \| 'month', onChange: f(), onTypeChange: f()}) | - | |
| locale | The calendar's locale | object | [(default)](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) | | | locale | The calendar's locale | object | [(default)](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) | |
| mode | The display mode of the calendar | `month` \| `year` | `month` | | | mode | The display mode of the calendar | `month` \| `year` | `month` | |
| validRange | To set valid range | \[[dayjs](https://day.js.org/), [dayjs](https://day.js.org/)] | - | | | validRange | To set valid range | \[[dayjs](https://day.js.org/), [dayjs](https://day.js.org/)] | - | |

View File

@ -1,7 +1,7 @@
import type { Dayjs } from 'dayjs'; import type { Dayjs } from 'dayjs';
import dayjsGenerateConfig from 'rc-picker/lib/generate/dayjs'; import dayjsGenerateConfig from 'rc-picker/lib/generate/dayjs';
import type { CalendarProps } from './generateCalendar'; import type { CalendarMode, CalendarProps } from './generateCalendar';
import generateCalendar from './generateCalendar'; import generateCalendar from './generateCalendar';
const Calendar = generateCalendar<Dayjs>(dayjsGenerateConfig); const Calendar = generateCalendar<Dayjs>(dayjsGenerateConfig);
@ -12,5 +12,5 @@ export type CalendarType = typeof Calendar & {
(Calendar as CalendarType).generateCalendar = generateCalendar; (Calendar as CalendarType).generateCalendar = generateCalendar;
export type { CalendarProps }; export type { CalendarMode, CalendarProps };
export default Calendar as CalendarType; export default Calendar as CalendarType;

View File

@ -48,7 +48,7 @@ coverDark: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*-p-wQLik200AAA
| disabledDate | 不可选择的日期,参数为当前 `value`,注意使用时[不要直接修改](https://github.com/ant-design/ant-design/issues/30987) | (currentDate: Dayjs) => boolean | - | | | disabledDate | 不可选择的日期,参数为当前 `value`,注意使用时[不要直接修改](https://github.com/ant-design/ant-design/issues/30987) | (currentDate: Dayjs) => boolean | - | |
| fullscreen | 是否全屏显示 | boolean | true | | | fullscreen | 是否全屏显示 | boolean | true | |
| showWeek | 是否显示周数列 | boolean | false | 5.23.0 | | showWeek | 是否显示周数列 | boolean | false | 5.23.0 |
| headerRender | 自定义头部内容 | function(object:{value: Dayjs, type: string, onChange: f(), onTypeChange: f()}) | - | | | headerRender | 自定义头部内容 | function(object:{value: Dayjs, type: 'year' \| 'month', onChange: f(), onTypeChange: f()}) | - | |
| locale | 国际化配置 | object | [(默认配置)](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) | | | locale | 国际化配置 | object | [(默认配置)](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) | |
| mode | 初始模式 | `month` \| `year` | `month` | | | mode | 初始模式 | `month` \| `year` | `month` | |
| validRange | 设置可以显示的日期 | \[[dayjs](https://day.js.org/), [dayjs](https://day.js.org/)] | - | | | validRange | 设置可以显示的日期 | \[[dayjs](https://day.js.org/), [dayjs](https://day.js.org/)] | - | |

View File

@ -21,7 +21,7 @@ export type { BreadcrumbItemProps, BreadcrumbProps } from './breadcrumb';
export { default as Button } from './button'; export { default as Button } from './button';
export type { ButtonProps } from './button'; export type { ButtonProps } from './button';
export { default as Calendar } from './calendar'; export { default as Calendar } from './calendar';
export type { CalendarProps } from './calendar'; export type { CalendarMode, CalendarProps } from './calendar';
export { default as Card } from './card'; export { default as Card } from './card';
export type { CardProps } from './card'; export type { CardProps } from './card';
export { default as Carousel } from './carousel'; export { default as Carousel } from './carousel';