aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionSchemaCells.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/collections/CollectionSchemaCells.tsx')
-rw-r--r--src/client/views/collections/CollectionSchemaCells.tsx13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/client/views/collections/CollectionSchemaCells.tsx b/src/client/views/collections/CollectionSchemaCells.tsx
index 3452e8702..4dac27e60 100644
--- a/src/client/views/collections/CollectionSchemaCells.tsx
+++ b/src/client/views/collections/CollectionSchemaCells.tsx
@@ -39,7 +39,7 @@ export interface CellProps {
Document: Doc;
fieldKey: string;
renderDepth: number;
- addDocTab: (document: Doc, dataDoc: Doc | undefined, where: string) => void;
+ addDocTab: (document: Doc, dataDoc: Doc | undefined, where: string) => boolean;
pinToPres: (document: Doc) => void;
moveDocument: (document: Doc, targetCollection: Doc, addDocument: (document: Doc) => boolean) => boolean;
isFocused: boolean;
@@ -151,6 +151,7 @@ export class CollectionSchemaCell extends React.Component<CellProps> {
fieldExt: "",
ruleProvider: undefined,
ContainingCollectionView: this.props.CollectionView,
+ ContainingCollectionDoc: this.props.CollectionView.props.Document,
isSelected: returnFalse,
select: emptyFunction,
renderDepth: this.props.renderDepth + 1,
@@ -237,13 +238,11 @@ export class CollectionSchemaCell extends React.Component<CellProps> {
return this.applyToDoc(props.Document, this.props.row, this.props.col, script.run);
}}
OnFillDown={async (value: string) => {
- let script = CompileScript(value, { requiredType: type, addReturn: true, params: { this: Doc.name, $r: "number", $c: "number", $: "any" } });
- if (!script.compiled) {
- return;
+ const script = CompileScript(value, { requiredType: type, addReturn: true, params: { this: Doc.name, $r: "number", $c: "number", $: "any" } });
+ if (script.compiled) {
+ DocListCast(this.props.Document[this.props.fieldKey]).
+ forEach((doc, i) => this.applyToDoc(doc, i, this.props.col, script.run));
}
- const run = script.run;
- const val = await DocListCastAsync(this.props.Document[this.props.fieldKey]);
- val && val.forEach((doc, i) => this.applyToDoc(doc, i, this.props.col, run));
}}
/>
</div >