Browse Source

fix(nc-gui): max drag to end of week

pull/7611/head
DarkPhoenix2704 10 months ago
parent
commit
5c22465a64
  1. 6
      packages/nc-gui/components/nc/DateWeekSelector.vue
  2. 4
      packages/nc-gui/components/smartsheet/calendar/WeekView/DateField.vue
  3. 1
      packages/nc-gui/components/smartsheet/calendar/index.vue

6
packages/nc-gui/components/nc/DateWeekSelector.vue

@ -198,18 +198,18 @@ const paginate = (action: 'next' | 'prev') => {
} }
.nc-selected-week:before { .nc-selected-week:before {
@apply absolute top-0 left-0 w-full h-full border-y-2 bg-brand-50 border-brand-500; @apply absolute top-0 left-0 w-full h-full border-y-1 bg-brand-50 border-brand-500;
content: ''; content: '';
width: 124%; width: 124%;
height: 100%; height: 100%;
} }
.nc-selected-week-start:before { .nc-selected-week-start:before {
@apply !border-l-2 !rounded-l-lg; @apply !border-l-1 !rounded-l-lg;
} }
.nc-selected-week-end:before { .nc-selected-week-end:before {
width: 100%; width: 100%;
@apply !border-r-2 !rounded-r-lg; @apply !border-r-1 !rounded-r-lg;
} }
</style> </style>

4
packages/nc-gui/components/smartsheet/calendar/WeekView/DateField.vue

@ -231,7 +231,7 @@ const onResize = (event: MouseEvent) => {
const ogEndDate = dayjs(resizeRecord.value.row[toCol.title!]) const ogEndDate = dayjs(resizeRecord.value.row[toCol.title!])
const ogStartDate = dayjs(resizeRecord.value.row[fromCol.title!]) const ogStartDate = dayjs(resizeRecord.value.row[fromCol.title!])
const day = Math.floor(percentX * 7) const day = Math.min(Math.floor(percentX * 7), 6)
if (resizeDirection.value === 'right') { if (resizeDirection.value === 'right') {
let newEndDate = dayjs(selectedDateRange.value.start).add(day, 'day') let newEndDate = dayjs(selectedDateRange.value.start).add(day, 'day')
@ -318,7 +318,7 @@ const onDrag = (event: MouseEvent) => {
if (!fromCol) return if (!fromCol) return
const day = Math.floor(percentX * 7) const day = Math.min(Math.floor(percentX * 7), 6)
const newStartDate = dayjs(selectedDateRange.value.start).add(day, 'day') const newStartDate = dayjs(selectedDateRange.value.start).add(day, 'day')
if (!newStartDate) return if (!newStartDate) return

1
packages/nc-gui/components/smartsheet/calendar/index.vue

@ -160,6 +160,7 @@ const headerText = computed(() => {
'w-36': activeCalendarView === 'month', 'w-36': activeCalendarView === 'month',
'w-40': activeCalendarView === 'day', 'w-40': activeCalendarView === 'day',
'w-20': activeCalendarView === 'year', 'w-20': activeCalendarView === 'year',
'w-50': activeCalendarView === 'week',
}" }"
size="small" size="small"
type="secondary" type="secondary"

Loading…
Cancel
Save