From 448e5edc52bbb65e2228ca65f415b6b88fb1513e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Thu, 6 Apr 2023 11:19:46 +0300 Subject: [PATCH] Refactor #3832 Refactor #3833 - For Calendar --- api-generator/components/calendar.js | 46 +++++++++++++++++- components/lib/calendar/Calendar.d.ts | 25 ++++++++-- components/lib/calendar/Calendar.vue | 69 ++++++++++++++++++++------- 3 files changed, 116 insertions(+), 24 deletions(-) diff --git a/api-generator/components/calendar.js b/api-generator/components/calendar.js index f1b2700a1..131f885af 100644 --- a/api-generator/components/calendar.js +++ b/api-generator/components/calendar.js @@ -44,9 +44,33 @@ const CalendarProps = [ { name: 'icon', type: 'string', - default: 'pi pi-calendar', + default: 'null', description: 'Icon of the calendar button.' }, + { + name: 'previousIcon', + type: 'string', + default: 'null', + description: 'Icon to show in the previous button.' + }, + { + name: 'nextIcon', + type: 'string', + default: 'null', + description: 'Icon to show in the next button.' + }, + { + name: 'incrementIcon', + type: 'string', + default: 'null', + description: 'Icon to show in each of the increment buttons.' + }, + { + name: 'decrementIcon', + type: 'string', + default: 'null', + description: 'Icon to show in each of the decrement buttons.' + }, { name: 'numberOfMonths', type: 'number', @@ -436,6 +460,26 @@ const CalendarSlots = [ { name: 'decade', description: 'Custom content for the calendar decade.' + }, + { + name: 'triggericon', + description: 'Custom trigger icon template.' + }, + { + name: 'previcon', + description: 'Custom previous icon template.' + }, + { + name: 'nexticon', + description: 'Custom next icon template.' + }, + { + name: 'incrementicon', + description: 'Custom increment icon template.' + }, + { + name: 'decrementicon', + description: 'Custom decrement icon template.' } ]; diff --git a/components/lib/calendar/Calendar.d.ts b/components/lib/calendar/Calendar.d.ts index 4effcd117..78c91e8c9 100755 --- a/components/lib/calendar/Calendar.d.ts +++ b/components/lib/calendar/Calendar.d.ts @@ -109,27 +109,22 @@ export interface CalendarProps { showIcon?: boolean | undefined; /** * Icon of the calendar button. - * @defaultValue pi pi-calendar */ icon?: string | undefined; /** * Icon to show in the previous button. - * @defaultValue pi pi-chevron-left */ previousIcon?: string | undefined; /** * Icon to show in the next button. - * @defaultValue pi pi-chevron-right */ nextIcon?: string | undefined; /** * Icon to show in each of the increment buttons. - * @defaultValue pi pi-chevron-up */ incrementIcon?: string | undefined; /** * Icon to show in each of the decrement buttons. - * @defaultValue pi pi-chevron-down */ decrementIcon?: string | undefined; /** @@ -368,6 +363,26 @@ export interface CalendarSlots { */ years: string[] | undefined; }): VNode[]; + /** + * Custom trigger icon template. + */ + triggericon(): VNode[]; + /** + * Custom previous icon template. + */ + previcon(): VNode[]; + /** + * Custom next icon template. + */ + nexticon(): VNode[]; + /** + * Custom increment icon template. + */ + incrementicon(): VNode[]; + /** + * Custom decrement icon template. + */ + decrementicon(): VNode[]; } /** diff --git a/components/lib/calendar/Calendar.vue b/components/lib/calendar/Calendar.vue index 8eb2e6200..dfe20b459 100755 --- a/components/lib/calendar/Calendar.vue +++ b/components/lib/calendar/Calendar.vue @@ -29,7 +29,6 @@ /> + > + + + +
- + + +
@@ -202,7 +209,9 @@ @keyup.space="onTimePickerElementMouseUp($event)" type="button" > - + + + {{ formattedCurrentHour }}
@@ -241,7 +252,9 @@ @keyup.space="onTimePickerElementMouseUp($event)" type="button" > - + + + {{ formattedCurrentMinute }}
@@ -281,7 +296,9 @@ @keyup.space="onTimePickerElementMouseUp($event)" type="button" > - + + + {{ formattedCurrentSecond }}
@@ -307,11 +326,15 @@
{{ pm ? $primevue.config.locale.pm : $primevue.config.locale.am }}
@@ -328,6 +351,11 @@