| @@ -32,12 +32,12 typescript { | |||||
| 32 |
|
32 | |||
| 33 | configureTsMain { |
|
33 | configureTsMain { | |
| 34 | compilerOptions { |
|
34 | compilerOptions { | |
| 35 | baseUrl = "$projectDir/src" |
|
35 | /*baseUrl = "$projectDir/src" | |
| 36 | paths = [ |
|
36 | paths = [ | |
| 37 | "dojo/*" : [ "typings/dojo/*" ], |
|
37 | "dojo/*" : [ "typings/dojo/*" ], | |
| 38 | "dijit/*" : [ "typings/dijit/*" ] |
|
38 | "dijit/*" : [ "typings/dijit/*" ] | |
| 39 |
|
|
39 | ]*/ | |
| 40 |
types = ["requirejs", |
|
40 | types = ["requirejs", "dojo-typings"] | |
| 41 | } |
|
41 | } | |
| 42 | } |
|
42 | } | |
| 43 |
|
43 | |||
| @@ -3,7 +3,7 import { isPlainObject, isNode, isBuildC | |||||
| 3 |
|
3 | |||
| 4 | import dom = require("dojo/dom-construct"); |
|
4 | import dom = require("dojo/dom-construct"); | |
| 5 |
|
5 | |||
| 6 | export abstract class BuildContextBase implements BuildContext { |
|
6 | export abstract class BuildContextBase<TNode extends Node> implements BuildContext<TNode> { | |
| 7 | _attrs = {}; |
|
7 | _attrs = {}; | |
| 8 |
|
8 | |||
| 9 | _children = new Array(); |
|
9 | _children = new Array(); | |
| @@ -43,7 +43,7 export abstract class BuildContextBase i | |||||
| 43 | } |
|
43 | } | |
| 44 | } |
|
44 | } | |
| 45 |
|
45 | |||
| 46 | abstract _getDomNode(): Node; |
|
46 | abstract _getDomNode(): TNode; | |
| 47 |
|
47 | |||
| 48 | ensureCreated() { |
|
48 | ensureCreated() { | |
| 49 | if (!this._created) { |
|
49 | if (!this._created) { | |
| @@ -3,7 +3,6 import _WidgetBase = require("dijit/_Wid | |||||
| 3 | import _AttachMixin = require("dijit/_AttachMixin"); |
|
3 | import _AttachMixin = require("dijit/_AttachMixin"); | |
| 4 | import { BuildContext, isNode } from "./traits"; |
|
4 | import { BuildContext, isNode } from "./traits"; | |
| 5 | import registry = require("dijit/registry"); |
|
5 | import registry = require("dijit/registry"); | |
| 6 | import { Handle } from "dojo/interfaces"; |
|
|||
| 7 |
|
6 | |||
| 8 | // type Handle = dojo.Handle; |
|
7 | // type Handle = dojo.Handle; | |
| 9 |
|
8 | |||
| @@ -15,13 +14,13 export abstract class DjxWidgetBase exte | |||||
| 15 | super.buildRendering(); |
|
14 | super.buildRendering(); | |
| 16 | } |
|
15 | } | |
| 17 |
|
16 | |||
| 18 | abstract render(): BuildContext; |
|
17 | abstract render(): BuildContext<HTMLElement>; | |
| 19 |
|
18 | |||
| 20 | _processTemplateNode<T extends (Element | Node | _WidgetBase)>( |
|
19 | _processTemplateNode<T extends (Element | Node | _WidgetBase)>( | |
| 21 | baseNode: T, |
|
20 | baseNode: T, | |
| 22 | getAttrFunc: (baseNode: T, attr: string) => string, |
|
21 | getAttrFunc: (baseNode: T, attr: string) => string, | |
| 23 | // tslint:disable-next-line: ban-types |
|
22 | // tslint:disable-next-line: ban-types | |
| 24 | attachFunc: (node: T, type: string, func?: Function) => Handle |
|
23 | attachFunc: (node: T, type: string, func?: Function) => dojo.Handle | |
| 25 | ): boolean { |
|
24 | ): boolean { | |
| 26 | if (isNode(baseNode)) { |
|
25 | if (isNode(baseNode)) { | |
| 27 | const w = registry.byNode(baseNode); |
|
26 | const w = registry.byNode(baseNode); | |
| @@ -3,7 +3,7 import attr = require("dojo/dom-attr"); | |||||
| 3 | import { argumentNotEmptyString } from "@implab/core-amd/safe"; |
|
3 | import { argumentNotEmptyString } from "@implab/core-amd/safe"; | |
| 4 | import { BuildContextBase } from "./BuildContextBase"; |
|
4 | import { BuildContextBase } from "./BuildContextBase"; | |
| 5 |
|
5 | |||
| 6 | export class HtmlElementContext extends BuildContextBase { |
|
6 | export class HtmlElementContext extends BuildContextBase<HTMLElement> { | |
| 7 | elementType: string; |
|
7 | elementType: string; | |
| 8 |
|
8 | |||
| 9 | _element: HTMLElement | undefined; |
|
9 | _element: HTMLElement | undefined; | |
| @@ -17,7 +17,7 export interface _Widget { | |||||
| 17 |
|
17 | |||
| 18 | export type _WidgetCtor = new (attrs: any, srcNode?: string | Node) => _Widget; |
|
18 | export type _WidgetCtor = new (attrs: any, srcNode?: string | Node) => _Widget; | |
| 19 |
|
19 | |||
| 20 | export class WidgetContext extends BuildContextBase { |
|
20 | export class WidgetContext extends BuildContextBase<Node> { | |
| 21 | widgetClass: _WidgetCtor; |
|
21 | widgetClass: _WidgetCtor; | |
| 22 |
|
22 | |||
| 23 | _instance: _Widget | undefined; |
|
23 | _instance: _Widget | undefined; | |
| @@ -4,8 +4,8 type _WidgetBaseConstructor = typeof _Wi | |||||
| 4 |
|
4 | |||
| 5 | export type DojoNodePosition = "first" | "after" | "before" | "last" | "replace" | "only" | number; |
|
5 | export type DojoNodePosition = "first" | "after" | "before" | "last" | "replace" | "only" | number; | |
| 6 |
|
6 | |||
| 7 | export interface BuildContext { |
|
7 | export interface BuildContext<TNode extends Node = Node> { | |
| 8 | getDomNode(): Node; |
|
8 | getDomNode(): TNode; | |
| 9 |
|
9 | |||
| 10 | placeAt(refNode: string | Node, position?: DojoNodePosition): void; |
|
10 | placeAt(refNode: string | Node, position?: DojoNodePosition): void; | |
| 11 | } |
|
11 | } | |
| @@ -1,18 +1,13 | |||||
| 1 | { |
|
1 | { | |
| 2 | "extends": "../tsconfig", |
|
2 | "extends": "../tsconfig", | |
| 3 | "compilerOptions": { |
|
3 | "compilerOptions": { | |
| 4 | "baseUrl": "../", |
|
|||
| 5 | "rootDir": "ts", |
|
4 | "rootDir": "ts", | |
| 6 | "rootDirs": [ |
|
5 | "rootDirs": [ | |
| 7 | "ts", |
|
6 | "ts", | |
| 8 | "typings" |
|
7 | "typings" | |
| 9 | ], |
|
8 | ], | |
| 10 | "paths" : { |
|
|||
| 11 | "dojo/*" : [ "typings/dojo/*" ], |
|
|||
| 12 | "dijit/*" : [ "typings/dijit/*" ] |
|
|||
| 13 | }, |
|
|||
| 14 | "types": [ |
|
9 | "types": [ | |
| 15 |
"requirejs", "./typings/index", " |
|
10 | "requirejs", "./typings/index", "dojo-typings" | |
| 16 | ] |
|
11 | ] | |
| 17 | } |
|
12 | } | |
| 18 | } No newline at end of file |
|
13 | } | |
| @@ -1,7 +1,6 | |||||
| 1 | import { Handle } from "dojo/interfaces"; |
|
1 | import { Handle } from "dojo/interfaces"; | |
| 2 | import _WidgetBase = require("./_WidgetBase"); |
|
2 | import _WidgetBase = require("./_WidgetBase"); | |
| 3 |
import d |
|
3 | import dojo = require("dojo/_base/kernel"); | |
| 4 | import dojo = require("dojo/_base/html"); |
|
|||
| 5 |
|
4 | |||
| 6 | declare module "./_WidgetBase" { |
|
5 | declare module "./_WidgetBase" { | |
| 7 | interface _WidgetBase { |
|
6 | interface _WidgetBase { | |
| @@ -2,6 +2,7 import Stateful = require("dojo/Stateful | |||||
| 2 | import Destroyable = require("./Destroyable"); |
|
2 | import Destroyable = require("./Destroyable"); | |
| 3 | import { ExtensionEvent } from "dojo/on"; |
|
3 | import { ExtensionEvent } from "dojo/on"; | |
| 4 | import { NodeFragmentOrString, Handle, NodeOrString, WatchHandle } from "dojo/interfaces"; |
|
4 | import { NodeFragmentOrString, Handle, NodeOrString, WatchHandle } from "dojo/interfaces"; | |
|
|
5 | import dojo = require("dojo/_base/kernel"); | |||
| 5 |
|
6 | |||
| 6 | declare namespace _WidgetBase { |
|
7 | declare namespace _WidgetBase { | |
| 7 | interface _WidgetBase extends Stateful, Destroyable { |
|
8 | interface _WidgetBase extends Stateful, Destroyable { | |
| @@ -229,7 +230,7 declare namespace _WidgetBase { | |||||
| 229 | defer(fcn: Function, delay?: number): Handle; |
|
230 | defer(fcn: Function, delay?: number): Handle; | |
| 230 | } |
|
231 | } | |
| 231 |
|
232 | |||
| 232 | interface _WidgetBaseConstructor<W = _WidgetBase> extends DeclareConstructor<W> { |
|
233 | interface _WidgetBaseConstructor<W = _WidgetBase> extends dojo._base.DeclareConstructor<W> { | |
| 233 | new(params: Object, srcNodeRef?: NodeOrString): W; |
|
234 | new(params: Object, srcNodeRef?: NodeOrString): W; | |
| 234 | } |
|
235 | } | |
| 235 |
|
236 | |||
General Comments 0
You need to be logged in to leave comments.
Login now
