From a0f266b7dd7946a12be0d17b523b0a45570c80a6 Mon Sep 17 00:00:00 2001 From: Andy Rickert Date: Tue, 28 Jul 2020 17:03:53 -0400 Subject: filter and other small features --- .../views/collections/CollectionSchemaView.scss | 1 - .../views/collections/CollectionSchemaView.tsx | 1 + src/client/views/nodes/FieldView.tsx | 5 +- src/client/views/search/SearchBox.tsx | 194 +++------------------ 4 files changed, 28 insertions(+), 173 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/CollectionSchemaView.scss b/src/client/views/collections/CollectionSchemaView.scss index 83fe54c82..93878d799 100644 --- a/src/client/views/collections/CollectionSchemaView.scss +++ b/src/client/views/collections/CollectionSchemaView.scss @@ -25,7 +25,6 @@ .collectionSchemaView-tableContainer { width: 100%; height: 100%; - overflow: auto; } .collectionSchemaView-dividerDragger { diff --git a/src/client/views/collections/CollectionSchemaView.tsx b/src/client/views/collections/CollectionSchemaView.tsx index 4ecc7ba60..d3c975e5d 100644 --- a/src/client/views/collections/CollectionSchemaView.tsx +++ b/src/client/views/collections/CollectionSchemaView.tsx @@ -628,6 +628,7 @@ export class CollectionSchemaView extends CollectionSubView(doc => doc) { ; return
diff --git a/src/client/views/nodes/FieldView.tsx b/src/client/views/nodes/FieldView.tsx index 732a254fe..c9fc99a31 100644 --- a/src/client/views/nodes/FieldView.tsx +++ b/src/client/views/nodes/FieldView.tsx @@ -46,9 +46,10 @@ export interface FieldViewProps { dontRegisterView?: boolean; focus: (doc: Doc) => void; ignoreAutoHeight?: boolean; - PanelWidth: () => number|string; - PanelHeight: () => number|string; + PanelWidth: () => number | string; + PanelHeight: () => number | string; PanelPosition: string; + overflow?: boolean; NativeHeight: () => number; NativeWidth: () => number; setVideoBox?: (player: VideoBox) => void; diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx index 7601ea12e..73932896b 100644 --- a/src/client/views/search/SearchBox.tsx +++ b/src/client/views/search/SearchBox.tsx @@ -452,39 +452,22 @@ export class SearchBox extends ViewBoxBaseComponent { - // let hlights: string[] = []; - // const protos = Doc.GetAllPrototypes(d); - // let proto = protos[protos.length - 2]; - // Object.keys(proto).forEach(key => { - // console.log(key); - // console.log(StrCast(this.layoutDoc._searchString)); - // Doc.setDocFilter(selectedCollection.props.Document, key, StrCast(this.layoutDoc._searchString), "match"); - - // // if (StrCast(d[key]).includes(query)) { - // // console.log(key, d[key]); - // // hlights.push(key); - // // } - // }); - // // if (hlights.length > 0) { - // // found.push([d, hlights, []]); - // // }; - // }); - // console.log(found); - // this._results = found; - // this._numTotalResults = found.length; + let doc = undefined; + if (this.scale === false) { + doc = SelectionManager.SelectedDocuments()[0].props.Document; + } + console.log(this.scale); + if (this.scale === true) { + doc = Cast(Doc.UserDoc().myWorkspaces, Doc) as Doc; + doc = DocListCast(doc.data)[0]; + } + if (doc !== undefined) { + console.log(StrCast(doc.title)); + Doc.setDocFilter(doc, key, values, "match"); } else { this.noresults = "No collection selected :("; } - - //Doc.setDocFilter(this.props.Document, newKey, filter, "match"); } @action @@ -512,7 +495,6 @@ export class SearchBox extends ViewBoxBaseComponent { console.log("Resubmitting search"); - }, 60000); } @@ -708,7 +690,7 @@ export class SearchBox extends ViewBoxBaseComponent(); + let headers = new Set(["title", "author", "creationDate"]); if ((this._numTotalResults === 0 || this._results.length === 0) && this._openNoResults) { if (this.noresults === "") { this.noresults = "No search results :("; @@ -986,125 +968,6 @@ export class SearchBox extends ViewBoxBaseComponent Doc.RemoveDocFromList(CurrentUserUtils.UserDocument.expandingButtons as Doc, "data", doc); moveButtonDoc = (doc: Doc, targetCollection: Doc | undefined, addDocument: (document: Doc) => boolean) => this.remButtonDoc(doc) && addDocument(doc); - @computed get docButtons() { - const nodeBtns = this.props.Document.nodeButtons; - let width = () => NumCast(this.props.Document._width); - // if (StrCast(this.props.Document.title)==="sidebar search stack"){ - width = MainView.Instance.flyoutWidthFunc; - - // } - if (nodeBtns instanceof Doc) { - return
- 100} - renderDepth={0} - backgroundColor={returnEmptyString} - focus={emptyFunction} - parentActive={returnTrue} - whenActiveChanged={emptyFunction} - bringToFront={emptyFunction} - ContainingCollectionView={undefined} - ContainingCollectionDoc={undefined} - NativeHeight={() => 100} - NativeWidth={width} - /> -
; - } - return (null); - } - - @computed get keyButtons() { - const nodeBtns = this.props.Document.keyButtons; - let width = () => NumCast(this.props.Document._width); - // if (StrCast(this.props.Document.title)==="sidebar search stack"){ - width = MainView.Instance.flyoutWidthFunc; - // } - if (nodeBtns instanceof Doc) { - return
- 100} - renderDepth={0} - backgroundColor={returnEmptyString} - focus={emptyFunction} - parentActive={returnTrue} - whenActiveChanged={emptyFunction} - bringToFront={emptyFunction} - ContainingCollectionView={undefined} - ContainingCollectionDoc={undefined} - NativeHeight={() => 100} - NativeWidth={width} - /> -
; - } - return (null); - } - - @computed get defaultButtons() { - const defBtns = this.props.Document.defaultButtons; - let width = () => NumCast(this.props.Document._width); - // if (StrCast(this.props.Document.title)==="sidebar search stack"){ - width = MainView.Instance.flyoutWidthFunc; - // } - if (defBtns instanceof Doc) { - return
- 100} - renderDepth={0} - backgroundColor={returnEmptyString} - focus={emptyFunction} - parentActive={returnTrue} - whenActiveChanged={emptyFunction} - bringToFront={emptyFunction} - ContainingCollectionView={undefined} - ContainingCollectionDoc={undefined} - NativeHeight={() => 100} - NativeWidth={width} - /> -
; - } - return (null); - } - @action.bound updateIcon = async (icon: string) => { if (this._icons.includes(icon)) { @@ -1223,15 +1086,17 @@ export class SearchBox extends ViewBoxBaseComponent 3 ? length = 650 : length = length * 205 + 51; - let height = this.children; - height > 8 ? height = 31 + 31 * 8 : height = 31 * height + 31; + let cols = Cast(this.props.Document._schemaHeaders, listSpec(SchemaHeaderField), []).length; + let length = 0; + cols > 5 ? length = 1076 : length = cols * 205 + 51; + let height = 0; + let rows = this.children; + rows > 8 ? height = 31 + 31 * 8 : height = 31 * rows + 31; return (
@@ -1239,28 +1104,16 @@ export class SearchBox extends ViewBoxBaseComponent */}
{Doc.CurrentUserEmail}
- + StrCast(this.layoutDoc._searchString) ? this.startDragCollection() : undefined)} icon={"search"} size="lg" style={{ position: "relative", left: 24, padding: 1 }} /> - {/* */} -
-
0 ? { overflow: "visible" } : { overflow: "hidden" }}> -
- {this.defaultButtons} -
-
- {this.docButtons} -
-
- {this.keyButtons} -
{this._searchbarOpen === true ?
0 ? length : 253, + width: cols > 0 ? length : 253, height: 25, borderColor: "#9c9396", border: "1px solid", @@ -1315,9 +1168,10 @@ export class SearchBox extends ViewBoxBaseComponent height : () => 0} PanelWidth={this.open === true ? () => length : () => 0} PanelPosition={"absolute"} + overflow={cols > 5 || rows > 8 ? true : false} focus={this.selectElement} ScreenToLocalTransform={Transform.Identity} - />
:
+ />
:
{this.noresults}
}
: undefined} -- cgit v1.2.3-70-g09d2