diff options
| author | bobzel <zzzman@gmail.com> | 2024-03-17 11:50:15 -0400 |
|---|---|---|
| committer | bobzel <zzzman@gmail.com> | 2024-03-17 11:50:15 -0400 |
| commit | 606088e419f0e146715244d00840349b587c80ba (patch) | |
| tree | ecf522255ef5d9b43e4577176cd0dc0e5bb2e660 /src/client/views/nodes/FieldView.tsx | |
| parent | 92879a2f211f5e5c3c5fe5b28bd25a6f22d274ee (diff) | |
use metakey to edit computedfield result instead of expression in schema cell, set default new field values on data doc. fixed stacking view from autoresizing when switching to a different collection view. changed syntax for setting fields in text docs to use ':=' for computed fields. Added call to Chat in computed functions when (( )) is used. Added caching of computed function result when a function called by ComputedField uses the _setCacheResult_ method (currently only gptCallChat).
Diffstat (limited to 'src/client/views/nodes/FieldView.tsx')
| -rw-r--r-- | src/client/views/nodes/FieldView.tsx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/client/views/nodes/FieldView.tsx b/src/client/views/nodes/FieldView.tsx index 8a49b4757..4ecaaa283 100644 --- a/src/client/views/nodes/FieldView.tsx +++ b/src/client/views/nodes/FieldView.tsx @@ -11,6 +11,7 @@ import { ViewBoxInterface } from '../DocComponent'; import { CollectionFreeFormDocumentView } from './CollectionFreeFormDocumentView'; import { DocumentView, OpenWhere } from './DocumentView'; import { PinProps } from './trails'; +import { computed } from 'mobx'; export interface FocusViewOptions { willPan?: boolean; // determines whether to pan to target document @@ -121,9 +122,12 @@ export class FieldView extends React.Component<FieldViewProps> { public static LayoutString(fieldType: { name: string }, fieldStr: string) { return `<${fieldType.name} {...props} fieldKey={'${fieldStr}'}/>`; //e.g., "<ImageBox {...props} fieldKey={'data'} />" } + @computed get fieldval() { + return this.props.Document[this.props.fieldKey]; + } render() { - const field = this.props.Document[this.props.fieldKey]; + const field = this.fieldval; // prettier-ignore if (field instanceof Doc) return <p> <b>{field.title?.toString()}</b></p>; if (field === undefined) return <p>{'<null>'}</p>; |
