diff --git a/packages/nc-gui/components/smartsheet/PlainCell.vue b/packages/nc-gui/components/smartsheet/PlainCell.vue index 6a190cfada..7d7c70b808 100644 --- a/packages/nc-gui/components/smartsheet/PlainCell.vue +++ b/packages/nc-gui/components/smartsheet/PlainCell.vue @@ -376,6 +376,8 @@ const parseValue = (value: any, col: ColumnType): string => { &::before { content: '•'; padding: 0 4px; + display: inline-block; + text-decoration: none !important; } &:first-child::before { content: ''; diff --git a/packages/nc-gui/components/smartsheet/calendar/DayView/DateField.vue b/packages/nc-gui/components/smartsheet/calendar/DayView/DateField.vue index 955bfbaff4..82c843f784 100644 --- a/packages/nc-gui/components/smartsheet/calendar/DayView/DateField.vue +++ b/packages/nc-gui/components/smartsheet/calendar/DayView/DateField.vue @@ -45,7 +45,14 @@ const recordsAcrossAllRange = computed(() => { const fromCol = range.fk_from_col const endCol = range.fk_to_col if (fromCol && endCol) { - for (const record of formattedData.value) { + const filteredData = formattedData.value.filter((record) => { + const startDate = dayjs(record.row[fromCol.title!]) + const endDate = dayjs(record.row[endCol.title!]) + + return startDate.isSameOrBefore(endDate, 'day') + }) + + for (const record of filteredData) { const startDate = dayjs(record.row[fromCol.title!]) const endDate = dayjs(record.row[endCol.title!]) diff --git a/packages/nc-gui/components/smartsheet/calendar/RecordCard.vue b/packages/nc-gui/components/smartsheet/calendar/RecordCard.vue index d4e47e148b..5b91605456 100644 --- a/packages/nc-gui/components/smartsheet/calendar/RecordCard.vue +++ b/packages/nc-gui/components/smartsheet/calendar/RecordCard.vue @@ -71,7 +71,7 @@ const emit = defineEmits(['resize-start']) >
- .... + ....
.... + ....
{ .filter((r) => { const startDate = dayjs(r.row[fk_from_col.title!]) const endDate = dayjs(r.row[fk_to_col.title!]) - return startDate.isValid() && endDate.isValid() && !endDate.isBefore(startDate) + return ( + startDate.isValid() && + endDate.isValid() && + !endDate.isBefore(startDate) && + !endDate.isBefore(selectedDateRange.value.start, 'day') + ) }) .forEach(processRecord) } else { @@ -294,16 +299,16 @@ const dragOffset = ref<{ // This method is used to calculate the new start and end date of a record when dragging and dropping const calculateNewRow = (event: MouseEvent, updateSideBarData?: boolean) => { - const { width, left } = container.value.getBoundingClientRect() + const { width, left } = container.value?.getBoundingClientRect() // Calculate the percentage of the width based on the mouse position // This is used to calculate the day index - let relativeX = event.clientX - left + const relativeX = event.clientX - left - if (dragOffset.value.x) { + /* if (dragOffset.value.x && dragRecord.value?.rowMeta.spanningDays === 1) { relativeX -= dragOffset.value.x - } + } */ const percentX = relativeX / width @@ -377,6 +382,8 @@ const calculateNewRow = (event: MouseEvent, updateSideBarData?: boolean) => { const onDrag = (event: MouseEvent) => { if (!isUIAllowed('dataEdit')) return if (!container.value || !dragRecord.value) return + event.preventDefault() + calculateNewRow(event, false) } @@ -402,10 +409,16 @@ const stopDrag = (event: MouseEvent) => { dragElement.value.style.boxShadow = 'none' dragElement.value = null } + dragRecord.value = undefined updateRowProperty(newRow, updateProperty, false) + dragOffset.value = { + x: null, + y: null, + } + document.removeEventListener('mousemove', onDrag) document.removeEventListener('mouseup', stopDrag) } @@ -482,11 +495,6 @@ const dropEvent = (event: DragEvent) => { } updateRowProperty(newRow, updateProperty, false) - dragOffset.value = { - x: null, - y: null, - } - $e('c:calendar:day:drag-record') } }