Browse Source

fix: Expanded Record Fields (#8250)

* fix: expanded record display field is messed up

* fix: delete modal
pull/8255/head
Anbarasu 7 months ago committed by GitHub
parent
commit
c39b30d311
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      packages/nc-gui/components/smartsheet/PlainCell.vue
  2. 3
      packages/nc-gui/components/smartsheet/calendar/DayView/DateField.vue
  3. 3
      packages/nc-gui/components/smartsheet/calendar/DayView/DateTimeField.vue
  4. 3
      packages/nc-gui/components/smartsheet/calendar/MonthView.vue
  5. 2
      packages/nc-gui/components/smartsheet/calendar/SideMenu.vue
  6. 3
      packages/nc-gui/components/smartsheet/calendar/WeekView/DateField.vue
  7. 3
      packages/nc-gui/components/smartsheet/calendar/WeekView/DateTimeField.vue
  8. 14
      packages/nc-gui/components/smartsheet/expanded-form/index.vue

6
packages/nc-gui/components/smartsheet/calendar/Cell.vue → packages/nc-gui/components/smartsheet/PlainCell.vue

@ -356,20 +356,20 @@ const parseValue = (value: any, col: ColumnType): string => {
<template> <template>
<span <span
class="calendar-cell text-xs before:px-1" class="plain-cell before:px-1"
:class="{ :class="{
'font-bold': bold, 'font-bold': bold,
'italic': italic, 'italic': italic,
'underline': underline, 'underline': underline,
}" }"
data-testid="nc-calendar-cell" data-testid="nc-plain-cell"
> >
{{ parseValue(modelValue, column) }} {{ parseValue(modelValue, column) }}
</span> </span>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.calendar-cell { .plain-cell {
&::before { &::before {
content: '•'; content: '•';
padding: 0 4px; padding: 0 4px;

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

@ -221,9 +221,10 @@ const newRecord = () => {
@click="emit('expandRecord', record)" @click="emit('expandRecord', record)"
> >
<template v-for="(field, id) in fields" :key="id"> <template v-for="(field, id) in fields" :key="id">
<LazySmartsheetCalendarCell <LazySmartsheetPlainCell
v-if="!isRowEmpty(record, field!)" v-if="!isRowEmpty(record, field!)"
v-model="record.row[field!.title!]" v-model="record.row[field!.title!]"
class="text-xs"
:bold="getFieldStyle(field).bold" :bold="getFieldStyle(field).bold"
:column="field" :column="field"
:italic="getFieldStyle(field).italic" :italic="getFieldStyle(field).italic"

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

@ -941,9 +941,10 @@ watch(
@resize-start="onResizeStart" @resize-start="onResizeStart"
> >
<template v-for="(field, id) in fields" :key="id"> <template v-for="(field, id) in fields" :key="id">
<LazySmartsheetCalendarCell <LazySmartsheetPlainCell
v-if="!isRowEmpty(record, field!)" v-if="!isRowEmpty(record, field!)"
v-model="record.row[field!.title!]" v-model="record.row[field!.title!]"
class="text-xs"
:bold="getFieldStyle(field).bold" :bold="getFieldStyle(field).bold"
:column="field" :column="field"
:italic="getFieldStyle(field).italic" :italic="getFieldStyle(field).italic"

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

@ -796,9 +796,10 @@ const addRecord = (date: dayjs.Dayjs) => {
@dblclick.stop="emit('expandRecord', record)" @dblclick.stop="emit('expandRecord', record)"
> >
<template v-for="(field, id) in fields" :key="id"> <template v-for="(field, id) in fields" :key="id">
<LazySmartsheetCalendarCell <LazySmartsheetPlainCell
v-if="!isRowEmpty(record, field!)" v-if="!isRowEmpty(record, field!)"
v-model="record.row[field!.title!]" v-model="record.row[field!.title!]"
class="text-xs"
:bold="getFieldStyle(field).bold" :bold="getFieldStyle(field).bold"
:column="field" :column="field"
:italic="getFieldStyle(field).italic" :italic="getFieldStyle(field).italic"

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

@ -433,7 +433,7 @@ onUnmounted(() => {
@dragover.prevent @dragover.prevent
> >
<template v-if="!isRowEmpty(record, displayField)"> <template v-if="!isRowEmpty(record, displayField)">
<LazySmartsheetCalendarCell v-model="record.row[displayField!.title!]" :column="displayField" /> <LazySmartsheetPlainCell v-model="record.row[displayField!.title!]" :column="displayField" />
</template> </template>
</LazySmartsheetCalendarSideRecordCard> </LazySmartsheetCalendarSideRecordCard>
</LazySmartsheetRow> </LazySmartsheetRow>

3
packages/nc-gui/components/smartsheet/calendar/WeekView/DateField.vue

@ -588,9 +588,10 @@ const addRecord = (date: dayjs.Dayjs) => {
@resize-start="onResizeStart" @resize-start="onResizeStart"
> >
<template v-for="(field, index) in fields" :key="index"> <template v-for="(field, index) in fields" :key="index">
<LazySmartsheetCalendarCell <LazySmartsheetPlainCell
v-if="!isRowEmpty(record, field!)" v-if="!isRowEmpty(record, field!)"
v-model="record.row[field!.title!]" v-model="record.row[field!.title!]"
class="text-xs"
:bold="getFieldStyle(field).bold" :bold="getFieldStyle(field).bold"
:column="field" :column="field"
:italic="getFieldStyle(field).italic" :italic="getFieldStyle(field).italic"

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

@ -822,9 +822,10 @@ watch(
@resize-start="onResizeStart" @resize-start="onResizeStart"
> >
<template v-for="(field, id) in fields" :key="id"> <template v-for="(field, id) in fields" :key="id">
<LazySmartsheetCalendarCell <LazySmartsheetPlainCell
v-if="!isRowEmpty(record, field!)" v-if="!isRowEmpty(record, field!)"
v-model="record.row[field!.title!]" v-model="record.row[field!.title!]"
class="text-xs"
:bold="getFieldStyle(field).bold" :bold="getFieldStyle(field).bold"
:column="field" :column="field"
:italic="getFieldStyle(field).italic" :italic="getFieldStyle(field).italic"

14
packages/nc-gui/components/smartsheet/expanded-form/index.vue

@ -19,6 +19,7 @@ import {
IsPublicInj, IsPublicInj,
MetaInj, MetaInj,
ReloadRowDataHookInj, ReloadRowDataHookInj,
computed,
computedInject, computedInject,
createEventHook, createEventHook,
iconMap, iconMap,
@ -117,6 +118,8 @@ const fields = computedInject(FieldsInj, (_fields) => {
return _fields?.value ?? [] return _fields?.value ?? []
}) })
const displayField = computed(() => meta.value?.columns?.find((c) => c.pv && fields.value.includes(c)) ?? null)
const hiddenFields = computed(() => { const hiddenFields = computed(() => {
// todo: figure out when meta.value is undefined // todo: figure out when meta.value is undefined
return (meta.value?.columns ?? []).filter((col) => !fields.value?.includes(col)).filter((col) => !isSystemColumn(col)) return (meta.value?.columns ?? []).filter((col) => !fields.value?.includes(col)).filter((col) => !isSystemColumn(col))
@ -493,8 +496,7 @@ watch([expandedFormScrollWrapper, isLoading], () => {
const expandedFormScrollWrapperEl = expandedFormScrollWrapper.value const expandedFormScrollWrapperEl = expandedFormScrollWrapper.value
if (expandedFormScrollWrapperEl && !isLoading.value) { if (expandedFormScrollWrapperEl && !isLoading.value) {
const height = expandedFormScrollWrapperEl.scrollHeight expandedFormScrollWrapperEl.scrollTop = expandedFormScrollWrapperEl.scrollHeight
expandedFormScrollWrapperEl.scrollTop = height
setTimeout(() => { setTimeout(() => {
expandedFormScrollWrapperEl.scrollTop = 0 expandedFormScrollWrapperEl.scrollTop = 0
@ -555,8 +557,8 @@ export default {
{{ props.newRecordHeader ?? $t('activity.newRecord') }} {{ props.newRecordHeader ?? $t('activity.newRecord') }}
</div> </div>
<div v-else-if="displayValue && !row.rowMeta?.new" class="flex items-center font-bold text-gray-800 text-xl w-64"> <div v-else-if="displayValue && !row.rowMeta?.new" class="flex items-center font-bold text-gray-800 text-xl w-64">
<span class="truncate"> <span class="truncate !text-xl">
{{ displayValue }} <LazySmartsheetPlainCell v-model="displayValue" :column="displayField" />
</span> </span>
</div> </div>
</div> </div>
@ -891,8 +893,8 @@ export default {
<template #entity-preview> <template #entity-preview>
<span> <span>
<div class="flex flex-row items-center py-2.25 px-2.5 bg-gray-50 rounded-lg text-gray-700 mb-4"> <div class="flex flex-row items-center py-2.25 px-2.5 bg-gray-50 rounded-lg text-gray-700 mb-4">
<div class="capitalize text-ellipsis overflow-hidden select-none w-full pl-1.75 break-keep whitespace-nowrap"> <div class="text-ellipsis overflow-hidden select-none w-full pl-1.75 break-keep whitespace-nowrap">
{{ displayValue }} <LazySmartsheetPlainCell v-model="displayValue" :column="displayField" />
</div> </div>
</div> </div>
</span> </span>

Loading…
Cancel
Save