Browse Source

fix(nc-gui): month picker

pull/7611/head
DarkPhoenix2704 7 months ago
parent
commit
dcc488ce61
  1. 8
      packages/nc-gui/components/nc/MonthYearSelector.vue

8
packages/nc-gui/components/nc/MonthYearSelector.vue

@ -12,7 +12,7 @@ const props = withDefaults(defineProps<Props>(), {
selectedDate: null, selectedDate: null,
isDisabled: false, isDisabled: false,
pageDate: new Date(), pageDate: new Date(),
yearPicker: false, yearPicker: false
}); });
const pageDate = useVModel(props, 'pageDate', emit); const pageDate = useVModel(props, 'pageDate', emit);
@ -20,8 +20,8 @@ const selectedDate = useVModel(props, 'selectedDate', emit);
const years = computed(() => { const years = computed(() => {
const date = new Date(pageDate.value); const date = new Date(pageDate.value);
const startYear = date.getFullYear() - 5; const startYear = date.getFullYear();
const endYear = date.getFullYear() + 6; const endYear = date.getFullYear() + 11;
const years = []; const years = [];
for (let i = startYear; i <= endYear; i++) { for (let i = startYear; i <= endYear; i++) {
years.push({ years.push({
@ -146,7 +146,7 @@ const compareYear = (date1: Date, date2: Date) => {
<component :is="iconMap.doubleRightArrow" class="h-4 w-4"/> <component :is="iconMap.doubleRightArrow" class="h-4 w-4"/>
</NcButton> </NcButton>
</div> </div>
<div class="border-1 border-gray-200 rounded-y-xl max-w-[320px]"> <div class="border-1 border-gray-200 rounded-y-xl max-w-[350px]">
<div class="grid grid-cols-4 gap-2 p-2"> <div class="grid grid-cols-4 gap-2 p-2">
<span v-for="(month) in months" v-if="!yearPicker" :key="month.value" :class="{ <span v-for="(month) in months" v-if="!yearPicker" :key="month.value" :class="{
'!bg-brand-50 !border-2 !border-brand-500' : isMonthSelected(month.value), '!bg-brand-50 !border-2 !border-brand-500' : isMonthSelected(month.value),

Loading…
Cancel
Save