diff options
author | Andy Rickert <andrew_rickert@brown.edu> | 2020-03-31 16:15:10 -0700 |
---|---|---|
committer | Andy Rickert <andrew_rickert@brown.edu> | 2020-03-31 16:15:10 -0700 |
commit | b33ba2eb7a4bb6744f07c3ee8d86c55ec7b599b5 (patch) | |
tree | 88f4d21c08f4a1218000f8c8b88e2689e5247b0d /src/client/views/nodes/QueryBox.tsx | |
parent | 13e6b075154001ce33845a72454e3cd039a92670 (diff) |
more settings ui + huge bugfixes with document dragging and selection
Diffstat (limited to 'src/client/views/nodes/QueryBox.tsx')
-rw-r--r-- | src/client/views/nodes/QueryBox.tsx | 61 |
1 files changed, 54 insertions, 7 deletions
diff --git a/src/client/views/nodes/QueryBox.tsx b/src/client/views/nodes/QueryBox.tsx index b2f9ca8fe..995effd1b 100644 --- a/src/client/views/nodes/QueryBox.tsx +++ b/src/client/views/nodes/QueryBox.tsx @@ -1,12 +1,22 @@ import React = require("react"); import { library } from '@fortawesome/fontawesome-svg-core'; import { faArrowLeft, faArrowRight, faEdit, faMinus, faPlay, faPlus, faStop, faTimes } from '@fortawesome/free-solid-svg-icons'; -import { IReactionDisposer } from "mobx"; +import { IReactionDisposer, computed } from "mobx"; import { observer } from "mobx-react"; import { FilterBox } from "../search/FilterBox"; import { FieldView, FieldViewProps } from './FieldView'; import "./PresBox.scss"; import { SearchBox } from "../search/SearchBox"; +import { SelectionManager } from "../../util/SelectionManager"; +import { CollectionFreeFormView } from "../collections/collectionFreeForm/CollectionFreeFormView"; +import { emptyFunction, returnOne } from "../../../Utils"; +import { DocAnnotatableComponent } from '../DocComponent'; +import { makeInterface, createSchema } from "../../../new_fields/Schema"; +import { documentSchema } from "../../../new_fields/documentSchemas"; +import { TraceMobx } from "../../../new_fields/util"; +import { Id } from '../../../new_fields/FieldSymbols'; + + library.add(faArrowLeft); library.add(faArrowRight); @@ -17,8 +27,19 @@ library.add(faTimes); library.add(faMinus); library.add(faEdit); +export const pageSchema = createSchema({ + curPage: "number", + fitWidth: "boolean", + googlePhotosUrl: "string", + googlePhotosTags: "string" +}); + + +type QueryDocument = makeInterface<[typeof pageSchema, typeof documentSchema]>; +const QueryDocument = makeInterface(pageSchema, documentSchema); + @observer -export class QueryBox extends React.Component<FieldViewProps> { +export class QueryBox extends DocAnnotatableComponent<FieldViewProps, QueryDocument>(QueryDocument) { public static LayoutString(fieldKey: string) { return FieldView.LayoutString(QueryBox, fieldKey); } _docListChangedReaction: IReactionDisposer | undefined; componentDidMount() { @@ -28,12 +49,38 @@ export class QueryBox extends React.Component<FieldViewProps> { this._docListChangedReaction && this._docListChangedReaction(); } - render() { - return <div style={{ width: "100%", height: "100%", position: "absolute", pointerEvents: "all" }}> - <div style={{ display: "flex", flexDirection: "row-reverse" }}> - <SearchBox /> - </div> + @computed get content() { + let key = this.props.Document[Id]; + return <SearchBox id={key}/> + } + contentFunc = () => [this.content]; + + render() { + const dragging = !SelectionManager.GetIsDragging() ? "" : "-dragging"; + return <div className={`queryBox${dragging}`} style={{ width: "100%", height: "100%", position: "absolute", pointerEvents: "all" }} > + {/* <CollectionFreeFormView {...this.props} + PanelHeight={this.props.PanelHeight} + PanelWidth={this.props.PanelWidth} + annotationsKey={this.annotationKey} + isAnnotationOverlay={true} + focus={this.props.focus} + isSelected={this.props.isSelected} + select={emptyFunction} + active={this.active} + ContentScaling={returnOne} + whenActiveChanged={this.whenActiveChanged} + removeDocument={this.removeDocument} + moveDocument={this.moveDocument} + addDocument={this.addDocument} + CollectionView={undefined} + ScreenToLocalTransform={this.props.ScreenToLocalTransform} + renderDepth={this.props.renderDepth + 1} + ContainingCollectionDoc={this.props.ContainingCollectionDoc} + chromeCollapsed={true}> + {this.contentFunc} + </CollectionFreeFormView> */} + {this.contentFunc()} </div >; } }
\ No newline at end of file |