|
|
@ -15,6 +15,7 @@ import { |
|
|
|
ReadonlyInj, |
|
|
|
ReadonlyInj, |
|
|
|
inject, |
|
|
|
inject, |
|
|
|
onBeforeMount, |
|
|
|
onBeforeMount, |
|
|
|
|
|
|
|
onBeforeUnmount, |
|
|
|
provide, |
|
|
|
provide, |
|
|
|
useKanbanViewStoreOrThrow, |
|
|
|
useKanbanViewStoreOrThrow, |
|
|
|
} from '#imports' |
|
|
|
} from '#imports' |
|
|
@ -88,6 +89,8 @@ const fields = inject(FieldsInj, ref([])) |
|
|
|
|
|
|
|
|
|
|
|
const kanbanContainerRef = ref() |
|
|
|
const kanbanContainerRef = ref() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const selectedStackTitle = ref('') |
|
|
|
|
|
|
|
|
|
|
|
const isRowEmpty = (record: any, col: any) => { |
|
|
|
const isRowEmpty = (record: any, col: any) => { |
|
|
|
const val = record.row[col.title] |
|
|
|
const val = record.row[col.title] |
|
|
|
if (!val) return true |
|
|
|
if (!val) return true |
|
|
@ -122,6 +125,7 @@ const expandForm = (row: RowType, state?: Record<string, any>) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const _contextMenu = ref(false) |
|
|
|
const _contextMenu = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
const contextMenu = computed({ |
|
|
|
const contextMenu = computed({ |
|
|
|
get: () => _contextMenu.value, |
|
|
|
get: () => _contextMenu.value, |
|
|
|
set: (val) => { |
|
|
|
set: (val) => { |
|
|
@ -227,23 +231,29 @@ const handleCollapseStack = async (stackIdx: number) => { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
openNewRecordFormHook?.on(async (stackTitle) => { |
|
|
|
const openNewRecordFormHookHandler = async () => { |
|
|
|
const newRow = await addEmptyRow() |
|
|
|
const newRow = await addEmptyRow() |
|
|
|
// preset the grouping field value |
|
|
|
// preset the grouping field value |
|
|
|
newRow.row = { |
|
|
|
newRow.row = { |
|
|
|
[groupingField.value]: stackTitle, |
|
|
|
[groupingField.value]: selectedStackTitle.value, |
|
|
|
} |
|
|
|
} |
|
|
|
// increase total count by 1 |
|
|
|
// increase total count by 1 |
|
|
|
countByStack.value.set(null, countByStack.value.get(null)! + 1) |
|
|
|
countByStack.value.set(null, countByStack.value.get(null)! + 1) |
|
|
|
// open the expanded form |
|
|
|
// open the expanded form |
|
|
|
expandForm(newRow) |
|
|
|
expandForm(newRow) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
openNewRecordFormHook?.on(openNewRecordFormHookHandler) |
|
|
|
|
|
|
|
|
|
|
|
onBeforeMount(async () => { |
|
|
|
onBeforeMount(async () => { |
|
|
|
await loadKanbanMeta() |
|
|
|
await loadKanbanMeta() |
|
|
|
await loadKanbanData() |
|
|
|
await loadKanbanData() |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// remove openNewRecordFormHookHandler before unmounting |
|
|
|
|
|
|
|
// so that it won't be triggered multiple times |
|
|
|
|
|
|
|
onBeforeUnmount(() => openNewRecordFormHook.off(openNewRecordFormHookHandler)) |
|
|
|
|
|
|
|
|
|
|
|
// reset context menu target on hide |
|
|
|
// reset context menu target on hide |
|
|
|
watch(contextMenu, () => { |
|
|
|
watch(contextMenu, () => { |
|
|
|
if (!contextMenu.value) { |
|
|
|
if (!contextMenu.value) { |
|
|
@ -325,9 +335,14 @@ watch(view, async (nextView) => { |
|
|
|
<template v-if="!isLocked" #overlay> |
|
|
|
<template v-if="!isLocked" #overlay> |
|
|
|
<a-menu class="ml-6 !text-sm !px-0 !py-2 !rounded"> |
|
|
|
<a-menu class="ml-6 !text-sm !px-0 !py-2 !rounded"> |
|
|
|
<a-menu-item |
|
|
|
<a-menu-item |
|
|
|
v-if="hasEditPermission && !isPublic" |
|
|
|
v-if="hasEditPermission && !isPublic && !isLocked" |
|
|
|
v-e="['c:kanban:add-new-record']" |
|
|
|
v-e="['c:kanban:add-new-record']" |
|
|
|
@click="openNewRecordFormHook.trigger(stack.title === null ? null : stack.title)" |
|
|
|
@click=" |
|
|
|
|
|
|
|
() => { |
|
|
|
|
|
|
|
selectedStackTitle = stack.title |
|
|
|
|
|
|
|
openNewRecordFormHook.trigger(stack.title) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
" |
|
|
|
> |
|
|
|
> |
|
|
|
<div class="py-2 flex gap-2 items-center"> |
|
|
|
<div class="py-2 flex gap-2 items-center"> |
|
|
|
<mdi-plus class="text-gray-500" /> |
|
|
|
<mdi-plus class="text-gray-500" /> |
|
|
@ -433,9 +448,14 @@ watch(view, async (nextView) => { |
|
|
|
<div v-if="formattedData.get(stack.title) && countByStack.get(stack.title) >= 0" class="mt-5 text-center"> |
|
|
|
<div v-if="formattedData.get(stack.title) && countByStack.get(stack.title) >= 0" class="mt-5 text-center"> |
|
|
|
<!-- Stack Title --> |
|
|
|
<!-- Stack Title --> |
|
|
|
<mdi-plus |
|
|
|
<mdi-plus |
|
|
|
v-if="!isPublic" |
|
|
|
v-if="!isPublic && !isLocked" |
|
|
|
class="text-pint-500 text-lg text-primary cursor-pointer" |
|
|
|
class="text-pint-500 text-lg text-primary cursor-pointer" |
|
|
|
@click="openNewRecordFormHook.trigger(stack.title === 'uncategorized' ? null : stack.title)" |
|
|
|
@click=" |
|
|
|
|
|
|
|
() => { |
|
|
|
|
|
|
|
selectedStackTitle = stack.title |
|
|
|
|
|
|
|
openNewRecordFormHook.trigger(stack.title) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
" |
|
|
|
/> |
|
|
|
/> |
|
|
|
<!-- Record Count --> |
|
|
|
<!-- Record Count --> |
|
|
|
<div class="nc-kanban-data-count"> |
|
|
|
<div class="nc-kanban-data-count"> |
|
|
|