diff options
author | bobzel <zzzman@gmail.com> | 2024-09-17 18:31:09 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2024-09-17 18:31:09 -0400 |
commit | 0653464370398188b23bb490c16b5a2ccf0300c3 (patch) | |
tree | 3dff6b5a05b6e4f5d3ad489b3e34ece487b836ac /src/fields/Doc.ts | |
parent | 35d19c29c2f628792a379534df6d5760e49cfb8f (diff) | |
parent | 4f2ee4a8642a93fb399b979750078374b317af32 (diff) |
merged with master + cleanup of carousel code
Diffstat (limited to 'src/fields/Doc.ts')
-rw-r--r-- | src/fields/Doc.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index 7abba7679..29903cfb5 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -24,6 +24,7 @@ import { listSpec } from './Schema'; import { ComputedField, ScriptField } from './ScriptField'; import { BoolCast, Cast, DocCast, FieldValue, NumCast, StrCast, ToConstructor, toList } from './Types'; import { containedFieldChangedHandler, deleteProperty, GetEffectiveAcl, getField, getter, makeEditable, makeReadOnly, setter, SharingPermissions } from './util'; +import { KEY } from 'google-maps'; export let ObjGetRefField: (id: string, force?: boolean) => Promise<Doc | undefined>; export let ObjGetRefFields: (ids: string[]) => Promise<Map<string, Doc | undefined>>; @@ -1360,6 +1361,13 @@ export namespace Doc { export const FilterAny = '--any--'; export const FilterNone = '--undefined--'; + export function hasDocFilter(container: Opt<Doc>, key: string, fieldPrefix?: string) { + if (!container) return; + const filterField = '_' + (fieldPrefix ? fieldPrefix + '_' : '') + 'childFilters'; + const childFilters = StrListCast(container[filterField]); + return childFilters.some(filter => filter.split(FilterSep)[0] === key); + } + // 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 |