aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
diff options
context:
space:
mode:
authorNathan-SR <144961007+Nathan-SR@users.noreply.github.com>2024-09-22 15:29:28 -0400
committerNathan-SR <144961007+Nathan-SR@users.noreply.github.com>2024-09-22 15:29:28 -0400
commitd8a43b76f101a2f38ef1e3e9cbf8ec036468481d (patch)
tree08fea673e890c1e3b5c22d7a58d6c06c45fdc1fe /src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
parent24c6c3f0c9b43059cd013d344dfa065969f73389 (diff)
header comments + change to cellfield updating
Diffstat (limited to 'src/client/views/collections/collectionSchema/CollectionSchemaView.tsx')
-rw-r--r--src/client/views/collections/collectionSchema/CollectionSchemaView.tsx22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
index 0e5a1e6b6..11a4e88f9 100644
--- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
+++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
@@ -495,6 +495,26 @@ export class CollectionSchemaView extends CollectionSubView() {
return adjIndex;
};
+ @action
+ setRelCursorIndex = (mouseY: number) => {
+ this._mouseCoordinates.y = mouseY; // updates this.rowDropIndex computed value to overwrite the old cached value
+
+ const rowHeight = CollectionSchemaView._rowHeight;
+ const adjInitMouseY = mouseY - rowHeight - 100; // rowHeight: height of the column menu cells | 100: height of the top menu
+ const yOffset = this._lowestSelectedIndex * rowHeight;
+
+ const heights = this._selectedDocs.map(() => this.rowHeightFunc());
+ let index: number = 0;
+ heights.reduce((total, curr, i) => {
+ if (total <= adjInitMouseY && total + curr >= adjInitMouseY) {
+ if (adjInitMouseY <= total + curr) index = i;
+ else index = i + 1;
+ }
+ return total + curr;
+ }, yOffset);
+ this._relCursorIndex = index;
+ };
+
highlightDraggedColumn = (index: number) =>
this._colEles.forEach((colRef, i) => {
const edgeStyle = i === index ? `solid 2px ${Colors.MEDIUM_BLUE}` : '';
@@ -731,7 +751,7 @@ export class CollectionSchemaView extends CollectionSubView() {
const field = this.columnKeys[col];
const refToAdd = `d${docIndex}.${field}`
const editedField = this._referenceSelectMode.currEditing ? this._referenceSelectMode.currEditing as SchemaCellField : null;
- editedField?.appendText(refToAdd, true);
+ editedField?.insertText(refToAdd, true);
editedField?.setupRefSelect(false);
return;
}