Browse Source

Merge pull request #3285 from nocodb/fix/ctx-menu

fix(gui-v2): context menu styles
pull/3289/head
navi 2 years ago committed by GitHub
parent
commit
f4bd5c816b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 60
      packages/nc-gui-v2/components/smartsheet/Grid.vue

60
packages/nc-gui-v2/components/smartsheet/Grid.vue

@ -3,6 +3,19 @@ import type { ColumnType } from 'nocodb-sdk'
import { UITypes, isVirtualCol } from 'nocodb-sdk' import { UITypes, isVirtualCol } from 'nocodb-sdk'
import { message } from 'ant-design-vue' import { message } from 'ant-design-vue'
import { import {
ActiveViewInj,
ChangePageInj,
FieldsInj,
IsFormInj,
IsGridInj,
IsLockedInj,
IsPublicInj,
MetaInj,
OpenNewRecordFormHookInj,
PaginationDataInj,
ReadonlyInj,
ReloadViewDataHookInj,
enumColor,
inject, inject,
onClickOutside, onClickOutside,
onMounted, onMounted,
@ -12,25 +25,12 @@ import {
useEventListener, useEventListener,
useGridViewColumnWidth, useGridViewColumnWidth,
useSmartsheetStoreOrThrow, useSmartsheetStoreOrThrow,
useUIPermission,
useViewData, useViewData,
watch, watch,
} from '#imports' } from '#imports'
import type { Row } from '~/composables' import type { Row } from '~/composables'
import {
ActiveViewInj,
ChangePageInj,
FieldsInj,
IsFormInj,
IsGridInj,
IsLockedInj,
IsPublicInj,
MetaInj,
PaginationDataInj,
ReadonlyInj,
ReloadViewDataHookInj,
} from '~/context'
import { NavigateDir } from '~/lib' import { NavigateDir } from '~/lib'
import { enumColor } from '~/utils'
const meta = inject(MetaInj) const meta = inject(MetaInj)
@ -42,7 +42,7 @@ const isPublicView = inject(IsPublicInj, ref(false))
// fields menu and get used in grid and gallery // fields menu and get used in grid and gallery
const fields = inject(FieldsInj, ref([])) const fields = inject(FieldsInj, ref([]))
const readOnly = inject(ReadonlyInj, false) const readOnly = inject(ReadonlyInj, false)
const isLocked = inject(IsLockedInj, false) const isLocked = inject(IsLockedInj, ref(false))
const reloadViewDataHook = inject(ReloadViewDataHookInj) const reloadViewDataHook = inject(ReloadViewDataHookInj)
const openNewRecordFormHook = inject(OpenNewRecordFormHookInj) const openNewRecordFormHook = inject(OpenNewRecordFormHookInj)
@ -487,28 +487,32 @@ const onNavigate = (dir: NavigateDir) => {
</tr> </tr>
</tbody> </tbody>
</table> </table>
<template v-if="!isLocked && isUIAllowed('xcDatatableEditable')" #overlay> <template v-if="!isLocked && isUIAllowed('xcDatatableEditable')" #overlay>
<a-menu class="bg-white shadow" @click="contextMenu = false"> <a-menu class="shadow !rounded !py-0" @click="contextMenu = false">
<a-menu-item v-if="contextMenuTarget" @click="deleteRow(contextMenuTarget.row)" <a-menu-item v-if="contextMenuTarget" @click="deleteRow(contextMenuTarget.row)">
><span class="text-xs"> <div class="nc-project-menu-item">
<!-- Delete Row --> <!-- Delete Row -->
{{ $t('activity.deleteRow') }} {{ $t('activity.deleteRow') }}
</span></a-menu-item </div>
> </a-menu-item>
<a-menu-item @click="deleteSelectedRows"
><span class="text-xs"> <a-menu-item @click="deleteSelectedRows">
<div class="nc-project-menu-item">
<!-- Delete Selected Rows --> <!-- Delete Selected Rows -->
{{ $t('activity.deleteSelectedRow') }} {{ $t('activity.deleteSelectedRow') }}
</span></a-menu-item </div>
>
<a-menu-item v-if="contextMenuTarget" @click="clearCell(contextMenuTarget)"
><span class="text-xs">Clear cell</span>
</a-menu-item> </a-menu-item>
<a-menu-item v-if="contextMenuTarget" @click="clearCell(contextMenuTarget)">
<div class="nc-project-menu-item">Clear cell</div>
</a-menu-item>
<a-menu-item v-if="contextMenuTarget" @click="addEmptyRow(contextMenuTarget.row + 1)"> <a-menu-item v-if="contextMenuTarget" @click="addEmptyRow(contextMenuTarget.row + 1)">
<span class="text-xs"> <div class="nc-project-menu-item">
<!-- Insert New Row --> <!-- Insert New Row -->
{{ $t('activity.insertRow') }} {{ $t('activity.insertRow') }}
</span> </div>
</a-menu-item> </a-menu-item>
</a-menu> </a-menu>
</template> </template>

Loading…
Cancel
Save