@@ -1,7 +1,9 | |||||
1 | import { isNull, mixin, argumentNotNull } from "@implab/core-amd/safe"; |
|
1 | import { isNull, mixin, argumentNotNull } from "@implab/core-amd/safe"; | |
2 | import { isPlainObject, isNode, isBuildContext } from "./traits"; |
|
2 | import { isPlainObject, isNode, isBuildContext, DojoNodePosition, BuildContext } from "./traits"; | |
3 |
|
3 | |||
4 | export abstract class BuildContextBase { |
|
4 | import dom = require("dojo/dom-construct"); | |
|
5 | ||||
|
6 | export abstract class BuildContextBase implements BuildContext { | |||
5 | _attrs = {}; |
|
7 | _attrs = {}; | |
6 |
|
8 | |||
7 | _children = new Array(); |
|
9 | _children = new Array(); | |
@@ -57,6 +59,10 export abstract class BuildContextBase { | |||||
57 | return this._getDomElement(); |
|
59 | return this._getDomElement(); | |
58 | } |
|
60 | } | |
59 |
|
61 | |||
|
62 | placeAt(refNode: string | Node, position?: DojoNodePosition) { | |||
|
63 | dom.place(this.getDomElement(), refNode, position); | |||
|
64 | } | |||
|
65 | ||||
60 | abstract _addChild(child: any): void; |
|
66 | abstract _addChild(child: any): void; | |
61 |
|
67 | |||
62 | abstract _setAttrs(attrs: object): void; |
|
68 | abstract _setAttrs(attrs: object): void; |
@@ -2,9 +2,12 import _WidgetBase = require("dijit/_Wid | |||||
2 |
|
2 | |||
3 | type _WidgetBaseConstructor = typeof _WidgetBase; |
|
3 | type _WidgetBaseConstructor = typeof _WidgetBase; | |
4 |
|
4 | |||
|
5 | export type DojoNodePosition = "first" | "after" | "before" | "last" | "replace" | "only" | number; | |||
5 |
|
6 | |||
6 | export interface BuildContext { |
|
7 | export interface BuildContext { | |
7 | getDomElement(): HTMLElement; |
|
8 | getDomElement(): HTMLElement; | |
|
9 | ||||
|
10 | placeAt(refNode: string | Node, position?: DojoNodePosition): void; | |||
8 | } |
|
11 | } | |
9 |
|
12 | |||
10 | export function isNode(el: any): el is HTMLElement { |
|
13 | export function isNode(el: any): el is HTMLElement { |
General Comments 0
You need to be logged in to leave comments.
Login now