From d952a9309608c1522726df74c5efc21e52e956ee Mon Sep 17 00:00:00 2001 From: lorefnon Date: Sat, 16 Sep 2023 22:51:51 +0530 Subject: [PATCH 1/2] Add config option to set popover placement --- src/components/Calendar/CalendarHeader.vue | 13 ++----------- src/use/calendar.ts | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/components/Calendar/CalendarHeader.vue b/src/components/Calendar/CalendarHeader.vue index 1d098e1e3..46d039472 100644 --- a/src/components/Calendar/CalendarHeader.vue +++ b/src/components/Calendar/CalendarHeader.vue @@ -61,28 +61,19 @@ const props = defineProps<{ const { navPopoverId, navVisibility, + navPopoverPlacement, canMovePrev, movePrev, canMoveNext, moveNext, } = useCalendar(); -const navPlacement = computed(() => { - switch (props.page.titlePosition) { - case 'left': - return 'bottom-start'; - case 'right': - return 'bottom-end'; - default: - return 'bottom'; - } -}); const navPopoverOptions = computed(() => { const { page } = props; return { id: navPopoverId.value, visibility: navVisibility.value, - placement: navPlacement.value, + placement: navPopoverPlacement.value, modifiers: [{ name: 'flip', options: { fallbackPlacements: ['bottom'] } }], data: { page }, isInteractive: true, diff --git a/src/use/calendar.ts b/src/use/calendar.ts index 7ae2b5d41..dd712b4cf 100755 --- a/src/use/calendar.ts +++ b/src/use/calendar.ts @@ -108,6 +108,9 @@ export const propsDef = { type: String as PropType, default: () => getDefault('navVisibility') as PopoverVisibility, }, + navPopoverPlacement: { + type: String, + }, showWeeknumbers: [Boolean, String], showIsoWeeknumbers: [Boolean, String], expanded: Boolean, @@ -197,6 +200,17 @@ export function createCalendar( ); const navVisibility = computed(() => props.navVisibility); + const navPopoverPlacement = computed(() => { + if (props.navPopoverPlacement) return props.navPopoverPlacement; + switch (props.titlePosition) { + case 'left': + return 'bottom-start'; + case 'right': + return 'bottom-end'; + default: + return 'bottom'; + } + }); const showWeeknumbers = computed(() => !!props.showWeeknumbers); @@ -751,6 +765,7 @@ export function createCalendar( isWeekly, isDaily, navVisibility, + navPopoverPlacement, showWeeknumbers, showIsoWeeknumbers, getDateAddress, From 5453eb8ecb92195c797e193709b0ac80d567deb8 Mon Sep 17 00:00:00 2001 From: lorefnon Date: Sat, 16 Sep 2023 22:53:44 +0530 Subject: [PATCH 2/2] Fix unrelated build failures --- src/components/BaseSelect/BaseSelect.vue | 2 +- src/components/CalendarGrid/CalendarGrid.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/BaseSelect/BaseSelect.vue b/src/components/BaseSelect/BaseSelect.vue index ad0d1bc92..62ce05041 100644 --- a/src/components/BaseSelect/BaseSelect.vue +++ b/src/components/BaseSelect/BaseSelect.vue @@ -44,7 +44,7 @@ export default { import { computed } from 'vue'; import BaseIcon from '../BaseIcon/BaseIcon.vue'; -interface BaseOption { +export interface BaseOption { value: any; label: string; disabled?: boolean; diff --git a/src/components/CalendarGrid/CalendarGrid.vue b/src/components/CalendarGrid/CalendarGrid.vue index 32cbc296b..a9010afc8 100755 --- a/src/components/CalendarGrid/CalendarGrid.vue +++ b/src/components/CalendarGrid/CalendarGrid.vue @@ -104,7 +104,7 @@ tabindex="1" role="button" class="vc-grid-header-day-number vc-focusable" - :class="`id-${day.id}`" + :class="`id-${String(day.id)}`" @click="onDayNumberClick(day)" @keydown="onDayKeydown(day, $event)" @keydown.space.enter="onDayNumberClick(day)"