mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.8 KiB
61 lines
1.8 KiB
2 years ago
|
<script setup lang="ts">
|
||
2 years ago
|
import type { ColumnType } from 'nocodb-sdk'
|
||
2 years ago
|
import { ColumnInj, IsFormInj, inject, provide, ref, toRef, useUIPermission } from '#imports'
|
||
|
|
||
2 years ago
|
const props = defineProps<{ column: ColumnType & { meta: any }; required?: boolean | number; hideMenu?: boolean }>()
|
||
2 years ago
|
|
||
2 years ago
|
const hideMenu = toRef(props, 'hideMenu')
|
||
2 years ago
|
|
||
2 years ago
|
const isForm = inject(IsFormInj, ref(false))
|
||
2 years ago
|
|
||
2 years ago
|
const column = toRef(props, 'column')
|
||
|
|
||
2 years ago
|
const { isUIAllowed } = useUIPermission()
|
||
|
|
||
2 years ago
|
provide(ColumnInj, column)
|
||
|
|
||
2 years ago
|
const editColumnDropdown = ref(false)
|
||
2 years ago
|
</script>
|
||
|
|
||
|
<template>
|
||
2 years ago
|
<div class="flex items-center w-full text-xs text-normal text-gray-500 font-weight-medium" :class="{ 'h-full': column }">
|
||
2 years ago
|
<SmartsheetHeaderCellIcon v-if="column" />
|
||
|
<span v-if="column" class="name" style="white-space: nowrap" :title="column.title">{{ column.title }}</span>
|
||
2 years ago
|
<span v-if="(column.rqd && !column.cdf) || required" class="text-red-500"> *</span>
|
||
2 years ago
|
|
||
2 years ago
|
<template v-if="!hideMenu">
|
||
|
<div class="flex-1" />
|
||
2 years ago
|
<SmartsheetHeaderMenu v-if="!isForm && isUIAllowed('edit-column')" @edit="editColumnDropdown = true" />
|
||
2 years ago
|
</template>
|
||
2 years ago
|
|
||
2 years ago
|
<a-dropdown
|
||
|
v-model:visible="editColumnDropdown"
|
||
|
class="h-full"
|
||
|
:trigger="['click']"
|
||
|
placement="bottomRight"
|
||
|
overlay-class-name="nc-dropdown-edit-column"
|
||
|
>
|
||
2 years ago
|
<div />
|
||
|
<template #overlay>
|
||
2 years ago
|
<SmartsheetColumnEditOrAddProvider
|
||
|
v-if="editColumnDropdown"
|
||
|
:column="column"
|
||
2 years ago
|
class="w-full"
|
||
2 years ago
|
@submit="editColumnDropdown = false"
|
||
|
@cancel="editColumnDropdown = false"
|
||
2 years ago
|
@click.stop
|
||
|
@keydown.stop
|
||
|
/>
|
||
|
</template>
|
||
|
</a-dropdown>
|
||
2 years ago
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<style scoped>
|
||
|
.name {
|
||
|
max-width: calc(100% - 40px);
|
||
|
overflow: hidden;
|
||
|
text-overflow: ellipsis;
|
||
|
}
|
||
|
</style>
|