| @@ -13,7 +13,7 typescript { | |||||
| 13 | module = "amd" |
|
13 | module = "amd" | |
| 14 | it.target = "es5" |
|
14 | it.target = "es5" | |
| 15 | experimentalDecorators = true |
|
15 | experimentalDecorators = true | |
| 16 |
noUnusedLocals = |
|
16 | noUnusedLocals = false | |
| 17 | jsx = "react" |
|
17 | jsx = "react" | |
| 18 | jsxFactory = "createElement" |
|
18 | jsxFactory = "createElement" | |
| 19 | moduleResolution = "node" |
|
19 | moduleResolution = "node" | |
| @@ -114,6 +114,6 export const on = <E extends string>(... | |||||
| 114 | key: K, |
|
114 | key: K, | |
| 115 | _descriptor: TypedPropertyDescriptor<(eventObj: EV) => void> | TypedPropertyDescriptor<() => void> |
|
115 | _descriptor: TypedPropertyDescriptor<(eventObj: EV) => void> | TypedPropertyDescriptor<() => void> | |
| 116 | ): any => { |
|
116 | ): any => { | |
| 117 | const handlers = eventNames.map(eventName => ({ eventName, handlerMethod: key })) |
|
117 | const handlers = eventNames.map(eventName => ({ eventName, handlerMethod: key })); | |
| 118 | target._eventHandlers = target._eventHandlers ? target._eventHandlers.concat(handlers) : handlers; |
|
118 | target._eventHandlers = target._eventHandlers ? target._eventHandlers.concat(handlers) : handlers; | |
| 119 | }; |
|
119 | }; | |
| @@ -23,7 +23,6 export class HtmlRendition extends Rendi | |||||
| 23 | _create(attrs: object, children: any[]) { |
|
23 | _create(attrs: object, children: any[]) { | |
| 24 | this._element = dom.create(this.elementType, attrs); |
|
24 | this._element = dom.create(this.elementType, attrs); | |
| 25 |
|
25 | |||
| 26 | if (children) |
|
|||
| 27 |
|
|
26 | children.forEach(v => this._addChild(v)); | |
| 28 | } |
|
27 | } | |
| 29 |
|
28 | |||
| @@ -29,6 +29,7 export abstract class RenditionBase<TNod | |||||
| 29 | } |
|
29 | } | |
| 30 | } |
|
30 | } | |
| 31 |
|
31 | |||
|
|
32 | /** Renders DOM element for different types of the argument. */ | |||
| 32 | protected getItemDom(v: any) { |
|
33 | protected getItemDom(v: any) { | |
| 33 | const tv = typeof v; |
|
34 | const tv = typeof v; | |
| 34 |
|
35 | |||
| @@ -39,7 +40,7 export abstract class RenditionBase<TNod | |||||
| 39 | // nodes are kept as is |
|
40 | // nodes are kept as is | |
| 40 | return v; |
|
41 | return v; | |
| 41 | } else if (isRendition(v)) { |
|
42 | } else if (isRendition(v)) { | |
| 42 |
// renditions a |
|
43 | // renditions are instantiated | |
| 43 | return v.getDomNode(); |
|
44 | return v.getDomNode(); | |
| 44 | } else if (isWidget(v)) { |
|
45 | } else if (isWidget(v)) { | |
| 45 | // widgets are converted to it's markup |
|
46 | // widgets are converted to it's markup | |
| @@ -62,9 +63,9 export abstract class RenditionBase<TNod | |||||
| 62 | } |
|
63 | } | |
| 63 | } |
|
64 | } | |
| 64 |
|
65 | |||
| 65 | /** @deprecated will be removed in 1.0.0, use getDomNode() */ |
|
66 | /** Is rendition was instantiated to the DOM node */ | |
| 66 | getDomElement() { |
|
67 | isCreated() { | |
| 67 |
return this. |
|
68 | return this._created; | |
| 68 | } |
|
69 | } | |
| 69 |
|
70 | |||
| 70 | /** Creates DOM node if not created. No additional actions are taken. */ |
|
71 | /** Creates DOM node if not created. No additional actions are taken. */ | |
| @@ -107,7 +107,8 export function destroy(target: Node | I | |||||
| 107 | } else if (isDestroyable(target)) { |
|
107 | } else if (isDestroyable(target)) { | |
| 108 | target.destroy(); |
|
108 | target.destroy(); | |
| 109 | } else if (isNode(target)) { |
|
109 | } else if (isNode(target)) { | |
| 110 | const w = isElementNode(target) ? registry.byNode(target) : undefined; |
|
110 | if (isElementNode(target)) { | |
|
|
111 | const w = registry.byNode(target); | |||
| 111 | if (w) { |
|
112 | if (w) { | |
| 112 | w.destroyRecursive(); |
|
113 | w.destroyRecursive(); | |
| 113 | } else { |
|
114 | } else { | |
| @@ -116,6 +117,7 export function destroy(target: Node | I | |||||
| 116 | } |
|
117 | } | |
| 117 | } |
|
118 | } | |
| 118 | } |
|
119 | } | |
|
|
120 | } | |||
| 119 |
|
121 | |||
| 120 | /** Empties a content of the specified node and destroys all contained widgets. |
|
122 | /** Empties a content of the specified node and destroys all contained widgets. | |
| 121 | * |
|
123 | * | |
| @@ -134,13 +136,15 export function emptyNode(target: Node) | |||||
| 134 | */ |
|
136 | */ | |
| 135 | export function startupWidgets(target: Node | _WidgetBase, skipNode?: Node) { |
|
137 | export function startupWidgets(target: Node | _WidgetBase, skipNode?: Node) { | |
| 136 | if (isNode(target)) { |
|
138 | if (isNode(target)) { | |
| 137 | const w = isElementNode(target) ? registry.byNode(target) : undefined; |
|
139 | if (isElementNode(target)) { | |
|
|
140 | const w = registry.byNode(target); | |||
| 138 | if (w) { |
|
141 | if (w) { | |
| 139 | if (w.startup) |
|
142 | if (w.startup) | |
| 140 | w.startup(); |
|
143 | w.startup(); | |
| 141 | } else { |
|
144 | } else { | |
| 142 | registry.findWidgets(target, skipNode).forEach(x => x.startup()); |
|
145 | registry.findWidgets(target, skipNode).forEach(x => x.startup()); | |
| 143 | } |
|
146 | } | |
|
|
147 | } | |||
| 144 | } else { |
|
148 | } else { | |
| 145 | if (target.startup) |
|
149 | if (target.startup) | |
| 146 | target.startup(); |
|
150 | target.startup(); | |
| @@ -60,7 +60,7 export class MyWidget extends djbase(Djx | |||||
| 60 | } |
|
60 | } | |
| 61 |
|
61 | |||
| 62 | @on("count-inc") |
|
62 | @on("count-inc") | |
| 63 | _onCounterInc(evt: Event & { detail: number; x?: number; }) { |
|
63 | private _onCounterInc(evt: Event & { detail: number; x?: number; }) { | |
| 64 | } |
|
64 | } | |
| 65 |
|
65 | |||
| 66 | @on("click", "keydown") |
|
66 | @on("click", "keydown") | |
General Comments 0
You need to be logged in to leave comments.
Login now
