Browse Source

refactor(nc-gui): use lazy components for kanban

pull/3818/head
Wing-Kam Wong 2 years ago
parent
commit
7e63f89ce3
  1. 4
      packages/nc-gui/components/shared-view/Kanban.vue
  2. 4
      packages/nc-gui/components/smartsheet-toolbar/KanbanStackEditOrAdd.vue
  3. 20
      packages/nc-gui/components/smartsheet/Kanban.vue
  4. 4
      packages/nc-gui/pages/[projectType]/kanban/[viewId]/index.vue

4
packages/nc-gui/components/shared-view/Kanban.vue

@ -23,9 +23,9 @@ useProvideSmartsheetStore(sharedView, meta, true, sorts, nestedFilters)
<template> <template>
<div class="nc-container h-full mt-1.5 px-12"> <div class="nc-container h-full mt-1.5 px-12">
<div class="flex flex-col h-full flex-1 min-w-0"> <div class="flex flex-col h-full flex-1 min-w-0">
<SmartsheetToolbar /> <LazySmartsheetToolbar />
<div class="h-full flex-1 min-w-0 min-h-0 bg-gray-50"> <div class="h-full flex-1 min-w-0 min-h-0 bg-gray-50">
<SmartsheetKanban /> <LazySmartsheetKanban />
</div> </div>
</div> </div>
</div> </div>

4
packages/nc-gui/components/smartsheet-toolbar/KanbanStackEditOrAdd.vue

@ -34,7 +34,7 @@ provide(IsKanbanInj, ref(true))
:disabled="isLocked" :disabled="isLocked"
> >
<div class="flex items-center gap-1"> <div class="flex items-center gap-1">
<mdi-plus-circle-outline /> <MdiPlusCircleOutline />
<span class="text-capitalize !text-sm font-weight-normal"> <span class="text-capitalize !text-sm font-weight-normal">
{{ $t('activity.kanban.addOrEditStack') }} {{ $t('activity.kanban.addOrEditStack') }}
</span> </span>
@ -43,7 +43,7 @@ provide(IsKanbanInj, ref(true))
</a-button> </a-button>
</div> </div>
<template #overlay> <template #overlay>
<SmartsheetColumnEditOrAddProvider <LazySmartsheetColumnEditOrAddProvider
v-if="addOrEditStackDropdown" v-if="addOrEditStackDropdown"
:column="groupingFieldColumn" :column="groupingFieldColumn"
@submit="handleSubmit" @submit="handleSubmit"

20
packages/nc-gui/components/smartsheet/Kanban.vue

@ -260,7 +260,7 @@ onMounted(async () => {
class="flex items-center cursor-pointer w-full" class="flex items-center cursor-pointer w-full"
:class="{ capitalize: stack.title === 'uncategorized' }" :class="{ capitalize: stack.title === 'uncategorized' }"
> >
<GeneralTruncateText>{{ stack.title }}</GeneralTruncateText> <LazyGeneralTruncateText>{{ stack.title }}</LazyGeneralTruncateText>
<span class="w-full flex w-[15px]"> <span class="w-full flex w-[15px]">
<mdi-menu-down class="text-grey text-lg ml-auto" /> <mdi-menu-down class="text-grey text-lg ml-auto" />
</span> </span>
@ -309,7 +309,7 @@ onMounted(async () => {
> >
<template #item="{ element: record }"> <template #item="{ element: record }">
<div class="nc-kanban-item py-2 px-[15px]"> <div class="nc-kanban-item py-2 px-[15px]">
<SmartsheetRow :row="record"> <LazySmartsheetRow :row="record">
<a-card <a-card
hoverable hoverable
:data-stack="stack.title" :data-stack="stack.title"
@ -328,8 +328,8 @@ onMounted(async () => {
> >
<div v-if="!isRowEmpty(record, col)" class="flex flex-row w-full justify-start pt-2"> <div v-if="!isRowEmpty(record, col)" class="flex flex-row w-full justify-start pt-2">
<div class="w-full text-gray-600"> <div class="w-full text-gray-600">
<SmartsheetHeaderVirtualCell v-if="isVirtualCol(col)" :column="col" :hide-menu="true" /> <LazySmartsheetHeaderVirtualCell v-if="isVirtualCol(col)" :column="col" :hide-menu="true" />
<SmartsheetHeaderCell v-else :column="col" :hide-menu="true" /> <LazySmartsheetHeaderCell v-else :column="col" :hide-menu="true" />
</div> </div>
</div> </div>
<div <div
@ -337,13 +337,13 @@ onMounted(async () => {
class="flex flex-row w-full items-center justify-start" class="flex flex-row w-full items-center justify-start"
:class="{ 'pt-2 pl-2': col.uidt !== UITypes.SingleSelect }" :class="{ 'pt-2 pl-2': col.uidt !== UITypes.SingleSelect }"
> >
<SmartsheetVirtualCell <LazySmartsheetVirtualCell
v-if="isVirtualCol(col)" v-if="isVirtualCol(col)"
v-model="record.row[col.title]" v-model="record.row[col.title]"
:column="col" :column="col"
:row="record" :row="record"
/> />
<SmartsheetCell <LazySmartsheetCell
v-else v-else
v-model="record.row[col.title]" v-model="record.row[col.title]"
:column="col" :column="col"
@ -353,7 +353,7 @@ onMounted(async () => {
</div> </div>
</div> </div>
</a-card> </a-card>
</SmartsheetRow> </LazySmartsheetRow>
</div> </div>
</template> </template>
</Draggable> </Draggable>
@ -387,7 +387,7 @@ onMounted(async () => {
<a-skeleton v-if="!formattedData[stack.title] || !countByStack" class="!w-[150px] pl-5" :paragraph="false" /> <a-skeleton v-if="!formattedData[stack.title] || !countByStack" class="!w-[150px] pl-5" :paragraph="false" />
<div v-else class="nc-kanban-data-count mt-[7px] mx-[10px]"> <div v-else class="nc-kanban-data-count mt-[7px] mx-[10px]">
<div class="float-right flex gap-2 items-center cursor-pointer font-bold"> <div class="float-right flex gap-2 items-center cursor-pointer font-bold">
<GeneralTruncateText>{{ stack.title }}</GeneralTruncateText> <LazyGeneralTruncateText>{{ stack.title }}</LazyGeneralTruncateText>
<mdi-menu-down class="text-grey text-lg" /> <mdi-menu-down class="text-grey text-lg" />
</div> </div>
{{ formattedData[stack.title].length }} / {{ countByStack[stack.title] }} {{ formattedData[stack.title].length }} / {{ countByStack[stack.title] }}
@ -401,7 +401,7 @@ onMounted(async () => {
</div> </div>
</div> </div>
<div class="flex-1" /> <div class="flex-1" />
<SmartsheetExpandedForm <LazySmartsheetExpandedForm
v-if="expandedFormRow && expandedFormDlg" v-if="expandedFormRow && expandedFormDlg"
v-model="expandedFormDlg" v-model="expandedFormDlg"
:row="expandedFormRow" :row="expandedFormRow"
@ -409,7 +409,7 @@ onMounted(async () => {
:meta="meta" :meta="meta"
@cancel="removeRowFromUncategorizedStack" @cancel="removeRowFromUncategorizedStack"
/> />
<SmartsheetExpandedForm <LazySmartsheetExpandedForm
v-if="expandedFormOnRowIdDlg" v-if="expandedFormOnRowIdDlg"
:key="route.query.rowId" :key="route.query.rowId"
v-model="expandedFormOnRowIdDlg" v-model="expandedFormOnRowIdDlg"

4
packages/nc-gui/pages/[projectType]/kanban/[viewId]/index.vue

@ -27,8 +27,8 @@ try {
<template> <template>
<NuxtLayout id="content" class="flex" name="shared-view"> <NuxtLayout id="content" class="flex" name="shared-view">
<div v-if="showPassword"> <div v-if="showPassword">
<SharedViewAskPassword v-model="showPassword" /> <LazySharedViewAskPassword v-model="showPassword" />
</div> </div>
<SharedViewKanban v-else /> <LazySharedViewKanban v-else />
</NuxtLayout> </NuxtLayout>
</template> </template>

Loading…
Cancel
Save