|
|
@ -5,7 +5,7 @@ import type { Cell } from './cellRange' |
|
|
|
import { CellRange } from './cellRange' |
|
|
|
import { CellRange } from './cellRange' |
|
|
|
import convertCellData from '~/composables/useMultiSelect/convertCellData' |
|
|
|
import convertCellData from '~/composables/useMultiSelect/convertCellData' |
|
|
|
import { useMetas } from '~/composables/useMetas' |
|
|
|
import { useMetas } from '~/composables/useMetas' |
|
|
|
import { extractPkFromRow } from '~/utils' |
|
|
|
import { extractPkFromRow, extractSdkResponseErrorMsg } from '~/utils' |
|
|
|
import { copyTable, message, reactive, ref, unref, useCopy, useEventListener, useI18n } from '#imports' |
|
|
|
import { copyTable, message, reactive, ref, unref, useCopy, useEventListener, useI18n } from '#imports' |
|
|
|
import type { Row } from '~/lib' |
|
|
|
import type { Row } from '~/lib' |
|
|
|
|
|
|
|
|
|
|
@ -245,6 +245,7 @@ export function useMultiSelect( |
|
|
|
await copyValue() |
|
|
|
await copyValue() |
|
|
|
break |
|
|
|
break |
|
|
|
case 86: |
|
|
|
case 86: |
|
|
|
|
|
|
|
try { |
|
|
|
// handle belongs to column
|
|
|
|
// handle belongs to column
|
|
|
|
if ( |
|
|
|
if ( |
|
|
|
columnObj.uidt === UITypes.LinkToAnotherRecord && |
|
|
|
columnObj.uidt === UITypes.LinkToAnotherRecord && |
|
|
@ -253,7 +254,6 @@ export function useMultiSelect( |
|
|
|
if (!clipboardContext.value || typeof clipboardContext.value !== 'object') { |
|
|
|
if (!clipboardContext.value || typeof clipboardContext.value !== 'object') { |
|
|
|
return message.info('Invalid data') |
|
|
|
return message.info('Invalid data') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
rowObj.row[columnObj.title!] = convertCellData({ |
|
|
|
rowObj.row[columnObj.title!] = convertCellData({ |
|
|
|
value: clipboardContext.value, |
|
|
|
value: clipboardContext.value, |
|
|
|
from: clipboardContext.uidt, |
|
|
|
from: clipboardContext.uidt, |
|
|
@ -262,20 +262,23 @@ export function useMultiSelect( |
|
|
|
e.preventDefault() |
|
|
|
e.preventDefault() |
|
|
|
|
|
|
|
|
|
|
|
const foreignKeyColumn: ColumnType = meta.value?.columns.find( |
|
|
|
const foreignKeyColumn: ColumnType = meta.value?.columns.find( |
|
|
|
(c) => c.id === (columnObj.colOptions as LinkToAnotherRecordType)?.fk_child_column_id, |
|
|
|
(column: ColumnType) => column.id === (columnObj.colOptions as LinkToAnotherRecordType)?.fk_child_column_id, |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
const relatedTableMeta = await getMeta((columnObj.colOptions as LinkToAnotherRecordType)?.fk_related_model_id!) |
|
|
|
const relatedTableMeta = await getMeta((columnObj.colOptions as LinkToAnotherRecordType).fk_related_model_id!) |
|
|
|
|
|
|
|
|
|
|
|
rowObj.row[foreignKeyColumn.title!] = extractPkFromRow(clipboardContext.value, relatedTableMeta!.columns!) |
|
|
|
rowObj.row[foreignKeyColumn.title!] = extractPkFromRow( |
|
|
|
|
|
|
|
clipboardContext.value, |
|
|
|
|
|
|
|
(relatedTableMeta as any)!.columns!, |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
// makeEditable(rowObj, columnObj)
|
|
|
|
// makeEditable(rowObj, columnObj)
|
|
|
|
return syncCellData?.({ ...selectedCell, updatedColumnTitle: foreignKeyColumn.title }) |
|
|
|
return await syncCellData?.({ ...selectedCell, updatedColumnTitle: foreignKeyColumn.title }) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// if it's a virtual column excluding belongs to cell type skip paste
|
|
|
|
// if it's a virtual column excluding belongs to cell type skip paste
|
|
|
|
if (isVirtualCol(columnObj)) { |
|
|
|
if (isVirtualCol(columnObj)) { |
|
|
|
return message.info(t('msg.info.cannotPasteHere')) |
|
|
|
return message.info(t('msg.info.notSupported')) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// const clipboardText = await getClipboardData()
|
|
|
|
// const clipboardText = await getClipboardData()
|
|
|
@ -292,6 +295,9 @@ export function useMultiSelect( |
|
|
|
clearCell(selectedCell as { row: number; col: number }, true) |
|
|
|
clearCell(selectedCell as { row: number; col: number }, true) |
|
|
|
makeEditable(rowObj, columnObj) |
|
|
|
makeEditable(rowObj, columnObj) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
|
|
message.error(await extractSdkResponseErrorMsg(error)) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|