aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormehekj <mehek.jethani@gmail.com>2023-03-01 21:17:28 -0500
committermehekj <mehek.jethani@gmail.com>2023-03-01 21:17:28 -0500
commitfdf2f866e948d030e7b29009ed5c06e384d74fe1 (patch)
treecfc71147a60965700e04412a1d1ecd676f37d6a0 /src
parent9853c1e3ca1c3a1d2da210118b927adc559e67fa (diff)
drag and drop working
Diffstat (limited to 'src')
-rw-r--r--src/client/views/collections/collectionSchema/CollectionSchemaView.tsx4
-rw-r--r--src/client/views/collections/collectionSchema/SchemaRowBox.tsx16
2 files changed, 6 insertions, 14 deletions
diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
index 02591489b..c52a7f3e4 100644
--- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
+++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
@@ -343,14 +343,14 @@ export class CollectionSchemaView extends CollectionSubView() {
@action
selectRow = (doc: Doc, shift: boolean, ctrl: boolean) => {
- console.log(ctrl);
const index = this.childDocs.indexOf(doc);
if (index < 0) return;
if (shift && this._lastSelectedRow !== undefined) {
const startRow = Math.min(this._lastSelectedRow, index);
const endRow = Math.max(this._lastSelectedRow, index);
for (let i = startRow; i <= endRow; i++) {
- this.addDocToSelection(this.childDocs[i], true, i);
+ const currDoc = this.childDocs[i];
+ if (!this._selectedDocs.has(currDoc)) this.addDocToSelection(currDoc, true, i);
}
this._lastSelectedRow = index;
} else if (ctrl) {
diff --git a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx
index 5de9fdf5c..4b709f670 100644
--- a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx
+++ b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx
@@ -40,15 +40,7 @@ export class SchemaRowBox extends ViewBoxBaseComponent<FieldViewProps>() {
@action
onRowPointerDown = (e: React.PointerEvent) => {
- e.stopPropagation();
-
- // setupMoveUpEvents(
- // this,
- // e,
- // e => this.schemaView?.startDrag(e, this.rootDoc, this.rowIndex) ?? true,
- // emptyFunction,
- // e => this.schemaView?.selectRow(e, this.rootDoc, this.rowIndex)
- // );
+ setupMoveUpEvents(this, e, e => this.schemaView?.startDrag(e, this.rootDoc, this.rowIndex) ?? true, emptyFunction, emptyFunction, false);
};
onPointerEnter = (e: any) => {
@@ -97,9 +89,9 @@ export class SchemaRowBox extends ViewBoxBaseComponent<FieldViewProps>() {
? { height: CollectionSchemaView._rowHeight, backgroundColor: Colors.LIGHT_BLUE, pointerEvents: this.schemaView?.props.isContentActive() ? 'all' : undefined /*, opacity: this.props.dragging ? 0.5 : 1 */ }
: { height: CollectionSchemaView._rowHeight, pointerEvents: this.schemaView?.props.isContentActive() ? 'all' : undefined }
}
- // onPointerDown={this.onRowPointerDown}
- // onPointerEnter={this.onPointerEnter}
- // onPointerLeave={this.onPointerLeave}
+ onPointerDown={this.onRowPointerDown}
+ onPointerEnter={this.onPointerEnter}
+ onPointerLeave={this.onPointerLeave}
ref={(row: HTMLDivElement | null) => {
row && this.schemaView?.addRowRef(this.rootDoc, row);
this._ref = row;