From 0484376a5a1f723261d79d5acc52c7416b79174b Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Tue, 27 Feb 2024 14:20:38 -0500 Subject: icon change --- src/client/views/nodes/ImageBox.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/client/views/nodes') diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx index 923aead64..6bd11e43a 100644 --- a/src/client/views/nodes/ImageBox.tsx +++ b/src/client/views/nodes/ImageBox.tsx @@ -302,7 +302,7 @@ export class ImageBox extends ViewBoxAnnotatableComponent() impl background: usePath === undefined ? 'white' : usePath === 'alternate' ? 'black' : 'gray', color: usePath === undefined ? 'black' : 'white', }}> - + ); -- cgit v1.2.3-70-g09d2 From a938946417035f479e61216ebb0ca72507ef4fad Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Tue, 27 Feb 2024 14:27:20 -0500 Subject: icon --- src/client/views/nodes/ImageBox.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/client/views/nodes') diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx index 6bd11e43a..58674bca9 100644 --- a/src/client/views/nodes/ImageBox.tsx +++ b/src/client/views/nodes/ImageBox.tsx @@ -302,7 +302,7 @@ export class ImageBox extends ViewBoxAnnotatableComponent() impl background: usePath === undefined ? 'white' : usePath === 'alternate' ? 'black' : 'gray', color: usePath === undefined ? 'black' : 'white', }}> - + ); -- cgit v1.2.3-70-g09d2 From 1fd64d58063eba2ba2663a48a5f75ddb40dc1ecd Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Tue, 27 Feb 2024 14:28:14 -0500 Subject: icon3 --- src/client/views/nodes/ImageBox.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/client/views/nodes') diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx index 58674bca9..923aead64 100644 --- a/src/client/views/nodes/ImageBox.tsx +++ b/src/client/views/nodes/ImageBox.tsx @@ -302,7 +302,7 @@ export class ImageBox extends ViewBoxAnnotatableComponent() impl background: usePath === undefined ? 'white' : usePath === 'alternate' ? 'black' : 'gray', color: usePath === undefined ? 'black' : 'white', }}> - + ); -- cgit v1.2.3-70-g09d2 From a4e4cdb00d0ae986b1232aa26a0fe3a45ee9d418 Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Tue, 27 Feb 2024 14:38:46 -0500 Subject: 4 --- src/client/views/nodes/ImageBox.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/client/views/nodes') diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx index 923aead64..d8c67d788 100644 --- a/src/client/views/nodes/ImageBox.tsx +++ b/src/client/views/nodes/ImageBox.tsx @@ -302,7 +302,7 @@ export class ImageBox extends ViewBoxAnnotatableComponent() impl background: usePath === undefined ? 'white' : usePath === 'alternate' ? 'black' : 'gray', color: usePath === undefined ? 'black' : 'white', }}> - + ); -- cgit v1.2.3-70-g09d2 From 729d6fda0a81330661936967aa8af9928e432095 Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Tue, 27 Feb 2024 14:45:02 -0500 Subject: 5 --- src/client/views/nodes/ImageBox.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/client/views/nodes') diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx index d8c67d788..ea52f1c78 100644 --- a/src/client/views/nodes/ImageBox.tsx +++ b/src/client/views/nodes/ImageBox.tsx @@ -302,7 +302,7 @@ export class ImageBox extends ViewBoxAnnotatableComponent() impl background: usePath === undefined ? 'white' : usePath === 'alternate' ? 'black' : 'gray', color: usePath === undefined ? 'black' : 'white', }}> - + ); -- cgit v1.2.3-70-g09d2 From 9f8210f6acd943dc198c0d5d249e74650209541d Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Tue, 27 Feb 2024 14:49:53 -0500 Subject: icon final? --- src/client/views/nodes/ImageBox.tsx | 2 +- src/mobile/MobileInterface.tsx | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src/client/views/nodes') diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx index ea52f1c78..6bd11e43a 100644 --- a/src/client/views/nodes/ImageBox.tsx +++ b/src/client/views/nodes/ImageBox.tsx @@ -302,7 +302,7 @@ export class ImageBox extends ViewBoxAnnotatableComponent() impl background: usePath === undefined ? 'white' : usePath === 'alternate' ? 'black' : 'gray', color: usePath === undefined ? 'black' : 'white', }}> - + ); diff --git a/src/mobile/MobileInterface.tsx b/src/mobile/MobileInterface.tsx index c31e73b42..3e79f8312 100644 --- a/src/mobile/MobileInterface.tsx +++ b/src/mobile/MobileInterface.tsx @@ -60,6 +60,7 @@ import { faLongArrowAltLeft, faLongArrowAltRight, faMicrophone, + faCircleHalfStroke, faMinus, faMobile, faMousePointer, @@ -196,6 +197,7 @@ library.add( faHighlighter, faLongArrowAltRight, faMicrophone, + faCircleHalfStroke, faMousePointer, faMusic, faObjectGroup, -- cgit v1.2.3-70-g09d2 From 6b87703bff0e26489ae5e7757b7a622a7143a51d Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Sun, 17 Mar 2024 13:51:01 -0400 Subject: DocView 1330 problem statement --- src/client/util/SelectionManager.ts | 4 +--- .../views/collections/collectionSchema/CollectionSchemaView.tsx | 1 - src/client/views/nodes/DocumentView.tsx | 6 +++--- 3 files changed, 4 insertions(+), 7 deletions(-) (limited to 'src/client/views/nodes') diff --git a/src/client/util/SelectionManager.ts b/src/client/util/SelectionManager.ts index 0862cf20e..f3b2acb5e 100644 --- a/src/client/util/SelectionManager.ts +++ b/src/client/util/SelectionManager.ts @@ -34,9 +34,7 @@ export class SelectionManager { public static SelectView = action((docView: DocumentView | undefined, extendSelection: boolean): void => { if (!docView) this.DeselectAll(); else if (!docView.IsSelected) { - if (!extendSelection) { - this.DeselectAll(); - }; + if (!extendSelection) this.DeselectAll(); this.Instance.SelectedViews.push(docView); docView.IsSelected = true; docView._props.whenChildContentsActiveChanged(true); diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx index 4e90f5006..e6c13d11e 100644 --- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx +++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx @@ -420,7 +420,6 @@ export class CollectionSchemaView extends CollectionSubView() { @action clearSelection = () => { SelectionManager.DeselectAll() - console.log(2); }; selectRows = (doc: Doc, lastSelected: Doc) => { diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index abb1aa59f..38e60721f 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -1325,8 +1325,8 @@ export class DocumentView extends DocComponent() { screenToLocalScale = () => this._props.ScreenToLocalTransform().Scale; isSelected = () => this.IsSelected; select = (extendSelection: boolean, focusSelection?: boolean) => { - if (this.IsSelected && SelectionManager.Views.length > 1) SelectionManager.DeselectView(this); - else { + /*if (this.IsSelected && SelectionManager.Views.length > 1) SelectionManager.DeselectView(this); + else {*/ SelectionManager.SelectView(this, extendSelection); if (focusSelection) { DocumentManager.Instance.showDocument(this.Document, { @@ -1335,7 +1335,7 @@ export class DocumentView extends DocComponent() { zoomTime: 500, }); } - } + /*}*/ }; DataTransition = () => this._props.DataTransition?.() || StrCast(this.Document.dataTransition); ShouldNotScale = () => this.shouldNotScale; -- cgit v1.2.3-70-g09d2 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 --- src/client/util/SelectionManager.ts | 3 +- .../collectionSchema/CollectionSchemaView.tsx | 36 +++++++++++++--------- .../collections/collectionSchema/SchemaRowBox.tsx | 6 ++-- .../collectionSchema/SchemaTableCell.tsx | 19 ++++++------ src/client/views/nodes/DocumentView.tsx | 2 +- 5 files changed, 38 insertions(+), 28 deletions(-) (limited to 'src/client/views/nodes') diff --git a/src/client/util/SelectionManager.ts b/src/client/util/SelectionManager.ts index f3b2acb5e..6f6278662 100644 --- a/src/client/util/SelectionManager.ts +++ b/src/client/util/SelectionManager.ts @@ -9,6 +9,7 @@ import { DocumentView } from '../views/nodes/DocumentView'; import { LinkManager } from './LinkManager'; import { ScriptingGlobals } from './ScriptingGlobals'; import { UndoManager } from './UndoManager'; +import { SchemaRowBox } from '../views/collections/collectionSchema/SchemaRowBox'; export class SelectionManager { private static _manager: SelectionManager; @@ -43,7 +44,6 @@ export class SelectionManager { }); public static DeselectView = action((docView?: DocumentView): void => { - console.log(3); if (docView && this.Instance.SelectedViews.includes(docView)) { docView.IsSelected = false; this.Instance.SelectedViews.splice(this.Instance.SelectedViews.indexOf(docView), 1); @@ -63,6 +63,7 @@ export class SelectionManager { dv._props.whenChildContentsActiveChanged(false); }); runInAction(() => (this.Instance.SelectedViews.length = 0)); + //not responsible for select onPointerDown if (found) this.SelectView(found, false); }; diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx index d179a00ca..b78bd5558 100644 --- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx +++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx @@ -86,7 +86,7 @@ export class CollectionSchemaView extends CollectionSubView() { @observable _filterColumnIndex: number | undefined = undefined; @observable _filterSearchValue: string = ''; //Doc = the row; number = the index of the cell to select within the row - @observable _selectedCell: [Doc, number] | undefined = undefined; + @observable _selectedCells: [Array, number] | undefined; // target HTMLelement portal for showing a popup menu to edit cell values. public get MenuTarget() { @@ -190,13 +190,11 @@ export class CollectionSchemaView extends CollectionSubView() { if (lastIndex >= 0 && lastIndex < this.childDocs.length - 1) { !e.shiftKey && this.clearSelection(); const newDoc = this.sortedDocs.docs[lastIndex + 1]; - const newDoc2 = this.sortedDocs.docs[lastIndex + 2]; if (this._selectedDocs.includes(newDoc)) { SelectionManager.DeselectView(DocumentManager.Instance.getFirstDocumentView(curDoc)); } else { - this.addDocToSelection(newDoc, true, lastIndex + 1); - this.addDocToSelection(newDoc2, true, lastIndex + 2); - this._selectedCell && (this._selectedCell[0] = newDoc); + this.addDocToSelection(newDoc, e.shiftKey, lastIndex + 1); + this.selectCell(newDoc, this._selectedCells ? this._selectedCells[1] : 0); this.scrollToDoc(newDoc, {}); } } @@ -215,7 +213,7 @@ export class CollectionSchemaView extends CollectionSubView() { if (this._selectedDocs.includes(newDoc)) SelectionManager.DeselectView(DocumentManager.Instance.getFirstDocumentView(curDoc)); else { this.addDocToSelection(newDoc, e.shiftKey, firstIndex - 1); - this._selectedCell && (this._selectedCell[0] = newDoc); + this.selectCell(newDoc, this._selectedCells ? this._selectedCells[1] : 0); this.scrollToDoc(newDoc, {}); } } @@ -224,15 +222,15 @@ export class CollectionSchemaView extends CollectionSubView() { } break; case 'ArrowRight': - if (this._selectedCell) { - this._selectedCell[1] = Math.min(this._selectedCell[1] + 1, this.columnKeys.length - 1); + if (this._selectedCells) { + this._selectedCells[1] = Math.min(this._selectedCells[1] + 1, this.columnKeys.length - 1); } else if (this._selectedDocs.length > 0) { this.selectCell(this._selectedDocs[0], 0); } break; case 'ArrowLeft': - if (this._selectedCell) { - this._selectedCell[1] = Math.max(this._selectedCell[1] - 1, 0); + if (this._selectedCells) { + this._selectedCells[1] = Math.max(this._selectedCells[1] - 1, 0); } else if (this._selectedDocs.length > 0) { this.selectCell(this._selectedDocs[0], 0); } @@ -242,7 +240,7 @@ export class CollectionSchemaView extends CollectionSubView() { break; } case 'Escape': { - this.deselectCell(); + this.deselectAllCells(); } } } @@ -414,7 +412,6 @@ export class CollectionSchemaView extends CollectionSubView() { @action addDocToSelection = (doc: Doc, extendSelection: boolean, index: number) => { - console.log("addDoc called"); const rowDocView = DocumentManager.Instance.getDocumentView(doc); if (rowDocView) SelectionManager.SelectView(rowDocView, extendSelection); }; @@ -437,10 +434,21 @@ export class CollectionSchemaView extends CollectionSubView() { }; @action - selectCell = (doc: Doc, index: number) => (this._selectedCell = [doc, index]); + selectCell = (doc: Doc, index: number) => { + !this._selectedCells && (this._selectedCells = [[doc], index]); + this._selectedCells[0].push(doc); + this._selectedCells[1] = index; + }; @action - deselectCell = () => (this._selectedCell = undefined); + deselectCell = (doc: Doc) => { + this._selectedCells && this._selectedCells[0].filter(d => d !== doc); + }; + + @action + deselectAllCells = () => { + this._selectedCells = [[], 0]; + } sortedSelectedDocs = () => this.sortedDocs.docs.filter(doc => this._selectedDocs.includes(doc)); diff --git a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx index c30eee237..36e58d610 100644 --- a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx +++ b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx @@ -59,7 +59,7 @@ export class SchemaRowBox extends ViewBoxBaseComponent() { const lastSelected = Array.from(this.schemaView._selectedDocs).lastElement(); if (shiftKey && lastSelected) this.schemaView.selectRows(this.Document, lastSelected); else { - this._props.select?.(ctrlKey); + this.schemaView.addDocToSelection(this.Document, false, 0); } }; @@ -100,8 +100,8 @@ export class SchemaRowBox extends ViewBoxBaseComponent() { getFinfo = computedFn((fieldKey: string) => this.schemaView?.fieldInfos.get(fieldKey)); selectCell = (doc: Doc, col: number) => this.schemaView?.selectCell(doc, col); - deselectCell = () => this.schemaView?.deselectCell(); - selectedCell = () => this.schemaView?._selectedCell; + deselectCell = () => this.schemaView?.deselectAllCells(); + selectedCell = () => this.schemaView?._selectedCells; setColumnValues = (field: any, value: any) => this.schemaView?.setColumnValues(field, value) ?? false; columnWidth = computedFn((index: number) => () => this.schemaView?.displayColumnWidths[index] ?? CollectionSchemaView._minColWidth); render() { 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 doc === this._props.Document).length !== 0) && selected[1] === this._props.col; } @computed get defaultCellContent() { @@ -309,8 +309,9 @@ export class SchemaRTFCell extends ObservableReactComponent 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 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 doc === this._props.Document).length !== 0) && selected[1] === this._props.col; } render() { const { color, textDecoration, fieldProps, cursor, pointerEvents } = SchemaTableCell.renderProps(this._props); diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index 38e60721f..a46426e0b 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -360,7 +360,7 @@ export class DocumentViewInternal extends DocComponent (sendToBack ? documentView._props.bringToFront?.(this.Document, true) : + clickFunc ?? (() => (sendToBack ? documentView._props.bringToFront?.(this.Document, true) : this._props.select(e.ctrlKey||e.shiftKey, e.metaKey))); const waitFordblclick = this._props.waitForDoubleClickToClick?.() ?? this.Document.waitForDoubleClickToClick; if ((clickFunc && waitFordblclick !== 'never') || waitFordblclick === 'always') { -- cgit v1.2.3-70-g09d2 From 8cc8c972c73ea52e6be3d6dc25d9abc6905327df Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Tue, 19 Mar 2024 17:49:44 -0400 Subject: routing select through selectCell; shift select kind of working; cell selection updating still broken; cell select with shift select broken --- .../collectionSchema/CollectionSchemaView.tsx | 43 ++++++++++++++++------ .../collections/collectionSchema/SchemaRowBox.tsx | 4 +- .../collectionSchema/SchemaTableCell.tsx | 22 ++++++----- src/client/views/nodes/DocumentView.tsx | 2 +- .../views/nodes/formattedText/DashFieldView.tsx | 2 +- 5 files changed, 47 insertions(+), 26 deletions(-) (limited to 'src/client/views/nodes') diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx index b78bd5558..33ae8aad1 100644 --- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx +++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx @@ -25,6 +25,7 @@ import { CollectionSubView } from '../CollectionSubView'; import './CollectionSchemaView.scss'; import { SchemaColumnHeader } from './SchemaColumnHeader'; import { SchemaRowBox } from './SchemaRowBox'; +import { faLessThanEqual } from '@fortawesome/free-solid-svg-icons'; const { default: { SCHEMA_NEW_NODE_HEIGHT } } = require('../../global/globalCssVariables.module.scss'); // prettier-ignore export enum ColumnType { @@ -85,7 +86,8 @@ export class CollectionSchemaView extends CollectionSubView() { @observable _menuValue: string = ''; @observable _filterColumnIndex: number | undefined = undefined; @observable _filterSearchValue: string = ''; - //Doc = the row; number = the index of the cell to select within the row + //an array of selected docs and the index representing the selected column + @observable selectedCol: number = 0; @observable _selectedCells: [Array, number] | undefined; // target HTMLelement portal for showing a popup menu to edit cell values. @@ -194,7 +196,7 @@ export class CollectionSchemaView extends CollectionSubView() { SelectionManager.DeselectView(DocumentManager.Instance.getFirstDocumentView(curDoc)); } else { this.addDocToSelection(newDoc, e.shiftKey, lastIndex + 1); - this.selectCell(newDoc, this._selectedCells ? this._selectedCells[1] : 0); + this.selectCell(newDoc, this._selectedCells ? this._selectedCells[1] : 0, false); this.scrollToDoc(newDoc, {}); } } @@ -213,7 +215,7 @@ export class CollectionSchemaView extends CollectionSubView() { if (this._selectedDocs.includes(newDoc)) SelectionManager.DeselectView(DocumentManager.Instance.getFirstDocumentView(curDoc)); else { this.addDocToSelection(newDoc, e.shiftKey, firstIndex - 1); - this.selectCell(newDoc, this._selectedCells ? this._selectedCells[1] : 0); + this.selectCell(newDoc, this._selectedCells ? this._selectedCells[1] + 1 : 0, false); this.scrollToDoc(newDoc, {}); } } @@ -223,17 +225,13 @@ export class CollectionSchemaView extends CollectionSubView() { break; case 'ArrowRight': if (this._selectedCells) { - this._selectedCells[1] = Math.min(this._selectedCells[1] + 1, this.columnKeys.length - 1); + this.selectCell(this._selectedCells[0][0], this._selectedCells[1] + 1, false); } else if (this._selectedDocs.length > 0) { - this.selectCell(this._selectedDocs[0], 0); + this.selectCell(this._selectedDocs[0], 0, false); } break; case 'ArrowLeft': - if (this._selectedCells) { - this._selectedCells[1] = Math.max(this._selectedCells[1] - 1, 0); - } else if (this._selectedDocs.length > 0) { - this.selectCell(this._selectedDocs[0], 0); - } + this.changeSelectedCellColumn(); break; case 'Backspace': { this.removeDocument(this._selectedDocs); @@ -246,6 +244,15 @@ export class CollectionSchemaView extends CollectionSubView() { } }; + @action + changeSelectedCellColumn = () => { + if (this._selectedCells) { + this._selectedCells[1] = Math.max(this._selectedCells[1] - 1, 0); + } else if (this._selectedDocs.length > 0) { + this.selectCell(this._selectedDocs[0], 0, false); + } + } + @undoBatch setColumnSort = (field: string | undefined, desc: boolean = false) => { this.layoutDoc.sortField = field; @@ -412,6 +419,7 @@ export class CollectionSchemaView extends CollectionSubView() { @action addDocToSelection = (doc: Doc, extendSelection: boolean, index: number) => { + //console.log("doc added"); const rowDocView = DocumentManager.Instance.getDocumentView(doc); if (rowDocView) SelectionManager.SelectView(rowDocView, extendSelection); }; @@ -427,6 +435,8 @@ export class CollectionSchemaView extends CollectionSubView() { const lastSelectedRow = this.rowIndex(lastSelected); const startRow = Math.min(lastSelectedRow, index); const endRow = Math.max(lastSelectedRow, index); + console.log(lastSelectedRow); + console.log("start: " + startRow + " end: " + endRow); for (let i = startRow; i <= endRow; i++) { const currDoc = this.sortedDocs.docs[i]; if (!this._selectedDocs.includes(currDoc)) this.addDocToSelection(currDoc, true, i); @@ -434,10 +444,19 @@ export class CollectionSchemaView extends CollectionSubView() { }; @action - selectCell = (doc: Doc, index: number) => { + selectCell = (doc: Doc, index: number, shiftKey: boolean) => { + //console.log("cellSelect"); + //console.log(shiftKey); + shiftKey = true; !this._selectedCells && (this._selectedCells = [[doc], index]); this._selectedCells[0].push(doc); this._selectedCells[1] = index; + if (!this) return; + const lastSelected = Array.from(this._selectedDocs).lastElement(); + if (shiftKey && lastSelected) this.selectRows(doc, lastSelected); + else { + this.addDocToSelection(doc, false, 0); + } }; @action @@ -447,7 +466,7 @@ export class CollectionSchemaView extends CollectionSubView() { @action deselectAllCells = () => { - this._selectedCells = [[], 0]; + this._selectedCells = undefined; } sortedSelectedDocs = () => this.sortedDocs.docs.filter(doc => this._selectedDocs.includes(doc)); diff --git a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx index 36e58d610..0ef78fe07 100644 --- a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx +++ b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx @@ -99,7 +99,7 @@ export class SchemaRowBox extends ViewBoxBaseComponent() { }; getFinfo = computedFn((fieldKey: string) => this.schemaView?.fieldInfos.get(fieldKey)); - selectCell = (doc: Doc, col: number) => this.schemaView?.selectCell(doc, col); + selectCell = (doc: Doc, col: number, shift: boolean) => this.schemaView?.selectCell(doc, col, shift); deselectCell = () => this.schemaView?.deselectAllCells(); selectedCell = () => this.schemaView?._selectedCells; setColumnValues = (field: any, value: any) => this.schemaView?.setColumnValues(field, value) ?? false; @@ -186,7 +186,7 @@ export class SchemaRowBox extends ViewBoxBaseComponent() { getFinfo={this.getFinfo} selectCell={this.selectCell} deselectCell={this.deselectCell} - selectedCell={this.selectedCell} + selectedCells={this.selectedCell} setColumnValues={this.setColumnValues} oneLine={BoolCast(this.schemaDoc?._singleLine)} menuTarget={this.schemaView.MenuTarget} diff --git a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx index 85b3158a8..2769b5042 100644 --- a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx +++ b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx @@ -4,7 +4,7 @@ import { extname } from 'path'; import * as React from 'react'; import DatePicker from 'react-datepicker'; import Select from 'react-select'; -import { Utils, emptyFunction, returnEmptyDoclist, returnEmptyFilter, returnFalse, returnZero } from '../../../../Utils'; +import { Utils, emptyFunction, returnEmptyDoclist, returnEmptyFilter, returnFalse, returnTrue, returnZero } from '../../../../Utils'; import { DateField } from '../../../../fields/DateField'; import { Doc, DocListCast, Field } from '../../../../fields/Doc'; import { RichTextField } from '../../../../fields/RichTextField'; @@ -35,8 +35,8 @@ export interface SchemaTableCellProps { Document: Doc; col: number; deselectCell: () => void; - selectCell: (doc: Doc, col: number) => void; - selectedCell: () => [Doc[], number] | undefined; + selectCell: (doc: Doc, col: number, shift: boolean) => void; + selectedCells: () => [Doc[], number] | undefined; fieldKey: string; maxWidth?: () => number; columnWidth: () => number; @@ -76,7 +76,7 @@ export class SchemaTableCell extends ObservableReactComponent doc === this._props.Document).length !== 0) && selected[1] === this._props.col; + const selected = this._props.selectedCells(); + let istrue = this._props.isRowActive() && (selected && selected[0]?.filter(doc => doc === this._props.Document).length !== 0) && selected[1] === this._props.col; + //console.log("col: " + this._props.col + "true: " + istrue); + return istrue; } @computed get defaultCellContent() { @@ -177,7 +179,7 @@ export class SchemaTableCell extends ObservableReactComponent !this.selected && this._props.selectCell(this._props.Document, this._props.col))} + onPointerDown={action(e => !this.selected && this._props.selectCell(this._props.Document, this._props.col, e.shiftKey))} 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} @@ -309,7 +311,7 @@ export class SchemaRTFCell extends ObservableReactComponent 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; } @@ -332,7 +334,7 @@ export class SchemaBoolCell extends ObservableReactComponent doc === this._props.Document).length !== 0) && selected[1] === this._props.col; } render() { @@ -376,7 +378,7 @@ export class SchemaEnumerationCell extends ObservableReactComponent doc === this._props.Document).length !== 0) && selected[1] === this._props.col; } render() { diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index a46426e0b..c957e7429 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -1335,7 +1335,7 @@ export class DocumentView extends DocComponent() { zoomTime: 500, }); } - /*}*/ + //} }; DataTransition = () => this._props.DataTransition?.() || StrCast(this.Document.dataTransition); ShouldNotScale = () => this.shouldNotScale; diff --git a/src/client/views/nodes/formattedText/DashFieldView.tsx b/src/client/views/nodes/formattedText/DashFieldView.tsx index b49e7dcf0..b0c35b161 100644 --- a/src/client/views/nodes/formattedText/DashFieldView.tsx +++ b/src/client/views/nodes/formattedText/DashFieldView.tsx @@ -140,7 +140,7 @@ export class DashFieldViewInternal extends ObservableReactComponent this._props.tbox._props.PanelWidth() - 20 : returnZero} - selectedCell={() => [this._dashDoc!, 0]} + selectedCells={() => [this._dashDoc!, 0]} fieldKey={this._fieldKey} rowHeight={returnZero} isRowActive={() => this._expanded && this._props.editable} -- cgit v1.2.3-70-g09d2 From a598877cc71c1f2a25e8cac4b831ab947a2539e0 Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Thu, 21 Mar 2024 00:05:32 -0400 Subject: editing all selected cols working --- .../collectionSchema/CollectionSchemaView.tsx | 84 +++++++++++++++------- .../collections/collectionSchema/SchemaRowBox.tsx | 2 + .../collectionSchema/SchemaTableCell.tsx | 14 +++- .../views/nodes/formattedText/DashFieldView.tsx | 3 +- 4 files changed, 75 insertions(+), 28 deletions(-) (limited to 'src/client/views/nodes') diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx index 33ae8aad1..60b3ae4ab 100644 --- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx +++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx @@ -190,13 +190,14 @@ export class CollectionSchemaView extends CollectionSubView() { const lastIndex = this.rowIndex(lastDoc); const curDoc = this.sortedDocs.docs[lastIndex]; if (lastIndex >= 0 && lastIndex < this.childDocs.length - 1) { - !e.shiftKey && this.clearSelection(); const newDoc = this.sortedDocs.docs[lastIndex + 1]; if (this._selectedDocs.includes(newDoc)) { SelectionManager.DeselectView(DocumentManager.Instance.getFirstDocumentView(curDoc)); + this.deselectCell(curDoc); + } else { - this.addDocToSelection(newDoc, e.shiftKey, lastIndex + 1); - this.selectCell(newDoc, this._selectedCells ? this._selectedCells[1] : 0, false); + const shift: boolean = e.shiftKey; + this.selectCell(newDoc, this._selectedCells ? this._selectedCells[1] : 2, shift); this.scrollToDoc(newDoc, {}); } } @@ -210,12 +211,14 @@ export class CollectionSchemaView extends CollectionSubView() { const firstIndex = this.rowIndex(firstDoc); const curDoc = this.sortedDocs.docs[firstIndex]; if (firstIndex > 0 && firstIndex < this.childDocs.length) { - !e.shiftKey && this.clearSelection(); const newDoc = this.sortedDocs.docs[firstIndex - 1]; - if (this._selectedDocs.includes(newDoc)) SelectionManager.DeselectView(DocumentManager.Instance.getFirstDocumentView(curDoc)); - else { - this.addDocToSelection(newDoc, e.shiftKey, firstIndex - 1); - this.selectCell(newDoc, this._selectedCells ? this._selectedCells[1] + 1 : 0, false); + if (this._selectedDocs.includes(newDoc)){ + SelectionManager.DeselectView(DocumentManager.Instance.getFirstDocumentView(curDoc)) + this.deselectCell(curDoc); + } else { + const shift: boolean = e.shiftKey; + + this.selectCell(newDoc, this._selectedCells ? this._selectedCells[1] : 2, shift); this.scrollToDoc(newDoc, {}); } } @@ -231,7 +234,13 @@ export class CollectionSchemaView extends CollectionSubView() { } break; case 'ArrowLeft': - this.changeSelectedCellColumn(); + if (this._selectedCells) { + this._selectedCells = undefined; + //this._selectedCells = [this._selectedCells[0], 2] + //this._selectedCells[1] = Math.max(this._selectedCells[1] - 1, 0); + } else if (this._selectedDocs.length > 0) { + this.selectCell(this._selectedDocs[0], 0, false); + } break; case 'Backspace': { this.removeDocument(this._selectedDocs); @@ -246,11 +255,7 @@ export class CollectionSchemaView extends CollectionSubView() { @action changeSelectedCellColumn = () => { - if (this._selectedCells) { - this._selectedCells[1] = Math.max(this._selectedCells[1] - 1, 0); - } else if (this._selectedDocs.length > 0) { - this.selectCell(this._selectedDocs[0], 0, false); - } + } @undoBatch @@ -422,11 +427,14 @@ export class CollectionSchemaView extends CollectionSubView() { //console.log("doc added"); const rowDocView = DocumentManager.Instance.getDocumentView(doc); if (rowDocView) SelectionManager.SelectView(rowDocView, extendSelection); + //let selectedIndexes: Array = this._selectedDocs.map(doc => this.rowIndex(doc)); + //console.log(selectedIndexes); }; @action clearSelection = () => { - SelectionManager.DeselectAll() + SelectionManager.DeselectAll(); + this.deselectAllCells(); }; //This method is called in SchemaRowBox.select, which is never called anywhere @@ -435,33 +443,41 @@ export class CollectionSchemaView extends CollectionSubView() { const lastSelectedRow = this.rowIndex(lastSelected); const startRow = Math.min(lastSelectedRow, index); const endRow = Math.max(lastSelectedRow, index); - console.log(lastSelectedRow); - console.log("start: " + startRow + " end: " + endRow); + //console.log(lastSelectedRow); + //console.log("start: " + startRow + " end: " + endRow); for (let i = startRow; i <= endRow; i++) { const currDoc = this.sortedDocs.docs[i]; if (!this._selectedDocs.includes(currDoc)) this.addDocToSelection(currDoc, true, i); + this._selectedCells && this._selectedCells[0].push(currDoc); } }; @action selectCell = (doc: Doc, index: number, shiftKey: boolean) => { - //console.log("cellSelect"); - //console.log(shiftKey); - shiftKey = true; - !this._selectedCells && (this._selectedCells = [[doc], index]); + !shiftKey && this.deselectAllCells(); + !this._selectedCells && (this._selectedCells = [[], index]); this._selectedCells[0].push(doc); this._selectedCells[1] = index; + if (!this) return; const lastSelected = Array.from(this._selectedDocs).lastElement(); if (shiftKey && lastSelected) this.selectRows(doc, lastSelected); else { - this.addDocToSelection(doc, false, 0); + this.addDocToSelection(doc, false, this.rowIndex(doc)); } + + let selectedIndexes: Array = this._selectedCells[0].map(doc => this.rowIndex(doc)); + console.log("cells: " + selectedIndexes); }; @action deselectCell = (doc: Doc) => { - this._selectedCells && this._selectedCells[0].filter(d => d !== doc); + if (this._selectedCells) + this._selectedCells[0] = this._selectedCells[0].filter(d => d !== doc); + if (this._selectedCells){ + let selectedIndexes: Array = this._selectedCells[0].map(doc => this.rowIndex(doc)); + console.log("cells: " + selectedIndexes); + } }; @action @@ -590,7 +606,27 @@ export class CollectionSchemaView extends CollectionSubView() { }; setColumnValues = (key: string, value: string) => { - this.childDocs.forEach(doc => KeyValueBox.SetField(doc, key, value)); + this.childDocs.forEach(doc => { + let docIsSelected = this._selectedCells && !(this._selectedCells[0]?.filter(d => d === doc).length === 0); + console.log(docIsSelected); + if (docIsSelected){ + KeyValueBox.SetField(doc, key, value) + } + } + ); + //this.childDocs.forEach(doc => KeyValueBox.SetField(doc, key, value)); + return true; + }; + + setSelectedColumnValues = (key: string, value: string) => { + console.log("called"); + this.childDocs.forEach(doc => { + let docIsSelected = this._selectedCells && !(this._selectedCells[0]?.filter(d => d === doc).length === 0); + if (docIsSelected){ + KeyValueBox.SetField(doc, key, value) + } + } + ); return true; }; diff --git a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx index 0ef78fe07..af502dd03 100644 --- a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx +++ b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx @@ -103,6 +103,7 @@ export class SchemaRowBox extends ViewBoxBaseComponent() { deselectCell = () => this.schemaView?.deselectAllCells(); selectedCell = () => this.schemaView?._selectedCells; setColumnValues = (field: any, value: any) => this.schemaView?.setColumnValues(field, value) ?? false; + setSelectedColumnValues = (field: any, value: any) => this.schemaView?.setSelectedColumnValues(field, value) ?? false; columnWidth = computedFn((index: number) => () => this.schemaView?.displayColumnWidths[index] ?? CollectionSchemaView._minColWidth); render() { return ( @@ -188,6 +189,7 @@ export class SchemaRowBox extends ViewBoxBaseComponent() { deselectCell={this.deselectCell} selectedCells={this.selectedCell} setColumnValues={this.setColumnValues} + setSelectedColumnValues={this.setSelectedColumnValues} oneLine={BoolCast(this.schemaDoc?._singleLine)} menuTarget={this.schemaView.MenuTarget} transform={() => { diff --git a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx index 2769b5042..cae16be36 100644 --- a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx +++ b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx @@ -45,6 +45,7 @@ export interface SchemaTableCellProps { isRowActive: () => boolean | undefined; getFinfo: (fieldKey: string) => FInfo | undefined; setColumnValues: (field: string, value: string) => boolean; + setSelectedColumnValues: (field: string, value: string) => boolean; oneLine?: boolean; // whether all input should fit on one line vs allowing textare multiline inputs allowCRs?: boolean; // allow carriage returns in text input (othewrise CR ends the edit) finishEdit?: () => void; // notify container that edit is over (eg. to hide view in DashFieldView) @@ -107,7 +108,7 @@ export class SchemaTableCell extends ObservableReactComponent doc === this._props.Document).length !== 0) && selected[1] === this._props.col; //console.log("col: " + this._props.col + "true: " + istrue); return istrue; @@ -135,7 +136,9 @@ export class SchemaTableCell extends ObservableReactComponent { if (shiftDown && enterKey) { this._props.setColumnValues(this._props.fieldKey.replace(/^_/, ''), value); - } + } /*else { + this._props.setSelectedColumnValues(this._props.fieldKey.replace(/^_/, ''), value); + }*/ const ret = KeyValueBox.SetField(this._props.Document, this._props.fieldKey.replace(/^_/, ''), value); this._props.finishEdit?.(); return ret; @@ -179,7 +182,12 @@ export class SchemaTableCell extends ObservableReactComponent !this.selected && this._props.selectCell(this._props.Document, this._props.col, e.shiftKey))} + onPointerDown={action(e => { + console.log(e); + console.log(e.shiftKey); + const shift: boolean = e.shiftKey; + !this.selected && this._props.selectCell(this._props.Document, this._props.col, shift)} + )} 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} diff --git a/src/client/views/nodes/formattedText/DashFieldView.tsx b/src/client/views/nodes/formattedText/DashFieldView.tsx index b0c35b161..631de1241 100644 --- a/src/client/views/nodes/formattedText/DashFieldView.tsx +++ b/src/client/views/nodes/formattedText/DashFieldView.tsx @@ -140,13 +140,14 @@ export class DashFieldViewInternal extends ObservableReactComponent this._props.tbox._props.PanelWidth() - 20 : returnZero} - selectedCells={() => [this._dashDoc!, 0]} + selectedCells={() => [[this._dashDoc!], 0]} fieldKey={this._fieldKey} rowHeight={returnZero} isRowActive={() => this._expanded && this._props.editable} padding={0} getFinfo={emptyFunction} setColumnValues={returnFalse} + setSelectedColumnValues={returnFalse} allowCRs={true} oneLine={!this._expanded} finishEdit={action(() => (this._expanded = false))} -- cgit v1.2.3-70-g09d2 From 9ccbc0a6d6f6fffbc479d37ac2a880eafe85c65d Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Thu, 21 Mar 2024 00:43:08 -0400 Subject: multiple cell column switching working --- .../collectionSchema/CollectionSchemaView.tsx | 35 +++++++++++----------- .../collections/collectionSchema/SchemaRowBox.tsx | 6 ++-- .../collectionSchema/SchemaTableCell.tsx | 15 +++++----- .../views/nodes/formattedText/DashFieldView.tsx | 3 +- 4 files changed, 32 insertions(+), 27 deletions(-) (limited to 'src/client/views/nodes') diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx index 60b3ae4ab..e722e774d 100644 --- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx +++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx @@ -87,8 +87,9 @@ export class CollectionSchemaView extends CollectionSubView() { @observable _filterColumnIndex: number | undefined = undefined; @observable _filterSearchValue: string = ''; //an array of selected docs and the index representing the selected column - @observable selectedCol: number = 0; - @observable _selectedCells: [Array, number] | undefined; + @observable _selectedCol: number = 0; + @observable _selectedCells: Array | undefined; + // target HTMLelement portal for showing a popup menu to edit cell values. public get MenuTarget() { @@ -197,7 +198,7 @@ export class CollectionSchemaView extends CollectionSubView() { } else { const shift: boolean = e.shiftKey; - this.selectCell(newDoc, this._selectedCells ? this._selectedCells[1] : 2, shift); + this.selectCell(newDoc, this._selectedCol, shift); this.scrollToDoc(newDoc, {}); } } @@ -218,7 +219,7 @@ export class CollectionSchemaView extends CollectionSubView() { } else { const shift: boolean = e.shiftKey; - this.selectCell(newDoc, this._selectedCells ? this._selectedCells[1] : 2, shift); + this.selectCell(newDoc, this._selectedCol, shift); this.scrollToDoc(newDoc, {}); } } @@ -228,16 +229,14 @@ export class CollectionSchemaView extends CollectionSubView() { break; case 'ArrowRight': if (this._selectedCells) { - this.selectCell(this._selectedCells[0][0], this._selectedCells[1] + 1, false); + ++this._selectedCol; } else if (this._selectedDocs.length > 0) { this.selectCell(this._selectedDocs[0], 0, false); } break; case 'ArrowLeft': if (this._selectedCells) { - this._selectedCells = undefined; - //this._selectedCells = [this._selectedCells[0], 2] - //this._selectedCells[1] = Math.max(this._selectedCells[1] - 1, 0); + --this._selectedCol; } else if (this._selectedDocs.length > 0) { this.selectCell(this._selectedDocs[0], 0, false); } @@ -448,16 +447,16 @@ export class CollectionSchemaView extends CollectionSubView() { for (let i = startRow; i <= endRow; i++) { const currDoc = this.sortedDocs.docs[i]; if (!this._selectedDocs.includes(currDoc)) this.addDocToSelection(currDoc, true, i); - this._selectedCells && this._selectedCells[0].push(currDoc); + this._selectedCells && this._selectedCells.push(currDoc); } }; @action selectCell = (doc: Doc, index: number, shiftKey: boolean) => { !shiftKey && this.deselectAllCells(); - !this._selectedCells && (this._selectedCells = [[], index]); - this._selectedCells[0].push(doc); - this._selectedCells[1] = index; + !this._selectedCells && (this._selectedCells = []); + this._selectedCells.push(doc); + this._selectedCol = index; if (!this) return; const lastSelected = Array.from(this._selectedDocs).lastElement(); @@ -466,16 +465,18 @@ export class CollectionSchemaView extends CollectionSubView() { this.addDocToSelection(doc, false, this.rowIndex(doc)); } - let selectedIndexes: Array = this._selectedCells[0].map(doc => this.rowIndex(doc)); + let selectedIndexes: Array = this._selectedCells.map(doc => this.rowIndex(doc)); console.log("cells: " + selectedIndexes); + console.log("index: " + this._selectedCol); + }; @action deselectCell = (doc: Doc) => { if (this._selectedCells) - this._selectedCells[0] = this._selectedCells[0].filter(d => d !== doc); + this._selectedCells = this._selectedCells.filter(d => d !== doc); if (this._selectedCells){ - let selectedIndexes: Array = this._selectedCells[0].map(doc => this.rowIndex(doc)); + let selectedIndexes: Array = this._selectedCells.map(doc => this.rowIndex(doc)); console.log("cells: " + selectedIndexes); } }; @@ -607,7 +608,7 @@ export class CollectionSchemaView extends CollectionSubView() { setColumnValues = (key: string, value: string) => { this.childDocs.forEach(doc => { - let docIsSelected = this._selectedCells && !(this._selectedCells[0]?.filter(d => d === doc).length === 0); + let docIsSelected = this._selectedCells && !(this._selectedCells?.filter(d => d === doc).length === 0); console.log(docIsSelected); if (docIsSelected){ KeyValueBox.SetField(doc, key, value) @@ -621,7 +622,7 @@ export class CollectionSchemaView extends CollectionSubView() { setSelectedColumnValues = (key: string, value: string) => { console.log("called"); this.childDocs.forEach(doc => { - let docIsSelected = this._selectedCells && !(this._selectedCells[0]?.filter(d => d === doc).length === 0); + let docIsSelected = this._selectedCells && !(this._selectedCells?.filter(d => d === doc).length === 0); if (docIsSelected){ KeyValueBox.SetField(doc, key, value) } diff --git a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx index af502dd03..e3654facb 100644 --- a/src/client/views/collections/collectionSchema/SchemaRowBox.tsx +++ b/src/client/views/collections/collectionSchema/SchemaRowBox.tsx @@ -98,10 +98,11 @@ export class SchemaRowBox extends ViewBoxBaseComponent() { document.removeEventListener('pointermove', this.onPointerMove); }; + 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); deselectCell = () => this.schemaView?.deselectAllCells(); - selectedCell = () => this.schemaView?._selectedCells; + selectedCells = () => this.schemaView?._selectedCells; setColumnValues = (field: any, value: any) => this.schemaView?.setColumnValues(field, value) ?? false; setSelectedColumnValues = (field: any, value: any) => this.schemaView?.setSelectedColumnValues(field, value) ?? false; columnWidth = computedFn((index: number) => () => this.schemaView?.displayColumnWidths[index] ?? CollectionSchemaView._minColWidth); @@ -187,7 +188,8 @@ export class SchemaRowBox extends ViewBoxBaseComponent() { getFinfo={this.getFinfo} selectCell={this.selectCell} deselectCell={this.deselectCell} - selectedCells={this.selectedCell} + selectedCells={this.selectedCells} + selectedCol={this.selectedCol} setColumnValues={this.setColumnValues} setSelectedColumnValues={this.setSelectedColumnValues} oneLine={BoolCast(this.schemaDoc?._singleLine)} diff --git a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx index cae16be36..52c34e8d6 100644 --- a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx +++ b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx @@ -36,7 +36,8 @@ export interface SchemaTableCellProps { col: number; deselectCell: () => void; selectCell: (doc: Doc, col: number, shift: boolean) => void; - selectedCells: () => [Doc[], number] | undefined; + selectedCells: () => Doc[] | undefined; + selectedCol: () => number; fieldKey: string; maxWidth?: () => number; columnWidth: () => number; @@ -108,9 +109,9 @@ export class SchemaTableCell extends ObservableReactComponent doc === this._props.Document).length !== 0) && selected[1] === this._props.col; - //console.log("col: " + this._props.col + "true: " + istrue); + const selected: Doc[] | undefined = this._props.selectedCells(); + let istrue = this._props.isRowActive() && (selected && selected?.filter(doc => doc === this._props.Document).length !== 0) && this._props.selectedCol() === this._props.col; + console.log("col: " + this._props.col + " selCol: " + this._props.selectedCol() + " true: " + istrue); return istrue; } @@ -320,7 +321,7 @@ export class SchemaRTFCell extends ObservableReactComponent doc === this._props.Document).length !== 0) && selected[1] === this._props.col; + return this._props.isRowActive() && (selected && selected?.filter(doc => doc === this._props.Document).length !== 0) && this._props.selectedCol() === this._props.col; //return this._props.isRowActive() && selected?.[0] === this._props.Document && selected[1] === this._props.col; } selectedFunc = () => this.selected; @@ -343,7 +344,7 @@ export class SchemaBoolCell extends ObservableReactComponent doc === this._props.Document).length !== 0) && selected[1] === this._props.col; + return this._props.isRowActive() && (selected && selected?.filter(doc => doc === this._props.Document).length !== 0) && this._props.selectedCol() === this._props.col; } render() { const { color, textDecoration, fieldProps, cursor, pointerEvents } = SchemaTableCell.renderProps(this._props); @@ -387,7 +388,7 @@ export class SchemaEnumerationCell extends ObservableReactComponent doc === this._props.Document).length !== 0) && selected[1] === this._props.col; + return this._props.isRowActive() && (selected && selected?.filter(doc => doc === this._props.Document).length !== 0) && this._props.selectedCol() === this._props.col; } render() { const { color, textDecoration, fieldProps, cursor, pointerEvents } = SchemaTableCell.renderProps(this._props); diff --git a/src/client/views/nodes/formattedText/DashFieldView.tsx b/src/client/views/nodes/formattedText/DashFieldView.tsx index 631de1241..66db06d69 100644 --- a/src/client/views/nodes/formattedText/DashFieldView.tsx +++ b/src/client/views/nodes/formattedText/DashFieldView.tsx @@ -140,7 +140,8 @@ export class DashFieldViewInternal extends ObservableReactComponent this._props.tbox._props.PanelWidth() - 20 : returnZero} - selectedCells={() => [[this._dashDoc!], 0]} + selectedCells={() => [this._dashDoc!]} + selectedCol={() => 0} //!!! fieldKey={this._fieldKey} rowHeight={returnZero} isRowActive={() => this._expanded && this._props.editable} -- cgit v1.2.3-70-g09d2 From efcacfa867ac7ac39d97ed2fe33c1311b912ca0f Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Thu, 21 Mar 2024 00:55:34 -0400 Subject: the decommenting --- .../collections/collectionSchema/CollectionSchemaView.tsx | 10 ---------- .../views/collections/collectionSchema/SchemaTableCell.tsx | 3 --- src/client/views/nodes/formattedText/DashFieldView.tsx | 2 +- 3 files changed, 1 insertion(+), 14 deletions(-) (limited to 'src/client/views/nodes') diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx index d583ffd03..b2942cc47 100644 --- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx +++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx @@ -423,11 +423,8 @@ export class CollectionSchemaView extends CollectionSubView() { @action addDocToSelection = (doc: Doc, extendSelection: boolean, index: number) => { - //console.log("doc added"); const rowDocView = DocumentManager.Instance.getDocumentView(doc); if (rowDocView) SelectionManager.SelectView(rowDocView, extendSelection); - //let selectedIndexes: Array = this._selectedDocs.map(doc => this.rowIndex(doc)); - //console.log(selectedIndexes); }; @action @@ -442,8 +439,6 @@ export class CollectionSchemaView extends CollectionSubView() { const lastSelectedRow = this.rowIndex(lastSelected); const startRow = Math.min(lastSelectedRow, index); const endRow = Math.max(lastSelectedRow, index); - //console.log(lastSelectedRow); - //console.log("start: " + startRow + " end: " + endRow); for (let i = startRow; i <= endRow; i++) { const currDoc = this.sortedDocs.docs[i]; if (!this._selectedDocs.includes(currDoc)) this.addDocToSelection(currDoc, true, i); @@ -466,8 +461,6 @@ export class CollectionSchemaView extends CollectionSubView() { } let selectedIndexes: Array = this._selectedCells.map(doc => this.rowIndex(doc)); - console.log("cells: " + selectedIndexes); - console.log("index: " + this._selectedCol); }; @@ -477,7 +470,6 @@ export class CollectionSchemaView extends CollectionSubView() { this._selectedCells = this._selectedCells.filter(d => d !== doc); if (this._selectedCells){ let selectedIndexes: Array = this._selectedCells.map(doc => this.rowIndex(doc)); - console.log("cells: " + selectedIndexes); } }; @@ -609,7 +601,6 @@ export class CollectionSchemaView extends CollectionSubView() { setColumnValues = (key: string, value: string) => { this.childDocs.forEach(doc => { let docIsSelected = this._selectedCells && !(this._selectedCells?.filter(d => d === doc).length === 0); - console.log(docIsSelected); if (docIsSelected){ KeyValueBox.SetField(doc, key, value) } @@ -620,7 +611,6 @@ export class CollectionSchemaView extends CollectionSubView() { }; setSelectedColumnValues = (key: string, value: string) => { - console.log("called"); this.childDocs.forEach(doc => { let docIsSelected = this._selectedCells && !(this._selectedCells?.filter(d => d === doc).length === 0); if (docIsSelected){ diff --git a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx index 52c34e8d6..1c4520ae2 100644 --- a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx +++ b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx @@ -111,7 +111,6 @@ export class SchemaTableCell extends ObservableReactComponent doc === this._props.Document).length !== 0) && this._props.selectedCol() === this._props.col; - console.log("col: " + this._props.col + " selCol: " + this._props.selectedCol() + " true: " + istrue); return istrue; } @@ -184,8 +183,6 @@ export class SchemaTableCell extends ObservableReactComponent { - console.log(e); - console.log(e.shiftKey); const shift: boolean = e.shiftKey; !this.selected && this._props.selectCell(this._props.Document, this._props.col, shift)} )} diff --git a/src/client/views/nodes/formattedText/DashFieldView.tsx b/src/client/views/nodes/formattedText/DashFieldView.tsx index 66db06d69..f6e2bfa66 100644 --- a/src/client/views/nodes/formattedText/DashFieldView.tsx +++ b/src/client/views/nodes/formattedText/DashFieldView.tsx @@ -141,7 +141,7 @@ export class DashFieldViewInternal extends ObservableReactComponent this._props.tbox._props.PanelWidth() - 20 : returnZero} selectedCells={() => [this._dashDoc!]} - selectedCol={() => 0} //!!! + selectedCol={() => 0} fieldKey={this._fieldKey} rowHeight={returnZero} isRowActive={() => this._expanded && this._props.editable} -- cgit v1.2.3-70-g09d2 From 89e9ad0448290fe7daf6980c9c5e5cda0ce66714 Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Thu, 11 Apr 2024 05:24:03 -0400 Subject: Row dragging no longer interferes with multi-selection; dragged rows render where they will be dropped; pointerevent listeners removed from schemarowbox --- .env.swp | Bin 12349 -> 12351 bytes src/client/util/DocumentManager.ts | 4 + .../views/collections/CollectionNoteTakingView.tsx | 1 + .../collectionSchema/CollectionSchemaView.tsx | 104 ++++++++++++++++----- .../collections/collectionSchema/SchemaRowBox.tsx | 41 +------- .../collectionSchema/SchemaTableCell.tsx | 5 +- src/client/views/nodes/DocumentView.tsx | 1 + 7 files changed, 91 insertions(+), 65 deletions(-) (limited to 'src/client/views/nodes') diff --git a/.env.swp b/.env.swp index 0894f214e..8280a666e 100644 Binary files a/.env.swp and b/.env.swp differ diff --git a/src/client/util/DocumentManager.ts b/src/client/util/DocumentManager.ts index a38a330da..561114182 100644 --- a/src/client/util/DocumentManager.ts +++ b/src/client/util/DocumentManager.ts @@ -36,6 +36,7 @@ export class DocumentManager { } public DeleteDocumentView(dv: DocumentView) { this._documentViews.delete(dv); + console.log("deleted") } //private constructor so no other class can create a nodemanager @@ -94,6 +95,7 @@ export class DocumentManager { this.callAddViewFuncs(view); } // prettier-ignore }; + public RemoveView = action((view: DocumentView) => { if (!view._props.LayoutTemplateString?.includes(KeyValueBox.name) && !view._props.LayoutTemplateString?.includes(LinkAnchorBox.name)) { this.DeleteDocumentView(view); @@ -125,6 +127,8 @@ export class DocumentManager { public getDocumentView(target: Doc | undefined, preferredCollection?: DocumentView): DocumentView | undefined { const docViewArray = DocumentManager.Instance.DocumentViews; + //console.log(docViewArray) + //console.log(this._documentViews) const passes = !target ? [] : preferredCollection ? [preferredCollection, undefined] : [undefined]; return passes.reduce( (toReturn, pass) => diff --git a/src/client/views/collections/CollectionNoteTakingView.tsx b/src/client/views/collections/CollectionNoteTakingView.tsx index 6318620e0..8c10db5dc 100644 --- a/src/client/views/collections/CollectionNoteTakingView.tsx +++ b/src/client/views/collections/CollectionNoteTakingView.tsx @@ -138,6 +138,7 @@ export class CollectionNoteTakingView extends CollectionSubView() { sections.get(existingHeader)!.push(d); } }); + //*!* // now we add back in the docs that we're dragging if (rowCol.length && columnHeaders.length > rowCol[1]) { const offset = 0; diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx index f59d562dd..050f303c2 100644 --- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx +++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx @@ -3,7 +3,7 @@ import { Popup, PopupTrigger, Type } from 'browndash-components'; import { ObservableMap, action, computed, makeObservable, observable, observe } from 'mobx'; import { observer } from 'mobx-react'; import * as React from 'react'; -import { emptyFunction, returnEmptyDoclist, returnEmptyString, returnFalse, returnIgnore, returnNever, returnTrue, setupMoveUpEvents, smoothScroll } from '../../../../Utils'; +import { StopEvent, emptyFunction, returnEmptyDoclist, returnEmptyString, returnFalse, returnIgnore, returnNever, returnTrue, setupMoveUpEvents, smoothScroll } from '../../../../Utils'; import { Doc, DocListCast, Field, NumListCast, Opt, StrListCast } from '../../../../fields/Doc'; import { DocData } from '../../../../fields/DocSymbols'; import { Id } from '../../../../fields/FieldSymbols'; @@ -91,7 +91,8 @@ export class CollectionSchemaView extends CollectionSubView() { //an array of selected docs and the index representing the selected column @observable _selectedCol: number = 0; @observable _selectedCells: Array | undefined; - + @observable _mouseY: number = 0; + @observable _mouseX: number = 0; // target HTMLelement portal for showing a popup menu to edit cell values. public get MenuTarget() { @@ -99,7 +100,11 @@ export class CollectionSchemaView extends CollectionSubView() { } @computed get _selectedDocs() { - const selected = SelectionManager.Docs.filter(doc => Doc.AreProtosEqual(DocCast(doc.embedContainer), this.Document)); + // get all selected documents then filter out any whose parent is not this schema document + const selected = SelectionManager.Docs.filter(doc => this.childDocs.includes(doc)); + // SelectionManager... filter(doc => this.childDocs.includes(doc)) + //DocCast(doc.embedContainer)[DocData] === this.dataDoc + //SelectionManager.Docs.forEach(doc => console.log("index: " + this.rowIndex(doc) + " equal: " + Doc.AreProtosEqual(DocCast(doc.embedContainer), this.Document))); if (!selected.length) { for (const sel of SelectionManager.Docs) { const contextPath = DocumentManager.GetContextPath(sel, true); @@ -128,6 +133,10 @@ export class CollectionSchemaView extends CollectionSubView() { return Cast(this.layoutDoc.schema_columnKeys, listSpec('string'), defaultColumnKeys); } + @computed get rowKeys() { + return Cast(this.layoutDoc.schema_rowKeys, listSpec('string'), []); + } + @computed get storedColumnWidths() { const widths = NumListCast( this.layoutDoc.schema_columnWidths, @@ -135,12 +144,18 @@ export class CollectionSchemaView extends CollectionSubView() { ); const totalWidth = widths.reduce((sum, width) => sum + width, 0); + //If the total width of all columns is not the width of the schema table minus the width of the row menu, resize them appropriately if (totalWidth !== this.tableWidth - CollectionSchemaView._rowMenuWidth) { return widths.map(w => (w / totalWidth) * (this.tableWidth - CollectionSchemaView._rowMenuWidth)); } return widths; } + @computed get rowHeights() { + const heights = this.childDocs.map(() => (this.rowHeightFunc())) + return heights; + } + @computed get displayColumnWidths() { return this._displayColumnWidths ?? this.storedColumnWidths; } @@ -211,11 +226,11 @@ export class CollectionSchemaView extends CollectionSubView() { break; case 'ArrowUp': { - const firstDoc = this._selectedDocs.lastElement(); - const firstIndex = this.rowIndex(firstDoc); + const firstIndex = this.lastSelectedIndex; const curDoc = this.sortedDocs.docs[firstIndex]; if (firstIndex > 0 && firstIndex < this.childDocs.length) { - const newDoc = this.sortedDocs.docs[firstIndex - 1]; + console.log("firstindex: " + firstIndex + " docs: " + this.childDocs.length) + const newDoc = firstIndex < this.childDocs.length - 1 ? this.sortedDocs.docs[firstIndex - 1] : curDoc; if (this._selectedDocs.includes(newDoc)){ SelectionManager.DeselectView(DocumentManager.Instance.getFirstDocumentView(curDoc)) this.deselectCell(curDoc); @@ -255,6 +270,15 @@ export class CollectionSchemaView extends CollectionSubView() { } }; + @computed get lastSelectedIndex() { + let lastIndex: number = 0; + if (this._selectedCells) for (let i = 0; i < this._selectedCells?.length; ++i){ + let rowIndex = this.rowIndex(this._selectedCells[i]); + (rowIndex > lastIndex) && (lastIndex = rowIndex); + } + return lastIndex; + } + @action changeSelectedCellColumn = () => { @@ -390,6 +414,19 @@ export class CollectionSchemaView extends CollectionSubView() { } return total + curr; }, CollectionSchemaView._rowMenuWidth); + console.log(index); + return index; + }; + + findRowDropIndex = (mouseY: number) => { + let index: number = 0; + this.rowHeights.reduce((total, curr, i) => { + if (total <= mouseY && total + curr >= mouseY) { + if (mouseY <= total + curr) index = i; + else index = i + 1; + } + return total + curr; + }, CollectionSchemaView._rowHeight); return index; }; @@ -428,6 +465,7 @@ export class CollectionSchemaView extends CollectionSubView() { addDocToSelection = (doc: Doc, extendSelection: boolean, index: number) => { const rowDocView = DocumentManager.Instance.getDocumentView(doc); if (rowDocView) SelectionManager.SelectView(rowDocView, extendSelection); + else console.log("nonexistent") }; @action @@ -443,29 +481,31 @@ export class CollectionSchemaView extends CollectionSubView() { const endRow = Math.max(lastSelectedRow, index); for (let i = startRow; i <= endRow; i++) { const currDoc = this.sortedDocs.docs[i]; - if (!this._selectedDocs.includes(currDoc)) this.addDocToSelection(currDoc, true, i); - this._selectedCells && this._selectedCells.push(currDoc); + if (!this._selectedDocs.includes(currDoc)){ + this.selectCell(currDoc, this._selectedCol, false, true) + } } }; @action - selectCell = (doc: Doc, index: number, shiftKey: boolean, ctrlKey: boolean) => { - (!shiftKey && !ctrlKey) && this.clearSelection(); + selectCell = (doc: Doc, col: number, shiftKey: boolean, ctrlKey: boolean) => { + if (!shiftKey && !ctrlKey) this.clearSelection(); !this._selectedCells && (this._selectedCells = []); - this._selectedCells.push(doc); + !shiftKey && this._selectedCells && this._selectedCells.push(doc); if (!this) return; const lastSelected = Array.from(this._selectedDocs).lastElement(); 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) { + if (lastSelected && this._selectedDocs.includes(doc)){ + SelectionManager.DeselectView(DocumentManager.Instance.getFirstDocumentView(doc)) + this.deselectCell(doc); + } else this.addDocToSelection(doc, true, this.rowIndex(doc)); } - else if (ctrlKey) {this.addDocToSelection(doc, true, this.rowIndex(doc)); console.log("2")} else this.addDocToSelection(doc, false, this.rowIndex(doc)); + this._selectedCol = col; - this._selectedCol = index; + //let selectedIndexes: Array = this._selectedCells.map(doc => this.rowIndex(doc)); }; @action @@ -480,7 +520,12 @@ export class CollectionSchemaView extends CollectionSubView() { sortedSelectedDocs = () => this.sortedDocs.docs.filter(doc => this._selectedDocs.includes(doc)); - setDropIndex = (index: number) => (this._closestDropIndex = index); + @computed + get rowDropIndex(){ + const mouseY = this.ScreenToLocalBoxXf().transformPoint(this._mouseX, this._mouseY)[1]; + const index = this.findRowDropIndex(mouseY); + return index + } onInternalDrop = (e: Event, de: DragManager.DropEvent) => { if (de.complete.columnDragData) { @@ -502,14 +547,14 @@ export class CollectionSchemaView extends CollectionSubView() { } const draggedDocs = de.complete.docDragData?.draggedDocuments; if (draggedDocs && super.onInternalDrop(e, de) && !this.sortField) { - const pushedDocs = this.childDocs.filter((doc, index) => index >= this._closestDropIndex && !draggedDocs.includes(doc)); + const pushedDocs = this.childDocs.filter((doc, index) => index >= this.rowDropIndex && !draggedDocs.includes(doc)); const pushedAndDraggedDocs = [...pushedDocs, ...draggedDocs]; const removed = this.childDocs.slice().filter(doc => !pushedAndDraggedDocs.includes(doc)); this.dataDoc[this.fieldKey ?? 'data'] = new List([...removed, ...draggedDocs, ...pushedDocs]); this.clearSelection(); draggedDocs.forEach(doc => { const draggedView = DocumentManager.Instance.getFirstDocumentView(doc); - if (draggedView) DocumentManager.Instance.RemoveView(draggedView); + //if (draggedView) DocumentManager.Instance.RemoveView(draggedView); //this is what messed up multi-select with row dragging DocumentManager.Instance.AddViewRenderedCb(doc, dv => dv.select(true)); }); return true; @@ -880,12 +925,21 @@ export class CollectionSchemaView extends CollectionSubView() { ); } + @action + onPointerMove = (e: React.PointerEvent) => { + if (DragManager.docsBeingDragged.length){ + this._mouseY = e.clientY; + this._mouseX = e.clientX; + } + } + @computed get sortedDocs() { const field = StrCast(this.layoutDoc.sortField); - const desc = BoolCast(this.layoutDoc.sortDesc); + const desc = BoolCast(this.layoutDoc.sortDesc); // is this an ascending or descending sort + const staticDocs = this.childDocs.filter(d => !DragManager.docsBeingDragged.includes(d)); const docs = !field - ? this.childDocs - : [...this.childDocs].sort((docA, docB) => { + ? staticDocs + : [...staticDocs].sort((docA, docB) => { // this sorts the documents based on the selected field. returning -1 for a before b, 0 for a = b, 1 for a > b const aStr = Field.toString(docA[field] as Field); const bStr = Field.toString(docB[field] as Field); var out = 0; @@ -894,8 +948,10 @@ export class CollectionSchemaView extends CollectionSubView() { if (desc) out *= -1; return out; }); + docs.splice(this.rowDropIndex, 0, ...DragManager.docsBeingDragged) return { docs }; } + rowHeightFunc = () => (BoolCast(this.layoutDoc._schema_singleLine) ? CollectionSchemaView._rowSingleLineHeight : CollectionSchemaView._rowHeight); sortedDocsFunc = () => this.sortedDocs; isContentActive = () => this._props.isSelected() || this._props.isContentActive(); @@ -905,7 +961,7 @@ export class CollectionSchemaView extends CollectionSubView() { _oldWheel: any; render() { return ( -
this.createDashEventsTarget(ele)} onDrop={this.onExternalDrop.bind(this)}> +
this.createDashEventsTarget(ele)} onDrop={this.onExternalDrop.bind(this)} onPointerMove={(e) => this.onPointerMove(e)}>
() { } }; - onPointerEnter = (e: any) => { - if (SnappingManager.IsDragging && this._props.isContentActive()) { - document.removeEventListener('pointermove', this.onPointerMove); - document.addEventListener('pointermove', this.onPointerMove); - } - }; - - onPointerMove = (e: any) => { - const dragIsRow = DragManager.docsBeingDragged.some(doc => doc.embedContainer === this.schemaDoc); // this.schemaView?._selectedDocs.has(doc) ?? false; - - if (this._ref && dragIsRow) { - const rect = this._ref.getBoundingClientRect(); - const y = e.clientY - rect.top; //y position within the element. - const height = this._ref.clientHeight; - const halfLine = height / 2; - if (y <= halfLine) { - this._ref.style.borderTop = `solid 2px ${Colors.MEDIUM_BLUE}`; - this._ref.style.borderBottom = '0px'; - this.schemaView?.setDropIndex(this.rowIndex); - } else if (y > halfLine) { - this._ref.style.borderTop = '0px'; - this._ref.style.borderBottom = `solid 2px ${Colors.MEDIUM_BLUE}`; - this.schemaView?.setDropIndex(this.rowIndex + 1); - } - } - }; - - onPointerLeave = (e: any) => { - if (this._ref) { - this._ref.style.borderTop = '0px'; - this._ref.style.borderBottom = '0px'; - } - document.removeEventListener('pointermove', this.onPointerMove); - }; - selectedCol = () => this.schemaView._selectedCol; getFinfo = computedFn((fieldKey: string) => this.schemaView?.fieldInfos.get(fieldKey)); selectCell = (doc: Doc, col: number, shift: boolean, ctrl: boolean) => this.schemaView?.selectCell(doc, col, shift, ctrl); deselectCell = () => this.schemaView?.deselectAllCells(); - selectedCells = () => this.schemaView?._selectedCells; + selectedCells = () => this.schemaView?._selectedDocs; setColumnValues = (field: any, value: any) => this.schemaView?.setColumnValues(field, value) ?? false; setSelectedColumnValues = (field: any, value: any) => this.schemaView?.setSelectedColumnValues(field, value) ?? false; columnWidth = computedFn((index: number) => () => this.schemaView?.displayColumnWidths[index] ?? CollectionSchemaView._minColWidth); @@ -111,8 +76,6 @@ export class SchemaRowBox extends ViewBoxBaseComponent() {
{ row && this.schemaView?.addRowRef?.(this.Document, row); this._ref = row; diff --git a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx index 6a75ad6c5..1786d688b 100644 --- a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx +++ b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx @@ -7,7 +7,7 @@ import * as React from 'react'; import DatePicker from 'react-datepicker'; import 'react-datepicker/dist/react-datepicker.css'; import Select from 'react-select'; -import { Utils, emptyFunction, returnEmptyDoclist, returnEmptyFilter, returnFalse, returnTrue, returnZero } from '../../../../Utils'; +import { StopEvent, Utils, emptyFunction, returnEmptyDoclist, returnEmptyFilter, returnFalse, returnTrue, returnZero } from '../../../../Utils'; import { DateField } from '../../../../fields/DateField'; import { Doc, DocListCast, Field } from '../../../../fields/Doc'; import { RichTextField } from '../../../../fields/RichTextField'; @@ -110,7 +110,7 @@ export class SchemaTableCell extends ObservableReactComponent doc === this._props.Document).length !== 0) && this._props.selectedCol() === this._props.col; + let istrue = this._props.isRowActive() && (selected?.filter(doc => doc === this._props.Document).length !== 0) && this._props.selectedCol() === this._props.col; return istrue; } @@ -182,6 +182,7 @@ export class SchemaTableCell extends ObservableReactComponent StopEvent(e)} onPointerDown={action(e => { const shift: boolean = e.shiftKey; const ctrl: boolean = e.ctrlKey; diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index 8d3750cad..3764f6edd 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -279,6 +279,7 @@ export class DocumentViewInternal extends DocComponent dv.ContentDiv); -- cgit v1.2.3-70-g09d2 From 154029278c92327eb48955ac2c7137b5a59b1d7d Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Thu, 2 May 2024 00:36:11 -0400 Subject: selected cell moves with col; jitter on col move index 0 fixed --- src/client/util/CaptureManager.tsx | 1 + src/client/util/SelectionManager.ts | 2 ++ src/client/util/UndoManager.ts | 18 +++++----- src/client/views/DocumentDecorations.tsx | 1 + src/client/views/MainView.tsx | 1 + .../collections/collectionFreeForm/MarqueeView.tsx | 2 ++ .../collectionSchema/CollectionSchemaView.tsx | 42 +++++++++++++--------- .../collectionSchema/SchemaTableCell.tsx | 7 ++-- src/client/views/nodes/DocumentView.tsx | 3 +- .../views/nodes/formattedText/DashFieldView.tsx | 3 +- 10 files changed, 49 insertions(+), 31 deletions(-) (limited to 'src/client/views/nodes') diff --git a/src/client/util/CaptureManager.tsx b/src/client/util/CaptureManager.tsx index 2e13aff2f..17eba55e7 100644 --- a/src/client/util/CaptureManager.tsx +++ b/src/client/util/CaptureManager.tsx @@ -82,6 +82,7 @@ export class CaptureManager extends React.Component<{}> {
{ + console.log("cancel") //!!! const selected = SelectionManager.Views.slice(); SelectionManager.DeselectAll(); selected.map(dv => dv.props.removeDocument?.(dv.Document)); diff --git a/src/client/util/SelectionManager.ts b/src/client/util/SelectionManager.ts index 6f6278662..1a8680e2b 100644 --- a/src/client/util/SelectionManager.ts +++ b/src/client/util/SelectionManager.ts @@ -44,6 +44,7 @@ export class SelectionManager { }); public static DeselectView = action((docView?: DocumentView): void => { + console.log("single deselect") if (docView && this.Instance.SelectedViews.includes(docView)) { docView.IsSelected = false; this.Instance.SelectedViews.splice(this.Instance.SelectedViews.indexOf(docView), 1); @@ -52,6 +53,7 @@ export class SelectionManager { }); public static DeselectAll = (except?: Doc): void => { + //console.log("deselect all") const found = this.Instance.SelectedViews.find(dv => dv.Document === except); runInAction(() => { LinkManager.Instance.currentLink = undefined; diff --git a/src/client/util/UndoManager.ts b/src/client/util/UndoManager.ts index 421855bf3..20801baa7 100644 --- a/src/client/util/UndoManager.ts +++ b/src/client/util/UndoManager.ts @@ -97,13 +97,13 @@ export namespace UndoManager { export function AddEvent(event: UndoEvent, value?: any): void { if (currentBatch && batchCounter.get() && !undoing) { - console.log( - ' '.slice(0, batchCounter.get()) + - 'UndoEvent : ' + - event.prop + - ' = ' + - (value instanceof RichTextField ? value.Text : value instanceof Array ? value.map(val => Field.toJavascriptString(val)).join(',') : Field.toJavascriptString(value)) - ); + // console.log( + // ' '.slice(0, batchCounter.get()) + + // 'UndoEvent : ' + + // event.prop + + // ' = ' + + // (value instanceof RichTextField ? value.Text : value instanceof Array ? value.map(val => Field.toJavascriptString(val)).join(',') : Field.toJavascriptString(value)) + // ); currentBatch.push(event); tempEvents?.push(event); } @@ -171,7 +171,7 @@ export namespace UndoManager { } export function StartBatch(batchName: string): Batch { - console.log(' '.slice(0, batchCounter.get()) + 'Start ' + batchCounter + ' ' + batchName); + //console.log(' '.slice(0, batchCounter.get()) + 'Start ' + batchCounter + ' ' + batchName); runInAction(() => batchCounter.set(batchCounter.get() + 1)); if (currentBatch === undefined) { currentBatch = []; @@ -181,7 +181,7 @@ export namespace UndoManager { const EndBatch = action((batchName: string, cancel: boolean = false) => { runInAction(() => batchCounter.set(batchCounter.get() - 1)); - console.log(' '.slice(0, batchCounter.get()) + 'End ' + batchName + ' (' + currentBatch?.length + ')'); + //console.log(' '.slice(0, batchCounter.get()) + 'End ' + batchName + ' (' + currentBatch?.length + ')'); if (batchCounter.get() === 0 && currentBatch?.length) { if (!cancel) { undoStack.push(currentBatch); diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx index 2fb9f0fc1..8f042e68c 100644 --- a/src/client/views/DocumentDecorations.tsx +++ b/src/client/views/DocumentDecorations.tsx @@ -301,6 +301,7 @@ export class DocumentDecorations extends ObservableReactComponent { SelectionManager.Views.forEach(dv => dv?.iconify()); + console.log("iconify") //!!! SelectionManager.DeselectAll(); }; diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx index 677114e2d..eb45350a8 100644 --- a/src/client/views/MainView.tsx +++ b/src/client/views/MainView.tsx @@ -573,6 +573,7 @@ export class MainView extends ObservableReactComponent<{}> { if (!e.cancelBubble) { const pathstr = (e as any)?.path?.map((p: any) => p.classList?.toString()).join(); if (pathstr?.includes('libraryFlyout')) { + console.log("random") //!!! SelectionManager.DeselectAll(); } } diff --git a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx index b913e05ad..62f391201 100644 --- a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx +++ b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx @@ -249,6 +249,7 @@ export class MarqueeView extends ObservableReactComponent { + console.log("pileup")//!!! const selected = this.marqueeSelect(false); SelectionManager.DeselectAll(); selected.forEach(d => this._props.removeDocument?.(d)); diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx index a4d7eae06..7067aed5a 100644 --- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx +++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx @@ -373,6 +373,9 @@ export class CollectionSchemaView extends CollectionSubView() { @undoBatch moveColumn = (fromIndex: number, toIndex: number) => { + console.log("from: " + fromIndex + " to: " + toIndex) + if (toIndex === this._selectedCol) this._selectedCol = fromIndex; //keeps selected cell consistent + let currKeys = this.columnKeys.slice(); currKeys.splice(toIndex, 0, currKeys.splice(fromIndex, 1)[0]); this.layoutDoc.schema_columnKeys = new List(currKeys); @@ -380,6 +383,8 @@ export class CollectionSchemaView extends CollectionSubView() { let currWidths = this.storedColumnWidths.slice(); currWidths.splice(toIndex, 0, currWidths.splice(fromIndex, 1)[0]); this.layoutDoc.schema_columnWidths = new List(currWidths); + + this._draggedColIndex = toIndex; }; @action @@ -466,23 +471,23 @@ export class CollectionSchemaView extends CollectionSubView() { this._colEles.forEach((colRef, i) => { let edgeStyle = ''; if (i === index) edgeStyle = `solid 2px ${Colors.MEDIUM_BLUE}`; + + //border styles of menu cell colRef.style.borderLeft = edgeStyle; colRef.style.borderRight = edgeStyle; colRef.style.borderTop = edgeStyle; + for (let doc = 0; doc < this.childDocs.length; ++doc){ - this._rowEles.get(this.childDocs[doc]).children[1].children[i].style.borderLeft = edgeStyle; - this._rowEles.get(this.childDocs[doc]).children[1].children[i].style.borderRight = edgeStyle; - if (doc === this.childDocs.length - 1){ - this._rowEles.get(this.childDocs[doc]).children[1].children[i].style.borderBottom = edgeStyle; + if (i === this._selectedCol && this._selectedDocs.includes(this.childDocs[doc])){ + continue; + } else { + this._rowEles.get(this.childDocs[doc]).children[1].children[i].style.borderLeft = edgeStyle; + this._rowEles.get(this.childDocs[doc]).children[1].children[i].style.borderRight = edgeStyle; + if (doc === this.childDocs.length - 1){ + this._rowEles.get(this.childDocs[doc]).children[1].children[i].style.borderBottom = edgeStyle; + } } } - // this.childDocs.forEach(doc => { - // this._rowEles.get(doc).children[1].children[i].style.borderLeft = edgeStyle; - // this._rowEles.get(doc).children[1].children[i].style.borderRight = edgeStyle; - // if (i === this.childDocs.length - 1){ - // this._rowEles.get(doc).children[1].children[i].style.borderBottom = edgeStyle; - // } - // }); }); }; @@ -502,11 +507,11 @@ export class CollectionSchemaView extends CollectionSubView() { addDocToSelection = (doc: Doc, extendSelection: boolean, index: number) => { const rowDocView = DocumentManager.Instance.getDocumentView(doc); if (rowDocView) SelectionManager.SelectView(rowDocView, extendSelection); - else console.log("nonexistent") }; @action clearSelection = () => { + //console.log("clear selection") //!!! SelectionManager.DeselectAll(); this.deselectAllCells(); }; @@ -575,14 +580,17 @@ export class CollectionSchemaView extends CollectionSubView() { e.stopPropagation(); this._colEles.forEach((colRef, i) => { + //style for menu cell colRef.style.borderLeft = ''; colRef.style.borderRight = ''; colRef.style.borderTop = ''; - colRef.style.borderBottom = ''; + this.childDocs.forEach(doc => { - this._rowEles.get(doc).children[1].children[i].style.borderLeft = ''; - this._rowEles.get(doc).children[1].children[i].style.borderRight = ''; - this._rowEles.get(doc).children[1].children[i].style.borderBottom = ''; + if (!(this._selectedDocs.includes(doc) && i === this._selectedCol)){ + this._rowEles.get(doc).children[1].children[i].style.borderLeft = ''; + this._rowEles.get(doc).children[1].children[i].style.borderRight = ''; + this._rowEles.get(doc).children[1].children[i].style.borderBottom = ''; + } }); }); return true; @@ -899,7 +907,7 @@ export class CollectionSchemaView extends CollectionSubView() { ); } get renderKeysMenu() { - console.log('RNDERMENUT:' + this._columnMenuIndex); + //console.log('RNDERMENUT:' + this._columnMenuIndex); return (
e.stopPropagation()} /> diff --git a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx index 1786d688b..6bbc4dfa6 100644 --- a/src/client/views/collections/collectionSchema/SchemaTableCell.tsx +++ b/src/client/views/collections/collectionSchema/SchemaTableCell.tsx @@ -109,9 +109,9 @@ export class SchemaTableCell extends ObservableReactComponent doc === this._props.Document).length !== 0) && this._props.selectedCol() === this._props.col; - return istrue; + const selectedDocs: Doc[] | undefined = this._props.selectedCells(); + let isSelected = this._props.isRowActive() && (selectedDocs?.filter(doc => doc === this._props.Document).length !== 0) && this._props.selectedCol() === this._props.col; + return isSelected; } @computed get defaultCellContent() { @@ -178,6 +178,7 @@ export class SchemaTableCell extends ObservableReactComponent this.onDoubleClickHandler.script.run(scriptProps, console.log).result?.select && this._props.select(false), 'on double click: ' + this.Document.title); } else if (!Doc.IsSystem(this.Document) && defaultDblclick !== 'ignore') { + console.log("double click") //!!! UndoManager.RunInBatch(() => LightboxView.Instance.AddDocTab(this.Document, OpenWhere.lightbox), 'double tap'); SelectionManager.DeselectAll(); Doc.UnBrushDoc(this.Document); @@ -381,7 +382,7 @@ export class DocumentViewInternal extends DocComponent { if (this._props.isGroupActive?.() === 'child' && !this._props.isDocumentActive?.()) return; - this._longPressSelector = setTimeout(() => DocumentView.LongPress && this._props.select(false), 1000); + this._longPressSelector = setTimeout(() => {console.log("long press"); DocumentView.LongPress && this._props.select(false), 1000}); //!!! if (!GestureOverlay.DownDocView) GestureOverlay.DownDocView = this._docView; this._downX = e.clientX; diff --git a/src/client/views/nodes/formattedText/DashFieldView.tsx b/src/client/views/nodes/formattedText/DashFieldView.tsx index c0c729fb5..a9d916fcd 100644 --- a/src/client/views/nodes/formattedText/DashFieldView.tsx +++ b/src/client/views/nodes/formattedText/DashFieldView.tsx @@ -139,7 +139,8 @@ export class DashFieldViewInternal extends ObservableReactComponent (this._expanded = !this._props.editable ? !this._expanded : true))} style={{ fontSize: 'smaller', width: this._props.hideKey ? this._props.tbox._props.PanelWidth() - 20 : undefined }}> +
{console.log(true); + (this._expanded = !this._props.editable ? !this._expanded : true)})} style={{ fontSize: 'smaller', width: this._props.hideKey ? this._props.tbox._props.PanelWidth() - 20 : undefined }}> Date: Thu, 2 May 2024 00:57:20 -0400 Subject: arrow selection fixed --- src/client/util/SelectionManager.ts | 1 - .../views/collections/collectionSchema/CollectionSchemaView.tsx | 7 ++----- src/client/views/nodes/DocumentView.tsx | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) (limited to 'src/client/views/nodes') diff --git a/src/client/util/SelectionManager.ts b/src/client/util/SelectionManager.ts index 1a8680e2b..b6ee4d5c3 100644 --- a/src/client/util/SelectionManager.ts +++ b/src/client/util/SelectionManager.ts @@ -44,7 +44,6 @@ export class SelectionManager { }); public static DeselectView = action((docView?: DocumentView): void => { - console.log("single deselect") if (docView && this.Instance.SelectedViews.includes(docView)) { docView.IsSelected = false; this.Instance.SelectedViews.splice(this.Instance.SelectedViews.indexOf(docView), 1); diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx index 7067aed5a..13370ea6b 100644 --- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx +++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx @@ -215,7 +215,6 @@ export class CollectionSchemaView extends CollectionSubView() { if (this._selectedDocs.includes(newDoc)) { SelectionManager.DeselectView(DocumentManager.Instance.getFirstDocumentView(curDoc)); this.deselectCell(curDoc); - } else { const shift: boolean = e.shiftKey; const ctrl: boolean = e.ctrlKey; @@ -229,12 +228,11 @@ export class CollectionSchemaView extends CollectionSubView() { break; case 'ArrowUp': { - const firstDoc = this.sortedDocs.docs[0]; + const firstDoc = this._selectedDocs.lastElement(); const firstIndex = this.rowIndex(firstDoc); const curDoc = this.sortedDocs.docs[firstIndex]; if (firstIndex > 0 && firstIndex < this.childDocs.length) { - console.log("firstindex: " + firstIndex + " docs: " + this.childDocs.length) - const newDoc = firstIndex < this.childDocs.length - 1 ? this.sortedDocs.docs[firstIndex - 1] : curDoc; + const newDoc = this.sortedDocs.docs[firstIndex - 1]; if (this._selectedDocs.includes(newDoc)){ SelectionManager.DeselectView(DocumentManager.Instance.getFirstDocumentView(curDoc)) this.deselectCell(curDoc); @@ -373,7 +371,6 @@ export class CollectionSchemaView extends CollectionSubView() { @undoBatch moveColumn = (fromIndex: number, toIndex: number) => { - console.log("from: " + fromIndex + " to: " + toIndex) if (toIndex === this._selectedCol) this._selectedCol = fromIndex; //keeps selected cell consistent let currKeys = this.columnKeys.slice(); diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index 5f243ad9f..10a55b260 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -382,7 +382,7 @@ export class DocumentViewInternal extends DocComponent { if (this._props.isGroupActive?.() === 'child' && !this._props.isDocumentActive?.()) return; - this._longPressSelector = setTimeout(() => {console.log("long press"); DocumentView.LongPress && this._props.select(false), 1000}); //!!! + this._longPressSelector = setTimeout(() => (DocumentView.LongPress && this._props.select(false), 1000)); //!!! if (!GestureOverlay.DownDocView) GestureOverlay.DownDocView = this._docView; this._downX = e.clientX; -- cgit v1.2.3-70-g09d2 From f706f70451525d4d0716c631cece9d78d76b3bfd Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Thu, 2 May 2024 12:42:36 -0400 Subject: removed console.logs --- src/client/util/CaptureManager.tsx | 1 - src/client/views/DocumentDecorations.tsx | 1 - src/client/views/MainView.tsx | 1 - src/client/views/collections/collectionFreeForm/MarqueeView.tsx | 2 -- .../views/collections/collectionSchema/CollectionSchemaView.tsx | 4 ++-- src/client/views/nodes/DocumentView.tsx | 1 - 6 files changed, 2 insertions(+), 8 deletions(-) (limited to 'src/client/views/nodes') diff --git a/src/client/util/CaptureManager.tsx b/src/client/util/CaptureManager.tsx index 17eba55e7..2e13aff2f 100644 --- a/src/client/util/CaptureManager.tsx +++ b/src/client/util/CaptureManager.tsx @@ -82,7 +82,6 @@ export class CaptureManager extends React.Component<{}> {
{ - console.log("cancel") //!!! const selected = SelectionManager.Views.slice(); SelectionManager.DeselectAll(); selected.map(dv => dv.props.removeDocument?.(dv.Document)); diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx index 8f042e68c..2fb9f0fc1 100644 --- a/src/client/views/DocumentDecorations.tsx +++ b/src/client/views/DocumentDecorations.tsx @@ -301,7 +301,6 @@ export class DocumentDecorations extends ObservableReactComponent { SelectionManager.Views.forEach(dv => dv?.iconify()); - console.log("iconify") //!!! SelectionManager.DeselectAll(); }; diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx index eb45350a8..677114e2d 100644 --- a/src/client/views/MainView.tsx +++ b/src/client/views/MainView.tsx @@ -573,7 +573,6 @@ export class MainView extends ObservableReactComponent<{}> { if (!e.cancelBubble) { const pathstr = (e as any)?.path?.map((p: any) => p.classList?.toString()).join(); if (pathstr?.includes('libraryFlyout')) { - console.log("random") //!!! SelectionManager.DeselectAll(); } } diff --git a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx index 62f391201..b913e05ad 100644 --- a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx +++ b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx @@ -249,7 +249,6 @@ export class MarqueeView extends ObservableReactComponent { - console.log("pileup")//!!! const selected = this.marqueeSelect(false); SelectionManager.DeselectAll(); selected.forEach(d => this._props.removeDocument?.(d)); diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx index 13370ea6b..841222c96 100644 --- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx +++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx @@ -371,7 +371,8 @@ export class CollectionSchemaView extends CollectionSubView() { @undoBatch moveColumn = (fromIndex: number, toIndex: number) => { - if (toIndex === this._selectedCol) this._selectedCol = fromIndex; //keeps selected cell consistent + if (this._selectedCol === fromIndex) this._selectedCol = toIndex; + else if (toIndex === this._selectedCol) this._selectedCol = fromIndex; //keeps selected cell consistent let currKeys = this.columnKeys.slice(); currKeys.splice(toIndex, 0, currKeys.splice(fromIndex, 1)[0]); @@ -508,7 +509,6 @@ export class CollectionSchemaView extends CollectionSubView() { @action clearSelection = () => { - //console.log("clear selection") //!!! SelectionManager.DeselectAll(); this.deselectAllCells(); }; diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index 10a55b260..5f2a71ef5 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -333,7 +333,6 @@ export class DocumentViewInternal extends DocComponent this.onDoubleClickHandler.script.run(scriptProps, console.log).result?.select && this._props.select(false), 'on double click: ' + this.Document.title); } else if (!Doc.IsSystem(this.Document) && defaultDblclick !== 'ignore') { - console.log("double click") //!!! UndoManager.RunInBatch(() => LightboxView.Instance.AddDocTab(this.Document, OpenWhere.lightbox), 'double tap'); SelectionManager.DeselectAll(); Doc.UnBrushDoc(this.Document); -- cgit v1.2.3-70-g09d2 From e2196ef689b6784613b5950446609b08fb0ef7a2 Mon Sep 17 00:00:00 2001 From: bobzel Date: Fri, 3 May 2024 09:20:46 -0400 Subject: reverting unnecessary changes --- src/client/util/DocumentManager.ts | 5 +---- src/client/util/SelectionManager.ts | 1 - src/client/util/UndoManager.ts | 16 ++++++++-------- .../views/collections/CollectionNoteTakingView.tsx | 1 - src/client/views/nodes/DocumentView.tsx | 19 +++++++++---------- .../views/nodes/formattedText/DashFieldView.tsx | 8 ++++---- 6 files changed, 22 insertions(+), 28 deletions(-) (limited to 'src/client/views/nodes') diff --git a/src/client/util/DocumentManager.ts b/src/client/util/DocumentManager.ts index 561114182..ae5fafcdd 100644 --- a/src/client/util/DocumentManager.ts +++ b/src/client/util/DocumentManager.ts @@ -36,7 +36,6 @@ export class DocumentManager { } public DeleteDocumentView(dv: DocumentView) { this._documentViews.delete(dv); - console.log("deleted") } //private constructor so no other class can create a nodemanager @@ -95,7 +94,7 @@ export class DocumentManager { this.callAddViewFuncs(view); } // prettier-ignore }; - + public RemoveView = action((view: DocumentView) => { if (!view._props.LayoutTemplateString?.includes(KeyValueBox.name) && !view._props.LayoutTemplateString?.includes(LinkAnchorBox.name)) { this.DeleteDocumentView(view); @@ -127,8 +126,6 @@ export class DocumentManager { public getDocumentView(target: Doc | undefined, preferredCollection?: DocumentView): DocumentView | undefined { const docViewArray = DocumentManager.Instance.DocumentViews; - //console.log(docViewArray) - //console.log(this._documentViews) const passes = !target ? [] : preferredCollection ? [preferredCollection, undefined] : [undefined]; return passes.reduce( (toReturn, pass) => diff --git a/src/client/util/SelectionManager.ts b/src/client/util/SelectionManager.ts index b6ee4d5c3..dd34d5f22 100644 --- a/src/client/util/SelectionManager.ts +++ b/src/client/util/SelectionManager.ts @@ -9,7 +9,6 @@ import { DocumentView } from '../views/nodes/DocumentView'; import { LinkManager } from './LinkManager'; import { ScriptingGlobals } from './ScriptingGlobals'; import { UndoManager } from './UndoManager'; -import { SchemaRowBox } from '../views/collections/collectionSchema/SchemaRowBox'; export class SelectionManager { private static _manager: SelectionManager; diff --git a/src/client/util/UndoManager.ts b/src/client/util/UndoManager.ts index 20801baa7..b16fed675 100644 --- a/src/client/util/UndoManager.ts +++ b/src/client/util/UndoManager.ts @@ -97,13 +97,13 @@ export namespace UndoManager { export function AddEvent(event: UndoEvent, value?: any): void { if (currentBatch && batchCounter.get() && !undoing) { - // console.log( - // ' '.slice(0, batchCounter.get()) + - // 'UndoEvent : ' + - // event.prop + - // ' = ' + - // (value instanceof RichTextField ? value.Text : value instanceof Array ? value.map(val => Field.toJavascriptString(val)).join(',') : Field.toJavascriptString(value)) - // ); + console.log( + ' '.slice(0, batchCounter.get()) + + 'UndoEvent : ' + + event.prop + + ' = ' + + (value instanceof RichTextField ? value.Text : value instanceof Array ? value.map(val => Field.toJavascriptString(val)).join(',') : Field.toJavascriptString(value)) + ); currentBatch.push(event); tempEvents?.push(event); } @@ -181,7 +181,7 @@ export namespace UndoManager { const EndBatch = action((batchName: string, cancel: boolean = false) => { runInAction(() => batchCounter.set(batchCounter.get() - 1)); - //console.log(' '.slice(0, batchCounter.get()) + 'End ' + batchName + ' (' + currentBatch?.length + ')'); + console.log(' '.slice(0, batchCounter.get()) + 'End ' + batchName + ' (' + currentBatch?.length + ')'); if (batchCounter.get() === 0 && currentBatch?.length) { if (!cancel) { undoStack.push(currentBatch); diff --git a/src/client/views/collections/CollectionNoteTakingView.tsx b/src/client/views/collections/CollectionNoteTakingView.tsx index 8c10db5dc..6318620e0 100644 --- a/src/client/views/collections/CollectionNoteTakingView.tsx +++ b/src/client/views/collections/CollectionNoteTakingView.tsx @@ -138,7 +138,6 @@ export class CollectionNoteTakingView extends CollectionSubView() { sections.get(existingHeader)!.push(d); } }); - //*!* // now we add back in the docs that we're dragging if (rowCol.length && columnHeaders.length > rowCol[1]) { const offset = 0; diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index 5f2a71ef5..ae83819e5 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -279,7 +279,6 @@ export class DocumentViewInternal extends DocComponent dv.ContentDiv); @@ -381,7 +380,7 @@ export class DocumentViewInternal extends DocComponent { if (this._props.isGroupActive?.() === 'child' && !this._props.isDocumentActive?.()) return; - this._longPressSelector = setTimeout(() => (DocumentView.LongPress && this._props.select(false), 1000)); //!!! + this._longPressSelector = setTimeout(() => (DocumentView.LongPress && this._props.select(false), 1000)); if (!GestureOverlay.DownDocView) GestureOverlay.DownDocView = this._docView; this._downX = e.clientX; @@ -1348,14 +1347,14 @@ export class DocumentView extends DocComponent() { select = (extendSelection: boolean, focusSelection?: boolean) => { /*if (this.IsSelected && SelectionManager.Views.length > 1) SelectionManager.DeselectView(this); else {*/ - SelectionManager.SelectView(this, extendSelection); - if (focusSelection) { - DocumentManager.Instance.showDocument(this.Document, { - willZoomCentered: true, - zoomScale: 0.9, - zoomTime: 500, - }); - } + SelectionManager.SelectView(this, extendSelection); + if (focusSelection) { + DocumentManager.Instance.showDocument(this.Document, { + willZoomCentered: true, + zoomScale: 0.9, + zoomTime: 500, + }); + } //} }; DataTransition = () => this._props.DataTransition?.() || StrCast(this.Document.dataTransition); diff --git a/src/client/views/nodes/formattedText/DashFieldView.tsx b/src/client/views/nodes/formattedText/DashFieldView.tsx index a9d916fcd..6186b3d99 100644 --- a/src/client/views/nodes/formattedText/DashFieldView.tsx +++ b/src/client/views/nodes/formattedText/DashFieldView.tsx @@ -135,12 +135,12 @@ export class DashFieldViewInternal extends ObservableReactComponent this._expanded && this._props.editable; finishEdit = action(() => (this._expanded = false)); selectedCell = (): [Doc, number] => [this._dashDoc!, 0]; + selectedCells = () => [this._dashDoc!]; // set the display of the field's value (checkbox for booleans, span of text for strings) @computed get fieldValueContent() { return !this._dashDoc ? null : ( -
{console.log(true); - (this._expanded = !this._props.editable ? !this._expanded : true)})} style={{ fontSize: 'smaller', width: this._props.hideKey ? this._props.tbox._props.PanelWidth() - 20 : undefined }}> +
(this._expanded = !this._props.editable ? !this._expanded : true))} style={{ fontSize: 'smaller', width: this._props.hideKey ? this._props.tbox._props.PanelWidth() - 20 : undefined }}> [this._dashDoc!]} - selectedCol={() => 0} + selectedCells={this.selectedCells} + selectedCol={returnZero} fieldKey={this._fieldKey} rowHeight={returnZero} isRowActive={this.isRowActive} -- cgit v1.2.3-70-g09d2