diff --git a/packages/nc-gui/components/smartsheet/Grid.vue b/packages/nc-gui/components/smartsheet/Grid.vue index d007bfb074..e56ebc7f75 100644 --- a/packages/nc-gui/components/smartsheet/Grid.vue +++ b/packages/nc-gui/components/smartsheet/Grid.vue @@ -95,6 +95,10 @@ const tbodyEl = ref() const gridWrapper = ref() const tableHead = ref() +const isAddingColumnAllowed = !readOnly.value && !isLocked.value && isUIAllowed('add-column') && !isSqlView.value + +const isAddingEmptyRowAllowed = !isView && !isLocked.value && hasEditPermission && !isSqlView.value + const { isLoading, loadData, @@ -187,6 +191,7 @@ const { selectCell, selectBlock, selectedRange, clearRangeRows, startSelectRange } const cmdOrCtrl = isMac() ? e.metaKey : e.ctrlKey + const altOrOptionKey = e.altKey if (e.key === ' ') { if (selected.row !== null && !editEnabled) { e.preventDefault() @@ -205,6 +210,7 @@ const { selectCell, selectBlock, selectedRange, clearRangeRows, startSelectRange return true } } + if (cmdOrCtrl) { switch (e.key) { case 'ArrowUp': @@ -233,6 +239,26 @@ const { selectCell, selectBlock, selectedRange, clearRangeRows, startSelectRange return true } } + + if (altOrOptionKey) { + switch (e.keyCode) { + // wingkwong + case 82: { + // ALT + R + if (isAddingEmptyRowAllowed) { + addEmptyRow() + } + break + } + case 67: { + // ALT + C + if (isAddingColumnAllowed) { + addColumnDropdown.value = true + } + break + } + } + } }, ) @@ -607,7 +633,7 @@ watch( - +