diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/_shared/EditRow/EditCellWrapper.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/_shared/EditRow/EditCellWrapper.tsx
index 46a5061acf..64dcebf98a 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/_shared/EditRow/EditCellWrapper.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/_shared/EditRow/EditCellWrapper.tsx
@@ -12,8 +12,10 @@ import { CellOptions } from '$app/components/_shared/EditRow/CellOptions';
import { EditCellNumber } from '$app/components/_shared/EditRow/EditCellNumber';
import { EditCheckboxCell } from '$app/components/_shared/EditRow/EditCheckboxCell';
import { EditCellUrl } from '$app/components/_shared/EditRow/EditCellUrl';
+import { Draggable } from 'react-beautiful-dnd';
export const EditCellWrapper = ({
+ index,
cellIdentifier,
cellCache,
fieldController,
@@ -21,6 +23,7 @@ export const EditCellWrapper = ({
onEditOptionsClick,
onEditDateClick,
}: {
+ index: number;
cellIdentifier: CellIdentifier;
cellCache: CellCache;
fieldController: FieldController;
@@ -39,50 +42,61 @@ export const EditCellWrapper = ({
};
return (
-
-
onClick()}
- className={'relative flex w-[180px] cursor-pointer items-center gap-2 rounded-lg px-3 py-1.5 hover:bg-shade-6'}
- >
-
-
+
+ {(provided) => (
+
+
onClick()}
+ className={
+ 'relative flex w-[180px] cursor-pointer items-center gap-2 rounded-lg px-3 py-1.5 hover:bg-shade-6'
+ }
+ >
+
+
+
+
+ {databaseStore.fields[cellIdentifier.fieldId].title}
+
+
+
+ {(cellIdentifier.fieldType === FieldType.SingleSelect ||
+ cellIdentifier.fieldType === FieldType.MultiSelect ||
+ cellIdentifier.fieldType === FieldType.Checklist) &&
+ cellController && (
+
+ )}
+
+ {cellIdentifier.fieldType === FieldType.Checkbox && cellController && (
+
+ )}
+
+ {cellIdentifier.fieldType === FieldType.DateTime && (
+
+ )}
+
+ {cellIdentifier.fieldType === FieldType.Number && cellController && (
+
+ )}
+
+ {cellIdentifier.fieldType === FieldType.URL && cellController && (
+
+ )}
+
+ {cellIdentifier.fieldType === FieldType.RichText && cellController && (
+
+ )}
+
-
- {databaseStore.fields[cellIdentifier.fieldId].title}
-
-
-
- {(cellIdentifier.fieldType === FieldType.SingleSelect ||
- cellIdentifier.fieldType === FieldType.MultiSelect ||
- cellIdentifier.fieldType === FieldType.Checklist) &&
- cellController && (
-
- )}
-
- {cellIdentifier.fieldType === FieldType.Checkbox && cellController && (
-
- )}
-
- {cellIdentifier.fieldType === FieldType.DateTime && (
-
- )}
-
- {cellIdentifier.fieldType === FieldType.Number && cellController && (
-
- )}
-
- {cellIdentifier.fieldType === FieldType.URL && cellController && (
-
- )}
-
- {cellIdentifier.fieldType === FieldType.RichText && cellController && (
-
- )}
-
-
+ )}
+
);
};
diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/_shared/EditRow/EditRow.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/_shared/EditRow/EditRow.tsx
index 047043e082..abf0b714e7 100644
--- a/frontend/appflowy_tauri/src/appflowy_app/components/_shared/EditRow/EditRow.tsx
+++ b/frontend/appflowy_tauri/src/appflowy_app/components/_shared/EditRow/EditRow.tsx
@@ -14,6 +14,7 @@ import { Some } from 'ts-results';
import { FieldType } from '@/services/backend';
import { CellOptionsPopup } from '$app/components/_shared/EditRow/CellOptionsPopup';
import { DatePickerPopup } from '$app/components/_shared/EditRow/DatePickerPopup';
+import { DragDropContext, Droppable, OnDragEndResponder } from 'react-beautiful-dnd';
export const EditRow = ({
onClose,
@@ -105,6 +106,11 @@ export const EditRow = ({
setShowDatePicker(true);
};
+ const onDragEnd: OnDragEndResponder = (result) => {
+ if (!result.destination?.index) return;
+ void controller.moveField(result.source.droppableId, result.source.index, result.destination.index);
+ };
+
return (
-
- {cells.map((cell, cellIndex) => (
- onEditFieldClick(cell.cellIdentifier, top, right)}
- onEditOptionsClick={(left: number, top: number) => onEditOptionsClick(cell.cellIdentifier, left, top)}
- onEditDateClick={(left: number, top: number) => onEditDateClick(cell.cellIdentifier, left, top)}
- >
- ))}
-
+
+
+
+ {(provided) => (
+
+ {cells.map((cell, cellIndex) => (
+ onEditFieldClick(cell.cellIdentifier, top, right)}
+ onEditOptionsClick={(left: number, top: number) =>
+ onEditOptionsClick(cell.cellIdentifier, left, top)
+ }
+ onEditDateClick={(left: number, top: number) => onEditDateClick(cell.cellIdentifier, left, top)}
+ >
+ ))}
+
+ )}
+
+