diff options
| author | andrewdkim <adkim414@gmail.com> | 2019-07-29 12:24:03 -0400 |
|---|---|---|
| committer | andrewdkim <adkim414@gmail.com> | 2019-07-29 12:24:03 -0400 |
| commit | 10a5b5a99ae77d890412b3a3d25b6b85c935f25b (patch) | |
| tree | 506f98d8632df09cfc1f9d25bf0e81891575f623 /src/client/views/collections/CollectionSubView.tsx | |
| parent | afe2355cd66c98e391965ebfe022d8f8607ac794 (diff) | |
| parent | e7ea2028f54787d6c92fb22b789f17b7268d3793 (diff) | |
Merged from master
Diffstat (limited to 'src/client/views/collections/CollectionSubView.tsx')
| -rw-r--r-- | src/client/views/collections/CollectionSubView.tsx | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx index 26ebbfe63..fceb40c42 100644 --- a/src/client/views/collections/CollectionSubView.tsx +++ b/src/client/views/collections/CollectionSubView.tsx @@ -21,6 +21,7 @@ import React = require("react"); import { MainView } from "../MainView"; import { Utils } from "../../../Utils"; import { DocComponent } from "../DocComponent"; +import { ScriptField } from "../../../new_fields/ScriptField"; export interface CollectionViewProps extends FieldViewProps { addDocument: (document: Doc, allowDuplicates?: boolean) => boolean; @@ -28,6 +29,7 @@ export interface CollectionViewProps extends FieldViewProps { moveDocument: (document: Doc, targetCollection: Doc, addDocument: (document: Doc) => boolean) => boolean; PanelWidth: () => number; PanelHeight: () => number; + chromeCollapsed: boolean; } export interface SubCollectionViewProps extends CollectionViewProps { @@ -54,7 +56,18 @@ export function CollectionSubView<T>(schemaCtor: (doc: Doc) => T) { let self = this; //TODO tfs: This might not be what we want? //This linter error can't be fixed because of how js arguments work, so don't switch this to filter(FieldValue) - return DocListCast(this.extensionDoc[this.props.fieldExt ? this.props.fieldExt : this.props.fieldKey]); + let docs = DocListCast(this.extensionDoc[this.props.fieldExt ? this.props.fieldExt : this.props.fieldKey]); + let viewSpecScript = Cast(this.props.Document.viewSpecScript, ScriptField); + if (viewSpecScript) { + let script = viewSpecScript.script; + docs = docs.filter(d => { + let res = script.run({ doc: d }); + if (res.success) { + return res.result; + } + }); + } + return docs; } get childDocList() { //TODO tfs: This might not be what we want? |
