|
|
|
@ -1,6 +1,8 @@
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
|
import { ColumnReqType } from 'nocodb-sdk' |
|
|
|
|
import type { ColumnType } from 'nocodb-sdk' |
|
|
|
|
import { ColumnInj, IsFormInj, IsKanbanInj, inject, provide, ref, toRef, useUIPermission } from '#imports' |
|
|
|
|
import { SmartsheetStoreEvents } from '~/lib' |
|
|
|
|
|
|
|
|
|
const props = defineProps<{ column: ColumnType & { meta: any }; required?: boolean | number; hideMenu?: boolean }>() |
|
|
|
|
|
|
|
|
@ -17,6 +19,19 @@ const { isUIAllowed } = useUIPermission()
|
|
|
|
|
provide(ColumnInj, column) |
|
|
|
|
|
|
|
|
|
const editColumnDropdown = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const columnOrder = ref<Pick<ColumnReqType, 'columnOrder'> | null>(null) |
|
|
|
|
|
|
|
|
|
const addField = async ( payload) => { |
|
|
|
|
columnOrder.value = payload |
|
|
|
|
editColumnDropdown.value = true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const closeAddColumnMenu = () => { |
|
|
|
|
columnOrder.value = null |
|
|
|
|
editColumnDropdown.value = false |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
@ -39,7 +54,7 @@ const editColumnDropdown = ref(false)
|
|
|
|
|
<template v-if="!hideMenu"> |
|
|
|
|
<div class="flex-1" /> |
|
|
|
|
|
|
|
|
|
<LazySmartsheetHeaderMenu v-if="!isForm && isUIAllowed('edit-column')" @edit="editColumnDropdown = true" /> |
|
|
|
|
<LazySmartsheetHeaderMenu @add-column="addField" v-if="!isForm && isUIAllowed('edit-column')" @edit="editColumnDropdown = true" /> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<a-dropdown |
|
|
|
@ -54,10 +69,11 @@ const editColumnDropdown = ref(false)
|
|
|
|
|
<template #overlay> |
|
|
|
|
<SmartsheetColumnEditOrAddProvider |
|
|
|
|
v-if="editColumnDropdown" |
|
|
|
|
:column="column" |
|
|
|
|
:column="columnOrder ? null : column" |
|
|
|
|
:column-position="columnOrder" |
|
|
|
|
class="w-full" |
|
|
|
|
@submit="editColumnDropdown = false" |
|
|
|
|
@cancel="editColumnDropdown = false" |
|
|
|
|
@submit="closeAddColumnMenu" |
|
|
|
|
@cancel="closeAddColumnMenu" |
|
|
|
|
@click.stop |
|
|
|
|
@keydown.stop |
|
|
|
|
/> |
|
|
|
|