# HG changeset patch # User cin # Date 2021-05-18 15:13:39 # Node ID bcdd096122ff37c79e0a89d2c27ed7c4b6698e5c # Parent ca915f0520a543ec9cab71419609bd3827672047 DjxFragment converted to functionl component Added support for the widgets, null, undefined, boolean types to BuildContext diff --git a/src/main/ts/tsx/BuildContextBase.ts b/src/main/ts/tsx/BuildContextBase.ts --- a/src/main/ts/tsx/BuildContextBase.ts +++ b/src/main/ts/tsx/BuildContextBase.ts @@ -1,5 +1,5 @@ import { isNull, mixin } from "@implab/core-amd/safe"; -import { isPlainObject, isNode, isBuildContext, DojoNodePosition, BuildContext, isInPage } from "./traits"; +import { isPlainObject, isNode, isBuildContext, DojoNodePosition, BuildContext, isInPage, isWidget } from "./traits"; import dom = require("dojo/dom-construct"); import registry = require("dijit/registry"); @@ -29,7 +29,7 @@ export abstract class BuildContextBase fragment.appendChild(child)); } \ No newline at end of file diff --git a/src/main/ts/tsx/FunctionComponentContext.ts b/src/main/ts/tsx/FunctionComponentContext.ts --- a/src/main/ts/tsx/FunctionComponentContext.ts +++ b/src/main/ts/tsx/FunctionComponentContext.ts @@ -19,9 +19,9 @@ export class FunctionComponentContext ex _create(attrs: object, children: any[]) { const _attrs: any = attrs || {}; - _attrs.children = children.map(x => this.getChildDom(x)); + _attrs.children = children.map(x => this.getItemDom(x)); - this._node = this.getChildDom(this._component.call(null, _attrs)); + this._node = this.getItemDom(this._component.call(null, _attrs)); } _getDomNode() { diff --git a/src/main/ts/tsx/HtmlElementContext.ts b/src/main/ts/tsx/HtmlElementContext.ts --- a/src/main/ts/tsx/HtmlElementContext.ts +++ b/src/main/ts/tsx/HtmlElementContext.ts @@ -17,7 +17,7 @@ export class HtmlElementContext extends _addChild(child: any): void { if (!this._element) throw new Error("The HTML element isn't created"); - dom.place(this.getChildDom(child), this._element); + dom.place(this.getItemDom(child), this._element); } _create(attrs: object, children: any[]) { diff --git a/src/main/ts/tsx/WidgetContext.ts b/src/main/ts/tsx/WidgetContext.ts --- a/src/main/ts/tsx/WidgetContext.ts +++ b/src/main/ts/tsx/WidgetContext.ts @@ -45,14 +45,14 @@ export class WidgetContext extends Build throw new Error("The widget doesn't have neither addChild nor containerNode"); // the current widget isn't started, it's children shouldn't start too - dom.place(this.getChildDom(child), instance.containerNode); + dom.place(this.getItemDom(child), instance.containerNode); } } else { if (!instance.containerNode) throw new Error("The widget doesn't have neither addChild nor containerNode"); // the current widget isn't started, it's children shouldn't start too - dom.place(this.getChildDom(child), instance.containerNode); + dom.place(this.getItemDom(child), instance.containerNode); } } @@ -65,7 +65,7 @@ export class WidgetContext extends Build // render children to the DocumentFragment const content = document.createDocumentFragment(); - children.forEach(child => content.appendChild(this.getChildDom(child))); + children.forEach(child => content.appendChild(this.getItemDom(child))); // set the content property to the parameters of the widget const _attrs = { ...attrs, content };