##// END OF EJS Templates
added type parameter to Evented<T>, T is the event map...
cin -
r10:641c326d4bb4 v1.0.2 default
parent child
Show More
@@ -0,0 +1,16
1 import * as Evented from "dojo/Evented";
2
3 interface DoorEvents {
4 open: { authorized: boolean }
5 close: void
6 }
7
8 const door = new Evented<DoorEvents>();
9
10 door.on("open", evt => evt.authorized);
11
12 door.on<any>("location-change", (x,y,z) => x+y+z);
13
14 door.emit("open", { authorized: false });
15 door.emit("close");
16 door.emit<any>("location-change");
@@ -1,70 +1,74
1 1 import org.gradle.internal.os.OperatingSystem;
2 2
3 3 plugins {
4 4 id "org.implab.gradle-typescript" version "1.3.4"
5 5 }
6 6
7 7 def isWindows = OperatingSystem.current().isWindows();
8 8
9 9 npm {
10 10 npmCmd = isWindows ? 'npm.cmd' : 'npm';
11 11 }
12 12
13 13 sources {
14 14 main { me ->
15 15 ts {
16 16 // to check typings with the compiler
17 17 srcDir me.typings
18 18 }
19 19 }
20 20 }
21 21
22 22 typescript {
23 23 compilerOptions {
24 24 lib = ["es5", "dom", "scripthost", "es2015.promise", "es2015.symbol", "es2015.iterable"]
25 25 declaration = true
26 26 types = ["requirejs"]
27 27 module = "amd"
28 28 it.target = "es5"
29 29 moduleResolution = "node"
30 30 // traceResolution = true
31 31
32 32 }
33 33
34 34 // для Π²Π°Ρ€ΠΈΠ°Π½Ρ‚Π° с Π»ΠΎΠΊΠ°Π»ΡŒΠ½Ρ‹ΠΌΠΈ tsc, eslint, tslint
35 35 tscCmd = "${projectDir}/node_modules/.bin/" + (isWindows ? 'tsc.cmd' : 'tsc')
36 36 esLintCmd = "${projectDir}/node_modules/.bin/" + (isWindows ? 'eslint.cmd' : 'eslint')
37 37 tsLintCmd = "${projectDir}/node_modules/.bin/" + (isWindows ? 'tslint.cmd' : 'tslint')
38 38 }
39 39
40 40 configureTsTest {
41 41 compilerOptions {
42 types = ["../main/typings/dojo/modules","../main/typings/dijit/modules"]
42 types = [
43 "../main/typings/dojo/modules",
44 "../main/typings/dijit/modules",
45 "../main/typings/dojo/NodeList-fx"
46 ]
43 47 module = "ESNext"
44 48 it.target = "ESNext"
45 49 }
46 50 }
47 51
48 52 npmPackMeta {
49 53 meta {
50 54 name = "@$npmScope/$project.name"
51 55 }
52 56 }
53 57
54 58 task npmPackTypings(type: Copy) {
55 59 dependsOn typings
56 60
57 61 npmPackContents.dependsOn it
58 62
59 63 from typescript.typingsDir
60 64 into npm.packageDir
61 65 }
62 66
63 67 task printVersion {
64 68 doLast {
65 69 println "packageName: ${npmPackMeta.metadata.get().name}";
66 70 println "version: $version";
67 71 println "target: $typescript.compilerOptions.target";
68 72 println "module: $typescript.compilerOptions.module";
69 73 }
70 74 } No newline at end of file
@@ -1,2384 +1,2369
1 1 /// <reference path="../dojo/index.d.ts" />
2 2 /// <reference path="form.d.ts" />
3 3 /// <reference path="layout.d.ts" />
4 4
5 5 declare namespace dijit {
6 6 /* Global Dijit Interface */
7 7 interface Dijit { }
8 8
9 9 /* dijit/_AttachMixin */
10 10
11 11 /* tslint:disable:class-name */
12 12
13 13 interface _WidgetBase {
14 14 dojoAttachEvent: string;
15 15 dojoAttachPoint: string;
16 16 }
17 17
18 18 interface _AttachMixin {
19 19 /**
20 20 * List of widget attribute names associated with data-dojo-attach-point=... in the template, ex: ["containerNode", "labelNode"]
21 21 */
22 22 _attachPoints: string[];
23 23
24 24 /**
25 25 * List of connections associated with data-dojo-attach-event=... in the template
26 26 */
27 27 _attachEvents: dojo.Handle[];
28 28
29 29 /**
30 30 * Object to which attach points and events will be scoped. Defaults to 'this'.
31 31 */
32 32 attachScope: any;
33 33
34 34 /**
35 35 * Search descendants of this.containerNode for data-dojo-attach-point and data-dojo-attach-event.
36 36 *
37 37 * 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.
38 38 */
39 39 searchContainerNode: boolean;
40 40
41 41 /**
42 42 * Attach to DOM nodes marked with special attributes.
43 43 */
44 44 buildRendering(): void;
45 45
46 46 /**
47 47 * hook for _WidgetsInTemplateMixin
48 48 */
49 49 _beforeFillContent(): void;
50 50
51 51 /**
52 52 * Iterate through the dom nodes and attach functions and nodes accordingly.
53 53 *
54 54 * 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:
55 55 * - dojoAttachPoint/data-dojo-attach-point
56 56 * - dojoAttachEvent/data-dojo-attach-event
57 57 */
58 58 _attachTemplateNodes(rootNode: Element | Node): void;
59 59
60 60 /**
61 61 * Process data-dojo-attach-point and data-dojo-attach-event for given node or widget.
62 62 *
63 63 * Returns true if caller should process baseNode's children too.
64 64 */
65 65 _processTemplateNode<T extends (Element | Node | _WidgetBase)>(
66 66 baseNode: T,
67 67 getAttrFunc: (baseNode: T, attr: string) => string,
68 68 attachFunc: (node: T, type: string, func?: Function) => dojo.Handle
69 69 ): boolean;
70 70
71 71 /**
72 72 * 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.
73 73 */
74 74 _attach(node: Element | Node, type: string, func?: Function): dojo.Handle;
75 75
76 76 /**
77 77 * Detach and clean up the attachments made in _attachtempalteNodes.
78 78 */
79 79 _detachTemplateNodes(): void;
80 80
81 81 destroyRendering(preserveDom?: boolean): void;
82 82 }
83 83
84 84 interface _AttachMixinConstructor extends dojo._base.DeclareConstructor<_AttachMixin> { }
85 85
86 86 /* dijit/_BidiMixin */
87 87
88 88 interface _WidgetBase {
89 89
90 90 /**
91 91 * Gets the right direction of text.
92 92 */
93 93 getTextDir(text: string): string;
94 94
95 95 /**
96 96 * Set element.dir according to this.textDir, assuming this.textDir has a value.
97 97 */
98 98 applyTextDir(element: HTMLElement, text?: string): void;
99 99
100 100 /**
101 101 * Wraps by UCC (Unicode control characters) option's text according to this.textDir
102 102 */
103 103 enforceTextDirWithUcc(option: HTMLOptionElement, text: string): string;
104 104
105 105 /**
106 106 * Restores the text of origObj, if needed, after enforceTextDirWithUcc, e.g. set("textDir", textDir).
107 107 */
108 108 restoreOriginalText(origObj: HTMLOptionElement): HTMLOptionElement;
109 109 }
110 110
111 111 /* dijit/_ConfirmDialogMixin */
112 112
113 113 interface _ConfirmDialogMixin extends _WidgetsInTemplateMixin {
114 114 /**
115 115 * HTML snippet for action bar, overrides _DialogMixin.actionBarTemplate
116 116 */
117 117 actionBarTemplate: string;
118 118
119 119 /**
120 120 * Label of OK button.
121 121 */
122 122 buttonOk: string;
123 123
124 124 /**
125 125 * Label of cancel button.
126 126 */
127 127 buttonCancel: string;
128 128 }
129 129
130 130 /* dijit/_Contained */
131 131
132 132 interface _Contained {
133 133 /**
134 134 * Returns the previous child of the parent or null if this is the
135 135 * first child of the parent.
136 136 */
137 137 getPreviousSibling<T extends _WidgetBase>(): T;
138 138
139 139 /**
140 140 * Returns the next child of the parent or null if this is the last
141 141 * child of the parent.
142 142 */
143 143 getNextSibling<T extends _WidgetBase>(): T;
144 144
145 145 /**
146 146 * Returns the index of this widget within its container parent.
147 147 * It returns -1 if the parent does not exist or if the parent is
148 148 * not a dijit/_Container.
149 149 */
150 150 getIndexInParent(): number;
151 151 }
152 152
153 153 interface _ContainedConstructor extends dojo._base.DeclareConstructor<_Contained> { }
154 154
155 155 /* dijit/_Container */
156 156
157 157 interface _Container {
158 158 buildRendering(): void;
159 159
160 160 /**
161 161 * Makes the given widget a child of this widget.
162 162 */
163 163 addChild<T extends _WidgetBase>(widget: T, insertIndex?: number): void;
164 164
165 165 /**
166 166 * Removes the passed widget instance from this widget but does
167 167 * not destroy it. You can also pass in an integer indicating
168 168 * the index within the container to remove (ie, removeChild(5) removes the sixth widget)
169 169 */
170 170 removeChild<T extends _WidgetBase>(widget: T): void;
171 171 removeChild<T extends number>(widget: number): void;
172 172
173 173 /**
174 174 * Returns true if widget has child widgets, i.e. if this.containerNode contains widgets.
175 175 */
176 176 hasChildren(): boolean;
177 177
178 178 /**
179 179 * Gets the index of the child in this container or -1 if not found
180 180 */
181 181 getIndexOfChild<T extends _WidgetBase>(widget: T): number;
182 182 }
183 183
184 184 interface _ContainerConstructor extends dojo._base.DeclareConstructor<_Container> { }
185 185
186 186 /* dijit/_CssStateMixin */
187 187
188 188 interface CSSStateNodes {
189 189 [node: string]: string;
190 190 }
191 191
192 192 interface _CssStateMixin {
193 193 /**
194 194 * True if cursor is over this widget
195 195 */
196 196 hovering: boolean;
197 197
198 198 /**
199 199 * True if mouse was pressed while over this widget, and hasn't been released yet
200 200 */
201 201 active: boolean;
202 202 }
203 203
204 204 interface _CssStateMixinConstructor extends dojo._base.DeclareConstructor<_CssStateMixin> { }
205 205
206 206 /* dijit/_DialogMixin */
207 207
208 208 interface _DialogMixin {
209 209 /**
210 210 * HTML snippet to show the action bar (gray bar with OK/cancel buttons).
211 211 * Blank by default, but used by ConfirmDialog/ConfirmTooltipDialog subclasses.
212 212 */
213 213 actionBarTemplate: string;
214 214
215 215 /**
216 216 * Callback when the user hits the submit button.
217 217 * Override this method to handle Dialog execution.
218 218 */
219 219 execute(formContents?: any): void;
220 220
221 221 /**
222 222 * Called when user has pressed the Dialog's cancel button, to notify container.
223 223 */
224 224 onCancel(): void;
225 225
226 226 /**
227 227 * Called when user has pressed the dialog's OK button, to notify container.
228 228 */
229 229 onExecute(): void;
230 230 }
231 231
232 232 /* dijit/_FocusMixin */
233 233 interface _FocusMixin { }
234 234
235 235 interface _WidgetBase {
236 236 /**
237 237 * Called when the widget becomes "active" because
238 238 * it or a widget inside of it either has focus, or has recently
239 239 * been clicked.
240 240 */
241 241 onFocus(): void;
242 242
243 243 /**
244 244 * Called when the widget stops being "active" because
245 245 * focus moved to something outside of it, or the user
246 246 * clicked somewhere outside of it, or the widget was
247 247 * hidden.
248 248 */
249 249 onBlur(): void;
250 250 }
251 251
252 252 /* dijit/_HasDropDown */
253 253
254 254 interface _HasDropDown<T extends _WidgetBase> extends _FocusMixin {
255 255 /**
256 256 * The button/icon/node to click to display the drop down.
257 257 * Can be set via a data-dojo-attach-point assignment.
258 258 * If missing, then either focusNode or domNode (if focusNode is also missing) will be used.
259 259 */
260 260 _buttonNode: HTMLElement;
261 261
262 262 /**
263 263 * Will set CSS class dijitUpArrow, dijitDownArrow, dijitRightArrow etc. on this node depending
264 264 * on where the drop down is set to be positioned.
265 265 * Can be set via a data-dojo-attach-point assignment.
266 266 * If missing, then _buttonNode will be used.
267 267 */
268 268 _arrowWrapperNode: HTMLElement;
269 269
270 270 /**
271 271 * The node to set the aria-expanded class on.
272 272 * Also sets popupActive class but that will be removed in 2.0.
273 273 * Can be set via a data-dojo-attach-point assignment.
274 274 * If missing, then focusNode or _buttonNode (if focusNode is missing) will be used.
275 275 */
276 276 _popupStateNode: HTMLElement;
277 277
278 278 /**
279 279 * The node to display the popup around.
280 280 * Can be set via a data-dojo-attach-point assignment.
281 281 * If missing, then domNode will be used.
282 282 */
283 283 _aroundNode: HTMLElement;
284 284
285 285 /**
286 286 * The widget to display as a popup. This widget *must* be
287 287 * defined before the startup function is called.
288 288 */
289 289 dropDown: T;
290 290
291 291 /**
292 292 * Set to true to make the drop down at least as wide as this
293 293 * widget. Set to false if the drop down should just be its
294 294 * default width.
295 295 */
296 296 autoWidth: boolean;
297 297
298 298 /**
299 299 * Set to true to make the drop down exactly as wide as this
300 300 * widget. Overrides autoWidth.
301 301 */
302 302 forceWidth: boolean;
303 303
304 304 /**
305 305 * The max height for our dropdown.
306 306 * Any dropdown taller than this will have scrollbars.
307 307 * Set to 0 for no max height, or -1 to limit height to available space in viewport
308 308 */
309 309 maxHeight: number;
310 310
311 311 /**
312 312 * This variable controls the position of the drop down.
313 313 * It's an array of strings
314 314 */
315 315 dropDownPosition: string[];
316 316 /* TODO remove for TS 1.8 */
317 317 /* dropDownPosition: ('before' | 'after' | 'above' | 'below')[]; */
318 318
319 319 /**
320 320 * When set to false, the click events will not be stopped, in
321 321 * case you want to use them in your subclass
322 322 */
323 323 _stopClickEvents: boolean;
324 324
325 325 /**
326 326 * Callback when the user mousedown/touchstart on the arrow icon.
327 327 */
328 328 _onDropDownMouseDown(e: MouseEvent): void;
329 329
330 330 /**
331 331 * Callback on mouseup/touchend after mousedown/touchstart on the arrow icon.
332 332 * Note that this function is called regardless of what node the event occurred on (but only after
333 333 * a mousedown/touchstart on the arrow).
334 334 */
335 335 _onDropDownMouseUp(e?: MouseEvent): void;
336 336
337 337 /**
338 338 * The drop down was already opened on mousedown/keydown; just need to stop the event
339 339 */
340 340 _onDropDownClick(e: MouseEvent): void;
341 341
342 342 buildRendering(): void;
343 343 postCreate(): void;
344 344 destroy(preserveDom?: boolean): void;
345 345
346 346 /**
347 347 * Returns true if the dropdown exists and it's data is loaded. This can
348 348 * be overridden in order to force a call to loadDropDown().
349 349 */
350 350 isLoaded(): boolean;
351 351
352 352 /**
353 353 * Creates the drop down if it doesn't exist, loads the data
354 354 * if there's an href and it hasn't been loaded yet, and then calls
355 355 * the given callback.
356 356 */
357 357 loadDropDown(loadCallback: () => void): void;
358 358
359 359 /**
360 360 * Creates the drop down if it doesn't exist, loads the data
361 361 * if there's an href and it hasn't been loaded yet, and
362 362 * then opens the drop down. This is basically a callback when the
363 363 * user presses the down arrow button to open the drop down.
364 364 */
365 365 loadAndOpenDropDown(): dojo.Deferred<T>;
366 366
367 367 /**
368 368 * Callback when the user presses the down arrow button or presses
369 369 * the down arrow key to open/close the drop down.
370 370 * Toggle the drop-down widget; if it is up, close it, if not, open it
371 371 */
372 372 toggleDropDown(): void;
373 373
374 374 /**
375 375 * Opens the dropdown for this widget. To be called only when this.dropDown
376 376 * has been created and is ready to display (ie, it's data is loaded).
377 377 */
378 378 openDropDown(): PlaceLocation;
379 379
380 380 /**
381 381 * Closes the drop down on this widget
382 382 */
383 383 closeDropDown(focus?: boolean): void;
384 384 }
385 385
386 386 /* dijit/_OnDijitClickMixin */
387 387
388 388 interface _OnDijitClickMixin {
389 389 /**
390 390 * override _WidgetBase.connect() to make this.connect(node, "ondijitclick", ...) work
391 391 */
392 392 connect(obj: any, event: string | dojo.ExtensionEvent, method: string | dojo.EventListener): dojo.WatchHandle;
393 393 }
394 394
395 395 interface _OnDijitClickMixinConstructor {
396 396 /**
397 397 * Deprecated. New code should access the dijit/a11yclick event directly, ex:
398 398 * | this.own(on(node, a11yclick, function(){ ... }));
399 399 *
400 400 * Mixing in this class will make _WidgetBase.connect(node, "ondijitclick", ...) work.
401 401 * It also used to be necessary to make templates with ondijitclick work, but now you can just require
402 402 * dijit/a11yclick.
403 403 */
404 404 new(): _OnDijitClickMixin;
405 405 a11yclick: A11yClick;
406 406 }
407 407
408 408 /* dijit/_TemplatedMixin */
409 409
410 410 interface _TemplatedMixin extends _AttachMixin {
411 411
412 412 /**
413 413 * A string that represents the widget template.
414 414 * Use in conjunction with dojo.cache() to load from a file.
415 415 */
416 416 templateString: string;
417 417
418 418 /**
419 419 * Path to template (HTML file) for this widget relative to dojo.baseUrl.
420 420 * Deprecated: use templateString with require([... "dojo/text!..."], ...) instead
421 421 */
422 422 templatePath: string;
423 423
424 424 /**
425 425 * Set _AttachMixin.searchContainerNode to true for back-compat for widgets that have data-dojo-attach-point's
426 426 * and events inside this.containerNode. Remove for 2.0.
427 427 */
428 428 searchContainerNode: boolean;
429 429
430 430 /**
431 431 * Construct the UI for this widget from a template, setting this.domNode.
432 432 */
433 433 buildRendering(): void;
434 434 }
435 435
436 436 interface _TemplatedMixinConstructor extends _WidgetBaseConstructor<_TemplatedMixin> {
437 437 /**
438 438 * Static method to get a template based on the templatePath or
439 439 * templateString key
440 440 */
441 441 getCachedTemplate(templateString: string, alwaysUseString: string, doc?: Document): string | HTMLElement;
442 442 }
443 443
444 444 /* dijit/_Widget */
445 445 interface _Widget extends _WidgetBase, _OnDijitClickMixin, _FocusMixin {
446 446 /**
447 447 * Connect to this function to receive notifications of mouse click events.
448 448 */
449 449 onClick(event: MouseEvent): void;
450 450
451 451 /**
452 452 * Connect to this function to receive notifications of mouse double click events.
453 453 */
454 454 onDblClick(event: MouseEvent): void;
455 455
456 456 /**
457 457 * Connect to this function to receive notifications of keys being pressed down.
458 458 */
459 459 onKeyDown(event: KeyboardEvent): void;
460 460
461 461 /**
462 462 * Connect to this function to receive notifications of printable keys being typed.
463 463 */
464 464 onKeyPress(event: KeyboardEvent): void;
465 465
466 466 /**
467 467 * Connect to this function to receive notifications of keys being released.
468 468 */
469 469 onKeyUp(event: KeyboardEvent): void;
470 470
471 471 /**
472 472 * Connect to this function to receive notifications of when the mouse button is pressed down.
473 473 */
474 474 onMouseDown(event: MouseEvent): void;
475 475
476 476 /**
477 477 * Connect to this function to receive notifications of when the mouse moves over nodes contained within this widget.
478 478 */
479 479 onMouseMove(event: MouseEvent): void;
480 480
481 481 /**
482 482 * Connect to this function to receive notifications of when the mouse moves off of nodes contained within this widget.
483 483 */
484 484 onMouseOut(event: MouseEvent): void;
485 485
486 486 /**
487 487 * Connect to this function to receive notifications of when the mouse moves onto nodes contained within this widget.
488 488 */
489 489 onMouseOver(event: MouseEvent): void;
490 490
491 491 /**
492 492 * Connect to this function to receive notifications of when the mouse moves off of this widget.
493 493 */
494 494 onMouseLeave(event: MouseEvent): void;
495 495
496 496 /**
497 497 * Connect to this function to receive notifications of when the mouse moves onto this widget.
498 498 */
499 499 onMouseEnter(event: MouseEvent): void;
500 500
501 501 /**
502 502 * Connect to this function to receive notifications of when the mouse button is released.
503 503 */
504 504 onMouseUp(event: MouseEvent): void;
505 505
506 506 postCreate(): void;
507 507
508 508 /**
509 509 * Deprecated. Use set() instead.
510 510 */
511 511 setAttribute(attr: string, value: any): void;
512 512
513 513 /**
514 514 * This method is deprecated, use get() or set() directly.
515 515 */
516 516 attr(name: string | { [attr: string]: any }, value?: any): any;
517 517
518 518 /**
519 519 * Returns all the widgets contained by this, i.e., all widgets underneath this.containerNode.
520 520 */
521 521 getDescendants(): _Widget[];
522 522
523 523 /**
524 524 * Called when this widget becomes the selected pane in a
525 525 * `dijit/layout/TabContainer`, `dijit/layout/StackContainer`,
526 526 * `dijit/layout/AccordionContainer`, etc.
527 527 *
528 528 * Also called to indicate display of a `dijit.Dialog`, `dijit.TooltipDialog`, or `dijit.TitlePane`.
529 529 */
530 530 onShow(): void;
531 531
532 532 /**
533 533 * Called when another widget becomes the selected pane in a
534 534 * `dijit/layout/TabContainer`, `dijit/layout/StackContainer`,
535 535 * `dijit/layout/AccordionContainer`, etc.
536 536 *
537 537 * Also called to indicate hide of a `dijit.Dialog`, `dijit.TooltipDialog`, or `dijit.TitlePane`.
538 538 */
539 539 onHide(): void;
540 540
541 541 /**
542 542 * Called when this widget is being displayed as a popup (ex: a Calendar popped
543 543 * up from a DateTextBox), and it is hidden.
544 544 * This is called from the dijit.popup code, and should not be called directly.
545 545 *
546 546 * Also used as a parameter for children of `dijit/layout/StackContainer` or subclasses.
547 547 * Callback if a user tries to close the child. Child will be closed if this function returns true.
548 548 */
549 549 onClose(): boolean;
550 550 }
551 551
552 type Props<T> = {
553 [k in Exclude<keyof T, keyof object>] : T[k] extends (...args: any) => any ? never: k;
554 }[ keyof T];
555
556 552 interface _WidgetBase {
557 553 /**
558 554 * Used across all instances a hash to cache attribute names and their getter
559 555 * and setter names.
560 556 */
561 557 _attrPairNames: { [attr: string]: string };
562 558
563 559 /**
564 560 * Helper function for get() and set().
565 561 * Caches attribute name values so we don't do the string ops every time.
566 562 */
567 563 _getAttrNames(name: string): string;
568 564
569 565 /**
570 566 * Internal helper for directly changing an attribute value.
571 567 * This method id derived from Stateful and must not be used!
572 568 * @deprecated use `_set(name, value)` instead.
573 569 */
574 570 _changeAttrValue(name: string, value: any): this;
575 571
576 572 get<K extends keyof this>(name: K): this[K];
577 573
578 574 /**
579 575 * Helper function to set new value for specified property, and call handlers
580 576 * registered with watch() if the value has changed.
581 577 * @param name
582 578 * @param value
583 579 */
584 580 _set<K extends keyof this>(name: K, value: this[K]): void;
585 581
586 582 /**
587 583 * Helper function to get value for specified property stored by this._set(),
588 584 * i.e. for properties with custom setters. Used mainly by custom getters.
589 585 *
590 586 * For example, CheckBox._getValueAttr() calls this._get("value").
591 587 * @param name
592 588 */
593 589 _get<K extends keyof this>(name: K): this[K];
594 590
595 591 /**
596 592 * Set a property on a Stateful instance
597 593 */
598 594 set<K extends keyof this>(name: K, value: this[K]): this;
599 595 set<K extends keyof this, V extends this[K] & any[]>(name: K, ...values: V): this;
600 596 set<K extends keyof this>(values: {[p in K]: this[p]}): this;
601 597
602 598 /**
603 599 * Watches a property for changes
604 600 */
605 601 watch(callback: <K extends keyof any>(prop: K, oldValue: any, newValue: any) => void): dojo.WatchHandle;
606 watch<K extends Props<this>>(name: K, callback: (prop: K, oldValue: this[K], newValue: this[K]) => void): dojo.WatchHandle;
602 watch<K extends keyof this>(name: K, callback: (prop: K, oldValue: this[K], newValue: this[K]) => void): dojo.WatchHandle;
607 603 }
608 604
609 605 type EventInitArgs<T extends Event> = {
610 606 [p in keyof T]?: T[p] extends (...args: any) => any ? never : T[p];
611 607 };
612 608
613 609 /* dijit/_WidgetBase */
614 610 interface _WidgetBase<Events extends { [name in keyof Events]: Event } = GlobalEventHandlersEventMap> extends Destroyable {
615 611
616 612 /**
617 613 * A unique, opaque ID string that can be assigned by users or by the
618 614 * system. If the developer passes an ID which is known not to be
619 615 * unique, the specified ID is ignored and the system-generated ID is
620 616 * used instead.
621 617 */
622 618 id: string;
623 619
624 620 /**
625 621 * Rarely used. Overrides the default Dojo locale used to render this widget,
626 622 * as defined by the [HTML LANG](http://www.w3.org/TR/html401/struct/dirlang.html#adef-lang) attribute.
627 623 * Value must be among the list of locales specified during by the Dojo bootstrap,
628 624 * formatted according to [RFC 3066](http://www.ietf.org/rfc/rfc3066.txt) (like en-us).
629 625 */
630 626 lang: string;
631 627
632 628 /**
633 629 * Bi-directional support, as defined by the [HTML DIR](http://www.w3.org/TR/html401/struct/dirlang.html#adef-dir)
634 630 * attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's
635 631 * default direction.
636 632 */
637 633 dir: string;
638 634
639 635 /**
640 636 * HTML class attribute
641 637 */
642 638 class: string;
643 639
644 640 /**
645 641 * HTML style attributes as cssText string or name/value hash
646 642 */
647 643 style: string;
648 644
649 645 /**
650 646 * HTML title attribute.
651 647 *
652 648 * For form widgets this specifies a tooltip to display when hovering over
653 649 * the widget (just like the native HTML title attribute).
654 650 *
655 651 * For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer,
656 652 * etc., it's used to specify the tab label, accordion pane title, etc. In this case it's
657 653 * interpreted as HTML.
658 654 */
659 655 title: string;
660 656
661 657 /**
662 658 * When this widget's title attribute is used to for a tab label, accordion pane title, etc.,
663 659 * this specifies the tooltip to appear when the mouse is hovered over that text.
664 660 */
665 661 tooltip: string;
666 662
667 663 /**
668 664 * Root CSS class of the widget (ex: dijitTextBox), used to construct CSS classes to indicate
669 665 * widget state.
670 666 */
671 667 baseClass: string;
672 668
673 669 /**
674 670 * pointer to original DOM node
675 671 */
676 672 srcNodeRef: HTMLElement;
677 673
678 674 /**
679 675 * This is our visible representation of the widget! Other DOM
680 676 * Nodes may by assigned to other properties, usually through the
681 677 * template system's data-dojo-attach-point syntax, but the domNode
682 678 * property is the canonical "top level" node in widget UI.
683 679 */
684 680 domNode: HTMLElement;
685 681
686 682 /**
687 683 * Designates where children of the source DOM node will be placed.
688 684 * "Children" in this case refers to both DOM nodes and widgets.
689 685 */
690 686 containerNode: HTMLElement;
691 687
692 688 /**
693 689 * The document this widget belongs to. If not specified to constructor, will default to
694 690 * srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global
695 691 */
696 692 ownerDocument: HTMLElement;
697 693
698 694 /**
699 695 * Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute
700 696 * for each XXX attribute to be mapped to the DOM.
701 697 */
702 698 attributeMap: { [attribute: string]: any };
703 699
704 700 /**
705 701 * Bi-directional support, the main variable which is responsible for the direction of the text.
706 702 * The text direction can be different than the GUI direction by using this parameter in creation
707 703 * of a widget.
708 704 */
709 705 textDir: string;
710 706
711 707 _started?: boolean;
712 708
713 709 /**
714 710 * Kicks off widget instantiation. See create() for details.
715 711 */
716 712 postscript(params?: any, srcNodeRef?: HTMLElement): void;
717 713
718 714 /**
719 715 * Kick off the life-cycle of a widget
720 716 */
721 717 create(params?: any, srcNodeRef?: HTMLElement): void;
722 718
723 719 /**
724 720 * Called after the parameters to the widget have been read-in,
725 721 * but before the widget template is instantiated. Especially
726 722 * useful to set properties that are referenced in the widget
727 723 * template.
728 724 */
729 725 postMixInProperties(): void;
730 726
731 727 /**
732 728 * Construct the UI for this widget, setting this.domNode.
733 729 * Most widgets will mixin `dijit._TemplatedMixin`, which implements this method.
734 730 */
735 731 buildRendering(): void;
736 732
737 733 /**
738 734 * Processing after the DOM fragment is created
739 735 */
740 736 postCreate(): void;
741 737
742 738 /**
743 739 * Processing after the DOM fragment is added to the document
744 740 */
745 741 startup(): void;
746 742
747 743 /**
748 744 * Destroy this widget and its descendants
749 745 */
750 746 destroyRecursive(preserveDom?: boolean): void;
751 747
752 748 /**
753 749 * Destroys the DOM nodes associated with this widget.
754 750 */
755 751 destroyRendering(preserveDom?: boolean): void;
756 752
757 753 /**
758 754 * Recursively destroy the children of this widget and their
759 755 * descendants.
760 756 */
761 757 destroyDescendants(preserveDom?: boolean): void;
762 758
763 759 /**
764 760 * Deprecated. Override destroy() instead to implement custom widget tear-down
765 761 * behavior.
766 762 * @deprecated
767 763 */
768 764 uninitialize(): boolean;
769 765
770 766 /**
771 767 * Used by widgets to signal that a synthetic event occurred, ex:
772 768 * | myWidget.emit("attrmodified-selectedChildWidget", {}).
773 769 */
774 emit<K extends keyof Events>(eventName: K, evt: EventInitArgs<Events[K]>): void;
775
776 /**
777 * @param type
778 * @param eventObj
779 * @param callbackArgs
780 */
781 emit<K extends string>(
782 type: K,
783 eventObj?: K extends keyof Events ? EventInitArgs<Events[K]> : any,
784 callbackArgs?: any[]
785 ): any;
770 emit<K extends keyof Events>(eventName: K, evt: EventInitArgs<Events[K]>, callbackArgs?: any[]): any;
786 771
787 772 /**
788 773 * Call specified function when event occurs, ex: myWidget.on("click", function(){ ... }).
789 774 */
790 775 on<K extends keyof Events>(eventName: K, cb: (evt: Events[K]) => void): dojo.WatchHandle;
791 776
792 on(type: string | dojo.ExtensionEvent, func: dojo.EventListener | Function): dojo.WatchHandle;
777 on(type: dojo.ExtensionEvent, func: dojo.EventListener): dojo.WatchHandle;
793 778
794 779 /**
795 780 * Returns a string that represents the widget.
796 781 */
797 782 toString(): string;
798 783
799 784 /**
800 785 * Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent
801 786 * is this widget. Note that it does not return all descendants, but rather just direct children.
802 787 */
803 788 getChildren<T extends _WidgetBase>(): T[];
804 789
805 790 /**
806 791 * Returns the parent widget of this widget.
807 792 */
808 793 getParent<T extends _WidgetBase>(): T;
809 794
810 795 /**
811 796 * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead.
812 797 * @deprecated
813 798 */
814 799 connect(obj: any, event: string | dojo.ExtensionEvent, method: string | dojo.EventListener): dojo.WatchHandle;
815 800
816 801 /**
817 802 * Deprecated, will be removed in 2.0, use handle.remove() instead.
818 803 * @deprecated
819 804 */
820 805 disconnect(handle: dojo.WatchHandle): void;
821 806
822 807 /**
823 808 * Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead.
824 809 * @deprecated
825 810 */
826 811 subscribe(t: string, method: dojo.EventListener): dojo.WatchHandle;
827 812
828 813 /**
829 814 * Deprecated, will be removed in 2.0, use handle.remove() instead.
830 815 * @deprecated
831 816 */
832 817 unsubscribe(handle: dojo.WatchHandle): void;
833 818
834 819 /**
835 820 * Return this widget's explicit or implicit orientation (true for LTR, false for RTL)
836 821 */
837 822 isLeftToRight(): boolean;
838 823
839 824 /**
840 825 * Return true if this widget can currently be focused
841 826 * and false if not
842 827 */
843 828 isFocusable(): boolean;
844 829
845 830 /**
846 831 * Place this widget somewhere in the DOM based
847 832 * on standard domConstruct.place() conventions.
848 833 */
849 834 placeAt<T extends _WidgetBase>(reference: dojo.NodeFragmentOrString | T, position?: string | number): this;
850 835
851 836 /**
852 837 * Wrapper to setTimeout to avoid deferred functions executing
853 838 * after the originating widget has been destroyed.
854 839 * Returns an object handle with a remove method (that returns null) (replaces clearTimeout).
855 840 */
856 841 defer(fcn: Function, delay?: number): dojo.Handle;
857 842 }
858 843
859 844 interface _WidgetBaseConstructor<W> extends Pick<dojo._base.DeclareConstructor<W>, Exclude<keyof dojo._base.DeclareConstructor<W>, 'new'>> {
860 845 new(params?: Partial<W> & ThisType<W>, srcNodeRef?: dojo.NodeOrString): W & dojo._base.DeclareCreatedObject;
861 846 }
862 847
863 848 /* dijit/_WidgetsInTemplateMixin */
864 849
865 850 interface _WidgetsInTemplateMixin {
866 851 /**
867 852 * Used to provide a context require to dojo/parser in order to be
868 853 * able to use relative MIDs (e.g. `./Widget`) in the widget's template.
869 854 */
870 855 contextRequire: Function;
871 856
872 857 startup(): void;
873 858 }
874 859
875 860 interface _WidgetsInTemplateMixinConstructor extends dojo._base.DeclareConstructor<_WidgetsInTemplateMixin> {
876 861 new(params: Object, srcNodeRef: dojo.NodeOrString): _WidgetsInTemplateMixin;
877 862 }
878 863
879 864 /* dijit/a11yclick */
880 865
881 866 interface A11yClick {
882 867
883 868 /**
884 869 * Custom press, release, and click synthetic events
885 870 * which trigger on a left mouse click, touch, or space/enter keyup.
886 871 */
887 872 (node: HTMLElement, listener: Function): dojo.Handle;
888 873
889 874 /**
890 875 * Mousedown (left button), touchstart, or keydown (space or enter) corresponding to logical click operation.
891 876 */
892 877 press: dojo.ExtensionEvent;
893 878
894 879 /**
895 880 * Mouseup (left button), touchend, or keyup (space or enter) corresponding to logical click operation.
896 881 */
897 882 release: dojo.ExtensionEvent;
898 883
899 884 /**
900 885 * Mouse cursor or a finger is dragged over the given node.
901 886 */
902 887 move: dojo.ExtensionEvent;
903 888 }
904 889
905 890 /* dijit/Calendar */
906 891
907 892 interface _MonthDropDownButton extends form.DropDownButton<_MonthDropDown> {
908 893 onMonthSelect(): void;
909 894 postCreate(): void;
910 895
911 896 //set(name: 'month', value: number): this;
912 897 //set(name: string, value: any): this;
913 898 //set(values: Object): this;
914 899 }
915 900
916 901 interface _MonthDropDownButtonConstructor extends _WidgetBaseConstructor<_MonthDropDownButton> { }
917 902
918 903 interface _MonthDropDown extends _Widget, _TemplatedMixin, _CssStateMixin {
919 904 months: string[];
920 905 baseClass: string;
921 906 templateString: string;
922 907
923 908 /**
924 909 * Callback when month is selected from drop down
925 910 */
926 911 onChange(month: number): void;
927 912
928 913 //set(name: 'months', value: string[]): this;
929 914 //set(name: string, value: any): this;
930 915 //set(values: Object): this;
931 916 }
932 917
933 918 interface _MonthDropDownConstructor extends _WidgetBaseConstructor<_MonthDropDown> { }
934 919
935 920 interface Calendar extends CalendarLite, _Widget, _CssStateMixin {
936 921
937 922 baseClass: string;
938 923
939 924 /**
940 925 * Set node classes for various mouse events, see dijit._CssStateMixin for more details
941 926 */
942 927 cssStateNodes: CSSStateNodes;
943 928
944 929 /**
945 930 * Creates the drop down button that displays the current month and lets user pick a new one
946 931 */
947 932 _createMonthWidget(): _MonthDropDownButton;
948 933
949 934 postCreate(): void;
950 935
951 936 /**
952 937 * Handler for when user selects a month from the drop down list
953 938 */
954 939 _onMonthSelect(newMonth: number): void;
955 940
956 941 /**
957 942 * Handler for mouse over events on days, sets hovered style
958 943 */
959 944 _onDayMouseOver(evt: MouseEvent): void;
960 945
961 946 /**
962 947 * Handler for mouse out events on days, clears hovered style
963 948 */
964 949 _onDayMouseOut(evt: MouseEvent): void;
965 950 _onDayMouseDown(evt: MouseEvent): void;
966 951 _onDayMouseUp(evt: MouseEvent): void;
967 952
968 953 /**
969 954 * Provides keyboard navigation of calendar.
970 955 */
971 956 handleKey(evt: KeyboardEvent): void;
972 957
973 958 /**
974 959 * For handling keydown events on a stand alone calendar
975 960 */
976 961 _onKeyDown(evt: KeyboardEvent): void;
977 962
978 963 /**
979 964 * Deprecated. Notification that a date cell was selected. It may be the same as the previous value.
980 965 */
981 966 onValueSelected(date: Date): void;
982 967
983 968 onChange(date: Date): void;
984 969
985 970 /**
986 971 * May be overridden to return CSS classes to associate with the date entry for the given dateObject
987 972 * for example to indicate a holiday in specified locale.
988 973 */
989 974 getClassForDate(dateObject: Date, locale?: string): string;
990 975
991 976 // get(name: 'value'): Date;
992 977 // get(name: string): any;
993 978
994 979 // set(name: 'value', value: number | Date): this;
995 980 // set(name: string, value: any): this;
996 981 // set(values: Object): this;
997 982 }
998 983
999 984 interface CalendarConstructor extends _WidgetBaseConstructor<Calendar> {
1000 985 _MonthWidget: _MonthWidgetConstructor;
1001 986 _MonthDropDown: _MonthDropDownButtonConstructor;
1002 987 _MonthDropDownButton: _MonthDropDownButtonConstructor;
1003 988 }
1004 989
1005 990 /* dijit/CalendarLite */
1006 991
1007 992 interface _MonthWidget extends _WidgetBase {
1008 993 // set(name: 'month', value: Date): this;
1009 994 // set(name: string, value: any): this;
1010 995 // set(values: Object): this;
1011 996 }
1012 997
1013 998 interface _MonthWidgetConstructor extends _WidgetBaseConstructor<_MonthWidget> { }
1014 999
1015 1000 interface CalendarLite extends _WidgetBase, _TemplatedMixin {
1016 1001 /**
1017 1002 * Template for main calendar
1018 1003 */
1019 1004 templateString: string;
1020 1005
1021 1006 /**
1022 1007 * Template for cell for a day of the week (ex: M)
1023 1008 */
1024 1009 dowTemplateString: string;
1025 1010
1026 1011 dateTemplateString: string;
1027 1012 weekTemplateString: string;
1028 1013
1029 1014 /**
1030 1015 * The currently selected Date, initially set to invalid date to indicate no selection.
1031 1016 */
1032 1017 value: Date;
1033 1018
1034 1019 /**
1035 1020 * JavaScript namespace to find calendar routines. If unspecified, uses Gregorian calendar routines
1036 1021 * at dojo/date and dojo/date/locale.
1037 1022 */
1038 1023 datePackage: string;
1039 1024
1040 1025 /**
1041 1026 * How to represent the days of the week in the calendar header. See locale
1042 1027 */
1043 1028 dayWidth: string;
1044 1029
1045 1030 /**
1046 1031 * Order fields are traversed when user hits the tab key
1047 1032 */
1048 1033 tabIndex: string;
1049 1034
1050 1035 /**
1051 1036 * (Optional) The first day of week override. By default the first day of week is determined
1052 1037 * for the current locale (extracted from the CLDR).
1053 1038 * Special value -1 (default value), means use locale dependent value.
1054 1039 */
1055 1040 dayOffset: number;
1056 1041
1057 1042 /**
1058 1043 * Date object containing the currently focused date, or the date which would be focused
1059 1044 * if the calendar itself was focused. Also indicates which year and month to display,
1060 1045 * i.e. the current "page" the calendar is on.
1061 1046 */
1062 1047 currentFocus: Date;
1063 1048
1064 1049 /**
1065 1050 * Put the summary to the node with role=grid
1066 1051 */
1067 1052 _setSummaryAttr: string;
1068 1053
1069 1054 baseClass: string;
1070 1055
1071 1056 /**
1072 1057 * Runs various tests on the value, checking that it's a valid date, rather
1073 1058 * than blank or NaN.
1074 1059 */
1075 1060 _isValidDate(value: Date): boolean;
1076 1061
1077 1062 /**
1078 1063 * Convert Number into Date, or copy Date object. Then, round to nearest day,
1079 1064 * setting to 1am to avoid issues when DST shift occurs at midnight, see #8521, #9366)
1080 1065 */
1081 1066 _patchDate(value: number | Date): Date;
1082 1067
1083 1068 /**
1084 1069 * This just sets the content of node to the specified text.
1085 1070 * Can't do "node.innerHTML=text" because of an IE bug w/tables, see #3434.
1086 1071 */
1087 1072 _setText(node: HTMLElement, text?: string): void;
1088 1073
1089 1074 /**
1090 1075 * Fills in the calendar grid with each day (1-31).
1091 1076 * Call this on creation, when moving to a new month.
1092 1077 */
1093 1078 _populateGrid(): void;
1094 1079
1095 1080 /**
1096 1081 * Fill in localized month, and prev/current/next years
1097 1082 */
1098 1083 _populateControls(): void;
1099 1084
1100 1085 /**
1101 1086 * Sets calendar's value to today's date
1102 1087 */
1103 1088 goToToday(): void;
1104 1089
1105 1090 /**
1106 1091 * Creates the drop down button that displays the current month and lets user pick a new one
1107 1092 */
1108 1093 _createMonthWidget(): void;
1109 1094
1110 1095 buildRendering(): void;
1111 1096 postCreate(): void;
1112 1097
1113 1098 /**
1114 1099 * Set up connects for increment/decrement of months/years
1115 1100 */
1116 1101 _connectControls(): void;
1117 1102
1118 1103 /**
1119 1104 * If the calendar currently has focus, then focuses specified date,
1120 1105 * changing the currently displayed month/year if necessary.
1121 1106 * If the calendar doesn't have focus, updates currently
1122 1107 * displayed month/year, and sets the cell that will get focus
1123 1108 * when Calendar is focused.
1124 1109 */
1125 1110 _setCurrentFocusAttr(date: Date, forceFocus?: boolean): void;
1126 1111
1127 1112 /**
1128 1113 * Focus the calendar by focusing one of the calendar cells
1129 1114 */
1130 1115 focus(): void;
1131 1116
1132 1117 /**
1133 1118 * Handler for day clicks, selects the date if appropriate
1134 1119 */
1135 1120 _onDayClick(evt: MouseEvent): void;
1136 1121
1137 1122 /**
1138 1123 * Returns the cell corresponding to the date, or null if the date is not within the currently
1139 1124 * displayed month.
1140 1125 */
1141 1126 _getNodeByDate(value: Date): HTMLElement;
1142 1127
1143 1128 /**
1144 1129 * Marks the specified cells as selected, and clears cells previously marked as selected.
1145 1130 * For CalendarLite at most one cell is selected at any point, but this allows an array
1146 1131 * for easy subclassing.
1147 1132 */
1148 1133 _markSelectedDates(dates: Date[]): void;
1149 1134
1150 1135 /**
1151 1136 * Called only when the selected date has changed
1152 1137 */
1153 1138 onChange(date: Date): void;
1154 1139
1155 1140 /**
1156 1141 * May be overridden to disable certain dates in the calendar e.g. `isDisabledDate=dojo.date.locale.isWeekend`
1157 1142 */
1158 1143 isDisabledDate(dateObject: Date, locale?: string): boolean;
1159 1144
1160 1145 /**
1161 1146 * May be overridden to return CSS classes to associate with the date entry for the given dateObject,
1162 1147 * for example to indicate a holiday in specified locale.
1163 1148 */
1164 1149 getClassForDate(dateObject: Date, locale?: string): string;
1165 1150
1166 1151 // get(name: 'value'): Date;
1167 1152 // get(name: string): any;
1168 1153
1169 1154 // set(name: 'value', value: number | Date): this;
1170 1155 // set(name: string, value: any): this;
1171 1156 // set(values: Object): this;
1172 1157 }
1173 1158
1174 1159 interface CalendarLiteConstructor extends _WidgetBaseConstructor<CalendarLite> {
1175 1160 _MonthWidget: _MonthWidgetConstructor;
1176 1161 }
1177 1162
1178 1163 /* dijit/Destroyable */
1179 1164
1180 1165 interface Destroyable {
1181 1166 _destroyed?: true;
1182 1167
1183 1168 /**
1184 1169 * Destroy this class, releasing any resources registered via own().
1185 1170 */
1186 1171 destroy(preserveDom?: boolean): void;
1187 1172
1188 1173 /**
1189 1174 * Track specified handles and remove/destroy them when this instance is destroyed, unless they were
1190 1175 * already removed/destroyed manually.
1191 1176 */
1192 1177 own(...args: any[]): any[];
1193 1178 }
1194 1179
1195 1180 /**
1196 1181 * Mixin to track handles and release them when instance is destroyed.
1197 1182 */
1198 1183 interface DestroyableConstructor extends dojo._base.DeclareConstructor<Destroyable> { }
1199 1184
1200 1185 /** dijit/_KeyNavMixin */
1201 1186
1202 1187 /**
1203 1188 * A mixin to allow arrow key and letter key navigation of child or descendant widgets.
1204 1189 * It can be used by dijit/_Container based widgets with a flat list of children, or more complex widgets like dijit/Tree.
1205 1190 *
1206 1191 * To use this mixin, the subclass must:
1207 1192 *
1208 1193 * - Implement _getNext(), _getFirst(), _getLast(), _onLeftArrow(), _onRightArrow() _onDownArrow(), _onUpArrow() methods to handle home/end/left/right/up/down keystrokes. Next and previous in this context refer to a linear ordering of the descendants used by letter key search.
1209 1194 * - Set all descendants' initial tabIndex to "-1"; both initial descendants and any descendants added later, by for example addChild()
1210 1195 * - Define childSelector to a function or string that identifies focusable descendant widgets
1211 1196 *
1212 1197 * Also, child widgets must implement a focus() method.
1213 1198 */
1214 1199 interface _KeyNavMixin extends _FocusMixin {
1215 1200 /**
1216 1201 * Tab index of the container; same as HTML tabIndex attribute.
1217 1202 * Note then when user tabs into the container, focus is immediately moved to the first item in the container.
1218 1203 */
1219 1204 tabIndex: string;
1220 1205
1221 1206 /**
1222 1207 * Selector (passed to on.selector()) used to identify what to treat as a child widget. Used to monitor focus events and set this.focusedChild. Must be set by implementing class. If this is a string (ex: "> *") then the implementing class must require dojo/query.
1223 1208 */
1224 1209 childSelector: string | Function | null;
1225 1210
1226 1211 /**
1227 1212 * Called on left arrow key, or right arrow key if widget is in RTL mode.
1228 1213 * Should go back to the previous child in horizontal container widgets like Toolbar.
1229 1214 */
1230 1215 _onLeftArrow(evt?: KeyboardEvent): void;
1231 1216
1232 1217 /**
1233 1218 * Called on right arrow key, or left arrow key if widget is in RTL mode.
1234 1219 * Should go to the next child in horizontal container widgets like Toolbar.
1235 1220 */
1236 1221 _onRightArrow(evt?: KeyboardEvent): void;
1237 1222
1238 1223 /**
1239 1224 * Called on up arrow key. Should go to the previous child in vertical container widgets like Menu.
1240 1225 */
1241 1226 _onUpArrow(evt?: KeyboardEvent): void;
1242 1227
1243 1228 /**
1244 1229 * Called on down arrow key. Should go to the next child in vertical container widgets like Menu.
1245 1230 */
1246 1231 _onDownArrow(evt?: KeyboardEvent): void;
1247 1232
1248 1233 /**
1249 1234 * Default focus() implementation: focus the first child.
1250 1235 */
1251 1236 focus(): void;
1252 1237
1253 1238 /**
1254 1239 * Returns first child that can be focused.
1255 1240 */
1256 1241 _getFirstFocusableChild(): _WidgetBase;
1257 1242
1258 1243 /**
1259 1244 * Returns last child that can be focused.
1260 1245 */
1261 1246 _getLastFocusableChild(): _WidgetBase;
1262 1247
1263 1248 /**
1264 1249 * Focus the first focusable child in the container.
1265 1250 */
1266 1251 focusFirstChild(): void;
1267 1252
1268 1253 /**
1269 1254 * Focus the last focusable child in the container.
1270 1255 */
1271 1256 focusLastChild(): void;
1272 1257
1273 1258 /**
1274 1259 * Focus specified child widget.
1275 1260 *
1276 1261 * @param widget Reference to container's child widget
1277 1262 * @param last If true and if widget has multiple focusable nodes, focus the last one instead of the first one
1278 1263 */
1279 1264 focusChild(widget: _WidgetBase, last?: boolean): void;
1280 1265
1281 1266 /**
1282 1267 * Handler for when the container itself gets focus.
1283 1268 *
1284 1269 * Initially the container itself has a tabIndex, but when it gets focus, switch focus to first child.
1285 1270 */
1286 1271 _onContainerFocus(evt: Event): void;
1287 1272
1288 1273 /**
1289 1274 * Called when a child widget gets focus, either by user clicking it, or programatically by arrow key handling code.
1290 1275 *
1291 1276 * It marks that the current node is the selected one, and the previously selected node no longer is.
1292 1277 */
1293 1278 _onChildFocus(child?: _WidgetBase): void;
1294 1279
1295 1280 _searchString: string;
1296 1281
1297 1282 multiCharSearchDuration: number;
1298 1283
1299 1284 /**
1300 1285 * When a key is pressed that matches a child item, this method is called so that a widget can take appropriate action is necessary.
1301 1286 */
1302 1287 onKeyboardSearch(tem: _WidgetBase, evt: Event, searchString: string, numMatches: number): void;
1303 1288
1304 1289 /**
1305 1290 * Compares the searchString to the widget's text label, returning:
1306 1291 *
1307 1292 * * -1: a high priority match and stop searching
1308 1293 * * 0: not a match
1309 1294 * * 1: a match but keep looking for a higher priority match
1310 1295 */
1311 1296 _keyboardSearchCompare(item: _WidgetBase, searchString: string): -1 | 0 | 1;
1312 1297
1313 1298 /**
1314 1299 * When a key is pressed, if it's an arrow key etc. then it's handled here.
1315 1300 */
1316 1301 _onContainerKeydown(evt: Event): void;
1317 1302
1318 1303 /**
1319 1304 * When a printable key is pressed, it's handled here, searching by letter.
1320 1305 */
1321 1306 _onContainerKeypress(evt: Event): void;
1322 1307
1323 1308 /**
1324 1309 * Perform a search of the widget's options based on the user's keyboard activity
1325 1310 *
1326 1311 * Called on keypress (and sometimes keydown), searches through this widget's children looking for items that match the user's typed search string. Multiple characters typed within 1 sec of each other are combined for multicharacter searching.
1327 1312 */
1328 1313 _keyboardSearch(evt: Event, keyChar: string): void;
1329 1314
1330 1315 /**
1331 1316 * Called when focus leaves a child widget to go to a sibling widget.
1332 1317 */
1333 1318 _onChildBlur(widget: _WidgetBase): void;
1334 1319
1335 1320 /**
1336 1321 * Returns the next or previous focusable descendant, compared to "child".
1337 1322 * Implements and extends _KeyNavMixin._getNextFocusableChild() for a _Container.
1338 1323 */
1339 1324 _getNextFocusableChild(child: _WidgetBase, dir: 1 | -1): _WidgetBase | null;
1340 1325
1341 1326 /**
1342 1327 * Returns the first child.
1343 1328 */
1344 1329 _getFirst(): _WidgetBase | null;
1345 1330
1346 1331 /**
1347 1332 * Returns the last descendant.
1348 1333 */
1349 1334 _getLast(): _WidgetBase | null;
1350 1335
1351 1336 /**
1352 1337 * Returns the next descendant, compared to "child".
1353 1338 */
1354 1339 _getNext(child: _WidgetBase, dir: 1 | -1): _WidgetBase | null;
1355 1340 }
1356 1341
1357 1342 interface _KeyNavMixinConstructor extends dojo._base.DeclareConstructor<_KeyNavMixin> { }
1358 1343
1359 1344 /* dijit/_KeyNavContainer */
1360 1345
1361 1346 /**
1362 1347 * A _Container with keyboard navigation of its children.
1363 1348 *
1364 1349 * Provides normalized keyboard and focusing code for Container widgets.
1365 1350 * To use this mixin, call connectKeyNavHandlers() in postCreate().
1366 1351 * Also, child widgets must implement a focus() method.
1367 1352 */
1368 1353 interface _KeyNavContainer extends _FocusMixin, _KeyNavMixin, _Container {
1369 1354 /**
1370 1355 * Deprecated. You can call this in postCreate() to attach the keyboard handlers to the container, but the preferred method is to override _onLeftArrow() and _onRightArrow(), or _onUpArrow() and _onDownArrow(), to call focusPrev() and focusNext().
1371 1356 *
1372 1357 * @param prevKeyCodes Key codes for navigating to the previous child.
1373 1358 * @param nextKeyCodes Key codes for navigating to the next child.
1374 1359 */
1375 1360 connectKeyNavHandlers(prevKeyCodes: number[], nextKeyCodes: number[]): void;
1376 1361
1377 1362 /**
1378 1363 * @deprecated
1379 1364 */
1380 1365 startupKeyNavChildren(): void;
1381 1366
1382 1367 /**
1383 1368 * Setup for each child widget.
1384 1369 *
1385 1370 * Sets tabIndex=-1 on each child, so that the tab key will leave the container rather than visiting each child.
1386 1371 *
1387 1372 * Note: if you add children by a different method than addChild(), then need to call this manually or at least make sure the child's tabIndex is -1.
1388 1373 *
1389 1374 * Note: see also _LayoutWidget.setupChild(), which is also called for each child widget.
1390 1375 */
1391 1376 _startupChild(widget: _WidgetBase): void;
1392 1377
1393 1378 /**
1394 1379 * Returns the first child.
1395 1380 */
1396 1381 _getFirst(): _Widget | null;
1397 1382
1398 1383 /**
1399 1384 * Returns the last descendant.
1400 1385 */
1401 1386 _getLast(): _Widget | null;
1402 1387
1403 1388 /**
1404 1389 * Focus the next widget
1405 1390 */
1406 1391 focusNext(): void;
1407 1392
1408 1393 /**
1409 1394 * Focus the last focusable node in the previous widget
1410 1395 *
1411 1396 * (ex: go to the ComboButton icon section rather than button section)
1412 1397 */
1413 1398 focusPrev(): void;
1414 1399
1415 1400 /**
1416 1401 * Implement _KeyNavMixin.childSelector, to identify focusable child nodes.
1417 1402 *
1418 1403 * If we allowed a dojo/query dependency from this module this could more simply be a string "> *" instead of this function.
1419 1404 */
1420 1405 childSelector(node: Element | Node): boolean | void | any;
1421 1406 }
1422 1407
1423 1408 interface _KeyNavContainerConstructor extends dojo._base.DeclareConstructor<_KeyNavContainer> { }
1424 1409
1425 1410 /* dijit/_MenuBase */
1426 1411
1427 1412 /**
1428 1413 * Abstract base class for Menu and MenuBar.
1429 1414 * Subclass should implement _onUpArrow(), _onDownArrow(), _onLeftArrow(), and _onRightArrow().
1430 1415 */
1431 1416 interface _MenuBase extends _Widget, _TemplatedMixin, _KeyNavContainer, _CssStateMixin {
1432 1417 selected: MenuItem | null;
1433 1418
1434 1419 _setSelectedAttr(item?: MenuItem | null): void;
1435 1420
1436 1421 /**
1437 1422 * This Menu has been clicked (mouse or via space/arrow key) or opened as a submenu, so mere mouseover will open submenus. Focusing a menu via TAB does NOT automatically make it active since TAB is a navigation operation and not a selection one.
1438 1423 *
1439 1424 * For Windows apps, pressing the ALT key focuses the menubar menus (similar to TAB navigation) but the menu is not active (ie no dropdown) until an item is clicked.
1440 1425 */
1441 1426 activated: boolean;
1442 1427
1443 1428 _setActivatedAttr(val: boolean): void;
1444 1429
1445 1430 /**
1446 1431 * pointer to menu that displayed me
1447 1432 */
1448 1433 parentMenu: _Widget | null;
1449 1434
1450 1435 /**
1451 1436 * After a menu has been activated (by clicking on it etc.), number of milliseconds before hovering (without clicking) another MenuItem causes that MenuItem's popup to automatically open.
1452 1437 */
1453 1438 popupDelay: number;
1454 1439
1455 1440 /**
1456 1441 * For a passive (unclicked) Menu, number of milliseconds before hovering (without clicking) will cause the popup to open. Default is Infinity, meaning you need to click the menu to open it.
1457 1442 */
1458 1443 passivePopupDelay: number;
1459 1444
1460 1445 /**
1461 1446 * A toggle to control whether or not a Menu gets focused when opened as a drop down from a MenuBar or DropDownButton/ComboButton. Note though that it always get focused when opened via the keyboard.
1462 1447 */
1463 1448 autoFocus: boolean;
1464 1449
1465 1450 /**
1466 1451 * Selector (passed to on.selector()) used to identify MenuItem child widgets, but exclude inert children like MenuSeparator. If subclass overrides to a string (ex: "> *"), the subclass must require dojo/query.
1467 1452 */
1468 1453 childSelector(node: Element | Node): boolean | void | Function;
1469 1454
1470 1455 /**
1471 1456 * Attach point for notification about when a menu item has been executed. This is an internal mechanism used for Menus to signal to their parent to close them, because they are about to execute the onClick handler. In general developers should not attach to or override this method.
1472 1457 */
1473 1458 onExecute(): void;
1474 1459
1475 1460 /**
1476 1461 * Attach point for notification about when the user cancels the current menu
1477 1462 * This is an internal mechanism used for Menus to signal to their parent to close them. In general developers should not attach to or override this method.
1478 1463 */
1479 1464 onCancel(): void;
1480 1465
1481 1466 /**
1482 1467 * This handles the right arrow key (left arrow key on RTL systems), which will either open a submenu, or move to the next item in the ancestor MenuBar
1483 1468 */
1484 1469 _moveToPopup(evt: Event): void;
1485 1470
1486 1471 /**
1487 1472 * This handler is called when the mouse moves over the popup.
1488 1473 */
1489 1474 _onPopupHover(evt?: MouseEvent): void;
1490 1475
1491 1476 /**
1492 1477 * Called when cursor is over a MenuItem.
1493 1478 */
1494 1479 onItemHover(item: MenuItem): void;
1495 1480
1496 1481 /**
1497 1482 * Called when a child MenuItem becomes deselected. Setup timer to close its popup.
1498 1483 */
1499 1484 _onChildDeselect(item: MenuItem): void;
1500 1485
1501 1486 /**
1502 1487 * Callback fires when mouse exits a MenuItem
1503 1488 */
1504 1489 onItemUnhover(item: MenuItem): void;
1505 1490
1506 1491 /**
1507 1492 * Cancels the popup timer because the user has stop hovering on the MenuItem, etc.
1508 1493 */
1509 1494 _stopPopupTimer(): void;
1510 1495
1511 1496 /**
1512 1497 * Cancels the pending-close timer because the close has been preempted
1513 1498 */
1514 1499 _stopPendingCloseTimer(): void;
1515 1500
1516 1501 /**
1517 1502 * Returns the top menu in this chain of Menus
1518 1503 */
1519 1504 _getTopMenu(): void;
1520 1505
1521 1506 /**
1522 1507 * Handle clicks on an item.
1523 1508 */
1524 1509 onItemClick(item: _WidgetBase, evt: Event): void;
1525 1510
1526 1511 /**
1527 1512 * Open the popup to the side of/underneath the current menu item, and optionally focus first item
1528 1513 */
1529 1514 _openItemPopup(fromItem: MenuItem, focus: boolean): void;
1530 1515
1531 1516 /**
1532 1517 * Callback when this menu is opened.
1533 1518 * This is called by the popup manager as notification that the menu was opened.
1534 1519 */
1535 1520 onOpen(evt?: Event): void;
1536 1521
1537 1522 /**
1538 1523 * Callback when this menu is closed.
1539 1524 * This is called by the popup manager as notification that the menu was closed.
1540 1525 */
1541 1526 onClose(): boolean;
1542 1527
1543 1528 /**
1544 1529 * Called when submenu is clicked or focus is lost. Close hierarchy of menus.
1545 1530 */
1546 1531 _closeChild(): void;
1547 1532 /**
1548 1533 * Called when child of this Menu gets focus from:
1549 1534 *
1550 1535 * 1. clicking it
1551 1536 * 2. tabbing into it
1552 1537 * 3. being opened by a parent menu.
1553 1538 *
1554 1539 * This is not called just from mouse hover.
1555 1540 */
1556 1541 _onItemFocus(item: MenuItem): void;
1557 1542
1558 1543 /**
1559 1544 * Called when focus is moved away from this Menu and it's submenus.
1560 1545 */
1561 1546 _onBlur(): void;
1562 1547
1563 1548 /**
1564 1549 * Called when the user is done with this menu. Closes hierarchy of menus.
1565 1550 */
1566 1551 _cleanUp(clearSelectedItem?: boolean): void;
1567 1552 }
1568 1553
1569 1554 interface _MenuBaseConstructor extends _WidgetBaseConstructor<_MenuBase> { }
1570 1555
1571 1556 /* dijit/Dialog */
1572 1557
1573 1558 interface _DialogBase extends _TemplatedMixin, form._FormMixin, _DialogMixin, _CssStateMixin {
1574 1559 templateString: string;
1575 1560 baseClass: string;
1576 1561 cssStateNodes: CSSStateNodes;
1577 1562
1578 1563 /**
1579 1564 * True if Dialog is currently displayed on screen.
1580 1565 */
1581 1566 open: boolean;
1582 1567
1583 1568 /**
1584 1569 * The time in milliseconds it takes the dialog to fade in and out
1585 1570 */
1586 1571 duration: number;
1587 1572
1588 1573 /**
1589 1574 * A Toggle to modify the default focus behavior of a Dialog, which
1590 1575 * is to re-focus the element which had focus before being opened.
1591 1576 * False will disable refocusing. Default: true
1592 1577 */
1593 1578 refocus: boolean;
1594 1579
1595 1580 /**
1596 1581 * A Toggle to modify the default focus behavior of a Dialog, which
1597 1582 * is to focus on the first dialog element after opening the dialog.
1598 1583 * False will disable autofocusing. Default: true
1599 1584 */
1600 1585 autofocus: boolean;
1601 1586
1602 1587 /**
1603 1588 * Toggles the movable aspect of the Dialog. If true, Dialog
1604 1589 * can be dragged by it's title. If false it will remain centered
1605 1590 * in the viewport.
1606 1591 */
1607 1592 draggable: boolean;
1608 1593
1609 1594 /**
1610 1595 * Maximum size to allow the dialog to expand to, relative to viewport size
1611 1596 */
1612 1597 maxRatio: number;
1613 1598
1614 1599 /**
1615 1600 * Dialog show [x] icon to close itself, and ESC key will close the dialog.
1616 1601 */
1617 1602 closable: boolean;
1618 1603 postMixInProperties(): void;
1619 1604 postCreate(): void;
1620 1605
1621 1606 /**
1622 1607 * Called when data has been loaded from an href.
1623 1608 * Unlike most other callbacks, this function can be connected to (via `dojo.connect`)
1624 1609 * but should *not* be overridden.
1625 1610 */
1626 1611 onLoad(data?: any): void;
1627 1612
1628 1613 focus(): void;
1629 1614
1630 1615 /* Not entirely sure of the resolution type of these promises */
1631 1616
1632 1617 /**
1633 1618 * Display the dialog
1634 1619 */
1635 1620 show(): dojo.promise.Promise<any>;
1636 1621
1637 1622 /**
1638 1623 * Hide the dialog
1639 1624 */
1640 1625 hide(): dojo.promise.Promise<any>;
1641 1626
1642 1627 /**
1643 1628 * Called with no argument when viewport scrolled or viewport size changed. Adjusts Dialog as
1644 1629 * necessary to keep it visible.
1645 1630 *
1646 1631 * Can also be called with an argument (by dojox/layout/ResizeHandle etc.) to explicitly set the
1647 1632 * size of the dialog.
1648 1633 */
1649 1634 resize(dim?: dojo.DomGeometryWidthHeight): void;
1650 1635
1651 1636 destroy(preserveDom?: boolean): void;
1652 1637 }
1653 1638
1654 1639 interface _DialogBaseConstructor extends _WidgetBaseConstructor<_DialogBase> { }
1655 1640
1656 1641 interface Dialog extends layout.ContentPane, _DialogBase {
1657 1642 /* overrides conflicting methods */
1658 1643 resize(dim?: dojo.DomGeometryWidthHeight): void;
1659 1644 }
1660 1645
1661 1646 interface DialogLevelManager {
1662 1647 _beginZIndex: number;
1663 1648
1664 1649 /**
1665 1650 * Call right before fade-in animation for new dialog.
1666 1651 *
1667 1652 * Saves current focus, displays/adjusts underlay for new dialog,
1668 1653 * and sets the z-index of the dialog itself.
1669 1654 *
1670 1655 * New dialog will be displayed on top of all currently displayed dialogs.
1671 1656 * Caller is responsible for setting focus in new dialog after the fade-in
1672 1657 * animation completes.
1673 1658 */
1674 1659 show(dialog: _WidgetBase, underlayAttrs: Object): void;
1675 1660
1676 1661 /**
1677 1662 * Called when the specified dialog is hidden/destroyed, after the fade-out
1678 1663 * animation ends, in order to reset page focus, fix the underlay, etc.
1679 1664 * If the specified dialog isn't open then does nothing.
1680 1665 *
1681 1666 * Caller is responsible for either setting display:none on the dialog domNode,
1682 1667 * or calling dijit/popup.hide(), or removing it from the page DOM.
1683 1668 */
1684 1669 hide(dialog: _WidgetBase): void;
1685 1670
1686 1671 /**
1687 1672 * Returns true if specified Dialog is the top in the task
1688 1673 */
1689 1674 isTop(dialog: _WidgetBase): boolean;
1690 1675 }
1691 1676
1692 1677 interface DialogConstructor extends _WidgetBaseConstructor<Dialog> {
1693 1678 /**
1694 1679 * for monkey patching and dojox/widget/DialogSimple
1695 1680 */
1696 1681 _DialogBase: _DialogBaseConstructor;
1697 1682 _DialogLevelManager: DialogLevelManager;
1698 1683 _dialogStack: {
1699 1684 dialog: _WidgetBase,
1700 1685 focus: any,
1701 1686 underlayAttrs: any
1702 1687 }[];
1703 1688 }
1704 1689
1705 1690 /* dijit/ConfirmDialog */
1706 1691
1707 1692 interface ConfirmDialog extends _ConfirmDialogMixin { }
1708 1693
1709 1694 interface ConfirmDialogConstructor extends DialogConstructor { }
1710 1695
1711 1696 /* dijit/DropDownMenu */
1712 1697
1713 1698 /**
1714 1699 * A menu, without features for context menu (Meaning, drop down menu)
1715 1700 */
1716 1701 interface DropDownMenu extends _MenuBase { }
1717 1702
1718 1703 interface DropDownMenuConstructor extends _WidgetBaseConstructor<DropDownMenu> { }
1719 1704
1720 1705 /* dijit/Fieldset */
1721 1706
1722 1707 /**
1723 1708 * An accessible fieldset that can be expanded or collapsed via
1724 1709 * its legend. Fieldset extends `dijit.TitlePane`.
1725 1710 */
1726 1711 interface Fieldset extends TitlePane {
1727 1712 open: boolean;
1728 1713 }
1729 1714
1730 1715 interface FieldsetConstructor extends _WidgetBaseConstructor<Fieldset> { }
1731 1716
1732 1717 /* dijit/Menu */
1733 1718
1734 1719 /**
1735 1720 * A context menu you can assign to multiple elements
1736 1721 */
1737 1722 interface Menu extends dijit.DropDownMenu {
1738 1723 /**
1739 1724 * Array of dom node ids of nodes to attach to.
1740 1725 * Fill this with nodeIds upon widget creation and it becomes context menu for those nodes.
1741 1726 */
1742 1727 targetNodeIds: string[];
1743 1728
1744 1729 /**
1745 1730 * CSS expression to apply this Menu to descendants of targetNodeIds, rather than to
1746 1731 * the nodes specified by targetNodeIds themselves. Useful for applying a Menu to
1747 1732 * a range of rows in a table, tree, etc.
1748 1733 *
1749 1734 * The application must require() an appropriate level of dojo/query to handle the selector.
1750 1735 */
1751 1736 selector: string;
1752 1737
1753 1738 /**
1754 1739 * If true, right clicking anywhere on the window will cause this context menu to open.
1755 1740 * If false, must specify targetNodeIds.
1756 1741 */
1757 1742 contextMenuForWindow: boolean;
1758 1743
1759 1744 /**
1760 1745 * If true, menu will open on left click instead of right click, similar to a file menu.
1761 1746 */
1762 1747 leftClickToOpen: boolean;
1763 1748
1764 1749 /**
1765 1750 * When this menu closes, re-focus the element which had focus before it was opened.
1766 1751 */
1767 1752 refocus: boolean;
1768 1753
1769 1754 /**
1770 1755 * Attach menu to given node
1771 1756 */
1772 1757 bindDomNode(node: string | Node): void;
1773 1758
1774 1759 /**
1775 1760 * Detach menu from given node
1776 1761 */
1777 1762 unBindDomNode(nodeName: string | Node): void;
1778 1763 }
1779 1764
1780 1765 interface MenuConstructor extends _WidgetBaseConstructor<Menu> { }
1781 1766
1782 1767 /* dijit/MenuBar */
1783 1768 interface MenuBar extends _MenuBase {
1784 1769 baseClass: 'dijitMenuBar';
1785 1770 popupDelay: number;
1786 1771 _isMenuBar: true;
1787 1772 _orient: string[];
1788 1773 _moveToPopup(evt: Event): void;
1789 1774 focusChild(item: _WidgetBase): void;
1790 1775 _onChildDeselect(item: _WidgetBase): void;
1791 1776 _onLeftArrow(): void;
1792 1777 _onRightArrow(): void;
1793 1778 _onDownArrow(): void;
1794 1779 _onUpArrow(): void;
1795 1780 onItemClick(item: _WidgetBase, evt: Event): void;
1796 1781 }
1797 1782
1798 1783 interface MenuBarConstructor extends _WidgetBaseConstructor<MenuBar> { }
1799 1784
1800 1785 /* dijit/MenuBarItem */
1801 1786 interface MenuBarItem extends MenuItem { }
1802 1787
1803 1788 interface MenuBarItemConstructor extends _WidgetBaseConstructor<MenuBarItem> { }
1804 1789
1805 1790 /* dijit/MenuItem */
1806 1791 interface MenuItem extends _Widget, _TemplatedMixin, _Contained, _CssStateMixin {
1807 1792 /**
1808 1793 * Text for the accelerator (shortcut) key combination, a control, alt, etc. modified keystroke meant to execute the menu item regardless of where the focus is on the page.
1809 1794 *
1810 1795 * Note that although Menu can display accelerator keys, there is no infrastructure to actually catch and execute those accelerators.
1811 1796 */
1812 1797 accelKey: string;
1813 1798
1814 1799 /**
1815 1800 * If true, the menu item is disabled.
1816 1801 * If false, the menu item is enabled.
1817 1802 */
1818 1803 disabled: boolean;
1819 1804
1820 1805 /** Menu text as HTML */
1821 1806 label: string;
1822 1807
1823 1808 /**
1824 1809 * Class to apply to DOMNode to make it display an icon.
1825 1810 */
1826 1811 iconClass: string;
1827 1812
1828 1813 /**
1829 1814 * Hook for attr('accelKey', ...) to work.
1830 1815 * Set accelKey on this menu item.
1831 1816 */
1832 1817 _setAccelKeyAttr(value: string): void;
1833 1818
1834 1819 /**
1835 1820 * Hook for attr('disabled', ...) to work.
1836 1821 * Enable or disable this menu item.
1837 1822 */
1838 1823 _setDisabledAttr(value: boolean): void;
1839 1824
1840 1825 _setLabelAttr(val: string): void;
1841 1826 _setIconClassAttr(val: string): void;
1842 1827
1843 1828 _fillContent(source: Element): void;
1844 1829
1845 1830 /**
1846 1831 * Indicate that this node is the currently selected one
1847 1832 */
1848 1833 _setSelected(selected: boolean): void;
1849 1834
1850 1835 focus(): void;
1851 1836
1852 1837 /**
1853 1838 * Deprecated.
1854 1839 * Use set('disabled', bool) instead.
1855 1840 */
1856 1841 setDisabled(disabled: boolean): void;
1857 1842
1858 1843 /**
1859 1844 * Deprecated.
1860 1845 * Use set('label', ...) instead.
1861 1846 */
1862 1847 setLabel(content: string): void;
1863 1848 }
1864 1849
1865 1850 interface MenuItemConstructor extends _WidgetBaseConstructor<MenuItem> { }
1866 1851
1867 1852 /* dijit/MenuSeparator */
1868 1853 interface MenuSeparator extends _WidgetBase, _TemplatedMixin, _Contained { }
1869 1854
1870 1855 interface MenuSeparatorConstructor extends _WidgetBaseConstructor<MenuSeparator> { }
1871 1856
1872 1857 /* dijit/place */
1873 1858
1874 1859 interface PlacePosition {
1875 1860 x: number;
1876 1861 y: number;
1877 1862 }
1878 1863
1879 1864 interface PlaceWidthHeight {
1880 1865 w: number;
1881 1866 h: number;
1882 1867 }
1883 1868
1884 1869 interface PlaceRectangle extends PlacePosition, PlaceWidthHeight { }
1885 1870
1886 1871 type PlaceCorner = 'BL' | 'TR' | 'BR' | 'TL';
1887 1872
1888 1873 type PlacePositions = 'before' | 'after' | 'before-centered' | 'after-centered' | 'above-centered' | 'above' | 'above-alt' | 'below-centered' | 'below' | 'below-alt';
1889 1874
1890 1875 interface PlaceChoice {
1891 1876 corner: PlaceCorner;
1892 1877 pos: PlacePosition;
1893 1878 aroundCorner?: PlaceCorner;
1894 1879 }
1895 1880
1896 1881 interface PlaceLocation extends PlaceRectangle {
1897 1882 corner: PlaceCorner;
1898 1883 aroundCorner: PlaceCorner;
1899 1884 overflow: number;
1900 1885 spaceAvailable: PlaceWidthHeight;
1901 1886 }
1902 1887
1903 1888 interface LayoutNodeFunction {
1904 1889 (node: HTMLElement, aroundCorner: string, corner: string, spaceAvailable: PlaceWidthHeight, aroundNodeCoords: PlaceWidthHeight): number;
1905 1890 }
1906 1891
1907 1892 interface Place {
1908 1893 /**
1909 1894 * Positions node kitty-corner to the rectangle centered at (pos.x, pos.y) with width and height of
1910 1895 * padding.x * 2 and padding.y * 2, or zero if padding not specified. Picks first corner in corners[]
1911 1896 * where node is fully visible, or the corner where it's most visible.
1912 1897 *
1913 1898 * Node is assumed to be absolutely or relatively positioned.
1914 1899 */
1915 1900 at(node: Element, pos?: PlacePosition, corners?: PlaceCorner[], padding?: PlacePosition, layoutNode?: LayoutNodeFunction): PlaceLocation;
1916 1901
1917 1902 /**
1918 1903 * Position node adjacent or kitty-corner to anchor
1919 1904 * such that it's fully visible in viewport.
1920 1905 */
1921 1906 around(node: Element, anchor: Element | PlaceRectangle, positions: PlacePositions[], leftToRight?: boolean, layoutNode?: LayoutNodeFunction): PlaceLocation;
1922 1907 }
1923 1908
1924 1909 /* dijit/popup */
1925 1910
1926 1911 interface PopupOpenArgs {
1927 1912 /**
1928 1913 * widget to display
1929 1914 */
1930 1915 popup?: _WidgetBase;
1931 1916
1932 1917 /**
1933 1918 * the button etc. that is displaying this popup
1934 1919 */
1935 1920 parent?: _WidgetBase;
1936 1921
1937 1922 /**
1938 1923 * DOM node (typically a button); place popup relative to this node. (Specify this *or* "x" and "y" parameters.)
1939 1924 */
1940 1925 around?: HTMLElement;
1941 1926
1942 1927 /**
1943 1928 * Absolute horizontal position (in pixels) to place node at. (Specify this *or* "around" parameter.)
1944 1929 */
1945 1930 x?: number;
1946 1931
1947 1932 /**
1948 1933 * Absolute vertical position (in pixels) to place node at. (Specify this *or* "around" parameter.)
1949 1934 */
1950 1935 y?: number;
1951 1936
1952 1937 /**
1953 1938 * When the around parameter is specified, orient should be a list of positions to try
1954 1939 */
1955 1940 orient?: string | string[] | { BL?: string; TR?: string; TL?: string; BR?: string; };
1956 1941
1957 1942 /**
1958 1943 * callback when user has canceled the popup by:
1959 1944 *
1960 1945 * 1. hitting ESC or
1961 1946 * 2. by using the popup widget's proprietary cancel mechanism (like a cancel button in a dialog);
1962 1947 * i.e. whenever popupWidget.onCancel() is called, args.onCancel is called
1963 1948 */
1964 1949 onCancel?: () => void;
1965 1950
1966 1951 /**
1967 1952 * callback whenever this popup is closed
1968 1953 */
1969 1954 onClose?: () => void;
1970 1955
1971 1956 /**
1972 1957 * callback when user "executed" on the popup/sub-popup by selecting a menu choice, etc. (top menu only)
1973 1958 */
1974 1959 onExecute?: () => void;
1975 1960
1976 1961 /**
1977 1962 * adding a buffer around the opening position. This is only useful when around is not set.
1978 1963 */
1979 1964 padding?: PlacePosition;
1980 1965
1981 1966 /**
1982 1967 * The max height for the popup. Any popup taller than this will have scrollbars.
1983 1968 * Set to Infinity for no max height. Default is to limit height to available space in viewport,
1984 1969 * above or below the aroundNode or specified x/y position.
1985 1970 */
1986 1971 maxHeight?: number;
1987 1972 }
1988 1973
1989 1974 interface PopupManager {
1990 1975 /**
1991 1976 * Stack of currently popped up widgets.
1992 1977 * (someone opened _stack[0], and then it opened _stack[1], etc.)
1993 1978 */
1994 1979 _stack: _WidgetBase[];
1995 1980
1996 1981 /**
1997 1982 * Z-index of the first popup. (If first popup opens other
1998 1983 * popups they get a higher z-index.)
1999 1984 */
2000 1985 _beginZIndex: number;
2001 1986
2002 1987 _idGen: number;
2003 1988
2004 1989 /**
2005 1990 * If screen has been scrolled, reposition all the popups in the stack.
2006 1991 * Then set timer to check again later.
2007 1992 */
2008 1993 _repositionAll(): void;
2009 1994
2010 1995 /**
2011 1996 * Initialization for widgets that will be used as popups.
2012 1997 * Puts widget inside a wrapper DIV (if not already in one),
2013 1998 * and returns pointer to that wrapper DIV.
2014 1999 */
2015 2000 _createWrapper(widget: _WidgetBase): HTMLDivElement;
2016 2001
2017 2002 /**
2018 2003 * Moves the popup widget off-screen.
2019 2004 * Do not use this method to hide popups when not in use, because
2020 2005 * that will create an accessibility issue: the offscreen popup is
2021 2006 * still in the tabbing order.
2022 2007 */
2023 2008 moveOffScreen(widget: _WidgetBase): HTMLDivElement;
2024 2009
2025 2010 /**
2026 2011 * Hide this popup widget (until it is ready to be shown).
2027 2012 * Initialization for widgets that will be used as popups
2028 2013 *
2029 2014 * Also puts widget inside a wrapper DIV (if not already in one)
2030 2015 *
2031 2016 * If popup widget needs to layout it should
2032 2017 * do so when it is made visible, and popup._onShow() is called.
2033 2018 */
2034 2019 hide(widget: _WidgetBase): void;
2035 2020
2036 2021 /**
2037 2022 * Compute the closest ancestor popup that's *not* a child of another popup.
2038 2023 * Ex: For a TooltipDialog with a button that spawns a tree of menus, find the popup of the button.
2039 2024 */
2040 2025 getTopPopup(): _WidgetBase;
2041 2026
2042 2027 /**
2043 2028 * Popup the widget at the specified position
2044 2029 */
2045 2030 open(args: PopupOpenArgs): PlaceLocation;
2046 2031
2047 2032 /**
2048 2033 * Close specified popup and any popups that it parented.
2049 2034 * If no popup is specified, closes all popups.
2050 2035 */
2051 2036 close(popup?: _WidgetBase): void;
2052 2037 }
2053 2038
2054 2039 /* dijit/PopupMenuBarItem */
2055 2040
2056 2041 interface PopupMenuBarItem extends PopupMenuItem { }
2057 2042
2058 2043 interface PopupMenuBarItemConstructor extends _WidgetBaseConstructor<PopupMenuBarItem> { }
2059 2044
2060 2045 /** dijit/PopupMenuItem */
2061 2046
2062 2047 /**
2063 2048 * An item in a Menu that spawn a drop down (usually a drop down menu)
2064 2049 */
2065 2050 interface PopupMenuItem extends MenuItem {
2066 2051 /**
2067 2052 * When Menu is declared in markup, this code gets the menu label and the popup widget from the srcNodeRef.
2068 2053 *
2069 2054 * srcNodeRef.innerHTML contains both the menu item text and a popup widget
2070 2055 * The first part holds the menu item text and the second part is the popup
2071 2056 */
2072 2057 _fillContent(source: Element): void;
2073 2058
2074 2059 /**
2075 2060 * Open the popup to the side of/underneath this MenuItem, and optionally focus first item
2076 2061 */
2077 2062 _openPopup(params: { around?: Element; popup?: Function }, focus?: boolean): void;
2078 2063
2079 2064 _closePopup(): void;
2080 2065 }
2081 2066
2082 2067 interface PopupMenuItemConstructor extends _WidgetBaseConstructor<PopupMenuItem> { }
2083 2068
2084 2069 /* dijit/registry */
2085 2070
2086 2071 interface Registry {
2087 2072 /**
2088 2073 * Number of registered widgets
2089 2074 */
2090 2075 length: number;
2091 2076
2092 2077 /**
2093 2078 * Add a widget to the registry. If a duplicate ID is detected, a error is thrown.
2094 2079 */
2095 2080 add(widget: _WidgetBase): void;
2096 2081
2097 2082 /**
2098 2083 * Remove a widget from the registry. Does not destroy the widget; simply
2099 2084 * removes the reference.
2100 2085 */
2101 2086 remove(id: string): void;
2102 2087
2103 2088 /**
2104 2089 * Find a widget by it's id.
2105 2090 * If passed a widget then just returns the widget.
2106 2091 */
2107 2092 byId(id: string | _WidgetBase): _WidgetBase;
2108 2093
2109 2094 /**
2110 2095 * Returns the widget corresponding to the given DOMNode
2111 2096 */
2112 2097 byNode(node: Element | Node): _WidgetBase;
2113 2098
2114 2099 /**
2115 2100 * Convert registry into a true Array
2116 2101 */
2117 2102 toArray(): _WidgetBase[];
2118 2103
2119 2104 /**
2120 2105 * Generates a unique id for a given widgetType
2121 2106 */
2122 2107 getUniqueId(widgetType: string): string;
2123 2108
2124 2109 /**
2125 2110 * Search subtree under root returning widgets found.
2126 2111 * Doesn't search for nested widgets (ie, widgets inside other widgets).
2127 2112 */
2128 2113 findWidgets(root: Node, skipNode?: Node): _WidgetBase[];
2129 2114
2130 2115 /**
2131 2116 * Returns the widget whose DOM tree contains the specified DOMNode, or null if
2132 2117 * the node is not contained within the DOM tree of any widget
2133 2118 */
2134 2119 getEnclosingWidget(node: Element | Node): _WidgetBase;
2135 2120 }
2136 2121
2137 2122 /* dijit/TitlePane */
2138 2123
2139 2124 interface TitlePane extends dijit.layout.ContentPane, _TemplatedMixin, _CssStateMixin {
2140 2125 /**
2141 2126 * Whether pane can be opened or closed by clicking the title bar.
2142 2127 */
2143 2128 toggleable: boolean;
2144 2129
2145 2130 /**
2146 2131 * Tabindex setting for the title (so users can tab to the title then use space/enter to open/close the title pane)
2147 2132 */
2148 2133 tabIndex: string;
2149 2134
2150 2135 /**
2151 2136 * Time in milliseconds to fade in/fade out
2152 2137 */
2153 2138 duration: number;
2154 2139
2155 2140 /**
2156 2141 * Don't change this parameter from the default value.
2157 2142 *
2158 2143 * This ContentPane parameter doesn't make sense for TitlePane, since TitlePane is never a child of a layout container, nor should TitlePane try to control the size of an inner widget.
2159 2144 */
2160 2145 doLayout: boolean;
2161 2146
2162 2147 /**
2163 2148 * Switches between opened and closed state
2164 2149 */
2165 2150 toggle(): void;
2166 2151
2167 2152 /**
2168 2153 * Set the open/close css state for the TitlePane
2169 2154 */
2170 2155 _setCss(): void;
2171 2156
2172 2157 /**
2173 2158 * Handler for when user hits a key
2174 2159 */
2175 2160 _onTitleKey(e: Event): void;
2176 2161
2177 2162 /**
2178 2163 * Handler when user clicks the title bar
2179 2164 */
2180 2165 _onTitleClick(): void;
2181 2166
2182 2167 /**
2183 2168 * Deprecated. Use set('title', ...) instead.
2184 2169 */
2185 2170 setTitle(): void;
2186 2171 }
2187 2172
2188 2173 interface TitlePaneConstructor extends _WidgetBaseConstructor<TitlePane> { }
2189 2174
2190 2175 /* dijit/Toolbar */
2191 2176
2192 2177 interface Toolbar extends dijit._Widget, dijit._TemplatedMixin, dijit._KeyNavContainer { }
2193 2178
2194 2179 interface ToolbarConstructor extends _WidgetBaseConstructor<Toolbar> { }
2195 2180
2196 2181 /* dijit/ToolbarSeparator */
2197 2182
2198 2183 interface ToolbarSeparator extends dijit._Widget, dijit._TemplatedMixin { }
2199 2184
2200 2185 interface ToolbarSeparatorConstructor extends _WidgetBaseConstructor<ToolbarSeparator> { }
2201 2186
2202 2187 /* dijit/Tooltip */
2203 2188
2204 2189 interface Tooltip extends _Widget {
2205 2190 /**
2206 2191 * HTML to display in the tooltip.
2207 2192 * Specified as innerHTML when creating the widget from markup.
2208 2193 */
2209 2194 label: string;
2210 2195
2211 2196 /**
2212 2197 * Number of milliseconds to wait after hovering over/focusing on the object, before
2213 2198 * the tooltip is displayed.
2214 2199 */
2215 2200 showDelay: number;
2216 2201
2217 2202 /**
2218 2203 * Number of milliseconds to wait after unhovering the object, before
2219 2204 * the tooltip is hidden. Note that blurring an object hides the tooltip immediately.
2220 2205 */
2221 2206 hideDelay: number;
2222 2207
2223 2208 /**
2224 2209 * Id of domNode(s) to attach the tooltip to.
2225 2210 * When user hovers over specified dom node(s), the tooltip will appear.
2226 2211 */
2227 2212 connectId: dojo.NodeOrString | dojo.NodeOrString[];
2228 2213
2229 2214 /**
2230 2215 * See description of `dijit/Tooltip.defaultPosition` for details on position parameter.
2231 2216 */
2232 2217 position: string;
2233 2218
2234 2219 /**
2235 2220 * CSS expression to apply this Tooltip to descendants of connectIds, rather than to
2236 2221 * the nodes specified by connectIds themselves. Useful for applying a Tooltip to
2237 2222 * a range of rows in a table, tree, etc. Use in conjunction with getContent() parameter.
2238 2223 * Ex: connectId: myTable, selector: "tr", getContent: function(node){ return ...; }
2239 2224 *
2240 2225 * The application must require() an appropriate level of dojo/query to handle the selector.
2241 2226 */
2242 2227 selector: string;
2243 2228
2244 2229 /**
2245 2230 * Attach tooltip to specified node if it's not already connected
2246 2231 */
2247 2232 addTarget(node: dojo.NodeOrString): void;
2248 2233
2249 2234 /**
2250 2235 * Detach tooltip from specified node
2251 2236 */
2252 2237 removeTarget(node: dojo.NodeOrString): void;
2253 2238
2254 2239 /**
2255 2240 * User overridable function that return the text to display in the tooltip.
2256 2241 */
2257 2242 getContent(node: Node): Node;
2258 2243
2259 2244 /**
2260 2245 * Display the tooltip; usually not called directly.
2261 2246 */
2262 2247 open(target: Node): void;
2263 2248
2264 2249 /**
2265 2250 * Hide the tooltip or cancel timer for show of tooltip
2266 2251 */
2267 2252 close(): void;
2268 2253
2269 2254 /**
2270 2255 * Called when the tooltip is shown
2271 2256 */
2272 2257 onShow(): void;
2273 2258
2274 2259 /**
2275 2260 * Called when the tooltip is hidden
2276 2261 */
2277 2262 onHide(): void;
2278 2263 }
2279 2264
2280 2265 interface TooltipConstructor extends _WidgetBaseConstructor<Tooltip> {
2281 2266 /**
2282 2267 * This variable controls the position of tooltips, if the position is not specified to
2283 2268 * the Tooltip widget or *TextBox widget itself. It's an array of strings with the values
2284 2269 * possible for `dijit/place.around()`. The recommended values are:
2285 2270 *
2286 2271 * - before-centered: centers tooltip to the left of the anchor node/widget, or to the right
2287 2272 * in the case of RTL scripts like Hebrew and Arabic
2288 2273 * - after-centered: centers tooltip to the right of the anchor node/widget, or to the left
2289 2274 * in the case of RTL scripts like Hebrew and Arabic
2290 2275 * - above-centered: tooltip is centered above anchor node
2291 2276 * - below-centered: tooltip is centered above anchor node
2292 2277 *
2293 2278 * The list is positions is tried, in order, until a position is found where the tooltip fits
2294 2279 * within the viewport.
2295 2280 *
2296 2281 * Be careful setting this parameter. A value of "above-centered" may work fine until the user scrolls
2297 2282 * the screen so that there's no room above the target node. Nodes with drop downs, like
2298 2283 * DropDownButton or FilteringSelect, are especially problematic, in that you need to be sure
2299 2284 * that the drop down and tooltip don't overlap, even when the viewport is scrolled so that there
2300 2285 * is only room below (or above) the target node, but not both.
2301 2286 */
2302 2287 defaultPosition: [string];
2303 2288
2304 2289 /**
2305 2290 * Static method to display tooltip w/specified contents in specified position.
2306 2291 * See description of dijit/Tooltip.defaultPosition for details on position parameter.
2307 2292 * If position is not specified then dijit/Tooltip.defaultPosition is used.
2308 2293 */
2309 2294 show(innerHTML: string, aroundNode: PlaceRectangle, position?: [string], rtl?: boolean, textDir?: string, onMouseEnter?: Function, onMouseLeave?: Function): void;
2310 2295
2311 2296 /**
2312 2297 * Hide the tooltip
2313 2298 */
2314 2299 hide(aroundNode: PlaceRectangle): void;
2315 2300 }
2316 2301
2317 2302 /* dijit/TooltipDialog */
2318 2303
2319 2304 interface TooltipDialog extends layout.ContentPane, _TemplatedMixin, form._FormMixin, _DialogMixin {
2320 2305 /**
2321 2306 * Description of tooltip dialog (required for a11y)
2322 2307 */
2323 2308 title: string;
2324 2309
2325 2310 /**
2326 2311 * Don't change this parameter from the default value.
2327 2312 * This ContentPane parameter doesn't make sense for TooltipDialog, since TooltipDialog
2328 2313 * is never a child of a layout container, nor can you specify the size of
2329 2314 * TooltipDialog in order to control the size of an inner widget.
2330 2315 */
2331 2316 doLayout: boolean;
2332 2317
2333 2318 /**
2334 2319 * A Toggle to modify the default focus behavior of a Dialog, which
2335 2320 * is to focus on the first dialog element after opening the dialog.
2336 2321 * False will disable autofocusing. Default: true.
2337 2322 */
2338 2323 autofocus: boolean;
2339 2324
2340 2325 /**
2341 2326 * The pointer to the first focusable node in the dialog.
2342 2327 */
2343 2328 _firstFocusItem: any;
2344 2329
2345 2330 /**
2346 2331 * The pointer to which node has focus prior to our dialog.
2347 2332 */
2348 2333 _lastFocusItem: any;
2349 2334
2350 2335 /**
2351 2336 * Configure widget to be displayed in given position relative to the button.
2352 2337 *
2353 2338 * This is called from the dijit.popup code, and should not be called directly.
2354 2339 */
2355 2340 orient(node: Node | HTMLElement, aroundCorner: PlaceCorner, tooltipCorner: PlaceCorner): void;
2356 2341
2357 2342 /**
2358 2343 * Focus on first field
2359 2344 */
2360 2345 focus(): void;
2361 2346
2362 2347 /**
2363 2348 * Called when dialog is displayed.
2364 2349 *
2365 2350 * This is called from the dijit.popup code, and should not be called directly.
2366 2351 */
2367 2352 onOpen(pos: {
2368 2353 aroundCorner: PlaceCorner
2369 2354 aroundNodePos: PlacePosition
2370 2355 corner: PlaceCorner
2371 2356 x: number
2372 2357 y: number
2373 2358 }): void;
2374 2359
2375 2360 /**
2376 2361 * Handler for keydown events
2377 2362 *
2378 2363 * Keep keyboard focus in dialog; close dialog on escape key
2379 2364 */
2380 2365 _onKey(evt: KeyboardEvent): void;
2381 2366 }
2382 2367
2383 2368 interface TooltipDialogConstructor extends _WidgetBaseConstructor<TooltipDialog> { }
2384 2369 }
@@ -1,1868 +1,1870
1 1 declare namespace dijit {
2 2
3 3 namespace form {
4 4
5 5 /* implied */
6 6
7 7 interface Constraints {
8 8 [prop: string]: any;
9 9 }
10 10
11 11 interface ConstrainedValueFunction<V = any, C extends Constraints = Constraints, T = any> {
12 12 /**
13 13 * Returns a value that has been constrained by the constraints
14 14 * @param value The value to constrain
15 15 * @param constraints The constraints to use
16 16 * @returns The constrained value
17 17 */
18 18 (value: V, constraints: C): T;
19 19 }
20 20
21 21 interface ConstrainedValidFunction<C extends Constraints = Constraints> {
22 22 /**
23 23 * Returns true if the value is valid based on the constraints, otherwise
24 24 * returns false.
25 25 * @param value The value to check
26 26 * @param constraints The constraints to use
27 27 * @returns true if valid, otherwise false
28 28 */
29 29 (value: any, constraints: C): boolean;
30 30 }
31 31
32 32 interface ConstraintsToRegExpString<C extends Constraints = Constraints> {
33 33 /**
34 34 * Takes a set of constraints and returns a RegExpString that can be used
35 35 * to match values against
36 36 * @param constraints The constraints to use
37 37 * @returns The RegExpString that represents the constraints
38 38 */
39 39 (constraints: C): string;
40 40 }
41 41
42 42 interface SerializationFunction {
43 43 (val: any, options?: Object): string;
44 44 }
45 45
46 46 /* dijit/form/_AutoCompleterMixin */
47 47
48 48 /* tslint:disable:class-name */
49 49 interface _AutoCompleterMixin<T extends Object = any, Q extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions = dojo.store.api.QueryOptions> extends _SearchMixin<T, Q, O> {
50 50 /**
51 51 * This is the item returned by the dojo/store/api/Store implementation that
52 52 * provides the data for this ComboBox, it's the currently selected item.
53 53 */
54 54 item: T;
55 55
56 56 /**
57 57 * If user types in a partial string, and then tab out of the `<input>` box,
58 58 * automatically copy the first entry displayed in the drop down list to
59 59 * the `<input>` field
60 60 */
61 61 autoComplete: boolean;
62 62
63 63 /**
64 64 * One of: "first", "all" or "none".
65 65 */
66 66 highlightMatch: string;
67 67 /* TODO: Uncomment for TS 1.8 and remove above */
68 68 /* highlightMatch: 'fisrt' | 'all' | 'none'; */
69 69
70 70 /**
71 71 * The entries in the drop down list come from this attribute in the
72 72 * dojo.data items.
73 73 * If not specified, the searchAttr attribute is used instead.
74 74 */
75 75 labelAttr: string;
76 76
77 77 /**
78 78 * Specifies how to interpret the labelAttr in the data store items.
79 79 * Can be "html" or "text".
80 80 */
81 81 labelType: string;
82 82
83 83 /**
84 84 * Flags to _HasDropDown to limit height of drop down to make it fit in viewport
85 85 */
86 86 maxHeight: number;
87 87
88 88 /**
89 89 * For backwards compatibility let onClick events propagate, even clicks on the down arrow button
90 90 */
91 91 _stopClickEvents: boolean;
92 92
93 93 _getCaretPos(element: HTMLElement): number;
94 94 _setCaretPos(element: HTMLElement, location: number): void;
95 95
96 96 /**
97 97 * Overrides _HasDropDown.loadDropDown().
98 98 */
99 99 loadDropDown(loadCallback: () => void): void;
100 100
101 101 /**
102 102 * signal to _HasDropDown that it needs to call loadDropDown() to load the
103 103 * drop down asynchronously before displaying it
104 104 */
105 105 isLoaded(): boolean;
106 106
107 107 /**
108 108 * Overrides _HasDropDown.closeDropDown(). Closes the drop down (assuming that it's open).
109 109 * This method is the callback when the user types ESC or clicking
110 110 * the button icon while the drop down is open. It's also called by other code.
111 111 */
112 112 closeDropDown(focus?: boolean): void;
113 113
114 114 postMixInProperties(): void;
115 115 postCreate(): void;
116 116
117 117 /**
118 118 * Highlights the string entered by the user in the menu. By default this
119 119 * highlights the first occurrence found. Override this method
120 120 * to implement your custom highlighting.
121 121 */
122 122 doHighlight(label: string, find: string): string;
123 123 reset(): void;
124 124 labelFunc(item: T, store: dojo.store.api.Store<T, Q, O>): string;
125 125
126 126 // set(name: 'value', value: string): this;
127 127 // set(name: 'item', value: T): this;
128 128 // set(name: 'disabled', value: boolean): this;
129 129 // set(name: string, value: any): this;
130 130 // set(values: Object): this;
131 131 }
132 132
133 133 /* dijit/form/_ButtonMixin */
134 134
135 135 interface _ButtonMixin {
136 136 /**
137 137 * A mixin to add a thin standard API wrapper to a normal HTML button
138 138 */
139 139 label: string;
140 140
141 141 /**
142 142 * Type of button (submit, reset, button, checkbox, radio)
143 143 */
144 144 type: string;
145 145 postCreate(): void;
146 146
147 147 /**
148 148 * Callback for when button is clicked.
149 149 * If type="submit", return true to perform submit, or false to cancel it.
150 150 */
151 151 onClick(e: MouseEvent): boolean | void;
152 152 onSetLabel(e: Event): void;
153 153 }
154 154
155 155 /* dijit/form/_CheckBoxMixin */
156 156
157 157 interface _CheckBoxMixin {
158 158 /**
159 159 * type attribute on `<input>` node.
160 160 * Overrides `dijit/form/Button.type`. Users should not change this value.
161 161 */
162 162 type: string;
163 163
164 164 /**
165 165 * As an initialization parameter, equivalent to value field on normal checkbox
166 166 * (if checked, the value is passed as the value when form is submitted).
167 167 */
168 168 value: string;
169 169
170 170 /**
171 171 * Should this widget respond to user input?
172 172 * In markup, this is specified as "readOnly".
173 173 * Similar to disabled except readOnly form values are submitted.
174 174 */
175 175 readOnly: boolean;
176 176
177 177 reset: () => void;
178 178 }
179 179
180 180 /* dijit/form/_ComboBoxMenu */
181 181
182 182 interface _ComboBoxMenu<T = any> extends _WidgetBase, _TemplatedMixin, _ListMouseMixin, _ComboBoxMenuMixin<T> {
183 183 templateString: string;
184 184 baseClass: string;
185 185
186 186 /**
187 187 * Add hover CSS
188 188 */
189 189 onHover(node: HTMLElement): void;
190 190
191 191 /**
192 192 * Remove hover CSS
193 193 */
194 194 onUnhover(node: HTMLElement): void;
195 195
196 196 /**
197 197 * Add selected CSS
198 198 */
199 199 onSelect(node: HTMLElement): void;
200 200
201 201 /**
202 202 * Remove selected CSS
203 203 */
204 204 onDeselect(node: HTMLElement): void;
205 205
206 206 /**
207 207 * Handles page-up and page-down keypresses
208 208 */
209 209 _page(up?: boolean): void;
210 210
211 211 /**
212 212 * Handle keystroke event forwarded from ComboBox, returning false if it's
213 213 * a keystroke I recognize and process, true otherwise.
214 214 */
215 215 handleKey(evt: KeyboardEvent): boolean;
216 216
217 217 // set(name: string, value: any): this;
218 218 // set(values: Object): this;
219 219 }
220 220
221 221 interface _ComboBoxMenuConstructor extends _WidgetBaseConstructor<_ComboBoxMenu<any>> {
222 222 new <T = any>(params: Object, srcNodeRef: dojo.NodeOrString): _ComboBoxMenu<T>;
223 223 }
224 224
225 225 /* dijit/form/_ComboBoxMenuMixin */
226 226
227 227 interface _ComboBoxMenuMixin<T = any> {
228 228 /**
229 229 * Holds "next" and "previous" text for paging buttons on drop down
230 230 */
231 231 _messages: { next: string; previous: string; };
232 232
233 233 onClick(node: HTMLElement): void;
234 234
235 235 /**
236 236 * Notifies ComboBox/FilteringSelect that user selected an option.
237 237 */
238 238 onChange(direction: number): void;
239 239
240 240 /**
241 241 * Notifies ComboBox/FilteringSelect that user clicked to advance to next/previous page.
242 242 */
243 243 onPage(direction: number): void;
244 244
245 245 /**
246 246 * Callback from dijit.popup code to this widget, notifying it that it closed
247 247 */
248 248 onClose(): void;
249 249
250 250 /**
251 251 * Fills in the items in the drop down list
252 252 */
253 253 createOptions(results: T[], options: dojo.store.api.QueryOptions, labelFunc: (item: T) => { html: boolean; label: string; }): void;
254 254
255 255 /**
256 256 * Clears the entries in the drop down list, but of course keeps the previous and next buttons.
257 257 */
258 258 clearResultList(): void;
259 259
260 260 /**
261 261 * Highlight the first real item in the list (not Previous Choices).
262 262 */
263 263 highlightFirstOption(): void;
264 264
265 265 /**
266 266 * Highlight the last real item in the list (not More Choices).
267 267 */
268 268 highlightLastOption(): void;
269 269
270 270 selectFirstNode(): void;
271 271 selectLastNode(): void;
272 272 getHighlightedOption(): HTMLElement;
273 273
274 274 // set(name: 'value', value: Object): this;
275 275 // set(name: string, value: any): this;
276 276 // set(values: Object): this;
277 277 }
278 278
279 279 /* dijit/form/_DateTimeTextBox */
280 280
281 281 interface DateTimeConstraints extends Constraints, dojo.date.DateLocaleFormatOptions { }
282 282
283 283 interface _DateTimeTextBox<T extends _WidgetBase> extends RangeBoundTextBox, _HasDropDown<T> {
284 284 templateString: string;
285 285
286 286 /**
287 287 * Set this textbox to display a down arrow button, to open the drop down list.
288 288 */
289 289 hasDownArrow: boolean;
290 290 cssStateNodes: CSSStateNodes;
291 291
292 292 /**
293 293 * Despite the name, this parameter specifies both constraints on the input
294 294 * (including starting/ending dates/times allowed) as well as
295 295 * formatting options like whether the date is displayed in long (ex: December 25, 2005)
296 296 * or short (ex: 12/25/2005) format. See `dijit/form/_DateTimeTextBox.__Constraints` for details.
297 297 */
298 298 constraints: DateTimeConstraints;
299 299
300 300 /**
301 301 * The constraints without the min/max properties. Used by the compare() method
302 302 */
303 303 _unboundedConstraints: DateTimeConstraints;
304 304
305 305 pattern: (options?: dojo.date.DateLocaleFormatOptions | RangeBoundTextBoxConstraints) => string;
306 306
307 307 /**
308 308 * JavaScript namespace to find calendar routines. If unspecified, uses Gregorian calendar routines
309 309 * at dojo/date and dojo/date/locale.
310 310 */
311 311 datePackage: string;
312 312
313 313 postMixInProperties(): void;
314 314 compare(val1: Date, val2: Date): number;
315 315 autoWidth: boolean;
316 316
317 317 /**
318 318 * Formats the value as a Date, according to specified locale (second argument)
319 319 */
320 320 format: ConstrainedValueFunction<Date, DateTimeConstraints, string>;
321 321
322 322 /**
323 323 * Parses as string as a Date, according to constraints
324 324 */
325 325 parse: ConstrainedValueFunction<string, DateTimeConstraints, Date>;
326 326
327 327 serialize(val: any, options?: dojo.date.StampFormatOptions): string;
328 328
329 329 /**
330 330 * The default value to focus in the popupClass widget when the textbox value is empty.
331 331 */
332 332 dropDownDefaultValue: Date;
333 333
334 334 /**
335 335 * The value of this widget as a JavaScript Date object. Use get("value") / set("value", val) to manipulate.
336 336 * When passed to the parser in markup, must be specified according to `dojo/date/stamp.fromISOString()`
337 337 */
338 338 value: Date;
339 339
340 340 _blankValue: string;
341 341
342 342 /**
343 343 * Name of the popup widget class used to select a date/time.
344 344 * Subclasses should specify this.
345 345 */
346 346 popupClass: string | _WidgetBaseConstructor<T>;
347 347
348 348 /**
349 349 * Specifies constraints.selector passed to dojo.date functions, should be either
350 350 * "date" or "time".
351 351 * Subclass must specify this.
352 352 */
353 353 _selector: string;
354 354 /* TODO: uncomment for TS 1.8 */
355 355 /* _selector: 'data' | 'time'; */
356 356
357 357 buildRendering(): void;
358 358
359 359 /**
360 360 * Runs various tests on the value, checking for invalid conditions
361 361 */
362 362 _isInvalidDate(value: Date): boolean;
363 363
364 364 // get(name: 'displayedValue'): string;
365 365 // get(name: string): any;
366 366
367 367 // set(name: 'displayedValue', value: string): this;
368 368 // set(name: 'dropDownDefaultValue', value: Date): this;
369 369 // set(name: 'value', value: Date | string): this;
370 370 // set(name: 'constraints', value: DateTimeConstraints): this;
371 371 // set(name: string, value: any): this;
372 372 // set(values: Object): this;
373 373 }
374 374
375 375 interface _DateTimeTextBoxConstructor<T extends _WidgetBase> extends _WidgetBaseConstructor<_DateTimeTextBox<T>> { }
376 376
377 377 /* dijit/form/_ExpandingTextAreaMixin */
378 378
379 379 interface _ExpandingTextAreaMixin {
380 380 postCreate(): void;
381 381 startup(): void;
382 382 resize(): void;
383 383 }
384 384
385 385 /* dijit/form/_FormMixin */
386 386
387 387 interface OnValidStateChange {
388 388 (isValid?: boolean): void;
389 389 }
390 390
391 391 interface _FormMixin {
392 392
393 393 /**
394 394 * Will be "Error" if one or more of the child widgets has an invalid value,
395 395 * "Incomplete" if not all of the required child widgets are filled in. Otherwise, "",
396 396 * which indicates that the form is ready to be submitted.
397 397 */
398 398 state: '' | 'Error' | 'Incomplete';
399 399
400 400 /**
401 401 * Returns all form widget descendants, searching through non-form child widgets like BorderContainer
402 402 */
403 403 _getDescendantFormWidgets(children?: _WidgetBase[]): _FormWidget[];
404 404
405 405 reset(): void;
406 406
407 407 /**
408 408 * returns if the form is valid - same as isValid - but
409 409 * provides a few additional (ui-specific) features:
410 410 *
411 411 * 1. it will highlight any sub-widgets that are not valid
412 412 * 2. it will call focus() on the first invalid sub-widget
413 413 */
414 414 validate(): boolean;
415 415
416 416 setValues(val: any): _FormMixin;
417 417 getValues(): any;
418 418
419 419 /**
420 420 * Returns true if all of the widgets are valid.
421 421 * Deprecated, will be removed in 2.0. Use get("state") instead.
422 422 */
423 423 isValid(): boolean;
424 424
425 425 /**
426 426 * Stub function to connect to if you want to do something
427 427 * (like disable/enable a submit button) when the valid
428 428 * state changes on the form as a whole.
429 429 *
430 430 * Deprecated. Will be removed in 2.0. Use watch("state", ...) instead.
431 431 */
432 432 onValidStateChange: OnValidStateChange;
433 433
434 434 /**
435 435 * Compute what this.state should be based on state of children
436 436 */
437 437 _getState(): '' | 'Error' | 'Incomplete';
438 438
439 439 /**
440 440 * Deprecated method. Applications no longer need to call this. Remove for 2.0.
441 441 */
442 442 disconnectChildren(): void;
443 443
444 444 /**
445 445 * You can call this function directly, ex. in the event that you
446 446 * programmatically add a widget to the form *after* the form has been
447 447 * initialized.
448 448 */
449 449 connectChildren(inStartup?: boolean): void;
450 450
451 451 /**
452 452 * Called when child's value or disabled state changes
453 453 */
454 454 _onChildChange(attr?: string): void;
455 455
456 456 startup(): void;
457 457 destroy(preserveDom?: boolean): void;
458
459 _setValueAttr(value: any): void;
458 460 }
459 461
460 462 interface _FormMixinConstructor extends dojo._base.DeclareConstructor<_FormMixin> { }
461 463
462 464 /* dijit/form/_FormSelectWidget */
463 465
464 466 interface SelectOption {
465 467 value?: string;
466 468 label: string;
467 469 selected?: boolean;
468 470 disabled?: boolean;
469 471 }
470 472
471 473 interface _FormSelectWidget<T extends Object, Q extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions = dojo.store.api.QueryOptions> extends _FormValueWidget {
472 474 /**
473 475 * Whether or not we are multi-valued
474 476 */
475 477 multiple: boolean;
476 478
477 479 /**
478 480 * The set of options for our select item. Roughly corresponds to
479 481 * the html `<option>` tag.
480 482 */
481 483 options: SelectOption[];
482 484
483 485 /**
484 486 * A store to use for getting our list of options - rather than reading them
485 487 * from the `<option>` html tags. Should support getIdentity().
486 488 * For back-compat store can also be a dojo/data/api/Identity.
487 489 */
488 490 store: dojo.store.api.Store<T, Q, O>;
489 491
490 492 /**
491 493 * A query to use when fetching items from our store
492 494 */
493 495 query: Q;
494 496
495 497 /**
496 498 * Query options to use when fetching from the store
497 499 */
498 500 queryOptions: O;
499 501
500 502 /**
501 503 * The entries in the drop down list come from this attribute in the dojo.store items.
502 504 * If ``store`` is set, labelAttr must be set too, unless store is an old-style
503 505 * dojo.data store rather than a new dojo/store.
504 506 */
505 507 labelAttr: string;
506 508
507 509 /**
508 510 * A callback to do with an onFetch - but before any items are actually
509 511 * iterated over (i.e. to filter even further what you want to add)
510 512 */
511 513 onFetch: (items: T[]) => void;
512 514
513 515 /**
514 516 * Flag to sort the options returned from a store by the label of
515 517 * the store.
516 518 */
517 519 sortByLabel: boolean;
518 520
519 521 /**
520 522 * By default loadChildren is called when the items are fetched from the
521 523 * store. This property allows delaying loadChildren (and the creation
522 524 * of the options/menuitems) until the user clicks the button to open the
523 525 * dropdown.
524 526 */
525 527 loadChildrenOnOpen: boolean;
526 528
527 529 /**
528 530 * This is the `dojo.Deferred` returned by setStore().
529 531 * Calling onLoadDeferred.then() registers your
530 532 * callback to be called only once, when the prior setStore completes.
531 533 */
532 534 onLoadDeferred: dojo.Deferred<void>;
533 535
534 536 /**
535 537 * Returns a given option (or options).
536 538 */
537 539 getOptions(valueOrIdx: string): SelectOption;
538 540 getOptions(valueOrIdx: number): SelectOption;
539 541 getOptions(valueOrIdx: SelectOption): SelectOption;
540 542 getOptions(valueOrIdx: (string | number | SelectOption)[]): SelectOption[];
541 543 getOptions(): SelectOption[];
542 544
543 545 /**
544 546 * Adds an option or options to the end of the select. If value
545 547 * of the option is empty or missing, a separator is created instead.
546 548 * Passing in an array of options will yield slightly better performance
547 549 * since the children are only loaded once.
548 550 */
549 551 addOption(option: SelectOption | SelectOption[]): void;
550 552
551 553 /**
552 554 * Removes the given option or options. You can remove by string
553 555 * (in which case the value is removed), number (in which case the
554 556 * index in the options array is removed), or select option (in
555 557 * which case, the select option with a matching value is removed).
556 558 * You can also pass in an array of those values for a slightly
557 559 * better performance since the children are only loaded once.
558 560 * For numeric option values, specify {value: number} as the argument.
559 561 */
560 562 removeOption(option: string | number | SelectOption | (string | number | SelectOption)[]): void;
561 563
562 564 /**
563 565 * Updates the values of the given option. The option to update
564 566 * is matched based on the value of the entered option. Passing
565 567 * in an array of new options will yield better performance since
566 568 * the children will only be loaded once.
567 569 */
568 570 updateOption(newOption: SelectOption | SelectOption[]): void;
569 571
570 572 /**
571 573 * Deprecated!
572 574 */
573 575 setStore(store: dojo.store.api.Store<T, Q, O>, selectedValue?: T, fetchArgs?: {
574 576 query: Q;
575 577 queryOptions: O;
576 578 onFetch: (items: T[], fetchArgs?: any) => void;
577 579 }): dojo.store.api.Store<T, Q, O>;
578 580
579 581 /**
580 582 * Sets the store you would like to use with this select widget.
581 583 * The selected value is the value of the new store to set. This
582 584 * function returns the original store, in case you want to reuse
583 585 * it or something.
584 586 */
585 587 _deprecatedSetStore(store: dojo.store.api.Store<T, Q, O>, selectedValue?: T, fetchArgs?: {
586 588 query: Q;
587 589 queryOptions: O;
588 590 onFetch: (items: T[], fetchArgs?: any) => void;
589 591 }): dojo.store.api.Store<T, Q, O>;
590 592
591 593 /**
592 594 * Loads the children represented by this widget's options.
593 595 * reset the menu to make it populatable on the next click
594 596 */
595 597 _loadChildren(): void;
596 598
597 599 /**
598 600 * Sets the "selected" class on the item for styling purposes
599 601 */
600 602 _updateSelection(): void;
601 603
602 604 /**
603 605 * Returns the value of the widget by reading the options for
604 606 * the selected flag
605 607 */
606 608 _getValueFromOpts(): string;
607 609
608 610 buildRendering(): void;
609 611
610 612 /**
611 613 * Loads our options and sets up our dropdown correctly. We
612 614 * don't want any content, so we don't call any inherit chain
613 615 * function.
614 616 */
615 617 _fillContent(): void;
616 618
617 619 /**
618 620 * sets up our event handling that we need for functioning
619 621 * as a select
620 622 */
621 623 postCreate(): void;
622 624
623 625 startup(): void;
624 626
625 627 /**
626 628 * Clean up our connections
627 629 */
628 630 destroy(preserveDom?: boolean): void;
629 631
630 632 /**
631 633 * User-overridable function which, for the given option, adds an
632 634 * item to the select. If the option doesn't have a value, then a
633 635 * separator is added in that place. Make sure to store the option
634 636 * in the created option widget.
635 637 */
636 638 _addOptionItem(option: SelectOption): void;
637 639
638 640 /**
639 641 * User-overridable function which, for the given option, removes
640 642 * its item from the select.
641 643 */
642 644 _removeOptionItem(option: SelectOption): void;
643 645
644 646 /**
645 647 * Overridable function which will set the display for the
646 648 * widget. newDisplay is either a string (in the case of
647 649 * single selects) or array of strings (in the case of multi-selects)
648 650 */
649 651 _setDisplay(newDisplay: string | string[]): void;
650 652
651 653 /**
652 654 * Overridable function to return the children that this widget contains.
653 655 */
654 656 _getChildren(): any[];
655 657
656 658 /**
657 659 * hooks into this.attr to provide a mechanism for getting the
658 660 * option items for the current value of the widget.
659 661 */
660 662 _getSelectedOptionsAttr(): SelectOption[];
661 663
662 664 /**
663 665 * a function that will "fake" loading children, if needed, and
664 666 * if we have set to not load children until the widget opens.
665 667 */
666 668 _pseudoLoadChildren(items: T[]): void;
667 669
668 670 /**
669 671 * a function that can be connected to in order to receive a
670 672 * notification that the store has finished loading and all options
671 673 * from that store are available
672 674 */
673 675 onSetStore(): void;
674 676 }
675 677
676 678 /* dijit/form/_FormValueMixin */
677 679
678 680 interface _FormValueMixin extends _FormWidgetMixin {
679 681
680 682 /**
681 683 * Should this widget respond to user input?
682 684 * In markup, this is specified as "readOnly".
683 685 * Similar to disabled except readOnly form values are submitted.
684 686 */
685 687 readOnly: boolean;
686 688
687 689 postCreate(): void;
688 690
689 691 /**
690 692 * Restore the value to the last value passed to onChange
691 693 */
692 694 undo(): void;
693 695
694 696 /**
695 697 * Reset the widget's value to what it was at initialization time
696 698 */
697 699 reset(): void;
698 700
699 701 _hasBeenBlurred?: boolean;
700 702 }
701 703
702 704 /* dijit/form/_FormValueWidget */
703 705
704 706 interface _FormValueWidget extends _FormWidget, _FormValueMixin {
705 707 /**
706 708 * Work around table sizing bugs on IE7 by forcing redraw
707 709 */
708 710 _layoutHackIE7(): void;
709 711
710 712 // set(name: string, value: any): this;
711 713 // set(values: Object): this;
712 714 }
713 715
714 716 interface _FormValueWidgetConstructor extends _WidgetBaseConstructor<_FormValueWidget> { }
715 717
716 718 /* dijit/form/_FormWidget */
717 719
718 720 interface _FormWidget extends _Widget, _TemplatedMixin, _CssStateMixin, _FormWidgetMixin {
719 721 setDisabled(disabled: boolean): void;
720 722 setValue(value: string): void;
721 723 postMixInProperties(): void;
722 724
723 725 // set(name: 'value', value: string): this;
724 726 // set(name: string, value: any): this;
725 727 // set(values: Object): this;
726 728 }
727 729
728 730 interface _FormWidgetConstructor extends _WidgetBaseConstructor<_FormWidget> { }
729 731
730 732 /* dijit/form/_FormWidgetMixin */
731 733
732 734 /**
733 735 * Mixin for widgets corresponding to native HTML elements such as `<checkbox>` or `<button>`,
734 736 * which can be children of a `<form>` node or a `dijit/form/Form` widget.
735 737 *
736 738 * Represents a single HTML element.
737 739 * All these widgets should have these attributes just like native HTML input elements.
738 740 * You can set them during widget construction or afterwards, via `dijit/_WidgetBase.set()`.
739 741 *
740 742 * They also share some common methods.
741 743 */
742 744 interface _FormWidgetMixin {
743 745 /**
744 746 * Name used when submitting form; same as "name" attribute or plain HTML elements
745 747 */
746 748 name: string;
747 749
748 750
749 751 /** Corresponds to the native HTML `<input>` element's attribute. */
750 752 alt: string;
751 753
752 754 /** Corresponds to the native HTML `<input>` element's attribute. */
753 755 value: any;
754 756
755 757 /** Corresponds to the native HTML `<input>` element's attribute. */
756 758 type: string;
757 759
758 760 /** Apply aria-label in markup to the widget's focusNode */
759 761 "aria-label": "focusNode";
760 762
761 763 /** Order fields are traversed when user hits the tab key */
762 764 tabIndex: number;
763 765
764 766 /** Should this widget respond to user input?
765 767 * In markup, this is specified as "disabled='disabled'", or just "disabled".
766 768 */
767 769 disabled: boolean;
768 770
769 771 /** Fires onChange for each value change or only on demand */
770 772 intermediateChanges: boolean;
771 773
772 774 /** On focus, should this widget scroll into view? */
773 775 scrollOnFocus: boolean;
774 776
775 777 _setDisabledAttr(value: boolean): void;
776 778
777 779 _onFocus(by: string): void;
778 780
779 781 /** Tells if this widget is focusable or not. Used internally by dijit.
780 782 * @protected
781 783 */
782 784 isFocusable(): boolean;
783 785
784 786 /** Put focus on this widget */
785 787 focus(): void;
786 788
787 789 /** Compare 2 values (as returned by get('value') for this widget).
788 790 * @protected
789 791 */
790 792 compare(val1: any, val2: any): number;
791 793
792 794 onChange(newValue: any): void;
793 795
794 796 /**
795 797 * Hook so set('value', value) works.
796 798 *
797 799 * Sets the value of the widget.
798 800 * If the value has changed, then fire onChange event, unless priorityChange
799 801 * is specified as null (or false?)
800 802 *
801 803 * @param value
802 804 * @param priorityChange
803 805 */
804 806 _setValueAttr(value: any, priorityChange?: boolean);
805 807
806 808 /**
807 809 * Called when the value of the widget has changed. Saves the new value in this.value,
808 810 * and calls onChange() if appropriate. See _FormWidget._handleOnChange() for details.
809 811 *
810 812 * @param newValue
811 813 * @param priorityChange
812 814 */
813 815 _handleOnChange(newValue: any, priorityChange?: boolean);
814 816 }
815 817
816 818 /* dijit/form/_ListBase */
817 819
818 820 interface _ListBase {
819 821 /**
820 822 * currently selected node
821 823 */
822 824 selected: HTMLElement;
823 825
824 826 /**
825 827 * Select the first displayed item in the list.
826 828 */
827 829 selectFirstNode(): void;
828 830
829 831 /**
830 832 * Select the last displayed item in the list
831 833 */
832 834 selectLastNode(): void;
833 835
834 836 /**
835 837 * Select the item just below the current selection.
836 838 * If nothing selected, select first node.
837 839 */
838 840 selectNextNode(): void;
839 841
840 842 /**
841 843 * Select the item just above the current selection.
842 844 * If nothing selected, select last node (if
843 845 * you select Previous and try to keep scrolling up the list).
844 846 */
845 847 selectPreviousNode(): void;
846 848
847 849 // set(name: 'selected', value: HTMLElement): this;
848 850 // set(name: string, value: any): this;
849 851 // set(values: Object): this;
850 852 }
851 853
852 854 /* dijit/form/_ListMouseMixin */
853 855
854 856 interface _ListMouseMixin extends _ListBase {
855 857 postCreate(): void;
856 858 }
857 859
858 860 /* dijit/form/_RadioButtonMixin */
859 861
860 862 interface _RadioButtonMixin {
861 863 /**
862 864 * type attribute on `<input>` node.
863 865 * Users should not change this value.
864 866 */
865 867 type: string;
866 868 }
867 869
868 870 /* dijit/form/_SearchMixin */
869 871
870 872 interface _SearchMixin<T extends Object, Q extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions = dojo.store.api.QueryOptions> {
871 873 /**
872 874 * Argument to data provider.
873 875 * Specifies maximum number of search results to return per query
874 876 */
875 877 pageSize: number;
876 878
877 879 /**
878 880 * Reference to data provider object used by this ComboBox.
879 881 * The store must accept an object hash of properties for its query. See `query` and `queryExpr` for details.
880 882 */
881 883 store: dojo.store.api.Store<T, Q, O>;
882 884
883 885 /**
884 886 * Mixin to the store's fetch.
885 887 * For example, to set the sort order of the ComboBox menu, pass:
886 888 * { sort: [{attribute:"name",descending: true}] }
887 889 * To override the default queryOptions so that deep=false, do:
888 890 * { queryOptions: {ignoreCase: true, deep: false} }
889 891 */
890 892 fetchProperties: { [property: string]: any };
891 893
892 894 /**
893 895 * A query that can be passed to `store` to initially filter the items.
894 896 * ComboBox overwrites any reference to the `searchAttr` and sets it to the `queryExpr` with the user's input substituted.
895 897 */
896 898 query: Q;
897 899
898 900 /**
899 901 * Alternate to specifying a store. Id of a dijit/form/DataList widget.
900 902 */
901 903 list: string;
902 904
903 905 /**
904 906 * Delay in milliseconds between when user types something and we start
905 907 * searching based on that value
906 908 */
907 909 searchDelay: number;
908 910
909 911 /**
910 912 * Search for items in the data store where this attribute (in the item)
911 913 * matches what the user typed
912 914 */
913 915 searchAttr: string;
914 916
915 917 /**
916 918 * This specifies what query is sent to the data store,
917 919 * based on what the user has typed. Changing this expression will modify
918 920 * whether the results are only exact matches, a "starting with" match,
919 921 * etc.
920 922 * `${0}` will be substituted for the user text.
921 923 * `*` is used for wildcards.
922 924 * `${0}*` means "starts with", `*${0}*` means "contains", `${0}` means "is"
923 925 */
924 926 queryExpr: string;
925 927
926 928 /**
927 929 * Set true if the query should ignore case when matching possible items
928 930 */
929 931 ignoreCase: boolean;
930 932
931 933 /**
932 934 * Helper function to convert a simple pattern to a regular expression for matching.
933 935 */
934 936 _patternToRegExp(pattern: string): RegExp;
935 937
936 938 _abortQuery(): void;
937 939
938 940 /**
939 941 * Handles input (keyboard/paste) events
940 942 */
941 943 _processInput(e: KeyboardEvent): void;
942 944
943 945 /**
944 946 * Callback when a search completes.
945 947 */
946 948 onSearch(results: T[], query: Q, options: O): void;
947 949
948 950 _startSearchFromInput(): void;
949 951
950 952 /**
951 953 * Starts a search for elements matching text (text=="" means to return all items
952 954 * and calls onSearch(...) when the search completes, to display the results.
953 955 */
954 956 _startSearch(text: string): void;
955 957
956 958 postMixInProperties(): void;
957 959
958 960 // set(name: 'list', value: string): this;
959 961 // set(name: string, value: any): this;
960 962 // set(values: Object): this;
961 963 }
962 964
963 965 /* dijit/form/_Spinner */
964 966
965 967 interface AdjustFunction {
966 968 (val: any, delta: number): any;
967 969 }
968 970
969 971 interface _Spinner extends RangeBoundTextBox {
970 972 /**
971 973 * Number of milliseconds before a held arrow key or up/down button becomes typematic
972 974 */
973 975 defaultTimeout: number;
974 976
975 977 /**
976 978 * minimum number of milliseconds that typematic event fires when held key or button is held
977 979 */
978 980 minimumTimeout: number;
979 981
980 982 /**
981 983 * Fraction of time used to change the typematic timer between events.
982 984 * 1.0 means that each typematic event fires at defaultTimeout intervals.
983 985 * Less than 1.0 means that each typematic event fires at an increasing faster rate.
984 986 */
985 987 timeoutChangeRate: number;
986 988
987 989 /**
988 990 * Adjust the value by this much when spinning using the arrow keys/buttons
989 991 */
990 992 smallDelta: number;
991 993
992 994 /**
993 995 * Adjust the value by this much when spinning using the PgUp/Dn keys
994 996 */
995 997 largeDelta: number;
996 998
997 999 templateString: string;
998 1000 baseClass: string;
999 1001 cssStateNodes: CSSStateNodes;
1000 1002
1001 1003 /**
1002 1004 * Overridable function used to adjust a primitive value(Number/Date/...) by the delta amount specified.
1003 1005 * The val is adjusted in a way that makes sense to the object type.
1004 1006 */
1005 1007 adjust: AdjustFunction;
1006 1008
1007 1009 postCreate(): void;
1008 1010 }
1009 1011
1010 1012 interface _SpinnerConstrctor extends _WidgetBaseConstructor<_Spinner> { }
1011 1013
1012 1014 /* dijit/form/_TextBoxMixin */
1013 1015
1014 1016 interface _TextBoxMixin<C extends Constraints = Constraints> {
1015 1017 /**
1016 1018 * Removes leading and trailing whitespace if true. Default is false.
1017 1019 */
1018 1020 trim: boolean;
1019 1021
1020 1022 /**
1021 1023 * Converts all characters to uppercase if true. Default is false.
1022 1024 */
1023 1025 uppercase: boolean;
1024 1026
1025 1027 /**
1026 1028 * Converts all characters to lowercase if true. Default is false.
1027 1029 */
1028 1030 lowercase: boolean;
1029 1031
1030 1032 /**
1031 1033 * Converts the first character of each word to uppercase if true.
1032 1034 */
1033 1035 propercase: boolean;
1034 1036
1035 1037 /**
1036 1038 * HTML INPUT tag maxLength declaration.
1037 1039 */
1038 1040 maxLength: string;
1039 1041
1040 1042 /**
1041 1043 * If true, all text will be selected when focused with mouse
1042 1044 */
1043 1045 selectOnClick: boolean;
1044 1046
1045 1047 /**
1046 1048 * Defines a hint to help users fill out the input field (as defined in HTML 5).
1047 1049 * This should only contain plain text (no html markup).
1048 1050 */
1049 1051 placeHolder: string;
1050 1052
1051 1053 /**
1052 1054 * For subclasses like ComboBox where the displayed value
1053 1055 * (ex: Kentucky) and the serialized value (ex: KY) are different,
1054 1056 * this represents the displayed value.
1055 1057 *
1056 1058 * Setting 'displayedValue' through set('displayedValue', ...)
1057 1059 * updates 'value', and vice-versa. Otherwise 'value' is updated
1058 1060 * from 'displayedValue' periodically, like onBlur etc.
1059 1061 */
1060 1062 displayedValue: string;
1061 1063
1062 1064 /**
1063 1065 * Replaceable function to convert a value to a properly formatted string.
1064 1066 */
1065 1067 format: ConstrainedValueFunction<any, C, any>;
1066 1068
1067 1069 /**
1068 1070 * Replaceable function to convert a formatted string to a value
1069 1071 */
1070 1072 parse: ConstrainedValueFunction<any, C, any>;
1071 1073
1072 1074 /**
1073 1075 * Connect to this function to receive notifications of various user data-input events.
1074 1076 * Return false to cancel the event and prevent it from being processed.
1075 1077 * Note that although for historical reasons this method is called `onInput()`, it doesn't
1076 1078 * correspond to the standard DOM "input" event, because it occurs before the input has been processed.
1077 1079 */
1078 1080 onInput(e: InputEvent): void;
1079 1081
1080 1082 postCreate(): void;
1081 1083
1082 1084 /**
1083 1085 * if the textbox is blank, what value should be reported
1084 1086 */
1085 1087 _blankValue: string;
1086 1088
1087 1089 /**
1088 1090 * Auto-corrections (such as trimming) that are applied to textbox
1089 1091 * value on blur or form submit.
1090 1092 */
1091 1093 filter<T>(val: T): T;
1092 1094 filter<T extends number>(value: T): T;
1093 1095
1094 1096 _setBlurValue(): void;
1095 1097
1096 1098 reset(): void;
1097 1099 }
1098 1100
1099 1101 /* dijit/form/_ToggleButtonMixin */
1100 1102
1101 1103 interface _ToggleButtonMixin {
1102 1104 /**
1103 1105 * Corresponds to the native HTML `<input>` element's attribute.
1104 1106 * In markup, specified as "checked='checked'" or just "checked".
1105 1107 * True if the button is depressed, or the checkbox is checked,
1106 1108 * or the radio button is selected, etc.
1107 1109 */
1108 1110 checked: boolean;
1109 1111
1110 1112 postCreate(): void;
1111 1113
1112 1114 /**
1113 1115 * Reset the widget's value to what it was at initialization time
1114 1116 */
1115 1117 reset(): void;
1116 1118
1117 1119 _hasBeenBlurred?: boolean;
1118 1120 }
1119 1121
1120 1122 /* dijit/form/Button */
1121 1123
1122 1124 interface Button extends _FormWidget, _ButtonMixin {
1123 1125 /**
1124 1126 * Set this to true to hide the label text and display only the icon.
1125 1127 * (If showLabel=false then iconClass must be specified.)
1126 1128 * Especially useful for toolbars.
1127 1129 * If showLabel=true, the label will become the title (a.k.a. tooltip/hint)
1128 1130 */
1129 1131 showLabel: boolean;
1130 1132
1131 1133 /**
1132 1134 * Class to apply to DOMNode in button to make it display an icon
1133 1135 */
1134 1136 iconClass: string;
1135 1137
1136 1138 baseClass: string;
1137 1139 templateString: string;
1138 1140 postCreate(): void;
1139 1141 setLabel(content: string): void;
1140 1142 onLabelSet(e: Event): void;
1141 1143
1142 1144 onClick(e: MouseEvent): boolean | void;
1143 1145
1144 1146 // set(name: 'showLabel', value: boolean): this;
1145 1147 // set(name: 'value', value: string): this;
1146 1148 // set(name: 'name', value: string): this;
1147 1149 // set(name: 'label', value: string): this;
1148 1150 // set(name: string, value: any): this;
1149 1151 // set(values: Object): this;
1150 1152 }
1151 1153
1152 1154 interface ButtonConstructor extends _WidgetBaseConstructor<Button> { }
1153 1155
1154 1156 /* dijit/form/CheckBox */
1155 1157
1156 1158 interface CheckBox extends ToggleButton, _CheckBoxMixin {
1157 1159 templateString: string;
1158 1160 baseClass: string;
1159 1161 postMixInProperties(): void;
1160 1162 value: string;
1161 1163
1162 1164 // set(name: 'value', value: string | boolean): this;
1163 1165 // set(name: string, value: any): this;
1164 1166 // set(values: Object): this;
1165 1167 }
1166 1168
1167 1169 interface CheckBoxConstructor extends _WidgetBaseConstructor<CheckBox> { }
1168 1170
1169 1171 /* dijit/form/ComboBox */
1170 1172
1171 1173 interface ComboBox<T extends Object = any, Q extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions = dojo.store.api.QueryOptions, C extends Constraints = Constraints> extends ValidationTextBox<C>, ComboBoxMixin<T, Q, O> {
1172 1174 // set(name: string, value: any): this;
1173 1175 // set(values: Object): this;
1174 1176 }
1175 1177
1176 1178 interface ComboBoxConstructor extends _WidgetBaseConstructor<ComboBox<any>> {
1177 1179 new <T extends Object = any, Q extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions = dojo.store.api.QueryOptions, C extends Constraints = Constraints>(params: Object, srcNodeRef: dojo.NodeOrString): ComboBox<T, Q, O, C>;
1178 1180 }
1179 1181
1180 1182 /* dijit/form/ComboBoxMixin */
1181 1183
1182 1184 interface ComboBoxMixin<T extends Object = any, Q extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions = dojo.store.api.QueryOptions> extends _HasDropDown<_ComboBoxMenu<T>>, _AutoCompleterMixin<T, Q, O> {
1183 1185
1184 1186 /**
1185 1187 * Dropdown widget class used to select a date/time.
1186 1188 * Subclasses should specify this.
1187 1189 */
1188 1190 dropDownClass: _ComboBoxMenu<T>;
1189 1191
1190 1192 /**
1191 1193 * Set this textbox to have a down arrow button, to display the drop down list.
1192 1194 * Defaults to true.
1193 1195 */
1194 1196 hasDownArrow: boolean;
1195 1197
1196 1198 templateString: string;
1197 1199 baseClass: string;
1198 1200
1199 1201 /**
1200 1202 * Reference to data provider object used by this ComboBox.
1201 1203 *
1202 1204 * Should be dojo/store/api/Store, but dojo/data/api/Read supported
1203 1205 * for backwards compatibility.
1204 1206 */
1205 1207 store: dojo.store.api.Store<T, Q, O>;
1206 1208
1207 1209 cssStateNodes: CSSStateNodes;
1208 1210 postMixInProperties(): void;
1209 1211 buildRendering(): void;
1210 1212 }
1211 1213
1212 1214 interface ComboBoxMixinConstructor<T = any, U extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, V = any> extends _WidgetBaseConstructor<ComboBoxMixin<T, U, V>> { }
1213 1215
1214 1216 /* dijit/form/CurrencyTextBox */
1215 1217
1216 1218 interface CurrencyTextBoxConstraints extends NumberTextBoxConstraints, dojo.CurrencyFormatOptions, dojo.CurrencyParseOptions {
1217 1219 }
1218 1220
1219 1221 interface CurrencyTextBox extends NumberTextBox {
1220 1222 /**
1221 1223 * the [ISO4217](http://en.wikipedia.org/wiki/ISO_4217) currency code, a three letter sequence like "USD"
1222 1224 */
1223 1225 currency: string;
1224 1226
1225 1227 /**
1226 1228 * Despite the name, this parameter specifies both constraints on the input
1227 1229 * (including minimum/maximum allowed values) as well as
1228 1230 * formatting options. See `dijit/form/CurrencyTextBox.__Constraints` for details.
1229 1231 */
1230 1232 constraints: CurrencyTextBoxConstraints;
1231 1233
1232 1234 baseClass: string;
1233 1235
1234 1236 _formatter: (value: number, options?: dojo.CurrencyFormatOptions) => string;
1235 1237 _parser: (expression: string, options?: dojo.CurrencyParseOptions) => number;
1236 1238 _regExpGenerator: (options?: dojo.NumberRegexpOptions) => string;
1237 1239
1238 1240 /**
1239 1241 * Parses string value as a Currency, according to the constraints object
1240 1242 */
1241 1243 parse(value: string, constraints: CurrencyTextBoxConstraints): string;
1242 1244 }
1243 1245
1244 1246 interface CurrencyTextBoxConstructor extends _WidgetBaseConstructor<CurrencyTextBox> { }
1245 1247
1246 1248 /* dijit/form/DataList */
1247 1249
1248 1250 interface DataList<T extends Object> extends dojo.store.Memory<T> {
1249 1251 /**
1250 1252 * Get the option marked as selected, like `<option selected>`.
1251 1253 * Not part of dojo.data API.
1252 1254 */
1253 1255 fetchSelectedItem(): T;
1254 1256 }
1255 1257
1256 1258 interface DataListConstructor {
1257 1259 new <T extends Object>(params: Object, srcNodeRef: dojo.NodeOrString): DataList<T>;
1258 1260 }
1259 1261
1260 1262 /* dijit/form/DateTextBox */
1261 1263
1262 1264 interface DateTextBox extends _DateTimeTextBox<Calendar> {
1263 1265 baseClass: string;
1264 1266 popupClass: CalendarConstructor;
1265 1267 _selector: string;
1266 1268 maxHeight: number;
1267 1269
1268 1270 /**
1269 1271 * The value of this widget as a JavaScript Date object, with only year/month/day specified.`
1270 1272 */
1271 1273 value: Date;
1272 1274 }
1273 1275
1274 1276 interface DateTextBoxConstructor extends _WidgetBaseConstructor<DateTextBox> { }
1275 1277
1276 1278 /* dijit/form/DropDownButton */
1277 1279
1278 1280 interface DropDownButton<T extends _WidgetBase> extends Button, _Container, _HasDropDown<T> {
1279 1281 baseClass: string;
1280 1282 templateString: string;
1281 1283
1282 1284 /**
1283 1285 * Overrides _TemplatedMixin#_fillContent().
1284 1286 * My inner HTML possibly contains both the button label and/or a drop down widget, like
1285 1287 * <DropDownButton> <span>push me</span> <Menu> ... </Menu> </DropDownButton>
1286 1288 */
1287 1289 _fillContent(): void;
1288 1290 startup(): void;
1289 1291
1290 1292 /**
1291 1293 * Returns whether or not we are loaded - if our dropdown has an href,
1292 1294 * then we want to check that.
1293 1295 */
1294 1296 isLoaded(): boolean;
1295 1297
1296 1298 /**
1297 1299 * Default implementation assumes that drop down already exists,
1298 1300 * but hasn't loaded it's data (ex: ContentPane w/href).
1299 1301 * App must override if the drop down is lazy-created.
1300 1302 */
1301 1303 loadDropDown(callback: () => void): void;
1302 1304
1303 1305 /**
1304 1306 * Overridden so that focus is handled by the _HasDropDown mixin, not by
1305 1307 * the _FormWidget mixin.
1306 1308 */
1307 1309 isFocusable(): boolean;
1308 1310 }
1309 1311
1310 1312 interface DropDownButtonConstructor extends _WidgetBaseConstructor<DropDownButton<any>> {
1311 1313 new <T extends _WidgetBase>(params: Object, srcNodeRef: dojo.NodeOrString): DropDownButton<T>;
1312 1314 }
1313 1315
1314 1316 /* dijit/form/FilteringSelect */
1315 1317
1316 1318 interface FilteringSelect<C extends Constraints, T extends Object, Q extends string | Object | Function, O extends dojo.store.api.QueryOptions> extends MappedTextBox<C>, ComboBoxMixin<T, Q, O> {
1317 1319 /**
1318 1320 * True (default) if user is required to enter a value into this field.
1319 1321 */
1320 1322 required: boolean;
1321 1323
1322 1324 _lastDisplayedValue: string;
1323 1325 _isValidSubset(): boolean;
1324 1326 isValid(): boolean;
1325 1327 _refreshState(): void;
1326 1328
1327 1329 /**
1328 1330 * Callback from dojo.store after lookup of user entered value finishes
1329 1331 */
1330 1332 _callbackSetLabel(result: T[], query: Q, options: O, priorityChange?: boolean): void;
1331 1333
1332 1334 _openResultList(results: T[], query: Q, options: O): void;
1333 1335 undo(): void;
1334 1336
1335 1337 // set(name: 'displayedValue', value: string): this;
1336 1338 // set(name: 'item', value: T): this;
1337 1339 // set(name: string, value: any): this;
1338 1340 // set(values: Object): this;
1339 1341 }
1340 1342
1341 1343 interface FilteringSelectConstructor extends _WidgetBaseConstructor<FilteringSelect<any, any, any, any>> {
1342 1344 new <C extends Constraints, T extends Object, Q extends string | Object | Function, O extends dojo.store.api.QueryOptions>(params: Object, srcNodeRef: dojo.NodeOrString): FilteringSelect<C, T, Q, O>;
1343 1345 }
1344 1346
1345 1347 /* dijit/form/Form */
1346 1348
1347 1349 interface Form extends _Widget, _TemplatedMixin, _FormMixin, layout._ContentPaneResizeMixin {
1348 1350 name?: string;
1349 1351 action?: string;
1350 1352 method?: string;
1351 1353 encType?: string;
1352 1354 'accept-charset'?: string;
1353 1355 accept?: string;
1354 1356 target?: string;
1355 1357 templateString: string;
1356 1358
1357 1359 /**
1358 1360 * Deprecated: use submit()
1359 1361 */
1360 1362 execute(formContents: Object): void;
1361 1363
1362 1364 /**
1363 1365 * Deprecated: use onSubmit()
1364 1366 */
1365 1367 onExecute(): void;
1366 1368
1367 1369 /**
1368 1370 * restores all widget values back to their init values,
1369 1371 * calls onReset() which can cancel the reset by returning false
1370 1372 */
1371 1373 reset(e?: Event): void;
1372 1374
1373 1375 /**
1374 1376 * Callback when user resets the form. This method is intended
1375 1377 * to be over-ridden. When the `reset` method is called
1376 1378 * programmatically, the return value from `onReset` is used
1377 1379 * to compute whether or not resetting should proceed
1378 1380 */
1379 1381 onReset(e?: Event): boolean;
1380 1382
1381 1383 /**
1382 1384 * Callback when user submits the form.
1383 1385 */
1384 1386 onSubmit(e?: Event): boolean;
1385 1387
1386 1388 /**
1387 1389 * programmatically submit form if and only if the `onSubmit` returns true
1388 1390 */
1389 1391 submit(): void;
1390 1392 }
1391 1393
1392 1394 interface FormConstructor extends _WidgetBaseConstructor<Form> { }
1393 1395
1394 1396 /* dijit/form/HorizontalRule */
1395 1397
1396 1398 /**
1397 1399 * Hash marks for `dijit/form/HorizontalSlider`
1398 1400 */
1399 1401 interface HorizontalRule extends _Widget, _TemplatedMixin {
1400 1402 /**
1401 1403 * Number of hash marks to generate
1402 1404 */
1403 1405 count: number;
1404 1406
1405 1407 /**
1406 1408 * For HorizontalSlider, this is either "topDecoration" or "bottomDecoration", and indicates whether this rule goes above or below the slider.
1407 1409 */
1408 1410 container: string;
1409 1411
1410 1412 /**
1411 1413 * CSS style to apply to individual hash marks
1412 1414 */
1413 1415 ruleStyle: string;
1414 1416
1415 1417 _positionPrefix: string;
1416 1418 _positionSuffix: string;
1417 1419 _suffix: string;
1418 1420
1419 1421 _genHTML(pos: number): string;
1420 1422
1421 1423 /**
1422 1424 * VerticalRule will override this...
1423 1425 */
1424 1426 _isHorizontal: boolean;
1425 1427 }
1426 1428
1427 1429 interface HorizontalRuleConstructor extends _WidgetBaseConstructor<HorizontalRule> { }
1428 1430
1429 1431 /* dijit/form/HorizontalRuleLabels */
1430 1432
1431 1433 /**
1432 1434 * Labels for `dijit/form/HorizontalSlider`
1433 1435 */
1434 1436 interface HorizontalRuleLabels extends HorizontalRule {
1435 1437 /**
1436 1438 * CSS style to apply to individual text labels
1437 1439 */
1438 1440 labelStyle: string;
1439 1441
1440 1442 /**
1441 1443 * Array of text labels to render - evenly spaced from left-to-right or bottom-to-top.
1442 1444 * Alternately, minimum and maximum can be specified, to get numeric labels.
1443 1445 */
1444 1446 labels: string[];
1445 1447
1446 1448 /**
1447 1449 * Number of generated numeric labels that should be rendered as '' on the ends when labels[] are not specified
1448 1450 */
1449 1451 numericMargin: number;
1450 1452
1451 1453 /**
1452 1454 * Leftmost label value for generated numeric labels when labels[] are not specified
1453 1455 */
1454 1456 minimum: number;
1455 1457
1456 1458 /**
1457 1459 * Rightmost label value for generated numeric labels when labels[] are not specified
1458 1460 */
1459 1461 maximum: number;
1460 1462
1461 1463 /**
1462 1464 * pattern, places, lang, et al (see dojo.number) for generated numeric labels when labels[] are not specified
1463 1465 */
1464 1466 constraints: { pattern: string };
1465 1467
1466 1468 /**
1467 1469 * Returns the value to be used in HTML for the label as part of the left: attribute
1468 1470 */
1469 1471 _calcPosition(pos: number): number;
1470 1472
1471 1473 _genHTML(pos: number, ndx?: number): string;
1472 1474
1473 1475 /**
1474 1476 * extension point for bidi code
1475 1477 */
1476 1478 _genDirectionHTML(label: string): string;
1477 1479
1478 1480 /**
1479 1481 * Overridable function to return array of labels to use for this slider.
1480 1482 * Can specify a getLabels() method instead of a labels[] array, or min/max attributes.
1481 1483 */
1482 1484 getLabels(): string[];
1483 1485 }
1484 1486
1485 1487 interface HorizontalRuleLabelsConstructor extends _WidgetBaseConstructor<HorizontalRuleLabels> { }
1486 1488
1487 1489 /* dijit/form/HorizontalSlider */
1488 1490
1489 1491 interface _SliderMover extends dojo.dnd.Mover { }
1490 1492
1491 1493 /**
1492 1494 * A form widget that allows one to select a value with a horizontally draggable handle
1493 1495 */
1494 1496 interface HorizontalSlider extends _FormValueWidget, _Container {
1495 1497 /**
1496 1498 * Show increment/decrement buttons at the ends of the slider?
1497 1499 */
1498 1500 showButtons: boolean;
1499 1501
1500 1502 /**
1501 1503 * The minimum value the slider can be set to.
1502 1504 */
1503 1505 minimum: number;
1504 1506
1505 1507 /**
1506 1508 * The maximum value the slider can be set to.
1507 1509 */
1508 1510 maximum: number;
1509 1511
1510 1512 /**
1511 1513 * If specified, indicates that the slider handle has only 'discreteValues' possible positions, and that after dragging the handle, it will snap to the nearest possible position.
1512 1514 * Thus, the slider has only 'discreteValues' possible values.
1513 1515 *
1514 1516 * For example, if minimum=10, maxiumum=30, and discreteValues=3, then the slider handle has three possible positions, representing values 10, 20, or 30.
1515 1517 *
1516 1518 * If discreteValues is not specified or if it's value is higher than the number of pixels in the slider bar, then the slider handle can be moved freely, and the slider's value will be computed/reported based on pixel position (in this case it will likely be fractional, such as 123.456789).
1517 1519 */
1518 1520 discreteValues: number;
1519 1521
1520 1522 /**
1521 1523 * If discreteValues is also specified, this indicates the amount of clicks (ie, snap positions) that the slider handle is moved via pageup/pagedown keys.
1522 1524 * If discreteValues is not specified, it indicates the number of pixels.
1523 1525 */
1524 1526 pageIncrement: number;
1525 1527
1526 1528 /**
1527 1529 * If clicking the slider bar changes the value or not
1528 1530 */
1529 1531 clickSelect: boolean;
1530 1532
1531 1533 /**
1532 1534 * The time in ms to take to animate the slider handle from 0% to 100%, when clicking the slider bar to make the handle move.
1533 1535 */
1534 1536 slideDuration: number;
1535 1537
1536 1538 _mousePixelCoord: string;
1537 1539 _pixelCount: string;
1538 1540 _startingPixelCoord: string;
1539 1541 _handleOffsetCoord: string;
1540 1542 _progressPixelSize: string;
1541 1543
1542 1544 _onKeyUp(e: Event): void;
1543 1545 _onKeyDown(e: Event): void;
1544 1546 _onHandleClick(e: Event): void;
1545 1547
1546 1548 /**
1547 1549 * Returns true if direction is from right to left
1548 1550 */
1549 1551 _isReversed(): boolean;
1550 1552
1551 1553 _onBarClick(e: Event): void;
1552 1554
1553 1555 _setPixelValue(pixelValue: number, maxPixels: number, priorityChange?: boolean): void;
1554 1556
1555 1557 _setValueAttr(value: number, priorityChange?: boolean): void;
1556 1558
1557 1559 _bumpValue(signedChange: number, priorityChange: boolean): void;
1558 1560
1559 1561 _onClkBumper(val: any): void;
1560 1562 _onClkIncBumper(): void;
1561 1563 _onClkDecBumper(): void;
1562 1564
1563 1565 decrement(e: Event): void;
1564 1566 increment(e: Event): void;
1565 1567
1566 1568 _mouseWheeled(evt: Event): void;
1567 1569
1568 1570 _typematicCallback(count: number, button: Element, e: Event): void;
1569 1571 }
1570 1572
1571 1573 interface HorizontalSliderConstructor extends _WidgetBaseConstructor<HorizontalSlider> {
1572 1574 /**
1573 1575 * for monkey patching
1574 1576 */
1575 1577 _Mover: _SliderMover;
1576 1578 }
1577 1579
1578 1580 /* dijit/form/MappedTextBox */
1579 1581
1580 1582 interface MappedTextBox<C extends Constraints> extends ValidationTextBox<C> {
1581 1583 postMixInProperties(): void;
1582 1584 serialize: SerializationFunction;
1583 1585 toString(): string;
1584 1586 validate(isFocused?: boolean): boolean;
1585 1587 buildRendering(): void;
1586 1588 reset(): void;
1587 1589 }
1588 1590
1589 1591 interface MappedTextBoxConstructor extends _WidgetBaseConstructor<MappedTextBox<Constraints>> {
1590 1592 new <C extends Constraints>(params: Object, srcNodeRef: dojo.NodeOrString): MappedTextBox<C>;
1591 1593 }
1592 1594
1593 1595 /* dijit/form/NumberSpinner */
1594 1596
1595 1597 interface NumberSpinner extends _Spinner, NumberTextBoxMixin {
1596 1598 constraints: NumberTextBoxConstraints;
1597 1599 baseClass: string;
1598 1600 adjust(val: any, delta: number): any;
1599 1601
1600 1602 /* overrides */
1601 1603 pattern: ConstraintsToRegExpString<NumberTextBoxConstraints>;
1602 1604 parse(value: string, constraints: NumberTextBoxConstraints): string;
1603 1605 format(value: number, constraints: NumberTextBoxConstraints): string;
1604 1606 filter(value: number): number;
1605 1607 value: number;
1606 1608 }
1607 1609
1608 1610 interface NumberSpinnerConstructor extends _WidgetBaseConstructor<NumberSpinner> { }
1609 1611
1610 1612 /* dijit/form/NumberTextBox */
1611 1613
1612 1614 interface NumberTextBoxConstraints extends RangeBoundTextBoxConstraints, dojo.NumberFormatOptions, dojo.NumberParseOptions { }
1613 1615
1614 1616 interface NumberTextBoxMixin {
1615 1617 pattern: ConstraintsToRegExpString<NumberTextBoxConstraints>;
1616 1618 constraints: NumberTextBoxConstraints;
1617 1619 value: number;
1618 1620 editOptions: { pattern: string };
1619 1621 _formatter: (value: number, options?: dojo.NumberFormatOptions) => string;
1620 1622 _regExpGenerator: (options?: dojo.NumberRegexpOptions) => string;
1621 1623 _decimalInfo: (constraints: Constraints) => { sep: string; places: number; };
1622 1624 postMixInProperties(): void;
1623 1625 format(value: number, constraints: NumberTextBoxConstraints): string;
1624 1626 _parser: (expression: string, options?: dojo.NumberParseOptions) => number;
1625 1627 parse(value: string, constraints: dojo.NumberParseOptions): string;
1626 1628 filter(value: number): number;
1627 1629 serialize: SerializationFunction;
1628 1630 isValid(isFocused: boolean): boolean;
1629 1631 }
1630 1632
1631 1633 interface NumberTextBoxMixinConstructor extends _WidgetBaseConstructor<NumberTextBoxMixin> { }
1632 1634
1633 1635 interface NumberTextBox extends RangeBoundTextBox, NumberTextBoxMixin {
1634 1636 constraints: NumberTextBoxConstraints;
1635 1637 pattern: ConstraintsToRegExpString<NumberTextBoxConstraints>;
1636 1638 parse(value: string, constraints: dojo.NumberParseOptions): string;
1637 1639 format(value: number, constraints: dojo.NumberFormatOptions): string;
1638 1640 value: number;
1639 1641 filter(value: number): number;
1640 1642 }
1641 1643
1642 1644 interface NumberTextBoxConstructor extends _WidgetBaseConstructor<NumberTextBox> {
1643 1645 Mixin: NumberTextBoxMixinConstructor;
1644 1646 }
1645 1647
1646 1648 /* dijit/form/RadioButton */
1647 1649
1648 1650 interface RadioButton extends CheckBox, _RadioButtonMixin {
1649 1651 baseClass: string;
1650 1652 }
1651 1653
1652 1654 interface RadioButtonConstructor extends _WidgetBaseConstructor<RadioButton> { }
1653 1655
1654 1656 /* dijit/form/RangeBoundTextBox */
1655 1657
1656 1658 interface RangeBoundTextBoxConstraints extends Constraints {
1657 1659 min?: number;
1658 1660 max?: number;
1659 1661 }
1660 1662
1661 1663 interface RangeBoundTextBox extends MappedTextBox<RangeBoundTextBoxConstraints> {
1662 1664 /**
1663 1665 * The message to display if value is out-of-range
1664 1666 */
1665 1667 rangeMessage: string;
1666 1668
1667 1669 /**
1668 1670 * Overridable function used to validate the range of the numeric input value.
1669 1671 */
1670 1672 rangeCheck(primative: number, constraints: RangeBoundTextBoxConstraints): boolean;
1671 1673
1672 1674 /**
1673 1675 * Tests if the value is in the min/max range specified in constraints
1674 1676 */
1675 1677 isInRange(isFocused: boolean): boolean;
1676 1678
1677 1679 /**
1678 1680 * Returns true if the value is out of range and will remain
1679 1681 * out of range even if the user types more characters
1680 1682 */
1681 1683 _isDefinitelyOutOfRange(): boolean;
1682 1684
1683 1685 isValid(isFocused: boolean): boolean;
1684 1686 getErrorMessage(isFocused: boolean): string;
1685 1687 postMixInProperties(): void;
1686 1688 }
1687 1689
1688 1690 interface RangeBoundTextBoxConstructor extends _WidgetBaseConstructor<RangeBoundTextBox> { }
1689 1691
1690 1692 /* dijit/form/Select */
1691 1693
1692 1694 interface Select<T extends Object, Q extends dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions, U extends dijit._WidgetBase> extends _FormSelectWidget<T, Q, O>, _HasDropDown<U>, _KeyNavMixin {
1693 1695 baseClass: string;
1694 1696
1695 1697 /**
1696 1698 * What to display in an "empty" drop down.
1697 1699 */
1698 1700 emptyLabel: string;
1699 1701
1700 1702 /**
1701 1703 * Specifies how to interpret the labelAttr in the data store items.
1702 1704 */
1703 1705 labelType: string;
1704 1706
1705 1707 /**
1706 1708 * Currently displayed error/prompt message
1707 1709 */
1708 1710 message: string;
1709 1711
1710 1712 /**
1711 1713 * Can be true or false, default is false.
1712 1714 */
1713 1715 required: boolean;
1714 1716
1715 1717 /**
1716 1718 * "Incomplete" if this select is required but unset (i.e. blank value), "" otherwise
1717 1719 */
1718 1720 state: string;
1719 1721
1720 1722 /**
1721 1723 * Order fields are traversed when user hits the tab key
1722 1724 */
1723 1725 tabIndex: any;
1724 1726 templateString: any;
1725 1727
1726 1728 /**
1727 1729 * See the description of dijit/Tooltip.defaultPosition for details on this parameter.
1728 1730 */
1729 1731 tooltipPosition: any;
1730 1732
1731 1733 childSelector(node: Element | Node): boolean;
1732 1734 destroy(preserveDom: boolean): void;
1733 1735 focus(): void;
1734 1736
1735 1737 /**
1736 1738 * Sets the value to the given option, used during search by letter.
1737 1739 * @param widget Reference to option's widget
1738 1740 */
1739 1741 focusChild(widget: dijit._WidgetBase): void;
1740 1742 isLoaded(): boolean;
1741 1743
1742 1744 /**
1743 1745 * Whether or not this is a valid value.
1744 1746 * @param isFocused
1745 1747 */
1746 1748 isValid(isFocused: boolean): boolean;
1747 1749
1748 1750 /**
1749 1751 * populates the menu
1750 1752 * @param loadCallback
1751 1753 */
1752 1754 loadDropDown(loadCallback: () => any): void;
1753 1755 postCreate(): void;
1754 1756
1755 1757 /**
1756 1758 * set the missing message
1757 1759 */
1758 1760 postMixInProperties(): void;
1759 1761
1760 1762 /**
1761 1763 * Overridden so that the state will be cleared.
1762 1764 */
1763 1765 reset(): void;
1764 1766 startup(): void;
1765 1767
1766 1768 /**
1767 1769 * Called by oninit, onblur, and onkeypress, and whenever required/disabled state changes
1768 1770 * @param isFocused
1769 1771 */
1770 1772 validate(isFocused: boolean): boolean;
1771 1773
1772 1774 /**
1773 1775 * When a key is pressed that matches a child item,
1774 1776 * this method is called so that a widget can take
1775 1777 * appropriate action is necessary.
1776 1778 * @param item
1777 1779 * @param evt
1778 1780 * @param searchString
1779 1781 * @param numMatches
1780 1782 */
1781 1783 onKeyboardSearch(item: dijit._WidgetBase, evt: Event, searchString: string, numMatches: number): void;
1782 1784 }
1783 1785
1784 1786 interface SelectConstructor extends _WidgetBaseConstructor<Select<any, any, any, any>> { }
1785 1787
1786 1788 /* dijit/form/SimpleTextarea */
1787 1789
1788 1790 interface SimpleTextarea extends TextBox {
1789 1791 baseClass: string;
1790 1792 rows: string;
1791 1793 cols: string;
1792 1794 templateString: string;
1793 1795 postMixInProperties(): void;
1794 1796 buildRendering(): void;
1795 1797 filter(value: string): string;
1796 1798 }
1797 1799
1798 1800 interface SimpleTextareaConstructor extends _WidgetBaseConstructor<SimpleTextarea> {
1799 1801 new(params: Object, srcNodeRef: dojo.NodeOrString): SimpleTextarea;
1800 1802 }
1801 1803
1802 1804 /* dijit/form/Textarea */
1803 1805
1804 1806 interface Textarea extends SimpleTextarea, _ExpandingTextAreaMixin {
1805 1807 baseClass: string;
1806 1808 cols: string;
1807 1809 buildRendering(): void;
1808 1810 }
1809 1811
1810 1812 interface TextareaConstructor extends _WidgetBaseConstructor<Textarea> { }
1811 1813
1812 1814 /* dijit/form/TextBox */
1813 1815
1814 1816 interface TextBox extends _FormValueWidget, _TextBoxMixin<Constraints> {
1815 1817
1816 1818 }
1817 1819
1818 1820 interface TextBoxConstructor extends _WidgetBaseConstructor<TextBox> { }
1819 1821
1820 1822 /* dijit/form/ToggleButton */
1821 1823
1822 1824 interface ToggleButton extends Button, _ToggleButtonMixin {
1823 1825 baseClass: string;
1824 1826
1825 1827 setChecked(checked: boolean): void;
1826 1828 }
1827 1829
1828 1830 interface ToggleButtonConstructor extends _WidgetBaseConstructor<ToggleButton> { }
1829 1831
1830 1832 /* dijit/form/ValidationTextBox */
1831 1833
1832 1834 interface IsValidFunction {
1833 1835 (isFocused?: boolean): boolean;
1834 1836 }
1835 1837
1836 1838 interface ValidationTextBox<C extends Constraints = Constraints> extends TextBox {
1837 1839 templateString: string;
1838 1840 required: boolean;
1839 1841 promptMessage: string;
1840 1842 invalidMessage: string;
1841 1843 missingMessage: string;
1842 1844 message: string;
1843 1845 constraints: C;
1844 1846 pattern: string | ConstraintsToRegExpString<C>;
1845 1847 regExp: string;
1846 1848 regExpGen(constraints: C): void;
1847 1849 state: string;
1848 1850 tooltipPosition: string[];
1849 1851 validator: ConstrainedValidFunction<C>;
1850 1852 isValid: IsValidFunction;
1851 1853 getErrorMessage(isFocused: boolean): string;
1852 1854 getPromptMessage(isFocused: boolean): string;
1853 1855 validate(isFocused: boolean): boolean;
1854 1856 displayMessage(message: string): void;
1855 1857
1856 1858 startup(): void;
1857 1859 postMixInProperties(): void;
1858 1860
1859 1861 reset(): void;
1860 1862
1861 1863 destroy(preserveDom?: boolean): void;
1862 1864 }
1863 1865
1864 1866 interface ValidationTextBoxConstructor extends _WidgetBaseConstructor<ValidationTextBox<Constraints>> {
1865 1867 new <C extends Constraints>(params: Object, srcNodeRef: dojo.NodeOrString): ValidationTextBox<C>;
1866 1868 }
1867 1869 }
1868 1870 }
@@ -1,2104 +1,2108
1 1 /// <reference path="index.d.ts" />
2 2 /// <reference path="../doh/doh.d.ts" />
3 3
4 4 declare namespace dojo {
5 5 /* general implied types */
6 6
7 7 type NodeOrString = Node | string;
8 8 type ElementOrString = Element | string;
9 9 type NodeFragmentOrString = NodeOrString | DocumentFragment;
10 10
11 11 interface GenericConstructor<T> {
12 12 new (...args: any[]): T;
13 13 prototype: T;
14 14 }
15 15
16 16 interface GenericObject {
17 17 [id: string]: any;
18 18 }
19 19
20 20 interface GenericFunction<T> {
21 21 (...args: any[]): T;
22 22 }
23 23
24 24 interface Handle {
25 25 remove(): void;
26 26 }
27 27
28 28 interface EventListener {
29 29 (evt: any): void;
30 30 }
31 31
32 32 interface BuildProfile {
33 33 resourceTags: { [tag: string]: (filename: string, mid?: string) => boolean; };
34 34 }
35 35
36 36 interface Package {
37 37 location?: string;
38 38 main?: string;
39 39 name?: string;
40 40 }
41 41
42 42 export interface ModuleMap extends ModuleMapItem {
43 43 [ sourceMid: string ]: ModuleMapReplacement;
44 44 }
45 45
46 46 export interface ModuleMapItem {
47 47 [ mid: string ]: /* ModuleMapReplacement | ModuleMap */ any;
48 48 }
49 49
50 50 export interface ModuleMapReplacement extends ModuleMapItem {
51 51 [ findMid: string ]: /* replaceMid */ string;
52 52 }
53 53
54 54 /* dojo/AdapterRegistry */
55 55
56 56 interface AdapterRegistry {
57 57 /**
58 58 * register a check function to determine if the wrap function or
59 59 * object gets selected
60 60 */
61 61 register(name: string, check: (...args: any[]) => boolean, wrap: Function, directReturn?: boolean, override?: boolean): void;
62 62
63 63 /**
64 64 * Find an adapter for the given arguments. If no suitable adapter
65 65 * is found, throws an exception. match() accepts any number of
66 66 * arguments, all of which are passed to all matching functions
67 67 * from the registered pairs.
68 68 */
69 69 match(...args: any[]): any;
70 70
71 71 /**
72 72 * Remove a named adapter from the registry
73 73 */
74 74 unregister(name: string): boolean;
75 75 }
76 76
77 77 interface AdapterRegistryConstructor {
78 78 new (returnWrappers?: boolean): AdapterRegistry;
79 79 prototype: AdapterRegistry;
80 80 }
81 81
82 82 /* dojo/aspect */
83 83
84 84 interface AfterAdvice<T> {
85 85 (result: T, ...args: any[]): T;
86 86 }
87 87
88 88 interface AroundAdvice<T> {
89 89 (origFn: GenericFunction<T>): (...args: any[]) => T;
90 90 }
91 91
92 92 interface BeforeAdvice {
93 93 (...args: any[]): any[] | void;
94 94 }
95 95
96 96 interface Aspect {
97 97 /**
98 98 * The "before" export of the aspect module is a function that can be used to attach
99 99 * "before" advice to a method. This function will be executed before the original attach
100 100 * is executed. This function will be called with the arguments used to call the mattach
101 101 * This function may optionally return an array as the new arguments to use tattach
102 102 * the original method (or the previous, next-to-execute before advice, if one exattach
103 103 * If the before method doesn't return anything (returns undefined) the original argattach
104 104 * will be presattach
105 105 * If there are multiple "before" advisors, they are executed in the reverse order they were registered.
106 106 */
107 107 before<T>(target: GenericObject, methodName: string, advice: BeforeAdvice | Function): Handle;
108 108
109 109 /**
110 110 * The "around" export of the aspect module is a function that can be used to attach
111 111 * "around" advice to a method. The advisor function is immediately executeattach
112 112 * the around() is called, is passed a single argument that is a function that attach
113 113 * called to continue execution of the original method (or the next around advattach
114 114 * The advisor function should return a function, and this function will be called whattach
115 115 * the method is called. It will be called with the arguments used to call the mattach
116 116 * Whatever this function returns will be returned as the result of the method call (unless after advise changes it).
117 117 */
118 118 around<T>(target: GenericObject, methodName: string, advice: AroundAdvice<T> | Function): Handle;
119 119
120 120 /**
121 121 * The "after" export of the aspect module is a function that can be used to attach
122 122 * "after" advice to a method. This function will be executed after the original method
123 123 * is executed. By default the function will be called with a single argument, the return
124 124 * value of the original method, or the the return value of the last executed advice (if a previous one exists).
125 125 * The fourth (optional) argument can be set to true to so the function receives the original
126 126 * arguments (from when the original method was called) rather than the return value.
127 127 * If there are multiple "after" advisors, they are executed in the order they were registered.
128 128 */
129 129 after<T>(target: GenericObject, methodName: string, advice: AfterAdvice<T> | Function, receiveArguments?: boolean): Handle;
130 130 }
131 131
132 132 /* dojo/back */
133 133
134 134 interface BackArgs {
135 135 back?: GenericFunction<void>;
136 136 forward?: GenericFunction<void>;
137 137 changeUrl?: boolean | string;
138 138 }
139 139
140 140 interface Back {
141 141 getHash(): string;
142 142 setHash(h: string): void;
143 143
144 144 /**
145 145 * private method. Do not call this directly.
146 146 */
147 147 goBack(): void;
148 148
149 149 /**
150 150 * private method. Do not call this directly.
151 151 */
152 152 goForward(): void;
153 153
154 154 /**
155 155 * Initializes the undo stack. This must be called from a <script>
156 156 * block that lives inside the `<body>` tag to prevent bugs on IE.
157 157 * Only call this method before the page's DOM is finished loading. Otherwise
158 158 * it will not work. Be careful with xdomain loading or djConfig.debugAtAllCosts scenarios,
159 159 * in order for this method to work, dojo/back will need to be part of a build layer.
160 160 */
161 161 init(): void;
162 162
163 163 /**
164 164 * Sets the state object and back callback for the very first page
165 165 * that is loaded.
166 166 * It is recommended that you call this method as part of an event
167 167 * listener that is registered via dojo/ready.
168 168 */
169 169 setInitialState(args: BackArgs): void;
170 170
171 171 /**
172 172 * adds a state object (args) to the history list.
173 173 */
174 174 addToHistory(args: BackArgs): void;
175 175
176 176 /**
177 177 * private method. Do not call this directly.
178 178 */
179 179 _iframeLoaded(evt: Event, ifrLoc: Location): void;
180 180 }
181 181
182 182 /* dojo/behavior */
183 183
184 184 interface Behavior {
185 185 _behaviors: { [selector: string]: any };
186 186
187 187 /**
188 188 * Add the specified behavior to the list of behaviors, ignoring existing
189 189 * matches.
190 190 */
191 191 add(behaviorObject: { [selector: string]: any }): void;
192 192
193 193 /**
194 194 * Applies all currently registered behaviors to the document.
195 195 */
196 196 apply(): void;
197 197 }
198 198
199 199 /* dojo/cookie */
200 200
201 201 interface CookieProps {
202 202 expires?: Date | string | number;
203 203 path?: string;
204 204 domain?: string;
205 205 secure?: boolean;
206 206 }
207 207
208 208 interface Cookie {
209 209 /* Get or set a cookie. */
210 210 (name: string, value?: string, props?: CookieProps): string;
211 211
212 212 /**
213 213 * Use to determine if the current browser supports cookies or not.
214 214 */
215 215 isSupported(): boolean;
216 216 }
217 217
218 218 /* dojo/currency */
219 219
220 220 interface CurrencyFormatOptions extends NumberFormatOptions {
221 221
222 222 /**
223 223 * Should not be set. Value is assumed to be "currency".
224 224 */
225 225 type?: string;
226 226
227 227 /**
228 228 * localized currency symbol. The default will be looked up in table of supported currencies in `dojo.cldr`
229 229 * A [ISO4217](http://en.wikipedia.org/wiki/ISO_4217) currency code will be used if not found.
230 230 */
231 231 symbol?: string;
232 232
233 233 /**
234 234 * an [ISO4217](http://en.wikipedia.org/wiki/ISO_4217) currency code, a three letter sequence like "USD".
235 235 * For use with dojo.currency only.
236 236 */
237 237 currency?: string;
238 238
239 239 /**
240 240 * number of decimal places to show. Default is defined based on which currency is used.
241 241 */
242 places?: number;
242 places?: string | number;
243 243 }
244 244
245 245 interface CurrencyParseOptions extends NumberParseOptions {
246 246
247 247 /**
248 248 * Should not be set. Value is assumed to be "currency".
249 249 */
250 250 type?: string;
251 251
252 252 /**
253 253 * localized currency symbol. The default will be looked up in table of supported currencies in `dojo.cldr`
254 254 * A [ISO4217](http://en.wikipedia.org/wiki/ISO_4217) currency code will be used if not found.
255 255 */
256 256 symbol?: string;
257 257
258 258 /**
259 259 * an [ISO4217](http://en.wikipedia.org/wiki/ISO_4217) currency code, a three letter sequence like "USD".
260 260 * For use with dojo.currency only.
261 261 */
262 262 currency?: string;
263 263
264 264 /**
265 265 * number of decimal places to show. Default is defined based on which currency is used.
266 266 */
267 places?: number;
267 places?: number | string;
268 268
269 269 /**
270 270 * Whether to include the fractional portion, where the number of decimal places are implied by the currency
271 271 * or explicit 'places' parameter. The value [true,false] makes the fractional portion optional.
272 272 * By default for currencies, it the fractional portion is optional.
273 273 */
274 274 fractional?: boolean | [boolean, boolean];
275 275 }
276 276
277 277 interface Currency {
278 278 _mixInDefaults(options: NumberFormatOptions): CurrencyFormatOptions;
279 279
280 280 /**
281 281 * Format a Number as a currency, using locale-specific settings
282 282 */
283 283 format(value: number, options?: CurrencyFormatOptions): string;
284 284
285 285 /**
286 286 * Builds the regular needed to parse a currency value
287 287 */
288 288 regexp(options?: NumberRegexpOptions): string;
289 289
290 290 /**
291 291 * Convert a properly formatted currency string to a primitive Number,
292 292 * using locale-specific settings.
293 293 */
294 294 parse(expression: string, options?: CurrencyParseOptions): number;
295 295 }
296 296
297 297 /* dojo/debounce */
298 298
299 299 interface Debounce {
300 300 /**
301 301 * Create a function that will only execute after `wait` milliseconds
302 302 */
303 303 <T extends Function>(cb: T, wait: number): T;
304 304 <T extends Function>(cb: Function, wait: number, ...args: any[]): T;
305 305 }
306 306
307 307 /* dojo/Deferred */
308 308
309 309 interface Deferred<T> {
310 310
311 311 /**
312 312 * The public promise object that clients can add callbacks to.
313 313 */
314 314 promise: promise.Promise<T>;
315 315
316 316 /**
317 317 * Checks whether the deferred has been resolved.
318 318 */
319 319 isResolved(): boolean;
320 320
321 321 /**
322 322 * Checks whether the deferred has been rejected.
323 323 */
324 324 isRejected(): boolean;
325 325
326 326 /**
327 327 * Checks whether the deferred has been resolved or rejected.
328 328 */
329 329 isFulfilled(): boolean;
330 330
331 331 /**
332 332 * Checks whether the deferred has been canceled.
333 333 */
334 334 isCanceled(): boolean;
335 335
336 336 /**
337 337 * Emit a progress update on the deferred.
338 338 */
339 339 progress(update: any, strict?: boolean): promise.Promise<T>;
340 340
341 341 /**
342 342 * Resolve the deferred.
343 343 */
344 344 resolve(value?: T, strict?: boolean): promise.Promise<T>;
345 345
346 346 /**
347 347 * Reject the deferred.
348 348 */
349 349 reject(error?: any, strict?: boolean): promise.Promise<T>;
350 350
351 351 /**
352 352 * Add new callbacks to the deferred.
353 353 */
354 354 then<U>(callback?: promise.PromiseCallback<T, U>, errback?: promise.PromiseErrback<U>, progback?: promise.PromiseProgback): promise.Promise<U>;
355 355
356 356 /**
357 357 * Inform the deferred it may cancel its asynchronous operation.
358 358 */
359 359 cancel(reason?: any, strict?: boolean): any;
360 360
361 361 /**
362 362 * Returns `[object Deferred]`.
363 363 */
364 364 toString(): string;
365 365 }
366 366
367 367 interface DeferredConstructor {
368 368 /**
369 369 * Creates a new deferred. This API is preferred over
370 370 * `dojo/_base/Deferred`.
371 371 */
372 372 new <T>(canceller?: (reason: any) => void): Deferred<T>;
373 373 prototype: Deferred<any>;
374 374 }
375 375
376 376 /* dojo/DeferredList */
377 377
378 378 interface DeferredList<T> extends Deferred<T[]> {
379 379 /**
380 380 * Gathers the results of the deferreds for packaging
381 381 * as the parameters to the Deferred Lists' callback
382 382 */
383 383 gatherResults<T>(deferredList: DeferredList<any>): DeferredList<T>;
384 384 }
385 385
386 386 interface DeferredListConstructor {
387 387 /**
388 388 * Deprecated, use dojo/promise/all instead.
389 389 * Provides event handling for a group of Deferred objects.
390 390 */
391 391 new <T>(list: T[], fireOnOneCallback?: boolean, fireOnOneErrback?: boolean, consumeErrors?: boolean, canceller?: (reason: any) => void): DeferredList<T>;
392 392 prototype: DeferredList<any>;
393 393 }
394 394
395 395 /* dojo/dojo */
396 396
397 397 interface RequireTrace {
398 398 (group: string, args: any[]): void;
399 399 on: boolean | number;
400 400 group: GenericObject;
401 401 set(group: string | GenericObject, value: any): void;
402 402 }
403 403
404 404 interface Require {
405 405 (config: GenericObject, dependencies: string[], callback?: GenericFunction<void>): Require;
406 406 (dependencies: string[], callback: GenericFunction<void>): Require;
407 407 async: number| boolean;
408 408 has: dojo.Has;
409 409 isXdurl(url: string): boolean;
410 410 initSyncLoader(dojoRequirePlugin: any, checkDojoRequirePlugin: any, transformToAmd: any): GenericObject;
411 411 getXhr(): XMLHttpRequest | ActiveXObject;
412 412 getText(url: string, async?: boolean, onLoad?: (responseText: string, async?: boolean) => void): string;
413 413 eval(text: string, hint?: string): any;
414 414 signal(type: string, args: any[]): void;
415 415 on(type: string, listener: (...args: any[]) => void): Handle;
416 416 map: { [id: string]: any };
417 417 waitms?: number;
418 418 legacyMode: boolean;
419 419 rawConfig: dojo._base.Config;
420 420 baseUrl: string;
421 421 combo?: {
422 422 add: () => void;
423 423 done(callback: (mids: string[], url?: string) => void, req: Require): void;
424 424 plugins?: GenericObject;
425 425 };
426 426 idle(): boolean;
427 427 toAbsMid(mid: string, referenceModule?: string): string;
428 428 toUrl(name: string, referenceModule?: string): string;
429 429 undef(moduleId: string, referenceModule?: string): void;
430 430 pageLoaded: number | boolean;
431 431 injectUrl(url: string, callback?: () => void, owner?: HTMLScriptElement): HTMLScriptElement;
432 432 log(...args: any[]): void;
433 433 trace: RequireTrace;
434 434 boot?: [string[], Function] | number;
435 435 }
436 436
437 437 interface Define {
438 438 (mid: string, dependencies?: string[], factory?: any): void;
439 439 (dependencies: string[], factory?: any): void;
440 440 amd: string;
441 441 }
442 442
443 443 /* dojo/dom */
444 444
445 445 interface Dom {
446 446 /**
447 447 * Returns DOM node with matching `id` attribute or falsy value (ex: null or undefined)
448 448 * if not found. Internally if `id` is not a string then `id` returned.
449 449 */
450 450 byId<E extends Element>(id: string | E, doc?: Document): E;
451 451
452 452 /**
453 453 * Returns true if node is a descendant of ancestor
454 454 */
455 455 isDescendant(node: NodeOrString, ancestor: NodeOrString): boolean;
456 456
457 457 /**
458 458 * Enable or disable selection on a node
459 459 */
460 460 setSelectable(node: ElementOrString, selectable?: boolean): void;
461 461 }
462 462
463 463 /* dojo/dom-attr */
464 464
465 465 interface DomAttr {
466 466 /**
467 467 * Returns true if the requested attribute is specified on the
468 468 * given element, and false otherwise.
469 469 */
470 470 has(node: NodeOrString, name: string): boolean;
471 471
472 472 /**
473 473 * Gets an attribute on an HTML element.
474 474 * Because sometimes this uses node.getAttribute, it should be a string,
475 475 * but it can also get any other attribute on a node, therefore it is unsafe
476 476 * to type just a string.
477 477 */
478 478 get(node: ElementOrString, name: string): any;
479 479
480 480 /**
481 481 * Sets an attribute on an HTML element.
482 482 */
483 483 set(node: ElementOrString, name: string, value: any): Element;
484 484 set(node: ElementOrString, map: GenericObject): Element;
485 485
486 486 /**
487 487 * Removes an attribute from an HTML element.
488 488 */
489 489 remove(node: NodeOrString, name: string): void;
490 490
491 491 /**
492 492 * Returns an effective value of a property or an attribute.
493 493 */
494 494 getNodeProp(node: NodeOrString, name: string): any;
495 495 }
496 496
497 497 /* dojo/dom-class */
498 498
499 499 interface DomClass {
500 500
501 501 /**
502 502 * Returns whether or not the specified classes are a portion of the
503 503 * class list currently applied to the node.
504 504 */
505 505 contains(node: NodeOrString, classStr: string): boolean;
506 506
507 507 /**
508 508 * Adds the specified classes to the end of the class list on the
509 509 * passed node. Will not re-apply duplicate classes.
510 510 */
511 511 add(node: NodeOrString, classStr: string | string[]): void;
512 512
513 513 /**
514 514 * Removes the specified classes from node. No `contains()`
515 515 * check is required.
516 516 */
517 517 remove(node: NodeOrString, classStr?: string | string[]): void;
518 518
519 519 /**
520 520 * Replaces one or more classes on a node if not present.
521 521 * Operates more quickly than calling dojo.removeClass and dojo.addClass
522 522 */
523 523 replace(node: NodeOrString, addClassStr: string | string[], removeClassStr?: string | string[]): void;
524 524
525 525 /**
526 526 * Adds a class to node if not present, or removes if present.
527 527 * Pass a boolean condition if you want to explicitly add or remove.
528 528 * Returns the condition that was specified directly or indirectly.
529 529 */
530 530 toggle(node: NodeOrString, classStr: string | string[], condition?: boolean): boolean;
531 531 }
532 532
533 533 /* dojo/dom-construct */
534 534
535 535 /* TODO implement for TS 1.8 */
536 536 /* type PosString = 'first' | 'after' | 'before' | 'last' | 'replace' | 'only'; */
537 537
538 538 interface DomConstruct {
539 539
540 540 /**
541 541 * instantiates an HTML fragment returning the corresponding DOM.
542 542 */
543 543 toDom(frag: string, doc?: Document): DocumentFragment | Node;
544 544
545 545 /**
546 546 * Attempt to insert node into the DOM, choosing from various positioning options.
547 547 * Returns the first argument resolved to a DOM node.
548 548 */
549 549 place(node: NodeFragmentOrString, refNode: NodeOrString, position?: string /* PosString */ | number): HTMLElement;
550 550
551 551 /**
552 552 * Create an element, allowing for optional attribute decoration
553 553 * and placement.
554 554 */
555 555 create(tag: NodeOrString, attrs?: GenericObject, refNode?: NodeOrString, pos?: string /* PosString */ | number): HTMLElement;
556 556
557 557 /**
558 558 * safely removes all children of the node.
559 559 */
560 560 empty(node: NodeOrString): void;
561 561
562 562 /**
563 563 * Removes a node from its parent, clobbering it and all of its
564 564 * children.
565 565 */
566 566 destroy(node: NodeOrString): void;
567 567 }
568 568
569 569 /* dojo/dom-form */
570 570
571 571 interface DomForm {
572 572 /**
573 573 * Serialize a form field to a JavaScript object.
574 574 */
575 575 fieldToObject(inputNode: NodeOrString): GenericObject;
576 576
577 577 /**
578 578 * Serialize a form node to a JavaScript object.
579 579 */
580 580 toObject(fromNode: HTMLFormElement | string): GenericObject;
581 581
582 582 /**
583 583 * Returns a URL-encoded string representing the form passed as either a
584 584 * node or string ID identifying the form to serialize
585 585 */
586 586 toQuery(fromNode: HTMLFormElement | string): string;
587 587
588 588 /**
589 589 * Create a serialized JSON string from a form node or string
590 590 * ID identifying the form to serialize
591 591 */
592 592 toJson(formNode: HTMLFormElement | string, prettyPrint?: boolean): string;
593 593 }
594 594
595 595 /* dojo/dom-geometry */
596 596
597 597 interface DomGeometryWidthHeight {
598 598 w?: number;
599 599 h?: number;
600 600 }
601 601
602 602 interface DomGeometryBox extends DomGeometryWidthHeight {
603 603 l?: number;
604 604 t?: number;
605 605 }
606 606
607 607 interface DomGeometryBoxExtents extends DomGeometryBox {
608 608 r?: number;
609 609 b?: number;
610 610 }
611 611
612 612 interface Point {
613 613 x: number;
614 614 y: number;
615 615 }
616 616
617 617 interface DomGeometryXYBox extends DomGeometryWidthHeight, Point {
618 618 }
619 619
620 620 interface DomGeometry {
621 621 boxModel: string; /* TODO: string literal 'border-box' | 'content-box' */
622 622
623 623 /**
624 624 * Returns object with special values specifically useful for node
625 625 * fitting.
626 626 */
627 627 getPadExtents(node: Element, computedStyle?: DomComputedStyle): DomGeometryBoxExtents;
628 628
629 629 /**
630 630 * returns an object with properties useful for noting the border
631 631 * dimensions.
632 632 */
633 633 getBorderExtents(node: Element, computedStyle?: DomComputedStyle): DomGeometryBoxExtents;
634 634
635 635 /**
636 636 * Returns object with properties useful for box fitting with
637 637 * regards to padding.
638 638 */
639 639 getPadBorderExtents(node: Element, computedStyle?: DomComputedStyle): DomGeometryBoxExtents;
640 640
641 641 /**
642 642 * returns object with properties useful for box fitting with
643 643 * regards to box margins (i.e., the outer-box).
644 644 * - l/t = marginLeft, marginTop, respectively
645 645 * - w = total width, margin inclusive
646 646 * - h = total height, margin inclusive
647 647 * The w/h are used for calculating boxes.
648 648 * Normally application code will not need to invoke this
649 649 * directly, and will use the ...box... functions instead.
650 650 */
651 651 getMarginExtents(node: Element, computedStyle?: DomComputedStyle): DomGeometryBoxExtents;
652 652
653 653 /**
654 654 * returns an object that encodes the width, height, left and top
655 655 * positions of the node's margin box.
656 656 */
657 657 getMarginBox(node: Element, computedStyle?: DomComputedStyle): DomGeometryBox;
658 658
659 659 /**
660 660 * Returns an object that encodes the width, height, left and top
661 661 * positions of the node's content box, irrespective of the
662 662 * current box model.
663 663 */
664 664 getContentBox(node: Element, computedStyle?: DomComputedStyle): DomGeometryBox;
665 665
666 666 /**
667 667 * Sets the size of the node's contents, irrespective of margins,
668 668 * padding, or borders.
669 669 */
670 670 setContentSize(node: Element, box: DomGeometryWidthHeight, computedStyle?: DomComputedStyle): void;
671 671
672 672 /**
673 673 * sets the size of the node's margin box and placement
674 674 * (left/top), irrespective of box model. Think of it as a
675 675 * passthrough to setBox that handles box-model vagaries for
676 676 * you.
677 677 */
678 678 setMarginBox(node: Element, box: DomGeometryBox, computedStyle?: DomComputedStyle): void;
679 679
680 680 /**
681 681 * Returns true if the current language is left-to-right, and false otherwise.
682 682 */
683 683 isBodyLtr(doc?: Document): boolean;
684 684
685 685 /**
686 686 * Returns an object with {node, x, y} with corresponding offsets.
687 687 */
688 688 docScroll(doc?: Document): Point;
689 689
690 690 /**
691 691 * Deprecated method previously used for IE6-IE7. Now, just returns `{x:0, y:0}`.
692 692 */
693 693 getIeDocumentElementOffset(doc: Document): Point;
694 694
695 695 /**
696 696 * In RTL direction, scrollLeft should be a negative value, but IE
697 697 * returns a positive one. All codes using documentElement.scrollLeft
698 698 * must call this function to fix this error, otherwise the position
699 699 * will offset to right when there is a horizontal scrollbar.
700 700 */
701 701 fixIeBiDiScrollLeft(scrollLeft: number, doc?: Document): number;
702 702
703 703 /**
704 704 * Gets the position and size of the passed element relative to
705 705 * the viewport (if includeScroll==false), or relative to the
706 706 * document root (if includeScroll==true).
707 707 */
708 708 position(node: Element, includeScroll?: boolean): DomGeometryXYBox;
709 709
710 710 /**
711 711 * returns an object that encodes the width and height of
712 712 * the node's margin box
713 713 */
714 714 getMarginSize(node: Element, computedStyle?: DomComputedStyle): DomGeometryWidthHeight;
715 715
716 716 /**
717 717 * Normalizes the geometry of a DOM event, normalizing the pageX, pageY,
718 718 * offsetX, offsetY, layerX, and layerX properties
719 719 */
720 720 normalizeEvent(event: Event): void;
721 721 }
722 722
723 723 /* dojo/dom-prop */
724 724
725 725 interface DomProp {
726 726 /**
727 727 * Gets a property on an HTML element.
728 728 */
729 729 get(node: ElementOrString, name: string): any;
730 730
731 731 /**
732 732 * Sets a property on an HTML element.
733 733 */
734 734 set(node: ElementOrString, name: string | GenericObject, value?: any): Element;
735 735 }
736 736
737 737 /* dojo/dom-style */
738 738
739 739 // TODO move over the most common properties from CSSStyleDeclaration
740 740 interface DomComputedStyle {
741 741 position?: string;
742 742 width?: string;
743 743 height?: string;
744 744 [id: string]: any;
745 745 }
746 746
747 747 interface DomStyle {
748 748 /**
749 749 * Returns a "computed style" object.
750 750 */
751 751 getComputedStyle(node: Node): DomComputedStyle;
752 752
753 753 /**
754 754 * Accesses styles on a node.
755 755 */
756 756 get(node: ElementOrString): DomComputedStyle;
757 757 get(node: ElementOrString, name: string): string | number;
758 758
759 759 /**
760 760 * Sets styles on a node.
761 761 */
762 762 set(node: ElementOrString, name: DomComputedStyle): DomComputedStyle;
763 763 set(node: ElementOrString, name: string, value: string | number): DomComputedStyle;
764 764
765 765 /**
766 766 * converts style value to pixels on IE or return a numeric value.
767 767 */
768 768 toPixelValue(element: Element, value: string): number;
769 769 }
770 770
771 771 /* dojo/domReady */
772 772
773 773 interface DomReady {
774 774 /**
775 775 * Plugin to delay require()/define() callback from firing until the DOM has finished
776 776 */
777 777 (callback: Function): void;
778 778
779 779 load(id: string, parentRequire: Function, loaded: Function): void; /* TODO: Align with loader api */
780 780 _Q: Function[];
781 781 _onEmpty(): void;
782 782 }
783 783
784 784 /* dojo/Evented */
785 785
786 interface Evented {
787 on(type: string | ExtensionEvent, listener: EventListener | Function): Handle;
788 emit(type: string | ExtensionEvent, ...events: any[]): boolean;
786 interface Evented<EM extends { [e in string]: any; } = any> {
787 on<E extends keyof EM>(type: E, listener: (this: this, ...args: EM[E] extends any[] ? EM[E]: [EM[E]]) => void ): Handle;
788
789 on(type: ExtensionEvent, listener: (...args: any[]) => void): Handle;
790
791 emit<E extends keyof EM>(type: E, ...args: EM[E] extends any[] ? EM[E] : [EM[E]] );
792 emit(type: ExtensionEvent, ...events: any[]): boolean;
789 793 }
790 794
791 795 interface EventedConstructor extends _base.DeclareConstructor<Evented> {
792 new (params?: Object): Evented;
796 new <T>(params?: Object): Evented<T>;
793 797 }
794 798
795 799 /* dojo/fx */
796 800
797 801 /* dojo/fx augments the dojo/_base/fx, therefore it is typed in fx.d.ts and not referenced from
798 802 index.d.ts or module.d.ts and is self contained typings for dojo/fx and dojo/fx/* */
799 803
800 804 /* dojo/gears */
801 805
802 806 /* This is long-ago deprecated by Google, so just doing a minimal typing */
803 807
804 808 interface Gears {
805 809 _gearsObject(): any;
806 810 available: boolean;
807 811 }
808 812
809 813 /* dojo/has */
810 814
811 815 interface HasCache {
812 816 [feature: string]: any;
813 817 }
814 818
815 819 interface HasTestFunction {
816 820 /* TypeScript has no way of referring to the global scope see Microsoft/TypeScript#983 */
817 821 (global?: any, doc?: Document, element?: Element): any;
818 822 }
819 823
820 824 interface Has {
821 825 /**
822 826 * Return the current value of the named feature.
823 827 * @param {string | number} name The name (if a string) or identifier (if an integer) of the feature to test.
824 828 */
825 829 (name: string | number): any;
826 830 (name: 'host-browser'): boolean;
827 831 (name: 'host-node'): any;
828 832 (name: 'host-rhino'): boolean;
829 833 (name: 'dom'): boolean;
830 834 (name: 'dojo-dom-ready-api'): 1;
831 835 (name: 'dojo-sniff'): 1;
832 836 // if host-browser is true
833 837 (name: 'dom-addeventlistener'): void | boolean;
834 838 (name: 'touch'): void | boolean;
835 839 (name: 'touch-events'): void | boolean;
836 840 (name: 'pointer-events'): void | boolean;
837 841 (name: 'MSPointer'): void | boolean;
838 842 (name: 'device-width'): void | number;
839 843 (name: 'dom-attributes-explicit'): void | boolean;
840 844 (name: 'dom-attributes-specified-flag'): void | boolean;
841 845 // dojo/_base/browser
842 846 (name: 'config-selectorEngine'): string;
843 847
844 848 cache: HasCache;
845 849
846 850 /**
847 851 * Register a new feature test for some named feature.
848 852 */
849 853 add(name: string | number, test: HasTestFunction, now?: boolean, force?: boolean): any;
850 854 add<T extends (Object | string | number | boolean | null | void)>(name: string | number, test: T, now?: boolean, force?: boolean): any;
851 855
852 856 /**
853 857 * Deletes the contents of the element passed to test functions.
854 858 */
855 859 clearElement(element: HTMLElement): HTMLElement;
856 860
857 861 /**
858 862 * Resolves id into a module id based on possibly-nested tenary expression that branches on has feature test value(s).
859 863 */
860 864 normalize(id: string, toAbsMid: Function): string; /* TODO: Align with loader api */
861 865
862 866 /**
863 867 * Conditional loading of AMD modules based on a has feature test value.
864 868 */
865 869 load(id: string, parentRequire: Function, loaded: Function): void; /* TODO: Align with loader api */
866 870 }
867 871
868 872 /* dojo/hash */
869 873
870 874 interface Hash {
871 875 (hash?: string, replace?: boolean): string;
872 876 }
873 877
874 878 /* dojo/hccss */
875 879
876 880 /* this only does has.add and re-exports the has interface */
877 881 interface Has {
878 882 (name: 'highcontrast'): void | boolean;
879 883 }
880 884
881 885 /* dojo/html */
882 886
883 887 type ContentSetterContent = string | Node | ArrayLike<Node>;
884 888
885 889 interface ContentSetterParams {
886 890 node?: NodeOrString;
887 891 content?: ContentSetterContent;
888 892 id?: string;
889 893 cleanContent?: boolean;
890 894 extractContent?: boolean;
891 895 parseContent?: boolean;
892 896 parserScope?: boolean;
893 897 startup?: boolean;
894 898 onBegin?: Function;
895 899 onEnd?: Function;
896 900 tearDown?: Function;
897 901 onContentError?: Function;
898 902 onExecError?: Function;
899 903 }
900 904
901 905 interface ContentSetter {
902 906
903 907 /**
904 908 * An node which will be the parent element that we set content into
905 909 */
906 910 node: NodeOrString;
907 911
908 912 /**
909 913 * The content to be placed in the node. Can be an HTML string, a node reference, or a enumerable list of nodes
910 914 */
911 915 content: ContentSetterContent;
912 916
913 917 /**
914 918 * Usually only used internally, and auto-generated with each instance
915 919 */
916 920 id: string;
917 921
918 922 /**
919 923 * Should the content be treated as a full html document,
920 924 * and the real content stripped of <html>, <body> wrapper before injection
921 925 */
922 926 cleanContent: boolean;
923 927
924 928 /**
925 929 * Should the content be treated as a full html document,
926 930 * and the real content stripped of `<html> <body>` wrapper before injection
927 931 */
928 932 extractContent: boolean;
929 933
930 934 /**
931 935 * Should the node by passed to the parser after the new content is set
932 936 */
933 937 parseContent: boolean;
934 938
935 939 /**
936 940 * Flag passed to parser. Root for attribute names to search for. If scopeName is dojo,
937 941 * will search for data-dojo-type (or dojoType). For backwards compatibility
938 942 * reasons defaults to dojo._scopeName (which is "dojo" except when
939 943 * multi-version support is used, when it will be something like dojo16, dojo20, etc.)
940 944 */
941 945 parserScope: string;
942 946
943 947 /**
944 948 * Start the child widgets after parsing them. Only obeyed if parseContent is true.
945 949 */
946 950 startup: boolean;
947 951
948 952 /**
949 953 * front-end to the set-content sequence
950 954 */
951 955 set(cont?: ContentSetterContent, params?: ContentSetterParams): promise.Promise<Node> | Node;
952 956
953 957 /**
954 958 * sets the content on the node
955 959 */
956 960 setContent(): void;
957 961
958 962 /**
959 963 * cleanly empty out existing content
960 964 */
961 965 empty(): void;
962 966
963 967 /**
964 968 * Called after instantiation, but before set();
965 969 * It allows modification of any of the object properties -
966 970 * including the node and content provided - before the set operation actually takes place
967 971 */
968 972 onBegin(): Node;
969 973
970 974 /**
971 975 * Called after set(), when the new content has been pushed into the node
972 976 * It provides an opportunity for post-processing before handing back the node to the caller
973 977 * This default implementation checks a parseContent flag to optionally run the dojo parser over the new content
974 978 */
975 979 onEnd(): Node;
976 980
977 981 /**
978 982 * manually reset the Setter instance if its being re-used for example for another set()
979 983 */
980 984 tearDown(): void;
981 985
982 986 onContentError(): string;
983 987 onExecError(): string;
984 988 _mixin(params: ContentSetterParams): void;
985 989 parseDeferred: Deferred<any[]>;
986 990
987 991 /**
988 992 * runs the dojo parser over the node contents, storing any results in this.parseResults
989 993 */
990 994 _parse(): void;
991 995
992 996 /**
993 997 * shows user the string that is returned by on[type]Error
994 998 * override/implement on[type]Error and return your own string to customize
995 999 */
996 1000 _onError(type: string, err: Error, consoleText?: string): void;
997 1001 }
998 1002
999 1003 interface ContentSetterConstructor extends _base.DeclareConstructor<ContentSetter> {
1000 1004 new (params?: ContentSetterParams, node?: NodeOrString): ContentSetter;
1001 1005 }
1002 1006
1003 1007 interface Html {
1004 1008 /**
1005 1009 * removes !DOCTYPE and title elements from the html string.
1006 1010 *
1007 1011 * khtml is picky about dom faults, you can't attach a style or `<title>` node as child of body
1008 1012 * must go into head, so we need to cut out those tags
1009 1013 */
1010 1014 _secureForInnerHtml(cont: string): string;
1011 1015
1012 1016 /**
1013 1017 * Deprecated, should use dojo/dom-constuct.empty() directly, remove in 2.0.
1014 1018 */
1015 1019 _emptyNode(node: NodeOrString): void;
1016 1020
1017 1021 /**
1018 1022 * inserts the given content into the given node
1019 1023 */
1020 1024 _setNodeContent<T extends Node>(node: Node, cont: string | Node | ArrayLike<T>): Node;
1021 1025
1022 1026 _ContentSetter: ContentSetterConstructor;
1023 1027
1024 1028 /**
1025 1029 * inserts (replaces) the given content into the given node. dojo/dom-construct.place(cont, node, "only")
1026 1030 * may be a better choice for simple HTML insertion.
1027 1031 */
1028 1032 set(node: Node, cont?: ContentSetterContent, params?: ContentSetterParams): promise.Promise<Node> | Node;
1029 1033 }
1030 1034
1031 1035 /* dojo/i18n */
1032 1036
1033 1037 interface I18n {
1034 1038 getLocalization(moduleName: string, bundleName: string, locale?: string): any;
1035 1039
1036 1040 dynamic: boolean;
1037 1041
1038 1042 /**
1039 1043 * Resolves id into a module id based on possibly-nested tenary expression that branches on has feature test value(s).
1040 1044 */
1041 1045 normalize(id: string, toAbsMid: Function): string; /* TODO: Align with loader api */
1042 1046
1043 1047 normalizeLocale(locale?: string): string;
1044 1048
1045 1049 /**
1046 1050 * Conditional loading of AMD modules based on a has feature test value.
1047 1051 */
1048 1052 load(id: string, parentRequire: Function, loaded: Function): void; /* TODO: Align with loader api */
1049 1053
1050 1054 cache: { [bundle: string]: any };
1051 1055
1052 1056 getL10nName(moduleName: string, bundleName: string, locale?: string): string;
1053 1057 }
1054 1058
1055 1059 /* dojo/io-query */
1056 1060
1057 1061 interface IoQuery {
1058 1062 /**
1059 1063 * takes a name/value mapping object and returns a string representing
1060 1064 * a URL-encoded version of that object.
1061 1065 */
1062 1066 objectToQuery(map: GenericObject): string;
1063 1067
1064 1068 /**
1065 1069 * Create an object representing a de-serialized query section of a
1066 1070 * URL. Query keys with multiple values are returned in an array.
1067 1071 */
1068 1072 queryToObject(str: string): GenericObject;
1069 1073 }
1070 1074
1071 1075 /* dojo/json */
1072 1076
1073 1077 interface Json {
1074 1078
1075 1079 /**
1076 1080 * Parses a [JSON](http://json.org) string to return a JavaScript object.
1077 1081 */
1078 1082 parse(str: string, strict?: boolean): any;
1079 1083
1080 1084 /**
1081 1085 * Returns a [JSON](http://json.org) serialization of an object.
1082 1086 */
1083 1087 stringify(value: any, replacer?: (key: string, value: any) => any| any[], space?: string | number): string;
1084 1088 }
1085 1089
1086 1090 /* dojo/keys */
1087 1091
1088 1092 interface Keys {
1089 1093 BACKSPACE: number;
1090 1094 TAB: number;
1091 1095 CLEAR: number;
1092 1096 ENTER: number;
1093 1097 SHIFT: number;
1094 1098 CTRL: number;
1095 1099 ALT: number;
1096 1100 META: number;
1097 1101 PAUSE: number;
1098 1102 CAPS_LOCK: number;
1099 1103 ESCAPE: number;
1100 1104 SPACE: number;
1101 1105 PAGE_UP: number;
1102 1106 PAGE_DOWN: number;
1103 1107 END: number;
1104 1108 HOME: number;
1105 1109 LEFT_ARROW: number;
1106 1110 UP_ARROW: number;
1107 1111 RIGHT_ARROW: number;
1108 1112 DOWN_ARROW: number;
1109 1113 INSERT: number;
1110 1114 DELETE: number;
1111 1115 HELP: number;
1112 1116 LEFT_WINDOW: number;
1113 1117 RIGHT_WINDOW: number;
1114 1118 SELECT: number;
1115 1119 NUMPAD_0: number;
1116 1120 NUMPAD_1: number;
1117 1121 NUMPAD_2: number;
1118 1122 NUMPAD_3: number;
1119 1123 NUMPAD_4: number;
1120 1124 NUMPAD_5: number;
1121 1125 NUMPAD_6: number;
1122 1126 NUMPAD_7: number;
1123 1127 NUMPAD_8: number;
1124 1128 NUMPAD_9: number;
1125 1129 NUMPAD_MULTIPLY: number;
1126 1130 NUMPAD_PLUS: number;
1127 1131 NUMPAD_ENTER: number;
1128 1132 NUMPAD_MINUS: number;
1129 1133 NUMPAD_PERIOD: number;
1130 1134 NUMPAD_DIVIDE: number;
1131 1135 F1: number;
1132 1136 F2: number;
1133 1137 F3: number;
1134 1138 F4: number;
1135 1139 F5: number;
1136 1140 F6: number;
1137 1141 F7: number;
1138 1142 F8: number;
1139 1143 F9: number;
1140 1144 F10: number;
1141 1145 F11: number;
1142 1146 F12: number;
1143 1147 F13: number;
1144 1148 F14: number;
1145 1149 F15: number;
1146 1150 NUM_LOCK: number;
1147 1151 SCROLL_LOCK: number;
1148 1152 UP_DPAD: number;
1149 1153 DOWN_DPAD: number;
1150 1154 LEFT_DPAD: number;
1151 1155 RIGHT_DPAD: number;
1152 1156 copyKey: number;
1153 1157 }
1154 1158
1155 1159 /* dojo/loadInit */
1156 1160
1157 1161 interface LoadInit {
1158 1162 dynamic: number;
1159 1163
1160 1164 /**
1161 1165 * Resolves id into a module id based on possibly-nested tenary expression that branches on has feature test value(s).
1162 1166 */
1163 1167 normalize(id: string, toAbsMid: Function): string; /* TODO: Align with loader api */
1164 1168
1165 1169 /**
1166 1170 * Conditional loading of AMD modules based on a has feature test value.
1167 1171 */
1168 1172 load(id: string, parentRequire: Function, loaded: Function): void; /* TODO: Align with loader api */
1169 1173 }
1170 1174
1171 1175 /* dojo/mouse */
1172 1176
1173 1177 interface Mouse {
1174 1178 _eventHandler(type: string, selectHandler?: (evt: MouseEvent, listener: EventListener) => void): MouseEvent;
1175 1179
1176 1180 /**
1177 1181 * This is an extension event for the mouseenter that IE provides, emulating the
1178 1182 * behavior on other browsers.
1179 1183 */
1180 1184 enter: MouseEvent;
1181 1185
1182 1186 /**
1183 1187 * This is an extension event for the mouseleave that IE provides, emulating the
1184 1188 * behavior on other browsers.
1185 1189 */
1186 1190 leave: MouseEvent;
1187 1191
1188 1192 /**
1189 1193 * This is an extension event for the mousewheel that non-Mozilla browsers provide,
1190 1194 * emulating the behavior on Mozilla based browsers.
1191 1195 */
1192 1196 wheel: string | ExtensionEvent;
1193 1197
1194 1198 /**
1195 1199 * Test an event object (from a mousedown event) to see if the left button was pressed.
1196 1200 */
1197 1201 isLeft(e: MouseEvent): boolean;
1198 1202
1199 1203 /**
1200 1204 * Test an event object (from a mousedown event) to see if the middle button was pressed.
1201 1205 */
1202 1206 isMiddle(e: MouseEvent): boolean;
1203 1207
1204 1208 /**
1205 1209 * Test an event object (from a mousedown event) to see if the right button was pressed.
1206 1210 */
1207 1211 isRight(e: MouseEvent): boolean;
1208 1212 }
1209 1213
1210 1214 /* dojo/node */
1211 1215
1212 1216 /* should only be used for re-exporting CommonJS modules */
1213 1217
1214 1218 /* dojo/NodeList */
1215 1219
1216 1220 /* Just proxies dojo/query::NodeList */
1217 1221
1218 1222 /* dojo/NodeList-* are included as seperate .d.ts files */
1219 1223
1220 1224 /* dojo/number */
1221 1225
1222 1226 interface NumberFormatOptions {
1223 1227
1224 1228 /**
1225 1229 * override [formatting pattern](http://www.unicode.org/reports/tr35/#Number_Format_Patterns)
1226 1230 * with this string. Default value is based on locale. Overriding this property will defeat
1227 1231 * localization. Literal characters in patterns are not supported.
1228 1232 */
1229 1233 pattern?: string;
1230 1234
1231 1235 /**
1232 1236 * choose a format type based on the locale from the following:
1233 1237 * decimal, scientific (not yet supported), percent, currency. decimal by default.
1234 1238 */
1235 1239 type?: string;
1236 1240
1237 1241 /**
1238 1242 * fixed number of decimal places to show. This overrides any
1239 1243 * information in the provided pattern.
1240 1244 */
1241 places?: number;
1245 places?: number | string;
1242 1246
1243 1247 /**
1244 1248 * 5 rounds to nearest .5; 0 rounds to nearest whole (default). -1
1245 1249 * means do not round.
1246 1250 */
1247 1251 round?: number;
1248 1252
1249 1253 /**
1250 1254 * override the locale used to determine formatting rules
1251 1255 */
1252 1256 locale?: string;
1253 1257
1254 1258 /**
1255 1259 * If false, show no decimal places, overriding places and pattern settings.
1256 1260 */
1257 1261 fractional?: boolean | [ boolean, boolean ];
1258 1262 }
1259 1263
1260 1264 interface NumberFormatAbsoluteOptions {
1261 1265 /**
1262 1266 * the decimal separator
1263 1267 */
1264 1268 decimal?: string;
1265 1269
1266 1270 /**
1267 1271 * the group separator
1268 1272 */
1269 1273 group?: string;
1270 1274
1271 1275 /**
1272 1276 * number of decimal places. the range "n,m" will format to m places.
1273 1277 */
1274 1278 places?: number | string;
1275 1279
1276 1280 /**
1277 1281 * 5 rounds to nearest .5; 0 rounds to nearest whole (default). -1
1278 1282 * means don't round.
1279 1283 */
1280 1284 round?: number;
1281 1285 }
1282 1286
1283 1287 interface NumberRegexpOptions {
1284 1288
1285 1289 /**
1286 1290 * override [formatting pattern](http://www.unicode.org/reports/tr35/#Number_Format_Patterns)
1287 1291 * with this string. Default value is based on locale. Overriding this property will defeat
1288 1292 * localization.
1289 1293 */
1290 1294 pattern?: string;
1291 1295
1292 1296 /**
1293 1297 * choose a format type based on the locale from the following:
1294 1298 * decimal, scientific (not yet supported), percent, currency. decimal by default.
1295 1299 */
1296 1300 type?: string;
1297 1301
1298 1302 /**
1299 1303 * override the locale used to determine formatting rules
1300 1304 */
1301 1305 locacle?: string;
1302 1306
1303 1307 /**
1304 1308 * strict parsing, false by default. Strict parsing requires input as produced by the format() method.
1305 1309 * Non-strict is more permissive, e.g. flexible on white space, omitting thousands separators
1306 1310 */
1307 1311 strict?: boolean;
1308 1312
1309 1313 /**
1310 1314 * number of decimal places to accept: Infinity, a positive number, or
1311 1315 * a range "n,m". Defined by pattern or Infinity if pattern not provided.
1312 1316 */
1313 1317 places?: number | string;
1314 1318 }
1315 1319
1316 1320 interface NumberParseOptions {
1317 1321
1318 1322 /**
1319 1323 * override [formatting pattern](http://www.unicode.org/reports/tr35/#Number_Format_Patterns)
1320 1324 * with this string. Default value is based on locale. Overriding this property will defeat
1321 1325 * localization. Literal characters in patterns are not supported.
1322 1326 */
1323 1327 pattern?: string;
1324 1328
1325 1329 /**
1326 1330 * choose a format type based on the locale from the following:
1327 1331 * decimal, scientific (not yet supported), percent, currency. decimal by default.
1328 1332 */
1329 1333 type?: string;
1330 1334
1331 1335 /**
1332 1336 * override the locale used to determine formatting rules
1333 1337 */
1334 1338 locale?: string;
1335 1339
1336 1340 /**
1337 1341 * strict parsing, false by default. Strict parsing requires input as produced by the format() method.
1338 1342 * Non-strict is more permissive, e.g. flexible on white space, omitting thousands separators
1339 1343 */
1340 1344 strict?: boolean;
1341 1345
1342 1346 /**
1343 1347 * Whether to include the fractional portion, where the number of decimal places are implied by pattern
1344 1348 * or explicit 'places' parameter. The value [true,false] makes the fractional portion optional.
1345 1349 */
1346 1350 fractional?: boolean | [boolean, boolean];
1347 1351 }
1348 1352
1349 1353 interface RealNumberRegexpFlags {
1350 1354
1351 1355 /**
1352 1356 * The integer number of decimal places or a range given as "n,m". If
1353 1357 * not given, the decimal part is optional and the number of places is
1354 1358 * unlimited.
1355 1359 */
1356 places?: number;
1360 places?: number | string;
1357 1361
1358 1362 /**
1359 1363 * A string for the character used as the decimal point. Default
1360 1364 * is ".".
1361 1365 */
1362 1366 decimal?: string;
1363 1367
1364 1368 /**
1365 1369 * Whether decimal places are used. Can be true, false, or [true,
1366 1370 * false]. Default is [true, false] which means optional.
1367 1371 */
1368 1372 fractional?: boolean | [boolean, boolean];
1369 1373
1370 1374 /**
1371 1375 * Express in exponential notation. Can be true, false, or [true,
1372 1376 * false]. Default is [true, false], (i.e. will match if the
1373 1377 * exponential part is present are not).
1374 1378 */
1375 1379 exponent?: boolean | [boolean, boolean];
1376 1380
1377 1381 /**
1378 1382 * The leading plus-or-minus sign on the exponent. Can be true,
1379 1383 * false, or [true, false]. Default is [true, false], (i.e. will
1380 1384 * match if it is signed or unsigned). flags in regexp.integer can be
1381 1385 * applied.
1382 1386 */
1383 1387 eSigned?: boolean | [boolean, boolean];
1384 1388 }
1385 1389
1386 1390 interface IntegerRegexpFlags {
1387 1391
1388 1392 /**
1389 1393 * The leading plus-or-minus sign. Can be true, false, or `[true,false]`.
1390 1394 * Default is `[true, false]`, (i.e. will match if it is signed
1391 1395 * or unsigned).
1392 1396 */
1393 1397 signed?: boolean;
1394 1398
1395 1399 /**
1396 1400 * The character used as the thousands separator. Default is no
1397 1401 * separator. For more than one symbol use an array, e.g. `[",", ""]`,
1398 1402 * makes ',' optional.
1399 1403 */
1400 1404 separator?: string;
1401 1405
1402 1406 /**
1403 1407 * group size between separators
1404 1408 */
1405 1409 groupSize?: number;
1406 1410
1407 1411 /**
1408 1412 * second grouping, where separators 2..n have a different interval than the first separator (for India)
1409 1413 */
1410 1414 groupSize2?: number;
1411 1415 }
1412 1416
1413 1417 interface Number {
1414 1418 /**
1415 1419 * Format a Number as a String, using locale-specific settings
1416 1420 */
1417 1421 format(value: number, options?: NumberFormatOptions): string;
1418 1422
1419 1423 /**
1420 1424 * not precise, but good enough
1421 1425 */
1422 1426 _numberPatternRE: RegExp;
1423 1427
1424 1428 /**
1425 1429 * Apply pattern to format value as a string using options. Gives no
1426 1430 * consideration to local customs.
1427 1431 */
1428 1432 _applyPattern(value: number, pattern: string, options?: NumberFormatOptions): string;
1429 1433
1430 1434 /**
1431 1435 * Rounds to the nearest value with the given number of decimal places, away from zero
1432 1436 */
1433 1437 round(value: number, places?: number, increment?: number): number;
1434 1438
1435 1439 /**
1436 1440 * Apply numeric pattern to absolute value using options. Gives no
1437 1441 * consideration to local customs.
1438 1442 */
1439 1443 _formatAbsolute(value: number, pattern: string, options?: NumberFormatAbsoluteOptions): string;
1440 1444
1441 1445 /**
1442 1446 * Builds the regular needed to parse a number
1443 1447 */
1444 1448 regexp(options?: NumberRegexpOptions): string;
1445 1449
1446 1450 _parseInfo(options?: any): { regexp: string, group: string, decimal: string, factor: number };
1447 1451
1448 1452 /**
1449 1453 * Convert a properly formatted string to a primitive Number, using
1450 1454 * locale-specific settings.
1451 1455 */
1452 1456 parse(expression: string, options?: NumberParseOptions): number;
1453 1457
1454 1458 /**
1455 1459 * Builds a regular expression to match a real number in exponential
1456 1460 * notation
1457 1461 */
1458 1462 _realNumberRegexp(flags: RealNumberRegexpFlags): string;
1459 1463
1460 1464 /**
1461 1465 * Builds a regular expression that matches an integer
1462 1466 */
1463 1467 _integerRegexp(flags: IntegerRegexpFlags): string;
1464 1468 }
1465 1469
1466 1470 /* dojo/on */
1467 1471
1468 1472 interface ExtensionEvent {
1469 1473 (target: Element | GenericObject, listener: EventListener): Handle;
1470 1474 }
1471 1475
1472 1476 interface PauseHandle extends Handle {
1473 1477 pause(): void;
1474 1478 resume(): void;
1475 1479 }
1476 1480
1477 1481 interface MatchesTarget {
1478 1482 matches(node: Element, selector: string, context?: any): any[];
1479 1483 [id: string]: any;
1480 1484 }
1481 1485
1482 1486 interface On {
1483 1487 /**
1484 1488 * A function that provides core event listening functionality. With this function
1485 1489 * you can provide a target, event type, and listener to be notified of
1486 1490 * future matching events that are fired.
1487 1491 */
1488 1492 (target: Element | GenericObject, type: string | ExtensionEvent, listener: EventListener | Function, dontFix?: boolean): Handle;
1489 1493
1490 1494 /**
1491 1495 * This function acts the same as on(), but with pausable functionality. The
1492 1496 * returned signal object has pause() and resume() functions. Calling the
1493 1497 * pause() method will cause the listener to not be called for future events.
1494 1498 */
1495 1499 pausable(target: Element | GenericObject, type: string | ExtensionEvent, listener: EventListener | Function, dontFix?: boolean): PauseHandle;
1496 1500
1497 1501 /**
1498 1502 * This function acts the same as on(), but will only call the listener once. The
1499 1503 * listener will be called for the first
1500 1504 * event that takes place and then listener will automatically be removed.
1501 1505 */
1502 1506 once(target: Element | GenericObject, type: string | ExtensionEvent, listener: EventListener | Function, dontFix?: boolean): Handle;
1503 1507
1504 1508 parse(target: Element | GenericObject, type: string | ExtensionEvent, listener: EventListener | Function, dontFix: boolean, matchesTarget: Element | GenericObject): Handle;
1505 1509
1506 1510 /**
1507 1511 * Check if a node match the current selector within the constraint of a context
1508 1512 */
1509 1513 matches(node: Element, selector: string, context: Element, children: boolean, matchesTarget?: MatchesTarget): Element | boolean;
1510 1514
1511 1515 /**
1512 1516 * Creates a new extension event with event delegation. This is based on
1513 1517 * the provided event type (can be extension event) that
1514 1518 * only calls the listener when the CSS selector matches the target of the event.
1515 1519 *
1516 1520 * The application must require() an appropriate level of dojo/query to handle the selector.
1517 1521 */
1518 1522 selector(selector: string, type: string | ExtensionEvent, children?: boolean): ExtensionEvent;
1519 1523
1520 1524 /**
1521 1525 * Fires an event on the target object.
1522 1526 */
1523 1527 emit(target: Element | GenericObject, type: string | ExtensionEvent, event?: any): boolean;
1524 1528
1525 1529 /**
1526 1530 * normalizes properties on the event object including event
1527 1531 * bubbling methods, keystroke normalization, and x/y positions
1528 1532 */
1529 1533 _fixEvent(evt: any, sender: any): any;
1530 1534 }
1531 1535
1532 1536 /* dojo/parser */
1533 1537
1534 1538 interface ParserOptions { }
1535 1539
1536 1540 interface ParserObjects {
1537 1541 ctor?: GenericConstructor<any>;
1538 1542 types?: string[];
1539 1543 node: Node;
1540 1544 scripts?: HTMLScriptElement[];
1541 1545 inherited?: { [prop: string]: any; };
1542 1546 }
1543 1547
1544 1548 interface InstancesArray extends Array<any>, promise.Promise<any> {}
1545 1549
1546 1550 interface Parser {
1547 1551 /**
1548 1552 * Clear cached data. Used mainly for benchmarking.
1549 1553 */
1550 1554 _clearCache(): void;
1551 1555
1552 1556 /**
1553 1557 * Convert a `<script type="dojo/method" args="a, b, c"> ... </script>`
1554 1558 * into a function
1555 1559 */
1556 1560 _functionFromScript(node: HTMLScriptElement, attrData: string): Function;
1557 1561
1558 1562 /**
1559 1563 * Takes array of nodes, and turns them into class instances and
1560 1564 * potentially calls a startup method to allow them to connect with
1561 1565 * any children.
1562 1566 */
1563 1567 instantiate(nodes: Node[], mixin?: Object, options?: ParserOptions): any[];
1564 1568
1565 1569 /**
1566 1570 * Takes array of objects representing nodes, and turns them into class instances and
1567 1571 * potentially calls a startup method to allow them to connect with
1568 1572 * any children.
1569 1573 */
1570 1574 _instantiate(nodes: ParserObjects[], mixin?: Object, options?: ParserOptions, returnPromise?: boolean): any[] | promise.Promise<any[]>;
1571 1575
1572 1576 /**
1573 1577 * Calls new ctor(params, node), where params is the hash of parameters specified on the node,
1574 1578 * excluding data-dojo-type and data-dojo-mixins. Does not call startup().
1575 1579 */
1576 1580 construct<T>(
1577 1581 ctor: GenericConstructor<T>,
1578 1582 node: Node, mixin?: Object,
1579 1583 options?: ParserOptions,
1580 1584 scripts?: HTMLScriptElement[],
1581 1585 inherited?: { [prop: string]: any; }
1582 1586 ): promise.Promise<T> | T;
1583 1587
1584 1588 /**
1585 1589 * Scan a DOM tree and return an array of objects representing the DOMNodes
1586 1590 * that need to be turned into widgets.
1587 1591 */
1588 1592 scan(root?: Node, options?: ParserOptions): promise.Promise<ParserObjects[]>;
1589 1593
1590 1594 /**
1591 1595 * Helper for _scanAMD(). Takes a `<script type=dojo/require>bar: "acme/bar", ...</script>` node,
1592 1596 * calls require() to load the specified modules and (asynchronously) assign them to the specified global
1593 1597 * variables, and returns a Promise for when that operation completes.
1594 1598 *
1595 1599 * In the example above, it is effectively doing a require(["acme/bar", ...], function(a){ bar = a; }).
1596 1600 */
1597 1601 _require(script: HTMLScriptElement, options: ParserOptions): promise.Promise<any>;
1598 1602
1599 1603 /**
1600 1604 * Scans the DOM for any declarative requires and returns their values.
1601 1605 */
1602 1606 _scanAmd(root?: Node, options?: ParserOptions): promise.Promise<boolean>;
1603 1607
1604 1608 /**
1605 1609 * Scan the DOM for class instances, and instantiate them.
1606 1610 */
1607 1611 parse(rootNode?: Node, options?: ParserOptions): InstancesArray;
1608 1612 }
1609 1613
1610 1614 /* dojo/query */
1611 1615
1612 1616 interface NodeListFilterCallback<T extends Node> {
1613 1617 (item: T, idx: number, nodeList: this): boolean;
1614 1618 }
1615 1619
1616 1620 type NodeListFilter<T extends Node> = string | NodeListFilterCallback<T>;
1617 1621
1618 1622 interface NodeList<T extends Node> extends ArrayLike<T> {
1619 1623 /**
1620 1624 * decorate an array to make it look like a `dojo/NodeList`.
1621 1625 */
1622 1626 _wrap<U extends Node, V extends Node>(a: U[], parent?: NodeList<V>, NodeListCtor?: NodeListConstructor): NodeList<U>;
1623 1627
1624 1628 _NodeListCtor: NodeListConstructor;
1625 1629 toString(): string;
1626 1630
1627 1631 /**
1628 1632 * private function to hold to a parent NodeList. end() to return the parent NodeList.
1629 1633 */
1630 1634 _stash(parent: Node): this;
1631 1635
1632 1636 /**
1633 1637 * Listen for events on the nodes in the NodeList.
1634 1638 */
1635 1639 on(eventName: string, listener: EventListener): Handle[];
1636 1640
1637 1641 /**
1638 1642 * Ends use of the current `NodeList` by returning the previous NodeList
1639 1643 * that generated the current NodeList.
1640 1644 */
1641 1645 end<U extends Node>(): NodeList<U>;
1642 1646
1643 1647 /**
1644 1648 * Returns a new NodeList, maintaining this one in place
1645 1649 */
1646 1650 slice(begin: number, end?: number): this;
1647 1651
1648 1652 /**
1649 1653 * Returns a new NodeList, manipulating this NodeList based on
1650 1654 * the arguments passed, potentially splicing in new elements
1651 1655 * at an offset, optionally deleting elements
1652 1656 */
1653 1657 splice(index: number, howmany?: number, ...items: T[]): this;
1654 1658
1655 1659 /**
1656 1660 * see `dojo/_base/array.indexOf()`. The primary difference is that the acted-on
1657 1661 * array is implicitly this NodeList
1658 1662 */
1659 1663 indexOf(value: T, fromIndex?: number, findLast?: boolean): number;
1660 1664
1661 1665 /**
1662 1666 * see `dojo/_base/array.lastIndexOf()`. The primary difference is that the
1663 1667 * acted-on array is implicitly this NodeList
1664 1668 */
1665 1669 lastIndexOf(value: T, fromIndex?: number): number;
1666 1670
1667 1671 /**
1668 1672 * see `dojo/_base/array.every()` and the [Array.every
1669 1673 * docs](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/every).
1670 1674 * Takes the same structure of arguments and returns as
1671 1675 * dojo/_base/array.every() with the caveat that the passed array is
1672 1676 * implicitly this NodeList
1673 1677 */
1674 1678 every(callback: (item: T, idx: number, nodeList: this) => boolean | string, thisObj?: Object): boolean;
1675 1679
1676 1680 /**
1677 1681 * Takes the same structure of arguments and returns as
1678 1682 * `dojo/_base/array.some()` with the caveat that the passed array as
1679 1683 * implicitly this NodeList. See `dojo/_base/array.some()` and Mozillaas
1680 1684 * [Array.soas
1681 1685 * documentation](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some).
1682 1686 */
1683 1687 some(callback: (item: T, idx: number, nodeList: this) => boolean | string, thisObj?: Object): boolean;
1684 1688
1685 1689 /**
1686 1690 * Returns a new NodeList comprised of items in this NodeList
1687 1691 * as well as items passed in as parameters
1688 1692 */
1689 1693 concat(...items: T[]): this;
1690 1694
1691 1695 /**
1692 1696 * see `dojo/_base/array.map()`. The primary difference is that the acted-on
1693 1697 * array is implicitly this NodeList and the return is a
1694 1698 * NodeList (a subclass of Array)
1695 1699 */
1696 1700 map<U extends Node>(func: (item: T, idx: number, nodeList: this) => U, obj?: Object): NodeList<U>;
1697 1701
1698 1702 /**
1699 1703 * see `dojo/_base/array.forEach()`. The primary difference is that the acted-on
1700 1704 * array is implicitly this NodeList. If you want the option to break out
1701 1705 * of the forEach loop, use every() or some() instead.
1702 1706 */
1703 1707 forEach(callback: (item: T, idx: number, nodeList: this) => void, thisObj?: Object): this;
1704 1708
1705 1709 /**
1706 1710 * "masks" the built-in javascript filter() method (supported
1707 1711 * in Dojo via `dojo/_base/array.filter`) to support passing a simple
1708 1712 * string filter in addition to supporting filtering function
1709 1713 * objects.
1710 1714 */
1711 1715 filter<U extends Node>(filter: NodeListFilter<T>, thisObj?: Object): NodeList<U>;
1712 1716
1713 1717 /**
1714 1718 * Create a new instance of a specified class, using the
1715 1719 * specified properties and each node in the NodeList as a
1716 1720 * srcNodeRef.
1717 1721 */
1718 1722 instantiate(declaredClass: string | GenericConstructor<any>, properties?: Object): this;
1719 1723
1720 1724 /**
1721 1725 * Returns a new NodeList comprised of items in this NodeList
1722 1726 * at the given index or indices.
1723 1727 */
1724 1728 at(...indices: number[]): this;
1725 1729
1726 1730 }
1727 1731
1728 1732 interface NodeListConstructor {
1729 1733 new <T extends Node>(array: number | Array<T> | NodeListOf<T>): NodeList<T>;
1730 1734 new <T extends Node>(...args: T[]): NodeList<T>;
1731 1735 <T extends Node>(array: number | Array<T> | NodeListOf<T>): NodeList<T>;
1732 1736 <T extends Node>(...args: T[]): NodeList<T>;
1733 1737
1734 1738 prototype: NodeList<any>;
1735 1739
1736 1740 /**
1737 1741 * decorate an array to make it look like a `dojo/NodeList`.
1738 1742 */
1739 1743 _wrap<U extends Node, V extends Node>(a: U[], parent?: NodeList<V>, NodeListCtor?: NodeListConstructor): NodeList<U>;
1740 1744
1741 1745 /**
1742 1746 * adapts a single node function to be used in the map-type
1743 1747 * actions. The return is a new array of values, as via `dojo/_base/array.map`
1744 1748 */
1745 1749 _adaptAsMap<T extends Node, U extends Node>(f: (node: T) => U, o?: Object): NodeList<U>;
1746 1750
1747 1751 /**
1748 1752 * adapts a single node function to be used in the forEach-type
1749 1753 * actions. The initial object is returned from the specialized
1750 1754 * function.
1751 1755 */
1752 1756 _adaptAsForEach<T extends Node>(f: (node: T) => void, o?: Object): this;
1753 1757
1754 1758 /**
1755 1759 * adapts a single node function to be used in the filter-type actions
1756 1760 */
1757 1761 _adaptAsFilter<T extends Node>(f: (node: T) => boolean, o?: Object): this;
1758 1762
1759 1763 /**
1760 1764 * adapts a single node function to be used in the map-type
1761 1765 * actions, behaves like forEach() or map() depending on arguments
1762 1766 */
1763 1767 _adaptWithCondition<T extends Node, U extends Node>(f: (node: T) => U | void, g: (...args: any[]) => boolean, o?: Object): NodeList<U> | this;
1764 1768 }
1765 1769
1766 1770 interface Query {
1767 1771 /**
1768 1772 * Returns nodes which match the given CSS selector, searching the
1769 1773 * entire document by default but optionally taking a node to scope
1770 1774 * the search by. Returns an instance of NodeList.
1771 1775 */
1772 1776 <T extends Node>(query: string, root?: NodeOrString): NodeList<T>;
1773 1777 <T extends Node>(root: Node): NodeList<T>;
1774 1778
1775 1779 NodeList: NodeListConstructor;
1776 1780
1777 1781 /**
1778 1782 * Test to see if a node matches a selector
1779 1783 */
1780 1784 matches(node: Node, selector: string, root?: NodeOrString): boolean;
1781 1785
1782 1786 /**
1783 1787 * Filters an array of nodes. Note that this does not guarantee to return a NodeList, just an array.
1784 1788 */
1785 1789 filter<T extends Node>(nodes: NodeList<T> | T[], select: string, root?: NodeOrString): T[] | NodeList<T>;
1786 1790
1787 1791 /**
1788 1792 * can be used as AMD plugin to conditionally load new query engine
1789 1793 */
1790 1794 load(id: string, parentRequire: Function, loaded: Function): void; /* TODO: Align with loader api */
1791 1795 }
1792 1796
1793 1797 /* dojo/ready */
1794 1798
1795 1799 interface Ready {
1796 1800 /**
1797 1801 * Add a function to execute on DOM content loaded and all requested modules have arrived and been evaluated.
1798 1802 * In most cases, the `domReady` plug-in should suffice and this method should not be needed.
1799 1803 *
1800 1804 * When called in a non-browser environment, just checks that all requested modules have arrived and been
1801 1805 * evaluated.
1802 1806 */
1803 1807 (callback: Function): void;
1804 1808 (context: Object, callback: Function | string): void;
1805 1809 (priority: number, callback: Function): void;
1806 1810 (priority: number, context: Object, callback: Function | string): void;
1807 1811 }
1808 1812
1809 1813 /* dojo/regexp */
1810 1814
1811 1815 interface RegExpModule {
1812 1816 /**
1813 1817 * Adds escape sequences for special characters in regular expressions
1814 1818 */
1815 1819 escapeString(str: string, except?: string): string;
1816 1820
1817 1821 /**
1818 1822 * Builds a regular expression that groups subexpressions
1819 1823 */
1820 1824 buildGroupRE(arr: any[] | Object, re: (item: any) => string, nonCapture?: boolean): string;
1821 1825
1822 1826 /**
1823 1827 * adds group match to expression
1824 1828 */
1825 1829 group(expression: string, nonCapture?: boolean): string;
1826 1830 }
1827 1831
1828 1832 /* dojo/request */
1829 1833
1830 1834 /* This is contained in request.d.ts */
1831 1835
1832 1836 /* dojo/require */
1833 1837
1834 1838 interface RequirePlugin {
1835 1839 dynamic: number;
1836 1840 normalize(id: string): string;
1837 1841 load(mid: string, require: any, loaded: (...modules: any[]) => void): void;
1838 1842 }
1839 1843
1840 1844 /* dojo/robot */
1841 1845
1842 1846 interface Robot extends doh.Robot {
1843 1847 _resolveNode(n: NodeOrString | (() => Node)): Node;
1844 1848 _scrollIntoView(n: Node): void;
1845 1849 _position(n: Node): DomGeometryBoxExtents;
1846 1850 _getWindowChain(n: Node): Window[];
1847 1851
1848 1852 /**
1849 1853 * Scroll the passed node into view, if it is not.
1850 1854 */
1851 1855 scrollIntoView(node: NodeOrString | (() => Node), delay?: number): void;
1852 1856
1853 1857 /**
1854 1858 * Moves the mouse over the specified node at the specified relative x,y offset.
1855 1859 */
1856 1860 mouseMoveAt(
1857 1861 node: NodeOrString | (() => Node),
1858 1862 delay?: number,
1859 1863 duration?: number,
1860 1864 offsetX?: number,
1861 1865 offsetY?: number
1862 1866 ): void;
1863 1867 }
1864 1868
1865 1869 /* dojo/robotx */
1866 1870
1867 1871 interface RobotX extends Robot {
1868 1872 /**
1869 1873 * Called every time a new page is loaded into the iframe, to setup variables
1870 1874 * Point dojo.global, dojo.publish, etc. to refer to iframe.
1871 1875 * Remove for 2.0?
1872 1876 */
1873 1877 _updateDocument(): void;
1874 1878
1875 1879 /**
1876 1880 * Opens the application at the specified URL for testing, redirecting dojo to point to the application
1877 1881 * environment instead of the test environment.
1878 1882 */
1879 1883 initRobot(url: string): void;
1880 1884
1881 1885 /**
1882 1886 * Notifies DOH that the doh.robot is about to make a page change in the application it is driving,
1883 1887 * returning a doh.Deferred object the user should return in their runTest function as part of a DOH test.
1884 1888 */
1885 1889 waitForPageToLoad(submitActions: () => void): any;
1886 1890 }
1887 1891
1888 1892 /* dojo/router */
1889 1893
1890 1894 /* Module just exports instance of dojo.router.BaseRouter */
1891 1895
1892 1896 /* dojo/sniff */
1893 1897
1894 1898 interface Has {
1895 1899 (name: 'air'): boolean;
1896 1900 (name: 'wp'): void | number;
1897 1901 (name: 'msapp'): void | number;
1898 1902 (name: 'khtml'): void | number;
1899 1903 (name: 'edge'): void | number;
1900 1904 (name: 'opr'): void | number;
1901 1905 (name: 'webkit'): void | number;
1902 1906 (name: 'chrome'): void | number;
1903 1907 (name: 'android'): void | number;
1904 1908 (name: 'safari'): void | number;
1905 1909 (name: 'mac'): boolean;
1906 1910 (name: 'quirks'): boolean;
1907 1911 (name: 'iphone'): void | number;
1908 1912 (name: 'ipod'): void | number;
1909 1913 (name: 'ipad'): void | number;
1910 1914 (name: 'ios'): void | number;
1911 1915 (name: 'bb'): void | number | boolean;
1912 1916 (name: 'trident'): void | number;
1913 1917 (name: 'svg'): boolean;
1914 1918 (name: 'opera'): void | number;
1915 1919 (name: 'mozilla'): void | number;
1916 1920 (name: 'ff'): void | number;
1917 1921 (name: 'ie'): void | number;
1918 1922 (name: 'wii'): boolean | any;
1919 1923 }
1920 1924
1921 1925 /* Just rexports has after adding features */
1922 1926
1923 1927 /* dojo/Stateful */
1924 1928
1925 1929 interface WatchHandle extends Handle {
1926 1930 unwatch(): void;
1927 1931 }
1928 1932
1929 1933 interface Stateful<T = any> {
1930 1934 /**
1931 1935 * Used across all instances a hash to cache attribute names and their getter
1932 1936 * and setter names.
1933 1937 */
1934 1938 _attrPairNames: { [attr: string]: string };
1935 1939
1936 1940 /**
1937 1941 * Helper function for get() and set().
1938 1942 * Caches attribute name values so we don't do the string ops every time.
1939 1943 */
1940 1944 _getAttrNames(name: string): string;
1941 1945
1942 1946 /**
1943 1947 * Automatic setting of params during construction
1944 1948 */
1945 1949 postscript(params?: Object): void;
1946 1950
1947 1951 /**
1948 1952 * Get a property on a Stateful instance.
1949 1953 */
1950 1954 get<K extends keyof T & string>(name: K): T[K];
1951 1955
1952 1956 /**
1953 1957 * Set a property on a Stateful instance
1954 1958 */
1955 1959 set<K extends keyof T & string>(name: K, value: T[K]): this;
1956 1960 set<K extends { [p in keyof T]: T[p] extends any[] ? p : never; }[keyof T & string] >(name: K, ...values: T[K]): this;
1957 1961 set(values: Partial<T>): this;
1958 1962
1959 1963 /**
1960 1964 * Internal helper for directly changing an attribute value.
1961 1965 */
1962 1966 _changeAttrValue(name: string, value: any): this;
1963 1967
1964 1968 /**
1965 1969 * Watches a property for changes
1966 1970 */
1967 1971 watch(callback:(prop: keyof any, oldValue: any, newValue: any) => void): WatchHandle;
1968 1972 watch<K extends keyof T>(name: K, callback: (prop: K, oldValue: T[K], newValue: T[K]) => void): WatchHandle;
1969 1973 }
1970 1974
1971 1975 interface StatefulConstructor extends _base.DeclareConstructor<Stateful> {
1972 1976 new <T>(params?: Partial<T>): Stateful<T>;
1973 1977 }
1974 1978
1975 1979 /* dojo/string */
1976 1980
1977 1981 interface String {
1978 1982
1979 1983 /**
1980 1984 * Efficiently escape a string for insertion into HTML (innerHTML or attributes), replacing &, <, >, ", ', and / characters.
1981 1985 */
1982 1986 escape(str: string): string;
1983 1987
1984 1988 /**
1985 1989 * Efficiently replicate a string `n` times.
1986 1990 */
1987 1991 rep(str: string, num: number): string;
1988 1992
1989 1993 /**
1990 1994 * Pad a string to guarantee that it is at least `size` length by
1991 1995 * filling with the character `ch` at either the start or end of the
1992 1996 * string. Pads at the start, by default.
1993 1997 */
1994 1998 pad(text: string, size: number, ch?: string, end?: boolean): string;
1995 1999
1996 2000 /**
1997 2001 * Performs parameterized substitutions on a string. Throws an
1998 2002 * exception if any parameter is unmatched.
1999 2003 */
2000 2004 substitute(template: string, map: Object | any[], transform?: (value: any, key: string) => any, thisObject?: Object): string;
2001 2005
2002 2006 /**
2003 2007 * Trims whitespace from both sides of the string
2004 2008 */
2005 2009 trim(str: string): string;
2006 2010 }
2007 2011
2008 2012 /* dojo/text */
2009 2013
2010 2014 /**
2011 2015 * A getter and setter for storing the string content associated with the
2012 2016 * module and url arguments.
2013 2017 */
2014 2018 interface Cache {
2015 2019 (module: string | GenericObject, url: string, value?: string | { value: string, sanitize?: boolean }): string;
2016 2020 }
2017 2021
2018 2022 interface Text {
2019 2023 /**
2020 2024 * the dojo/text caches it's own resources because of dojo.cache
2021 2025 */
2022 2026 dynamic: boolean;
2023 2027
2024 2028 normalize(id: string, toAbsMid: Function): string; /* TODO: Align with loader api */
2025 2029
2026 2030 load(id: string, parentRequire: Function, loaded: Function): void; /* TODO: Align with loader api */
2027 2031 }
2028 2032
2029 2033 /* dojo/throttle */
2030 2034
2031 2035 interface Throttle {
2032 2036 <T extends Function>(cb: T, wait: number): T;
2033 2037 }
2034 2038
2035 2039 /* dojo/topic */
2036 2040
2037 2041 interface Topic {
2038 2042 /**
2039 2043 * Publishes a message to a topic on the pub/sub hub. All arguments after
2040 2044 * the first will be passed to the subscribers, so any number of arguments
2041 2045 * can be provided (not just event).
2042 2046 */
2043 2047 publish(topic: string | ExtensionEvent, ...event: any[]): boolean;
2044 2048
2045 2049 /**
2046 2050 * Subscribes to a topic on the pub/sub hub
2047 2051 */
2048 2052 subscribe(topic: string | ExtensionEvent, listener: EventListener | Function): Handle;
2049 2053 }
2050 2054
2051 2055 /* dojo/touch */
2052 2056
2053 2057 interface Touch {
2054 2058 press: ExtensionEvent;
2055 2059 move: ExtensionEvent;
2056 2060 release: ExtensionEvent;
2057 2061 cancel: ExtensionEvent;
2058 2062 over: ExtensionEvent;
2059 2063 out: ExtensionEvent;
2060 2064 enter: ExtensionEvent;
2061 2065 leave: ExtensionEvent;
2062 2066 }
2063 2067
2064 2068 /* dojo/uacss */
2065 2069
2066 2070 /* rexports has after adding classes to dom */
2067 2071
2068 2072 /* dojo/when */
2069 2073
2070 2074 interface When {
2071 2075 /**
2072 2076 * Transparently applies callbacks to values and/or promises.
2073 2077 */
2074 2078 <T>(value: T | dojo.promise.Promise<T>): dojo.promise.Promise<T>;
2075 2079 <T>(value: T | dojo.promise.Promise<T>,
2076 2080 callback?: dojo.promise.PromiseCallback<T, T>,
2077 2081 errback?: dojo.promise.PromiseErrback<T>,
2078 2082 progress?: dojo.promise.PromiseProgback): T | dojo.promise.Promise<T>;
2079 2083 <T, U>(value: T | dojo.promise.Promise<T>,
2080 2084 callback?: dojo.promise.PromiseCallback<T, U>,
2081 2085 errback?: dojo.promise.PromiseErrback<U>,
2082 2086 progress?: dojo.promise.PromiseProgback): U | dojo.promise.Promise<U>;
2083 2087 }
2084 2088
2085 2089 /* dojo/window */
2086 2090
2087 2091 interface WindowModule {
2088 2092
2089 2093 /**
2090 2094 * Returns the dimensions and scroll position of the viewable area of a browser window
2091 2095 */
2092 2096 getBox(doc?: Document): DomGeometryBox;
2093 2097
2094 2098 /**
2095 2099 * Get window object associated with document doc.
2096 2100 */
2097 2101 get(doc?: Document): Window;
2098 2102
2099 2103 /**
2100 2104 * Scroll the passed node into view using minimal movement, if it is not already.
2101 2105 */
2102 2106 scrollIntoView(node: Element, pos?: DomGeometryXYBox): void;
2103 2107 }
2104 2108 }
@@ -1,824 +1,824
1 1 /// <reference path="index.d.ts" />
2 2
3 3 declare module 'dojo/_base/array' {
4 4 const dojoArray: dojo._base.Array;
5 5 export = dojoArray;
6 6 }
7 7
8 8 declare module 'dojo/_base/browser' {
9 9 const ready: dojo.Ready;
10 10 export = ready;
11 11 }
12 12
13 13 declare module 'dojo/_base/Color' {
14 14 type Color = dojo._base.Color;
15 15 const Color: dojo._base.ColorConstructor;
16 16 export = Color;
17 17 }
18 18
19 19 declare module 'dojo/_base/config' {
20 20 const config: dojo._base.Config;
21 21 export = config;
22 22 }
23 23
24 24 declare module 'dojo/_base/connect' {
25 25 const connect: dojo._base.Connect;
26 26 export = connect;
27 27 }
28 28
29 29 declare module 'dojo/_base/declare' {
30 30 const dojoDeclare: dojo._base.Declare;
31 31 export = dojoDeclare;
32 32 }
33 33
34 34 declare module 'dojo/_base/Deferred' {
35 35 type Deferred<T> = dojo._base.Deferred<T>;
36 36 const Deferred: dojo._base.DeferredConstructor;
37 37 export = Deferred;
38 38 }
39 39
40 40 declare module 'dojo/_base/event' {
41 41 const event: dojo._base.EventModule;
42 42 export = event;
43 43 }
44 44
45 45 declare module 'dojo/_base/fx' {
46 46 const fx: dojo._base.Fx;
47 47 export = fx;
48 48 }
49 49
50 50 declare module 'dojo/_base/html' {
51 51 const dojo: dojo._base.Dojo;
52 52 export = dojo;
53 53 }
54 54
55 55 declare module 'dojo/_base/json' {
56 56 const dojo: dojo._base.Dojo;
57 57 export = dojo;
58 58 }
59 59
60 60 declare module 'dojo/_base/kernel' {
61 61 const dojo: dojo._base.Dojo;
62 62 export = dojo;
63 63 }
64 64
65 65 declare module 'dojo/_base/lang' {
66 66 const lang: dojo._base.Lang;
67 67 export = lang;
68 68 }
69 69
70 70 declare module 'dojo/_base/loader' {
71 71 const loader: dojo._base.Loader;
72 72 export = loader;
73 73 }
74 74
75 75 declare module 'dojo/_base/NodeList' {
76 76 type NodeList<T extends Node> = dojo.NodeList<T>;
77 77 const NodeList: dojo.NodeListConstructor;
78 78 export = NodeList;
79 79 }
80 80
81 81 declare module 'dojo/_base/query' {
82 82 const query: dojo.Query;
83 83 export = query;
84 84 }
85 85
86 86 declare module 'dojo/_base/sniff' {
87 87 const has: dojo.Has;
88 88 export = has;
89 89 }
90 90
91 91 declare module 'dojo/_base/unload' {
92 92 const unload: dojo._base.Unload;
93 93 export = unload;
94 94 }
95 95
96 96 declare module 'dojo/_base/url' {
97 97 type Url = dojo._base.Url;
98 98 const Url: dojo._base.UrlConstructor;
99 99 export = Url;
100 100 }
101 101
102 102 declare module 'dojo/_base/window' {
103 103 const window: dojo._base.Window;
104 104 export = window;
105 105 }
106 106
107 107 declare module 'dojo/_base/xhr' {
108 108 const xhr: dojo._base.Xhr;
109 109 export = xhr;
110 110 }
111 111
112 112 declare module 'dojo/AdapterRegistry' {
113 113 type AdapterRegistry = dojo.AdapterRegistry;
114 114 const AdapterRegistry: dojo.AdapterRegistryConstructor;
115 115 export = AdapterRegistry;
116 116 }
117 117
118 118 declare module 'dojo/aspect' {
119 119 const aspect: dojo.Aspect;
120 120 export = aspect;
121 121 }
122 122
123 123 declare module 'dojo/back' {
124 124 const back: dojo.Back;
125 125 export = back;
126 126 }
127 127
128 128 declare module 'dojo/behavior' {
129 129 const behavior: dojo.Behavior;
130 130 export = behavior;
131 131 }
132 132
133 133 declare module 'dojo/cache' {
134 134 const cache: dojo.Cache;
135 135 export = cache;
136 136 }
137 137
138 138 declare module 'dojo/cldr/monetary' {
139 139 const monetary: dojo.cldr.Monetary;
140 140 export = monetary;
141 141 }
142 142
143 143 declare module 'dojo/cldr/supplemental' {
144 144 const supplemental: dojo.cldr.Supplemental;
145 145 export = supplemental;
146 146 }
147 147
148 148 declare module 'dojo/colors' {
149 149 type Color = dojo._base.Color;
150 150 const Color: dojo._base.ColorConstructor;
151 151 export = Color;
152 152 }
153 153
154 154 declare module 'dojo/cookie' {
155 155 const cookie: dojo.Cookie;
156 156 export = cookie;
157 157 }
158 158
159 159 declare module 'dojo/currency' {
160 160 const currency: dojo.Currency;
161 161 export = currency;
162 162 }
163 163
164 164 declare module 'dojo/data/api/Identity' {
165 165 type Identity<T> = dojo.data.api.Identity<T>;
166 166 const Identity: dojo.data.api.IdentityConstructor;
167 167 export = Identity;
168 168 }
169 169
170 170 declare module 'dojo/data/api/Item' {
171 171 type Item = dojo.data.api.Item;
172 172 const Item: dojo.data.api.ItemConstructor;
173 173 export = Item;
174 174 }
175 175
176 176 declare module 'dojo/data/api/Notification' {
177 177 type Notification<T> = dojo.data.api.Notification<T>;
178 178 const Notification: dojo.data.api.NotificationConstructor;
179 179 export = Notification;
180 180 }
181 181
182 182 declare module 'dojo/data/api/Read' {
183 183 type Read<T> = dojo.data.api.Read<T>;
184 184 const Read: dojo.data.api.ReadConstructor;
185 185 export = Read;
186 186 }
187 187
188 188 declare module 'dojo/data/api/Request' {
189 189 type Request = dojo.data.api.Request;
190 190 const Request: dojo.data.api.RequestConstructor;
191 191 export = Request;
192 192 }
193 193
194 194 declare module 'dojo/data/api/Write' {
195 195 type Write<T> = dojo.data.api.Write<T>;
196 196 const Write: dojo.data.api.WriteConstructor;
197 197 export = Write;
198 198 }
199 199
200 200 declare module 'dojo/data/util/filter' {
201 201 const filter: dojo.data.util.Filter;
202 202 export = filter;
203 203 }
204 204
205 205 declare module 'dojo/data/util/simpleFetch' {
206 206 const simpleFetch: dojo.data.util.SimpleFetch;
207 207 export = simpleFetch;
208 208 }
209 209
210 210 declare module 'dojo/data/util/sorter' {
211 211 const sorter: dojo.data.util.Sorter;
212 212 export = sorter;
213 213 }
214 214
215 215 declare module 'dojo/data/ItemFileReadStore' {
216 216 type ItemFileReadStore<T> = dojo.data.ItemFileReadStore<T>;
217 217 const ItemFileReadStore: dojo.data.ItemFileReadStoreConstructor;
218 218 export = ItemFileReadStore;
219 219 }
220 220
221 221 declare module 'dojo/data/ItemFileWriteStore' {
222 222 type ItemFileWriteStore<T> = dojo.data.ItemFileWriteStore<T>;
223 223 const ItemFileWriteStore: dojo.data.ItemFileWriteStoreConstructor;
224 224 export = ItemFileWriteStore;
225 225 }
226 226
227 227 declare module 'dojo/data/ObjectStore' {
228 228 type ObjectStore<T> = dojo.data.ObjectStore<T>;
229 229 const ObjectStore: dojo.data.ObjectStoreConstructor;
230 230 export = ObjectStore;
231 231 }
232 232
233 233 declare module 'dojo/date' {
234 234 const date: dojo.date.DateBase;
235 235 export = date;
236 236 }
237 237
238 238 declare module 'dojo/date/locale' {
239 239 const dateLocale: dojo.date.DateLocale;
240 240 export = dateLocale;
241 241 }
242 242
243 243 declare module 'dojo/date/stamp' {
244 244 const stamp: dojo.date.Stamp;
245 245 export = stamp;
246 246 }
247 247
248 248 declare module 'dojo/debounce' {
249 249 const debounce: dojo.Debounce;
250 250 export = debounce;
251 251 }
252 252
253 253 declare module 'dojo/Deferred' {
254 254 type Deferred<T> = dojo.Deferred<T>;
255 255 const Deferred: dojo.DeferredConstructor;
256 256 export = Deferred;
257 257 }
258 258
259 259 declare module 'dojo/DeferredList' {
260 260 type DeferredList<T> = dojo.DeferredList<T>;
261 261 const DeferredList: dojo.DeferredListConstructor;
262 262 export = DeferredList;
263 263 }
264 264
265 265 declare module 'dojo/dnd/autoscroll' {
266 266 const autoscroll: dojo.dnd.AutoScroll;
267 267 export = autoscroll;
268 268 }
269 269
270 270 declare module 'dojo/dnd/AutoSource' {
271 271 const AutoSource: dojo.dnd.AutoSourceConstructor;
272 272 export = AutoSource;
273 273 }
274 274
275 275 declare module 'dojo/dnd/Avatar' {
276 276 type Avatar = dojo.dnd.Avatar;
277 277 const Avatar: dojo.dnd.AvatarConstructor;
278 278 export = Avatar;
279 279 }
280 280
281 281 declare module 'dojo/dnd/common' {
282 282 const common: dojo.dnd.Common;
283 283 export = common;
284 284 }
285 285
286 286 declare module 'dojo/dnd/Container' {
287 287 type Container = dojo.dnd.Container;
288 288 const Container: dojo.dnd.ContainerConstructor;
289 289 export = Container;
290 290 }
291 291
292 292 declare module 'dojo/dnd/Manager' {
293 293 type Manager = dojo.dnd.Manager;
294 294 const Manager: dojo.dnd.ManagerConstructor;
295 295 export = Manager;
296 296 }
297 297
298 298 declare module 'dojo/dnd/move' {
299 299 const Move: dojo.dnd.Move;
300 300 export = Move;
301 301 }
302 302
303 303 declare module 'dojo/dnd/Moveable' {
304 304 type Moveable = dojo.dnd.Moveable;
305 305 const Moveable: dojo.dnd.Moveable;
306 306 export = Moveable;
307 307 }
308 308
309 309 declare module 'dojo/dnd/Mover' {
310 310 type Mover = dojo.dnd.Mover;
311 311 const Mover: dojo.dnd.MoverConstructor;
312 312 export = Mover;
313 313 }
314 314
315 315 declare module 'dojo/dnd/Selector' {
316 316 type Selector = dojo.dnd.Selector;
317 317 const Selector: dojo.dnd.SelectorConstructor;
318 318 export = Selector;
319 319 }
320 320
321 321 declare module 'dojo/dnd/Source' {
322 322 type Source = dojo.dnd.Source;
323 323 const Source: dojo.dnd.SourceConstructor;
324 324 export = Source;
325 325 }
326 326
327 327 declare module 'dojo/dnd/Target' {
328 328 type Target = dojo.dnd.Target;
329 329 const Target: dojo.dnd.TargetConstructor;
330 330 export = Target;
331 331 }
332 332
333 333 declare module 'dojo/dnd/TimedMoveable' {
334 334 type TimedMoveable = dojo.dnd.TimedMoveable;
335 335 const TimedMoveable: dojo.dnd.TimedMoveableConstructor;
336 336 export = TimedMoveable;
337 337 }
338 338
339 339 declare module 'dojo/dojo' {
340 340 const require: dojo.Require;
341 341 export = require;
342 342 }
343 343
344 344 declare module 'require' {
345 345 const require: dojo.Require;
346 346 export = require;
347 347 }
348 348
349 349 declare module 'dojo/dom' {
350 350 const dom: dojo.Dom;
351 351 export = dom;
352 352 }
353 353
354 354 declare module 'dojo/dom-attr' {
355 355 const domAttr: dojo.DomAttr;
356 356 export = domAttr;
357 357 }
358 358
359 359 declare module 'dojo/dom-class' {
360 360 const domClass: dojo.DomClass;
361 361 export = domClass;
362 362 }
363 363
364 364 declare module 'dojo/dom-construct' {
365 365 const domConstruct: dojo.DomConstruct;
366 366 export = domConstruct;
367 367 }
368 368
369 369 declare module 'dojo/dom-form' {
370 370 const domForm: dojo.DomForm;
371 371 export = domForm;
372 372 }
373 373
374 374 declare module 'dojo/dom-geometry' {
375 375 const domGeom: dojo.DomGeometry;
376 376 export = domGeom;
377 377 }
378 378
379 379 declare module 'dojo/dom-prop' {
380 380 const domProp: dojo.DomProp;
381 381 export = domProp;
382 382 }
383 383
384 384 declare module 'dojo/dom-style' {
385 385 const domStyle: dojo.DomStyle;
386 386 export = domStyle;
387 387 }
388 388
389 389 declare module 'dojo/domReady' {
390 390 const domReady: dojo.DomReady;
391 391 export = domReady;
392 392 }
393 393
394 394 declare module 'dojo/domReady!' {
395 395 const callback: any;
396 396 export = callback;
397 397 }
398 398
399 399 declare module 'dojo/errors/CancelError' {
400 400 type CancelError = dojo.errors.CancelError;
401 401 const CancelError: dojo.errors.CancelErrorConstructor;
402 402 export = CancelError;
403 403 }
404 404
405 405 declare module 'dojo/errors/create' {
406 406 const create: dojo.errors.Create;
407 407 export = create;
408 408 }
409 409
410 410 declare module 'dojo/errors/RequestError' {
411 411 type RequestError = dojo.errors.RequestError;
412 412 const RequestError: dojo.errors.RequestErrorConstructor;
413 413 export = RequestError;
414 414 }
415 415
416 416 declare module 'dojo/errors/RequestTimeoutError' {
417 417 type RequestTimeoutError = dojo.errors.RequestError;
418 418 const RequestTimeoutError: dojo.errors.RequestTimeoutErrorConstructor;
419 419 export = RequestTimeoutError;
420 420 }
421 421
422 422 declare module 'dojo/Evented' {
423 type Evented = dojo.Evented;
423 type Evented<T> = dojo.Evented<T>;
424 424 const Evented: dojo.EventedConstructor;
425 425 export = Evented;
426 426 }
427 427
428 428 declare module 'dojo/gears' {
429 429 const gears: dojo.Gears;
430 430 export = gears;
431 431 }
432 432
433 433 declare module 'dojo/has' {
434 434 const has: dojo.Has;
435 435 export = has;
436 436 }
437 437
438 438 declare module 'dojo/hash' {
439 439 const hash: dojo.Hash;
440 440 export = hash;
441 441 }
442 442
443 443 declare module 'dojo/hccss' {
444 444 const hccss: dojo.Has;
445 445 export = hccss;
446 446 }
447 447
448 448 declare module 'dojo/html' {
449 449 const html: dojo.Html;
450 450 export = html;
451 451 }
452 452
453 453 declare module 'dojo/i18n' {
454 454 const i18n: dojo.I18n;
455 455 export = i18n;
456 456 }
457 457
458 458 declare module 'dojo/io/iframe' {
459 459 const iframe: dojo.io.IFrame;
460 460 export = iframe;
461 461 }
462 462
463 463 declare module 'dojo/io/script' {
464 464 const script: dojo.io.Script;
465 465 export = script;
466 466 }
467 467
468 468 declare module 'dojo/io-query' {
469 469 const ioQuery: dojo.IoQuery;
470 470 export = ioQuery;
471 471 }
472 472
473 473 declare module 'dojo/json' {
474 474 const json: dojo.Json;
475 475 export = json;
476 476 }
477 477
478 478 declare module 'dojo/keys' {
479 479 const keys: dojo.Keys;
480 480 export = keys;
481 481 }
482 482
483 483 declare module 'dojo/loadInit' {
484 484 const loadInit: dojo.LoadInit;
485 485 export = loadInit;
486 486 }
487 487
488 488 declare module 'dojo/loadInit!' {
489 489 const loadInit: (mid: string, require: any, loaded: (...modules: any[]) => void) => void;
490 490 export = loadInit;
491 491 }
492 492
493 493 declare module 'dojo/main' {
494 494 const main: dojo._base.Dojo;
495 495 export = main;
496 496 }
497 497
498 498 declare module 'dojo/mouse' {
499 499 const mouse: dojo.Mouse;
500 500 export = mouse;
501 501 }
502 502
503 503 declare module 'dojo/NodeList' {
504 504 type NodeList<T extends Node> = dojo.NodeList<T>;
505 505 const NodeList: dojo.NodeListConstructor;
506 506 export = NodeList;
507 507 }
508 508
509 509 declare module 'dojo/number' {
510 510 const value: dojo.Number;
511 511 export = value;
512 512 }
513 513
514 514 declare module 'dojo/on' {
515 515 const on: dojo.On;
516 516 export = on;
517 517 }
518 518
519 519 declare module 'dojo/on/asyncEventListener' {
520 520 const asyncEventListener: dojo.on.AsyncEventListener;
521 521 export = asyncEventListener;
522 522 }
523 523
524 524 declare module 'dojo/on/debounce' {
525 525 const debounce: dojo.on.Debounce;
526 526 export = debounce;
527 527 }
528 528
529 529 declare module 'dojo/on/throttle' {
530 530 const throttle: dojo.on.Throttle;
531 531 export = throttle;
532 532 }
533 533
534 534 declare module 'dojo/parser' {
535 535 const parser: dojo.Parser;
536 536 export = parser;
537 537 }
538 538
539 539 declare module 'dojo/promise/all' {
540 540 const all: dojo.promise.All;
541 541 export = all;
542 542 }
543 543
544 544 declare module 'dojo/promise/first' {
545 545 const first: dojo.promise.First;
546 546 export = first;
547 547 }
548 548
549 549 declare module 'dojo/promise/instrumentation' {
550 550 const instrumentation: dojo.promise.Instrumentation;
551 551 export = instrumentation;
552 552 }
553 553
554 554 declare module 'dojo/promise/Promise' {
555 555 type Promise<T> = dojo.promise.Promise<T>;
556 556 const Promise: dojo.promise.PromiseConstructor;
557 557 export = Promise;
558 558 }
559 559
560 560 declare module 'dojo/promise/tracer' {
561 561 const tracer: dojo.promise.Tracer;
562 562 export = tracer;
563 563 }
564 564
565 565 declare module 'dojo/query' {
566 566 const query: dojo.Query;
567 567 export = query;
568 568 }
569 569
570 570 /* modules for included selector engines */
571 571
572 572 declare module 'dojo/query!acme' {
573 573 const query: dojo.Query;
574 574 export = query;
575 575 }
576 576
577 577 declare module 'dojo/query!lite' {
578 578 const query: dojo.Query;
579 579 export = query;
580 580 }
581 581
582 582 declare module 'dojo/ready' {
583 583 const ready: dojo.Ready;
584 584 export = ready;
585 585 }
586 586
587 587 declare module 'dojo/regexp' {
588 588 const regexp: dojo.RegExpModule;
589 589 export = regexp;
590 590 }
591 591
592 592 declare module 'dojo/request' {
593 593 const request: dojo.request.Request;
594 594 export = request;
595 595 }
596 596
597 597 declare module 'dojo/request/default' {
598 598 const def: dojo.request.Default;
599 599 export = def;
600 600 }
601 601
602 602 declare module 'dojo/request/default!' {
603 603 const def: dojo.request.Request;
604 604 export = def;
605 605 }
606 606
607 607 declare module 'dojo/request/handlers' {
608 608 const handlers: dojo.request.Handlers;
609 609 export = handlers;
610 610 }
611 611
612 612 declare module 'dojo/request/iframe' {
613 613 const iframe: dojo.request.IFrame;
614 614 export = iframe;
615 615 }
616 616
617 617 declare module 'dojo/request/node' {
618 618 const node: dojo.request.Node;
619 619 export = node;
620 620 }
621 621
622 622 declare module 'dojo/request/registry' {
623 623 const registry: dojo.request.Registry;
624 624 export = registry;
625 625 }
626 626
627 627 declare module 'dojo/request/script' {
628 628 const script: dojo.request.Script;
629 629 export = script;
630 630 }
631 631
632 632 declare module 'dojo/request/util' {
633 633 const util: dojo.request.Util;
634 634 export = util;
635 635 }
636 636
637 637 declare module 'dojo/request/watch' {
638 638 const watch: dojo.request.Watch;
639 639 export = watch;
640 640 }
641 641
642 642 declare module 'dojo/request/xhr' {
643 643 const xhr: dojo.request.Xhr;
644 644 export = xhr;
645 645 }
646 646
647 647 declare module 'dojo/require' {
648 648 const require: dojo.RequirePlugin;
649 649 export = require;
650 650 }
651 651
652 652 declare module 'dojo/robot' {
653 653 const robot: dojo.Robot;
654 654 export = robot;
655 655 }
656 656
657 657 declare module 'dojo/robotx' {
658 658 const robotx: dojo.RobotX;
659 659 export = robotx;
660 660 }
661 661
662 662 declare module 'dojo/router' {
663 663 const router: dojo.router.RouterBase;
664 664 export = router;
665 665 }
666 666
667 667 declare module 'dojo/router/RouterBase' {
668 668 type RouterBase = dojo.router.RouterBase;
669 669 const RouterBase: dojo.router.RouterBaseConstructor;
670 670 export = RouterBase;
671 671 }
672 672
673 673 declare module 'dojo/rpc/JsonpService' {
674 674 type JsonpService<T> = dojo.rpc.JsonpService<T>;
675 675 const JsonpService: dojo.rpc.JsonpServiceConstructor;
676 676 export = JsonpService;
677 677 }
678 678
679 679 declare module 'dojo/rpc/JsonService' {
680 680 type JsonService<T> = dojo.rpc.JsonService<T>;
681 681 const JsonService: dojo.rpc.JsonServiceConstructor;
682 682 export = JsonService;
683 683 }
684 684
685 685 declare module 'dojo/rpc/RpcService' {
686 686 type RpcService<T> = dojo.rpc.RpcService<T>;
687 687 const RpcService: dojo.rpc.RpcServiceConstructor;
688 688 export = RpcService;
689 689 }
690 690
691 691 declare module 'dojo/selector/_loader' {
692 692 const loader: dojo.selector.Loader;
693 693 export = loader;
694 694 }
695 695
696 696 declare module 'dojo/selector/_loader!' {
697 697 const lite: dojo.selector.LiteQueryEnegine;
698 698 export = lite;
699 699 }
700 700
701 701 declare module 'dojo/selector/_loader!acme' {
702 702 const acme: dojo.selector.AcmeQueryEngine;
703 703 export = acme;
704 704 }
705 705
706 706 declare module 'dojo/selector/_loader!lite' {
707 707 const lite: dojo.selector.LiteQueryEnegine;
708 708 export = lite;
709 709 }
710 710
711 711 declare module 'dojo/selector/acme' {
712 712 const acme: dojo.selector.AcmeQueryEngine;
713 713 export = acme;
714 714 }
715 715
716 716 declare module 'dojo/selector/lite' {
717 717 const lite: dojo.selector.LiteQueryEnegine;
718 718 export = lite;
719 719 }
720 720
721 721 declare module 'dojo/sniff' {
722 722 const sniff: dojo.Has;
723 723 export = sniff;
724 724 }
725 725
726 726 declare module 'dojo/Stateful' {
727 727 type Stateful<T = any> = dojo.Stateful<T>;
728 728 const Stateful: dojo.StatefulConstructor;
729 729 export = Stateful;
730 730 }
731 731
732 732 declare module 'dojo/store/api/Store' {
733 733 type Store<T extends Object, Q extends string | Object | Function, O extends dojo.store.api.QueryOptions> = dojo.store.api.Store<T, Q, O>;
734 734 const Store: dojo.store.api.StoreConstructor;
735 735 export = Store;
736 736 }
737 737
738 738 declare module 'dojo/store/util/QueryResults' {
739 739 const QueryResults: dojo.store.util.QueryResultsFunction;
740 740 export = QueryResults;
741 741 }
742 742
743 743 declare module 'dojo/store/util/SimpleQueryEngine' {
744 744 const SimpleQueryEngine: dojo.store.util.SimpleQueryEngine;
745 745 export = SimpleQueryEngine;
746 746 }
747 747
748 748 declare module 'dojo/store/Cache' {
749 749 const Cache: dojo.store.Cache;
750 750 export = Cache;
751 751 }
752 752
753 753 declare module 'dojo/store/DataStore' {
754 754 type DataStore<T extends Object> = dojo.store.DataStore<T>;
755 755 const DataStore: dojo.store.DataStoreConstructor;
756 756 export = DataStore;
757 757 }
758 758
759 759 declare module 'dojo/store/JsonRest' {
760 760 type JsonRest<T extends object, Q extends dojo.store.api.BaseQueryType, O extends dojo.store.JsonRestQueryOptions> = dojo.store.JsonRest<T, Q, O>;
761 761 const JsonRest: dojo.store.JsonRestConstructor;
762 762 export = JsonRest;
763 763 }
764 764
765 765 declare module 'dojo/store/Memory' {
766 766 type Memory<T extends Object> = dojo.store.Memory<T>;
767 767 const Memory: dojo.store.MemoryConstructor;
768 768 export = Memory;
769 769 }
770 770
771 771 declare module 'dojo/store/Observable' {
772 772 const Observerable: dojo.store.Observable;
773 773 export = Observerable;
774 774 }
775 775
776 776 declare module 'dojo/string' {
777 777 const value: dojo.String;
778 778 export = value;
779 779 }
780 780
781 781 declare module 'dojo/text' {
782 782 const text: dojo.Text;
783 783 export = text;
784 784 }
785 785
786 786 declare module 'dojo/throttle' {
787 787 const throttle: dojo.Throttle;
788 788 export = throttle;
789 789 }
790 790
791 791 declare module 'dojo/topic' {
792 792 const hub: dojo.Topic;
793 793 export = hub;
794 794 }
795 795
796 796 declare module 'dojo/touch' {
797 797 const touch: dojo.Touch;
798 798 export = touch;
799 799 }
800 800
801 801 declare module 'dojo/uacss' {
802 802 const uacss: dojo.Has;
803 803 export = uacss;
804 804 }
805 805
806 806 declare module 'dojo/when' {
807 807 const when: dojo.When;
808 808 export = when;
809 809 }
810 810
811 811 declare module 'dojo/window' {
812 812 const window: dojo.WindowModule;
813 813 export = window;
814 814 }
815 815
816 816 declare module 'dojo/i18n!*' {
817 817 const value: any;
818 818 export = value;
819 819 }
820 820
821 821 declare module 'dojo/text!*' {
822 822 const content: string;
823 823 export = content;
824 824 }
@@ -1,8 +1,8
1 import "dojo/NodeList-fx";
1 import * as NodeList from "dojo/NodeList-fx";
2 2
3 declare const nl: dojo.NodeList<Node>;
3 const nl: dojo.NodeList<Node> = new NodeList();
4 4
5 5 const anim: dojo._base.Animation = nl.fadeIn();
6 6 const anim2: dojo._base.Animation = nl.fadeIn({duration: 500});
7 7 const nl2: typeof nl = nl.fadeOut({auto: true, onEnd: () => {}});
8 8 const other = nl.fadeOut({auto: false}); No newline at end of file
@@ -1,59 +1,59
1 1 import * as _WidgetBase from "dijit/_WidgetBase";
2 2 import { watch } from "./traits";
3 3
4 4 interface ScheduleWidgetAttrs {
5 5 data: string[];
6 6 }
7 7
8 8 interface ScheduleWidgetEvents {
9 9 "scheduled": Event & {
10 10 detail: {
11 11 startDate: Date,
12 12 endDate: Date
13 13 }
14 14 };
15 15 }
16 16
17 17 class ScheduleWidget extends _WidgetBase<ScheduleWidgetAttrs, ScheduleWidgetEvents> {
18 18 data: string[];
19 19
20 20 _onClick() {
21 21 this.set("data", "", "");
22 22
23 23 const t = this.get("title");
24 24 this.set({
25 25 data: ["",""]
26 26 });
27 27 }
28 28
29 29 render(){
30 30 watch(this, "title", v => String(v) );
31 31 }
32 32 }
33 33
34 34 const w = new ScheduleWidget({title: "Year schedule", data: ["a", "b"] });
35 35
36 36 w.get("data");
37 37
38 38 w.set("data", "a","b");
39 39 w.set({
40 40 data: ["a", "b"]
41 41 });
42 42
43 43 w.watch((p, o, n) => [p,o,n]);
44 44
45 45 w.watch("data", (p, o, n) => [p,o,n]);
46 46
47 47 watch(w, "title", v => String(v) );
48 48 watch(w, "data", v => String(v) );
49 49
50 50 w.emit("scheduled", { detail: { startDate: new Date(), endDate: new Date()} });
51 51
52 52 w.emit("click", {} );
53 53
54 54 w.emit("click", {} );
55 55
56 w.emit("some-extra-event", {});
56 w.emit<any>("some-extra-event", {});
57 57
58 58 w.on("click", e => e);
59 w.on("some-extra-event", e => e);
59 w.on<any>("some-extra-event", e => e);
General Comments 0
You need to be logged in to leave comments. Login now