|
|
import { Handle } from "dojo/interfaces";
|
|
|
import _WidgetBase = require("./_WidgetBase");
|
|
|
import declare = require("dojo/_base/declare");
|
|
|
import dojo = require("dojo/_base/html");
|
|
|
|
|
|
declare module "./_WidgetBase" {
|
|
|
interface _WidgetBase {
|
|
|
dojoAttachEvent: string;
|
|
|
dojoAttachPoint: string;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
declare module "dojo/_base/kernel" {
|
|
|
interface Dijit {
|
|
|
_AttachMixin: _AttachMixinConstructor;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
interface _AttachMixin {
|
|
|
/**
|
|
|
* List of widget attribute names associated with data-dojo-attach-point=... in the template, ex: ["containerNode", "labelNode"]
|
|
|
*/
|
|
|
_attachPoints: string[];
|
|
|
|
|
|
/**
|
|
|
* List of connections associated with data-dojo-attach-event=... in the template
|
|
|
*/
|
|
|
_attachEvents: Handle[];
|
|
|
|
|
|
/**
|
|
|
* Object to which attach points and events will be scoped. Defaults to 'this'.
|
|
|
*/
|
|
|
attachScope: any;
|
|
|
|
|
|
/**
|
|
|
* Search descendants of this.containerNode for data-dojo-attach-point and data-dojo-attach-event.
|
|
|
*
|
|
|
* Should generally be left false (the default value) both for performance and to avoid failures when this.containerNode holds other _AttachMixin instances with their own attach points and events.
|
|
|
*/
|
|
|
searchContainerNode: boolean;
|
|
|
|
|
|
/**
|
|
|
* Attach to DOM nodes marked with special attributes.
|
|
|
*/
|
|
|
buildRendering(): void;
|
|
|
|
|
|
/**
|
|
|
* hook for _WidgetsInTemplateMixin
|
|
|
*/
|
|
|
_beforeFillContent(): void;
|
|
|
|
|
|
/**
|
|
|
* Iterate through the dom nodes and attach functions and nodes accordingly.
|
|
|
*
|
|
|
* Map widget properties and functions to the handlers specified in the dom node and it's descendants. This function iterates over all nodes and looks for these properties:
|
|
|
* - dojoAttachPoint/data-dojo-attach-point
|
|
|
* - dojoAttachEvent/data-dojo-attach-event
|
|
|
*/
|
|
|
_attachTemplateNodes(rootNode: Element | Node): void;
|
|
|
|
|
|
/**
|
|
|
* Process data-dojo-attach-point and data-dojo-attach-event for given node or widget.
|
|
|
*
|
|
|
* Returns true if caller should process baseNode's children too.
|
|
|
*/
|
|
|
_processTemplateNode<T extends (Element | Node | _WidgetBase)>(
|
|
|
baseNode: T,
|
|
|
getAttrFunc: (baseNode: T, attr: string) => string,
|
|
|
attachFunc: (node: T, type: string, func?: Function) => Handle
|
|
|
): boolean;
|
|
|
|
|
|
/**
|
|
|
* Roughly corresponding to dojo/on, this is the default function for processing a data-dojo-attach-event. Meant to attach to DOMNodes, not to widgets.
|
|
|
*/
|
|
|
_attach(node: Element | Node, type: string, func?: Function): Handle;
|
|
|
|
|
|
/**
|
|
|
* Detach and clean up the attachments made in _attachtempalteNodes.
|
|
|
*/
|
|
|
_detachTemplateNodes(): void;
|
|
|
|
|
|
destroyRendering(preserveDom?: boolean): void;
|
|
|
}
|
|
|
|
|
|
interface _AttachMixinConstructor extends dojo._base.DeclareConstructor<_AttachMixin> { }
|
|
|
|
|
|
declare const _AttachMixin: _AttachMixinConstructor;
|
|
|
export = _AttachMixin;
|
|
|
|