π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
fix(nc-gui): reset cell drop ref on enter and leave drag
Ramesh Mane0db93a7efa03
diff --git a/packages/nc-gui/components/smartsheet/grid/canvas/index.vue b/packages/nc-gui/components/smartsheet/grid/canvas/index.vueindex 747985fed2..a03084e6c7 100644--- a/packages/nc-gui/components/smartsheet/grid/canvas/index.vue+++ b/packages/nc-gui/components/smartsheet/grid/canvas/index.vue@@ -2617,20 +2617,15 @@ useActiveKeydownListener()const resetAttachmentCellDropOver = () => {- if (!attachmentCellDropOver.value || attachmentCellDropOver.value.rowIndex === -1) return+ if (!attachmentCellDropOver.value) return- attachmentCellDropOver.value = {- rowIndex: -1,- columnId: '',- path: [],- uploadingCells: attachmentCellDropOver.value?.uploadingCells ?? [],- }+ attachmentCellDropOver.value = nullrequestAnimationFrame(triggerRefreshCanvas)}const onDrop = (files: File[] | null, event: DragEvent) => {- if (!attachmentCellDropOver.value || attachmentCellDropOver.value.rowIndex === -1 || !attachmentCellDropOver.value.columnId) {+ if (!attachmentCellDropOver.value) {return}@@ -2672,7 +2667,7 @@ const onDrop = (files: File[] | null, event: DragEvent) => {}}-const onOver = (files: File[] | null, e: DragEvent) => {+const onOver = (_files: File[] | null, e: DragEvent) => {const rect = canvasRef.value?.getBoundingClientRect()if (!rect) return@@ -2698,7 +2693,6 @@ const onOver = (files: File[] | null, e: DragEvent) => {const element = elementMap.findElementAt(mousePosition.x, mousePosition.y, [ElementTypes.ROW])if (!element?.row) return- const row = element?.rowconst rowIndex = element?.rowIndexconst groupPath = generateGroupPath(element?.group)@@ -2717,12 +2711,21 @@ const onOver = (files: File[] | null, e: DragEvent) => {return}- attachmentCellDropOver.value = { rowIndex, columnId: column.id, path: groupPath, uploadingCells: [] }+ attachmentCellDropOver.value = { rowIndex, columnId: column.id, path: groupPath }requestAnimationFrame(triggerRefreshCanvas)}-useDropZone(canvasRef, { onDrop, onOver })+useDropZone(canvasRef, {+ onDrop,+ onEnter: () => {+ resetAttachmentCellDropOver()+ },+ onOver,+ onLeave: () => {+ resetAttachmentCellDropOver()+ },+})watch(removeInlineAddRecord,diff --git a/packages/nc-gui/lib/types.ts b/packages/nc-gui/lib/types.tsindex acf3004402..2aa1c8dbfe 100644--- a/packages/nc-gui/lib/types.ts+++ b/packages/nc-gui/lib/types.ts@@ -932,7 +932,6 @@ interface AttachmentCellDropOverType {rowIndex?: numbercolumnId: stringpath: Array<number>- uploadingCells: Array<Omit<AttachmentCellDropOverType, 'uploadingCells'>>}export type {