Browse Source

fix(nc-gui): field customizations

pull/7673/head
DarkPhoenix2704 10 months ago
parent
commit
670b30f2b7
  1. 7
      packages/nc-gui/components/smartsheet/calendar/Cell.vue
  2. 8
      packages/nc-gui/components/smartsheet/calendar/DayView/DateField.vue
  3. 17
      packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue
  4. 16
      packages/nc-gui/components/smartsheet/calendar/VRecordCard.vue
  5. 2
      packages/nc-gui/components/smartsheet/calendar/index.vue

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

@ -1,5 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import { import {
type BoolType,
type ColumnType, type ColumnType,
type LookupType, type LookupType,
type RollupType, type RollupType,
@ -26,9 +27,9 @@ import {
interface Props { interface Props {
column: ColumnType column: ColumnType
modelValue: any modelValue: any
bold?: boolean bold?: BoolType
italic?: boolean italic?: BoolType
underline?: boolean underline?: BoolType
} }
const props = defineProps<Props>() const props = defineProps<Props>()

8
packages/nc-gui/components/smartsheet/calendar/DayView/DateField.vue

@ -215,10 +215,10 @@ const dropEvent = (event: DragEvent) => {
<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"> <template v-for="(field, id) in fieldsWithoutDisplay">

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

@ -7,6 +7,7 @@ import { generateRandomNumber, isRowEmpty } from '~/utils'
const emit = defineEmits(['expandRecord', 'new-record']) const emit = defineEmits(['expandRecord', 'new-record'])
const { const {
activeCalendarView,
selectedDate, selectedDate,
selectedTime, selectedTime,
formattedData, formattedData,
@ -29,16 +30,17 @@ const fields = inject(FieldsInj, ref())
const { fields: _fields } = useViewColumnsOrThrow() const { fields: _fields } = useViewColumnsOrThrow()
const getFieldStyle = (field: ColumnType) => { const getFieldStyle = (field: ColumnType) => {
if (!_fields.value) return { underline: false, bold: false, italic: false }
const fi = _fields.value.find((f) => f.title === field.title) const fi = _fields.value.find((f) => f.title === field.title)
return { return {
underline: fi.underline, underline: fi?.underline,
bold: fi.bold, bold: fi?.bold,
italic: fi.italic, italic: fi?.italic,
} }
} }
const fieldsWithoutDisplay = computed(() => fields.value.filter((f) => !isPrimary(f))) const fieldsWithoutDisplay = computed(() => fields.value?.filter((f) => !isPrimary(f)))
const hours = computed(() => { const hours = computed(() => {
const hours: Array<dayjs.Dayjs> = [] const hours: Array<dayjs.Dayjs> = []
@ -707,6 +709,7 @@ const viewMore = (hour: dayjs.Dayjs) => {
> >
<LazySmartsheetRow :row="record"> <LazySmartsheetRow :row="record">
<LazySmartsheetCalendarVRecordCard <LazySmartsheetCalendarVRecordCard
:view="activeCalendarView"
:hover="hoverRecord === record.rowMeta.id" :hover="hoverRecord === record.rowMeta.id"
:position="record.rowMeta!.position" :position="record.rowMeta!.position"
:record="record" :record="record"
@ -718,10 +721,10 @@ const viewMore = (hour: dayjs.Dayjs) => {
<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"> <template v-for="(field, id) in fieldsWithoutDisplay">

16
packages/nc-gui/components/smartsheet/calendar/VRecordCard.vue

@ -1,6 +1,7 @@
<script lang="ts" setup> <script lang="ts" setup>
interface Props { interface Props {
record: Record<string, string> record: Record<string, string>
color?: string color?: string
resize?: boolean resize?: boolean
selected?: boolean selected?: boolean
@ -26,14 +27,14 @@ const emit = defineEmits(['resize-start'])
> >
<NcButton <NcButton
:class="{ :class="{
'!flex border-1 rounded-lg border-brand-500': selected || hover, '!flex rounded-lg border-brand-500': selected || hover,
}" }"
class="!group-hover:(border-brand-500) !border-1 cursor-ns-resize" class="!group-hover:(border-brand-500) !border-1 text-gray-400 cursor-ns-resize"
size="xsmall" size="xsmall"
type="secondary" type="secondary"
@mousedown.stop="emit('resize-start', 'left', $event, record)" @mousedown.stop="emit('resize-start', 'left', $event, record)"
> >
<component :is="iconMap.drag" class="text-gray-400"></component> <component :is="iconMap.drag" class="mt-0.5" />
</NcButton> </NcButton>
</div> </div>
<div <div
@ -70,10 +71,7 @@ const emit = defineEmits(['resize-start'])
<div v-if="position === 'bottomRounded' || position === 'none'" class="ml-3">....</div> <div v-if="position === 'bottomRounded' || position === 'none'" class="ml-3">....</div>
<span <span
:class="{ class="mt-1.5 pl-4 pr-1 text-sm h-[100%] text-gray-800 leading-7 space-x-2 break-all whitespace-normal truncate w-full overflow-y-hidden absolute"
'!h-[40%]': position === 'none',
}"
class="mt-1.5 pl-4 pr-1 text-sm h-[70%] text-gray-800 leading-7 space-x-2 break-all whitespace-normal truncate w-full overflow-y-hidden absolute"
> >
<slot /> <slot />
</span> </span>
@ -87,12 +85,12 @@ const emit = defineEmits(['resize-start'])
:class="{ :class="{
'!flex border-1 rounded-lg z-1 cursor-ns-resize border-brand-500': selected || hover, '!flex border-1 rounded-lg z-1 cursor-ns-resize border-brand-500': selected || hover,
}" }"
class="!group-hover:(border-brand-500) !border-1" class="!group-hover:(border-brand-500) text-gray-400 !border-1"
size="xsmall" size="xsmall"
type="secondary" type="secondary"
@mousedown.stop="emit('resize-start', 'right', $event, record)" @mousedown.stop="emit('resize-start', 'right', $event, record)"
> >
<component :is="iconMap.drag" class="text-gray-400"></component> <component :is="iconMap.drag" class="mt-0.5" />
</NcButton> </NcButton>
</div> </div>
</template> </template>

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

@ -41,6 +41,7 @@ provide(IsKanbanInj, ref(false))
provide(IsCalendarInj, ref(true)) provide(IsCalendarInj, ref(true))
const { const {
activeCalendarView,
calendarRange, calendarRange,
calDataType, calDataType,
loadCalendarMeta, loadCalendarMeta,
@ -53,7 +54,6 @@ const {
pageDate, pageDate,
showSideMenu, showSideMenu,
selectedDateRange, selectedDateRange,
activeCalendarView,
paginateCalendarView, paginateCalendarView,
} = useCalendarViewStoreOrThrow() } = useCalendarViewStoreOrThrow()

Loading…
Cancel
Save