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-03-31 05:45:55 -0400
committerNathan-SR <144961007+Nathan-SR@users.noreply.github.com>2024-03-31 05:45:55 -0400
commitc705e22aa90710e3ba3f9ed5a6fadb0f1729f7b9 (patch)
tree37bff9a2e3dedd5af0a536467f4c473587e66424 /src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
parenta54d781810505565fb6d32ad4141ddb178ed81af (diff)
selection
Diffstat (limited to 'src/client/views/collections/collectionSchema/CollectionSchemaView.tsx')
-rw-r--r--src/client/views/collections/collectionSchema/CollectionSchemaView.tsx20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
index 96d7627a3..f59d562dd 100644
--- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
+++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
@@ -232,14 +232,14 @@ export class CollectionSchemaView extends CollectionSubView() {
break;
case 'ArrowRight':
if (this._selectedCells) {
- ++this._selectedCol;
+ this._selectedCol = Math.min(this._colEles.length - 1, this._selectedCol + 1);
} else if (this._selectedDocs.length > 0) {
this.selectCell(this._selectedDocs[0], 0, false, false);
}
break;
case 'ArrowLeft':
if (this._selectedCells) {
- --this._selectedCol;
+ this._selectedCol = Math.max(0, this._selectedCol - 1);
} else if (this._selectedDocs.length > 0) {
this.selectCell(this._selectedDocs[0], 0, false, false);
}
@@ -436,7 +436,6 @@ export class CollectionSchemaView extends CollectionSubView() {
this.deselectAllCells();
};
- //This method is called in SchemaRowBox.select, which is never called anywhere
selectRows = (doc: Doc, lastSelected: Doc) => {
const index = this.rowIndex(doc);
const lastSelectedRow = this.rowIndex(lastSelected);
@@ -451,24 +450,27 @@ export class CollectionSchemaView extends CollectionSubView() {
@action
selectCell = (doc: Doc, index: number, shiftKey: boolean, ctrlKey: boolean) => {
- console.log(ctrlKey);
(!shiftKey && !ctrlKey) && this.clearSelection();
!this._selectedCells && (this._selectedCells = []);
this._selectedCells.push(doc);
- this._selectedCol = index;
if (!this) return;
const lastSelected = Array.from(this._selectedDocs).lastElement();
- if (shiftKey && lastSelected) this.selectRows(doc, lastSelected);
+ if (shiftKey && lastSelected && !this._selectedDocs.includes(doc)) this.selectRows(doc, lastSelected);
+ else if (ctrlKey && lastSelected && this._selectedDocs.includes(doc)) {
+ console.log("removed");
+ SelectionManager.DeselectView(DocumentManager.Instance.getFirstDocumentView(doc))
+ this.deselectCell(doc);
+ }
else if (ctrlKey) {this.addDocToSelection(doc, true, this.rowIndex(doc)); console.log("2")}
else this.addDocToSelection(doc, false, this.rowIndex(doc));
-
+
+ this._selectedCol = index;
};
@action
deselectCell = (doc: Doc) => {
- if (this._selectedCells)
- this._selectedCells = this._selectedCells.filter(d => d !== doc);
+ this._selectedCells && (this._selectedCells = this._selectedCells.filter(d => d !== doc));
};
@action