From 5ca6b4c9754885122e6e788dc4a49244721f3afb Mon Sep 17 00:00:00 2001 From: DarkPhoenix2704 Date: Tue, 5 Mar 2024 10:10:28 +0000 Subject: [PATCH] fix: minor interaction correction --- .../calendar/DayView/DateTimeField.vue | 9 ++---- .../smartsheet/calendar/MonthView.vue | 29 ++++++----------- .../smartsheet/calendar/RecordCard.vue | 9 +++--- .../smartsheet/calendar/VRecordCard.vue | 11 ++++--- .../calendar/WeekView/DateField.vue | 32 +++++++------------ .../calendar/WeekView/DateTimeField.vue | 19 +++-------- .../components/smartsheet/calendar/index.vue | 2 +- 7 files changed, 41 insertions(+), 70 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue b/packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue index d086a45c43..8f1e6c55e3 100644 --- a/packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue +++ b/packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue @@ -391,10 +391,7 @@ const calculateNewRow = (event: MouseEvent) => { if (dragElement.value) { formattedData.value = formattedData.value.map((r) => { const pk = extractPkFromRow(r.row, meta.value!.columns!) - if (pk === newPk) { - return newRow - } - return r + return pk === newPk ? newRow : r }) } else { // If the old row is not found, we add the new row to the formattedData array and remove the old row from the formattedSideBarData array @@ -564,7 +561,6 @@ const dragStart = (event: MouseEvent, record: Row) => { dragRecord.value = record dragElement.value = target - dragRecord.value = record document.addEventListener('mousemove', onDrag) document.addEventListener('mouseup', stopDrag) @@ -749,7 +745,8 @@ const viewMore = (hour: dayjs.Dayjs) => { > { dragElement.value = null } + dragRecord.value = undefined updateRowProperty(newRow, updateProperty, false) focusedDate.value = null @@ -550,12 +551,10 @@ const dragStart = (event: MouseEvent, record: Row) => { const allRecords = document.querySelectorAll('.draggable-record') allRecords.forEach((el) => { if (!el.getAttribute('data-unique-id').includes(record.rowMeta.id!)) { - // el.style.visibility = 'hidden' el.style.opacity = '30%' } }) - dragRecord.value = record // selectedDate.value = null isDragging.value = true @@ -672,7 +671,7 @@ const isDateSelected = (date: dayjs.Dayjs) => { '!block': isDateSelected(day), '!hidden': !isDateSelected(day), }" - class="!group-hover:block" + class="!group-hover:block rounded" size="small" type="secondary" > @@ -709,8 +708,8 @@ const isDateSelected = (date: dayjs.Dayjs) => { '!block': isDateSelected(day), '!hidden': !isDateSelected(day), }" - class="!group-hover:block" - size="small" + class="!group-hover:block !w-6 !h-6 !rounded" + size="xsmall" type="secondary" @click=" () => { @@ -723,13 +722,13 @@ const isDateSelected = (date: dayjs.Dayjs) => { } " > - + {{ day.format('DD') }} @@ -761,10 +760,6 @@ const isDateSelected = (date: dayjs.Dayjs) => { :style="{ ...record.rowMeta.style, zIndex: record.rowMeta.id === draggingId ? 100 : 0, - boxShadow: - record.rowMeta.id === draggingId - ? '0px 8px 8px -4px rgba(0, 0, 0, 0.04), 0px 20px 24px -4px rgba(0, 0, 0, 0.10)' - : 'none', }" class="absolute group draggable-record cursor-pointer pointer-events-auto" @mouseleave="hoverRecord = null" @@ -773,17 +768,11 @@ const isDateSelected = (date: dayjs.Dayjs) => { > diff --git a/packages/nc-gui/components/smartsheet/calendar/RecordCard.vue b/packages/nc-gui/components/smartsheet/calendar/RecordCard.vue index fbeb7efcb2..6b0d0ab5f4 100644 --- a/packages/nc-gui/components/smartsheet/calendar/RecordCard.vue +++ b/packages/nc-gui/components/smartsheet/calendar/RecordCard.vue @@ -28,9 +28,9 @@ const emit = defineEmits(['resize-start']) :class="{ 'min-h-9': size === 'small', 'h-full': size === 'auto', - 'rounded-l-lg': position === 'leftRounded', - 'rounded-r-lg': position === 'rightRounded', - 'rounded-lg mx-1': position === 'rounded', + 'rounded-l-md': position === 'leftRounded', + 'rounded-r-md': position === 'rightRounded', + 'rounded-md mx-1': position === 'rounded', 'rounded-none': position === 'none', 'bg-maroon-50': color === 'maroon', 'bg-blue-50': color === 'blue', @@ -39,7 +39,8 @@ const emit = defineEmits(['resize-start']) 'bg-pink-50': color === 'pink', 'bg-purple-50': color === 'purple', 'group-hover:(border-brand-500 border-1)': resize, - '!border-brand-500 border-1': selected || hover, + '!border-brand-500 border-1': selected, + 'shadow-md': hover, }" class="relative transition-all flex items-center px-1 group border-1 border-transparent" > diff --git a/packages/nc-gui/components/smartsheet/calendar/VRecordCard.vue b/packages/nc-gui/components/smartsheet/calendar/VRecordCard.vue index c4ac0b4345..b66afc0c65 100644 --- a/packages/nc-gui/components/smartsheet/calendar/VRecordCard.vue +++ b/packages/nc-gui/components/smartsheet/calendar/VRecordCard.vue @@ -26,7 +26,7 @@ const emit = defineEmits(['resize-start']) >
diff --git a/packages/nc-gui/components/smartsheet/calendar/WeekView/DateField.vue b/packages/nc-gui/components/smartsheet/calendar/WeekView/DateField.vue index fecd8400db..f8f0242b64 100644 --- a/packages/nc-gui/components/smartsheet/calendar/WeekView/DateField.vue +++ b/packages/nc-gui/components/smartsheet/calendar/WeekView/DateField.vue @@ -418,7 +418,7 @@ const calculateNewRow = (event: MouseEvent, updateSideBarData?: boolean) => { const onDrag = (event: MouseEvent) => { if (!isUIAllowed('dataEdit')) return if (!container.value || !dragRecord.value) return - calculateNewRow(event) + calculateNewRow(event, false) } const stopDrag = (event: MouseEvent) => { @@ -443,6 +443,7 @@ const stopDrag = (event: MouseEvent) => { dragElement.value.style.boxShadow = 'none' dragElement.value = null } + dragRecord.value = undefined updateRowProperty(newRow, updateProperty, false) @@ -470,8 +471,6 @@ const dragStart = (event: MouseEvent, record: Row) => { } }) - dragRecord.value = record - isDragging.value = true dragElement.value = target dragRecord.value = record @@ -512,10 +511,13 @@ const dropEvent = (event: DragEvent) => { dragElement.value = null } updateRowProperty(newRow, updateProperty, false) - - dragRecord.value = null } } + +const selectDate = (day: dayjs.Dayjs) => { + selectedDate.value = day + dragRecord.value = undefined +}