diff options
Diffstat (limited to 'src/new_fields/Doc.ts')
-rw-r--r-- | src/new_fields/Doc.ts | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/new_fields/Doc.ts b/src/new_fields/Doc.ts index 5f790f886..1373431b8 100644 --- a/src/new_fields/Doc.ts +++ b/src/new_fields/Doc.ts @@ -14,7 +14,7 @@ import { PrefetchProxy, ProxyField } from "./Proxy"; import { FieldId, RefField } from "./RefField"; import { RichTextField } from "./RichTextField"; import { listSpec } from "./Schema"; -import { ComputedField } from "./ScriptField"; +import { ComputedField, ScriptField } from "./ScriptField"; import { Cast, FieldValue, NumCast, StrCast, ToConstructor, ScriptCast } from "./Types"; import { deleteProperty, getField, getter, makeEditable, makeReadOnly, setter, updateFunction } from "./util"; import { Docs } from "../client/documents/Documents"; @@ -913,6 +913,22 @@ export namespace Doc { return false; } + export function makeStarburst(newCollection: Doc) { + newCollection._layoutEngine = "starburst"; + newCollection._fitToBox = true; + newCollection.overflow = "visible"; + const script = "if (self._layoutEngine === 'starburst') {" + + " self._layoutEngine = 'pass';" + + " self.overflow = undefined;" + + " self.fitToContentScaling=undefined;" + + " } else {" + + " self._layoutEngine = 'starburst';" + + " self.overflow = 'visible';" + + " self.fitToContentScaling=10;" + + " };"; + newCollection.onClick = ScriptField.MakeScript(script, { self: Doc.name }); + } + export async function addFieldEnumerations(doc: Opt<Doc>, enumeratedFieldKey: string, enumerations: { title: string, _backgroundColor?: string, color?: string }[]) { let optionsCollection = await DocServer.GetRefField(enumeratedFieldKey); |