From 2e27b90ded41146b249649b0b0c3267b46c68363 Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Tue, 7 May 2024 04:51:15 -0400 Subject: dynamic dragged column index alignment; started filtered menukeys --- .../collectionSchema/CollectionSchemaView.tsx | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx index b684b65e5..27e1eabcf 100644 --- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx +++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx @@ -393,6 +393,9 @@ export class CollectionSchemaView extends CollectionSubView() { }; findColDropIndex = (mouseX: number) => { + let leftOffset: number = this._props.ScreenToLocalTransform().inverse().transformPoint(0,0)[0] + console.log(leftOffset) + console.log(CollectionSchemaView._rowMenuWidth) let index: number | undefined; this.displayColumnWidths.reduce((total, curr, i) => { if (total <= mouseX && total + curr >= mouseX) { @@ -400,7 +403,7 @@ export class CollectionSchemaView extends CollectionSubView() { else index = i + 1; } return total + curr; - }, 2 * CollectionSchemaView._rowMenuWidth); //probably prone to issues; find better implementation (!!!) + }, leftOffset + CollectionSchemaView._rowMenuWidth); //probably prone to issues; find better implementation (!!!) return index; }; @@ -587,6 +590,7 @@ export class CollectionSchemaView extends CollectionSubView() { this.clearSelection(); draggedDocs.forEach(doc => { DocumentView.addViewRenderedCb(doc, dv => dv.select(true)); + console.log(doc.x); }); this._lowestSelectedIndex = Math.min(...draggedDocs?.map(doc => this.rowIndex(doc))); return true; @@ -740,6 +744,19 @@ export class CollectionSchemaView extends CollectionSubView() { return true; }; + @computed + get activeMenuKeys() { + let activeKeys = this.documentKeys.filter(key => this.childDocsInclude(key)); + return activeKeys + } + + childDocsInclude = (key: string) => { + this.childDocs.forEach(doc => { + //TODO: if childdoc fieldkeys contain the key, return true + }) + return false + } + @action openColumnMenu = (index: number, newCol: boolean) => { this._makeNewColumn = false; @@ -937,6 +954,7 @@ export class CollectionSchemaView extends CollectionSubView() { return (