blob: 0fff0b57fd09ea5e4cae4221f04a69239ae37db0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
import React = require("react");
import { IReactionDisposer } from "mobx";
import { observer } from "mobx-react";
import { documentSchema } from "../../../fields/documentSchemas";
import { Id } from '../../../fields/FieldSymbols';
import { makeInterface, listSpec } from "../../../fields/Schema";
import { StrCast, Cast } from "../../../fields/Types";
import { ViewBoxAnnotatableComponent } from '../DocComponent';
import { SearchBox } from "../search/SearchBox";
import { FieldView, FieldViewProps } from './FieldView';
import "./QueryBox.scss";
import { List } from "../../../fields/List";
import { SnappingManager } from "../../util/SnappingManager";
type QueryDocument = makeInterface<[typeof documentSchema]>;
const QueryDocument = makeInterface(documentSchema);
@observer
export class QueryBox extends ViewBoxAnnotatableComponent<FieldViewProps, QueryDocument>(QueryDocument) {
public static LayoutString(fieldKey: string) { return FieldView.LayoutString(QueryBox, fieldKey); }
_docListChangedReaction: IReactionDisposer | undefined;
componentDidMount() {
}
componentWillUnmount() {
this._docListChangedReaction?.();
}
render() {
const dragging = !SnappingManager.GetIsDragging() ? "" : "-dragging";
return <div className={`queryBox${dragging}`} onWheel={(e) => e.stopPropagation()} >
<SearchBox
id={this.props.Document[Id]}
setSearchQuery={q => this.dataDoc.searchQuery = q}
searchQuery={StrCast(this.dataDoc.searchQuery)}
setSearchFileTypes={q => this.dataDoc.searchFileTypes = new List<string>(q)}
searchFileTypes={Cast(this.dataDoc.searchFileTypes, listSpec("string"), [])}
filterQquery={StrCast(this.dataDoc.filterQuery)} />
</div >;
}
}
|