|
|
@ -133,13 +133,12 @@ const recordsToDisplay = computed<{ |
|
|
|
|
|
|
|
|
|
|
|
// Filter out records that don't satisfy the range and sort them by start date |
|
|
|
// Filter out records that don't satisfy the range and sort them by start date |
|
|
|
const sortedFormattedData = [...formattedData.value].filter((record) => { |
|
|
|
const sortedFormattedData = [...formattedData.value].filter((record) => { |
|
|
|
const fromDate = record.row[startCol!.title!] ? dayjs(record.row[startCol!.title!]) : null |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (startCol && endCol) { |
|
|
|
if (startCol && endCol) { |
|
|
|
const fromDate = record.row[startCol!.title!] ? dayjs(record.row[startCol!.title!]) : null |
|
|
|
const fromDate = record.row[startCol.title!] ? dayjs(record.row[startCol.title!]) : null |
|
|
|
const toDate = record.row[endCol!.title!] ? dayjs(record.row[endCol!.title!]) : null |
|
|
|
const toDate = record.row[endCol.title!] ? dayjs(record.row[endCol.title!]) : null |
|
|
|
return fromDate && toDate && !toDate.isBefore(fromDate) |
|
|
|
return fromDate && toDate && !toDate.isBefore(fromDate) |
|
|
|
} else if (startCol && !endCol) { |
|
|
|
} else if (startCol && !endCol) { |
|
|
|
|
|
|
|
const fromDate = record.row[startCol!.title!] ? dayjs(record.row[startCol!.title!]) : null |
|
|
|
return !!fromDate |
|
|
|
return !!fromDate |
|
|
|
} |
|
|
|
} |
|
|
|
return false |
|
|
|
return false |
|
|
@ -148,7 +147,7 @@ const recordsToDisplay = computed<{ |
|
|
|
sortedFormattedData.forEach((record: Row) => { |
|
|
|
sortedFormattedData.forEach((record: Row) => { |
|
|
|
if (!endCol && startCol) { |
|
|
|
if (!endCol && startCol) { |
|
|
|
// If there is no end date, we just display the record on the start date |
|
|
|
// If there is no end date, we just display the record on the start date |
|
|
|
const startDate = dayjs(record.row[startCol!.title!]) |
|
|
|
const startDate = dayjs(record.row[startCol.title!]) |
|
|
|
const dateKey = startDate.format('YYYY-MM-DD') |
|
|
|
const dateKey = startDate.format('YYYY-MM-DD') |
|
|
|
|
|
|
|
|
|
|
|
if (!recordsInDay[dateKey]) { |
|
|
|
if (!recordsInDay[dateKey]) { |
|
|
@ -200,13 +199,13 @@ const recordsToDisplay = computed<{ |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else if (startCol && endCol) { |
|
|
|
} else if (startCol && endCol) { |
|
|
|
// If the range specifies fromCol and endCol |
|
|
|
// If the range specifies fromCol and endCol |
|
|
|
const startDate = dayjs(record.row[startCol!.title!]) |
|
|
|
const startDate = dayjs(record.row[startCol.title!]) |
|
|
|
const endDate = dayjs(record.row[endCol!.title!]) |
|
|
|
const endDate = dayjs(record.row[endCol.title!]) |
|
|
|
|
|
|
|
|
|
|
|
let currentWeekStart = startDate.startOf('week') |
|
|
|
let currentWeekStart = startDate.startOf('week') |
|
|
|
|
|
|
|
|
|
|
|
const id = record.rowMeta.id ?? generateRandomNumber() |
|
|
|
const id = record.rowMeta.id ?? generateRandomNumber() |
|
|
|
// Since the records can span multiple weeks, to display, we render multiple records |
|
|
|
// Since the records can span multiple weeks, to display, we render multiple elements |
|
|
|
// for each week the record spans. The id is used to identify the elements that belong to the same record |
|
|
|
// for each week the record spans. The id is used to identify the elements that belong to the same record |
|
|
|
|
|
|
|
|
|
|
|
while ( |
|
|
|
while ( |
|
|
@ -263,8 +262,7 @@ const recordsToDisplay = computed<{ |
|
|
|
overflowCount: 0, |
|
|
|
overflowCount: 0, |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
const recordIndex = recordsInDay[dateKey].count |
|
|
|
maxRecordCount = Math.max(maxRecordCount, recordsInDay[dateKey].count) |
|
|
|
maxRecordCount = Math.max(maxRecordCount, recordIndex) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const startDayIndex = Math.max( |
|
|
|
const startDayIndex = Math.max( |
|
|
@ -724,6 +722,7 @@ const addRecord = (date: dayjs.Dayjs) => { |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</NcDropdown> |
|
|
|
</NcDropdown> |
|
|
|
<NcButton |
|
|
|
<NcButton |
|
|
|
|
|
|
|
v-else |
|
|
|
:class="{ |
|
|
|
:class="{ |
|
|
|
'!block': isDateSelected(day), |
|
|
|
'!block': isDateSelected(day), |
|
|
|
'!hidden': !isDateSelected(day), |
|
|
|
'!hidden': !isDateSelected(day), |
|
|
|