aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/views/collections/collectionSchema/CollectionSchemaView.tsx28
-rw-r--r--src/client/views/collections/collectionSchema/SchemaRowBox.tsx2
-rw-r--r--src/client/views/collections/collectionSchema/SchemaTableCell.tsx5
3 files changed, 16 insertions, 19 deletions
diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
index 631ad7132..96d7627a3 100644
--- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
+++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
@@ -200,7 +200,8 @@ export class CollectionSchemaView extends CollectionSubView() {
} else {
const shift: boolean = e.shiftKey;
- this.selectCell(newDoc, this._selectedCol, shift);
+ const ctrl: boolean = e.ctrlKey;
+ this.selectCell(newDoc, this._selectedCol, shift, ctrl);
this.scrollToDoc(newDoc, {});
}
}
@@ -220,8 +221,8 @@ export class CollectionSchemaView extends CollectionSubView() {
this.deselectCell(curDoc);
} else {
const shift: boolean = e.shiftKey;
-
- this.selectCell(newDoc, this._selectedCol, shift);
+ const ctrl: boolean = e.ctrlKey;
+ this.selectCell(newDoc, this._selectedCol, shift, ctrl);
this.scrollToDoc(newDoc, {});
}
}
@@ -233,14 +234,14 @@ export class CollectionSchemaView extends CollectionSubView() {
if (this._selectedCells) {
++this._selectedCol;
} else if (this._selectedDocs.length > 0) {
- this.selectCell(this._selectedDocs[0], 0, false);
+ this.selectCell(this._selectedDocs[0], 0, false, false);
}
break;
case 'ArrowLeft':
if (this._selectedCells) {
--this._selectedCol;
} else if (this._selectedDocs.length > 0) {
- this.selectCell(this._selectedDocs[0], 0, false);
+ this.selectCell(this._selectedDocs[0], 0, false, false);
}
break;
case 'Backspace': {
@@ -449,8 +450,9 @@ export class CollectionSchemaView extends CollectionSubView() {
};
@action
- selectCell = (doc: Doc, index: number, shiftKey: boolean) => {
- !shiftKey && this.clearSelection();
+ 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;
@@ -458,21 +460,15 @@ export class CollectionSchemaView extends CollectionSubView() {
if (!this) return;
const lastSelected = Array.from(this._selectedDocs).lastElement();
if (shiftKey && lastSelected) this.selectRows(doc, lastSelected);
- else {
- this.addDocToSelection(doc, false, this.rowIndex(doc));
- }
-
- let selectedIndexes: Array<Number> = this._selectedCells.map(doc => this.rowIndex(doc));
-
+ else if (ctrlKey) {this.addDocToSelection(doc, true, this.rowIndex(doc)); console.log("2")}
+ else this.addDocToSelection(doc, false, this.rowIndex(doc));
+
};
@action
deselectCell = (doc: Doc) => {
if (this._selectedCells)
this._selectedCells = this._selectedCells.filter(d => d !== doc);
- if (this._selectedCells){
- let selectedIndexes: Array<Number> = this._selectedCells.map(doc => this.rowIndex(doc));
- }
};
@action
diff --git a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx
index e3654facb..33b2d36d6 100644
--- a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx
+++ b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx
@@ -100,7 +100,7 @@ export class SchemaRowBox extends ViewBoxBaseComponent<SchemaRowBoxProps>() {
selectedCol = () => this.schemaView._selectedCol;
getFinfo = computedFn((fieldKey: string) => this.schemaView?.fieldInfos.get(fieldKey));
- selectCell = (doc: Doc, col: number, shift: boolean) => this.schemaView?.selectCell(doc, col, shift);
+ selectCell = (doc: Doc, col: number, shift: boolean, ctrl: boolean) => this.schemaView?.selectCell(doc, col, shift, ctrl);
deselectCell = () => this.schemaView?.deselectAllCells();
selectedCells = () => this.schemaView?._selectedCells;
setColumnValues = (field: any, value: any) => this.schemaView?.setColumnValues(field, value) ?? false;
diff --git a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx
index 734345255..775a8ce05 100644
--- a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx
+++ b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx
@@ -35,7 +35,7 @@ export interface SchemaTableCellProps {
Document: Doc;
col: number;
deselectCell: () => void;
- selectCell: (doc: Doc, col: number, shift: boolean) => void;
+ selectCell: (doc: Doc, col: number, shift: boolean, ctrl: boolean) => void;
selectedCells: () => Doc[] | undefined;
selectedCol: () => number;
fieldKey: string;
@@ -184,7 +184,8 @@ export class SchemaTableCell extends ObservableReactComponent<SchemaTableCellPro
className="schema-table-cell"
onPointerDown={action(e => {
const shift: boolean = e.shiftKey;
- !this.selected && this._props.selectCell(this._props.Document, this._props.col, shift)}
+ const ctrl: boolean = e.ctrlKey;
+ !this.selected && this._props.selectCell(this._props.Document, this._props.col, shift, ctrl)}
)}
style={{ padding: this._props.padding, maxWidth: this._props.maxWidth?.(), width: this._props.columnWidth() || undefined, border: this.selected ? `solid 2px ${Colors.MEDIUM_BLUE}` : undefined }}>
{this.content}