##// END OF EJS Templates
corrected _Widget::set() signature
cin -
r14:03f3149f6507 v1.0.4 default
parent child
Show More
@@ -1,2369 +1,2368
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 552 interface _WidgetBase {
553 553 /**
554 554 * Used across all instances a hash to cache attribute names and their getter
555 555 * and setter names.
556 556 */
557 557 _attrPairNames: { [attr: string]: string };
558 558
559 559 /**
560 560 * Helper function for get() and set().
561 561 * Caches attribute name values so we don't do the string ops every time.
562 562 */
563 563 _getAttrNames(name: string): string;
564 564
565 565 /**
566 566 * Internal helper for directly changing an attribute value.
567 567 * This method id derived from Stateful and must not be used!
568 568 * @deprecated use `_set(name, value)` instead.
569 569 */
570 570 _changeAttrValue(name: string, value: any): this;
571 571
572 572 get<K extends keyof this>(name: K): this[K];
573 573
574 574 /**
575 575 * Helper function to set new value for specified property, and call handlers
576 576 * registered with watch() if the value has changed.
577 577 * @param name
578 578 * @param value
579 579 */
580 580 _set<K extends keyof this>(name: K, value: this[K]): void;
581 581
582 582 /**
583 583 * Helper function to get value for specified property stored by this._set(),
584 584 * i.e. for properties with custom setters. Used mainly by custom getters.
585 585 *
586 586 * For example, CheckBox._getValueAttr() calls this._get("value").
587 587 * @param name
588 588 */
589 589 _get<K extends keyof this>(name: K): this[K];
590 590
591 591 /**
592 592 * Set a property on a Stateful instance
593 593 */
594 set<K extends keyof this>(name: K, value: this[K]): this;
595 set<K extends keyof this, V extends this[K] & any[]>(name: K, ...values: V): this;
596 set<K extends keyof this>(values: {[p in K]: this[p]}): this;
594 set<K extends keyof this>(name: K, value: this[K], ...opts: unknown[]): this;
595 set(values: Partial<this>): this;
597 596
598 597 /**
599 598 * Watches a property for changes
600 599 */
601 600 watch(callback: <K extends keyof any>(prop: K, oldValue: any, newValue: any) => void): dojo.WatchHandle;
602 601 watch<K extends keyof this>(name: K, callback: (prop: K, oldValue: this[K], newValue: this[K]) => void): dojo.WatchHandle;
603 602 }
604 603
605 604 type EventInitArgs<T extends Event> = {
606 605 [p in keyof T]?: T[p] extends (...args: any) => any ? never : T[p];
607 606 };
608 607
609 608 /* dijit/_WidgetBase */
610 609 interface _WidgetBase<Events extends { [name in keyof Events]: Event } = GlobalEventHandlersEventMap> extends Destroyable {
611 610
612 611 /**
613 612 * A unique, opaque ID string that can be assigned by users or by the
614 613 * system. If the developer passes an ID which is known not to be
615 614 * unique, the specified ID is ignored and the system-generated ID is
616 615 * used instead.
617 616 */
618 617 id: string;
619 618
620 619 /**
621 620 * Rarely used. Overrides the default Dojo locale used to render this widget,
622 621 * as defined by the [HTML LANG](http://www.w3.org/TR/html401/struct/dirlang.html#adef-lang) attribute.
623 622 * Value must be among the list of locales specified during by the Dojo bootstrap,
624 623 * formatted according to [RFC 3066](http://www.ietf.org/rfc/rfc3066.txt) (like en-us).
625 624 */
626 625 lang: string;
627 626
628 627 /**
629 628 * Bi-directional support, as defined by the [HTML DIR](http://www.w3.org/TR/html401/struct/dirlang.html#adef-dir)
630 629 * attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's
631 630 * default direction.
632 631 */
633 632 dir: string;
634 633
635 634 /**
636 635 * HTML class attribute
637 636 */
638 637 class: string;
639 638
640 639 /**
641 640 * HTML style attributes as cssText string or name/value hash
642 641 */
643 642 style: string;
644 643
645 644 /**
646 645 * HTML title attribute.
647 646 *
648 647 * For form widgets this specifies a tooltip to display when hovering over
649 648 * the widget (just like the native HTML title attribute).
650 649 *
651 650 * For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer,
652 651 * etc., it's used to specify the tab label, accordion pane title, etc. In this case it's
653 652 * interpreted as HTML.
654 653 */
655 654 title: string;
656 655
657 656 /**
658 657 * When this widget's title attribute is used to for a tab label, accordion pane title, etc.,
659 658 * this specifies the tooltip to appear when the mouse is hovered over that text.
660 659 */
661 660 tooltip: string;
662 661
663 662 /**
664 663 * Root CSS class of the widget (ex: dijitTextBox), used to construct CSS classes to indicate
665 664 * widget state.
666 665 */
667 666 baseClass: string;
668 667
669 668 /**
670 669 * pointer to original DOM node
671 670 */
672 671 srcNodeRef: HTMLElement;
673 672
674 673 /**
675 674 * This is our visible representation of the widget! Other DOM
676 675 * Nodes may by assigned to other properties, usually through the
677 676 * template system's data-dojo-attach-point syntax, but the domNode
678 677 * property is the canonical "top level" node in widget UI.
679 678 */
680 679 domNode: HTMLElement;
681 680
682 681 /**
683 682 * Designates where children of the source DOM node will be placed.
684 683 * "Children" in this case refers to both DOM nodes and widgets.
685 684 */
686 685 containerNode: HTMLElement;
687 686
688 687 /**
689 688 * The document this widget belongs to. If not specified to constructor, will default to
690 689 * srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global
691 690 */
692 691 ownerDocument: HTMLElement;
693 692
694 693 /**
695 694 * Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute
696 695 * for each XXX attribute to be mapped to the DOM.
697 696 */
698 697 attributeMap: { [attribute: string]: any };
699 698
700 699 /**
701 700 * Bi-directional support, the main variable which is responsible for the direction of the text.
702 701 * The text direction can be different than the GUI direction by using this parameter in creation
703 702 * of a widget.
704 703 */
705 704 textDir: string;
706 705
707 706 _started?: boolean;
708 707
709 708 /**
710 709 * Kicks off widget instantiation. See create() for details.
711 710 */
712 711 postscript(params?: any, srcNodeRef?: HTMLElement): void;
713 712
714 713 /**
715 714 * Kick off the life-cycle of a widget
716 715 */
717 716 create(params?: any, srcNodeRef?: HTMLElement): void;
718 717
719 718 /**
720 719 * Called after the parameters to the widget have been read-in,
721 720 * but before the widget template is instantiated. Especially
722 721 * useful to set properties that are referenced in the widget
723 722 * template.
724 723 */
725 724 postMixInProperties(): void;
726 725
727 726 /**
728 727 * Construct the UI for this widget, setting this.domNode.
729 728 * Most widgets will mixin `dijit._TemplatedMixin`, which implements this method.
730 729 */
731 730 buildRendering(): void;
732 731
733 732 /**
734 733 * Processing after the DOM fragment is created
735 734 */
736 735 postCreate(): void;
737 736
738 737 /**
739 738 * Processing after the DOM fragment is added to the document
740 739 */
741 740 startup(): void;
742 741
743 742 /**
744 743 * Destroy this widget and its descendants
745 744 */
746 745 destroyRecursive(preserveDom?: boolean): void;
747 746
748 747 /**
749 748 * Destroys the DOM nodes associated with this widget.
750 749 */
751 750 destroyRendering(preserveDom?: boolean): void;
752 751
753 752 /**
754 753 * Recursively destroy the children of this widget and their
755 754 * descendants.
756 755 */
757 756 destroyDescendants(preserveDom?: boolean): void;
758 757
759 758 /**
760 759 * Deprecated. Override destroy() instead to implement custom widget tear-down
761 760 * behavior.
762 761 * @deprecated
763 762 */
764 763 uninitialize(): boolean;
765 764
766 765 /**
767 766 * Used by widgets to signal that a synthetic event occurred, ex:
768 767 * | myWidget.emit("attrmodified-selectedChildWidget", {}).
769 768 */
770 769 emit<K extends keyof Events>(eventName: K, evt: EventInitArgs<Events[K]>, callbackArgs?: any[]): any;
771 770
772 771 /**
773 772 * Call specified function when event occurs, ex: myWidget.on("click", function(){ ... }).
774 773 */
775 774 on<K extends keyof Events>(eventName: K, cb: (evt: Events[K]) => void): dojo.WatchHandle;
776 775
777 776 on(type: dojo.ExtensionEvent, func: dojo.EventListener): dojo.WatchHandle;
778 777
779 778 /**
780 779 * Returns a string that represents the widget.
781 780 */
782 781 toString(): string;
783 782
784 783 /**
785 784 * Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent
786 785 * is this widget. Note that it does not return all descendants, but rather just direct children.
787 786 */
788 787 getChildren<T extends _WidgetBase>(): T[];
789 788
790 789 /**
791 790 * Returns the parent widget of this widget.
792 791 */
793 792 getParent<T extends _WidgetBase>(): T;
794 793
795 794 /**
796 795 * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead.
797 796 * @deprecated
798 797 */
799 798 connect(obj: any, event: string | dojo.ExtensionEvent, method: string | dojo.EventListener): dojo.WatchHandle;
800 799
801 800 /**
802 801 * Deprecated, will be removed in 2.0, use handle.remove() instead.
803 802 * @deprecated
804 803 */
805 804 disconnect(handle: dojo.WatchHandle): void;
806 805
807 806 /**
808 807 * Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead.
809 808 * @deprecated
810 809 */
811 810 subscribe(t: string, method: dojo.EventListener): dojo.WatchHandle;
812 811
813 812 /**
814 813 * Deprecated, will be removed in 2.0, use handle.remove() instead.
815 814 * @deprecated
816 815 */
817 816 unsubscribe(handle: dojo.WatchHandle): void;
818 817
819 818 /**
820 819 * Return this widget's explicit or implicit orientation (true for LTR, false for RTL)
821 820 */
822 821 isLeftToRight(): boolean;
823 822
824 823 /**
825 824 * Return true if this widget can currently be focused
826 825 * and false if not
827 826 */
828 827 isFocusable(): boolean;
829 828
830 829 /**
831 830 * Place this widget somewhere in the DOM based
832 831 * on standard domConstruct.place() conventions.
833 832 */
834 833 placeAt<T extends _WidgetBase>(reference: dojo.NodeFragmentOrString | T, position?: string | number): this;
835 834
836 835 /**
837 836 * Wrapper to setTimeout to avoid deferred functions executing
838 837 * after the originating widget has been destroyed.
839 838 * Returns an object handle with a remove method (that returns null) (replaces clearTimeout).
840 839 */
841 840 defer(fcn: Function, delay?: number): dojo.Handle;
842 841 }
843 842
844 843 interface _WidgetBaseConstructor<W> extends Pick<dojo._base.DeclareConstructor<W>, Exclude<keyof dojo._base.DeclareConstructor<W>, 'new'>> {
845 844 new(params?: Partial<W> & ThisType<W>, srcNodeRef?: dojo.NodeOrString): W & dojo._base.DeclareCreatedObject;
846 845 }
847 846
848 847 /* dijit/_WidgetsInTemplateMixin */
849 848
850 849 interface _WidgetsInTemplateMixin {
851 850 /**
852 851 * Used to provide a context require to dojo/parser in order to be
853 852 * able to use relative MIDs (e.g. `./Widget`) in the widget's template.
854 853 */
855 854 contextRequire: Function;
856 855
857 856 startup(): void;
858 857 }
859 858
860 859 interface _WidgetsInTemplateMixinConstructor extends dojo._base.DeclareConstructor<_WidgetsInTemplateMixin> {
861 860 new(params: Object, srcNodeRef: dojo.NodeOrString): _WidgetsInTemplateMixin;
862 861 }
863 862
864 863 /* dijit/a11yclick */
865 864
866 865 interface A11yClick {
867 866
868 867 /**
869 868 * Custom press, release, and click synthetic events
870 869 * which trigger on a left mouse click, touch, or space/enter keyup.
871 870 */
872 871 (node: HTMLElement, listener: Function): dojo.Handle;
873 872
874 873 /**
875 874 * Mousedown (left button), touchstart, or keydown (space or enter) corresponding to logical click operation.
876 875 */
877 876 press: dojo.ExtensionEvent;
878 877
879 878 /**
880 879 * Mouseup (left button), touchend, or keyup (space or enter) corresponding to logical click operation.
881 880 */
882 881 release: dojo.ExtensionEvent;
883 882
884 883 /**
885 884 * Mouse cursor or a finger is dragged over the given node.
886 885 */
887 886 move: dojo.ExtensionEvent;
888 887 }
889 888
890 889 /* dijit/Calendar */
891 890
892 891 interface _MonthDropDownButton extends form.DropDownButton<_MonthDropDown> {
893 892 onMonthSelect(): void;
894 893 postCreate(): void;
895 894
896 895 //set(name: 'month', value: number): this;
897 896 //set(name: string, value: any): this;
898 897 //set(values: Object): this;
899 898 }
900 899
901 900 interface _MonthDropDownButtonConstructor extends _WidgetBaseConstructor<_MonthDropDownButton> { }
902 901
903 902 interface _MonthDropDown extends _Widget, _TemplatedMixin, _CssStateMixin {
904 903 months: string[];
905 904 baseClass: string;
906 905 templateString: string;
907 906
908 907 /**
909 908 * Callback when month is selected from drop down
910 909 */
911 910 onChange(month: number): void;
912 911
913 912 //set(name: 'months', value: string[]): this;
914 913 //set(name: string, value: any): this;
915 914 //set(values: Object): this;
916 915 }
917 916
918 917 interface _MonthDropDownConstructor extends _WidgetBaseConstructor<_MonthDropDown> { }
919 918
920 919 interface Calendar extends CalendarLite, _Widget, _CssStateMixin {
921 920
922 921 baseClass: string;
923 922
924 923 /**
925 924 * Set node classes for various mouse events, see dijit._CssStateMixin for more details
926 925 */
927 926 cssStateNodes: CSSStateNodes;
928 927
929 928 /**
930 929 * Creates the drop down button that displays the current month and lets user pick a new one
931 930 */
932 931 _createMonthWidget(): _MonthDropDownButton;
933 932
934 933 postCreate(): void;
935 934
936 935 /**
937 936 * Handler for when user selects a month from the drop down list
938 937 */
939 938 _onMonthSelect(newMonth: number): void;
940 939
941 940 /**
942 941 * Handler for mouse over events on days, sets hovered style
943 942 */
944 943 _onDayMouseOver(evt: MouseEvent): void;
945 944
946 945 /**
947 946 * Handler for mouse out events on days, clears hovered style
948 947 */
949 948 _onDayMouseOut(evt: MouseEvent): void;
950 949 _onDayMouseDown(evt: MouseEvent): void;
951 950 _onDayMouseUp(evt: MouseEvent): void;
952 951
953 952 /**
954 953 * Provides keyboard navigation of calendar.
955 954 */
956 955 handleKey(evt: KeyboardEvent): void;
957 956
958 957 /**
959 958 * For handling keydown events on a stand alone calendar
960 959 */
961 960 _onKeyDown(evt: KeyboardEvent): void;
962 961
963 962 /**
964 963 * Deprecated. Notification that a date cell was selected. It may be the same as the previous value.
965 964 */
966 965 onValueSelected(date: Date): void;
967 966
968 967 onChange(date: Date): void;
969 968
970 969 /**
971 970 * May be overridden to return CSS classes to associate with the date entry for the given dateObject
972 971 * for example to indicate a holiday in specified locale.
973 972 */
974 973 getClassForDate(dateObject: Date, locale?: string): string;
975 974
976 975 // get(name: 'value'): Date;
977 976 // get(name: string): any;
978 977
979 978 // set(name: 'value', value: number | Date): this;
980 979 // set(name: string, value: any): this;
981 980 // set(values: Object): this;
982 981 }
983 982
984 983 interface CalendarConstructor extends _WidgetBaseConstructor<Calendar> {
985 984 _MonthWidget: _MonthWidgetConstructor;
986 985 _MonthDropDown: _MonthDropDownButtonConstructor;
987 986 _MonthDropDownButton: _MonthDropDownButtonConstructor;
988 987 }
989 988
990 989 /* dijit/CalendarLite */
991 990
992 991 interface _MonthWidget extends _WidgetBase {
993 992 // set(name: 'month', value: Date): this;
994 993 // set(name: string, value: any): this;
995 994 // set(values: Object): this;
996 995 }
997 996
998 997 interface _MonthWidgetConstructor extends _WidgetBaseConstructor<_MonthWidget> { }
999 998
1000 999 interface CalendarLite extends _WidgetBase, _TemplatedMixin {
1001 1000 /**
1002 1001 * Template for main calendar
1003 1002 */
1004 1003 templateString: string;
1005 1004
1006 1005 /**
1007 1006 * Template for cell for a day of the week (ex: M)
1008 1007 */
1009 1008 dowTemplateString: string;
1010 1009
1011 1010 dateTemplateString: string;
1012 1011 weekTemplateString: string;
1013 1012
1014 1013 /**
1015 1014 * The currently selected Date, initially set to invalid date to indicate no selection.
1016 1015 */
1017 1016 value: Date;
1018 1017
1019 1018 /**
1020 1019 * JavaScript namespace to find calendar routines. If unspecified, uses Gregorian calendar routines
1021 1020 * at dojo/date and dojo/date/locale.
1022 1021 */
1023 1022 datePackage: string;
1024 1023
1025 1024 /**
1026 1025 * How to represent the days of the week in the calendar header. See locale
1027 1026 */
1028 1027 dayWidth: string;
1029 1028
1030 1029 /**
1031 1030 * Order fields are traversed when user hits the tab key
1032 1031 */
1033 1032 tabIndex: string;
1034 1033
1035 1034 /**
1036 1035 * (Optional) The first day of week override. By default the first day of week is determined
1037 1036 * for the current locale (extracted from the CLDR).
1038 1037 * Special value -1 (default value), means use locale dependent value.
1039 1038 */
1040 1039 dayOffset: number;
1041 1040
1042 1041 /**
1043 1042 * Date object containing the currently focused date, or the date which would be focused
1044 1043 * if the calendar itself was focused. Also indicates which year and month to display,
1045 1044 * i.e. the current "page" the calendar is on.
1046 1045 */
1047 1046 currentFocus: Date;
1048 1047
1049 1048 /**
1050 1049 * Put the summary to the node with role=grid
1051 1050 */
1052 1051 _setSummaryAttr: string;
1053 1052
1054 1053 baseClass: string;
1055 1054
1056 1055 /**
1057 1056 * Runs various tests on the value, checking that it's a valid date, rather
1058 1057 * than blank or NaN.
1059 1058 */
1060 1059 _isValidDate(value: Date): boolean;
1061 1060
1062 1061 /**
1063 1062 * Convert Number into Date, or copy Date object. Then, round to nearest day,
1064 1063 * setting to 1am to avoid issues when DST shift occurs at midnight, see #8521, #9366)
1065 1064 */
1066 1065 _patchDate(value: number | Date): Date;
1067 1066
1068 1067 /**
1069 1068 * This just sets the content of node to the specified text.
1070 1069 * Can't do "node.innerHTML=text" because of an IE bug w/tables, see #3434.
1071 1070 */
1072 1071 _setText(node: HTMLElement, text?: string): void;
1073 1072
1074 1073 /**
1075 1074 * Fills in the calendar grid with each day (1-31).
1076 1075 * Call this on creation, when moving to a new month.
1077 1076 */
1078 1077 _populateGrid(): void;
1079 1078
1080 1079 /**
1081 1080 * Fill in localized month, and prev/current/next years
1082 1081 */
1083 1082 _populateControls(): void;
1084 1083
1085 1084 /**
1086 1085 * Sets calendar's value to today's date
1087 1086 */
1088 1087 goToToday(): void;
1089 1088
1090 1089 /**
1091 1090 * Creates the drop down button that displays the current month and lets user pick a new one
1092 1091 */
1093 1092 _createMonthWidget(): void;
1094 1093
1095 1094 buildRendering(): void;
1096 1095 postCreate(): void;
1097 1096
1098 1097 /**
1099 1098 * Set up connects for increment/decrement of months/years
1100 1099 */
1101 1100 _connectControls(): void;
1102 1101
1103 1102 /**
1104 1103 * If the calendar currently has focus, then focuses specified date,
1105 1104 * changing the currently displayed month/year if necessary.
1106 1105 * If the calendar doesn't have focus, updates currently
1107 1106 * displayed month/year, and sets the cell that will get focus
1108 1107 * when Calendar is focused.
1109 1108 */
1110 1109 _setCurrentFocusAttr(date: Date, forceFocus?: boolean): void;
1111 1110
1112 1111 /**
1113 1112 * Focus the calendar by focusing one of the calendar cells
1114 1113 */
1115 1114 focus(): void;
1116 1115
1117 1116 /**
1118 1117 * Handler for day clicks, selects the date if appropriate
1119 1118 */
1120 1119 _onDayClick(evt: MouseEvent): void;
1121 1120
1122 1121 /**
1123 1122 * Returns the cell corresponding to the date, or null if the date is not within the currently
1124 1123 * displayed month.
1125 1124 */
1126 1125 _getNodeByDate(value: Date): HTMLElement;
1127 1126
1128 1127 /**
1129 1128 * Marks the specified cells as selected, and clears cells previously marked as selected.
1130 1129 * For CalendarLite at most one cell is selected at any point, but this allows an array
1131 1130 * for easy subclassing.
1132 1131 */
1133 1132 _markSelectedDates(dates: Date[]): void;
1134 1133
1135 1134 /**
1136 1135 * Called only when the selected date has changed
1137 1136 */
1138 1137 onChange(date: Date): void;
1139 1138
1140 1139 /**
1141 1140 * May be overridden to disable certain dates in the calendar e.g. `isDisabledDate=dojo.date.locale.isWeekend`
1142 1141 */
1143 1142 isDisabledDate(dateObject: Date, locale?: string): boolean;
1144 1143
1145 1144 /**
1146 1145 * May be overridden to return CSS classes to associate with the date entry for the given dateObject,
1147 1146 * for example to indicate a holiday in specified locale.
1148 1147 */
1149 1148 getClassForDate(dateObject: Date, locale?: string): string;
1150 1149
1151 1150 // get(name: 'value'): Date;
1152 1151 // get(name: string): any;
1153 1152
1154 1153 // set(name: 'value', value: number | Date): this;
1155 1154 // set(name: string, value: any): this;
1156 1155 // set(values: Object): this;
1157 1156 }
1158 1157
1159 1158 interface CalendarLiteConstructor extends _WidgetBaseConstructor<CalendarLite> {
1160 1159 _MonthWidget: _MonthWidgetConstructor;
1161 1160 }
1162 1161
1163 1162 /* dijit/Destroyable */
1164 1163
1165 1164 interface Destroyable {
1166 1165 _destroyed?: true;
1167 1166
1168 1167 /**
1169 1168 * Destroy this class, releasing any resources registered via own().
1170 1169 */
1171 1170 destroy(preserveDom?: boolean): void;
1172 1171
1173 1172 /**
1174 1173 * Track specified handles and remove/destroy them when this instance is destroyed, unless they were
1175 1174 * already removed/destroyed manually.
1176 1175 */
1177 1176 own(...args: any[]): any[];
1178 1177 }
1179 1178
1180 1179 /**
1181 1180 * Mixin to track handles and release them when instance is destroyed.
1182 1181 */
1183 1182 interface DestroyableConstructor extends dojo._base.DeclareConstructor<Destroyable> { }
1184 1183
1185 1184 /** dijit/_KeyNavMixin */
1186 1185
1187 1186 /**
1188 1187 * A mixin to allow arrow key and letter key navigation of child or descendant widgets.
1189 1188 * It can be used by dijit/_Container based widgets with a flat list of children, or more complex widgets like dijit/Tree.
1190 1189 *
1191 1190 * To use this mixin, the subclass must:
1192 1191 *
1193 1192 * - 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.
1194 1193 * - Set all descendants' initial tabIndex to "-1"; both initial descendants and any descendants added later, by for example addChild()
1195 1194 * - Define childSelector to a function or string that identifies focusable descendant widgets
1196 1195 *
1197 1196 * Also, child widgets must implement a focus() method.
1198 1197 */
1199 1198 interface _KeyNavMixin extends _FocusMixin {
1200 1199 /**
1201 1200 * Tab index of the container; same as HTML tabIndex attribute.
1202 1201 * Note then when user tabs into the container, focus is immediately moved to the first item in the container.
1203 1202 */
1204 1203 tabIndex: string;
1205 1204
1206 1205 /**
1207 1206 * 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.
1208 1207 */
1209 1208 childSelector: string | Function | null;
1210 1209
1211 1210 /**
1212 1211 * Called on left arrow key, or right arrow key if widget is in RTL mode.
1213 1212 * Should go back to the previous child in horizontal container widgets like Toolbar.
1214 1213 */
1215 1214 _onLeftArrow(evt?: KeyboardEvent): void;
1216 1215
1217 1216 /**
1218 1217 * Called on right arrow key, or left arrow key if widget is in RTL mode.
1219 1218 * Should go to the next child in horizontal container widgets like Toolbar.
1220 1219 */
1221 1220 _onRightArrow(evt?: KeyboardEvent): void;
1222 1221
1223 1222 /**
1224 1223 * Called on up arrow key. Should go to the previous child in vertical container widgets like Menu.
1225 1224 */
1226 1225 _onUpArrow(evt?: KeyboardEvent): void;
1227 1226
1228 1227 /**
1229 1228 * Called on down arrow key. Should go to the next child in vertical container widgets like Menu.
1230 1229 */
1231 1230 _onDownArrow(evt?: KeyboardEvent): void;
1232 1231
1233 1232 /**
1234 1233 * Default focus() implementation: focus the first child.
1235 1234 */
1236 1235 focus(): void;
1237 1236
1238 1237 /**
1239 1238 * Returns first child that can be focused.
1240 1239 */
1241 1240 _getFirstFocusableChild(): _WidgetBase;
1242 1241
1243 1242 /**
1244 1243 * Returns last child that can be focused.
1245 1244 */
1246 1245 _getLastFocusableChild(): _WidgetBase;
1247 1246
1248 1247 /**
1249 1248 * Focus the first focusable child in the container.
1250 1249 */
1251 1250 focusFirstChild(): void;
1252 1251
1253 1252 /**
1254 1253 * Focus the last focusable child in the container.
1255 1254 */
1256 1255 focusLastChild(): void;
1257 1256
1258 1257 /**
1259 1258 * Focus specified child widget.
1260 1259 *
1261 1260 * @param widget Reference to container's child widget
1262 1261 * @param last If true and if widget has multiple focusable nodes, focus the last one instead of the first one
1263 1262 */
1264 1263 focusChild(widget: _WidgetBase, last?: boolean): void;
1265 1264
1266 1265 /**
1267 1266 * Handler for when the container itself gets focus.
1268 1267 *
1269 1268 * Initially the container itself has a tabIndex, but when it gets focus, switch focus to first child.
1270 1269 */
1271 1270 _onContainerFocus(evt: Event): void;
1272 1271
1273 1272 /**
1274 1273 * Called when a child widget gets focus, either by user clicking it, or programatically by arrow key handling code.
1275 1274 *
1276 1275 * It marks that the current node is the selected one, and the previously selected node no longer is.
1277 1276 */
1278 1277 _onChildFocus(child?: _WidgetBase): void;
1279 1278
1280 1279 _searchString: string;
1281 1280
1282 1281 multiCharSearchDuration: number;
1283 1282
1284 1283 /**
1285 1284 * When a key is pressed that matches a child item, this method is called so that a widget can take appropriate action is necessary.
1286 1285 */
1287 1286 onKeyboardSearch(tem: _WidgetBase, evt: Event, searchString: string, numMatches: number): void;
1288 1287
1289 1288 /**
1290 1289 * Compares the searchString to the widget's text label, returning:
1291 1290 *
1292 1291 * * -1: a high priority match and stop searching
1293 1292 * * 0: not a match
1294 1293 * * 1: a match but keep looking for a higher priority match
1295 1294 */
1296 1295 _keyboardSearchCompare(item: _WidgetBase, searchString: string): -1 | 0 | 1;
1297 1296
1298 1297 /**
1299 1298 * When a key is pressed, if it's an arrow key etc. then it's handled here.
1300 1299 */
1301 1300 _onContainerKeydown(evt: Event): void;
1302 1301
1303 1302 /**
1304 1303 * When a printable key is pressed, it's handled here, searching by letter.
1305 1304 */
1306 1305 _onContainerKeypress(evt: Event): void;
1307 1306
1308 1307 /**
1309 1308 * Perform a search of the widget's options based on the user's keyboard activity
1310 1309 *
1311 1310 * 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.
1312 1311 */
1313 1312 _keyboardSearch(evt: Event, keyChar: string): void;
1314 1313
1315 1314 /**
1316 1315 * Called when focus leaves a child widget to go to a sibling widget.
1317 1316 */
1318 1317 _onChildBlur(widget: _WidgetBase): void;
1319 1318
1320 1319 /**
1321 1320 * Returns the next or previous focusable descendant, compared to "child".
1322 1321 * Implements and extends _KeyNavMixin._getNextFocusableChild() for a _Container.
1323 1322 */
1324 1323 _getNextFocusableChild(child: _WidgetBase, dir: 1 | -1): _WidgetBase | null;
1325 1324
1326 1325 /**
1327 1326 * Returns the first child.
1328 1327 */
1329 1328 _getFirst(): _WidgetBase | null;
1330 1329
1331 1330 /**
1332 1331 * Returns the last descendant.
1333 1332 */
1334 1333 _getLast(): _WidgetBase | null;
1335 1334
1336 1335 /**
1337 1336 * Returns the next descendant, compared to "child".
1338 1337 */
1339 1338 _getNext(child: _WidgetBase, dir: 1 | -1): _WidgetBase | null;
1340 1339 }
1341 1340
1342 1341 interface _KeyNavMixinConstructor extends dojo._base.DeclareConstructor<_KeyNavMixin> { }
1343 1342
1344 1343 /* dijit/_KeyNavContainer */
1345 1344
1346 1345 /**
1347 1346 * A _Container with keyboard navigation of its children.
1348 1347 *
1349 1348 * Provides normalized keyboard and focusing code for Container widgets.
1350 1349 * To use this mixin, call connectKeyNavHandlers() in postCreate().
1351 1350 * Also, child widgets must implement a focus() method.
1352 1351 */
1353 1352 interface _KeyNavContainer extends _FocusMixin, _KeyNavMixin, _Container {
1354 1353 /**
1355 1354 * 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().
1356 1355 *
1357 1356 * @param prevKeyCodes Key codes for navigating to the previous child.
1358 1357 * @param nextKeyCodes Key codes for navigating to the next child.
1359 1358 */
1360 1359 connectKeyNavHandlers(prevKeyCodes: number[], nextKeyCodes: number[]): void;
1361 1360
1362 1361 /**
1363 1362 * @deprecated
1364 1363 */
1365 1364 startupKeyNavChildren(): void;
1366 1365
1367 1366 /**
1368 1367 * Setup for each child widget.
1369 1368 *
1370 1369 * Sets tabIndex=-1 on each child, so that the tab key will leave the container rather than visiting each child.
1371 1370 *
1372 1371 * 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.
1373 1372 *
1374 1373 * Note: see also _LayoutWidget.setupChild(), which is also called for each child widget.
1375 1374 */
1376 1375 _startupChild(widget: _WidgetBase): void;
1377 1376
1378 1377 /**
1379 1378 * Returns the first child.
1380 1379 */
1381 1380 _getFirst(): _Widget | null;
1382 1381
1383 1382 /**
1384 1383 * Returns the last descendant.
1385 1384 */
1386 1385 _getLast(): _Widget | null;
1387 1386
1388 1387 /**
1389 1388 * Focus the next widget
1390 1389 */
1391 1390 focusNext(): void;
1392 1391
1393 1392 /**
1394 1393 * Focus the last focusable node in the previous widget
1395 1394 *
1396 1395 * (ex: go to the ComboButton icon section rather than button section)
1397 1396 */
1398 1397 focusPrev(): void;
1399 1398
1400 1399 /**
1401 1400 * Implement _KeyNavMixin.childSelector, to identify focusable child nodes.
1402 1401 *
1403 1402 * If we allowed a dojo/query dependency from this module this could more simply be a string "> *" instead of this function.
1404 1403 */
1405 1404 childSelector(node: Element | Node): boolean | void | any;
1406 1405 }
1407 1406
1408 1407 interface _KeyNavContainerConstructor extends dojo._base.DeclareConstructor<_KeyNavContainer> { }
1409 1408
1410 1409 /* dijit/_MenuBase */
1411 1410
1412 1411 /**
1413 1412 * Abstract base class for Menu and MenuBar.
1414 1413 * Subclass should implement _onUpArrow(), _onDownArrow(), _onLeftArrow(), and _onRightArrow().
1415 1414 */
1416 1415 interface _MenuBase extends _Widget, _TemplatedMixin, _KeyNavContainer, _CssStateMixin {
1417 1416 selected: MenuItem | null;
1418 1417
1419 1418 _setSelectedAttr(item?: MenuItem | null): void;
1420 1419
1421 1420 /**
1422 1421 * 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.
1423 1422 *
1424 1423 * 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.
1425 1424 */
1426 1425 activated: boolean;
1427 1426
1428 1427 _setActivatedAttr(val: boolean): void;
1429 1428
1430 1429 /**
1431 1430 * pointer to menu that displayed me
1432 1431 */
1433 1432 parentMenu: _Widget | null;
1434 1433
1435 1434 /**
1436 1435 * 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.
1437 1436 */
1438 1437 popupDelay: number;
1439 1438
1440 1439 /**
1441 1440 * 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.
1442 1441 */
1443 1442 passivePopupDelay: number;
1444 1443
1445 1444 /**
1446 1445 * 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.
1447 1446 */
1448 1447 autoFocus: boolean;
1449 1448
1450 1449 /**
1451 1450 * 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.
1452 1451 */
1453 1452 childSelector(node: Element | Node): boolean | void | Function;
1454 1453
1455 1454 /**
1456 1455 * 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.
1457 1456 */
1458 1457 onExecute(): void;
1459 1458
1460 1459 /**
1461 1460 * Attach point for notification about when the user cancels the current menu
1462 1461 * 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.
1463 1462 */
1464 1463 onCancel(): void;
1465 1464
1466 1465 /**
1467 1466 * 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
1468 1467 */
1469 1468 _moveToPopup(evt: Event): void;
1470 1469
1471 1470 /**
1472 1471 * This handler is called when the mouse moves over the popup.
1473 1472 */
1474 1473 _onPopupHover(evt?: MouseEvent): void;
1475 1474
1476 1475 /**
1477 1476 * Called when cursor is over a MenuItem.
1478 1477 */
1479 1478 onItemHover(item: MenuItem): void;
1480 1479
1481 1480 /**
1482 1481 * Called when a child MenuItem becomes deselected. Setup timer to close its popup.
1483 1482 */
1484 1483 _onChildDeselect(item: MenuItem): void;
1485 1484
1486 1485 /**
1487 1486 * Callback fires when mouse exits a MenuItem
1488 1487 */
1489 1488 onItemUnhover(item: MenuItem): void;
1490 1489
1491 1490 /**
1492 1491 * Cancels the popup timer because the user has stop hovering on the MenuItem, etc.
1493 1492 */
1494 1493 _stopPopupTimer(): void;
1495 1494
1496 1495 /**
1497 1496 * Cancels the pending-close timer because the close has been preempted
1498 1497 */
1499 1498 _stopPendingCloseTimer(): void;
1500 1499
1501 1500 /**
1502 1501 * Returns the top menu in this chain of Menus
1503 1502 */
1504 1503 _getTopMenu(): void;
1505 1504
1506 1505 /**
1507 1506 * Handle clicks on an item.
1508 1507 */
1509 1508 onItemClick(item: _WidgetBase, evt: Event): void;
1510 1509
1511 1510 /**
1512 1511 * Open the popup to the side of/underneath the current menu item, and optionally focus first item
1513 1512 */
1514 1513 _openItemPopup(fromItem: MenuItem, focus: boolean): void;
1515 1514
1516 1515 /**
1517 1516 * Callback when this menu is opened.
1518 1517 * This is called by the popup manager as notification that the menu was opened.
1519 1518 */
1520 1519 onOpen(evt?: Event): void;
1521 1520
1522 1521 /**
1523 1522 * Callback when this menu is closed.
1524 1523 * This is called by the popup manager as notification that the menu was closed.
1525 1524 */
1526 1525 onClose(): boolean;
1527 1526
1528 1527 /**
1529 1528 * Called when submenu is clicked or focus is lost. Close hierarchy of menus.
1530 1529 */
1531 1530 _closeChild(): void;
1532 1531 /**
1533 1532 * Called when child of this Menu gets focus from:
1534 1533 *
1535 1534 * 1. clicking it
1536 1535 * 2. tabbing into it
1537 1536 * 3. being opened by a parent menu.
1538 1537 *
1539 1538 * This is not called just from mouse hover.
1540 1539 */
1541 1540 _onItemFocus(item: MenuItem): void;
1542 1541
1543 1542 /**
1544 1543 * Called when focus is moved away from this Menu and it's submenus.
1545 1544 */
1546 1545 _onBlur(): void;
1547 1546
1548 1547 /**
1549 1548 * Called when the user is done with this menu. Closes hierarchy of menus.
1550 1549 */
1551 1550 _cleanUp(clearSelectedItem?: boolean): void;
1552 1551 }
1553 1552
1554 1553 interface _MenuBaseConstructor extends _WidgetBaseConstructor<_MenuBase> { }
1555 1554
1556 1555 /* dijit/Dialog */
1557 1556
1558 1557 interface _DialogBase extends _TemplatedMixin, form._FormMixin, _DialogMixin, _CssStateMixin {
1559 1558 templateString: string;
1560 1559 baseClass: string;
1561 1560 cssStateNodes: CSSStateNodes;
1562 1561
1563 1562 /**
1564 1563 * True if Dialog is currently displayed on screen.
1565 1564 */
1566 1565 open: boolean;
1567 1566
1568 1567 /**
1569 1568 * The time in milliseconds it takes the dialog to fade in and out
1570 1569 */
1571 1570 duration: number;
1572 1571
1573 1572 /**
1574 1573 * A Toggle to modify the default focus behavior of a Dialog, which
1575 1574 * is to re-focus the element which had focus before being opened.
1576 1575 * False will disable refocusing. Default: true
1577 1576 */
1578 1577 refocus: boolean;
1579 1578
1580 1579 /**
1581 1580 * A Toggle to modify the default focus behavior of a Dialog, which
1582 1581 * is to focus on the first dialog element after opening the dialog.
1583 1582 * False will disable autofocusing. Default: true
1584 1583 */
1585 1584 autofocus: boolean;
1586 1585
1587 1586 /**
1588 1587 * Toggles the movable aspect of the Dialog. If true, Dialog
1589 1588 * can be dragged by it's title. If false it will remain centered
1590 1589 * in the viewport.
1591 1590 */
1592 1591 draggable: boolean;
1593 1592
1594 1593 /**
1595 1594 * Maximum size to allow the dialog to expand to, relative to viewport size
1596 1595 */
1597 1596 maxRatio: number;
1598 1597
1599 1598 /**
1600 1599 * Dialog show [x] icon to close itself, and ESC key will close the dialog.
1601 1600 */
1602 1601 closable: boolean;
1603 1602 postMixInProperties(): void;
1604 1603 postCreate(): void;
1605 1604
1606 1605 /**
1607 1606 * Called when data has been loaded from an href.
1608 1607 * Unlike most other callbacks, this function can be connected to (via `dojo.connect`)
1609 1608 * but should *not* be overridden.
1610 1609 */
1611 1610 onLoad(data?: any): void;
1612 1611
1613 1612 focus(): void;
1614 1613
1615 1614 /* Not entirely sure of the resolution type of these promises */
1616 1615
1617 1616 /**
1618 1617 * Display the dialog
1619 1618 */
1620 1619 show(): dojo.promise.Promise<any>;
1621 1620
1622 1621 /**
1623 1622 * Hide the dialog
1624 1623 */
1625 1624 hide(): dojo.promise.Promise<any>;
1626 1625
1627 1626 /**
1628 1627 * Called with no argument when viewport scrolled or viewport size changed. Adjusts Dialog as
1629 1628 * necessary to keep it visible.
1630 1629 *
1631 1630 * Can also be called with an argument (by dojox/layout/ResizeHandle etc.) to explicitly set the
1632 1631 * size of the dialog.
1633 1632 */
1634 1633 resize(dim?: dojo.DomGeometryWidthHeight): void;
1635 1634
1636 1635 destroy(preserveDom?: boolean): void;
1637 1636 }
1638 1637
1639 1638 interface _DialogBaseConstructor extends _WidgetBaseConstructor<_DialogBase> { }
1640 1639
1641 1640 interface Dialog extends layout.ContentPane, _DialogBase {
1642 1641 /* overrides conflicting methods */
1643 1642 resize(dim?: dojo.DomGeometryWidthHeight): void;
1644 1643 }
1645 1644
1646 1645 interface DialogLevelManager {
1647 1646 _beginZIndex: number;
1648 1647
1649 1648 /**
1650 1649 * Call right before fade-in animation for new dialog.
1651 1650 *
1652 1651 * Saves current focus, displays/adjusts underlay for new dialog,
1653 1652 * and sets the z-index of the dialog itself.
1654 1653 *
1655 1654 * New dialog will be displayed on top of all currently displayed dialogs.
1656 1655 * Caller is responsible for setting focus in new dialog after the fade-in
1657 1656 * animation completes.
1658 1657 */
1659 1658 show(dialog: _WidgetBase, underlayAttrs: Object): void;
1660 1659
1661 1660 /**
1662 1661 * Called when the specified dialog is hidden/destroyed, after the fade-out
1663 1662 * animation ends, in order to reset page focus, fix the underlay, etc.
1664 1663 * If the specified dialog isn't open then does nothing.
1665 1664 *
1666 1665 * Caller is responsible for either setting display:none on the dialog domNode,
1667 1666 * or calling dijit/popup.hide(), or removing it from the page DOM.
1668 1667 */
1669 1668 hide(dialog: _WidgetBase): void;
1670 1669
1671 1670 /**
1672 1671 * Returns true if specified Dialog is the top in the task
1673 1672 */
1674 1673 isTop(dialog: _WidgetBase): boolean;
1675 1674 }
1676 1675
1677 1676 interface DialogConstructor extends _WidgetBaseConstructor<Dialog> {
1678 1677 /**
1679 1678 * for monkey patching and dojox/widget/DialogSimple
1680 1679 */
1681 1680 _DialogBase: _DialogBaseConstructor;
1682 1681 _DialogLevelManager: DialogLevelManager;
1683 1682 _dialogStack: {
1684 1683 dialog: _WidgetBase,
1685 1684 focus: any,
1686 1685 underlayAttrs: any
1687 1686 }[];
1688 1687 }
1689 1688
1690 1689 /* dijit/ConfirmDialog */
1691 1690
1692 1691 interface ConfirmDialog extends _ConfirmDialogMixin { }
1693 1692
1694 1693 interface ConfirmDialogConstructor extends DialogConstructor { }
1695 1694
1696 1695 /* dijit/DropDownMenu */
1697 1696
1698 1697 /**
1699 1698 * A menu, without features for context menu (Meaning, drop down menu)
1700 1699 */
1701 1700 interface DropDownMenu extends _MenuBase { }
1702 1701
1703 1702 interface DropDownMenuConstructor extends _WidgetBaseConstructor<DropDownMenu> { }
1704 1703
1705 1704 /* dijit/Fieldset */
1706 1705
1707 1706 /**
1708 1707 * An accessible fieldset that can be expanded or collapsed via
1709 1708 * its legend. Fieldset extends `dijit.TitlePane`.
1710 1709 */
1711 1710 interface Fieldset extends TitlePane {
1712 1711 open: boolean;
1713 1712 }
1714 1713
1715 1714 interface FieldsetConstructor extends _WidgetBaseConstructor<Fieldset> { }
1716 1715
1717 1716 /* dijit/Menu */
1718 1717
1719 1718 /**
1720 1719 * A context menu you can assign to multiple elements
1721 1720 */
1722 1721 interface Menu extends dijit.DropDownMenu {
1723 1722 /**
1724 1723 * Array of dom node ids of nodes to attach to.
1725 1724 * Fill this with nodeIds upon widget creation and it becomes context menu for those nodes.
1726 1725 */
1727 1726 targetNodeIds: string[];
1728 1727
1729 1728 /**
1730 1729 * CSS expression to apply this Menu to descendants of targetNodeIds, rather than to
1731 1730 * the nodes specified by targetNodeIds themselves. Useful for applying a Menu to
1732 1731 * a range of rows in a table, tree, etc.
1733 1732 *
1734 1733 * The application must require() an appropriate level of dojo/query to handle the selector.
1735 1734 */
1736 1735 selector: string;
1737 1736
1738 1737 /**
1739 1738 * If true, right clicking anywhere on the window will cause this context menu to open.
1740 1739 * If false, must specify targetNodeIds.
1741 1740 */
1742 1741 contextMenuForWindow: boolean;
1743 1742
1744 1743 /**
1745 1744 * If true, menu will open on left click instead of right click, similar to a file menu.
1746 1745 */
1747 1746 leftClickToOpen: boolean;
1748 1747
1749 1748 /**
1750 1749 * When this menu closes, re-focus the element which had focus before it was opened.
1751 1750 */
1752 1751 refocus: boolean;
1753 1752
1754 1753 /**
1755 1754 * Attach menu to given node
1756 1755 */
1757 1756 bindDomNode(node: string | Node): void;
1758 1757
1759 1758 /**
1760 1759 * Detach menu from given node
1761 1760 */
1762 1761 unBindDomNode(nodeName: string | Node): void;
1763 1762 }
1764 1763
1765 1764 interface MenuConstructor extends _WidgetBaseConstructor<Menu> { }
1766 1765
1767 1766 /* dijit/MenuBar */
1768 1767 interface MenuBar extends _MenuBase {
1769 1768 baseClass: 'dijitMenuBar';
1770 1769 popupDelay: number;
1771 1770 _isMenuBar: true;
1772 1771 _orient: string[];
1773 1772 _moveToPopup(evt: Event): void;
1774 1773 focusChild(item: _WidgetBase): void;
1775 1774 _onChildDeselect(item: _WidgetBase): void;
1776 1775 _onLeftArrow(): void;
1777 1776 _onRightArrow(): void;
1778 1777 _onDownArrow(): void;
1779 1778 _onUpArrow(): void;
1780 1779 onItemClick(item: _WidgetBase, evt: Event): void;
1781 1780 }
1782 1781
1783 1782 interface MenuBarConstructor extends _WidgetBaseConstructor<MenuBar> { }
1784 1783
1785 1784 /* dijit/MenuBarItem */
1786 1785 interface MenuBarItem extends MenuItem { }
1787 1786
1788 1787 interface MenuBarItemConstructor extends _WidgetBaseConstructor<MenuBarItem> { }
1789 1788
1790 1789 /* dijit/MenuItem */
1791 1790 interface MenuItem extends _Widget, _TemplatedMixin, _Contained, _CssStateMixin {
1792 1791 /**
1793 1792 * 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.
1794 1793 *
1795 1794 * Note that although Menu can display accelerator keys, there is no infrastructure to actually catch and execute those accelerators.
1796 1795 */
1797 1796 accelKey: string;
1798 1797
1799 1798 /**
1800 1799 * If true, the menu item is disabled.
1801 1800 * If false, the menu item is enabled.
1802 1801 */
1803 1802 disabled: boolean;
1804 1803
1805 1804 /** Menu text as HTML */
1806 1805 label: string;
1807 1806
1808 1807 /**
1809 1808 * Class to apply to DOMNode to make it display an icon.
1810 1809 */
1811 1810 iconClass: string;
1812 1811
1813 1812 /**
1814 1813 * Hook for attr('accelKey', ...) to work.
1815 1814 * Set accelKey on this menu item.
1816 1815 */
1817 1816 _setAccelKeyAttr(value: string): void;
1818 1817
1819 1818 /**
1820 1819 * Hook for attr('disabled', ...) to work.
1821 1820 * Enable or disable this menu item.
1822 1821 */
1823 1822 _setDisabledAttr(value: boolean): void;
1824 1823
1825 1824 _setLabelAttr(val: string): void;
1826 1825 _setIconClassAttr(val: string): void;
1827 1826
1828 1827 _fillContent(source: Element): void;
1829 1828
1830 1829 /**
1831 1830 * Indicate that this node is the currently selected one
1832 1831 */
1833 1832 _setSelected(selected: boolean): void;
1834 1833
1835 1834 focus(): void;
1836 1835
1837 1836 /**
1838 1837 * Deprecated.
1839 1838 * Use set('disabled', bool) instead.
1840 1839 */
1841 1840 setDisabled(disabled: boolean): void;
1842 1841
1843 1842 /**
1844 1843 * Deprecated.
1845 1844 * Use set('label', ...) instead.
1846 1845 */
1847 1846 setLabel(content: string): void;
1848 1847 }
1849 1848
1850 1849 interface MenuItemConstructor extends _WidgetBaseConstructor<MenuItem> { }
1851 1850
1852 1851 /* dijit/MenuSeparator */
1853 1852 interface MenuSeparator extends _WidgetBase, _TemplatedMixin, _Contained { }
1854 1853
1855 1854 interface MenuSeparatorConstructor extends _WidgetBaseConstructor<MenuSeparator> { }
1856 1855
1857 1856 /* dijit/place */
1858 1857
1859 1858 interface PlacePosition {
1860 1859 x: number;
1861 1860 y: number;
1862 1861 }
1863 1862
1864 1863 interface PlaceWidthHeight {
1865 1864 w: number;
1866 1865 h: number;
1867 1866 }
1868 1867
1869 1868 interface PlaceRectangle extends PlacePosition, PlaceWidthHeight { }
1870 1869
1871 1870 type PlaceCorner = 'BL' | 'TR' | 'BR' | 'TL';
1872 1871
1873 1872 type PlacePositions = 'before' | 'after' | 'before-centered' | 'after-centered' | 'above-centered' | 'above' | 'above-alt' | 'below-centered' | 'below' | 'below-alt';
1874 1873
1875 1874 interface PlaceChoice {
1876 1875 corner: PlaceCorner;
1877 1876 pos: PlacePosition;
1878 1877 aroundCorner?: PlaceCorner;
1879 1878 }
1880 1879
1881 1880 interface PlaceLocation extends PlaceRectangle {
1882 1881 corner: PlaceCorner;
1883 1882 aroundCorner: PlaceCorner;
1884 1883 overflow: number;
1885 1884 spaceAvailable: PlaceWidthHeight;
1886 1885 }
1887 1886
1888 1887 interface LayoutNodeFunction {
1889 1888 (node: HTMLElement, aroundCorner: string, corner: string, spaceAvailable: PlaceWidthHeight, aroundNodeCoords: PlaceWidthHeight): number;
1890 1889 }
1891 1890
1892 1891 interface Place {
1893 1892 /**
1894 1893 * Positions node kitty-corner to the rectangle centered at (pos.x, pos.y) with width and height of
1895 1894 * padding.x * 2 and padding.y * 2, or zero if padding not specified. Picks first corner in corners[]
1896 1895 * where node is fully visible, or the corner where it's most visible.
1897 1896 *
1898 1897 * Node is assumed to be absolutely or relatively positioned.
1899 1898 */
1900 1899 at(node: Element, pos?: PlacePosition, corners?: PlaceCorner[], padding?: PlacePosition, layoutNode?: LayoutNodeFunction): PlaceLocation;
1901 1900
1902 1901 /**
1903 1902 * Position node adjacent or kitty-corner to anchor
1904 1903 * such that it's fully visible in viewport.
1905 1904 */
1906 1905 around(node: Element, anchor: Element | PlaceRectangle, positions: PlacePositions[], leftToRight?: boolean, layoutNode?: LayoutNodeFunction): PlaceLocation;
1907 1906 }
1908 1907
1909 1908 /* dijit/popup */
1910 1909
1911 1910 interface PopupOpenArgs {
1912 1911 /**
1913 1912 * widget to display
1914 1913 */
1915 1914 popup?: _WidgetBase;
1916 1915
1917 1916 /**
1918 1917 * the button etc. that is displaying this popup
1919 1918 */
1920 1919 parent?: _WidgetBase;
1921 1920
1922 1921 /**
1923 1922 * DOM node (typically a button); place popup relative to this node. (Specify this *or* "x" and "y" parameters.)
1924 1923 */
1925 1924 around?: HTMLElement;
1926 1925
1927 1926 /**
1928 1927 * Absolute horizontal position (in pixels) to place node at. (Specify this *or* "around" parameter.)
1929 1928 */
1930 1929 x?: number;
1931 1930
1932 1931 /**
1933 1932 * Absolute vertical position (in pixels) to place node at. (Specify this *or* "around" parameter.)
1934 1933 */
1935 1934 y?: number;
1936 1935
1937 1936 /**
1938 1937 * When the around parameter is specified, orient should be a list of positions to try
1939 1938 */
1940 1939 orient?: string | string[] | { BL?: string; TR?: string; TL?: string; BR?: string; };
1941 1940
1942 1941 /**
1943 1942 * callback when user has canceled the popup by:
1944 1943 *
1945 1944 * 1. hitting ESC or
1946 1945 * 2. by using the popup widget's proprietary cancel mechanism (like a cancel button in a dialog);
1947 1946 * i.e. whenever popupWidget.onCancel() is called, args.onCancel is called
1948 1947 */
1949 1948 onCancel?: () => void;
1950 1949
1951 1950 /**
1952 1951 * callback whenever this popup is closed
1953 1952 */
1954 1953 onClose?: () => void;
1955 1954
1956 1955 /**
1957 1956 * callback when user "executed" on the popup/sub-popup by selecting a menu choice, etc. (top menu only)
1958 1957 */
1959 1958 onExecute?: () => void;
1960 1959
1961 1960 /**
1962 1961 * adding a buffer around the opening position. This is only useful when around is not set.
1963 1962 */
1964 1963 padding?: PlacePosition;
1965 1964
1966 1965 /**
1967 1966 * The max height for the popup. Any popup taller than this will have scrollbars.
1968 1967 * Set to Infinity for no max height. Default is to limit height to available space in viewport,
1969 1968 * above or below the aroundNode or specified x/y position.
1970 1969 */
1971 1970 maxHeight?: number;
1972 1971 }
1973 1972
1974 1973 interface PopupManager {
1975 1974 /**
1976 1975 * Stack of currently popped up widgets.
1977 1976 * (someone opened _stack[0], and then it opened _stack[1], etc.)
1978 1977 */
1979 1978 _stack: _WidgetBase[];
1980 1979
1981 1980 /**
1982 1981 * Z-index of the first popup. (If first popup opens other
1983 1982 * popups they get a higher z-index.)
1984 1983 */
1985 1984 _beginZIndex: number;
1986 1985
1987 1986 _idGen: number;
1988 1987
1989 1988 /**
1990 1989 * If screen has been scrolled, reposition all the popups in the stack.
1991 1990 * Then set timer to check again later.
1992 1991 */
1993 1992 _repositionAll(): void;
1994 1993
1995 1994 /**
1996 1995 * Initialization for widgets that will be used as popups.
1997 1996 * Puts widget inside a wrapper DIV (if not already in one),
1998 1997 * and returns pointer to that wrapper DIV.
1999 1998 */
2000 1999 _createWrapper(widget: _WidgetBase): HTMLDivElement;
2001 2000
2002 2001 /**
2003 2002 * Moves the popup widget off-screen.
2004 2003 * Do not use this method to hide popups when not in use, because
2005 2004 * that will create an accessibility issue: the offscreen popup is
2006 2005 * still in the tabbing order.
2007 2006 */
2008 2007 moveOffScreen(widget: _WidgetBase): HTMLDivElement;
2009 2008
2010 2009 /**
2011 2010 * Hide this popup widget (until it is ready to be shown).
2012 2011 * Initialization for widgets that will be used as popups
2013 2012 *
2014 2013 * Also puts widget inside a wrapper DIV (if not already in one)
2015 2014 *
2016 2015 * If popup widget needs to layout it should
2017 2016 * do so when it is made visible, and popup._onShow() is called.
2018 2017 */
2019 2018 hide(widget: _WidgetBase): void;
2020 2019
2021 2020 /**
2022 2021 * Compute the closest ancestor popup that's *not* a child of another popup.
2023 2022 * Ex: For a TooltipDialog with a button that spawns a tree of menus, find the popup of the button.
2024 2023 */
2025 2024 getTopPopup(): _WidgetBase;
2026 2025
2027 2026 /**
2028 2027 * Popup the widget at the specified position
2029 2028 */
2030 2029 open(args: PopupOpenArgs): PlaceLocation;
2031 2030
2032 2031 /**
2033 2032 * Close specified popup and any popups that it parented.
2034 2033 * If no popup is specified, closes all popups.
2035 2034 */
2036 2035 close(popup?: _WidgetBase): void;
2037 2036 }
2038 2037
2039 2038 /* dijit/PopupMenuBarItem */
2040 2039
2041 2040 interface PopupMenuBarItem extends PopupMenuItem { }
2042 2041
2043 2042 interface PopupMenuBarItemConstructor extends _WidgetBaseConstructor<PopupMenuBarItem> { }
2044 2043
2045 2044 /** dijit/PopupMenuItem */
2046 2045
2047 2046 /**
2048 2047 * An item in a Menu that spawn a drop down (usually a drop down menu)
2049 2048 */
2050 2049 interface PopupMenuItem extends MenuItem {
2051 2050 /**
2052 2051 * When Menu is declared in markup, this code gets the menu label and the popup widget from the srcNodeRef.
2053 2052 *
2054 2053 * srcNodeRef.innerHTML contains both the menu item text and a popup widget
2055 2054 * The first part holds the menu item text and the second part is the popup
2056 2055 */
2057 2056 _fillContent(source: Element): void;
2058 2057
2059 2058 /**
2060 2059 * Open the popup to the side of/underneath this MenuItem, and optionally focus first item
2061 2060 */
2062 2061 _openPopup(params: { around?: Element; popup?: Function }, focus?: boolean): void;
2063 2062
2064 2063 _closePopup(): void;
2065 2064 }
2066 2065
2067 2066 interface PopupMenuItemConstructor extends _WidgetBaseConstructor<PopupMenuItem> { }
2068 2067
2069 2068 /* dijit/registry */
2070 2069
2071 2070 interface Registry {
2072 2071 /**
2073 2072 * Number of registered widgets
2074 2073 */
2075 2074 length: number;
2076 2075
2077 2076 /**
2078 2077 * Add a widget to the registry. If a duplicate ID is detected, a error is thrown.
2079 2078 */
2080 2079 add(widget: _WidgetBase): void;
2081 2080
2082 2081 /**
2083 2082 * Remove a widget from the registry. Does not destroy the widget; simply
2084 2083 * removes the reference.
2085 2084 */
2086 2085 remove(id: string): void;
2087 2086
2088 2087 /**
2089 2088 * Find a widget by it's id.
2090 2089 * If passed a widget then just returns the widget.
2091 2090 */
2092 2091 byId(id: string | _WidgetBase): _WidgetBase;
2093 2092
2094 2093 /**
2095 2094 * Returns the widget corresponding to the given DOMNode
2096 2095 */
2097 2096 byNode(node: Element | Node): _WidgetBase;
2098 2097
2099 2098 /**
2100 2099 * Convert registry into a true Array
2101 2100 */
2102 2101 toArray(): _WidgetBase[];
2103 2102
2104 2103 /**
2105 2104 * Generates a unique id for a given widgetType
2106 2105 */
2107 2106 getUniqueId(widgetType: string): string;
2108 2107
2109 2108 /**
2110 2109 * Search subtree under root returning widgets found.
2111 2110 * Doesn't search for nested widgets (ie, widgets inside other widgets).
2112 2111 */
2113 2112 findWidgets(root: Node, skipNode?: Node): _WidgetBase[];
2114 2113
2115 2114 /**
2116 2115 * Returns the widget whose DOM tree contains the specified DOMNode, or null if
2117 2116 * the node is not contained within the DOM tree of any widget
2118 2117 */
2119 2118 getEnclosingWidget(node: Element | Node): _WidgetBase;
2120 2119 }
2121 2120
2122 2121 /* dijit/TitlePane */
2123 2122
2124 2123 interface TitlePane extends dijit.layout.ContentPane, _TemplatedMixin, _CssStateMixin {
2125 2124 /**
2126 2125 * Whether pane can be opened or closed by clicking the title bar.
2127 2126 */
2128 2127 toggleable: boolean;
2129 2128
2130 2129 /**
2131 2130 * Tabindex setting for the title (so users can tab to the title then use space/enter to open/close the title pane)
2132 2131 */
2133 2132 tabIndex: string;
2134 2133
2135 2134 /**
2136 2135 * Time in milliseconds to fade in/fade out
2137 2136 */
2138 2137 duration: number;
2139 2138
2140 2139 /**
2141 2140 * Don't change this parameter from the default value.
2142 2141 *
2143 2142 * 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.
2144 2143 */
2145 2144 doLayout: boolean;
2146 2145
2147 2146 /**
2148 2147 * Switches between opened and closed state
2149 2148 */
2150 2149 toggle(): void;
2151 2150
2152 2151 /**
2153 2152 * Set the open/close css state for the TitlePane
2154 2153 */
2155 2154 _setCss(): void;
2156 2155
2157 2156 /**
2158 2157 * Handler for when user hits a key
2159 2158 */
2160 2159 _onTitleKey(e: Event): void;
2161 2160
2162 2161 /**
2163 2162 * Handler when user clicks the title bar
2164 2163 */
2165 2164 _onTitleClick(): void;
2166 2165
2167 2166 /**
2168 2167 * Deprecated. Use set('title', ...) instead.
2169 2168 */
2170 2169 setTitle(): void;
2171 2170 }
2172 2171
2173 2172 interface TitlePaneConstructor extends _WidgetBaseConstructor<TitlePane> { }
2174 2173
2175 2174 /* dijit/Toolbar */
2176 2175
2177 2176 interface Toolbar extends dijit._Widget, dijit._TemplatedMixin, dijit._KeyNavContainer { }
2178 2177
2179 2178 interface ToolbarConstructor extends _WidgetBaseConstructor<Toolbar> { }
2180 2179
2181 2180 /* dijit/ToolbarSeparator */
2182 2181
2183 2182 interface ToolbarSeparator extends dijit._Widget, dijit._TemplatedMixin { }
2184 2183
2185 2184 interface ToolbarSeparatorConstructor extends _WidgetBaseConstructor<ToolbarSeparator> { }
2186 2185
2187 2186 /* dijit/Tooltip */
2188 2187
2189 2188 interface Tooltip extends _Widget {
2190 2189 /**
2191 2190 * HTML to display in the tooltip.
2192 2191 * Specified as innerHTML when creating the widget from markup.
2193 2192 */
2194 2193 label: string;
2195 2194
2196 2195 /**
2197 2196 * Number of milliseconds to wait after hovering over/focusing on the object, before
2198 2197 * the tooltip is displayed.
2199 2198 */
2200 2199 showDelay: number;
2201 2200
2202 2201 /**
2203 2202 * Number of milliseconds to wait after unhovering the object, before
2204 2203 * the tooltip is hidden. Note that blurring an object hides the tooltip immediately.
2205 2204 */
2206 2205 hideDelay: number;
2207 2206
2208 2207 /**
2209 2208 * Id of domNode(s) to attach the tooltip to.
2210 2209 * When user hovers over specified dom node(s), the tooltip will appear.
2211 2210 */
2212 2211 connectId: dojo.NodeOrString | dojo.NodeOrString[];
2213 2212
2214 2213 /**
2215 2214 * See description of `dijit/Tooltip.defaultPosition` for details on position parameter.
2216 2215 */
2217 2216 position: string;
2218 2217
2219 2218 /**
2220 2219 * CSS expression to apply this Tooltip to descendants of connectIds, rather than to
2221 2220 * the nodes specified by connectIds themselves. Useful for applying a Tooltip to
2222 2221 * a range of rows in a table, tree, etc. Use in conjunction with getContent() parameter.
2223 2222 * Ex: connectId: myTable, selector: "tr", getContent: function(node){ return ...; }
2224 2223 *
2225 2224 * The application must require() an appropriate level of dojo/query to handle the selector.
2226 2225 */
2227 2226 selector: string;
2228 2227
2229 2228 /**
2230 2229 * Attach tooltip to specified node if it's not already connected
2231 2230 */
2232 2231 addTarget(node: dojo.NodeOrString): void;
2233 2232
2234 2233 /**
2235 2234 * Detach tooltip from specified node
2236 2235 */
2237 2236 removeTarget(node: dojo.NodeOrString): void;
2238 2237
2239 2238 /**
2240 2239 * User overridable function that return the text to display in the tooltip.
2241 2240 */
2242 2241 getContent(node: Node): Node;
2243 2242
2244 2243 /**
2245 2244 * Display the tooltip; usually not called directly.
2246 2245 */
2247 2246 open(target: Node): void;
2248 2247
2249 2248 /**
2250 2249 * Hide the tooltip or cancel timer for show of tooltip
2251 2250 */
2252 2251 close(): void;
2253 2252
2254 2253 /**
2255 2254 * Called when the tooltip is shown
2256 2255 */
2257 2256 onShow(): void;
2258 2257
2259 2258 /**
2260 2259 * Called when the tooltip is hidden
2261 2260 */
2262 2261 onHide(): void;
2263 2262 }
2264 2263
2265 2264 interface TooltipConstructor extends _WidgetBaseConstructor<Tooltip> {
2266 2265 /**
2267 2266 * This variable controls the position of tooltips, if the position is not specified to
2268 2267 * the Tooltip widget or *TextBox widget itself. It's an array of strings with the values
2269 2268 * possible for `dijit/place.around()`. The recommended values are:
2270 2269 *
2271 2270 * - before-centered: centers tooltip to the left of the anchor node/widget, or to the right
2272 2271 * in the case of RTL scripts like Hebrew and Arabic
2273 2272 * - after-centered: centers tooltip to the right of the anchor node/widget, or to the left
2274 2273 * in the case of RTL scripts like Hebrew and Arabic
2275 2274 * - above-centered: tooltip is centered above anchor node
2276 2275 * - below-centered: tooltip is centered above anchor node
2277 2276 *
2278 2277 * The list is positions is tried, in order, until a position is found where the tooltip fits
2279 2278 * within the viewport.
2280 2279 *
2281 2280 * Be careful setting this parameter. A value of "above-centered" may work fine until the user scrolls
2282 2281 * the screen so that there's no room above the target node. Nodes with drop downs, like
2283 2282 * DropDownButton or FilteringSelect, are especially problematic, in that you need to be sure
2284 2283 * that the drop down and tooltip don't overlap, even when the viewport is scrolled so that there
2285 2284 * is only room below (or above) the target node, but not both.
2286 2285 */
2287 2286 defaultPosition: [string];
2288 2287
2289 2288 /**
2290 2289 * Static method to display tooltip w/specified contents in specified position.
2291 2290 * See description of dijit/Tooltip.defaultPosition for details on position parameter.
2292 2291 * If position is not specified then dijit/Tooltip.defaultPosition is used.
2293 2292 */
2294 2293 show(innerHTML: string, aroundNode: PlaceRectangle, position?: [string], rtl?: boolean, textDir?: string, onMouseEnter?: Function, onMouseLeave?: Function): void;
2295 2294
2296 2295 /**
2297 2296 * Hide the tooltip
2298 2297 */
2299 2298 hide(aroundNode: PlaceRectangle): void;
2300 2299 }
2301 2300
2302 2301 /* dijit/TooltipDialog */
2303 2302
2304 2303 interface TooltipDialog extends layout.ContentPane, _TemplatedMixin, form._FormMixin, _DialogMixin {
2305 2304 /**
2306 2305 * Description of tooltip dialog (required for a11y)
2307 2306 */
2308 2307 title: string;
2309 2308
2310 2309 /**
2311 2310 * Don't change this parameter from the default value.
2312 2311 * This ContentPane parameter doesn't make sense for TooltipDialog, since TooltipDialog
2313 2312 * is never a child of a layout container, nor can you specify the size of
2314 2313 * TooltipDialog in order to control the size of an inner widget.
2315 2314 */
2316 2315 doLayout: boolean;
2317 2316
2318 2317 /**
2319 2318 * A Toggle to modify the default focus behavior of a Dialog, which
2320 2319 * is to focus on the first dialog element after opening the dialog.
2321 2320 * False will disable autofocusing. Default: true.
2322 2321 */
2323 2322 autofocus: boolean;
2324 2323
2325 2324 /**
2326 2325 * The pointer to the first focusable node in the dialog.
2327 2326 */
2328 2327 _firstFocusItem: any;
2329 2328
2330 2329 /**
2331 2330 * The pointer to which node has focus prior to our dialog.
2332 2331 */
2333 2332 _lastFocusItem: any;
2334 2333
2335 2334 /**
2336 2335 * Configure widget to be displayed in given position relative to the button.
2337 2336 *
2338 2337 * This is called from the dijit.popup code, and should not be called directly.
2339 2338 */
2340 2339 orient(node: Node | HTMLElement, aroundCorner: PlaceCorner, tooltipCorner: PlaceCorner): void;
2341 2340
2342 2341 /**
2343 2342 * Focus on first field
2344 2343 */
2345 2344 focus(): void;
2346 2345
2347 2346 /**
2348 2347 * Called when dialog is displayed.
2349 2348 *
2350 2349 * This is called from the dijit.popup code, and should not be called directly.
2351 2350 */
2352 2351 onOpen(pos: {
2353 2352 aroundCorner: PlaceCorner
2354 2353 aroundNodePos: PlacePosition
2355 2354 corner: PlaceCorner
2356 2355 x: number
2357 2356 y: number
2358 2357 }): void;
2359 2358
2360 2359 /**
2361 2360 * Handler for keydown events
2362 2361 *
2363 2362 * Keep keyboard focus in dialog; close dialog on escape key
2364 2363 */
2365 2364 _onKey(evt: KeyboardEvent): void;
2366 2365 }
2367 2366
2368 2367 interface TooltipDialogConstructor extends _WidgetBaseConstructor<TooltipDialog> { }
2369 2368 }
General Comments 0
You need to be logged in to leave comments. Login now