Browse Source

Merge pull request #4244 from ketewan/copy-notification

Copy in right menu, notification and refactor
pull/4530/head
navi 2 years ago committed by GitHub
parent
commit
2d2bf48cb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 82
      packages/nc-gui/components/smartsheet/Grid.vue
  2. 54
      packages/nc-gui/composables/useMultiSelect/cellRange.ts
  3. 29
      packages/nc-gui/composables/useMultiSelect/copyValue.ts
  4. 266
      packages/nc-gui/composables/useMultiSelect/index.ts
  5. 2
      packages/nc-gui/context/index.ts
  6. 3
      packages/nc-gui/lang/en.json

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

@ -162,15 +162,8 @@ const getContainerScrollForElement = (
return scroll return scroll
} }
const { selectCell, selectBlock, selectedRange, clearRangeRows, startSelectRange, selected } = useMultiSelect( const { selectCell, startSelectRange, endSelectRange, clearSelectedRange, copyValue, isCellSelected, selectedCell } =
fields, useMultiSelect(fields, data, $$(editEnabled), isPkAvail, clearCell, makeEditable, scrollToCell, (e: KeyboardEvent) => {
data,
$$(editEnabled),
isPkAvail,
clearCell,
makeEditable,
scrollToCell,
(e: KeyboardEvent) => {
// ignore navigating if picker(Date, Time, DateTime, Year) // ignore navigating if picker(Date, Time, DateTime, Year)
// or single/multi select options is open // or single/multi select options is open
const activePickerOrDropdownEl = document.querySelector( const activePickerOrDropdownEl = document.querySelector(
@ -188,9 +181,9 @@ const { selectCell, selectBlock, selectedRange, clearRangeRows, startSelectRange
const cmdOrCtrl = isMac() ? e.metaKey : e.ctrlKey const cmdOrCtrl = isMac() ? e.metaKey : e.ctrlKey
if (e.key === ' ') { if (e.key === ' ') {
if (selected.row !== null && !editEnabled) { if (selectedCell.row !== null && !editEnabled) {
e.preventDefault() e.preventDefault()
const row = data.value[selected.row] const row = data.value[selectedCell.row]
expandForm(row) expandForm(row)
return true return true
} }
@ -208,37 +201,37 @@ const { selectCell, selectBlock, selectedRange, clearRangeRows, startSelectRange
if (cmdOrCtrl) { if (cmdOrCtrl) {
switch (e.key) { switch (e.key) {
case 'ArrowUp': case 'ArrowUp':
selected.row = 0 selectedCell.row = 0
selected.col = selected.col ?? 0 selectedCell.col = selectedCell.col ?? 0
scrollToCell?.() scrollToCell?.()
editEnabled = false editEnabled = false
return true return true
case 'ArrowDown': case 'ArrowDown':
selected.row = data.value.length - 1 selectedCell.row = data.value.length - 1
selected.col = selected.col ?? 0 selectedCell.col = selectedCell.col ?? 0
scrollToCell?.() scrollToCell?.()
editEnabled = false editEnabled = false
return true return true
case 'ArrowRight': case 'ArrowRight':
selected.row = selected.row ?? 0 selectedCell.row = selectedCell.row ?? 0
selected.col = fields.value?.length - 1 selectedCell.col = fields.value?.length - 1
scrollToCell?.() scrollToCell?.()
editEnabled = false editEnabled = false
return true return true
case 'ArrowLeft': case 'ArrowLeft':
selected.row = selected.row ?? 0 selectedCell.row = selectedCell.row ?? 0
selected.col = 0 selectedCell.col = 0
scrollToCell?.() scrollToCell?.()
editEnabled = false editEnabled = false
return true return true
} }
} }
}, })
)
function scrollToCell(row?: number | null, col?: number | null) { function scrollToCell(row?: number | null, col?: number | null) {
row = row ?? selected.row row = row ?? selectedCell.row
col = col ?? selected.col col = col ?? selectedCell.col
if (row !== undefined && col !== undefined && row !== null && col !== null) { if (row !== undefined && col !== undefined && row !== null && col !== null) {
// get active cell // get active cell
const rows = tbodyEl.value?.querySelectorAll('tr') const rows = tbodyEl.value?.querySelectorAll('tr')
@ -393,10 +386,12 @@ useEventListener(document, 'keyup', async (e: KeyboardEvent) => {
/** On clicking outside of table reset active cell */ /** On clicking outside of table reset active cell */
const smartTable = ref(null) const smartTable = ref(null)
onClickOutside(smartTable, (e) => { onClickOutside(smartTable, (e) => {
clearRangeRows() // do nothing if context menu was open
if (selected.col === null) return if (contextMenu.value) return
clearSelectedRange()
if (selectedCell.col === null) return
const activeCol = fields.value[selected.col] const activeCol = fields.value[selectedCell.col]
if (editEnabled && (isVirtualCol(activeCol) || activeCol.uidt === UITypes.JSON)) return if (editEnabled && (isVirtualCol(activeCol) || activeCol.uidt === UITypes.JSON)) return
@ -417,25 +412,25 @@ onClickOutside(smartTable, (e) => {
return return
} }
selected.row = null selectedCell.row = null
selected.col = null selectedCell.col = null
}) })
const onNavigate = (dir: NavigateDir) => { const onNavigate = (dir: NavigateDir) => {
if (selected.row === null || selected.col === null) return if (selectedCell.row === null || selectedCell.col === null) return
editEnabled = false editEnabled = false
switch (dir) { switch (dir) {
case NavigateDir.NEXT: case NavigateDir.NEXT:
if (selected.row < data.value.length - 1) { if (selectedCell.row < data.value.length - 1) {
selected.row++ selectedCell.row++
} else { } else {
addEmptyRow() addEmptyRow()
selected.row++ selectedCell.row++
} }
break break
case NavigateDir.PREV: case NavigateDir.PREV:
if (selected.row > 0) { if (selectedCell.row > 0) {
selected.row-- selectedCell.row--
} }
break break
} }
@ -696,9 +691,7 @@ watch(
:key="columnObj.id" :key="columnObj.id"
class="cell relative cursor-pointer nc-grid-cell" class="cell relative cursor-pointer nc-grid-cell"
:class="{ :class="{
'active': 'active': hasEditPermission && isCellSelected(rowIndex, colIndex),
(hasEditPermission && selected.col === colIndex && selected.row === rowIndex) ||
(hasEditPermission && selectedRange(rowIndex, colIndex)),
'nc-required-cell': isColumnRequiredAndNull(columnObj, row.row), 'nc-required-cell': isColumnRequiredAndNull(columnObj, row.row),
}" }"
:data-testid="`cell-${columnObj.title}-${rowIndex}`" :data-testid="`cell-${columnObj.title}-${rowIndex}`"
@ -708,7 +701,7 @@ watch(
@click="selectCell(rowIndex, colIndex)" @click="selectCell(rowIndex, colIndex)"
@dblclick="makeEditable(row, columnObj)" @dblclick="makeEditable(row, columnObj)"
@mousedown="startSelectRange($event, rowIndex, colIndex)" @mousedown="startSelectRange($event, rowIndex, colIndex)"
@mouseover="selectBlock(rowIndex, colIndex)" @mouseover="endSelectRange(rowIndex, colIndex)"
@contextmenu="showContextMenu($event, { row: rowIndex, col: colIndex })" @contextmenu="showContextMenu($event, { row: rowIndex, col: colIndex })"
> >
<div v-if="!switchingTab" class="w-full h-full"> <div v-if="!switchingTab" class="w-full h-full">
@ -716,7 +709,7 @@ watch(
v-if="isVirtualCol(columnObj)" v-if="isVirtualCol(columnObj)"
v-model="row.row[columnObj.title]" v-model="row.row[columnObj.title]"
:column="columnObj" :column="columnObj"
:active="selected.col === colIndex && selected.row === rowIndex" :active="selectedCell.col === colIndex && selectedCell.row === rowIndex"
:row="row" :row="row"
@navigate="onNavigate" @navigate="onNavigate"
/> />
@ -726,10 +719,10 @@ watch(
v-model="row.row[columnObj.title]" v-model="row.row[columnObj.title]"
:column="columnObj" :column="columnObj"
:edit-enabled=" :edit-enabled="
!!hasEditPermission && !!editEnabled && selected.col === colIndex && selected.row === rowIndex !!hasEditPermission && !!editEnabled && selectedCell.col === colIndex && selectedCell.row === rowIndex
" "
:row-index="rowIndex" :row-index="rowIndex"
:active="selected.col === colIndex && selected.row === rowIndex" :active="selectedCell.col === colIndex && selectedCell.row === rowIndex"
@update:edit-enabled="editEnabled = $event" @update:edit-enabled="editEnabled = $event"
@save="updateOrSaveRow(row, columnObj.title, state)" @save="updateOrSaveRow(row, columnObj.title, state)"
@navigate="onNavigate" @navigate="onNavigate"
@ -794,6 +787,13 @@ watch(
{{ $t('activity.insertRow') }} {{ $t('activity.insertRow') }}
</div> </div>
</a-menu-item> </a-menu-item>
<a-menu-item v-if="contextMenuTarget" @click="copyValue(contextMenuTarget)">
<div v-e="['a:row:copy']" class="nc-project-menu-item">
<!-- Copy -->
{{ $t('general.copy') }}
</div>
</a-menu-item>
</a-menu> </a-menu>
</template> </template>
</a-dropdown> </a-dropdown>

54
packages/nc-gui/composables/useMultiSelect/cellRange.ts

@ -0,0 +1,54 @@
export interface Cell {
row: number | null
col: number | null
}
export class CellRange {
_start: Cell | null
_end: Cell | null
constructor(start = null, end = null) {
this._start = start
this._end = end ?? this._start
}
get start() {
return {
row: Math.min(this._start?.row ?? NaN, this._end?.row ?? NaN),
col: Math.min(this._start?.col ?? NaN, this._end?.col ?? NaN),
}
}
get end() {
return {
row: Math.max(this._start?.row ?? NaN, this._end?.row ?? NaN),
col: Math.max(this._start?.col ?? NaN, this._end?.col ?? NaN),
}
}
startRange(value: Cell) {
if (value == null) {
return
}
this._start = value
this._end = value
}
endRange(value: Cell) {
if (value == null) {
return
}
this._end = value
}
clear() {
this._start = null
this._end = null
}
isEmpty() {
return this._start == null || this._end == null
}
}

29
packages/nc-gui/composables/useMultiSelect/copyValue.ts

@ -0,0 +1,29 @@
import { UITypes } from '../../../nocodb-sdk'
import type { ColumnType } from '../../../nocodb-sdk'
import type { Row } from '~/lib'
export const copyTable = async (rows: Row[], cols: ColumnType[]) => {
let copyHTML = '<table>'
let copyPlainText = ''
rows.forEach((row) => {
let copyRow = '<tr>'
cols.forEach((col) => {
let value = (col.title && row.row[col.title]) ?? ''
if (typeof value === 'object') {
value = JSON.stringify(value)
}
copyRow += `<td>${value}</td>`
copyPlainText = `${copyPlainText} ${value} \t`
})
copyHTML += `${copyRow}</tr>`
copyPlainText = `${copyPlainText.trim()}\n`
})
copyHTML += '</table>'
copyPlainText.trim()
const blobHTML = new Blob([copyHTML], { type: 'text/html' })
const blobPlainText = new Blob([copyPlainText], { type: 'text/plain' })
return navigator.clipboard.write([new ClipboardItem({ [blobHTML.type]: blobHTML, [blobPlainText.type]: blobPlainText })])
}

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

@ -1,18 +1,16 @@
import type { MaybeRef } from '@vueuse/core' import type { MaybeRef } from '@vueuse/core'
import { UITypes } from 'nocodb-sdk' import type { ColumnType } from 'nocodb-sdk'
import { message, reactive, ref, unref, useCopy, useEventListener, useI18n } from '#imports' import type { Cell } from './cellRange'
import { CellRange } from './cellRange'
interface SelectedBlock { import { copyTable, message, reactive, ref, unref, useCopy, useEventListener, useI18n } from '#imports'
row: number | null import type { Row } from '~/lib'
col: number | null
}
/** /**
* Utility to help with multi-selecting rows/cells in the smartsheet * Utility to help with multi-selecting rows/cells in the smartsheet
*/ */
export function useMultiSelect( export function useMultiSelect(
fields: MaybeRef<any[]>, fields: MaybeRef<ColumnType[]>,
data: MaybeRef<any[]>, data: MaybeRef<Row[]>,
_editEnabled: MaybeRef<boolean>, _editEnabled: MaybeRef<boolean>,
isPkAvail: MaybeRef<boolean | undefined>, isPkAvail: MaybeRef<boolean | undefined>,
clearCell: Function, clearCell: Function,
@ -26,99 +24,92 @@ export function useMultiSelect(
const editEnabled = ref(_editEnabled) const editEnabled = ref(_editEnabled)
const selected = reactive<SelectedBlock>({ row: null, col: null }) const selectedCell = reactive<Cell>({ row: null, col: null })
const selectedRange = reactive(new CellRange())
let isMouseDown = $ref(false)
// save the first and the last column where the mouse is down while the value isSelectedRow is true const columnLength = $computed(() => unref(fields)?.length)
const selectedRows = reactive({ startCol: NaN, endCol: NaN, startRow: NaN, endRow: NaN })
// calculate the min and the max column where the mouse is down while the value isSelectedRow is true async function copyValue(ctx?: Cell) {
const rangeRows = reactive({ minRow: NaN, maxRow: NaN, minCol: NaN, maxCol: NaN }) try {
if (!selectedRange.isEmpty()) {
const cprows = unref(data).slice(selectedRange.start.row, selectedRange.end.row + 1) // slice the selected rows for copy
const cpcols = unref(fields).slice(selectedRange.start.col, selectedRange.end.col + 1) // slice the selected cols for copy
// check if mouse is down or up false=mouseup and true=mousedown await copyTable(cprows, cpcols)
let isSelectedBlock = $ref(false) message.success(t('msg.info.copiedToClipboard'))
} else {
// if copy was called with context (right click position) - copy value from context
// else if there is just one selected cell, copy it's value
const cpRow = ctx?.row ?? selectedCell?.row
const cpCol = ctx?.col ?? selectedCell?.col
const columnLength = $computed(() => unref(fields)?.length) if (cpRow != null && cpCol != null) {
const rowObj = unref(data)[cpRow]
const columnObj = unref(fields)[cpCol]
let textToCopy = (columnObj.title && rowObj.row[columnObj.title]) || ''
if (typeof textToCopy === 'object') {
textToCopy = JSON.stringify(textToCopy)
}
await copy(textToCopy)
message.success(t('msg.info.copiedToClipboard'))
}
}
} catch {
message.error(t('msg.error.copyToClipboardError'))
}
}
function selectCell(row: number, col: number) { function selectCell(row: number, col: number) {
clearRangeRows() selectedRange.clear()
if (selected.row === row && selected.col === col) return if (selectedCell.row === row && selectedCell.col === col) return
editEnabled.value = false editEnabled.value = false
selected.row = row selectedCell.row = row
selected.col = col selectedCell.col = col
} }
function selectBlock(row: number, col: number) { function endSelectRange(row: number, col: number) {
// if selected.col and selected.row are null and isSelectedBlock is true that means you are selecting a block if (!isMouseDown) {
if (selected.col === null || selected.row === null) { return
if (isSelectedBlock) {
// save the next value after the selectionStart
selectedRows.endCol = col
selectedRows.endRow = row
}
} else if (selected.col !== col || selected.row !== row) {
// if selected.col and selected.row is not null but the selected col and row is not equal at the row and col where the mouse is clicking
// and isSelectedBlock is true that means you are selecting a block
if (isSelectedBlock) {
selected.col = null
selected.row = null
// save the next value after the selectionStart
selectedRows.endCol = col
selectedRows.endRow = row
}
} }
selectedCell.row = null
selectedCell.col = null
selectedRange.endRange({ row, col })
} }
function selectedRange(row: number, col: number) { function isCellSelected(row: number, col: number) {
if ( if (selectedCell?.row === row && selectedCell?.col === col) {
!isNaN(selectedRows.startRow) && return true
!isNaN(selectedRows.startCol) && }
!isNaN(selectedRows.endRow) &&
!isNaN(selectedRows.endCol)
) {
// check if column selection is up or down
rangeRows.minRow = Math.min(selectedRows.startRow, selectedRows.endRow)
rangeRows.maxRow = Math.max(selectedRows.startRow, selectedRows.endRow)
rangeRows.minCol = Math.min(selectedRows.startCol, selectedRows.endCol)
rangeRows.maxCol = Math.max(selectedRows.startCol, selectedRows.endCol)
// return if the column is in between the selection if (selectedRange.isEmpty()) {
return col >= rangeRows.minCol && col <= rangeRows.maxCol && row >= rangeRows.minRow && row <= rangeRows.maxRow
} else {
return false return false
} }
return (
col >= selectedRange.start.col &&
col <= selectedRange.end.col &&
row >= selectedRange.start.row &&
row <= selectedRange.end.row
)
} }
function startSelectRange(event: MouseEvent, row: number, col: number) { function startSelectRange(event: MouseEvent, row: number, col: number) {
// if editEnabled but the selected col or the selected row is not equal like the actual row or col, enabled selected multiple rows // if there was a right click on selected range, don't restart the selection
if (unref(editEnabled) && (selected.col !== col || selected.row !== row)) { const leftClickButton = 0
event.preventDefault() if (event?.button !== leftClickButton && isCellSelected(row, col)) {
} else if (!unref(editEnabled)) { return
// if editEnabled is not true, enabled selected multiple rows
event.preventDefault()
} }
// clear the selection when the mouse is down if (unref(editEnabled)) {
selectedRows.startCol = NaN event.preventDefault()
selectedRows.endCol = NaN return
selectedRows.startRow = NaN
selectedRows.endRow = NaN
// asing where the selection start
selectedRows.startCol = col
selectedRows.startRow = row
isSelectedBlock = true
} }
function clearRangeRows() { isMouseDown = true
// when the selection starts or ends or when enter/arrow/tab is pressed selectedRange.clear()
// this clear the previous selection selectedRange.startRange({ row, col })
rangeRows.minCol = NaN
rangeRows.maxCol = NaN
rangeRows.minRow = NaN
rangeRows.maxRow = NaN
selectedRows.startRow = NaN
selectedRows.startCol = NaN
selectedRows.endRow = NaN
selectedRows.endCol = NaN
} }
useEventListener(document, 'mouseup', (e) => { useEventListener(document, 'mouseup', (e) => {
@ -127,7 +118,7 @@ export function useMultiSelect(
e.preventDefault() e.preventDefault()
} }
isSelectedBlock = false isMouseDown = false
}) })
const onKeyDown = async (e: KeyboardEvent) => { const onKeyDown = async (e: KeyboardEvent) => {
@ -136,41 +127,36 @@ export function useMultiSelect(
return true return true
} }
if ( if (!selectedRange.isEmpty()) {
!isNaN(selectedRows.startRow) &&
!isNaN(selectedRows.startCol) &&
!isNaN(selectedRows.endRow) &&
!isNaN(selectedRows.endCol)
) {
// In case the user press tabs or arrows keys // In case the user press tabs or arrows keys
selected.row = selectedRows.startRow selectedCell.row = selectedRange.start.row
selected.col = selectedRows.startCol selectedCell.col = selectedRange.start.col
} }
if (selected.row === null || selected.col === null) return if (selectedCell.row === null || selectedCell.col === null) return
/** on tab key press navigate through cells */ /** on tab key press navigate through cells */
switch (e.key) { switch (e.key) {
case 'Tab': case 'Tab':
e.preventDefault() e.preventDefault()
clearRangeRows() selectedRange.clear()
if (e.shiftKey) { if (e.shiftKey) {
if (selected.col > 0) { if (selectedCell.col > 0) {
selected.col-- selectedCell.col--
editEnabled.value = false editEnabled.value = false
} else if (selected.row > 0) { } else if (selectedCell.row > 0) {
selected.row-- selectedCell.row--
selected.col = unref(columnLength) - 1 selectedCell.col = unref(columnLength) - 1
editEnabled.value = false editEnabled.value = false
} }
} else { } else {
if (selected.col < unref(columnLength) - 1) { if (selectedCell.col < unref(columnLength) - 1) {
selected.col++ selectedCell.col++
editEnabled.value = false editEnabled.value = false
} else if (selected.row < unref(data).length - 1) { } else if (selectedCell.row < unref(data).length - 1) {
selected.row++ selectedCell.row++
selected.col = 0 selectedCell.col = 0
editEnabled.value = false editEnabled.value = false
} }
} }
@ -179,90 +165,63 @@ export function useMultiSelect(
/** on enter key press make cell editable */ /** on enter key press make cell editable */
case 'Enter': case 'Enter':
e.preventDefault() e.preventDefault()
clearRangeRows() selectedRange.clear()
makeEditable(unref(data)[selected.row], unref(fields)[selected.col]) makeEditable(unref(data)[selectedCell.row], unref(fields)[selectedCell.col])
break break
/** on delete key press clear cell */ /** on delete key press clear cell */
case 'Delete': case 'Delete':
e.preventDefault() e.preventDefault()
clearRangeRows() selectedRange.clear()
await clearCell(selected as { row: number; col: number }) await clearCell(selectedCell as { row: number; col: number })
break break
/** on arrow key press navigate through cells */ /** on arrow key press navigate through cells */
case 'ArrowRight': case 'ArrowRight':
e.preventDefault() e.preventDefault()
clearRangeRows() selectedRange.clear()
if (selected.col < unref(columnLength) - 1) { if (selectedCell.col < unref(columnLength) - 1) {
selected.col++ selectedCell.col++
scrollToActiveCell?.() scrollToActiveCell?.()
editEnabled.value = false editEnabled.value = false
} }
break break
case 'ArrowLeft': case 'ArrowLeft':
clearRangeRows() selectedRange.clear()
e.preventDefault() e.preventDefault()
clearRangeRows() if (selectedCell.col > 0) {
if (selected.col > 0) { selectedCell.col--
selected.col--
scrollToActiveCell?.() scrollToActiveCell?.()
editEnabled.value = false editEnabled.value = false
} }
break break
case 'ArrowUp': case 'ArrowUp':
clearRangeRows() selectedRange.clear()
e.preventDefault() e.preventDefault()
clearRangeRows() if (selectedCell.row > 0) {
if (selected.row > 0) { selectedCell.row--
selected.row--
scrollToActiveCell?.() scrollToActiveCell?.()
editEnabled.value = false editEnabled.value = false
} }
break break
case 'ArrowDown': case 'ArrowDown':
clearRangeRows() selectedRange.clear()
e.preventDefault() e.preventDefault()
clearRangeRows() if (selectedCell.row < unref(data).length - 1) {
if (selected.row < unref(data).length - 1) { selectedCell.row++
selected.row++
scrollToActiveCell?.() scrollToActiveCell?.()
editEnabled.value = false editEnabled.value = false
} }
break break
default: default:
{ {
const rowObj = unref(data)[selected.row] const rowObj = unref(data)[selectedCell.row]
const columnObj = unref(fields)[selected.col]
let cptext = '' // variable for save the text to be copy
if (!isNaN(rangeRows.minRow) && !isNaN(rangeRows.maxRow) && !isNaN(rangeRows.minCol) && !isNaN(rangeRows.maxCol)) {
const cprows = unref(data).slice(rangeRows.minRow, rangeRows.maxRow + 1) // slice the selected rows for copy
const cpcols = unref(fields).slice(rangeRows.minCol, rangeRows.maxCol + 1) // slice the selected cols for copy
cprows.forEach((row) => { const columnObj = unref(fields)[selectedCell.col]
cpcols.forEach((col) => {
// todo: JSON stringify the attachment cell and LTAR contents for copy
// filter attachment cells and LATR cells from copy
if (col.uidt !== UITypes.Attachment && col.uidt !== UITypes.LinkToAnotherRecord) {
cptext = `${cptext} ${row.row[col.title]} \t`
}
})
cptext = `${cptext.trim()}\n`
})
cptext.trim()
} else {
cptext = rowObj.row[columnObj.title] || ''
}
if ((!unref(editEnabled) && e.metaKey) || e.ctrlKey) { if ((!unref(editEnabled) && e.metaKey) || e.ctrlKey) {
switch (e.keyCode) { switch (e.keyCode) {
// copy - ctrl/cmd +c // copy - ctrl/cmd +c
case 67: case 67:
await copy(cptext) await copyValue()
break break
} }
} }
@ -277,7 +236,7 @@ export function useMultiSelect(
// Update not allowed for table which doesn't have primary Key // Update not allowed for table which doesn't have primary Key
return message.info(t('msg.info.updateNotAllowedWithoutPK')) return message.info(t('msg.info.updateNotAllowedWithoutPK'))
} }
if (makeEditable(rowObj, columnObj)) { if (makeEditable(rowObj, columnObj) && columnObj.title) {
rowObj.row[columnObj.title] = '' rowObj.row[columnObj.title] = ''
} }
// editEnabled = true // editEnabled = true
@ -291,12 +250,11 @@ export function useMultiSelect(
return { return {
selectCell, selectCell,
selectBlock,
selectedRange,
clearRangeRows,
startSelectRange, startSelectRange,
selected, endSelectRange,
selectedRows, clearSelectedRange: selectedRange.clear.bind(selectedRange),
rangeRows, copyValue,
isCellSelected,
selectedCell,
} }
} }

2
packages/nc-gui/context/index.ts

@ -26,7 +26,7 @@ export const ReloadViewDataHookInj: InjectionKey<EventHook<boolean | void>> = Sy
export const ReloadViewMetaHookInj: InjectionKey<EventHook<boolean | void>> = Symbol('reload-view-meta-injection') export const ReloadViewMetaHookInj: InjectionKey<EventHook<boolean | void>> = Symbol('reload-view-meta-injection')
export const ReloadRowDataHookInj: InjectionKey<EventHook<boolean | void>> = Symbol('reload-row-data-injection') export const ReloadRowDataHookInj: InjectionKey<EventHook<boolean | void>> = Symbol('reload-row-data-injection')
export const OpenNewRecordFormHookInj: InjectionKey<EventHook<void>> = Symbol('open-new-record-form-injection') export const OpenNewRecordFormHookInj: InjectionKey<EventHook<void>> = Symbol('open-new-record-form-injection')
export const FieldsInj: InjectionKey<Ref<any[]>> = Symbol('fields-injection') export const FieldsInj: InjectionKey<Ref<ColumnType[]>> = Symbol('fields-injection')
export const EditModeInj: InjectionKey<Ref<boolean>> = Symbol('edit-mode-injection') export const EditModeInj: InjectionKey<Ref<boolean>> = Symbol('edit-mode-injection')
export const SharedViewPasswordInj: InjectionKey<Ref<string | null>> = Symbol('shared-view-password-injection') export const SharedViewPasswordInj: InjectionKey<Ref<string | null>> = Symbol('shared-view-password-injection')
export const CellUrlDisableOverlayInj: InjectionKey<Ref<boolean>> = Symbol('cell-url-disable-url') export const CellUrlDisableOverlayInj: InjectionKey<Ref<boolean>> = Symbol('cell-url-disable-url')

3
packages/nc-gui/lang/en.json

@ -666,7 +666,8 @@
"parameterKeyCannotBeEmpty": "Parameter key cannot be empty", "parameterKeyCannotBeEmpty": "Parameter key cannot be empty",
"duplicateParameterKeysAreNotAllowed": "Duplicate parameter keys are not allowed", "duplicateParameterKeysAreNotAllowed": "Duplicate parameter keys are not allowed",
"fieldRequired": "{value} cannot be empty.", "fieldRequired": "{value} cannot be empty.",
"projectNotAccessible": "Project not accessible" "projectNotAccessible": "Project not accessible",
"copyToClipboardError": "Failed to copy to clipboard"
}, },
"toast": { "toast": {
"exportMetadata": "Project metadata exported successfully", "exportMetadata": "Project metadata exported successfully",

Loading…
Cancel
Save