@@ -12,7 +12,7 @@ import { useLocaleReceiver } from '../locale-provider/LocaleReceiver';
1212import enUS from './locale/en_US' ;
1313import CalendarHeader from './Header' ;
1414import type { CustomSlotsType , VueNode } from '../_util/type' ;
15- import type { App } from 'vue' ;
15+ import type { App , PropType } from 'vue' ;
1616import { computed , defineComponent , toRef } from 'vue' ;
1717import useConfigInject from '../_util/hooks/useConfigInject' ;
1818import classNames from '../_util/classNames' ;
@@ -86,28 +86,41 @@ function generateCalendar<
8686 ) ;
8787 }
8888
89- const Calendar = defineComponent < Props > ( {
89+ const Calendar = defineComponent ( {
9090 name : 'ACalendar' ,
9191 inheritAttrs : false ,
92- props : [
93- 'prefixCls' ,
94- 'locale' ,
95- 'validRange' ,
96- 'disabledDate' ,
97- 'dateFullCellRender' ,
98- 'dateCellRender' ,
99- 'monthFullCellRender' ,
100- 'monthCellRender' ,
101- 'headerRender' ,
102- 'value' ,
103- 'defaultValue' ,
104- 'mode' ,
105- 'fullscreen' ,
106- 'onChange' ,
107- 'onPanelChange' ,
108- 'onSelect' ,
109- 'valueFormat' ,
110- ] as any ,
92+ props : {
93+ prefixCls : String ,
94+ locale : { type : Object as PropType < Props [ 'locale' ] > , default : undefined as Props [ 'locale' ] } ,
95+ validRange : { type : Array as PropType < DateType [ ] > , default : undefined } ,
96+ disabledDate : { type : Function as PropType < Props [ 'disabledDate' ] > , default : undefined } ,
97+ dateFullCellRender : {
98+ type : Function as PropType < Props [ 'dateFullCellRender' ] > ,
99+ default : undefined ,
100+ } ,
101+ dateCellRender : { type : Function as PropType < Props [ 'dateCellRender' ] > , default : undefined } ,
102+ monthFullCellRender : {
103+ type : Function as PropType < Props [ 'monthFullCellRender' ] > ,
104+ default : undefined ,
105+ } ,
106+ monthCellRender : { type : Function as PropType < Props [ 'monthCellRender' ] > , default : undefined } ,
107+ headerRender : { type : Function as PropType < Props [ 'headerRender' ] > , default : undefined } ,
108+ value : {
109+ type : [ Object , String ] as PropType < Props [ 'value' ] > ,
110+ default : undefined as Props [ 'value' ] ,
111+ } ,
112+ defaultValue : {
113+ type : [ Object , String ] as PropType < Props [ 'defaultValue' ] > ,
114+ default : undefined as Props [ 'defaultValue' ] ,
115+ } ,
116+ mode : { type : String as PropType < Props [ 'mode' ] > , default : undefined } ,
117+ fullscreen : { type : Boolean as PropType < Props [ 'fullscreen' ] > , default : undefined } ,
118+ onChange : { type : Function as PropType < Props [ 'onChange' ] > , default : undefined } ,
119+ 'onUpdate:value' : { type : Function as PropType < Props [ 'onUpdate:value' ] > , default : undefined } ,
120+ onPanelChange : { type : Function as PropType < Props [ 'onPanelChange' ] > , default : undefined } ,
121+ onSelect : { type : Function as PropType < Props [ 'onSelect' ] > , default : undefined } ,
122+ valueFormat : { type : String , default : undefined } ,
123+ } ,
111124 slots : Object as CustomSlotsType < {
112125 dateFullCellRender ?: { current : DateType } ;
113126 dateCellRender ?: { current : DateType } ;
@@ -121,7 +134,8 @@ function generateCalendar<
121134 } ;
122135 default : any ;
123136 } > ,
124- setup ( props , { emit, slots, attrs } ) {
137+ setup ( p , { emit, slots, attrs } ) {
138+ const props = p as unknown as Props ;
125139 const { prefixCls, direction } = useConfigInject ( 'picker' , props ) ;
126140 const calendarPrefixCls = computed ( ( ) => `${ prefixCls . value } -calendar` ) ;
127141 const maybeToString = ( date : DateType ) => {
0 commit comments