Browse Source

feat(nc-gui): week view include granularity

pull/7731/head
DarkPhoenix2704 6 months ago
parent
commit
d3a33ef4b3
  1. 1
      packages/nc-gui/components/smartsheet/calendar/Cell.vue
  2. 2
      packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue
  3. 4
      packages/nc-gui/components/smartsheet/calendar/MonthView.vue
  4. 6
      packages/nc-gui/components/smartsheet/calendar/WeekView/DateTimeField.vue

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

@ -260,7 +260,6 @@ const getLookupValue = (modelValue: string | null | number | Array<any>, col: Co
}
const getAttachmentValue = (modelValue: string | null | number | Array<any>) => {
console.log(modelValue)
if (Array.isArray(modelValue)) {
return modelValue.map((v) => `${v.title} (${getPossibleAttachmentSrc(v).join(', ')})`).join(', ')
}

2
packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue

@ -336,7 +336,7 @@ const calculateNewRow = (event: MouseEvent) => {
// We calculate the hour based on the percentage of the mouse position in the scroll container
// It can be between 0 and 23 (inclusive)
const hour = Math.max(Math.floor(percentY * 23), 0)
const minutes = Math.floor(((percentY * 22 - hour) * 60) / 15) * 15
const minutes = Math.max(0, Math.min(59, Math.floor(((percentY * 22 - hour) * 60) / 15) * 15))
// We calculate the new startDate by adding the hour to the start of the selected date
const newStartDate = dayjs(selectedDate.value).startOf('day').add(hour, 'hour').add(minutes, 'minute')

4
packages/nc-gui/components/smartsheet/calendar/MonthView.vue

@ -508,12 +508,8 @@ const onResizeStart = (direction: 'right' | 'left', event: MouseEvent, record: R
const stopDrag = (event: MouseEvent) => {
clearTimeout(dragTimeout.value)
console.log('stopDrag')
console.log('stopDrag', dragRecord.value, isDragging.value)
if (!isUIAllowed('dataEdit') || !dragRecord.value || !isDragging.value) return
console.log('stopDrag')
event.preventDefault()
dragElement.value!.style.boxShadow = 'none'

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

@ -528,7 +528,7 @@ const calculateNewRow = (
const day = Math.max(0, Math.min(6, Math.floor(percentX * 7)))
const hour = Math.max(0, Math.min(23, Math.floor(percentY * 24)))
const minutes = Math.floor(((percentY * 22 - hour) * 60) / 15) * 15
const minutes = Math.max(0, Math.min(59, Math.floor(((percentY * 22 - hour) * 60) / 15) * 15))
const newStartDate = dayjs(selectedDateRange.value.start).add(day, 'day').add(hour, 'hour').add(minutes, 'minute')
if (!newStartDate) return { newRow: null, updatedProperty: [] }
@ -589,9 +589,9 @@ const onDrag = (event: MouseEvent) => {
const scrollBottomThreshold = 20
if (event.clientY > containerRect.bottom - scrollBottomThreshold) {
scrollContainer.value.scrollTop += 10
scrollContainer.value.scrollTop += 20
} else if (event.clientY < containerRect.top + scrollBottomThreshold) {
scrollContainer.value.scrollTop -= 10
scrollContainer.value.scrollTop -= 20
}
calculateNewRow(event)

Loading…
Cancel
Save