From 3554ba1a9fef92609f10c5c2e21c47c1ac54b7b1 Mon Sep 17 00:00:00 2001 From: tugcekucukoglu Date: Tue, 21 Nov 2023 21:27:59 +0300 Subject: [PATCH] Fixed #4669 - Calendar: Week Number customization --- components/lib/calendar/Calendar.d.ts | 42 ++++++++++++--------------- components/lib/calendar/Calendar.vue | 6 ++-- 2 files changed, 21 insertions(+), 27 deletions(-) diff --git a/components/lib/calendar/Calendar.d.ts b/components/lib/calendar/Calendar.d.ts index 8a60707df..dee99b6d3 100755 --- a/components/lib/calendar/Calendar.d.ts +++ b/components/lib/calendar/Calendar.d.ts @@ -182,6 +182,10 @@ export interface CalendarPassThroughOptions { * Used to pass attributes to the week header's DOM element. */ weekHeader?: CalendarPassThroughOptionType; + /** + * Used to pass attributes to the week header label's DOM element. + */ + weekHeaderLabel?: CalendarPassThroughOptionType; /** * Used to pass attributes to the table header cell's DOM element. */ @@ -756,6 +760,20 @@ export interface CalendarSlots { */ years: string[] | undefined; }): VNode[]; + /** + * Custom week header label template. + */ + weekheaderlabel(): VNode[]; + /** + * Custom week label template. + * @param {Object} scope - weeklabel slot's params. + */ + weeklabel(scope: { + /** + * Number of the week + */ + weekNumber: number; + }); /** * Custom dropdown icon template. * @param {Object} scope - dropdown icon slot's params. @@ -806,30 +824,6 @@ export interface CalendarSlots { */ class: any; }): VNode[]; - /** - * Custom header for the showWeek - */ - showWeekHeader(): VNode[]; - /** - * Custom showWeek template - * @param {Object} scope - showWeek slot params - */ - showWeek(scope: { - /** - * Date information corresponding to first day of week - */ - date: { - day: number; - month: number; - year: number; - today: boolean; - selectable: boolean; - }; - /** - * Internally calculated week number - */ - weekNumber: number; - }): VNode[]; } /** diff --git a/components/lib/calendar/Calendar.vue b/components/lib/calendar/Calendar.vue index a031163e6..389cc3e67 100755 --- a/components/lib/calendar/Calendar.vue +++ b/components/lib/calendar/Calendar.vue @@ -169,8 +169,8 @@ - - + + {{ weekHeaderLabel }} @@ -184,7 +184,7 @@ - + 0 {{ month.weekNumbers[i] }}