fix: long text issue

This commit is contained in:
DarkPhoenix2704
2025-01-11 03:29:50 +00:00
parent 5f2480ca62
commit 4e4675166e

View File

@@ -1,6 +1,17 @@
import type { ComputedRef, Ref } from 'vue'
import { UITypes, extractFilterFromXwhere, isAIPromptCol } from 'nocodb-sdk'
import type { Api, ColumnType, LinkToAnotherRecordType, PaginatedType, RelationTypes, TableType, ViewType } from 'nocodb-sdk'
import {
type Api,
type ColumnType,
type LinkToAnotherRecordType,
type PaginatedType,
type RelationTypes,
type TableType,
type ViewType,
isCreatedOrLastModifiedByCol,
isCreatedOrLastModifiedTimeCol,
isSystemColumn,
} from 'nocodb-sdk'
import type { Row } from '~/lib/types'
import { validateRowFilters } from '~/utils/dataUtils'
import { NavigateDir } from '~/lib/enums'
@@ -12,7 +23,7 @@ const formatData = (list: Record<string, any>[], pageInfo?: PaginatedType, param
row: { ...row },
oldRow: { ...row },
rowMeta: {
rowIndex: (pageInfo.page - 1) * pageInfo.pageSize + index,
rowIndex: (pageInfo.page! - 1) * pageInfo.pageSize! + index,
},
}))
}
@@ -1074,18 +1085,22 @@ export function useInfiniteData(args: {
UITypes.Attachment,
])
metaValue?.columns?.forEach((col: ColumnType) => {
if (
col.title &&
col.title in updatedRowData &&
(columnsToUpdate.has(col.uidt as UITypes) ||
isAIPromptCol(col) ||
col.au ||
(isValidValue(col?.cdf) && / on update /i.test(col.cdf as string)))
) {
toUpdate.row[col.title] = updatedRowData[col.title]
}
})
Object.assign(
toUpdate.row,
metaValue?.columns?.reduce<Record<string, any>>((acc, col: ColumnType) => {
if (
col.title &&
col.title in updatedRowData &&
(columnsToUpdate.has(col.uidt as UITypes) ||
isAIPromptCol(col) ||
col.au ||
(isValidValue(col?.cdf) && / on update /i.test(col.cdf as string)))
) {
acc[col.title] = updatedRowData[col.title]
}
return acc
}, {}),
)
Object.assign(toUpdate.oldRow, updatedRowData)
@@ -1125,9 +1140,7 @@ export function useInfiniteData(args: {
}
row.rowMeta.changed = false
let cachedRow: Row
let cachedRow
await until(() => {
cachedRow = cachedRows.value.get(row.rowMeta.rowIndex!)
if (!cachedRow) return true
@@ -1136,20 +1149,36 @@ export function useInfiniteData(args: {
let data
const fieldsToOverwrite = meta.value?.columns?.filter(
(c) =>
isSystemColumn(c) ||
isCreatedOrLastModifiedByCol(c) ||
isCreatedOrLastModifiedTimeCol(c) ||
[
UITypes.Formula,
UITypes.QrCode,
UITypes.Barcode,
UITypes.Rollup,
UITypes.Checkbox,
UITypes.User,
UITypes.Lookup,
UITypes.Button,
UITypes.Attachment,
].includes(c.uidt),
)
if (row.rowMeta.new) {
data = await insertRow(row, ltarState, args, false, true, beforeRowID)
} else if (property) {
data = await updateRowProperty(
{
...(cachedRow || row),
row: {
...(cachedRow?.row ? cachedRow.row : row.row),
[property]: row.row[property],
},
},
property,
args,
)
if (cachedRow) {
Object.assign(row.row, {
...(fieldsToOverwrite?.reduce((acc, col) => {
acc[col.title!] = cachedRow.row[col.title!]
return acc
}, {}) ?? {}),
})
}
data = await updateRowProperty(row, property, args)
}
row.rowMeta.isValidationFailed = !validateRowFilters(