diff --git a/packages/nc-gui/components/dlg/ViewCreate.vue b/packages/nc-gui/components/dlg/ViewCreate.vue index 38fc6dfd7e..9de6d7d4d4 100644 --- a/packages/nc-gui/components/dlg/ViewCreate.vue +++ b/packages/nc-gui/components/dlg/ViewCreate.vue @@ -1037,13 +1037,14 @@ const getPluralName = (name: string) => { - - {{ $t('activity.endDate') }} + + + {{ $t('activity.endDate') }} + @@ -1054,7 +1055,8 @@ const getPluralName = (name: string) => { { - - - { @apply !rounded-lg; } } - -.nc-to-select { - :deep(.ant-select) { - .ant-select-selector { - border-top-right-radius: 0 !important; - border-bottom-right-radius: 0 !important; - } - } -} diff --git a/packages/nc-gui/components/smartsheet/calendar/DayView/DateField.vue b/packages/nc-gui/components/smartsheet/calendar/DayView/DateField.vue index f0dceb10b2..2efc18eb51 100644 --- a/packages/nc-gui/components/smartsheet/calendar/DayView/DateField.vue +++ b/packages/nc-gui/components/smartsheet/calendar/DayView/DateField.vue @@ -211,6 +211,7 @@ const newRecord = () => { = { - left: `${startDayIndex * perWidth}px`, + left: `${startDayIndex * perWidth - 0.5}px`, width: `${(endDayIndex - startDayIndex + 1) * perWidth}px`, top: isRecordDraggingOrResizeState ? `${weekIndex * perHeight + perRecordHeight}px` @@ -373,6 +374,7 @@ const recordsToDisplay = computed<{ position, style, range, + maxSpanning: endDayIndex - startDayIndex + 1, id, recordIndex, }, @@ -639,11 +641,6 @@ const dragStart = (event: MouseEvent, record: Row) => { // TODO: @DarkPhoenix2704 // const initialDragElement = document.querySelector(`[data-unique-id="${record.rowMeta.id}-0"]`) - dragOffset.value = { - x: event.clientX - target.getBoundingClientRect().left, - y: event.clientY - target.getBoundingClientRect().top, - } - // selectedDate.value = null isDragging.value = true @@ -651,6 +648,11 @@ const dragStart = (event: MouseEvent, record: Row) => { draggingId.value = record.rowMeta!.id! dragRecord.value = record + dragOffset.value = { + x: dragRecord.value?.rowMeta.maxSpanning > 1 ? event.clientX - target.getBoundingClientRect().left : 0, + y: event.clientY, + } + document.addEventListener('mousemove', onDrag) document.addEventListener('mouseup', stopDrag) }, 500) diff --git a/packages/nc-gui/components/smartsheet/calendar/WeekView/DateField.vue b/packages/nc-gui/components/smartsheet/calendar/WeekView/DateField.vue index 782f35418c..58df7737ad 100644 --- a/packages/nc-gui/components/smartsheet/calendar/WeekView/DateField.vue +++ b/packages/nc-gui/components/smartsheet/calendar/WeekView/DateField.vue @@ -154,9 +154,10 @@ const calendarData = computed(() => { range: { fk_from_col, fk_to_col }, position, id, + spanningDays: Math.abs(ogStartDate.diff(endDate, 'day')) - Math.abs(startDate.diff(endDate, 'day')), style: { - width: `calc(max(${spanDays * perDayWidth - 10}px, ${perDayWidth - 10}px))`, - left: `${startDaysDiff * perDayWidth + 4}px`, + width: `calc(max(${spanDays * perDayWidth + 0.5}px, ${perDayWidth + 0.5}px))`, + left: `${startDaysDiff * perDayWidth - 1}px`, top: `${suitableRow * 28 + Math.max(suitableRow + 1, 1) * 8}px`, }, }, @@ -304,7 +305,7 @@ const calculateNewRow = (event: MouseEvent, updateSideBarData?: boolean) => { relativeX -= dragOffset.value.x } - const percentX = Math.max(0, Math.min(1, relativeX / width)) + const percentX = relativeX / width const fromCol = dragRecord.value.rowMeta.range?.fk_from_col const toCol = dragRecord.value.rowMeta.range?.fk_to_col @@ -312,8 +313,8 @@ const calculateNewRow = (event: MouseEvent, updateSideBarData?: boolean) => { if (!fromCol) return { updatedProperty: [], newRow: null } // Calculate the day index based on the percentage of the width - // The day index is a number between 0 and 6 - const day = Math.floor(percentX * maxVisibleDays.value) + + const day = Math.floor(percentX * maxVisibleDays.value) - dragRecord.value.rowMeta.spanningDays // Calculate the new start date based on the day index by adding the day index to the start date of the selected date range const newStartDate = dayjs(selectedDateRange.value.start).add(day, 'day') diff --git a/packages/nc-gui/components/smartsheet/toolbar/Calendar/Range.vue b/packages/nc-gui/components/smartsheet/toolbar/Calendar/Range.vue index c8a65a0624..c8509b21e4 100644 --- a/packages/nc-gui/components/smartsheet/toolbar/Calendar/Range.vue +++ b/packages/nc-gui/components/smartsheet/toolbar/Calendar/Range.vue @@ -236,13 +236,13 @@ const saveCalendarRange = async (range: CalendarRangeType, value?) => { v-if="range.fk_to_column_id === null && isRangeEnabled" size="small" data-testid="nc-calendar-range-add-end-date" - class="!border-none w-28" - type="secondary" + class="w-23" + type="text" :shadow="false" :disabled="!isEeUI || isLocked" @click="range.fk_to_column_id = undefined" > - + {{ $t('activity.endDate') }} @@ -254,7 +254,8 @@ const saveCalendarRange = async (range: CalendarRangeType, value?) => { { - - - - diff --git a/packages/nc-gui/composables/useCalendarViewStore.ts b/packages/nc-gui/composables/useCalendarViewStore.ts index 246d1a6d4f..063d1b4b95 100644 --- a/packages/nc-gui/composables/useCalendarViewStore.ts +++ b/packages/nc-gui/composables/useCalendarViewStore.ts @@ -847,11 +847,10 @@ const [useProvideCalendarViewStore, useCalendarViewStore] = useInjectionState( watch(activeCalendarView, async (value, oldValue) => { if (oldValue === 'week') { pageDate.value = selectedDate.value - selectedMonth.value = selectedTime.value ?? selectedDate.value ?? selectedDateRange.value.start - selectedDate.value = selectedTime.value ?? selectedDateRange.value.start + selectedMonth.value = selectedDate.value ?? selectedDateRange.value.start + selectedDate.value = selectedDate.value ?? selectedDateRange.value.start selectedTime.value = selectedDate.value ?? selectedDateRange.value.start } else if (oldValue === 'month') { - selectedDate.value = selectedMonth.value pageDate.value = selectedDate.value selectedTime.value = selectedDate.value selectedDateRange.value = { diff --git a/packages/nc-gui/lib/types.ts b/packages/nc-gui/lib/types.ts index 984fd354a5..78013222cd 100644 --- a/packages/nc-gui/lib/types.ts +++ b/packages/nc-gui/lib/types.ts @@ -103,6 +103,7 @@ interface Row { numberOfOverlaps?: number minutes?: number recordIndex?: number // For week spanning records in month view + maxSpanning?: number } }