aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormehekj <mehek.jethani@gmail.com>2023-03-20 17:48:08 -0400
committermehekj <mehek.jethani@gmail.com>2023-03-20 17:48:08 -0400
commit25ed15269b72073bd2c7e1e8580574f8a16d986d (patch)
tree4b68063e0e8b2bd694eba5926ea7808ceb297cd6 /src
parent61ce7b4d434aff7e642d2af17b8643297f99e4a3 (diff)
drag and drop to swap columns
Diffstat (limited to 'src')
-rw-r--r--src/client/views/collections/collectionSchema/CollectionSchemaView.tsx13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
index b0114a226..0b68fd31e 100644
--- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
+++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
@@ -392,6 +392,19 @@ export class CollectionSchemaView extends CollectionSubView() {
@action
onInternalDrop = (e: Event, de: DragManager.DropEvent) => {
+ if (de.complete.columnDragData) {
+ e.stopPropagation();
+ const mouseX = this.props.ScreenToLocalTransform().transformPoint(de.x, de.y)[0];
+ let i = de.complete.columnDragData.colIndex;
+ this.displayColumnWidths.reduce((total, curr, index) => {
+ if (total <= mouseX && total + curr >= mouseX) {
+ i = index;
+ }
+ return total + curr;
+ }, CollectionSchemaView._rowMenuWidth);
+ this.swapColumns(de.complete.columnDragData.colIndex, i);
+ return true;
+ }
if (super.onInternalDrop(e, de)) {
this._isDragging = false;
const pushedDocs: Doc[] = this.childDocs.filter((doc: Doc, index: number) => index >= this._closestDropIndex && !this._selectedDocs.has(doc));