@@ -5,7 +5,7 @@ import {addDate, createDate, formatDate, isSameDay, type DateLike} from '@zui/he
55import '@zui/css-icons/src/icons/chevron.css' ;
66import type { CalendarViewMode } from '../types' ;
77import type { CustomContentType } from '@zui/core/src/react' ;
8- import type { ToolbarSetting , ToolbarOptions } from '@zui/toolbar' ;
8+ import type { ToolbarSetting , ToolbarOptions , ToolbarItemOptions } from '@zui/toolbar' ;
99
1010/**
1111 * 日历头部的属性接口
@@ -32,6 +32,9 @@ export type CalendarHeaderProps = {
3232 /** 按钮尺寸,默认 'sm' */
3333 btnSize ?: ToolbarOptions [ 'size' ] ;
3434
35+ /** 头部导航栏按钮 */
36+ navItems ?: ToolbarItemOptions [ ] ;
37+
3538 /** 头部操作栏 */
3639 actions ?: ToolbarSetting ;
3740} ;
@@ -41,7 +44,7 @@ export type CalendarHeaderProps = {
4144 */
4245export class CalendarHeader extends Component < CalendarHeaderProps > {
4346 protected _getNavItems = ( props : CalendarHeaderProps ) => {
44- const { monthFormat = 'yyyy-MM' , dateFormat = 'yyyy-MM-dd' , date} = props ;
47+ const { monthFormat = 'yyyy-MM' , dateFormat = 'yyyy-MM-dd' , date, navItems = [ ] } = props ;
4548 const current = createDate ( date , true ) ;
4649 const today = new Date ( ) ;
4750 current . setHours ( 0 , 0 , 0 , 0 ) ;
@@ -55,7 +58,7 @@ export class CalendarHeader extends Component<CalendarHeaderProps> {
5558 { hint : formatDate ( prev , monthFormat ) , text : '' , textClass : 'chevron-left' , command : `.~switchDate/${ prev . getTime ( ) } ` } ,
5659 { type : 'text' , text : formatDate ( current , monthFormat ) } ,
5760 { hint : formatDate ( next , monthFormat ) , text : '' , textClass : 'chevron-right' , command : `.~switchDate/${ next . getTime ( ) } ` } ,
58-
61+ ... navItems ,
5962 ] ;
6063 } ;
6164
0 commit comments