diff options
author | bobzel <zzzman@gmail.com> | 2025-03-24 20:13:43 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2025-03-24 20:13:43 -0400 |
commit | 70898430dc45ec3422ab2e05fc46054ba56a1909 (patch) | |
tree | fdd949846e93f93f3342064f1302a3f427e20495 /src | |
parent | c1a474fd2cf633fa204f1bb6dce2539f4b172d6c (diff) |
fixed iconifying collections to show image icon. fixed shortcut for using cached template. fixed onClick prop type
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/DocComponent.tsx | 4 | ||||
-rw-r--r-- | src/client/views/collections/CollectionSubView.tsx | 4 | ||||
-rw-r--r-- | src/client/views/nodes/DocumentContentsView.tsx | 2 | ||||
-rw-r--r-- | src/client/views/nodes/FieldView.tsx | 2 | ||||
-rw-r--r-- | src/fields/Doc.ts | 6 |
5 files changed, 10 insertions, 8 deletions
diff --git a/src/client/views/DocComponent.tsx b/src/client/views/DocComponent.tsx index 8f254ddcd..3a868d1f9 100644 --- a/src/client/views/DocComponent.tsx +++ b/src/client/views/DocComponent.tsx @@ -192,7 +192,9 @@ export function ViewBoxAnnotatableComponent<P extends FieldViewProps>() { * This is the unique data repository for a dcoument that stores the intrinsic document data */ @computed get dataDoc() { - return this._renderDoc.isTemplateForField || this._renderDoc.isTemplateDoc ? (this._props.TemplateDataDocument ?? this._renderDoc[DocData]) : this._props.Document[DocData]; + return this._renderDoc.isTemplateForField || this._renderDoc.isTemplateDoc ? + (this._props.TemplateDataDocument ?? this._renderDoc[DocData]) : + this._props.Document[DocData]; // prettier-ignore } /** diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx index a43cf0755..7d487fed8 100644 --- a/src/client/views/collections/CollectionSubView.tsx +++ b/src/client/views/collections/CollectionSubView.tsx @@ -109,8 +109,8 @@ export function CollectionSubView<X>() { get dataDoc() { return this._props.TemplateDataDocument instanceof Doc && this.layoutDoc.isTemplateForField // - ? this._props.TemplateDataDocument[DocData] - : this.layoutDoc.resolvedDataDoc + ? Doc.GetProto(this._props.TemplateDataDocument) + : this.Document.resolvedDataDoc ? this._props.Document : this.Document[DocData]; // if the layout document has a resolvedDataDoc, then we don't want to get its parent which would be the unexpanded template } diff --git a/src/client/views/nodes/DocumentContentsView.tsx b/src/client/views/nodes/DocumentContentsView.tsx index 47c5734f7..d1eae1784 100644 --- a/src/client/views/nodes/DocumentContentsView.tsx +++ b/src/client/views/nodes/DocumentContentsView.tsx @@ -113,7 +113,7 @@ export class DocumentContentsView extends ObservableReactComponent<DocumentConte this._props.LayoutTemplate?.() || (this._props.LayoutTemplateString && this._props.Document) || (this._props.layoutFieldKey && StrCast(this._props.Document[this._props.layoutFieldKey]) && this._props.Document) || - Doc.Layout(this._props.Document, this._props.layoutFieldKey ? Cast(this._props.Document[this._props.layoutFieldKey], Doc, null) : undefined); + Doc.Layout(this._props.Document, DocCast(this._props.Document[this._props.layoutFieldKey])); return Doc.expandTemplateLayout(template, this._props.Document); } diff --git a/src/client/views/nodes/FieldView.tsx b/src/client/views/nodes/FieldView.tsx index f82e980f5..933868c46 100644 --- a/src/client/views/nodes/FieldView.tsx +++ b/src/client/views/nodes/FieldView.tsx @@ -80,7 +80,7 @@ export interface FieldViewSharedProps { styleProvider: Opt<StyleProviderFuncType>; setTitleFocus?: () => void; focus: FocusFuncType; - onClickScript?: () => ScriptField; + onClickScript?: () => ScriptField | undefined; onDoubleClickScript?: () => ScriptField; onPointerDownScript?: () => ScriptField; onPointerUpScript?: () => ScriptField; diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index 4bf04da5c..803e4cac0 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -1154,9 +1154,9 @@ export namespace Doc { // the document containing the view layout information - will be the Document itself unless the Document has // a layout field or 'layout' is given. - export function Layout(doc: Doc, layout?: Doc): Doc { - const overrideLayout = layout && Cast(doc[layout.title + '(' + StrCast(layout.isTemplateForField, 'data') + ')'], Doc, null); - return overrideLayout || doc[DocLayout] || doc; + export function Layout(doc: Doc, template?: Doc): Doc { + const expandedTemplate = template && Cast(doc['layout_' + template.title + '(' + StrCast(template.isTemplateForField, 'data') + ')'], Doc, null); + return expandedTemplate || doc[DocLayout] || doc; } export function SetLayout(doc: Doc, layout: Doc | string) { doc[StrCast(doc.layout_fieldKey, 'layout')] = layout; |