Browse Source

fix: min record size is 1 hour

pull/9831/head
DarkPhoenix2704 2 days ago
parent
commit
582beffa07
  1. 2
      packages/nc-gui/components/smartsheet/calendar/VRecordCard.vue
  2. 10
      packages/nc-gui/components/smartsheet/calendar/WeekView/DateTimeField.vue

2
packages/nc-gui/components/smartsheet/calendar/VRecordCard.vue

@ -44,7 +44,7 @@ const emit = defineEmits(['resize-start'])
'bg-pink-500': color === 'pink', 'bg-pink-500': color === 'pink',
'bg-purple-500': color === 'purple', 'bg-purple-500': color === 'purple',
}" }"
class="h-full min-h-9 w-1.25 -ml-0.25 rounded-l-md" class="h-full min-h-3 w-1.25 -ml-0.25 rounded-l-md"
></div> ></div>
<div class="flex overflow-x-hidden whitespace-nowrap text-ellipsis pt-1 w-full truncate text-ellipsis flex-col gap-1"> <div class="flex overflow-x-hidden whitespace-nowrap text-ellipsis pt-1 w-full truncate text-ellipsis flex-col gap-1">

10
packages/nc-gui/components/smartsheet/calendar/WeekView/DateTimeField.vue

@ -596,14 +596,24 @@ const onResize = (event: MouseEvent) => {
let isValid = true let isValid = true
if (resizeDirection.value === 'right') { if (resizeDirection.value === 'right') {
const minEndDate = ogStartDate.add(1, 'hour')
newDate = baseDate.isBefore(ogStartDate) newDate = baseDate.isBefore(ogStartDate)
? ogStartDate.add(Math.ceil(ogStartDate.diff(baseDate, 'minute') / 15) * 15, 'minute') ? ogStartDate.add(Math.ceil(ogStartDate.diff(baseDate, 'minute') / 15) * 15, 'minute')
: baseDate : baseDate
if (newDate.isBefore(minEndDate)) {
newDate = minEndDate
}
updateProperty = toCol.title updateProperty = toCol.title
} else if (resizeDirection.value === 'left') { } else if (resizeDirection.value === 'left') {
const minStartDate = ogEndDate.subtract(1, 'hour')
newDate = baseDate.isAfter(ogEndDate) newDate = baseDate.isAfter(ogEndDate)
? ogEndDate.subtract(Math.ceil(baseDate.diff(ogEndDate, 'minute') / 15) * 15, 'minute') ? ogEndDate.subtract(Math.ceil(baseDate.diff(ogEndDate, 'minute') / 15) * 15, 'minute')
: baseDate : baseDate
if (newDate.isAfter(minStartDate)) {
newDate = minStartDate
}
updateProperty = fromCol.title updateProperty = fromCol.title
} else { } else {
isValid = false isValid = false

Loading…
Cancel
Save