|
|
@ -1,8 +1,7 @@ |
|
|
|
<script lang="ts" setup> |
|
|
|
<script lang="ts" setup> |
|
|
|
import dayjs from 'dayjs' |
|
|
|
import dayjs from 'dayjs' |
|
|
|
|
|
|
|
import type { ColumnType } from 'nocodb-sdk' |
|
|
|
import { UITypes, isVirtualCol } from 'nocodb-sdk' |
|
|
|
import { type Row, computed, isPrimary, ref, useViewColumnsOrThrow } from '#imports' |
|
|
|
import type { Row } from '#imports' |
|
|
|
|
|
|
|
import { generateRandomNumber, isRowEmpty } from '~/utils' |
|
|
|
import { generateRandomNumber, isRowEmpty } from '~/utils' |
|
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits(['new-record', 'expandRecord']) |
|
|
|
const emit = defineEmits(['new-record', 'expandRecord']) |
|
|
@ -61,6 +60,22 @@ const resizeDirection = ref<'right' | 'left'>() |
|
|
|
|
|
|
|
|
|
|
|
const resizeRecord = ref<Row>() |
|
|
|
const resizeRecord = ref<Row>() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const fields = inject(FieldsInj, ref()) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { fields: _fields } = useViewColumnsOrThrow() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const getFieldStyle = (field: ColumnType) => { |
|
|
|
|
|
|
|
const fi = _fields.value.find((f) => f.title === field.title) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
underline: fi.underline, |
|
|
|
|
|
|
|
bold: fi.bold, |
|
|
|
|
|
|
|
italic: fi.italic, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const fieldsWithoutDisplay = computed(() => fields.value.filter((f) => !isPrimary(f))) |
|
|
|
|
|
|
|
|
|
|
|
const dates = computed(() => { |
|
|
|
const dates = computed(() => { |
|
|
|
const startOfMonth = selectedMonth.value.startOf('month') |
|
|
|
const startOfMonth = selectedMonth.value.startOf('month') |
|
|
|
const endOfMonth = selectedMonth.value.endOf('month') |
|
|
|
const endOfMonth = selectedMonth.value.endOf('month') |
|
|
@ -366,7 +381,6 @@ const calculateNewRow = (event: MouseEvent, updateSideBar?: boolean) => { |
|
|
|
endDate = newStartDate.clone() |
|
|
|
endDate = newStartDate.clone() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
dragRecord.value = undefined |
|
|
|
|
|
|
|
newRow.row[toCol!.title!] = dayjs(endDate).format('YYYY-MM-DD HH:mm:ssZ') |
|
|
|
newRow.row[toCol!.title!] = dayjs(endDate).format('YYYY-MM-DD HH:mm:ssZ') |
|
|
|
updateProperty.push(toCol!.title!) |
|
|
|
updateProperty.push(toCol!.title!) |
|
|
|
} |
|
|
|
} |
|
|
@ -490,11 +504,14 @@ const onResizeStart = (direction: 'right' | 'left', event: MouseEvent, record: R |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const stopDrag = (event: MouseEvent) => { |
|
|
|
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 |
|
|
|
if (!isUIAllowed('dataEdit') || !dragRecord.value || !isDragging.value) return |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log('stopDrag') |
|
|
|
event.preventDefault() |
|
|
|
event.preventDefault() |
|
|
|
clearTimeout(dragTimeout.value) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dragElement.value!.style.boxShadow = 'none' |
|
|
|
dragElement.value!.style.boxShadow = 'none' |
|
|
|
|
|
|
|
|
|
|
|
const { newRow, updateProperty } = calculateNewRow(event, false) |
|
|
|
const { newRow, updateProperty } = calculateNewRow(event, false) |
|
|
@ -772,27 +789,25 @@ const isDateSelected = (date: dayjs.Dayjs) => { |
|
|
|
@dblclick.stop="emit('expand-record', record)" |
|
|
|
@dblclick.stop="emit('expand-record', record)" |
|
|
|
> |
|
|
|
> |
|
|
|
<template v-if="!isRowEmpty(record, displayField)"> |
|
|
|
<template v-if="!isRowEmpty(record, displayField)"> |
|
|
|
<div |
|
|
|
<LazySmartsheetCalendarCell |
|
|
|
:class="{ |
|
|
|
v-if="!isRowEmpty(record, displayField!)" |
|
|
|
'mt-1.4': displayField!.uidt === UITypes.SingleLineText, |
|
|
|
|
|
|
|
'mt-1': displayField!.uidt === UITypes.MultiSelect || displayField!.uidt === UITypes.SingleSelect, |
|
|
|
|
|
|
|
}" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<LazySmartsheetVirtualCell |
|
|
|
|
|
|
|
v-if="isVirtualCol(displayField!)" |
|
|
|
|
|
|
|
v-model="record.row[displayField!.title!]" |
|
|
|
v-model="record.row[displayField!.title!]" |
|
|
|
|
|
|
|
:bold="getFieldStyle(displayField).bold" |
|
|
|
:column="displayField" |
|
|
|
:column="displayField" |
|
|
|
:row="record" |
|
|
|
:italic="getFieldStyle(displayField).italic" |
|
|
|
|
|
|
|
:underline="getFieldStyle(displayField).underline" |
|
|
|
/> |
|
|
|
/> |
|
|
|
|
|
|
|
</template> |
|
|
|
<LazySmartsheetCell |
|
|
|
<template v-for="(field, id) in fieldsWithoutDisplay"> |
|
|
|
v-else |
|
|
|
<LazySmartsheetCalendarCell |
|
|
|
v-model="record.row[displayField!.title!]" |
|
|
|
v-if="!isRowEmpty(record, field)" |
|
|
|
:column="displayField" |
|
|
|
:key="id" |
|
|
|
:edit-enabled="false" |
|
|
|
v-model="record.row[field!.title!]" |
|
|
|
:read-only="true" |
|
|
|
:bold="getFieldStyle(field).bold" |
|
|
|
|
|
|
|
:column="field" |
|
|
|
|
|
|
|
:italic="getFieldStyle(field).italic" |
|
|
|
|
|
|
|
:underline="getFieldStyle(field).underline" |
|
|
|
/> |
|
|
|
/> |
|
|
|
</div> |
|
|
|
|
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</LazySmartsheetCalendarRecordCard> |
|
|
|
</LazySmartsheetCalendarRecordCard> |
|
|
|
</LazySmartsheetRow> |
|
|
|
</LazySmartsheetRow> |
|
|
@ -802,11 +817,6 @@ const isDateSelected = (date: dayjs.Dayjs) => { |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
|
<style lang="scss" scoped> |
|
|
|
.hide { |
|
|
|
|
|
|
|
transition: 0.01s; |
|
|
|
|
|
|
|
transform: translateX(-9999px); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.prevent-select { |
|
|
|
.prevent-select { |
|
|
|
-webkit-user-select: none; /* Safari */ |
|
|
|
-webkit-user-select: none; /* Safari */ |
|
|
|
-ms-user-select: none; /* IE 10 and IE 11 */ |
|
|
|
-ms-user-select: none; /* IE 10 and IE 11 */ |
|
|
|