Browse Source

fix(gui): avoid header menu in form view and for user who doesn't have permission

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5206/head
Pranav C 2 years ago
parent
commit
29d4544bb1
  1. 18
      packages/nc-gui/components/smartsheet/header/Cell.vue

18
packages/nc-gui/components/smartsheet/header/Cell.vue

@ -7,6 +7,7 @@ interface Props {
required?: boolean | number required?: boolean | number
hideMenu?: boolean hideMenu?: boolean
} }
const props = defineProps<Props>() const props = defineProps<Props>()
const hideMenu = toRef(props, 'hideMenu') const hideMenu = toRef(props, 'hideMenu')
@ -34,6 +35,12 @@ const closeAddColumnDropdown = () => {
columnOrder.value = null columnOrder.value = null
editColumnDropdown.value = false editColumnDropdown.value = false
} }
const openHeaderMenu = () => {
if (!isForm && isUIAllowed('edit-column')) {
editColumnDropdown.value = true
}
}
</script> </script>
<template> <template>
@ -47,20 +54,15 @@ const closeAddColumnDropdown = () => {
class="name cursor-pointer" class="name cursor-pointer"
style="white-space: nowrap" style="white-space: nowrap"
:title="column.title" :title="column.title"
@dblclick="editColumnDropdown = true" @dblclick="openHeaderMenu"
>{{ column.title }}</span >{{ column.title }}</span>
>
<span v-if="(column.rqd && !column.cdf) || required" class="text-red-500">&nbsp;*</span> <span v-if="(column.rqd && !column.cdf) || required" class="text-red-500">&nbsp;*</span>
<template v-if="!hideMenu"> <template v-if="!hideMenu">
<div class="flex-1" /> <div class="flex-1" />
<LazySmartsheetHeaderMenu <LazySmartsheetHeaderMenu v-if="!isForm && isUIAllowed('edit-column')" @add-column="addField" @edit="openHeaderMenu" />
v-if="!isForm && isUIAllowed('edit-column')"
@add-column="addField"
@edit="editColumnDropdown = true"
/>
</template> </template>
<a-dropdown <a-dropdown

Loading…
Cancel
Save