Browse Source

Merge pull request #5842 from nocodb/fix/5829-shared-grid

fix: make cell selectable and skip paste behaviour if not permitted
pull/5845/head
Raju Udava 1 year ago committed by GitHub
parent
commit
a6755fdb49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      packages/nc-gui/components/smartsheet/Grid.vue
  2. 7
      packages/nc-gui/composables/useMultiSelect/index.ts

4
packages/nc-gui/components/smartsheet/Grid.vue

@ -954,9 +954,9 @@ const deleteSelectedRangeOfRows = () => {
<SmartsheetTableDataCell
v-for="(columnObj, colIndex) of fields"
:key="columnObj.id"
class="cell relative cursor-pointer nc-grid-cell"
class="cell relative nc-grid-cell"
:class="{
'active': hasEditPermission && isCellSelected(rowIndex, colIndex),
'active': isCellSelected(rowIndex, colIndex),
'nc-required-cell': isColumnRequiredAndNull(columnObj, row.row),
'align-middle': !rowHeight || rowHeight === 1,
'align-top': rowHeight && rowHeight !== 1,

7
packages/nc-gui/composables/useMultiSelect/index.ts

@ -24,6 +24,7 @@ import {
useI18n,
useMetas,
useProject,
useUIPermission,
} from '#imports'
const MAIN_MOUSE_PRESSED = 0
@ -73,6 +74,9 @@ export function useMultiSelect(
() => !(activeCell.row === null || activeCell.col === null || isNaN(activeCell.row) || isNaN(activeCell.col)),
)
const { isUIAllowed } = useUIPermission()
const hasEditPermission = $computed(() => isUIAllowed('xcDatatableEditable'))
function makeActive(row: number, col: number) {
if (activeCell.row === row && activeCell.col === col) {
return
@ -343,6 +347,9 @@ export function useMultiSelect(
// paste - ctrl/cmd + v
case 86:
try {
// if edit permission is not there, return
if (!hasEditPermission) return
// handle belongs to column
if (
columnObj.uidt === UITypes.LinkToAnotherRecord &&

Loading…
Cancel
Save