Browse Source

feat(gui-v2): add IsFormInj and disable header menu for form view

pull/3030/head
Wing-Kam Wong 2 years ago
parent
commit
9c73e0dc74
  1. 10
      packages/nc-gui-v2/components/smartsheet-header/Cell.vue
  2. 8
      packages/nc-gui-v2/components/smartsheet-header/VirtualCell.vue

10
packages/nc-gui-v2/components/smartsheet-header/Cell.vue

@ -2,15 +2,17 @@
import type { ColumnType, TableType } from 'nocodb-sdk'
import type { Ref } from 'vue'
import { inject } from 'vue'
import { ColumnInj, MetaInj } from '~/context'
import { ColumnInj, IsFormInj, MetaInj } from '~/context'
import { useProvideColumnCreateStore } from '#imports'
const { column } = defineProps<{ column: ColumnType & { meta: any } }>()
provide(ColumnInj, column)
const meta = inject(MetaInj)
const isForm = inject(IsFormInj)
provide(ColumnInj, column)
// instantiate column update store
useProvideColumnCreateStore(meta as Ref<TableType>, column)
</script>
@ -21,7 +23,7 @@ useProvideColumnCreateStore(meta as Ref<TableType>, column)
<span v-if="column" class="name" style="white-space: nowrap" :title="column.title">{{ column.title }}</span>
<div class="flex-1" />
<SmartsheetHeaderMenu />
<SmartsheetHeaderMenu v-if="!isForm" />
</div>
</template>

8
packages/nc-gui-v2/components/smartsheet-header/VirtualCell.vue

@ -1,10 +1,14 @@
<script setup lang="ts">
import type { ColumnType } from 'nocodb-sdk'
import { ColumnInj } from '~/context'
import { inject } from 'vue'
import { ColumnInj, IsFormInj } from '~/context'
import { provide } from '#imports'
const { column } = defineProps<{ column: ColumnType & { meta: any } }>()
provide(ColumnInj, column)
const isForm = inject(IsFormInj)
// import { UITypes } from 'nocodb-sdk'
// import { getUIDTIcon } from '../helpers/uiTypes'
// import EditVirtualColumn from '~/components/project/spreadsheet/components/EditVirtualColumn'
@ -146,7 +150,7 @@ provide(ColumnInj, column)
<!-- </v-tooltip> -->
<v-spacer />
<SmartsheetHeaderMenu :virtual="true" />
<SmartsheetHeaderMenu v-if="!isForm" :virtual="true" />
</div>
</template>

Loading…
Cancel
Save