diff options
| author | Stanley Yip <33562077+yipstanley@users.noreply.github.com> | 2019-07-30 19:40:00 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-07-30 19:40:00 -0400 |
| commit | b26a257e09b9f4d8375806acb7ad143802b93603 (patch) | |
| tree | 230fe76c093084c45105ec4c3b7a53f80b3eba86 /src/client/views/collections/KeyRestrictionRow.tsx | |
| parent | 36ac0409b2a7a752727eaf2fc289d8cc72487619 (diff) | |
| parent | 53b8bd7ff75ee500c999a4cbc87ed75e59ef1c21 (diff) | |
Merge branch 'master' into toggle_claire
Diffstat (limited to 'src/client/views/collections/KeyRestrictionRow.tsx')
| -rw-r--r-- | src/client/views/collections/KeyRestrictionRow.tsx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/client/views/collections/KeyRestrictionRow.tsx b/src/client/views/collections/KeyRestrictionRow.tsx index 9baa250a6..1b59547d8 100644 --- a/src/client/views/collections/KeyRestrictionRow.tsx +++ b/src/client/views/collections/KeyRestrictionRow.tsx @@ -2,6 +2,7 @@ import * as React from "react"; import { observable, runInAction } from "mobx"; import { observer } from "mobx-react"; import { PastelSchemaPalette } from "../../../new_fields/SchemaHeaderField"; +import { Doc } from "../../../new_fields/Doc"; interface IKeyRestrictionProps { contains: boolean; @@ -23,7 +24,10 @@ export default class KeyRestrictionRow extends React.Component<IKeyRestrictionPr parsedValue = parsed; type = "number"; } - let scriptText = `${this._contains ? "" : "!"}((doc.${this._key} as ${type})${type === "string" ? ".includes" : "<="}(${parsedValue}))`; + let scriptText = `${this._contains ? "" : "!"}(((doc.${this._key} && (doc.${this._key} as ${type})${type === "string" ? ".includes" : "<="}(${parsedValue}))) || + ((doc.data_ext && doc.data_ext.${this._key}) && (doc.data_ext.${this._key} as ${type})${type === "string" ? ".includes" : "<="}(${parsedValue}))))`; + // let doc = new Doc(); + // ((doc.data_ext && doc.data_ext!.text) && (doc.data_ext!.text as string).includes("hello")); this.props.script(scriptText); } else { |
