From be5c28d20f4c3af1a20b03fe8e93c8fd551e99e6 Mon Sep 17 00:00:00 2001
From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com>
Date: Tue, 19 Mar 2024 00:56:01 -0400
Subject: multiple cell selection started

---
 .../collections/collectionSchema/SchemaTableCell.tsx  | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

(limited to 'src/client/views/collections/collectionSchema/SchemaTableCell.tsx')

diff --git a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx
index 46867665d..85b3158a8 100644
--- a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx
+++ b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx
@@ -36,7 +36,7 @@ export interface SchemaTableCellProps {
     col: number;
     deselectCell: () => void;
     selectCell: (doc: Doc, col: number) => void;
-    selectedCell: () => [Doc, number] | undefined;
+    selectedCell: () => [Doc[], number] | undefined;
     fieldKey: string;
     maxWidth?: () => number;
     columnWidth: () => number;
@@ -107,8 +107,8 @@ export class SchemaTableCell extends ObservableReactComponent<SchemaTableCellPro
     }
 
     @computed get selected() {
-        const selected: [Doc, number] | undefined = this._props.selectedCell();
-        return this._props.isRowActive() && selected?.[0] === this._props.Document && selected[1] === this._props.col;
+        const selected = this._props.selectedCell();
+        return this._props.isRowActive() && (selected && selected[0]?.filter(doc => doc === this._props.Document).length !== 0) && selected[1] === this._props.col;
     }
 
     @computed get defaultCellContent() {
@@ -309,8 +309,9 @@ export class SchemaRTFCell extends ObservableReactComponent<SchemaTableCellProps
     }
 
     @computed get selected() {
-        const selected: [Doc, number] | undefined = this._props.selectedCell();
-        return this._props.isRowActive() && selected?.[0] === this._props.Document && selected[1] === this._props.col;
+        const selected = this._props.selectedCell();
+        return this._props.isRowActive() && (selected && selected[0]?.filter(doc => doc === this._props.Document).length !== 0) && selected[1] === this._props.col;
+        //return this._props.isRowActive() && selected?.[0] === this._props.Document && selected[1] === this._props.col;
     }
     selectedFunc = () => this.selected;
     render() {
@@ -331,8 +332,8 @@ export class SchemaBoolCell extends ObservableReactComponent<SchemaTableCellProp
     }
 
     @computed get selected() {
-        const selected: [Doc, number] | undefined = this._props.selectedCell();
-        return this._props.isRowActive() && selected?.[0] === this._props.Document && selected[1] === this._props.col;
+        const selected = this._props.selectedCell();
+        return this._props.isRowActive() && (selected && selected[0]?.filter(doc => doc === this._props.Document).length !== 0) && selected[1] === this._props.col;
     }
     render() {
         const { color, textDecoration, fieldProps, cursor, pointerEvents } = SchemaTableCell.renderProps(this._props);
@@ -375,8 +376,8 @@ export class SchemaEnumerationCell extends ObservableReactComponent<SchemaTableC
     }
 
     @computed get selected() {
-        const selected: [Doc, number] | undefined = this._props.selectedCell();
-        return this._props.isRowActive() && selected?.[0] === this._props.Document && selected[1] === this._props.col;
+        const selected = this._props.selectedCell();
+        return this._props.isRowActive() && (selected && selected[0]?.filter(doc => doc === this._props.Document).length !== 0) && selected[1] === this._props.col;
     }
     render() {
         const { color, textDecoration, fieldProps, cursor, pointerEvents } = SchemaTableCell.renderProps(this._props);
-- 
cgit v1.2.3-70-g09d2

