aboutsummaryrefslogtreecommitdiff
path: root/src/fields/Doc.ts
diff options
context:
space:
mode:
authorusodhi <61431818+usodhi@users.noreply.github.com>2020-09-04 15:00:49 +0530
committerusodhi <61431818+usodhi@users.noreply.github.com>2020-09-04 15:00:49 +0530
commit1afe593b00b8002c24086d003d0e364260b80abd (patch)
tree672c96d6ccf7d68ac668a379b1c5a6ee6d393dbe /src/fields/Doc.ts
parentde49c6f52bf97f9b10008e8ca26e767b71b49abd (diff)
parent7f6f5acc59e772cb828b8e532e16d4c40465de65 (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into acls_uv
Diffstat (limited to 'src/fields/Doc.ts')
-rw-r--r--src/fields/Doc.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts
index bc31c1a21..08d949b5e 100644
--- a/src/fields/Doc.ts
+++ b/src/fields/Doc.ts
@@ -23,6 +23,7 @@ import { deleteProperty, getField, getter, makeEditable, makeReadOnly, setter, u
import { LinkManager } from "../client/util/LinkManager";
import JSZip = require("jszip");
import { saveAs } from "file-saver";
+import { CollectionDockingView } from "../client/views/collections/CollectionDockingView";
export namespace Field {
export function toKeyValueString(doc: Doc, key: string): string {
@@ -1048,7 +1049,8 @@ export namespace Doc {
doc.layoutKey = deiconify || "layout";
}
export function setDocFilterRange(target: Doc, key: string, range?: number[]) {
- const docRangeFilters = Cast(target._docRangeFilters, listSpec("string"), []);
+ const container = target ?? CollectionDockingView.Instance.props.Document;
+ const docRangeFilters = Cast(container._docRangeFilters, listSpec("string"), []);
for (let i = 0; i < docRangeFilters.length; i += 3) {
if (docRangeFilters[i] === key) {
docRangeFilters.splice(i, 3);
@@ -1059,14 +1061,15 @@ export namespace Doc {
docRangeFilters.push(key);
docRangeFilters.push(range[0].toString());
docRangeFilters.push(range[1].toString());
- target._docRangeFilters = new List<string>(docRangeFilters);
+ container._docRangeFilters = new List<string>(docRangeFilters);
}
}
// filters document in a container collection:
// all documents with the specified value for the specified key are included/excluded
// based on the modifiers :"check", "x", undefined
- export function setDocFilter(container: Doc, key: string, value: any, modifiers?: "remove" | "match" | "check" | "x" | undefined) {
+ export function setDocFilter(target: Opt<Doc>, key: string, value: any, modifiers?: "remove" | "match" | "check" | "x" | undefined) {
+ const container = target ?? CollectionDockingView.Instance.props.Document;
const docFilters = Cast(container._docFilters, listSpec("string"), []);
runInAction(() => {
for (let i = 0; i < docFilters.length; i += 3) {