Browse Source

Merge pull request #7838 from nocodb/nc/cal-opt

fix: missing calendar optmzin on oss
pull/6831/head
Raju Udava 9 months ago committed by GitHub
parent
commit
21e50b7074
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 91
      packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue
  2. 93
      packages/nc-gui/components/smartsheet/calendar/MonthView.vue
  3. 91
      packages/nc-gui/components/smartsheet/calendar/WeekView/DateTimeField.vue

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

@ -969,51 +969,52 @@ const newRecord = (hour: dayjs.Dayjs) => {
</div> </div>
<div class="absolute inset-0 pointer-events-none"> <div class="absolute inset-0 pointer-events-none">
<div class="relative !ml-[60px]" data-testid="nc-calendar-day-record-container"> <div class="relative !ml-[60px]" data-testid="nc-calendar-day-record-container">
<div <template v-for="(record, rowIndex) in recordsAcrossAllRange.record" :key="rowIndex">
v-for="(record, rowIndex) in recordsAcrossAllRange.record" <div
:key="rowIndex" v-if="record.rowMeta.style?.display !== 'none'"
:data-testid="`nc-calendar-day-record-${record.row[displayField!.title!]}`" :data-testid="`nc-calendar-day-record-${record.row[displayField!.title!]}`"
:data-unique-id="record.rowMeta.id" :data-unique-id="record.rowMeta.id"
:style="record.rowMeta.style" :style="record.rowMeta.style"
class="absolute draggable-record group cursor-pointer pointer-events-auto" class="absolute draggable-record group cursor-pointer pointer-events-auto"
@mousedown="dragStart($event, record)" @mousedown="dragStart($event, record)"
@mouseleave="hoverRecord = null" @mouseleave="hoverRecord = null"
@mouseover="hoverRecord = record.rowMeta.id as string" @mouseover="hoverRecord = record.rowMeta.id as string"
@dragover.prevent @dragover.prevent
> >
<LazySmartsheetRow :row="record"> <LazySmartsheetRow :row="record">
<LazySmartsheetCalendarVRecordCard <LazySmartsheetCalendarVRecordCard
:hover="hoverRecord === record.rowMeta.id || record.rowMeta.id === dragRecord?.rowMeta?.id" :hover="hoverRecord === record.rowMeta.id || record.rowMeta.id === dragRecord?.rowMeta?.id"
:selected="record.rowMeta.id === dragRecord?.rowMeta?.id" :selected="record.rowMeta.id === dragRecord?.rowMeta?.id"
:position="record.rowMeta!.position" :position="record.rowMeta!.position"
:record="record" :record="record"
:resize="!!record.rowMeta.range?.fk_to_col && isUIAllowed('dataEdit')" :resize="!!record.rowMeta.range?.fk_to_col && isUIAllowed('dataEdit')"
color="blue" color="blue"
@resize-start="onResizeStart" @resize-start="onResizeStart"
> >
<template v-if="!isRowEmpty(record, displayField)"> <template v-if="!isRowEmpty(record, displayField)">
<LazySmartsheetCalendarCell <LazySmartsheetCalendarCell
v-if="!isRowEmpty(record, displayField!)" v-if="!isRowEmpty(record, displayField!)"
v-model="record.row[displayField!.title!]" v-model="record.row[displayField!.title!]"
:bold="getFieldStyle(displayField!).bold" :bold="getFieldStyle(displayField!).bold"
:column="displayField!" :column="displayField!"
:italic="getFieldStyle(displayField!).italic" :italic="getFieldStyle(displayField!).italic"
:underline="getFieldStyle(displayField!).underline" :underline="getFieldStyle(displayField!).underline"
/> />
</template> </template>
<template v-for="(field, id) in fieldsWithoutDisplay" :key="id"> <template v-for="(field, id) in fieldsWithoutDisplay" :key="id">
<LazySmartsheetCalendarCell <LazySmartsheetCalendarCell
v-if="!isRowEmpty(record, field!)" v-if="!isRowEmpty(record, field!)"
v-model="record.row[field!.title!]" v-model="record.row[field!.title!]"
:bold="getFieldStyle(field).bold" :bold="getFieldStyle(field).bold"
:column="field" :column="field"
:italic="getFieldStyle(field).italic" :italic="getFieldStyle(field).italic"
:underline="getFieldStyle(field).underline" :underline="getFieldStyle(field).underline"
/> />
</template> </template>
</LazySmartsheetCalendarVRecordCard> </LazySmartsheetCalendarVRecordCard>
</LazySmartsheetRow> </LazySmartsheetRow>
</div> </div>
</template>
</div> </div>
</div> </div>
</div> </div>

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

@ -772,52 +772,53 @@ const addRecord = (date: dayjs.Dayjs) => {
</div> </div>
</div> </div>
<div class="absolute inset-0 pointer-events-none mt-8 pb-7.5" data-testid="nc-calendar-month-record-container"> <div class="absolute inset-0 pointer-events-none mt-8 pb-7.5" data-testid="nc-calendar-month-record-container">
<div <template v-for="(record, recordIndex) in recordsToDisplay.records" :key="recordIndex">
v-for="(record, recordIndex) in recordsToDisplay.records" <div
:key="recordIndex" v-if="record.rowMeta.style?.display !== 'none'"
:data-testid="`nc-calendar-month-record-${record.row[displayField!.title!]}`" :data-testid="`nc-calendar-month-record-${record.row[displayField!.title!]}`"
:data-unique-id="record.rowMeta.id" :data-unique-id="record.rowMeta.id"
:style="{ :style="{
...record.rowMeta.style, ...record.rowMeta.style,
zIndex: record.rowMeta.id === draggingId ? 100 : 0, zIndex: record.rowMeta.id === draggingId ? 100 : 0,
}" }"
class="absolute group draggable-record cursor-pointer pointer-events-auto" class="absolute group draggable-record cursor-pointer pointer-events-auto"
@mouseleave="hoverRecord = null" @mouseleave="hoverRecord = null"
@mouseover="hoverRecord = record.rowMeta.id" @mouseover="hoverRecord = record.rowMeta.id"
@mousedown.stop="dragStart($event, record)" @mousedown.stop="dragStart($event, record)"
> >
<LazySmartsheetRow :row="record"> <LazySmartsheetRow :row="record">
<LazySmartsheetCalendarRecordCard <LazySmartsheetCalendarRecordCard
:hover="hoverRecord === record.rowMeta.id || record.rowMeta.id === draggingId" :hover="hoverRecord === record.rowMeta.id || record.rowMeta.id === draggingId"
:position="record.rowMeta.position" :position="record.rowMeta.position"
:record="record" :record="record"
:resize="!!record.rowMeta.range?.fk_to_col && isUIAllowed('dataEdit')" :resize="!!record.rowMeta.range?.fk_to_col && isUIAllowed('dataEdit')"
:selected="dragRecord?.rowMeta?.id === record.rowMeta.id || resizeRecord?.rowMeta?.id === record.rowMeta.id" :selected="dragRecord?.rowMeta?.id === record.rowMeta.id || resizeRecord?.rowMeta?.id === record.rowMeta.id"
@resize-start="onResizeStart" @resize-start="onResizeStart"
@dblclick.stop="emit('expandRecord', record)" @dblclick.stop="emit('expandRecord', record)"
> >
<template v-if="!isRowEmpty(record, displayField)"> <template v-if="!isRowEmpty(record, displayField)">
<LazySmartsheetCalendarCell <LazySmartsheetCalendarCell
v-model="record.row[displayField!.title!]" v-model="record.row[displayField!.title!]"
:bold="getFieldStyle(displayField).bold" :bold="getFieldStyle(displayField).bold"
:column="displayField" :column="displayField"
:italic="getFieldStyle(displayField).italic" :italic="getFieldStyle(displayField).italic"
:underline="getFieldStyle(displayField).underline" :underline="getFieldStyle(displayField).underline"
/> />
</template> </template>
<template v-for="(field, id) in fieldsWithoutDisplay" :key="id"> <template v-for="(field, id) in fieldsWithoutDisplay" :key="id">
<LazySmartsheetCalendarCell <LazySmartsheetCalendarCell
v-if="!isRowEmpty(record, field!)" v-if="!isRowEmpty(record, field!)"
v-model="record.row[field!.title!]" v-model="record.row[field!.title!]"
:bold="getFieldStyle(field).bold" :bold="getFieldStyle(field).bold"
:column="field" :column="field"
:italic="getFieldStyle(field).italic" :italic="getFieldStyle(field).italic"
:underline="getFieldStyle(field).underline" :underline="getFieldStyle(field).underline"
/> />
</template> </template>
</LazySmartsheetCalendarRecordCard> </LazySmartsheetCalendarRecordCard>
</LazySmartsheetRow> </LazySmartsheetRow>
</div> </div>
</template>
</div> </div>
</div> </div>
</template> </template>

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

@ -805,51 +805,52 @@ const addRecord = (date: dayjs.Dayjs) => {
class="absolute pointer-events-none inset-0 overflow-hidden !mt-[29px]" class="absolute pointer-events-none inset-0 overflow-hidden !mt-[29px]"
data-testid="nc-calendar-week-record-container" data-testid="nc-calendar-week-record-container"
> >
<div <template v-for="(record, rowIndex) in recordsAcrossAllRange.records" :key="rowIndex">
v-for="(record, rowIndex) in recordsAcrossAllRange.records" <div
:key="rowIndex" v-if="record.rowMeta.style?.display !== 'none'"
:data-testid="`nc-calendar-week-record-${record.row[displayField!.title!]}`" :data-testid="`nc-calendar-week-record-${record.row[displayField!.title!]}`"
:data-unique-id="record.rowMeta!.id" :data-unique-id="record.rowMeta!.id"
:style="record.rowMeta!.style " :style="record.rowMeta!.style "
class="absolute draggable-record w-1/7 group cursor-pointer pointer-events-auto" class="absolute draggable-record w-1/7 group cursor-pointer pointer-events-auto"
@mousedown.stop="dragStart($event, record)" @mousedown.stop="dragStart($event, record)"
@mouseleave="hoverRecord = null" @mouseleave="hoverRecord = null"
@mouseover="hoverRecord = record.rowMeta.id" @mouseover="hoverRecord = record.rowMeta.id"
@dragover.prevent @dragover.prevent
> >
<LazySmartsheetRow :row="record"> <LazySmartsheetRow :row="record">
<LazySmartsheetCalendarVRecordCard <LazySmartsheetCalendarVRecordCard
:hover="hoverRecord === record.rowMeta.id || record.rowMeta.id === dragRecord?.rowMeta?.id" :hover="hoverRecord === record.rowMeta.id || record.rowMeta.id === dragRecord?.rowMeta?.id"
:position="record.rowMeta!.position" :position="record.rowMeta!.position"
:resize="!!record.rowMeta.range?.fk_to_col && isUIAllowed('dataEdit')" :resize="!!record.rowMeta.range?.fk_to_col && isUIAllowed('dataEdit')"
:record="record" :record="record"
color="blue" color="blue"
:selected="record.rowMeta!.id === dragRecord?.rowMeta?.id" :selected="record.rowMeta!.id === dragRecord?.rowMeta?.id"
@resize-start="onResizeStart" @resize-start="onResizeStart"
> >
<template v-if="!isRowEmpty(record, displayField)"> <template v-if="!isRowEmpty(record, displayField)">
<LazySmartsheetCalendarCell <LazySmartsheetCalendarCell
v-if="!isRowEmpty(record, displayField!)" v-if="!isRowEmpty(record, displayField!)"
v-model="record.row[displayField!.title!]" v-model="record.row[displayField!.title!]"
:bold="getFieldStyle(displayField).bold" :bold="getFieldStyle(displayField).bold"
:column="displayField" :column="displayField"
:italic="getFieldStyle(displayField).italic" :italic="getFieldStyle(displayField).italic"
:underline="getFieldStyle(displayField).underline" :underline="getFieldStyle(displayField).underline"
/> />
</template> </template>
<template v-for="(field, id) in fieldsWithoutDisplay" :key="id"> <template v-for="(field, id) in fieldsWithoutDisplay" :key="id">
<LazySmartsheetCalendarCell <LazySmartsheetCalendarCell
v-if="!isRowEmpty(record, field!)" v-if="!isRowEmpty(record, field!)"
v-model="record.row[field!.title!]" v-model="record.row[field!.title!]"
:bold="getFieldStyle(field).bold" :bold="getFieldStyle(field).bold"
:column="field" :column="field"
:italic="getFieldStyle(field).italic" :italic="getFieldStyle(field).italic"
:underline="getFieldStyle(field).underline" :underline="getFieldStyle(field).underline"
/> />
</template> </template>
</LazySmartsheetCalendarVRecordCard> </LazySmartsheetCalendarVRecordCard>
</LazySmartsheetRow> </LazySmartsheetRow>
</div> </div>
</template>
</div> </div>
</div> </div>
</div> </div>

Loading…
Cancel
Save