diff options
author | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2024-05-07 04:51:15 -0400 |
---|---|---|
committer | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2024-05-07 04:51:15 -0400 |
commit | 2e27b90ded41146b249649b0b0c3267b46c68363 (patch) | |
tree | 9b82346b00e694f589d6d899b31566c79e628d6a | |
parent | 86f55d8aa12268fe847eaa344e8efbab5d293f34 (diff) |
dynamic dragged column index alignment; started filtered menukeys
-rw-r--r-- | src/client/views/collections/collectionSchema/CollectionSchemaView.tsx | 20 |
1 files changed, 19 insertions, 1 deletions
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 ( <div className="schema-column-menu" style={{ left: 0, minWidth: CollectionSchemaView._minColWidth }}> <input className="schema-key-search-input" type="text" onKeyDown={this.onSearchKeyDown} onChange={this.updateKeySearch} onPointerDown={e => e.stopPropagation()} /> + <button className="schema-column-menu-toggle" onClick={() => null}></button> {this._makeNewField ? this.newFieldMenu : this.keysDropdown} </div> ); |