|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
<script lang="ts" setup> |
|
|
|
|
const { selectedDate, activeDates, calendarMetaData } = useCalendarViewStoreOrThrow() |
|
|
|
|
const { selectedDate, activeDates } = useCalendarViewStoreOrThrow() |
|
|
|
|
|
|
|
|
|
const months = computed(() => { |
|
|
|
|
const months = [] |
|
|
|
@ -9,24 +9,43 @@ const months = computed(() => {
|
|
|
|
|
return months |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
const size = computed(() => calendarMetaData.value?.meta?.yearViewSize ?? 'small') |
|
|
|
|
const calendarContainer = ref<HTMLElement | null>(null) |
|
|
|
|
|
|
|
|
|
const { width } = useWindowSize() |
|
|
|
|
|
|
|
|
|
const size = ref('small') |
|
|
|
|
|
|
|
|
|
const handleResize = () => { |
|
|
|
|
if (width.value < 1608) { |
|
|
|
|
size.value = 'small' |
|
|
|
|
} else if (width.value < 2000) { |
|
|
|
|
size.value = 'medium' |
|
|
|
|
} else { |
|
|
|
|
size.value = 'large' |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
|
handleResize() |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
watch(width, handleResize) |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
|
<div |
|
|
|
|
class="flex flex-wrap gap-3 py-3 items-center justify-center overflow-auto nc-scrollbar-md" |
|
|
|
|
data-testid="nc-calendar-year-view" |
|
|
|
|
> |
|
|
|
|
<NcDateWeekSelector |
|
|
|
|
v-for="(_, index) in months" |
|
|
|
|
:key="index" |
|
|
|
|
v-model:active-dates="activeDates" |
|
|
|
|
v-model:page-date="months[index]" |
|
|
|
|
v-model:selected-date="selectedDate" |
|
|
|
|
:size="size" |
|
|
|
|
data-testid="nc-calendar-year-view-month-selector" |
|
|
|
|
disable-pagination |
|
|
|
|
/> |
|
|
|
|
<div ref="calendarContainer" class="overflow-auto flex my-3 justify-center nc-scrollbar-md"> |
|
|
|
|
<div class="grid grid-cols-4 justify-items-center gap-3" data-testid="nc-calendar-year-view"> |
|
|
|
|
<NcDateWeekSelector |
|
|
|
|
v-for="(_, index) in months" |
|
|
|
|
:key="index" |
|
|
|
|
v-model:active-dates="activeDates" |
|
|
|
|
v-model:page-date="months[index]" |
|
|
|
|
v-model:selected-date="selectedDate" |
|
|
|
|
:size="size" |
|
|
|
|
data-testid="nc-calendar-year-view-month-selector" |
|
|
|
|
disable-pagination |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|