fix(nc-gui): test fail issue

This commit is contained in:
Ramesh Mane
2025-10-29 02:23:51 +05:30
parent ef16f8b56e
commit a5d84af791
3 changed files with 15 additions and 8 deletions

View File

@@ -9,7 +9,7 @@ import { IconType } from 'nocodb-sdk'
interface Props {
icon: string | Record<string, any>
iconType: IconType | string
imageCropperData: Omit<ImageCropperProps, 'showCropper'>
imageCropperData?: Omit<ImageCropperProps, 'showCropper'>
tabOrder?: IconType[]
hiddenTabs?: IconType[]
defaultActiveTab?: IconType
@@ -35,7 +35,9 @@ const vIcon = useVModel(props, 'icon', emits)
const vIconType = useVModel(props, 'iconType', emits)
const imageCropperData = useVModel(props, 'imageCropperData', emits)
const imageCropperData = useVModel(props, 'imageCropperData', emits, {
defaultValue: {} as Omit<ImageCropperProps, 'showCropper'>,
})
const { t } = useI18n()
@@ -155,17 +157,19 @@ const handleChange = (info: UploadChangeParam) => {
if (status === 'done' && info.file.originFileObj instanceof File) {
// 1. Revoke the object URL, to allow the garbage collector to destroy the uploaded before file
if (imageCropperData.value.imageConfig.src) {
if (imageCropperData.value?.imageConfig?.src) {
URL.revokeObjectURL(imageCropperData.value.imageConfig.src)
}
// 2. Create the blob link to the file to optimize performance:
const blob = URL.createObjectURL(info.file.originFileObj)
// 3. Update the image. The type will be derived from the extension
imageCropperData.value.imageConfig = {
src: blob,
type: info.file.originFileObj.type,
name: info.file.originFileObj.name,
if (imageCropperData.value) {
imageCropperData.value.imageConfig = {
src: blob,
type: info.file.originFileObj.type,
name: info.file.originFileObj.name,
}
}
isUploadingImage.value = false
@@ -409,6 +413,7 @@ watch(isOpen, (newValue) => {
</NcDropdown>
<GeneralImageCropper
v-if="tabs.some((t) => t.value === IconType.IMAGE) && imageCropperData"
v-model:show-cropper="showImageCropper"
:cropper-config="imageCropperData.cropperConfig"
:image-config="imageCropperData.imageConfig"

View File

@@ -744,6 +744,8 @@ const updateFieldTitle = (value: string) => {
if (!activeField.value) return
activeField.value.label = value.trimStart()
updateColMeta(activeField.value)
}
const handleAutoScrollFormField = (title: string, isSidebar: boolean) => {

View File

@@ -553,7 +553,7 @@ const [useProvideFormViewStore, useFormViewStore] = useInjectionState(
)
const updateColMeta = useDebounceFn(async (col: Record<string, any>) => {
if (col.id && isEditable) {
if (col?.id && isEditable) {
validateActiveField(col)
try {