Browse Source

chore(nc-gui): adopt recent changes from develop

pull/3563/head
Wing-Kam Wong 2 years ago
parent
commit
7cc5660877
  1. 39
      packages/nc-gui/components/smartsheet/Kanban.vue
  2. 2
      packages/nc-gui/composables/useKanbanViewStore.ts

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

@ -1,6 +1,6 @@
<script lang="ts" setup>
import Draggable from 'vuedraggable'
import { UITypes, isVirtualCol } from 'nocodb-sdk'
import { UITypes, ViewTypes, isVirtualCol } from 'nocodb-sdk'
import {
ActiveViewInj,
FieldsInj,
@ -89,8 +89,6 @@ const fields = inject(FieldsInj, ref([]))
const kanbanContainerRef = ref()
let isMounted = false
const isRowEmpty = (record: any, col: any) => {
const val = record.row[col.title]
if (!val) return true
@ -245,24 +243,26 @@ openNewRecordFormHook?.on(async (stackTitle) => {
})
onMounted(async () => {
// reset state to avoid from showing the previous stacks when switching kanban views
groupingFieldColOptions.value = []
formattedData.value = {}
// load kanban meta
await loadKanbanMeta()
// load kanban data
await loadKanbanData()
// update isMounted for below watcher
isMounted = true
})
watch(
() => shouldScrollToRight.value,
() => {
// use `isMounted` to avoid scrolling from switching from other views
// i.e. scroll only when a new option is added within kanban view
if (isMounted && shouldScrollToRight.value) {
// reset context menu target on hide
watch(contextMenu, () => {
if (!contextMenu.value) {
contextMenuTarget.value = null
}
})
watch(view, async (nextView) => {
if (nextView?.type === ViewTypes.KANBAN) {
// load kanban meta
await loadKanbanMeta()
// load kanban data
await loadKanbanData()
// horizontally scroll to the end of the kanban container
// when a new option is added within kanban view
if (shouldScrollToRight.value) {
kanbanContainerRef.value.scrollTo({
left: kanbanContainerRef.value.scrollWidth,
behavior: 'smooth',
@ -270,13 +270,6 @@ watch(
// reset shouldScrollToRight
shouldScrollToRight.value = false
}
},
)
// reset context menu target on hide
watch(contextMenu, () => {
if (!contextMenu.value) {
contextMenuTarget.value = null
}
})
</script>

2
packages/nc-gui/composables/useKanbanViewStore.ts

@ -127,7 +127,7 @@ const [useProvideKanbanViewStore, useKanbanViewStore] = useInjectionState(
...(isUIAllowed('filterSync') ? {} : { filterArrJson: JSON.stringify(nestedFilters.value) }),
where,
})
: await fetchSharedViewData(params)
: await fetchSharedViewData({ sortsArr: sorts.value, filtersArr: nestedFilters.value })
formattedData.value[stackTitle] = [...formattedData.value[stackTitle], ...formatData(response.list)]
}

Loading…
Cancel
Save