|
|
|
@ -68,6 +68,12 @@ watch(
|
|
|
|
|
|
|
|
|
|
const numberOfHiddenFields = computed(() => filteredFieldList.value?.filter((field) => !field.show)?.length) |
|
|
|
|
|
|
|
|
|
const gridPrimaryValueField = computed(() => { |
|
|
|
|
if (activeView.value?.type !== ViewTypes.GRID) return null |
|
|
|
|
const pvCol = Object.values(metaColumnById.value)?.find((col) => col?.pv) |
|
|
|
|
return filteredFieldList.value?.find((field) => field.fk_column_id === pvCol?.id) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
const onMove = (_event: { moved: { newIndex: number } }) => { |
|
|
|
|
// todo : sync with server |
|
|
|
|
if (!fields.value) return |
|
|
|
@ -188,7 +194,7 @@ useMenuCloseOnEsc(open)
|
|
|
|
|
<Draggable v-model="fields" item-key="id" @change="onMove($event)"> |
|
|
|
|
<template #item="{ element: field, index: index }"> |
|
|
|
|
<div |
|
|
|
|
v-if="filteredFieldList.slice(activeView?.type === ViewTypes.GRID ? 1 : 0).includes(field)" |
|
|
|
|
v-if="filteredFieldList.filter((el) => el !== gridPrimaryValueField).includes(field)" |
|
|
|
|
:key="field.id" |
|
|
|
|
class="px-2 py-1 flex items-center" |
|
|
|
|
:data-testid="`nc-fields-menu-${field.title}`" |
|
|
|
@ -214,11 +220,10 @@ useMenuCloseOnEsc(open)
|
|
|
|
|
</template> |
|
|
|
|
<template v-if="activeView?.type === ViewTypes.GRID" #header> |
|
|
|
|
<div |
|
|
|
|
v-if="filteredFieldList[0]" |
|
|
|
|
v-show="filteredFieldList[0]" |
|
|
|
|
:key="`pv-${filteredFieldList[0].id}`" |
|
|
|
|
v-if="gridPrimaryValueField" |
|
|
|
|
:key="`pv-${gridPrimaryValueField.id}`" |
|
|
|
|
class="px-2 py-1 flex items-center" |
|
|
|
|
:data-testid="`nc-fields-menu-${filteredFieldList[0].title}`" |
|
|
|
|
:data-testid="`nc-fields-menu-${gridPrimaryValueField.title}`" |
|
|
|
|
@click.stop |
|
|
|
|
> |
|
|
|
|
<a-tooltip placement="bottom"> |
|
|
|
|