From c2a2b8c119c44b167310485cede0920f313cd40a Mon Sep 17 00:00:00 2001
From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com>
Date: Tue, 11 Jun 2024 01:56:17 -0400
Subject: rowmenu info icons

---
 .../collectionSchema/CollectionSchemaView.tsx      | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

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

diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
index dc29e7413..4abbc7f51 100644
--- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
+++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
@@ -201,7 +201,7 @@ export class CollectionSchemaView extends CollectionSubView() {
         this._docs = this._docs.filter(d => d !== doc)
     }
 
-    rowIndex = (doc: Doc) => this.displayedDocs.docs.indexOf(doc);
+    rowIndex = (doc: Doc) => this.draggedSpliceDocs.docs.indexOf(doc);
 
     @action
     onKeyDown = (e: KeyboardEvent) => {
@@ -211,9 +211,9 @@ export class CollectionSchemaView extends CollectionSubView() {
                     {
                         const lastDoc = this._selectedDocs.lastElement();
                         const lastIndex = this.rowIndex(lastDoc);
-                        const curDoc = this.displayedDocs.docs[lastIndex];
+                        const curDoc = this.docs[lastIndex];
                         if (lastIndex >= 0 && lastIndex < this.childDocs.length - 1) {
-                            const newDoc = this.displayedDocs.docs[lastIndex + 1];
+                            const newDoc = this.docs[lastIndex + 1];
                             if (this._selectedDocs.includes(newDoc)) {
                                 DocumentView.DeselectView(DocumentView.getFirstDocumentView(curDoc));
                                 this.deselectCell(curDoc);
@@ -230,9 +230,9 @@ export class CollectionSchemaView extends CollectionSubView() {
                     {
                         const firstDoc = this._selectedDocs.lastElement();
                         const firstIndex = this.rowIndex(firstDoc);
-                        const curDoc = this.displayedDocs.docs[firstIndex];
+                        const curDoc = this.docs[firstIndex];
                         if (firstIndex > 0 && firstIndex < this.childDocs.length) {
-                            const newDoc = this.displayedDocs.docs[firstIndex - 1];
+                            const newDoc = this.docs[firstIndex - 1];
                             if (this._selectedDocs.includes(newDoc)) {
                                 DocumentView.DeselectView(DocumentView.getFirstDocumentView(curDoc));
                                 this.deselectCell(curDoc);
@@ -514,7 +514,7 @@ export class CollectionSchemaView extends CollectionSubView() {
         const startRow = Math.min(lastSelectedRow, index);
         const endRow = Math.max(lastSelectedRow, index);
         for (let i = startRow; i <= endRow; i++) {
-            const currDoc = this.displayedDocs.docs[i];
+            const currDoc = this.docs[i];
             if (!this._selectedDocs.includes(currDoc)) {
                 this.selectCell(currDoc, this._selectedCol, false, true);
             }
@@ -555,8 +555,6 @@ export class CollectionSchemaView extends CollectionSubView() {
         this._lowestSelectedIndex = -1;
     };
 
-    sortedSelectedDocs = () => this.displayedDocs.docs.filter(doc => this._selectedDocs.includes(doc));
-
     @computed
     get rowDropIndex() {
         const mouseY = this.ScreenToLocalBoxXf().transformPoint(this._mouseCoordinates.x, this._mouseCoordinates.y)[1];
@@ -587,7 +585,7 @@ export class CollectionSchemaView extends CollectionSubView() {
 
         const draggedDocs = de.complete.docDragData?.draggedDocuments;
         if (draggedDocs && super.onInternalDrop(e, de) && !this.sortField) {
-            const docs = this.displayedDocs.docs.slice();
+            const docs = this.draggedSpliceDocs.docs.slice();
             this._docs = docs;
             this.clearSelection();
             draggedDocs.forEach(doc => {
@@ -719,7 +717,7 @@ export class CollectionSchemaView extends CollectionSubView() {
     };
 
     setCellValues = (key: string, value: string) => {
-        if (this._selectedCells.length === 1) this.childDocs.forEach(doc => !doc._lockedSchemaEditing &&Doc.SetField(doc, key, value)); // if only one cell selected, fill all
+        if (this._selectedCells.length === 1) this.docs.forEach(doc => !doc._lockedSchemaEditing &&Doc.SetField(doc, key, value)); // if only one cell selected, fill all
         else this._selectedCells.forEach(doc => !doc._lockedSchemaEditing && Doc.SetField(doc, key, value)); // else only fill selected cells
         return true;
     };
@@ -1037,7 +1035,7 @@ export class CollectionSchemaView extends CollectionSubView() {
         return docs;
     }
     
-    @computed get displayedDocs() {
+    @computed get draggedSpliceDocs() {
         const draggedDocs = this.isContentActive() ? DragManager.docsBeingDragged : [];
         let docs = [...this.docs];
         docs = docs.filter(d => !draggedDocs.includes(d));
@@ -1064,7 +1062,7 @@ export class CollectionSchemaView extends CollectionSubView() {
     screenToLocal = () => this.ScreenToLocalBoxXf().translate(-this.tableWidth, 0);
     previewWidthFunc = () => this.previewWidth;
     onPassiveWheel = (e: WheelEvent) => e.stopPropagation();
-    displayedDocsFunc = () => this.displayedDocs.docs;
+    displayedDocsFunc = () => this.draggedSpliceDocs.docs;
     _oldWheel: any;
     render() {
         return (
-- 
cgit v1.2.3-70-g09d2

