|
|
|
@ -181,7 +181,7 @@ const gridRect = useElementBounding(gridWrapper)
|
|
|
|
|
|
|
|
|
|
// #Permissions |
|
|
|
|
const { isUIAllowed } = useRoles() |
|
|
|
|
const hasEditPermission = computed(() => isUIAllowed('dataEdit')) |
|
|
|
|
const hasEditPermission = computed(() => isUIAllowed('dataEdit') && !isLocked.value) |
|
|
|
|
const isAddingColumnAllowed = computed(() => !readOnly.value && !isLocked.value && isUIAllowed('fieldAdd') && !isSqlView.value) |
|
|
|
|
|
|
|
|
|
const { onDrag, onDragStart, draggedCol, dragColPlaceholderDomRef, toBeDroppedColId } = useColumnDrag({ |
|
|
|
@ -223,9 +223,7 @@ const _contextMenu = ref(false)
|
|
|
|
|
const contextMenu = computed({ |
|
|
|
|
get: () => _contextMenu.value, |
|
|
|
|
set: (val) => { |
|
|
|
|
if (hasEditPermission.value) { |
|
|
|
|
_contextMenu.value = val |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
const contextMenuClosing = ref(false) |
|
|
|
@ -1549,14 +1547,12 @@ onKeyStroke('ArrowDown', onDown)
|
|
|
|
|
<SmartsheetTableDataCell |
|
|
|
|
v-for="(columnObj, colIndex) of fields" |
|
|
|
|
:key="columnObj.id" |
|
|
|
|
class="cell relative nc-grid-cell" |
|
|
|
|
class="cell relative nc-grid-cell cursor-pointer" |
|
|
|
|
:class="{ |
|
|
|
|
'cursor-pointer': hasEditPermission, |
|
|
|
|
'active': hasEditPermission && isCellSelected(rowIndex, colIndex), |
|
|
|
|
'active': isCellSelected(rowIndex, colIndex), |
|
|
|
|
'active-cell': |
|
|
|
|
hasEditPermission && |
|
|
|
|
((activeCell.row === rowIndex && activeCell.col === colIndex) || |
|
|
|
|
(selectedRange._start?.row === rowIndex && selectedRange._start?.col === colIndex)), |
|
|
|
|
(activeCell.row === rowIndex && activeCell.col === colIndex) || |
|
|
|
|
(selectedRange._start?.row === rowIndex && selectedRange._start?.col === colIndex), |
|
|
|
|
'last-cell': |
|
|
|
|
rowIndex === (isNaN(selectedRange.end.row) ? activeCell.row : selectedRange.end.row) && |
|
|
|
|
colIndex === (isNaN(selectedRange.end.col) ? activeCell.col : selectedRange.end.col), |
|
|
|
@ -1658,7 +1654,7 @@ onKeyStroke('ArrowDown', onDown)
|
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<template v-if="!isLocked && hasEditPermission" #overlay> |
|
|
|
|
<template #overlay> |
|
|
|
|
<NcMenu class="!rounded !py-0" @click="contextMenu = false"> |
|
|
|
|
<NcMenuItem |
|
|
|
|
v-if="isEeUI && !contextMenuClosing && !contextMenuTarget && data.some((r) => r.rowMeta.selected)" |
|
|
|
@ -1709,6 +1705,7 @@ onKeyStroke('ArrowDown', onDown)
|
|
|
|
|
<NcMenuItem |
|
|
|
|
v-if=" |
|
|
|
|
contextMenuTarget && |
|
|
|
|
hasEditPermission && |
|
|
|
|
selectedRange.isSingleCell() && |
|
|
|
|
(isLinksOrLTAR(fields[contextMenuTarget.col]) || !isVirtualCol(fields[contextMenuTarget.col])) |
|
|
|
|
" |
|
|
|
@ -1722,7 +1719,7 @@ onKeyStroke('ArrowDown', onDown)
|
|
|
|
|
|
|
|
|
|
<!-- Clear cell --> |
|
|
|
|
<NcMenuItem |
|
|
|
|
v-else-if="contextMenuTarget" |
|
|
|
|
v-else-if="contextMenuTarget && hasEditPermission" |
|
|
|
|
v-e="['a:row:clear-range']" |
|
|
|
|
class="nc-base-menu-item" |
|
|
|
|
@click="clearSelectedRangeOfCells()" |
|
|
|
@ -1731,7 +1728,9 @@ onKeyStroke('ArrowDown', onDown)
|
|
|
|
|
|
|
|
|
|
{{ $t('general.clear') }} |
|
|
|
|
</NcMenuItem> |
|
|
|
|
<template v-if="contextMenuTarget && selectedRange.isSingleCell() && isUIAllowed('commentEdit') && !isMobileMode"> |
|
|
|
|
<template |
|
|
|
|
v-if="contextMenuTarget && !isLocked && selectedRange.isSingleCell() && isUIAllowed('commentEdit') && !isMobileMode" |
|
|
|
|
> |
|
|
|
|
<NcDivider /> |
|
|
|
|
<NcMenuItem v-e="['a:row:comment']" class="nc-base-menu-item" @click="commentRow(contextMenuTarget.row)"> |
|
|
|
|
<MdiMessageOutline class="h-4 w-4" /> |
|
|
|
@ -1739,6 +1738,7 @@ onKeyStroke('ArrowDown', onDown)
|
|
|
|
|
{{ $t('general.comment') }} |
|
|
|
|
</NcMenuItem> |
|
|
|
|
</template> |
|
|
|
|
<template v-if="hasEditPermission"> |
|
|
|
|
<NcDivider v-if="!(!contextMenuClosing && !contextMenuTarget && data.some((r) => r.rowMeta.selected))" /> |
|
|
|
|
<NcMenuItem |
|
|
|
|
v-if="contextMenuTarget && (selectedRange.isSingleCell() || selectedRange.isSingleRow())" |
|
|
|
@ -1761,6 +1761,7 @@ onKeyStroke('ArrowDown', onDown)
|
|
|
|
|
{{ $t('activity.deleteRows') }} |
|
|
|
|
</NcMenuItem> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</NcMenu> |
|
|
|
|
</template> |
|
|
|
|
</NcDropdown> |
|
|
|
|