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 }}
</div>
<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 }}
</div>
</div>

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

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

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

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

Loading…
Cancel
Save