Browse Source

fix: refactor type and skelton computation

pull/6486/head
sreehari jayaraj 1 year ago
parent
commit
aa164360cc
  1. 2
      packages/nc-gui/components/smartsheet/expanded-form/index.vue
  2. 20
      packages/nc-gui/components/virtual-cell/components/ListChildItems.vue
  3. 2
      packages/nc-gui/utils/iconUtils.ts

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

@ -397,7 +397,7 @@ export default {
{{ displayValue }} {{ displayValue }}
</div> </div>
<div class="bg-gray-100 px-2 gap-1 flex my-1 items-center rounded-lg text-gray-800 font-medium"> <div class="bg-gray-100 px-2 gap-1 flex my-1 items-center rounded-lg text-gray-800 font-medium">
<component :is="iconMap.recordIcon" class="w-6 h-6 text-sm" /> <component :is="iconMap.record" class="w-6 h-6 text-sm" />
All {{ meta.title }} All {{ meta.title }}
</div> </div>
</div> </div>

20
packages/nc-gui/components/virtual-cell/components/ListChildItems.vue

@ -18,13 +18,13 @@ import {
useVModel, useVModel,
} from '#imports' } from '#imports'
interface Iprop { interface Prop {
modelValue?: boolean modelValue?: boolean
cellValue: any cellValue: any
column: any column: any
} }
const props = defineProps<Iprop>() const props = defineProps<Prop>()
const emit = defineEmits(['update:modelValue', 'attachRecord']) const emit = defineEmits(['update:modelValue', 'attachRecord'])
@ -130,22 +130,20 @@ onKeyStroke('Escape', () => {
vModel.value = false vModel.value = false
}) })
/* /*
to render same number of skelton as the number of cards to render same number of skelton as the number of cards
displayed displayed
*/ */
const skeltonCount = computed(() => { const skeltonCount = computed(() => {
if (childrenListCount.value < 10 && childrenListPagination.page === 1) { if (childrenListCount.value < 10 && childrenListPagination.page === 1) {
return childrenListCount.value === 0 ? 10 : childrenListCount.value return childrenListCount.value || 10
} }
const totlaRows = Math.ceil(childrenListCount.value / 10) const totalRows = Math.ceil(childrenListCount.value / 10)
if (totlaRows === childrenListPagination.page) { if (totalRows === childrenListPagination.page) {
return childrenListCount.value % 10 return childrenListCount.value % 10
} else {
return 10
} }
return 10
}) })
const isDataExist = computed<boolean>(() => { const isDataExist = computed<boolean>(() => {
@ -154,9 +152,7 @@ const isDataExist = computed<boolean>(() => {
const linkOrUnLink = (rowRef: Record<string, string>, id: string) => { const linkOrUnLink = (rowRef: Record<string, string>, id: string) => {
if (isPublic.value && !isForm.value) return if (isPublic.value && !isForm.value) return
if (isNew.value) { if (isNew.value || isChildrenListLinked.value[parseInt(id)]) {
unlinkRow(rowRef, parseInt(id))
} else if (isChildrenListLinked.value[parseInt(id)]) {
unlinkRow(rowRef, parseInt(id)) unlinkRow(rowRef, parseInt(id))
} else { } else {
linkRow(rowRef, parseInt(id)) linkRow(rowRef, parseInt(id))

2
packages/nc-gui/utils/iconUtils.ts

@ -238,7 +238,7 @@ import MaterialSymbolsBlock from '~icons/material-symbols/block'
} as const */ } as const */
export const iconMap = { export const iconMap = {
recordIcon: RecordIcon, record: RecordIcon,
workspaceDefault: MsGroup, workspaceDefault: MsGroup,
search: NcSearch, search: NcSearch,
error: h('span', { class: 'material-symbols' }, 'error'), error: h('span', { class: 'material-symbols' }, 'error'),

Loading…
Cancel
Save