diff options
author | bobzel <zzzman@gmail.com> | 2020-09-28 00:39:13 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2020-09-28 00:39:13 -0400 |
commit | 0ba42a96a69f79b388c3279d683636f8cf6b0eab (patch) | |
tree | d2a0ca53866bd32ded2ade6120f5b6b05885e938 /src | |
parent | 8513eaae38d1cc4e8e9b30f656a4e58d22167351 (diff) |
fixed schemacells to accept '=' syntax to set on layout document.
Diffstat (limited to 'src')
-rw-r--r-- | src/client/util/SearchUtil.ts | 2 | ||||
-rw-r--r-- | src/client/views/collections/CollectionSchemaCells.tsx | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/client/util/SearchUtil.ts b/src/client/util/SearchUtil.ts index 6657ab19c..08ad49dcc 100644 --- a/src/client/util/SearchUtil.ts +++ b/src/client/util/SearchUtil.ts @@ -44,7 +44,7 @@ export namespace SearchUtil { const header = query.match(/_[atnb]?:/) ? replacedQuery : "DEFAULT:" + replacedQuery; replacedQuery = `{!join from=id to=proto_i}* AND ${header}`; } - console.log("Q: " + replacedQuery); + console.log("Q: " + replacedQuery + " fq: " + options.fq); const gotten = await rp.get(rpquery, { qs: { ...options, q: replacedQuery } }); const result: IdSearchResult = gotten.startsWith("<") ? { ids: [], docs: [], numFound: 0, lines: [] } : JSON.parse(gotten); if (!returnDocs) { diff --git a/src/client/views/collections/CollectionSchemaCells.tsx b/src/client/views/collections/CollectionSchemaCells.tsx index 1483da99e..2896a8243 100644 --- a/src/client/views/collections/CollectionSchemaCells.tsx +++ b/src/client/views/collections/CollectionSchemaCells.tsx @@ -241,8 +241,9 @@ export class CollectionSchemaCell extends React.Component<CellProps> { const script = value.substring(value.startsWith("=:=") ? 3 : 2); retVal = this.props.setComputed(script, value.startsWith(":=") ? this._rowDataDoc : this._rowDoc, this.renderFieldKey, this.props.row, this.props.col); } else { - const script = CompileScript(value, { requiredType: type, typecheck: false, editable: true, addReturn: true, params: { this: Doc.name, $r: "number", $c: "number", $: "any" } }); - script.compiled && (retVal = this.applyToDoc(this._rowDataDoc, this.props.row, this.props.col, script.run)); + const inputscript = value.substring(value.startsWith("=") ? 1 : 0); + const script = CompileScript(inputscript, { requiredType: type, typecheck: false, editable: true, addReturn: true, params: { this: Doc.name, $r: "number", $c: "number", $: "any" } }); + script.compiled && (retVal = this.applyToDoc(inputscript.length !== value.length ? this._rowDoc : this._rowDataDoc, this.props.row, this.props.col, script.run)); } if (retVal) { this._isEditing = false; // need to set this here. otherwise, the assignment of the field will invalidate & cause render() to be called with the wrong value for 'editing' |