Browse Source

fix(nc-gui): position calc fix

pull/7611/head
DarkPhoenix2704 9 months ago
parent
commit
d74c366b51
  1. 4
      packages/nc-gui/components/smartsheet/calendar/DayView.vue
  2. 16
      packages/nc-gui/components/smartsheet/calendar/WeekView.vue
  3. 1
      packages/nc-gui/lib/types.ts

4
packages/nc-gui/components/smartsheet/calendar/DayView.vue

@ -121,12 +121,12 @@ const getRecordPosition = (record: Row) => {
// EndDate and no StartDate -> Same Day No Spanning - none // EndDate and no StartDate -> Same Day No Spanning - none
if (startDate.isSame(selectedDate.value, 'day') && endDate.isSame(selectedDate.value, 'day')) { if (startDate.isSame(selectedDate.value, 'day') && endDate.isSame(selectedDate.value, 'day')) {
return 'rounded' return 'rounded'
} else if (startDate.isBefore(selectedDate.value, 'day') && endDate.isAfter(selectedDate.value, 'day')) {
return 'none'
} else if (startDate.isSame(selectedDate.value, 'day') && endDate.isAfter(selectedDate.value, 'day')) { } else if (startDate.isSame(selectedDate.value, 'day') && endDate.isAfter(selectedDate.value, 'day')) {
return 'leftRounded' return 'leftRounded'
} else if (startDate.isBefore(selectedDate.value, 'day') && endDate.isSame(selectedDate.value, 'day')) { } else if (startDate.isBefore(selectedDate.value, 'day') && endDate.isSame(selectedDate.value, 'day')) {
return 'rightRounded' return 'rightRounded'
} else if (startDate.isBefore(selectedDate.value, 'day') && endDate.isAfter(selectedDate.value, 'day')) {
return 'rounded'
} else if (startDate.isSame(selectedDate.value, 'day') && endDate.isBefore(selectedDate.value, 'day')) { } else if (startDate.isSame(selectedDate.value, 'day') && endDate.isBefore(selectedDate.value, 'day')) {
return 'rightRounded' return 'rightRounded'
} else if (startDate.isAfter(selectedDate.value, 'day') && endDate.isSame(selectedDate.value, 'day')) { } else if (startDate.isAfter(selectedDate.value, 'day') && endDate.isSame(selectedDate.value, 'day')) {

16
packages/nc-gui/components/smartsheet/calendar/WeekView.vue

@ -54,13 +54,7 @@ const getRecordPosition = (record: Row) => {
// StartDate is before selectedDateRange start and EndDate is after selectedDateRange end -> Spanning Both // StartDate is before selectedDateRange start and EndDate is after selectedDateRange end -> Spanning Both
// StartDate is after selectedDateRange end and EndDate is before selectedDateRange start -> Spanning Both // StartDate is after selectedDateRange end and EndDate is before selectedDateRange start -> Spanning Both
if (startDate.isSameOrAfter(selectedDateRange.value.start) && endDate.isSameOrBefore(selectedDateRange.value.end)) { if (startDate.isSameOrAfter(selectedDateRange.value.start) && endDate.isAfter(selectedDateRange.value.end)) {
return 'rounded'
} else if (endDate.isSameOrAfter(selectedDateRange.value.start) && startDate.isSameOrBefore(selectedDateRange.value.end)) {
return 'rounded'
} else if ((startDate && !endDate) || (endDate && !startDate)) {
return 'rounded'
} else if (startDate.isSameOrAfter(selectedDateRange.value.start) && endDate.isAfter(selectedDateRange.value.end)) {
return 'leftRounded' return 'leftRounded'
} else if (endDate.isSameOrAfter(selectedDateRange.value.start) && startDate.isAfter(selectedDateRange.value.end)) { } else if (endDate.isSameOrAfter(selectedDateRange.value.start) && startDate.isAfter(selectedDateRange.value.end)) {
return 'leftRounded' return 'leftRounded'
@ -72,6 +66,12 @@ const getRecordPosition = (record: Row) => {
return 'rounded' return 'rounded'
} else if (startDate.isAfter(selectedDateRange.value.end) && endDate.isBefore(selectedDateRange.value.start)) { } else if (startDate.isAfter(selectedDateRange.value.end) && endDate.isBefore(selectedDateRange.value.start)) {
return 'rounded' return 'rounded'
} else if (startDate.isSameOrAfter(selectedDateRange.value.start) && endDate.isSameOrBefore(selectedDateRange.value.end)) {
return 'rounded'
} else if (endDate.isSameOrAfter(selectedDateRange.value.start) && startDate.isSameOrBefore(selectedDateRange.value.end)) {
return 'rounded'
} else if ((startDate && !endDate) || (endDate && !startDate)) {
return 'rounded'
} }
} }
} }
@ -194,8 +194,6 @@ const calendarData = computed(() => {
} }
}) })
console.log(recordsInDay)
return recordsInRange return recordsInRange
}) })
</script> </script>

1
packages/nc-gui/lib/types.ts

@ -64,6 +64,7 @@ interface Row {
// use in datetime picker component // use in datetime picker component
isUpdatedFromCopyNPaste?: Record<string, boolean> isUpdatedFromCopyNPaste?: Record<string, boolean>
// Used in Calendar view // Used in Calendar view
style?: Partial<CSSStyleDeclaration>
range?: { range?: {
fk_from_col: ColumnType fk_from_col: ColumnType
fk_to_col: ColumnType | null fk_to_col: ColumnType | null

Loading…
Cancel
Save