# HG changeset patch # User cin # Date 2021-02-05 17:25:05 # Node ID 0b9593714536028520171116aefd638c23b8c559 # Parent 0b41300b6dd9e4476c133c05648a68af7a89094f Fixed startup of DjxWidgetBase to start inner widgets added some traits to tsx/traits : destroy, emptyNode, startupWidgets diff --git a/src/main/ts/dom-inject.ts b/src/main/ts/dom-inject.ts --- a/src/main/ts/dom-inject.ts +++ b/src/main/ts/dom-inject.ts @@ -40,7 +40,7 @@ class DomInject { const noerr = on(node, "error", e => { fail({ - erorr: e, + error: e, node }); cleanup(); diff --git a/src/main/ts/tsx/DjxWidgetBase.ts b/src/main/ts/tsx/DjxWidgetBase.ts --- a/src/main/ts/tsx/DjxWidgetBase.ts +++ b/src/main/ts/tsx/DjxWidgetBase.ts @@ -1,7 +1,7 @@ import { djbase, djclass } from "../declare"; import _WidgetBase = require("dijit/_WidgetBase"); import _AttachMixin = require("dijit/_AttachMixin"); -import { BuildContext, isNode } from "./traits"; +import { BuildContext, isNode, startupWidgets } from "./traits"; import registry = require("dijit/registry"); // type Handle = dojo.Handle; @@ -66,4 +66,12 @@ export abstract class DjxWidgetBase { elementType: string; diff --git a/src/main/ts/tsx/traits.ts b/src/main/ts/tsx/traits.ts --- a/src/main/ts/tsx/traits.ts +++ b/src/main/ts/tsx/traits.ts @@ -1,4 +1,8 @@ +import { IDestroyable } from "@implab/core-amd/interfaces"; +import { isDestroyable } from "@implab/core-amd/safe"; import _WidgetBase = require("dijit/_WidgetBase"); +import registry = require("dijit/registry"); +import dom = require("dojo/dom-construct"); type _WidgetBaseConstructor = typeof _WidgetBase; @@ -10,6 +14,10 @@ export interface BuildContext w.startup()); + } else { + target.startup(); + } +} \ No newline at end of file diff --git a/src/main/typings/index.d.ts b/src/main/typings/index.d.ts --- a/src/main/typings/index.d.ts +++ b/src/main/typings/index.d.ts @@ -14,7 +14,8 @@ declare namespace JSX { /** specifies handlers map for the events */ "data-dojo-attach-event": string; - + + /** @deprecated */ [attr: string]: any; } @@ -40,7 +41,23 @@ declare namespace JSX { type ElementAttrType = K extends keyof E ? RecursivePartial : string; - type LaxElement = ExcludeMembers, (...args: any[]) => any> & DjxIntrinsicAttributes; + + type ElementAttrNamesBlacklist = "children" | "getRootNode" | keyof EventTarget; + + /** This type extracts keys of the specified parameter E by the following rule: + * 1. skips all ElementAttrNamesBlacklist + * 2. skips all methods except with the signature of event handlers + */ + type AssignableElementAttrNames = { + [K in keyof E]: K extends ElementAttrNamesBlacklist ? never : + ((evt: Event) => any) extends E[K] ? K : + E[K] extends ((...args: any[]) => any) ? never : + K; + }[keyof E]; + + type LaxElement = + Pick> & + DjxIntrinsicAttributes; type LaxIntrinsicElementsMap = { [tag in keyof HTMLElementTagNameMap]: LaxElement