Browse Source

wip(nc-gui): add / edit stack logic

pull/3818/head
Wing-Kam Wong 2 years ago
parent
commit
b265d5d5ae
  1. 35
      packages/nc-gui/components/smartsheet/Kanban.vue

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

@ -41,6 +41,7 @@ const {
addEmptyRow, addEmptyRow,
groupingFieldColOptions, groupingFieldColOptions,
groupingField, groupingField,
groupingFieldColumn,
} = useKanbanViewData(meta, view as any) } = useKanbanViewData(meta, view as any)
const { isUIAllowed } = useUIPermission() const { isUIAllowed } = useUIPermission()
@ -143,20 +144,17 @@ async function onMove(event: any, stackKey: string) {
} }
} }
function createNewStack() {
// TODO:
// P.S tag value cannot be empty
}
openNewRecordFormHook?.on(async () => { openNewRecordFormHook?.on(async () => {
const newRow = await addEmptyRow() const newRow = await addEmptyRow()
expandForm(newRow) expandForm(newRow)
}) })
const addNewStackDropdown = ref(false)
</script> </script>
<template> <template>
<div class="flex h-full"> <div class="flex h-full">
<div class="nc-kanban-container flex my-4 px-3 overflow-x-scroll overflow-y-auto"> <div class="nc-kanban-container flex my-4 px-3 overflow-x-scroll overflow-y-hidden">
<Draggable <Draggable
v-model="groupingFieldColOptions" v-model="groupingFieldColOptions"
class="flex gap-5" class="flex gap-5"
@ -177,7 +175,7 @@ openNewRecordFormHook?.on(async () => {
> >
<div :style="`background-color: ${stack.color}`" class="nc-kanban-stack-head-color h-[20px]"></div> <div :style="`background-color: ${stack.color}`" class="nc-kanban-stack-head-color h-[20px]"></div>
<a-skeleton v-if="!formattedData" /> <a-skeleton v-if="!formattedData" />
<a-layout class="px-[20px] !bg-[#f0f2f5]" v-else> <a-layout v-else class="px-[20px] !bg-[#f0f2f5]">
<a-layout-header> <a-layout-header>
<div class="nc-kanban-stack-head justify-center w-full items-center flex"> <div class="nc-kanban-stack-head justify-center w-full items-center flex">
<div class="text-slate-500 font-bold">{{ stack.title }}</div> <div class="text-slate-500 font-bold">{{ stack.title }}</div>
@ -287,12 +285,31 @@ openNewRecordFormHook?.on(async () => {
body-style="padding: 0px 20px; height: 100%;" body-style="padding: 0px 20px; height: 100%;"
:bordered="false" :bordered="false"
> >
<a-button class="w-full !h-[40px] !rounded-xl" @click="createNewStack"> <a-dropdown v-if="isUIAllowed('edit-column')" v-model:visible="addNewStackDropdown" :trigger="['click']">
<a-button class="w-full !h-[40px] !rounded-xl">
<div class="flex items-center"> <div class="flex items-center">
<mdi-plus /> <mdi-plus />
<span class="text-gray-500 group-hover:(text-primary/100) flex-1">New Stack</span> <span class="text-gray-500 group-hover:(text-primary/100) flex-1">Add / Edit Stack</span>
</div> </div>
</a-button> </a-button>
<template #overlay>
<SmartsheetColumnEditOrAddProvider
v-if="addNewStackDropdown"
:column="groupingFieldColumn"
@submit="
;async () => {
addNewStackDropdown = false
await loadKanbanMeta()
await loadKanbanData()
}
"
@cancel="addNewStackDropdown = false"
@click.stop
@keydown.stop
/>
</template>
</a-dropdown>
</a-card> </a-card>
</div> </div>
</div> </div>

Loading…
Cancel
Save