From ce716a382b83f4f05de651a96871877cd772f3af Mon Sep 17 00:00:00 2001 From: Andy Rickert Date: Thu, 4 Jun 2020 23:22:42 -0400 Subject: expand bucket --- src/client/views/search/SearchBox.tsx | 18 +++++------- src/client/views/search/SearchItem.tsx | 54 +++++++++++++++++----------------- 2 files changed, 35 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx index c38c4c1b9..525969565 100644 --- a/src/client/views/search/SearchBox.tsx +++ b/src/client/views/search/SearchBox.tsx @@ -80,9 +80,8 @@ const SearchBoxDocument = makeInterface(documentSchema, searchSchema); @observer export class SearchBox extends ViewBoxBaseComponent(SearchBoxDocument) { - // private get _searchString() { return this.rootDoc.searchQuery; } - // private set _searchString(value) { this.rootDoc.setSearchQuery(value); } - @observable _searchString: string =""; + @computed get _searchString() { return this.layoutDoc.searchQuery; } + @computed set _searchString(value) { this.layoutDoc.searchQuery=(value); } @observable private _resultsOpen: boolean = false; @observable private _searchbarOpen: boolean = false; @observable private _results: [Doc, string[], string[]][] = []; @@ -355,7 +354,12 @@ export class SearchBox extends ViewBoxBaseComponent { + submitSearch = async (reset?:boolean) => { + console.log("yes"); + if (reset){ + this.layoutDoc._searchString=""; + } + console.log(this.layoutDoc._searchString); this.dataDoc[this.fieldKey] = new List([]); this.buckets=[]; this.new_buckets={}; @@ -660,10 +664,8 @@ export class SearchBox extends ViewBoxBaseComponent; result[0].targetDoc=result[0]; - //Doc.AddDocToList(this.buckets![Math.floor(i/3)], this.props.fieldKey, result[0]); this._isSearch[i] = "search"; } } @@ -683,13 +685,9 @@ export class SearchBox extends ViewBoxBaseComponent(result[2]); result[0].highlighting=highlights.join(", "); - - //this._visibleElements[i] = ; if(i this.targetDoc!.searchMatch = true, 0); } highlightDoc = (e: React.PointerEvent) => { - // if (this.targetDoc!.type === DocumentType.LINK) { - // if (this.targetDoc!.anchor1 && this.targetDoc!.anchor2) { - - // const doc1 = Cast(this.targetDoc!.anchor1, Doc, null); - // const doc2 = Cast(this.targetDoc!.anchor2, Doc, null); - // Doc.BrushDoc(doc1); - // Doc.BrushDoc(doc2); - // } - // } else { - // Doc.BrushDoc(this.targetDoc!); - // } + if (this.targetDoc!.type === DocumentType.LINK) { + if (this.targetDoc!.anchor1 && this.targetDoc!.anchor2) { + + const doc1 = Cast(this.targetDoc!.anchor1, Doc, null); + const doc2 = Cast(this.targetDoc!.anchor2, Doc, null); + Doc.BrushDoc(doc1); + Doc.BrushDoc(doc2); + } + } else { + Doc.BrushDoc(this.targetDoc!); + } e.stopPropagation(); } unHighlightDoc = (e: React.PointerEvent) => { - // if (this.targetDoc!.type === DocumentType.LINK) { - // if (this.targetDoc!.anchor1 && this.targetDoc!.anchor2) { - - // const doc1 = Cast(this.targetDoc!.anchor1, Doc, null); - // const doc2 = Cast(this.targetDoc!.anchor2, Doc, null); - // Doc.UnBrushDoc(doc1); - // Doc.UnBrushDoc(doc2); - // } - // } else { - // Doc.UnBrushDoc(this.targetDoc!); - // } + if (this.targetDoc!.type === DocumentType.LINK) { + if (this.targetDoc!.anchor1 && this.targetDoc!.anchor2) { + + const doc1 = Cast(this.targetDoc!.anchor1, Doc, null); + const doc2 = Cast(this.targetDoc!.anchor2, Doc, null); + Doc.UnBrushDoc(doc1); + Doc.UnBrushDoc(doc2); + } + } else { + Doc.UnBrushDoc(this.targetDoc!); + } } onContextMenu = (e: React.MouseEvent) => { @@ -345,13 +345,13 @@ export class SearchItem extends ViewBoxBaseComponent{ SearchBox.Instance._searchString=""; - SearchBox.Instance.submitSearch(); + SearchBox.Instance.submitSearch(true); }) } render() { - // const doc1 = Cast(this.targetDoc!.anchor1, Doc); - // const doc2 = Cast(this.targetDoc!.anchor2, Doc); + const doc1 = Cast(this.targetDoc!.anchor1, Doc); + const doc2 = Cast(this.targetDoc!.anchor2, Doc); if (this.targetDoc.isBucket === true){ this.props.Document._viewType=CollectionViewType.Stacking; this.props.Document._chromeStatus='disabled'; @@ -395,8 +395,8 @@ export class SearchItem extends ViewBoxBaseComponent
- {/* {(doc1 instanceof Doc && doc2 instanceof Doc) && this.targetDoc!.type === DocumentType.LINK ? : - this.contextButton} */} + {(doc1 instanceof Doc && doc2 instanceof Doc) && this.targetDoc!.type === DocumentType.LINK ? : + this.contextButton}
; -- cgit v1.2.3-70-g09d2