Browse Source

fix(nc-gui): view more & filter fix

pull/7611/head
DarkPhoenix2704 10 months ago
parent
commit
16498d10ce
  1. 28
      packages/nc-gui/components/smartsheet/calendar/MonthView.vue
  2. 6
      packages/nc-gui/composables/useCalendarViewStore.ts

28
packages/nc-gui/components/smartsheet/calendar/MonthView.vue

@ -6,8 +6,16 @@ import type { Row } from '#imports'
const emit = defineEmits(['new-record', 'expandRecord'])
const { selectedDate, selectedMonth, formattedData, formattedSideBarData, displayField, calendarRange, updateRowProperty } =
useCalendarViewStoreOrThrow()
const {
selectedDate,
selectedMonth,
formattedData,
formattedSideBarData,
sideBarFilterOption,
displayField,
calendarRange,
updateRowProperty,
} = useCalendarViewStoreOrThrow()
const isMondayFirst = ref(true)
@ -668,6 +676,11 @@ const selectDate = (date: Date) => {
selectedDate.value = date
}
const viewMore = (date: Date) => {
sideBarFilterOption.value = 'selectedDate' as const
selectedDate.value = date
}
const isDateSelected = (date: Date) => {
if (!selectedDate.value) return false
return dayjs(date).isSame(selectedDate.value, 'day')
@ -794,16 +807,19 @@ onBeforeUnmount(() => {
</div>
<div v-if="!isUIAllowed('dataEdit')" class="p-3">{{ dayjs(day).format('DD') }}</div>
<div
<NcButton
v-if="
recordsToDisplay.count[dayjs(day).format('YYYY-MM-DD')] &&
recordsToDisplay.count[dayjs(day).format('YYYY-MM-DD')]?.overflow &&
!draggingId
"
class="text-xs absolute bottom-1 text-center inset-x-0 !z-[90] text-gray-500"
class="!absolute bottom-1 text-center w-13 mx-auto inset-x-0 z-3 text-gray-500"
size="xxsmall"
type="secondary"
@click="viewMore(day)"
>
+ {{ recordsToDisplay.count[dayjs(day).format('YYYY-MM-DD')]?.overflowCount }} more
</div>
<span class="text-xs"> + {{ recordsToDisplay.count[dayjs(day).format('YYYY-MM-DD')]?.overflowCount }} more </span>
</NcButton>
</div>
</div>
</div>

6
packages/nc-gui/composables/useCalendarViewStore.ts

@ -151,8 +151,8 @@ const [useProvideCalendarViewStore, useCalendarViewStore] = useInjectionState(
switch (sideBarFilterOption.value) {
case 'day':
fromDate = dayjs(selectedDate.value)
toDate = dayjs(selectedDate.value)
fromDate = dayjs(selectedDate.value).startOf('day')
toDate = dayjs(selectedDate.value).endOf('day')
break
case 'week':
fromDate = dayjs(selectedDateRange.value.start).startOf('day')
@ -164,7 +164,7 @@ const [useProvideCalendarViewStore, useCalendarViewStore] = useInjectionState(
const daysToDisplay = Math.max(endOfMonth.diff(startOfMonth, 'day') + 1, 35)
fromDate = startOfMonth.subtract((startOfMonth.day() + 7) % 7, 'day').add(1, 'day')
toDate = fromDate.add(daysToDisplay, 'day')
toDate = fromDate.add(daysToDisplay, 'day').endOf('day')
break
}
case 'year':

Loading…
Cancel
Save