Browse Source

fix(nc-gui): PR review changes #2215

pull/7491/head
Ramesh Mane 9 months ago
parent
commit
6865243cf7
  1. 8
      packages/nc-gui/composables/useMultiSelect/convertCellData.ts
  2. 12
      packages/nc-gui/composables/useMultiSelect/index.ts

8
packages/nc-gui/composables/useMultiSelect/convertCellData.ts

@ -5,11 +5,11 @@ import type { AppInfo } from '~/composables/useGlobal'
import { parseProp } from '#imports'
export default function convertCellData(
args: { to: UITypes; value: string; files?: FileList | File[]; oldFiles?: any[] | null; column: ColumnType; appInfo: AppInfo },
args: { to: UITypes; value: string; column: ColumnType; appInfo: AppInfo; files?: FileList | File[]; oldValue?: unknown },
isMysql = false,
isMultiple = false,
) {
const { to, value, files = [], oldFiles, column } = args
const { to, value, column, files = [], oldValue } = args
const dateFormat = isMysql ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD HH:mm:ssZ'
@ -113,8 +113,8 @@ export default function convertCellData(
}
}
case UITypes.Attachment: {
const parsedOldFiles = parseProp(oldFiles)
const oldAttachments = parsedOldFiles && Array.isArray(parsedOldFiles) ? parsedOldFiles : []
const parsedOldValue = parseProp(oldValue)
const oldAttachments = parsedOldValue && Array.isArray(parsedOldValue) ? parsedOldValue : []
if (!value && !files.length) {
if (oldAttachments.length) return undefined

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

@ -820,10 +820,10 @@ export function useMultiSelect(
{
// Repeat the clipboard data array if the matrix is smaller than the selection
value: clipboardMatrix[i % clipboardMatrix.length][j],
oldFiles: pasteCol.uidt === UITypes.Attachment ? pasteRow.row[pasteCol.title!] : undefined,
to: pasteCol.uidt as UITypes,
column: pasteCol,
appInfo: unref(appInfo),
oldValue: pasteCol.uidt === UITypes.Attachment ? pasteRow.row[pasteCol.title!] : undefined,
},
isMysql(meta.value?.source_id),
true,
@ -883,11 +883,11 @@ export function useMultiSelect(
const pasteValue = convertCellData(
{
value: clipboardData,
files: columnObj.uidt === UITypes.Attachment && e.clipboardData?.files?.length ? e.clipboardData?.files : undefined,
oldFiles: rowObj.row[columnObj.title!],
to: columnObj.uidt as UITypes,
column: columnObj,
appInfo: unref(appInfo),
files: columnObj.uidt === UITypes.Attachment && e.clipboardData?.files?.length ? e.clipboardData?.files : undefined,
oldValue: rowObj.row[columnObj.title!],
},
isMysql(meta.value?.source_id),
)
@ -937,11 +937,11 @@ export function useMultiSelect(
const fileUploadPayload = convertCellData(
{
value: '',
files,
oldFiles: row.row[col.title],
to: col.uidt as UITypes,
column: col,
appInfo: unref(appInfo),
files,
oldValue: row.row[col.title],
},
isMysql(meta.value?.source_id),
true,
@ -960,10 +960,10 @@ export function useMultiSelect(
pasteValue = convertCellData(
{
value: clipboardData,
oldFiles: row.row[col.title],
to: col.uidt as UITypes,
column: col,
appInfo: unref(appInfo),
oldValue: row.row[col.title],
},
isMysql(meta.value?.source_id),
true,

Loading…
Cancel
Save