Browse Source

fix: refactor links modal

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

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

@ -3,7 +3,6 @@ import type { TableType, ViewType } from 'nocodb-sdk'
import { isLinksOrLTAR, isSystemColumn, isVirtualCol } from 'nocodb-sdk' import { isLinksOrLTAR, isSystemColumn, isVirtualCol } from 'nocodb-sdk'
import type { Ref } from 'vue' import type { Ref } from 'vue'
import MdiChevronDown from '~icons/mdi/chevron-down' import MdiChevronDown from '~icons/mdi/chevron-down'
import RecordIcon from '~icons/nc-icons/record'
import { import {
CellClickHookInj, CellClickHookInj,
@ -398,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">
<RecordIcon class="w-6 h-6 text-sm" /> <component :is="iconMap.recordIcon" class="w-6 h-6 text-sm" />
All {{ meta.title }} All {{ meta.title }}
</div> </div>
</div> </div>

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

@ -18,7 +18,13 @@ import {
useVModel, useVModel,
} from '#imports' } from '#imports'
const props = defineProps<{ modelValue?: boolean; cellValue: any; column: any }>() interface Iprop {
modelValue?: boolean
cellValue: any
column: any
}
const props = defineProps<Iprop>()
const emit = defineEmits(['update:modelValue', 'attachRecord']) const emit = defineEmits(['update:modelValue', 'attachRecord'])
@ -124,23 +130,21 @@ onKeyStroke('Escape', () => {
vModel.value = false vModel.value = false
}) })
const skeltonAmountToShow = ref(childrenListCount.value === 0 ? 10 : childrenListCount.value)
/* /*
to render same number of skelton as the number of cards to render same number of skelton as the number of cards
displayed displayed
*/ */
watch(childrenListPagination, () => {
const skeltonCount = computed(() => {
if (childrenListCount.value < 10 && childrenListPagination.page === 1) { if (childrenListCount.value < 10 && childrenListPagination.page === 1) {
skeltonAmountToShow.value = childrenListCount.value === 0 ? 10 : childrenListCount.value return childrenListCount.value === 0 ? 10 : childrenListCount.value
} }
const totlaRows = Math.ceil(childrenListCount.value / 10) const totlaRows = Math.ceil(childrenListCount.value / 10)
if (totlaRows === childrenListPagination.page) { if (totlaRows === childrenListPagination.page) {
skeltonAmountToShow.value = childrenListCount.value % 10 return childrenListCount.value % 10
} else { } else {
skeltonAmountToShow.value = 10 return 10
} }
}) })
@ -150,11 +154,13 @@ 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
isNew.value if (isNew.value) {
? unlinkRow(rowRef, parseInt(id)) unlinkRow(rowRef, parseInt(id))
: isChildrenListLinked.value[parseInt(id)] } else if (isChildrenListLinked.value[parseInt(id)]) {
? unlinkRow(rowRef, parseInt(id)) unlinkRow(rowRef, parseInt(id))
: linkRow(rowRef, parseInt(id)) } else {
linkRow(rowRef, parseInt(id))
}
} }
</script> </script>
@ -202,19 +208,19 @@ const linkOrUnLink = (rowRef: Record<string, string>, id: string) => {
<div v-if="isDataExist || isChildrenLoading" class="mt-2 mb-2"> <div v-if="isDataExist || isChildrenLoading" class="mt-2 mb-2">
<div <div
:class="{ :class="{
'h-[420px]': !isForm, 'h-105': !isForm,
'h-[250px]': isForm, 'h-62.5': isForm,
}" }"
class="overflow-scroll nc-scrollbar-md cursor-pointer pr-1" class="overflow-scroll nc-scrollbar-md cursor-pointer pr-1"
> >
<template v-if="isChildrenLoading"> <template v-if="isChildrenLoading">
<div <div
v-for="(x, i) in Array.from({ length: skeltonAmountToShow })" v-for="(_, i) in Array.from({ length: skeltonCount })"
:key="i" :key="i"
class="border-2 flex flex-row gap-2 mb-2 transition-all rounded-xl relative border-gray-200 hover:bg-gray-50" class="border-2 flex flex-row gap-2 mb-2 transition-all rounded-xl relative border-gray-200 hover:bg-gray-50"
> >
<a-skeleton-image class="h-24 w-24 !rounded-xl" /> <a-skeleton-image class="h-24 w-24 !rounded-xl" />
<div class="flex flex-col m-[.5rem] gap-2 flex-grow justify-center"> <div class="flex flex-col m-2 gap-2 flex-grow justify-center">
<a-skeleton-input class="!w-48 !rounded-xl" active size="small" /> <a-skeleton-input class="!w-48 !rounded-xl" active size="small" />
<div class="flex flex-row gap-6 w-10/12"> <div class="flex flex-row gap-6 w-10/12">
<div class="flex flex-col gap-0.5"> <div class="flex flex-col gap-0.5">

2
packages/nc-gui/components/virtual-cell/components/ListItems.vue

@ -278,7 +278,7 @@ onKeyStroke('Escape', () => {
</template> </template>
<div <div
v-if="!isChildrenExcludedLoading && !childrenExcludedList?.pageInfo?.totalRows" v-if="!isChildrenExcludedLoading && !childrenExcludedList?.pageInfo?.totalRows"
class="py-2 h-[420px] flex flex-col gap-3 items-center justify-center text-gray-500" class="py-2 h-105 flex flex-col gap-3 items-center justify-center text-gray-500"
> >
<InboxIcon class="w-16 h-16 mx-auto" /> <InboxIcon class="w-16 h-16 mx-auto" />
<p> <p>

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

@ -82,7 +82,7 @@ import NcAddDataSource from '~icons/nc-icons/add-data-source'
import NcDatabaseIcon from '~icons/nc-icons/database' import NcDatabaseIcon from '~icons/nc-icons/database'
import Project from '~icons/nc-icons/project' import Project from '~icons/nc-icons/project'
import TableIcon from '~icons/nc-icons/table' import TableIcon from '~icons/nc-icons/table'
import RecordIcon from '~icons/nc-icons/record'
// Roles // Roles
import MaterialSymbolsManageAccountsOutline from '~icons/material-symbols/manage-accounts-outline' import MaterialSymbolsManageAccountsOutline from '~icons/material-symbols/manage-accounts-outline'
// account // account
@ -238,6 +238,7 @@ import MaterialSymbolsBlock from '~icons/material-symbols/block'
} as const */ } as const */
export const iconMap = { export const iconMap = {
recordIcon: 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