diff options
| author | Andy Rickert <andrew_rickert@brown.edu> | 2020-08-04 22:05:30 -0400 |
|---|---|---|
| committer | Andy Rickert <andrew_rickert@brown.edu> | 2020-08-04 22:05:30 -0400 |
| commit | e83fd812ed3798a7e7c22ad132a2f9e8dccaa76c (patch) | |
| tree | 00bf6d6be5c6c40845c320dfbf3771bb823abfb5 /src/client/views/collections/CollectionSchemaCells.tsx | |
| parent | a59bcec29efb9b5ea0ba8ddfb4b9977b904c10b8 (diff) | |
changes
Diffstat (limited to 'src/client/views/collections/CollectionSchemaCells.tsx')
| -rw-r--r-- | src/client/views/collections/CollectionSchemaCells.tsx | 84 |
1 files changed, 82 insertions, 2 deletions
diff --git a/src/client/views/collections/CollectionSchemaCells.tsx b/src/client/views/collections/CollectionSchemaCells.tsx index ecd20eb06..6e19bb029 100644 --- a/src/client/views/collections/CollectionSchemaCells.tsx +++ b/src/client/views/collections/CollectionSchemaCells.tsx @@ -242,7 +242,7 @@ export class CollectionSchemaCell extends React.Component<CellProps> { // </div> // ); trace(); - let positions = []; + const positions = []; if (StrCast(this.props.Document._searchString) !== "") { const cfield = ComputedField.WithoutComputed(() => FieldValue(props.Document[props.fieldKey])); let term = ""; @@ -257,7 +257,7 @@ export class CollectionSchemaCell extends React.Component<CellProps> { term = String(NumCast(cfield)); } } - let search = StrCast(this.props.Document._searchString) + let search = StrCast(this.props.Document._searchString); let start = term.indexOf(search) as number; let tally = 0; if (start !== -1) { @@ -873,3 +873,83 @@ export class CollectionSchemaCheckboxCell extends CollectionSchemaCell { ); } } + + +@observer +export class CollectionSchemaButtons extends CollectionSchemaCell { + + render() { + // const reference = React.createRef<HTMLDivElement>(); + // const onItemDown = (e: React.PointerEvent) => { + // (!this.props.CollectionView || !this.props.CollectionView.props.isSelected() ? undefined : + // SetupDrag(reference, () => this._document, this.props.moveDocument, this.props.Document.schemaDoc ? "copy" : undefined)(e)); + // }; + let doc = this.props.rowProps.original; + let buttons = <div style={{ + paddingTop: 8, + paddingLeft: 3, + }}><button onClick={() => { + console.log(doc); + console.log(doc.searchMatch); + doc.searchMatch = false; + console.log(doc.searchMatch); + setTimeout(() => doc.searchMatch = true, 0); + console.log(doc.searchMatch); + doc.searchIndex = NumCast(doc.searchIndex); + }} style={{ padding: 2, left: 77 }}> + <FontAwesomeIcon icon="arrow-up" size="sm" /> + </button> + <button onClick={() => { + { + console.log(doc); + console.log(doc.searchMatch2); + doc.searchMatch2 = false; + console.log(doc.searchMatch2); + setTimeout(() => doc.searchMatch2 = true, 0); + console.log(doc.searchMatch2); + doc.searchIndex = NumCast(doc.searchIndex); + } + }} style={{ padding: 2 }}> + <FontAwesomeIcon icon="arrow-down" size="sm" /> + </button></div>; + const type = StrCast(doc.type); + console.log(StrCast(doc.type)); + if (type === "pdf") { + buttons = <div><button + style={{ + position: "relative", + height: 30, + width: 28, + left: 1, + }} + + onClick={() => { + console.log(doc); + console.log(doc.searchMatch); + doc.searchMatch = false; + console.log(doc.searchMatch); + setTimeout(() => doc.searchMatch = true, 0); + console.log(doc.searchMatch); + doc.searchIndex = NumCast(doc.searchIndex); + }}> + <FontAwesomeIcon icon="arrow-down" size="sm" /> + </button></div > + } + else if (type !== "rtf") { + console.log("sad"); + buttons = undefined; + } + + if (BoolCast(this.props.Document._searchDoc) === true) { + + } + else { + buttons = undefined; + } + + return ( + <div> {buttons}</div> + ); + } +} + |
