Browse Source

fix: make cell selectable and skip paste behaviour if not permitted

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5842/head
Pranav C 1 year ago
parent
commit
0389d1876c
  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