##// END OF EJS Templates
some fixes after testing
cin -
r5:af2703f9110e default
parent child
Show More
@@ -1,68 +1,70
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 = ["../main/typings/dojo/modules","../main/typings/dijit/modules"]
43 module = "ESNext"
44 it.target = "ESNext"
43 45 }
44 46 }
45 47
46 48 npmPackMeta {
47 49 meta {
48 50 name = "@$npmScope/$project.name"
49 51 }
50 52 }
51 53
52 54 task npmPackTypings(type: Copy) {
53 55 dependsOn typings
54 56
55 57 npmPackContents.dependsOn it
56 58
57 59 from typescript.typingsDir
58 60 into npm.packageDir
59 61 }
60 62
61 63 task printVersion {
62 64 doLast {
63 65 println "packageName: ${npmPackMeta.metadata.get().name}";
64 66 println "version: $version";
65 67 println "target: $typescript.compilerOptions.target";
66 68 println "module: $typescript.compilerOptions.module";
67 69 }
68 70 } No newline at end of file
@@ -1,2380 +1,2384
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
552 556 interface _WidgetBase {
553 557 /**
554 558 * Used across all instances a hash to cache attribute names and their getter
555 559 * and setter names.
556 560 */
557 561 _attrPairNames: { [attr: string]: string };
558 562
559 563 /**
560 564 * Helper function for get() and set().
561 565 * Caches attribute name values so we don't do the string ops every time.
562 566 */
563 567 _getAttrNames(name: string): string;
564 568
565 569 /**
566 570 * Internal helper for directly changing an attribute value.
567 571 * This method id derived from Stateful and must not be used!
568 572 * @deprecated use `_set(name, value)` instead.
569 573 */
570 574 _changeAttrValue(name: string, value: any): this;
571 575
572 get<K extends keyof this & string>(name: K): this[K];
576 get<K extends keyof this>(name: K): this[K];
573 577
574 578 /**
575 579 * Helper function to set new value for specified property, and call handlers
576 580 * registered with watch() if the value has changed.
577 581 * @param name
578 582 * @param value
579 583 */
580 584 _set<K extends keyof this>(name: K, value: this[K]): void;
581 585
582 586 /**
583 587 * Helper function to get value for specified property stored by this._set(),
584 588 * i.e. for properties with custom setters. Used mainly by custom getters.
585 589 *
586 590 * For example, CheckBox._getValueAttr() calls this._get("value").
587 591 * @param name
588 592 */
589 593 _get<K extends keyof this>(name: K): this[K];
590 594
591 595 /**
592 596 * Set a property on a Stateful instance
593 597 */
594 set<K extends keyof this & string>(name: K, value: this[K]): this;
595 set<K extends { [p in keyof this]: this[p] extends any[] ? p : never; }[keyof this & string]>(name: K, ...values: this[K]): this;
596 set(values: Partial<this>): this;
598 set<K extends keyof this>(name: K, value: this[K]): this;
599 set<K extends keyof this, V extends this[K] & any[]>(name: K, ...values: V): this;
600 set<K extends keyof this>(values: {[p in K]: this[p]}): this;
597 601
598 602 /**
599 603 * Watches a property for changes
600 604 */
601 605 watch(callback: <K extends keyof any>(prop: K, oldValue: any, newValue: any) => void): dojo.WatchHandle;
602 watch<K extends keyof this>(name: K, callback: (prop: K, oldValue: this[K], newValue: this[K]) => void): dojo.WatchHandle;
606 watch<K extends Props<this>>(name: K, callback: (prop: K, oldValue: this[K], newValue: this[K]) => void): dojo.WatchHandle;
603 607 }
604 608
605 609 type EventInitArgs<T extends Event> = {
606 610 [p in keyof T]?: T[p] extends (...args: any) => any ? never : T[p];
607 611 };
608 612
609 613 /* dijit/_WidgetBase */
610 614 interface _WidgetBase<Events extends { [name in keyof Events]: Event } = GlobalEventHandlersEventMap> extends Destroyable {
611 615
612 616 /**
613 617 * A unique, opaque ID string that can be assigned by users or by the
614 618 * system. If the developer passes an ID which is known not to be
615 619 * unique, the specified ID is ignored and the system-generated ID is
616 620 * used instead.
617 621 */
618 622 id: string;
619 623
620 624 /**
621 625 * Rarely used. Overrides the default Dojo locale used to render this widget,
622 626 * as defined by the [HTML LANG](http://www.w3.org/TR/html401/struct/dirlang.html#adef-lang) attribute.
623 627 * Value must be among the list of locales specified during by the Dojo bootstrap,
624 628 * formatted according to [RFC 3066](http://www.ietf.org/rfc/rfc3066.txt) (like en-us).
625 629 */
626 630 lang: string;
627 631
628 632 /**
629 633 * Bi-directional support, as defined by the [HTML DIR](http://www.w3.org/TR/html401/struct/dirlang.html#adef-dir)
630 634 * attribute. Either left-to-right "ltr" or right-to-left "rtl". If undefined, widgets renders in page's
631 635 * default direction.
632 636 */
633 637 dir: string;
634 638
635 639 /**
636 640 * HTML class attribute
637 641 */
638 642 class: string;
639 643
640 644 /**
641 645 * HTML style attributes as cssText string or name/value hash
642 646 */
643 647 style: string;
644 648
645 649 /**
646 650 * HTML title attribute.
647 651 *
648 652 * For form widgets this specifies a tooltip to display when hovering over
649 653 * the widget (just like the native HTML title attribute).
650 654 *
651 655 * For TitlePane or for when this widget is a child of a TabContainer, AccordionContainer,
652 656 * etc., it's used to specify the tab label, accordion pane title, etc. In this case it's
653 657 * interpreted as HTML.
654 658 */
655 659 title: string;
656 660
657 661 /**
658 662 * When this widget's title attribute is used to for a tab label, accordion pane title, etc.,
659 663 * this specifies the tooltip to appear when the mouse is hovered over that text.
660 664 */
661 665 tooltip: string;
662 666
663 667 /**
664 668 * Root CSS class of the widget (ex: dijitTextBox), used to construct CSS classes to indicate
665 669 * widget state.
666 670 */
667 671 baseClass: string;
668 672
669 673 /**
670 674 * pointer to original DOM node
671 675 */
672 676 srcNodeRef: HTMLElement;
673 677
674 678 /**
675 679 * This is our visible representation of the widget! Other DOM
676 680 * Nodes may by assigned to other properties, usually through the
677 681 * template system's data-dojo-attach-point syntax, but the domNode
678 682 * property is the canonical "top level" node in widget UI.
679 683 */
680 684 domNode: HTMLElement;
681 685
682 686 /**
683 687 * Designates where children of the source DOM node will be placed.
684 688 * "Children" in this case refers to both DOM nodes and widgets.
685 689 */
686 690 containerNode: HTMLElement;
687 691
688 692 /**
689 693 * The document this widget belongs to. If not specified to constructor, will default to
690 694 * srcNodeRef.ownerDocument, or if no sourceRef specified, then to the document global
691 695 */
692 696 ownerDocument: HTMLElement;
693 697
694 698 /**
695 699 * Deprecated. Instead of attributeMap, widget should have a _setXXXAttr attribute
696 700 * for each XXX attribute to be mapped to the DOM.
697 701 */
698 702 attributeMap: { [attribute: string]: any };
699 703
700 704 /**
701 705 * Bi-directional support, the main variable which is responsible for the direction of the text.
702 706 * The text direction can be different than the GUI direction by using this parameter in creation
703 707 * of a widget.
704 708 */
705 709 textDir: string;
706 710
707 711 _started?: boolean;
708 712
709 713 /**
710 714 * Kicks off widget instantiation. See create() for details.
711 715 */
712 716 postscript(params?: any, srcNodeRef?: HTMLElement): void;
713 717
714 718 /**
715 719 * Kick off the life-cycle of a widget
716 720 */
717 721 create(params?: any, srcNodeRef?: HTMLElement): void;
718 722
719 723 /**
720 724 * Called after the parameters to the widget have been read-in,
721 725 * but before the widget template is instantiated. Especially
722 726 * useful to set properties that are referenced in the widget
723 727 * template.
724 728 */
725 729 postMixInProperties(): void;
726 730
727 731 /**
728 732 * Construct the UI for this widget, setting this.domNode.
729 733 * Most widgets will mixin `dijit._TemplatedMixin`, which implements this method.
730 734 */
731 735 buildRendering(): void;
732 736
733 737 /**
734 738 * Processing after the DOM fragment is created
735 739 */
736 740 postCreate(): void;
737 741
738 742 /**
739 743 * Processing after the DOM fragment is added to the document
740 744 */
741 745 startup(): void;
742 746
743 747 /**
744 748 * Destroy this widget and its descendants
745 749 */
746 750 destroyRecursive(preserveDom?: boolean): void;
747 751
748 752 /**
749 753 * Destroys the DOM nodes associated with this widget.
750 754 */
751 755 destroyRendering(preserveDom?: boolean): void;
752 756
753 757 /**
754 758 * Recursively destroy the children of this widget and their
755 759 * descendants.
756 760 */
757 761 destroyDescendants(preserveDom?: boolean): void;
758 762
759 763 /**
760 764 * Deprecated. Override destroy() instead to implement custom widget tear-down
761 765 * behavior.
762 766 * @deprecated
763 767 */
764 768 uninitialize(): boolean;
765 769
766 770 /**
767 771 * Used by widgets to signal that a synthetic event occurred, ex:
768 772 * | myWidget.emit("attrmodified-selectedChildWidget", {}).
769 773 */
770 774 emit<K extends keyof Events>(eventName: K, evt: EventInitArgs<Events[K]>): void;
771 775
772 776 /**
773 777 * @param type
774 778 * @param eventObj
775 779 * @param callbackArgs
776 780 */
777 781 emit<K extends string>(
778 782 type: K,
779 783 eventObj?: K extends keyof Events ? EventInitArgs<Events[K]> : any,
780 784 callbackArgs?: any[]
781 785 ): any;
782 786
783 787 /**
784 788 * Call specified function when event occurs, ex: myWidget.on("click", function(){ ... }).
785 789 */
786 790 on<K extends keyof Events>(eventName: K, cb: (evt: Events[K]) => void): dojo.WatchHandle;
787 791
788 792 on(type: string | dojo.ExtensionEvent, func: dojo.EventListener | Function): dojo.WatchHandle;
789 793
790 794 /**
791 795 * Returns a string that represents the widget.
792 796 */
793 797 toString(): string;
794 798
795 799 /**
796 800 * Returns all direct children of this widget, i.e. all widgets underneath this.containerNode whose parent
797 801 * is this widget. Note that it does not return all descendants, but rather just direct children.
798 802 */
799 803 getChildren<T extends _WidgetBase>(): T[];
800 804
801 805 /**
802 806 * Returns the parent widget of this widget.
803 807 */
804 808 getParent<T extends _WidgetBase>(): T;
805 809
806 810 /**
807 811 * Deprecated, will be removed in 2.0, use this.own(on(...)) or this.own(aspect.after(...)) instead.
808 812 * @deprecated
809 813 */
810 814 connect(obj: any, event: string | dojo.ExtensionEvent, method: string | dojo.EventListener): dojo.WatchHandle;
811 815
812 816 /**
813 817 * Deprecated, will be removed in 2.0, use handle.remove() instead.
814 818 * @deprecated
815 819 */
816 820 disconnect(handle: dojo.WatchHandle): void;
817 821
818 822 /**
819 823 * Deprecated, will be removed in 2.0, use this.own(topic.subscribe()) instead.
820 824 * @deprecated
821 825 */
822 826 subscribe(t: string, method: dojo.EventListener): dojo.WatchHandle;
823 827
824 828 /**
825 829 * Deprecated, will be removed in 2.0, use handle.remove() instead.
826 830 * @deprecated
827 831 */
828 832 unsubscribe(handle: dojo.WatchHandle): void;
829 833
830 834 /**
831 835 * Return this widget's explicit or implicit orientation (true for LTR, false for RTL)
832 836 */
833 837 isLeftToRight(): boolean;
834 838
835 839 /**
836 840 * Return true if this widget can currently be focused
837 841 * and false if not
838 842 */
839 843 isFocusable(): boolean;
840 844
841 845 /**
842 846 * Place this widget somewhere in the DOM based
843 847 * on standard domConstruct.place() conventions.
844 848 */
845 849 placeAt<T extends _WidgetBase>(reference: dojo.NodeFragmentOrString | T, position?: string | number): this;
846 850
847 851 /**
848 852 * Wrapper to setTimeout to avoid deferred functions executing
849 853 * after the originating widget has been destroyed.
850 854 * Returns an object handle with a remove method (that returns null) (replaces clearTimeout).
851 855 */
852 856 defer(fcn: Function, delay?: number): dojo.Handle;
853 857 }
854 858
855 859 interface _WidgetBaseConstructor<W> extends Pick<dojo._base.DeclareConstructor<W>, Exclude<keyof dojo._base.DeclareConstructor<W>, 'new'>> {
856 860 new(params?: Partial<W> & ThisType<W>, srcNodeRef?: dojo.NodeOrString): W & dojo._base.DeclareCreatedObject;
857 861 }
858 862
859 863 /* dijit/_WidgetsInTemplateMixin */
860 864
861 865 interface _WidgetsInTemplateMixin {
862 866 /**
863 867 * Used to provide a context require to dojo/parser in order to be
864 868 * able to use relative MIDs (e.g. `./Widget`) in the widget's template.
865 869 */
866 870 contextRequire: Function;
867 871
868 872 startup(): void;
869 873 }
870 874
871 875 interface _WidgetsInTemplateMixinConstructor extends dojo._base.DeclareConstructor<_WidgetsInTemplateMixin> {
872 876 new(params: Object, srcNodeRef: dojo.NodeOrString): _WidgetsInTemplateMixin;
873 877 }
874 878
875 879 /* dijit/a11yclick */
876 880
877 881 interface A11yClick {
878 882
879 883 /**
880 884 * Custom press, release, and click synthetic events
881 885 * which trigger on a left mouse click, touch, or space/enter keyup.
882 886 */
883 887 (node: HTMLElement, listener: Function): dojo.Handle;
884 888
885 889 /**
886 890 * Mousedown (left button), touchstart, or keydown (space or enter) corresponding to logical click operation.
887 891 */
888 892 press: dojo.ExtensionEvent;
889 893
890 894 /**
891 895 * Mouseup (left button), touchend, or keyup (space or enter) corresponding to logical click operation.
892 896 */
893 897 release: dojo.ExtensionEvent;
894 898
895 899 /**
896 900 * Mouse cursor or a finger is dragged over the given node.
897 901 */
898 902 move: dojo.ExtensionEvent;
899 903 }
900 904
901 905 /* dijit/Calendar */
902 906
903 907 interface _MonthDropDownButton extends form.DropDownButton<_MonthDropDown> {
904 908 onMonthSelect(): void;
905 909 postCreate(): void;
906 910
907 911 //set(name: 'month', value: number): this;
908 912 //set(name: string, value: any): this;
909 913 //set(values: Object): this;
910 914 }
911 915
912 916 interface _MonthDropDownButtonConstructor extends _WidgetBaseConstructor<_MonthDropDownButton> { }
913 917
914 918 interface _MonthDropDown extends _Widget, _TemplatedMixin, _CssStateMixin {
915 919 months: string[];
916 920 baseClass: string;
917 921 templateString: string;
918 922
919 923 /**
920 924 * Callback when month is selected from drop down
921 925 */
922 926 onChange(month: number): void;
923 927
924 928 //set(name: 'months', value: string[]): this;
925 929 //set(name: string, value: any): this;
926 930 //set(values: Object): this;
927 931 }
928 932
929 933 interface _MonthDropDownConstructor extends _WidgetBaseConstructor<_MonthDropDown> { }
930 934
931 935 interface Calendar extends CalendarLite, _Widget, _CssStateMixin {
932 936
933 937 baseClass: string;
934 938
935 939 /**
936 940 * Set node classes for various mouse events, see dijit._CssStateMixin for more details
937 941 */
938 942 cssStateNodes: CSSStateNodes;
939 943
940 944 /**
941 945 * Creates the drop down button that displays the current month and lets user pick a new one
942 946 */
943 947 _createMonthWidget(): _MonthDropDownButton;
944 948
945 949 postCreate(): void;
946 950
947 951 /**
948 952 * Handler for when user selects a month from the drop down list
949 953 */
950 954 _onMonthSelect(newMonth: number): void;
951 955
952 956 /**
953 957 * Handler for mouse over events on days, sets hovered style
954 958 */
955 959 _onDayMouseOver(evt: MouseEvent): void;
956 960
957 961 /**
958 962 * Handler for mouse out events on days, clears hovered style
959 963 */
960 964 _onDayMouseOut(evt: MouseEvent): void;
961 965 _onDayMouseDown(evt: MouseEvent): void;
962 966 _onDayMouseUp(evt: MouseEvent): void;
963 967
964 968 /**
965 969 * Provides keyboard navigation of calendar.
966 970 */
967 971 handleKey(evt: KeyboardEvent): void;
968 972
969 973 /**
970 974 * For handling keydown events on a stand alone calendar
971 975 */
972 976 _onKeyDown(evt: KeyboardEvent): void;
973 977
974 978 /**
975 979 * Deprecated. Notification that a date cell was selected. It may be the same as the previous value.
976 980 */
977 981 onValueSelected(date: Date): void;
978 982
979 983 onChange(date: Date): void;
980 984
981 985 /**
982 986 * May be overridden to return CSS classes to associate with the date entry for the given dateObject
983 987 * for example to indicate a holiday in specified locale.
984 988 */
985 989 getClassForDate(dateObject: Date, locale?: string): string;
986 990
987 991 // get(name: 'value'): Date;
988 992 // get(name: string): any;
989 993
990 994 // set(name: 'value', value: number | Date): this;
991 995 // set(name: string, value: any): this;
992 996 // set(values: Object): this;
993 997 }
994 998
995 999 interface CalendarConstructor extends _WidgetBaseConstructor<Calendar> {
996 1000 _MonthWidget: _MonthWidgetConstructor;
997 1001 _MonthDropDown: _MonthDropDownButtonConstructor;
998 1002 _MonthDropDownButton: _MonthDropDownButtonConstructor;
999 1003 }
1000 1004
1001 1005 /* dijit/CalendarLite */
1002 1006
1003 1007 interface _MonthWidget extends _WidgetBase {
1004 1008 // set(name: 'month', value: Date): this;
1005 1009 // set(name: string, value: any): this;
1006 1010 // set(values: Object): this;
1007 1011 }
1008 1012
1009 1013 interface _MonthWidgetConstructor extends _WidgetBaseConstructor<_MonthWidget> { }
1010 1014
1011 1015 interface CalendarLite extends _WidgetBase, _TemplatedMixin {
1012 1016 /**
1013 1017 * Template for main calendar
1014 1018 */
1015 1019 templateString: string;
1016 1020
1017 1021 /**
1018 1022 * Template for cell for a day of the week (ex: M)
1019 1023 */
1020 1024 dowTemplateString: string;
1021 1025
1022 1026 dateTemplateString: string;
1023 1027 weekTemplateString: string;
1024 1028
1025 1029 /**
1026 1030 * The currently selected Date, initially set to invalid date to indicate no selection.
1027 1031 */
1028 1032 value: Date;
1029 1033
1030 1034 /**
1031 1035 * JavaScript namespace to find calendar routines. If unspecified, uses Gregorian calendar routines
1032 1036 * at dojo/date and dojo/date/locale.
1033 1037 */
1034 1038 datePackage: string;
1035 1039
1036 1040 /**
1037 1041 * How to represent the days of the week in the calendar header. See locale
1038 1042 */
1039 1043 dayWidth: string;
1040 1044
1041 1045 /**
1042 1046 * Order fields are traversed when user hits the tab key
1043 1047 */
1044 1048 tabIndex: string;
1045 1049
1046 1050 /**
1047 1051 * (Optional) The first day of week override. By default the first day of week is determined
1048 1052 * for the current locale (extracted from the CLDR).
1049 1053 * Special value -1 (default value), means use locale dependent value.
1050 1054 */
1051 1055 dayOffset: number;
1052 1056
1053 1057 /**
1054 1058 * Date object containing the currently focused date, or the date which would be focused
1055 1059 * if the calendar itself was focused. Also indicates which year and month to display,
1056 1060 * i.e. the current "page" the calendar is on.
1057 1061 */
1058 1062 currentFocus: Date;
1059 1063
1060 1064 /**
1061 1065 * Put the summary to the node with role=grid
1062 1066 */
1063 1067 _setSummaryAttr: string;
1064 1068
1065 1069 baseClass: string;
1066 1070
1067 1071 /**
1068 1072 * Runs various tests on the value, checking that it's a valid date, rather
1069 1073 * than blank or NaN.
1070 1074 */
1071 1075 _isValidDate(value: Date): boolean;
1072 1076
1073 1077 /**
1074 1078 * Convert Number into Date, or copy Date object. Then, round to nearest day,
1075 1079 * setting to 1am to avoid issues when DST shift occurs at midnight, see #8521, #9366)
1076 1080 */
1077 1081 _patchDate(value: number | Date): Date;
1078 1082
1079 1083 /**
1080 1084 * This just sets the content of node to the specified text.
1081 1085 * Can't do "node.innerHTML=text" because of an IE bug w/tables, see #3434.
1082 1086 */
1083 1087 _setText(node: HTMLElement, text?: string): void;
1084 1088
1085 1089 /**
1086 1090 * Fills in the calendar grid with each day (1-31).
1087 1091 * Call this on creation, when moving to a new month.
1088 1092 */
1089 1093 _populateGrid(): void;
1090 1094
1091 1095 /**
1092 1096 * Fill in localized month, and prev/current/next years
1093 1097 */
1094 1098 _populateControls(): void;
1095 1099
1096 1100 /**
1097 1101 * Sets calendar's value to today's date
1098 1102 */
1099 1103 goToToday(): void;
1100 1104
1101 1105 /**
1102 1106 * Creates the drop down button that displays the current month and lets user pick a new one
1103 1107 */
1104 1108 _createMonthWidget(): void;
1105 1109
1106 1110 buildRendering(): void;
1107 1111 postCreate(): void;
1108 1112
1109 1113 /**
1110 1114 * Set up connects for increment/decrement of months/years
1111 1115 */
1112 1116 _connectControls(): void;
1113 1117
1114 1118 /**
1115 1119 * If the calendar currently has focus, then focuses specified date,
1116 1120 * changing the currently displayed month/year if necessary.
1117 1121 * If the calendar doesn't have focus, updates currently
1118 1122 * displayed month/year, and sets the cell that will get focus
1119 1123 * when Calendar is focused.
1120 1124 */
1121 1125 _setCurrentFocusAttr(date: Date, forceFocus?: boolean): void;
1122 1126
1123 1127 /**
1124 1128 * Focus the calendar by focusing one of the calendar cells
1125 1129 */
1126 1130 focus(): void;
1127 1131
1128 1132 /**
1129 1133 * Handler for day clicks, selects the date if appropriate
1130 1134 */
1131 1135 _onDayClick(evt: MouseEvent): void;
1132 1136
1133 1137 /**
1134 1138 * Returns the cell corresponding to the date, or null if the date is not within the currently
1135 1139 * displayed month.
1136 1140 */
1137 1141 _getNodeByDate(value: Date): HTMLElement;
1138 1142
1139 1143 /**
1140 1144 * Marks the specified cells as selected, and clears cells previously marked as selected.
1141 1145 * For CalendarLite at most one cell is selected at any point, but this allows an array
1142 1146 * for easy subclassing.
1143 1147 */
1144 1148 _markSelectedDates(dates: Date[]): void;
1145 1149
1146 1150 /**
1147 1151 * Called only when the selected date has changed
1148 1152 */
1149 1153 onChange(date: Date): void;
1150 1154
1151 1155 /**
1152 1156 * May be overridden to disable certain dates in the calendar e.g. `isDisabledDate=dojo.date.locale.isWeekend`
1153 1157 */
1154 1158 isDisabledDate(dateObject: Date, locale?: string): boolean;
1155 1159
1156 1160 /**
1157 1161 * May be overridden to return CSS classes to associate with the date entry for the given dateObject,
1158 1162 * for example to indicate a holiday in specified locale.
1159 1163 */
1160 1164 getClassForDate(dateObject: Date, locale?: string): string;
1161 1165
1162 1166 // get(name: 'value'): Date;
1163 1167 // get(name: string): any;
1164 1168
1165 1169 // set(name: 'value', value: number | Date): this;
1166 1170 // set(name: string, value: any): this;
1167 1171 // set(values: Object): this;
1168 1172 }
1169 1173
1170 1174 interface CalendarLiteConstructor extends _WidgetBaseConstructor<CalendarLite> {
1171 1175 _MonthWidget: _MonthWidgetConstructor;
1172 1176 }
1173 1177
1174 1178 /* dijit/Destroyable */
1175 1179
1176 1180 interface Destroyable {
1177 1181 _destroyed?: true;
1178 1182
1179 1183 /**
1180 1184 * Destroy this class, releasing any resources registered via own().
1181 1185 */
1182 1186 destroy(preserveDom?: boolean): void;
1183 1187
1184 1188 /**
1185 1189 * Track specified handles and remove/destroy them when this instance is destroyed, unless they were
1186 1190 * already removed/destroyed manually.
1187 1191 */
1188 1192 own(...args: any[]): any[];
1189 1193 }
1190 1194
1191 1195 /**
1192 1196 * Mixin to track handles and release them when instance is destroyed.
1193 1197 */
1194 1198 interface DestroyableConstructor extends dojo._base.DeclareConstructor<Destroyable> { }
1195 1199
1196 1200 /** dijit/_KeyNavMixin */
1197 1201
1198 1202 /**
1199 1203 * A mixin to allow arrow key and letter key navigation of child or descendant widgets.
1200 1204 * It can be used by dijit/_Container based widgets with a flat list of children, or more complex widgets like dijit/Tree.
1201 1205 *
1202 1206 * To use this mixin, the subclass must:
1203 1207 *
1204 1208 * - 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.
1205 1209 * - Set all descendants' initial tabIndex to "-1"; both initial descendants and any descendants added later, by for example addChild()
1206 1210 * - Define childSelector to a function or string that identifies focusable descendant widgets
1207 1211 *
1208 1212 * Also, child widgets must implement a focus() method.
1209 1213 */
1210 1214 interface _KeyNavMixin extends _FocusMixin {
1211 1215 /**
1212 1216 * Tab index of the container; same as HTML tabIndex attribute.
1213 1217 * Note then when user tabs into the container, focus is immediately moved to the first item in the container.
1214 1218 */
1215 1219 tabIndex: string;
1216 1220
1217 1221 /**
1218 1222 * 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.
1219 1223 */
1220 1224 childSelector: string | Function | null;
1221 1225
1222 1226 /**
1223 1227 * Called on left arrow key, or right arrow key if widget is in RTL mode.
1224 1228 * Should go back to the previous child in horizontal container widgets like Toolbar.
1225 1229 */
1226 1230 _onLeftArrow(evt?: KeyboardEvent): void;
1227 1231
1228 1232 /**
1229 1233 * Called on right arrow key, or left arrow key if widget is in RTL mode.
1230 1234 * Should go to the next child in horizontal container widgets like Toolbar.
1231 1235 */
1232 1236 _onRightArrow(evt?: KeyboardEvent): void;
1233 1237
1234 1238 /**
1235 1239 * Called on up arrow key. Should go to the previous child in vertical container widgets like Menu.
1236 1240 */
1237 1241 _onUpArrow(evt?: KeyboardEvent): void;
1238 1242
1239 1243 /**
1240 1244 * Called on down arrow key. Should go to the next child in vertical container widgets like Menu.
1241 1245 */
1242 1246 _onDownArrow(evt?: KeyboardEvent): void;
1243 1247
1244 1248 /**
1245 1249 * Default focus() implementation: focus the first child.
1246 1250 */
1247 1251 focus(): void;
1248 1252
1249 1253 /**
1250 1254 * Returns first child that can be focused.
1251 1255 */
1252 1256 _getFirstFocusableChild(): _WidgetBase;
1253 1257
1254 1258 /**
1255 1259 * Returns last child that can be focused.
1256 1260 */
1257 1261 _getLastFocusableChild(): _WidgetBase;
1258 1262
1259 1263 /**
1260 1264 * Focus the first focusable child in the container.
1261 1265 */
1262 1266 focusFirstChild(): void;
1263 1267
1264 1268 /**
1265 1269 * Focus the last focusable child in the container.
1266 1270 */
1267 1271 focusLastChild(): void;
1268 1272
1269 1273 /**
1270 1274 * Focus specified child widget.
1271 1275 *
1272 1276 * @param widget Reference to container's child widget
1273 1277 * @param last If true and if widget has multiple focusable nodes, focus the last one instead of the first one
1274 1278 */
1275 1279 focusChild(widget: _WidgetBase, last?: boolean): void;
1276 1280
1277 1281 /**
1278 1282 * Handler for when the container itself gets focus.
1279 1283 *
1280 1284 * Initially the container itself has a tabIndex, but when it gets focus, switch focus to first child.
1281 1285 */
1282 1286 _onContainerFocus(evt: Event): void;
1283 1287
1284 1288 /**
1285 1289 * Called when a child widget gets focus, either by user clicking it, or programatically by arrow key handling code.
1286 1290 *
1287 1291 * It marks that the current node is the selected one, and the previously selected node no longer is.
1288 1292 */
1289 1293 _onChildFocus(child?: _WidgetBase): void;
1290 1294
1291 1295 _searchString: string;
1292 1296
1293 1297 multiCharSearchDuration: number;
1294 1298
1295 1299 /**
1296 1300 * When a key is pressed that matches a child item, this method is called so that a widget can take appropriate action is necessary.
1297 1301 */
1298 1302 onKeyboardSearch(tem: _WidgetBase, evt: Event, searchString: string, numMatches: number): void;
1299 1303
1300 1304 /**
1301 1305 * Compares the searchString to the widget's text label, returning:
1302 1306 *
1303 1307 * * -1: a high priority match and stop searching
1304 1308 * * 0: not a match
1305 1309 * * 1: a match but keep looking for a higher priority match
1306 1310 */
1307 1311 _keyboardSearchCompare(item: _WidgetBase, searchString: string): -1 | 0 | 1;
1308 1312
1309 1313 /**
1310 1314 * When a key is pressed, if it's an arrow key etc. then it's handled here.
1311 1315 */
1312 1316 _onContainerKeydown(evt: Event): void;
1313 1317
1314 1318 /**
1315 1319 * When a printable key is pressed, it's handled here, searching by letter.
1316 1320 */
1317 1321 _onContainerKeypress(evt: Event): void;
1318 1322
1319 1323 /**
1320 1324 * Perform a search of the widget's options based on the user's keyboard activity
1321 1325 *
1322 1326 * 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.
1323 1327 */
1324 1328 _keyboardSearch(evt: Event, keyChar: string): void;
1325 1329
1326 1330 /**
1327 1331 * Called when focus leaves a child widget to go to a sibling widget.
1328 1332 */
1329 1333 _onChildBlur(widget: _WidgetBase): void;
1330 1334
1331 1335 /**
1332 1336 * Returns the next or previous focusable descendant, compared to "child".
1333 1337 * Implements and extends _KeyNavMixin._getNextFocusableChild() for a _Container.
1334 1338 */
1335 1339 _getNextFocusableChild(child: _WidgetBase, dir: 1 | -1): _WidgetBase | null;
1336 1340
1337 1341 /**
1338 1342 * Returns the first child.
1339 1343 */
1340 1344 _getFirst(): _WidgetBase | null;
1341 1345
1342 1346 /**
1343 1347 * Returns the last descendant.
1344 1348 */
1345 1349 _getLast(): _WidgetBase | null;
1346 1350
1347 1351 /**
1348 1352 * Returns the next descendant, compared to "child".
1349 1353 */
1350 1354 _getNext(child: _WidgetBase, dir: 1 | -1): _WidgetBase | null;
1351 1355 }
1352 1356
1353 1357 interface _KeyNavMixinConstructor extends dojo._base.DeclareConstructor<_KeyNavMixin> { }
1354 1358
1355 1359 /* dijit/_KeyNavContainer */
1356 1360
1357 1361 /**
1358 1362 * A _Container with keyboard navigation of its children.
1359 1363 *
1360 1364 * Provides normalized keyboard and focusing code for Container widgets.
1361 1365 * To use this mixin, call connectKeyNavHandlers() in postCreate().
1362 1366 * Also, child widgets must implement a focus() method.
1363 1367 */
1364 1368 interface _KeyNavContainer extends _FocusMixin, _KeyNavMixin, _Container {
1365 1369 /**
1366 1370 * 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().
1367 1371 *
1368 1372 * @param prevKeyCodes Key codes for navigating to the previous child.
1369 1373 * @param nextKeyCodes Key codes for navigating to the next child.
1370 1374 */
1371 1375 connectKeyNavHandlers(prevKeyCodes: number[], nextKeyCodes: number[]): void;
1372 1376
1373 1377 /**
1374 1378 * @deprecated
1375 1379 */
1376 1380 startupKeyNavChildren(): void;
1377 1381
1378 1382 /**
1379 1383 * Setup for each child widget.
1380 1384 *
1381 1385 * Sets tabIndex=-1 on each child, so that the tab key will leave the container rather than visiting each child.
1382 1386 *
1383 1387 * 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.
1384 1388 *
1385 1389 * Note: see also _LayoutWidget.setupChild(), which is also called for each child widget.
1386 1390 */
1387 1391 _startupChild(widget: _WidgetBase): void;
1388 1392
1389 1393 /**
1390 1394 * Returns the first child.
1391 1395 */
1392 1396 _getFirst(): _Widget | null;
1393 1397
1394 1398 /**
1395 1399 * Returns the last descendant.
1396 1400 */
1397 1401 _getLast(): _Widget | null;
1398 1402
1399 1403 /**
1400 1404 * Focus the next widget
1401 1405 */
1402 1406 focusNext(): void;
1403 1407
1404 1408 /**
1405 1409 * Focus the last focusable node in the previous widget
1406 1410 *
1407 1411 * (ex: go to the ComboButton icon section rather than button section)
1408 1412 */
1409 1413 focusPrev(): void;
1410 1414
1411 1415 /**
1412 1416 * Implement _KeyNavMixin.childSelector, to identify focusable child nodes.
1413 1417 *
1414 1418 * If we allowed a dojo/query dependency from this module this could more simply be a string "> *" instead of this function.
1415 1419 */
1416 1420 childSelector(node: Element | Node): boolean | void | any;
1417 1421 }
1418 1422
1419 1423 interface _KeyNavContainerConstructor extends dojo._base.DeclareConstructor<_KeyNavContainer> { }
1420 1424
1421 1425 /* dijit/_MenuBase */
1422 1426
1423 1427 /**
1424 1428 * Abstract base class for Menu and MenuBar.
1425 1429 * Subclass should implement _onUpArrow(), _onDownArrow(), _onLeftArrow(), and _onRightArrow().
1426 1430 */
1427 1431 interface _MenuBase extends _Widget, _TemplatedMixin, _KeyNavContainer, _CssStateMixin {
1428 1432 selected: MenuItem | null;
1429 1433
1430 1434 _setSelectedAttr(item?: MenuItem | null): void;
1431 1435
1432 1436 /**
1433 1437 * 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.
1434 1438 *
1435 1439 * 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.
1436 1440 */
1437 1441 activated: boolean;
1438 1442
1439 1443 _setActivatedAttr(val: boolean): void;
1440 1444
1441 1445 /**
1442 1446 * pointer to menu that displayed me
1443 1447 */
1444 1448 parentMenu: _Widget | null;
1445 1449
1446 1450 /**
1447 1451 * 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.
1448 1452 */
1449 1453 popupDelay: number;
1450 1454
1451 1455 /**
1452 1456 * 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.
1453 1457 */
1454 1458 passivePopupDelay: number;
1455 1459
1456 1460 /**
1457 1461 * 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.
1458 1462 */
1459 1463 autoFocus: boolean;
1460 1464
1461 1465 /**
1462 1466 * 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.
1463 1467 */
1464 1468 childSelector(node: Element | Node): boolean | void | Function;
1465 1469
1466 1470 /**
1467 1471 * 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.
1468 1472 */
1469 1473 onExecute(): void;
1470 1474
1471 1475 /**
1472 1476 * Attach point for notification about when the user cancels the current menu
1473 1477 * 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.
1474 1478 */
1475 1479 onCancel(): void;
1476 1480
1477 1481 /**
1478 1482 * 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
1479 1483 */
1480 1484 _moveToPopup(evt: Event): void;
1481 1485
1482 1486 /**
1483 1487 * This handler is called when the mouse moves over the popup.
1484 1488 */
1485 1489 _onPopupHover(evt?: MouseEvent): void;
1486 1490
1487 1491 /**
1488 1492 * Called when cursor is over a MenuItem.
1489 1493 */
1490 1494 onItemHover(item: MenuItem): void;
1491 1495
1492 1496 /**
1493 1497 * Called when a child MenuItem becomes deselected. Setup timer to close its popup.
1494 1498 */
1495 1499 _onChildDeselect(item: MenuItem): void;
1496 1500
1497 1501 /**
1498 1502 * Callback fires when mouse exits a MenuItem
1499 1503 */
1500 1504 onItemUnhover(item: MenuItem): void;
1501 1505
1502 1506 /**
1503 1507 * Cancels the popup timer because the user has stop hovering on the MenuItem, etc.
1504 1508 */
1505 1509 _stopPopupTimer(): void;
1506 1510
1507 1511 /**
1508 1512 * Cancels the pending-close timer because the close has been preempted
1509 1513 */
1510 1514 _stopPendingCloseTimer(): void;
1511 1515
1512 1516 /**
1513 1517 * Returns the top menu in this chain of Menus
1514 1518 */
1515 1519 _getTopMenu(): void;
1516 1520
1517 1521 /**
1518 1522 * Handle clicks on an item.
1519 1523 */
1520 1524 onItemClick(item: _WidgetBase, evt: Event): void;
1521 1525
1522 1526 /**
1523 1527 * Open the popup to the side of/underneath the current menu item, and optionally focus first item
1524 1528 */
1525 1529 _openItemPopup(fromItem: MenuItem, focus: boolean): void;
1526 1530
1527 1531 /**
1528 1532 * Callback when this menu is opened.
1529 1533 * This is called by the popup manager as notification that the menu was opened.
1530 1534 */
1531 1535 onOpen(evt?: Event): void;
1532 1536
1533 1537 /**
1534 1538 * Callback when this menu is closed.
1535 1539 * This is called by the popup manager as notification that the menu was closed.
1536 1540 */
1537 1541 onClose(): boolean;
1538 1542
1539 1543 /**
1540 1544 * Called when submenu is clicked or focus is lost. Close hierarchy of menus.
1541 1545 */
1542 1546 _closeChild(): void;
1543 1547 /**
1544 1548 * Called when child of this Menu gets focus from:
1545 1549 *
1546 1550 * 1. clicking it
1547 1551 * 2. tabbing into it
1548 1552 * 3. being opened by a parent menu.
1549 1553 *
1550 1554 * This is not called just from mouse hover.
1551 1555 */
1552 1556 _onItemFocus(item: MenuItem): void;
1553 1557
1554 1558 /**
1555 1559 * Called when focus is moved away from this Menu and it's submenus.
1556 1560 */
1557 1561 _onBlur(): void;
1558 1562
1559 1563 /**
1560 1564 * Called when the user is done with this menu. Closes hierarchy of menus.
1561 1565 */
1562 1566 _cleanUp(clearSelectedItem?: boolean): void;
1563 1567 }
1564 1568
1565 1569 interface _MenuBaseConstructor extends _WidgetBaseConstructor<_MenuBase> { }
1566 1570
1567 1571 /* dijit/Dialog */
1568 1572
1569 1573 interface _DialogBase extends _TemplatedMixin, form._FormMixin, _DialogMixin, _CssStateMixin {
1570 1574 templateString: string;
1571 1575 baseClass: string;
1572 1576 cssStateNodes: CSSStateNodes;
1573 1577
1574 1578 /**
1575 1579 * True if Dialog is currently displayed on screen.
1576 1580 */
1577 1581 open: boolean;
1578 1582
1579 1583 /**
1580 1584 * The time in milliseconds it takes the dialog to fade in and out
1581 1585 */
1582 1586 duration: number;
1583 1587
1584 1588 /**
1585 1589 * A Toggle to modify the default focus behavior of a Dialog, which
1586 1590 * is to re-focus the element which had focus before being opened.
1587 1591 * False will disable refocusing. Default: true
1588 1592 */
1589 1593 refocus: boolean;
1590 1594
1591 1595 /**
1592 1596 * A Toggle to modify the default focus behavior of a Dialog, which
1593 1597 * is to focus on the first dialog element after opening the dialog.
1594 1598 * False will disable autofocusing. Default: true
1595 1599 */
1596 1600 autofocus: boolean;
1597 1601
1598 1602 /**
1599 1603 * Toggles the movable aspect of the Dialog. If true, Dialog
1600 1604 * can be dragged by it's title. If false it will remain centered
1601 1605 * in the viewport.
1602 1606 */
1603 1607 draggable: boolean;
1604 1608
1605 1609 /**
1606 1610 * Maximum size to allow the dialog to expand to, relative to viewport size
1607 1611 */
1608 1612 maxRatio: number;
1609 1613
1610 1614 /**
1611 1615 * Dialog show [x] icon to close itself, and ESC key will close the dialog.
1612 1616 */
1613 1617 closable: boolean;
1614 1618 postMixInProperties(): void;
1615 1619 postCreate(): void;
1616 1620
1617 1621 /**
1618 1622 * Called when data has been loaded from an href.
1619 1623 * Unlike most other callbacks, this function can be connected to (via `dojo.connect`)
1620 1624 * but should *not* be overridden.
1621 1625 */
1622 1626 onLoad(data?: any): void;
1623 1627
1624 1628 focus(): void;
1625 1629
1626 1630 /* Not entirely sure of the resolution type of these promises */
1627 1631
1628 1632 /**
1629 1633 * Display the dialog
1630 1634 */
1631 1635 show(): dojo.promise.Promise<any>;
1632 1636
1633 1637 /**
1634 1638 * Hide the dialog
1635 1639 */
1636 1640 hide(): dojo.promise.Promise<any>;
1637 1641
1638 1642 /**
1639 1643 * Called with no argument when viewport scrolled or viewport size changed. Adjusts Dialog as
1640 1644 * necessary to keep it visible.
1641 1645 *
1642 1646 * Can also be called with an argument (by dojox/layout/ResizeHandle etc.) to explicitly set the
1643 1647 * size of the dialog.
1644 1648 */
1645 1649 resize(dim?: dojo.DomGeometryWidthHeight): void;
1646 1650
1647 1651 destroy(preserveDom?: boolean): void;
1648 1652 }
1649 1653
1650 1654 interface _DialogBaseConstructor extends _WidgetBaseConstructor<_DialogBase> { }
1651 1655
1652 1656 interface Dialog extends layout.ContentPane, _DialogBase {
1653 1657 /* overrides conflicting methods */
1654 1658 resize(dim?: dojo.DomGeometryWidthHeight): void;
1655 1659 }
1656 1660
1657 1661 interface DialogLevelManager {
1658 1662 _beginZIndex: number;
1659 1663
1660 1664 /**
1661 1665 * Call right before fade-in animation for new dialog.
1662 1666 *
1663 1667 * Saves current focus, displays/adjusts underlay for new dialog,
1664 1668 * and sets the z-index of the dialog itself.
1665 1669 *
1666 1670 * New dialog will be displayed on top of all currently displayed dialogs.
1667 1671 * Caller is responsible for setting focus in new dialog after the fade-in
1668 1672 * animation completes.
1669 1673 */
1670 1674 show(dialog: _WidgetBase, underlayAttrs: Object): void;
1671 1675
1672 1676 /**
1673 1677 * Called when the specified dialog is hidden/destroyed, after the fade-out
1674 1678 * animation ends, in order to reset page focus, fix the underlay, etc.
1675 1679 * If the specified dialog isn't open then does nothing.
1676 1680 *
1677 1681 * Caller is responsible for either setting display:none on the dialog domNode,
1678 1682 * or calling dijit/popup.hide(), or removing it from the page DOM.
1679 1683 */
1680 1684 hide(dialog: _WidgetBase): void;
1681 1685
1682 1686 /**
1683 1687 * Returns true if specified Dialog is the top in the task
1684 1688 */
1685 1689 isTop(dialog: _WidgetBase): boolean;
1686 1690 }
1687 1691
1688 1692 interface DialogConstructor extends _WidgetBaseConstructor<Dialog> {
1689 1693 /**
1690 1694 * for monkey patching and dojox/widget/DialogSimple
1691 1695 */
1692 1696 _DialogBase: _DialogBaseConstructor;
1693 1697 _DialogLevelManager: DialogLevelManager;
1694 1698 _dialogStack: {
1695 1699 dialog: _WidgetBase,
1696 1700 focus: any,
1697 1701 underlayAttrs: any
1698 1702 }[];
1699 1703 }
1700 1704
1701 1705 /* dijit/ConfirmDialog */
1702 1706
1703 1707 interface ConfirmDialog extends _ConfirmDialogMixin { }
1704 1708
1705 1709 interface ConfirmDialogConstructor extends DialogConstructor { }
1706 1710
1707 1711 /* dijit/DropDownMenu */
1708 1712
1709 1713 /**
1710 1714 * A menu, without features for context menu (Meaning, drop down menu)
1711 1715 */
1712 1716 interface DropDownMenu extends _MenuBase { }
1713 1717
1714 1718 interface DropDownMenuConstructor extends _WidgetBaseConstructor<DropDownMenu> { }
1715 1719
1716 1720 /* dijit/Fieldset */
1717 1721
1718 1722 /**
1719 1723 * An accessible fieldset that can be expanded or collapsed via
1720 1724 * its legend. Fieldset extends `dijit.TitlePane`.
1721 1725 */
1722 1726 interface Fieldset extends TitlePane {
1723 1727 open: boolean;
1724 1728 }
1725 1729
1726 1730 interface FieldsetConstructor extends _WidgetBaseConstructor<Fieldset> { }
1727 1731
1728 1732 /* dijit/Menu */
1729 1733
1730 1734 /**
1731 1735 * A context menu you can assign to multiple elements
1732 1736 */
1733 1737 interface Menu extends dijit.DropDownMenu {
1734 1738 /**
1735 1739 * Array of dom node ids of nodes to attach to.
1736 1740 * Fill this with nodeIds upon widget creation and it becomes context menu for those nodes.
1737 1741 */
1738 1742 targetNodeIds: string[];
1739 1743
1740 1744 /**
1741 1745 * CSS expression to apply this Menu to descendants of targetNodeIds, rather than to
1742 1746 * the nodes specified by targetNodeIds themselves. Useful for applying a Menu to
1743 1747 * a range of rows in a table, tree, etc.
1744 1748 *
1745 1749 * The application must require() an appropriate level of dojo/query to handle the selector.
1746 1750 */
1747 1751 selector: string;
1748 1752
1749 1753 /**
1750 1754 * If true, right clicking anywhere on the window will cause this context menu to open.
1751 1755 * If false, must specify targetNodeIds.
1752 1756 */
1753 1757 contextMenuForWindow: boolean;
1754 1758
1755 1759 /**
1756 1760 * If true, menu will open on left click instead of right click, similar to a file menu.
1757 1761 */
1758 1762 leftClickToOpen: boolean;
1759 1763
1760 1764 /**
1761 1765 * When this menu closes, re-focus the element which had focus before it was opened.
1762 1766 */
1763 1767 refocus: boolean;
1764 1768
1765 1769 /**
1766 1770 * Attach menu to given node
1767 1771 */
1768 1772 bindDomNode(node: string | Node): void;
1769 1773
1770 1774 /**
1771 1775 * Detach menu from given node
1772 1776 */
1773 1777 unBindDomNode(nodeName: string | Node): void;
1774 1778 }
1775 1779
1776 1780 interface MenuConstructor extends _WidgetBaseConstructor<Menu> { }
1777 1781
1778 1782 /* dijit/MenuBar */
1779 1783 interface MenuBar extends _MenuBase {
1780 1784 baseClass: 'dijitMenuBar';
1781 1785 popupDelay: number;
1782 1786 _isMenuBar: true;
1783 1787 _orient: string[];
1784 1788 _moveToPopup(evt: Event): void;
1785 1789 focusChild(item: _WidgetBase): void;
1786 1790 _onChildDeselect(item: _WidgetBase): void;
1787 1791 _onLeftArrow(): void;
1788 1792 _onRightArrow(): void;
1789 1793 _onDownArrow(): void;
1790 1794 _onUpArrow(): void;
1791 1795 onItemClick(item: _WidgetBase, evt: Event): void;
1792 1796 }
1793 1797
1794 1798 interface MenuBarConstructor extends _WidgetBaseConstructor<MenuBar> { }
1795 1799
1796 1800 /* dijit/MenuBarItem */
1797 1801 interface MenuBarItem extends MenuItem { }
1798 1802
1799 1803 interface MenuBarItemConstructor extends _WidgetBaseConstructor<MenuBarItem> { }
1800 1804
1801 1805 /* dijit/MenuItem */
1802 1806 interface MenuItem extends _Widget, _TemplatedMixin, _Contained, _CssStateMixin {
1803 1807 /**
1804 1808 * 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.
1805 1809 *
1806 1810 * Note that although Menu can display accelerator keys, there is no infrastructure to actually catch and execute those accelerators.
1807 1811 */
1808 1812 accelKey: string;
1809 1813
1810 1814 /**
1811 1815 * If true, the menu item is disabled.
1812 1816 * If false, the menu item is enabled.
1813 1817 */
1814 1818 disabled: boolean;
1815 1819
1816 1820 /** Menu text as HTML */
1817 1821 label: string;
1818 1822
1819 1823 /**
1820 1824 * Class to apply to DOMNode to make it display an icon.
1821 1825 */
1822 1826 iconClass: string;
1823 1827
1824 1828 /**
1825 1829 * Hook for attr('accelKey', ...) to work.
1826 1830 * Set accelKey on this menu item.
1827 1831 */
1828 1832 _setAccelKeyAttr(value: string): void;
1829 1833
1830 1834 /**
1831 1835 * Hook for attr('disabled', ...) to work.
1832 1836 * Enable or disable this menu item.
1833 1837 */
1834 1838 _setDisabledAttr(value: boolean): void;
1835 1839
1836 1840 _setLabelAttr(val: string): void;
1837 1841 _setIconClassAttr(val: string): void;
1838 1842
1839 1843 _fillContent(source: Element): void;
1840 1844
1841 1845 /**
1842 1846 * Indicate that this node is the currently selected one
1843 1847 */
1844 1848 _setSelected(selected: boolean): void;
1845 1849
1846 1850 focus(): void;
1847 1851
1848 1852 /**
1849 1853 * Deprecated.
1850 1854 * Use set('disabled', bool) instead.
1851 1855 */
1852 1856 setDisabled(disabled: boolean): void;
1853 1857
1854 1858 /**
1855 1859 * Deprecated.
1856 1860 * Use set('label', ...) instead.
1857 1861 */
1858 1862 setLabel(content: string): void;
1859 1863 }
1860 1864
1861 1865 interface MenuItemConstructor extends _WidgetBaseConstructor<MenuItem> { }
1862 1866
1863 1867 /* dijit/MenuSeparator */
1864 1868 interface MenuSeparator extends _WidgetBase, _TemplatedMixin, _Contained { }
1865 1869
1866 1870 interface MenuSeparatorConstructor extends _WidgetBaseConstructor<MenuSeparator> { }
1867 1871
1868 1872 /* dijit/place */
1869 1873
1870 1874 interface PlacePosition {
1871 1875 x: number;
1872 1876 y: number;
1873 1877 }
1874 1878
1875 1879 interface PlaceWidthHeight {
1876 1880 w: number;
1877 1881 h: number;
1878 1882 }
1879 1883
1880 1884 interface PlaceRectangle extends PlacePosition, PlaceWidthHeight { }
1881 1885
1882 1886 type PlaceCorner = 'BL' | 'TR' | 'BR' | 'TL';
1883 1887
1884 1888 type PlacePositions = 'before' | 'after' | 'before-centered' | 'after-centered' | 'above-centered' | 'above' | 'above-alt' | 'below-centered' | 'below' | 'below-alt';
1885 1889
1886 1890 interface PlaceChoice {
1887 1891 corner: PlaceCorner;
1888 1892 pos: PlacePosition;
1889 1893 aroundCorner?: PlaceCorner;
1890 1894 }
1891 1895
1892 1896 interface PlaceLocation extends PlaceRectangle {
1893 1897 corner: PlaceCorner;
1894 1898 aroundCorner: PlaceCorner;
1895 1899 overflow: number;
1896 1900 spaceAvailable: PlaceWidthHeight;
1897 1901 }
1898 1902
1899 1903 interface LayoutNodeFunction {
1900 1904 (node: HTMLElement, aroundCorner: string, corner: string, spaceAvailable: PlaceWidthHeight, aroundNodeCoords: PlaceWidthHeight): number;
1901 1905 }
1902 1906
1903 1907 interface Place {
1904 1908 /**
1905 1909 * Positions node kitty-corner to the rectangle centered at (pos.x, pos.y) with width and height of
1906 1910 * padding.x * 2 and padding.y * 2, or zero if padding not specified. Picks first corner in corners[]
1907 1911 * where node is fully visible, or the corner where it's most visible.
1908 1912 *
1909 1913 * Node is assumed to be absolutely or relatively positioned.
1910 1914 */
1911 1915 at(node: Element, pos?: PlacePosition, corners?: PlaceCorner[], padding?: PlacePosition, layoutNode?: LayoutNodeFunction): PlaceLocation;
1912 1916
1913 1917 /**
1914 1918 * Position node adjacent or kitty-corner to anchor
1915 1919 * such that it's fully visible in viewport.
1916 1920 */
1917 1921 around(node: Element, anchor: Element | PlaceRectangle, positions: PlacePositions[], leftToRight?: boolean, layoutNode?: LayoutNodeFunction): PlaceLocation;
1918 1922 }
1919 1923
1920 1924 /* dijit/popup */
1921 1925
1922 1926 interface PopupOpenArgs {
1923 1927 /**
1924 1928 * widget to display
1925 1929 */
1926 1930 popup?: _WidgetBase;
1927 1931
1928 1932 /**
1929 1933 * the button etc. that is displaying this popup
1930 1934 */
1931 1935 parent?: _WidgetBase;
1932 1936
1933 1937 /**
1934 1938 * DOM node (typically a button); place popup relative to this node. (Specify this *or* "x" and "y" parameters.)
1935 1939 */
1936 1940 around?: HTMLElement;
1937 1941
1938 1942 /**
1939 1943 * Absolute horizontal position (in pixels) to place node at. (Specify this *or* "around" parameter.)
1940 1944 */
1941 1945 x?: number;
1942 1946
1943 1947 /**
1944 1948 * Absolute vertical position (in pixels) to place node at. (Specify this *or* "around" parameter.)
1945 1949 */
1946 1950 y?: number;
1947 1951
1948 1952 /**
1949 1953 * When the around parameter is specified, orient should be a list of positions to try
1950 1954 */
1951 1955 orient?: string | string[] | { BL?: string; TR?: string; TL?: string; BR?: string; };
1952 1956
1953 1957 /**
1954 1958 * callback when user has canceled the popup by:
1955 1959 *
1956 1960 * 1. hitting ESC or
1957 1961 * 2. by using the popup widget's proprietary cancel mechanism (like a cancel button in a dialog);
1958 1962 * i.e. whenever popupWidget.onCancel() is called, args.onCancel is called
1959 1963 */
1960 1964 onCancel?: () => void;
1961 1965
1962 1966 /**
1963 1967 * callback whenever this popup is closed
1964 1968 */
1965 1969 onClose?: () => void;
1966 1970
1967 1971 /**
1968 1972 * callback when user "executed" on the popup/sub-popup by selecting a menu choice, etc. (top menu only)
1969 1973 */
1970 1974 onExecute?: () => void;
1971 1975
1972 1976 /**
1973 1977 * adding a buffer around the opening position. This is only useful when around is not set.
1974 1978 */
1975 1979 padding?: PlacePosition;
1976 1980
1977 1981 /**
1978 1982 * The max height for the popup. Any popup taller than this will have scrollbars.
1979 1983 * Set to Infinity for no max height. Default is to limit height to available space in viewport,
1980 1984 * above or below the aroundNode or specified x/y position.
1981 1985 */
1982 1986 maxHeight?: number;
1983 1987 }
1984 1988
1985 1989 interface PopupManager {
1986 1990 /**
1987 1991 * Stack of currently popped up widgets.
1988 1992 * (someone opened _stack[0], and then it opened _stack[1], etc.)
1989 1993 */
1990 1994 _stack: _WidgetBase[];
1991 1995
1992 1996 /**
1993 1997 * Z-index of the first popup. (If first popup opens other
1994 1998 * popups they get a higher z-index.)
1995 1999 */
1996 2000 _beginZIndex: number;
1997 2001
1998 2002 _idGen: number;
1999 2003
2000 2004 /**
2001 2005 * If screen has been scrolled, reposition all the popups in the stack.
2002 2006 * Then set timer to check again later.
2003 2007 */
2004 2008 _repositionAll(): void;
2005 2009
2006 2010 /**
2007 2011 * Initialization for widgets that will be used as popups.
2008 2012 * Puts widget inside a wrapper DIV (if not already in one),
2009 2013 * and returns pointer to that wrapper DIV.
2010 2014 */
2011 2015 _createWrapper(widget: _WidgetBase): HTMLDivElement;
2012 2016
2013 2017 /**
2014 2018 * Moves the popup widget off-screen.
2015 2019 * Do not use this method to hide popups when not in use, because
2016 2020 * that will create an accessibility issue: the offscreen popup is
2017 2021 * still in the tabbing order.
2018 2022 */
2019 2023 moveOffScreen(widget: _WidgetBase): HTMLDivElement;
2020 2024
2021 2025 /**
2022 2026 * Hide this popup widget (until it is ready to be shown).
2023 2027 * Initialization for widgets that will be used as popups
2024 2028 *
2025 2029 * Also puts widget inside a wrapper DIV (if not already in one)
2026 2030 *
2027 2031 * If popup widget needs to layout it should
2028 2032 * do so when it is made visible, and popup._onShow() is called.
2029 2033 */
2030 2034 hide(widget: _WidgetBase): void;
2031 2035
2032 2036 /**
2033 2037 * Compute the closest ancestor popup that's *not* a child of another popup.
2034 2038 * Ex: For a TooltipDialog with a button that spawns a tree of menus, find the popup of the button.
2035 2039 */
2036 2040 getTopPopup(): _WidgetBase;
2037 2041
2038 2042 /**
2039 2043 * Popup the widget at the specified position
2040 2044 */
2041 2045 open(args: PopupOpenArgs): PlaceLocation;
2042 2046
2043 2047 /**
2044 2048 * Close specified popup and any popups that it parented.
2045 2049 * If no popup is specified, closes all popups.
2046 2050 */
2047 2051 close(popup?: _WidgetBase): void;
2048 2052 }
2049 2053
2050 2054 /* dijit/PopupMenuBarItem */
2051 2055
2052 2056 interface PopupMenuBarItem extends PopupMenuItem { }
2053 2057
2054 2058 interface PopupMenuBarItemConstructor extends _WidgetBaseConstructor<PopupMenuBarItem> { }
2055 2059
2056 2060 /** dijit/PopupMenuItem */
2057 2061
2058 2062 /**
2059 2063 * An item in a Menu that spawn a drop down (usually a drop down menu)
2060 2064 */
2061 2065 interface PopupMenuItem extends MenuItem {
2062 2066 /**
2063 2067 * When Menu is declared in markup, this code gets the menu label and the popup widget from the srcNodeRef.
2064 2068 *
2065 2069 * srcNodeRef.innerHTML contains both the menu item text and a popup widget
2066 2070 * The first part holds the menu item text and the second part is the popup
2067 2071 */
2068 2072 _fillContent(source: Element): void;
2069 2073
2070 2074 /**
2071 2075 * Open the popup to the side of/underneath this MenuItem, and optionally focus first item
2072 2076 */
2073 2077 _openPopup(params: { around?: Element; popup?: Function }, focus?: boolean): void;
2074 2078
2075 2079 _closePopup(): void;
2076 2080 }
2077 2081
2078 2082 interface PopupMenuItemConstructor extends _WidgetBaseConstructor<PopupMenuItem> { }
2079 2083
2080 2084 /* dijit/registry */
2081 2085
2082 2086 interface Registry {
2083 2087 /**
2084 2088 * Number of registered widgets
2085 2089 */
2086 2090 length: number;
2087 2091
2088 2092 /**
2089 2093 * Add a widget to the registry. If a duplicate ID is detected, a error is thrown.
2090 2094 */
2091 2095 add(widget: _WidgetBase): void;
2092 2096
2093 2097 /**
2094 2098 * Remove a widget from the registry. Does not destroy the widget; simply
2095 2099 * removes the reference.
2096 2100 */
2097 2101 remove(id: string): void;
2098 2102
2099 2103 /**
2100 2104 * Find a widget by it's id.
2101 2105 * If passed a widget then just returns the widget.
2102 2106 */
2103 2107 byId(id: string | _WidgetBase): _WidgetBase;
2104 2108
2105 2109 /**
2106 2110 * Returns the widget corresponding to the given DOMNode
2107 2111 */
2108 2112 byNode(node: Element | Node): _WidgetBase;
2109 2113
2110 2114 /**
2111 2115 * Convert registry into a true Array
2112 2116 */
2113 2117 toArray(): _WidgetBase[];
2114 2118
2115 2119 /**
2116 2120 * Generates a unique id for a given widgetType
2117 2121 */
2118 2122 getUniqueId(widgetType: string): string;
2119 2123
2120 2124 /**
2121 2125 * Search subtree under root returning widgets found.
2122 2126 * Doesn't search for nested widgets (ie, widgets inside other widgets).
2123 2127 */
2124 2128 findWidgets(root: Node, skipNode?: Node): _WidgetBase[];
2125 2129
2126 2130 /**
2127 2131 * Returns the widget whose DOM tree contains the specified DOMNode, or null if
2128 2132 * the node is not contained within the DOM tree of any widget
2129 2133 */
2130 2134 getEnclosingWidget(node: Element | Node): _WidgetBase;
2131 2135 }
2132 2136
2133 2137 /* dijit/TitlePane */
2134 2138
2135 2139 interface TitlePane extends dijit.layout.ContentPane, _TemplatedMixin, _CssStateMixin {
2136 2140 /**
2137 2141 * Whether pane can be opened or closed by clicking the title bar.
2138 2142 */
2139 2143 toggleable: boolean;
2140 2144
2141 2145 /**
2142 2146 * Tabindex setting for the title (so users can tab to the title then use space/enter to open/close the title pane)
2143 2147 */
2144 2148 tabIndex: string;
2145 2149
2146 2150 /**
2147 2151 * Time in milliseconds to fade in/fade out
2148 2152 */
2149 2153 duration: number;
2150 2154
2151 2155 /**
2152 2156 * Don't change this parameter from the default value.
2153 2157 *
2154 2158 * 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.
2155 2159 */
2156 2160 doLayout: boolean;
2157 2161
2158 2162 /**
2159 2163 * Switches between opened and closed state
2160 2164 */
2161 2165 toggle(): void;
2162 2166
2163 2167 /**
2164 2168 * Set the open/close css state for the TitlePane
2165 2169 */
2166 2170 _setCss(): void;
2167 2171
2168 2172 /**
2169 2173 * Handler for when user hits a key
2170 2174 */
2171 2175 _onTitleKey(e: Event): void;
2172 2176
2173 2177 /**
2174 2178 * Handler when user clicks the title bar
2175 2179 */
2176 2180 _onTitleClick(): void;
2177 2181
2178 2182 /**
2179 2183 * Deprecated. Use set('title', ...) instead.
2180 2184 */
2181 2185 setTitle(): void;
2182 2186 }
2183 2187
2184 2188 interface TitlePaneConstructor extends _WidgetBaseConstructor<TitlePane> { }
2185 2189
2186 2190 /* dijit/Toolbar */
2187 2191
2188 2192 interface Toolbar extends dijit._Widget, dijit._TemplatedMixin, dijit._KeyNavContainer { }
2189 2193
2190 2194 interface ToolbarConstructor extends _WidgetBaseConstructor<Toolbar> { }
2191 2195
2192 2196 /* dijit/ToolbarSeparator */
2193 2197
2194 2198 interface ToolbarSeparator extends dijit._Widget, dijit._TemplatedMixin { }
2195 2199
2196 2200 interface ToolbarSeparatorConstructor extends _WidgetBaseConstructor<ToolbarSeparator> { }
2197 2201
2198 2202 /* dijit/Tooltip */
2199 2203
2200 2204 interface Tooltip extends _Widget {
2201 2205 /**
2202 2206 * HTML to display in the tooltip.
2203 2207 * Specified as innerHTML when creating the widget from markup.
2204 2208 */
2205 2209 label: string;
2206 2210
2207 2211 /**
2208 2212 * Number of milliseconds to wait after hovering over/focusing on the object, before
2209 2213 * the tooltip is displayed.
2210 2214 */
2211 2215 showDelay: number;
2212 2216
2213 2217 /**
2214 2218 * Number of milliseconds to wait after unhovering the object, before
2215 2219 * the tooltip is hidden. Note that blurring an object hides the tooltip immediately.
2216 2220 */
2217 2221 hideDelay: number;
2218 2222
2219 2223 /**
2220 2224 * Id of domNode(s) to attach the tooltip to.
2221 2225 * When user hovers over specified dom node(s), the tooltip will appear.
2222 2226 */
2223 2227 connectId: dojo.NodeOrString | dojo.NodeOrString[];
2224 2228
2225 2229 /**
2226 2230 * See description of `dijit/Tooltip.defaultPosition` for details on position parameter.
2227 2231 */
2228 2232 position: string;
2229 2233
2230 2234 /**
2231 2235 * CSS expression to apply this Tooltip to descendants of connectIds, rather than to
2232 2236 * the nodes specified by connectIds themselves. Useful for applying a Tooltip to
2233 2237 * a range of rows in a table, tree, etc. Use in conjunction with getContent() parameter.
2234 2238 * Ex: connectId: myTable, selector: "tr", getContent: function(node){ return ...; }
2235 2239 *
2236 2240 * The application must require() an appropriate level of dojo/query to handle the selector.
2237 2241 */
2238 2242 selector: string;
2239 2243
2240 2244 /**
2241 2245 * Attach tooltip to specified node if it's not already connected
2242 2246 */
2243 2247 addTarget(node: dojo.NodeOrString): void;
2244 2248
2245 2249 /**
2246 2250 * Detach tooltip from specified node
2247 2251 */
2248 2252 removeTarget(node: dojo.NodeOrString): void;
2249 2253
2250 2254 /**
2251 2255 * User overridable function that return the text to display in the tooltip.
2252 2256 */
2253 2257 getContent(node: Node): Node;
2254 2258
2255 2259 /**
2256 2260 * Display the tooltip; usually not called directly.
2257 2261 */
2258 2262 open(target: Node): void;
2259 2263
2260 2264 /**
2261 2265 * Hide the tooltip or cancel timer for show of tooltip
2262 2266 */
2263 2267 close(): void;
2264 2268
2265 2269 /**
2266 2270 * Called when the tooltip is shown
2267 2271 */
2268 2272 onShow(): void;
2269 2273
2270 2274 /**
2271 2275 * Called when the tooltip is hidden
2272 2276 */
2273 2277 onHide(): void;
2274 2278 }
2275 2279
2276 2280 interface TooltipConstructor extends _WidgetBaseConstructor<Tooltip> {
2277 2281 /**
2278 2282 * This variable controls the position of tooltips, if the position is not specified to
2279 2283 * the Tooltip widget or *TextBox widget itself. It's an array of strings with the values
2280 2284 * possible for `dijit/place.around()`. The recommended values are:
2281 2285 *
2282 2286 * - before-centered: centers tooltip to the left of the anchor node/widget, or to the right
2283 2287 * in the case of RTL scripts like Hebrew and Arabic
2284 2288 * - after-centered: centers tooltip to the right of the anchor node/widget, or to the left
2285 2289 * in the case of RTL scripts like Hebrew and Arabic
2286 2290 * - above-centered: tooltip is centered above anchor node
2287 2291 * - below-centered: tooltip is centered above anchor node
2288 2292 *
2289 2293 * The list is positions is tried, in order, until a position is found where the tooltip fits
2290 2294 * within the viewport.
2291 2295 *
2292 2296 * Be careful setting this parameter. A value of "above-centered" may work fine until the user scrolls
2293 2297 * the screen so that there's no room above the target node. Nodes with drop downs, like
2294 2298 * DropDownButton or FilteringSelect, are especially problematic, in that you need to be sure
2295 2299 * that the drop down and tooltip don't overlap, even when the viewport is scrolled so that there
2296 2300 * is only room below (or above) the target node, but not both.
2297 2301 */
2298 2302 defaultPosition: [string];
2299 2303
2300 2304 /**
2301 2305 * Static method to display tooltip w/specified contents in specified position.
2302 2306 * See description of dijit/Tooltip.defaultPosition for details on position parameter.
2303 2307 * If position is not specified then dijit/Tooltip.defaultPosition is used.
2304 2308 */
2305 2309 show(innerHTML: string, aroundNode: PlaceRectangle, position?: [string], rtl?: boolean, textDir?: string, onMouseEnter?: Function, onMouseLeave?: Function): void;
2306 2310
2307 2311 /**
2308 2312 * Hide the tooltip
2309 2313 */
2310 2314 hide(aroundNode: PlaceRectangle): void;
2311 2315 }
2312 2316
2313 2317 /* dijit/TooltipDialog */
2314 2318
2315 2319 interface TooltipDialog extends layout.ContentPane, _TemplatedMixin, form._FormMixin, _DialogMixin {
2316 2320 /**
2317 2321 * Description of tooltip dialog (required for a11y)
2318 2322 */
2319 2323 title: string;
2320 2324
2321 2325 /**
2322 2326 * Don't change this parameter from the default value.
2323 2327 * This ContentPane parameter doesn't make sense for TooltipDialog, since TooltipDialog
2324 2328 * is never a child of a layout container, nor can you specify the size of
2325 2329 * TooltipDialog in order to control the size of an inner widget.
2326 2330 */
2327 2331 doLayout: boolean;
2328 2332
2329 2333 /**
2330 2334 * A Toggle to modify the default focus behavior of a Dialog, which
2331 2335 * is to focus on the first dialog element after opening the dialog.
2332 2336 * False will disable autofocusing. Default: true.
2333 2337 */
2334 2338 autofocus: boolean;
2335 2339
2336 2340 /**
2337 2341 * The pointer to the first focusable node in the dialog.
2338 2342 */
2339 2343 _firstFocusItem: any;
2340 2344
2341 2345 /**
2342 2346 * The pointer to which node has focus prior to our dialog.
2343 2347 */
2344 2348 _lastFocusItem: any;
2345 2349
2346 2350 /**
2347 2351 * Configure widget to be displayed in given position relative to the button.
2348 2352 *
2349 2353 * This is called from the dijit.popup code, and should not be called directly.
2350 2354 */
2351 2355 orient(node: Node | HTMLElement, aroundCorner: PlaceCorner, tooltipCorner: PlaceCorner): void;
2352 2356
2353 2357 /**
2354 2358 * Focus on first field
2355 2359 */
2356 2360 focus(): void;
2357 2361
2358 2362 /**
2359 2363 * Called when dialog is displayed.
2360 2364 *
2361 2365 * This is called from the dijit.popup code, and should not be called directly.
2362 2366 */
2363 2367 onOpen(pos: {
2364 2368 aroundCorner: PlaceCorner
2365 2369 aroundNodePos: PlacePosition
2366 2370 corner: PlaceCorner
2367 2371 x: number
2368 2372 y: number
2369 2373 }): void;
2370 2374
2371 2375 /**
2372 2376 * Handler for keydown events
2373 2377 *
2374 2378 * Keep keyboard focus in dialog; close dialog on escape key
2375 2379 */
2376 2380 _onKey(evt: KeyboardEvent): void;
2377 2381 }
2378 2382
2379 2383 interface TooltipDialogConstructor extends _WidgetBaseConstructor<TooltipDialog> { }
2380 2384 }
@@ -1,1889 +1,1889
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 interface ConstrainedValueFunction<V, C extends Constraints, T> {
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 interface ConstrainedValidFunction<C extends Constraints> {
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 interface ConstraintsToRegExpString<C extends Constraints> {
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 interface _AutoCompleterMixin<T extends Object, Q extends dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions> extends _SearchMixin<T, Q, O> {
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 interface _ComboBoxMenu<T> extends _WidgetBase, _TemplatedMixin, _ListMouseMixin, _ComboBoxMenuMixin<T> {
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 new <T>(params: Object, srcNodeRef: dojo.NodeOrString): _ComboBoxMenu<T>;
222 new <T = any>(params: Object, srcNodeRef: dojo.NodeOrString): _ComboBoxMenu<T>;
223 223 }
224 224
225 225 /* dijit/form/_ComboBoxMenuMixin */
226 226
227 interface _ComboBoxMenuMixin<T> {
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 458 }
459 459
460 460 interface _FormMixinConstructor extends dojo._base.DeclareConstructor<_FormMixin> { }
461 461
462 462 /* dijit/form/_FormSelectWidget */
463 463
464 464 interface SelectOption {
465 465 value?: string;
466 466 label: string;
467 467 selected?: boolean;
468 468 disabled?: boolean;
469 469 }
470 470
471 interface _FormSelectWidget<T extends Object, Q extends dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions> extends _FormValueWidget {
471 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 472 /**
473 473 * Whether or not we are multi-valued
474 474 */
475 475 multiple: boolean;
476 476
477 477 /**
478 478 * The set of options for our select item. Roughly corresponds to
479 479 * the html `<option>` tag.
480 480 */
481 481 options: SelectOption[];
482 482
483 483 /**
484 484 * A store to use for getting our list of options - rather than reading them
485 485 * from the `<option>` html tags. Should support getIdentity().
486 486 * For back-compat store can also be a dojo/data/api/Identity.
487 487 */
488 488 store: dojo.store.api.Store<T, Q, O>;
489 489
490 490 /**
491 491 * A query to use when fetching items from our store
492 492 */
493 493 query: Q;
494 494
495 495 /**
496 496 * Query options to use when fetching from the store
497 497 */
498 498 queryOptions: O;
499 499
500 500 /**
501 501 * The entries in the drop down list come from this attribute in the dojo.store items.
502 502 * If ``store`` is set, labelAttr must be set too, unless store is an old-style
503 503 * dojo.data store rather than a new dojo/store.
504 504 */
505 505 labelAttr: string;
506 506
507 507 /**
508 508 * A callback to do with an onFetch - but before any items are actually
509 509 * iterated over (i.e. to filter even further what you want to add)
510 510 */
511 511 onFetch: (items: T[]) => void;
512 512
513 513 /**
514 514 * Flag to sort the options returned from a store by the label of
515 515 * the store.
516 516 */
517 517 sortByLabel: boolean;
518 518
519 519 /**
520 520 * By default loadChildren is called when the items are fetched from the
521 521 * store. This property allows delaying loadChildren (and the creation
522 522 * of the options/menuitems) until the user clicks the button to open the
523 523 * dropdown.
524 524 */
525 525 loadChildrenOnOpen: boolean;
526 526
527 527 /**
528 528 * This is the `dojo.Deferred` returned by setStore().
529 529 * Calling onLoadDeferred.then() registers your
530 530 * callback to be called only once, when the prior setStore completes.
531 531 */
532 532 onLoadDeferred: dojo.Deferred<void>;
533 533
534 534 /**
535 535 * Returns a given option (or options).
536 536 */
537 537 getOptions(valueOrIdx: string): SelectOption;
538 538 getOptions(valueOrIdx: number): SelectOption;
539 539 getOptions(valueOrIdx: SelectOption): SelectOption;
540 540 getOptions(valueOrIdx: (string | number | SelectOption)[]): SelectOption[];
541 541 getOptions(): SelectOption[];
542 542
543 543 /**
544 544 * Adds an option or options to the end of the select. If value
545 545 * of the option is empty or missing, a separator is created instead.
546 546 * Passing in an array of options will yield slightly better performance
547 547 * since the children are only loaded once.
548 548 */
549 549 addOption(option: SelectOption | SelectOption[]): void;
550 550
551 551 /**
552 552 * Removes the given option or options. You can remove by string
553 553 * (in which case the value is removed), number (in which case the
554 554 * index in the options array is removed), or select option (in
555 555 * which case, the select option with a matching value is removed).
556 556 * You can also pass in an array of those values for a slightly
557 557 * better performance since the children are only loaded once.
558 558 * For numeric option values, specify {value: number} as the argument.
559 559 */
560 560 removeOption(option: string | number | SelectOption | (string | number | SelectOption)[]): void;
561 561
562 562 /**
563 563 * Updates the values of the given option. The option to update
564 564 * is matched based on the value of the entered option. Passing
565 565 * in an array of new options will yield better performance since
566 566 * the children will only be loaded once.
567 567 */
568 568 updateOption(newOption: SelectOption | SelectOption[]): void;
569 569
570 570 /**
571 571 * Deprecated!
572 572 */
573 573 setStore(store: dojo.store.api.Store<T, Q, O>, selectedValue?: T, fetchArgs?: {
574 574 query: Q;
575 575 queryOptions: O;
576 576 onFetch: (items: T[], fetchArgs?: any) => void;
577 577 }): dojo.store.api.Store<T, Q, O>;
578 578
579 579 /**
580 580 * Sets the store you would like to use with this select widget.
581 581 * The selected value is the value of the new store to set. This
582 582 * function returns the original store, in case you want to reuse
583 583 * it or something.
584 584 */
585 585 _deprecatedSetStore(store: dojo.store.api.Store<T, Q, O>, selectedValue?: T, fetchArgs?: {
586 586 query: Q;
587 587 queryOptions: O;
588 588 onFetch: (items: T[], fetchArgs?: any) => void;
589 589 }): dojo.store.api.Store<T, Q, O>;
590 590
591 591 /**
592 592 * Loads the children represented by this widget's options.
593 593 * reset the menu to make it populatable on the next click
594 594 */
595 595 _loadChildren(): void;
596 596
597 597 /**
598 598 * Sets the "selected" class on the item for styling purposes
599 599 */
600 600 _updateSelection(): void;
601 601
602 602 /**
603 603 * Returns the value of the widget by reading the options for
604 604 * the selected flag
605 605 */
606 606 _getValueFromOpts(): string;
607 607
608 608 buildRendering(): void;
609 609
610 610 /**
611 611 * Loads our options and sets up our dropdown correctly. We
612 612 * don't want any content, so we don't call any inherit chain
613 613 * function.
614 614 */
615 615 _fillContent(): void;
616 616
617 617 /**
618 618 * sets up our event handling that we need for functioning
619 619 * as a select
620 620 */
621 621 postCreate(): void;
622 622
623 623 startup(): void;
624 624
625 625 /**
626 626 * Clean up our connections
627 627 */
628 628 destroy(preserveDom?: boolean): void;
629 629
630 630 /**
631 631 * User-overridable function which, for the given option, adds an
632 632 * item to the select. If the option doesn't have a value, then a
633 633 * separator is added in that place. Make sure to store the option
634 634 * in the created option widget.
635 635 */
636 636 _addOptionItem(option: SelectOption): void;
637 637
638 638 /**
639 639 * User-overridable function which, for the given option, removes
640 640 * its item from the select.
641 641 */
642 642 _removeOptionItem(option: SelectOption): void;
643 643
644 644 /**
645 645 * Overridable function which will set the display for the
646 646 * widget. newDisplay is either a string (in the case of
647 647 * single selects) or array of strings (in the case of multi-selects)
648 648 */
649 649 _setDisplay(newDisplay: string | string[]): void;
650 650
651 651 /**
652 652 * Overridable function to return the children that this widget contains.
653 653 */
654 654 _getChildren(): any[];
655 655
656 656 /**
657 657 * hooks into this.attr to provide a mechanism for getting the
658 658 * option items for the current value of the widget.
659 659 */
660 660 _getSelectedOptionsAttr(): SelectOption[];
661 661
662 662 /**
663 663 * a function that will "fake" loading children, if needed, and
664 664 * if we have set to not load children until the widget opens.
665 665 */
666 666 _pseudoLoadChildren(items: T[]): void;
667 667
668 668 /**
669 669 * a function that can be connected to in order to receive a
670 670 * notification that the store has finished loading and all options
671 671 * from that store are available
672 672 */
673 673 onSetStore(): void;
674 674 }
675 675
676 676 /* dijit/form/_FormValueMixin */
677 677
678 678 interface _FormValueMixin extends _FormWidgetMixin {
679 679
680 680 /**
681 681 * Should this widget respond to user input?
682 682 * In markup, this is specified as "readOnly".
683 683 * Similar to disabled except readOnly form values are submitted.
684 684 */
685 685 readOnly: boolean;
686 686
687 687 postCreate(): void;
688 688
689 689 /**
690 690 * Restore the value to the last value passed to onChange
691 691 */
692 692 undo(): void;
693 693
694 694 /**
695 695 * Reset the widget's value to what it was at initialization time
696 696 */
697 697 reset(): void;
698 698
699 699 _hasBeenBlurred?: boolean;
700 700 }
701 701
702 702 /* dijit/form/_FormValueWidget */
703 703
704 704 interface _FormValueWidget extends _FormWidget, _FormValueMixin {
705 705 /**
706 706 * Work around table sizing bugs on IE7 by forcing redraw
707 707 */
708 708 _layoutHackIE7(): void;
709 709
710 710 // set(name: string, value: any): this;
711 711 // set(values: Object): this;
712 712 }
713 713
714 714 interface _FormValueWidgetConstructor extends _WidgetBaseConstructor<_FormValueWidget> { }
715 715
716 716 /* dijit/form/_FormWidget */
717 717
718 718 interface _FormWidget extends _Widget, _TemplatedMixin, _CssStateMixin, _FormWidgetMixin {
719 719 setDisabled(disabled: boolean): void;
720 720 setValue(value: string): void;
721 721 postMixInProperties(): void;
722 722
723 723 // set(name: 'value', value: string): this;
724 724 // set(name: string, value: any): this;
725 725 // set(values: Object): this;
726 726 }
727 727
728 728 interface _FormWidgetConstructor extends _WidgetBaseConstructor<_FormWidget> { }
729 729
730 730 /* dijit/form/_FormWidgetMixin */
731 731
732 732 interface _FormWidgetMixin {
733 733 /**
734 734 * Name used when submitting form; same as "name" attribute or plain HTML elements
735 735 */
736 736 name: string;
737 737
738 738 /**
739 739 * Corresponds to the native HTML `<input>` element's attribute.
740 740 */
741 741 alt: string;
742 742
743 743 /**
744 744 * Corresponds to the native HTML `<input>` element's attribute.
745 745 */
746 746 value: any;
747 747
748 748 /**
749 749 * Corresponds to the native HTML `<input>` element's attribute.
750 750 */
751 751 type: string;
752 752
753 753 /**
754 754 * Apply aria-label in markup to the widget's focusNode
755 755 */
756 756 'aria-label': string;
757 757
758 758 /**
759 759 * Order fields are traversed when user hits the tab key
760 760 */
761 761 tabIndex: number;
762 762
763 763 /**
764 764 * Should this widget respond to user input?
765 765 * In markup, this is specified as "disabled='disabled'", or just "disabled".
766 766 */
767 767 disabled: boolean;
768 768
769 769 /**
770 770 * Fires onChange for each value change or only on demand
771 771 */
772 772 intermediateChanges: boolean;
773 773
774 774 /**
775 775 * On focus, should this widget scroll into view?
776 776 */
777 777 scrollOnFocus: boolean;
778 778
779 779 /**
780 780 * Tells if this widget is focusable or not. Used internally by dijit.
781 781 */
782 782 isFocusable(): boolean;
783 783
784 784 /**
785 785 * Put focus on this widget
786 786 */
787 787 focus(): void;
788 788
789 789 /**
790 790 * Compare 2 values (as returned by get('value') for this widget).
791 791 */
792 792 compare(val1: any, val2: any): number;
793 793
794 794 /**
795 795 * Callback when this widget's value is changed.
796 796 */
797 797 onChange(value: string): void;
798 798
799 799 /**
800 800 * Overrides _Widget.create()
801 801 */
802 802 create(params?: any, srcNodeRef?: HTMLElement): void;
803 803
804 804 destroy(preserveDom?: boolean): void;
805 805
806 806 // set(name: 'disabled', value: boolean): this;
807 807 // set(name: string, value: any): this;
808 808 // set(values: Object): this;
809 809 }
810 810
811 811 /* dijit/form/_ListBase */
812 812
813 813 interface _ListBase {
814 814 /**
815 815 * currently selected node
816 816 */
817 817 selected: HTMLElement;
818 818
819 819 /**
820 820 * Select the first displayed item in the list.
821 821 */
822 822 selectFirstNode(): void;
823 823
824 824 /**
825 825 * Select the last displayed item in the list
826 826 */
827 827 selectLastNode(): void;
828 828
829 829 /**
830 830 * Select the item just below the current selection.
831 831 * If nothing selected, select first node.
832 832 */
833 833 selectNextNode(): void;
834 834
835 835 /**
836 836 * Select the item just above the current selection.
837 837 * If nothing selected, select last node (if
838 838 * you select Previous and try to keep scrolling up the list).
839 839 */
840 840 selectPreviousNode(): void;
841 841
842 842 // set(name: 'selected', value: HTMLElement): this;
843 843 // set(name: string, value: any): this;
844 844 // set(values: Object): this;
845 845 }
846 846
847 847 /* dijit/form/_ListMouseMixin */
848 848
849 849 interface _ListMouseMixin extends _ListBase {
850 850 postCreate(): void;
851 851 }
852 852
853 853 /* dijit/form/_RadioButtonMixin */
854 854
855 855 interface _RadioButtonMixin {
856 856 /**
857 857 * type attribute on `<input>` node.
858 858 * Users should not change this value.
859 859 */
860 860 type: string;
861 861 }
862 862
863 863 /* dijit/form/_SearchMixin */
864 864
865 interface _SearchMixin<T extends Object, Q extends dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions> {
865 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> {
866 866 /**
867 867 * Argument to data provider.
868 868 * Specifies maximum number of search results to return per query
869 869 */
870 870 pageSize: number;
871 871
872 872 /**
873 873 * Reference to data provider object used by this ComboBox.
874 874 * The store must accept an object hash of properties for its query. See `query` and `queryExpr` for details.
875 875 */
876 876 store: dojo.store.api.Store<T, Q, O>;
877 877
878 878 /**
879 879 * Mixin to the store's fetch.
880 880 * For example, to set the sort order of the ComboBox menu, pass:
881 881 * { sort: [{attribute:"name",descending: true}] }
882 882 * To override the default queryOptions so that deep=false, do:
883 883 * { queryOptions: {ignoreCase: true, deep: false} }
884 884 */
885 885 fetchProperties: { [property: string]: any };
886 886
887 887 /**
888 888 * A query that can be passed to `store` to initially filter the items.
889 889 * ComboBox overwrites any reference to the `searchAttr` and sets it to the `queryExpr` with the user's input substituted.
890 890 */
891 891 query: Q;
892 892
893 893 /**
894 894 * Alternate to specifying a store. Id of a dijit/form/DataList widget.
895 895 */
896 896 list: string;
897 897
898 898 /**
899 899 * Delay in milliseconds between when user types something and we start
900 900 * searching based on that value
901 901 */
902 902 searchDelay: number;
903 903
904 904 /**
905 905 * Search for items in the data store where this attribute (in the item)
906 906 * matches what the user typed
907 907 */
908 908 searchAttr: string;
909 909
910 910 /**
911 911 * This specifies what query is sent to the data store,
912 912 * based on what the user has typed. Changing this expression will modify
913 913 * whether the results are only exact matches, a "starting with" match,
914 914 * etc.
915 915 * `${0}` will be substituted for the user text.
916 916 * `*` is used for wildcards.
917 917 * `${0}*` means "starts with", `*${0}*` means "contains", `${0}` means "is"
918 918 */
919 919 queryExpr: string;
920 920
921 921 /**
922 922 * Set true if the query should ignore case when matching possible items
923 923 */
924 924 ignoreCase: boolean;
925 925
926 926 /**
927 927 * Helper function to convert a simple pattern to a regular expression for matching.
928 928 */
929 929 _patternToRegExp(pattern: string): RegExp;
930 930
931 931 _abortQuery(): void;
932 932
933 933 /**
934 934 * Handles input (keyboard/paste) events
935 935 */
936 936 _processInput(e: KeyboardEvent): void;
937 937
938 938 /**
939 939 * Callback when a search completes.
940 940 */
941 941 onSearch(results: T[], query: Q, options: O): void;
942 942
943 943 _startSearchFromInput(): void;
944 944
945 945 /**
946 946 * Starts a search for elements matching text (text=="" means to return all items
947 947 * and calls onSearch(...) when the search completes, to display the results.
948 948 */
949 949 _startSearch(text: string): void;
950 950
951 951 postMixInProperties(): void;
952 952
953 953 // set(name: 'list', value: string): this;
954 954 // set(name: string, value: any): this;
955 955 // set(values: Object): this;
956 956 }
957 957
958 958 /* dijit/form/_Spinner */
959 959
960 960 interface AdjustFunction {
961 961 (val: any, delta: number): any;
962 962 }
963 963
964 964 interface _Spinner extends RangeBoundTextBox {
965 965 /**
966 966 * Number of milliseconds before a held arrow key or up/down button becomes typematic
967 967 */
968 968 defaultTimeout: number;
969 969
970 970 /**
971 971 * minimum number of milliseconds that typematic event fires when held key or button is held
972 972 */
973 973 minimumTimeout: number;
974 974
975 975 /**
976 976 * Fraction of time used to change the typematic timer between events.
977 977 * 1.0 means that each typematic event fires at defaultTimeout intervals.
978 978 * Less than 1.0 means that each typematic event fires at an increasing faster rate.
979 979 */
980 980 timeoutChangeRate: number;
981 981
982 982 /**
983 983 * Adjust the value by this much when spinning using the arrow keys/buttons
984 984 */
985 985 smallDelta: number;
986 986
987 987 /**
988 988 * Adjust the value by this much when spinning using the PgUp/Dn keys
989 989 */
990 990 largeDelta: number;
991 991
992 992 templateString: string;
993 993 baseClass: string;
994 994 cssStateNodes: CSSStateNodes;
995 995
996 996 /**
997 997 * Overridable function used to adjust a primitive value(Number/Date/...) by the delta amount specified.
998 998 * The val is adjusted in a way that makes sense to the object type.
999 999 */
1000 1000 adjust: AdjustFunction;
1001 1001
1002 1002 postCreate(): void;
1003 1003 }
1004 1004
1005 1005 interface _SpinnerConstrctor extends _WidgetBaseConstructor<_Spinner> { }
1006 1006
1007 1007 /* dijit/form/_TextBoxMixin */
1008 1008
1009 interface _TextBoxMixin<C extends Constraints> {
1009 interface _TextBoxMixin<C extends Constraints = Constraints> {
1010 1010 /**
1011 1011 * Removes leading and trailing whitespace if true. Default is false.
1012 1012 */
1013 1013 trim: boolean;
1014 1014
1015 1015 /**
1016 1016 * Converts all characters to uppercase if true. Default is false.
1017 1017 */
1018 1018 uppercase: boolean;
1019 1019
1020 1020 /**
1021 1021 * Converts all characters to lowercase if true. Default is false.
1022 1022 */
1023 1023 lowercase: boolean;
1024 1024
1025 1025 /**
1026 1026 * Converts the first character of each word to uppercase if true.
1027 1027 */
1028 1028 propercase: boolean;
1029 1029
1030 1030 /**
1031 1031 * HTML INPUT tag maxLength declaration.
1032 1032 */
1033 1033 maxLength: string;
1034 1034
1035 1035 /**
1036 1036 * If true, all text will be selected when focused with mouse
1037 1037 */
1038 1038 selectOnClick: boolean;
1039 1039
1040 1040 /**
1041 1041 * Defines a hint to help users fill out the input field (as defined in HTML 5).
1042 1042 * This should only contain plain text (no html markup).
1043 1043 */
1044 1044 placeHolder: string;
1045 1045
1046 1046 /**
1047 1047 * For subclasses like ComboBox where the displayed value
1048 1048 * (ex: Kentucky) and the serialized value (ex: KY) are different,
1049 1049 * this represents the displayed value.
1050 1050 *
1051 1051 * Setting 'displayedValue' through set('displayedValue', ...)
1052 1052 * updates 'value', and vice-versa. Otherwise 'value' is updated
1053 1053 * from 'displayedValue' periodically, like onBlur etc.
1054 1054 */
1055 1055 displayedValue: string;
1056 1056
1057 1057 /**
1058 1058 * Replaceable function to convert a value to a properly formatted string.
1059 1059 */
1060 1060 format: ConstrainedValueFunction<any, C, any>;
1061 1061
1062 1062 /**
1063 1063 * Replaceable function to convert a formatted string to a value
1064 1064 */
1065 1065 parse: ConstrainedValueFunction<any, C, any>;
1066 1066
1067 1067 /**
1068 1068 * Connect to this function to receive notifications of various user data-input events.
1069 1069 * Return false to cancel the event and prevent it from being processed.
1070 1070 * Note that although for historical reasons this method is called `onInput()`, it doesn't
1071 1071 * correspond to the standard DOM "input" event, because it occurs before the input has been processed.
1072 1072 */
1073 1073 onInput(e: InputEvent): void;
1074 1074
1075 1075 postCreate(): void;
1076 1076
1077 1077 /**
1078 1078 * if the textbox is blank, what value should be reported
1079 1079 */
1080 1080 _blankValue: string;
1081 1081
1082 1082 /**
1083 1083 * Auto-corrections (such as trimming) that are applied to textbox
1084 1084 * value on blur or form submit.
1085 1085 */
1086 1086 filter<T>(val: T): T;
1087 1087 filter<T extends number>(value: T): T;
1088 1088
1089 1089 _setBlurValue(): void;
1090 1090
1091 1091 reset(): void;
1092 1092 }
1093 1093
1094 1094 /* dijit/form/_ToggleButtonMixin */
1095 1095
1096 1096 interface _ToggleButtonMixin {
1097 1097 /**
1098 1098 * Corresponds to the native HTML `<input>` element's attribute.
1099 1099 * In markup, specified as "checked='checked'" or just "checked".
1100 1100 * True if the button is depressed, or the checkbox is checked,
1101 1101 * or the radio button is selected, etc.
1102 1102 */
1103 1103 checked: boolean;
1104 1104
1105 1105 postCreate(): void;
1106 1106
1107 1107 /**
1108 1108 * Reset the widget's value to what it was at initialization time
1109 1109 */
1110 1110 reset(): void;
1111 1111
1112 1112 _hasBeenBlurred?: boolean;
1113 1113 }
1114 1114
1115 1115 /* dijit/form/Button */
1116 1116
1117 1117 interface Button extends _FormWidget, _ButtonMixin {
1118 1118 /**
1119 1119 * Set this to true to hide the label text and display only the icon.
1120 1120 * (If showLabel=false then iconClass must be specified.)
1121 1121 * Especially useful for toolbars.
1122 1122 * If showLabel=true, the label will become the title (a.k.a. tooltip/hint)
1123 1123 */
1124 1124 showLabel: boolean;
1125 1125
1126 1126 /**
1127 1127 * Class to apply to DOMNode in button to make it display an icon
1128 1128 */
1129 1129 iconClass: string;
1130 1130
1131 1131 baseClass: string;
1132 1132 templateString: string;
1133 1133 postCreate(): void;
1134 1134 setLabel(content: string): void;
1135 1135 onLabelSet(e: Event): void;
1136 1136
1137 1137 onClick(e: MouseEvent): boolean | void;
1138 1138
1139 1139 // set(name: 'showLabel', value: boolean): this;
1140 1140 // set(name: 'value', value: string): this;
1141 1141 // set(name: 'name', value: string): this;
1142 1142 // set(name: 'label', value: string): this;
1143 1143 // set(name: string, value: any): this;
1144 1144 // set(values: Object): this;
1145 1145 }
1146 1146
1147 1147 interface ButtonConstructor extends _WidgetBaseConstructor<Button> { }
1148 1148
1149 1149 /* dijit/form/CheckBox */
1150 1150
1151 1151 interface CheckBox extends ToggleButton, _CheckBoxMixin {
1152 1152 templateString: string;
1153 1153 baseClass: string;
1154 1154 postMixInProperties(): void;
1155 1155 value: string;
1156 1156
1157 1157 // set(name: 'value', value: string | boolean): this;
1158 1158 // set(name: string, value: any): this;
1159 1159 // set(values: Object): this;
1160 1160 }
1161 1161
1162 1162 interface CheckBoxConstructor extends _WidgetBaseConstructor<CheckBox> { }
1163 1163
1164 1164 /* dijit/form/ComboBox */
1165 1165
1166 interface ComboBox<T extends Object, Q extends dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions, C extends Constraints> extends ValidationTextBox<C>, ComboBoxMixin<T, Q, O> {
1166 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> {
1167 1167 // set(name: string, value: any): this;
1168 1168 // set(values: Object): this;
1169 1169 }
1170 1170
1171 interface ComboBoxConstructor extends _WidgetBaseConstructor<ComboBox<any, any, any, any>> {
1172 new <T extends Object, Q extends dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions, C extends Constraints>(params: Object, srcNodeRef: dojo.NodeOrString): ComboBox<T, Q, O, C>;
1171 interface ComboBoxConstructor extends _WidgetBaseConstructor<ComboBox<any>> {
1172 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>;
1173 1173 }
1174 1174
1175 1175 /* dijit/form/ComboBoxMixin */
1176 1176
1177 interface ComboBoxMixin<T extends Object, Q extends dojo.store.api.BaseQueryType, O extends dojo.store.api.QueryOptions> extends _HasDropDown<_ComboBoxMenu<T>>, _AutoCompleterMixin<T, Q, O> {
1177 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> {
1178 1178
1179 1179 /**
1180 1180 * Dropdown widget class used to select a date/time.
1181 1181 * Subclasses should specify this.
1182 1182 */
1183 1183 dropDownClass: _ComboBoxMenu<T>;
1184 1184
1185 1185 /**
1186 1186 * Set this textbox to have a down arrow button, to display the drop down list.
1187 1187 * Defaults to true.
1188 1188 */
1189 1189 hasDownArrow: boolean;
1190 1190
1191 1191 templateString: string;
1192 1192 baseClass: string;
1193 1193
1194 1194 /**
1195 1195 * Reference to data provider object used by this ComboBox.
1196 1196 *
1197 1197 * Should be dojo/store/api/Store, but dojo/data/api/Read supported
1198 1198 * for backwards compatibility.
1199 1199 */
1200 1200 store: dojo.store.api.Store<T, Q, O>;
1201 1201
1202 1202 cssStateNodes: CSSStateNodes;
1203 1203 postMixInProperties(): void;
1204 1204 buildRendering(): void;
1205 1205 }
1206 1206
1207 interface ComboBoxMixinConstructor<T, U extends dojo.store.api.BaseQueryType, V> extends _WidgetBaseConstructor<ComboBoxMixin<T, U, V>> { }
1207 interface ComboBoxMixinConstructor<T = any, U extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, V = any> extends _WidgetBaseConstructor<ComboBoxMixin<T, U, V>> { }
1208 1208
1209 1209 /* dijit/form/CurrencyTextBox */
1210 1210
1211 1211 interface CurrencyTextBoxConstraints extends NumberTextBoxConstraints, dojo.CurrencyFormatOptions, dojo.CurrencyParseOptions {
1212 1212 }
1213 1213
1214 1214 interface CurrencyTextBox extends NumberTextBox {
1215 1215 /**
1216 1216 * the [ISO4217](http://en.wikipedia.org/wiki/ISO_4217) currency code, a three letter sequence like "USD"
1217 1217 */
1218 1218 currency: string;
1219 1219
1220 1220 /**
1221 1221 * Despite the name, this parameter specifies both constraints on the input
1222 1222 * (including minimum/maximum allowed values) as well as
1223 1223 * formatting options. See `dijit/form/CurrencyTextBox.__Constraints` for details.
1224 1224 */
1225 1225 constraints: CurrencyTextBoxConstraints;
1226 1226
1227 1227 baseClass: string;
1228 1228
1229 1229 _formatter: (value: number, options?: dojo.CurrencyFormatOptions) => string;
1230 1230 _parser: (expression: string, options?: dojo.CurrencyParseOptions) => number;
1231 1231 _regExpGenerator: (options?: dojo.NumberRegexpOptions) => string;
1232 1232
1233 1233 /**
1234 1234 * Parses string value as a Currency, according to the constraints object
1235 1235 */
1236 1236 parse(value: string, constraints: CurrencyTextBoxConstraints): string;
1237 1237 }
1238 1238
1239 1239 interface CurrencyTextBoxConstructor extends _WidgetBaseConstructor<CurrencyTextBox> { }
1240 1240
1241 1241 /* dijit/form/DataList */
1242 1242
1243 1243 interface DataList<T extends Object> extends dojo.store.Memory<T> {
1244 1244 /**
1245 1245 * Get the option marked as selected, like `<option selected>`.
1246 1246 * Not part of dojo.data API.
1247 1247 */
1248 1248 fetchSelectedItem(): T;
1249 1249 }
1250 1250
1251 1251 interface DataListConstructor {
1252 1252 new <T extends Object>(params: Object, srcNodeRef: dojo.NodeOrString): DataList<T>;
1253 1253 }
1254 1254
1255 1255 /* dijit/form/DateTextBox */
1256 1256
1257 1257 interface DateTextBox extends _DateTimeTextBox<Calendar> {
1258 1258 baseClass: string;
1259 1259 popupClass: CalendarConstructor;
1260 1260 _selector: string;
1261 1261 maxHeight: number;
1262 1262
1263 1263 /**
1264 1264 * The value of this widget as a JavaScript Date object, with only year/month/day specified.`
1265 1265 */
1266 1266 value: Date;
1267 1267 }
1268 1268
1269 1269 interface DateTextBoxConstructor extends _WidgetBaseConstructor<DateTextBox> { }
1270 1270
1271 1271 /* dijit/form/DropDownButton */
1272 1272
1273 1273 interface DropDownButton<T extends _WidgetBase> extends Button, _Container, _HasDropDown<T> {
1274 1274 baseClass: string;
1275 1275 templateString: string;
1276 1276
1277 1277 /**
1278 1278 * Overrides _TemplatedMixin#_fillContent().
1279 1279 * My inner HTML possibly contains both the button label and/or a drop down widget, like
1280 1280 * <DropDownButton> <span>push me</span> <Menu> ... </Menu> </DropDownButton>
1281 1281 */
1282 1282 _fillContent(): void;
1283 1283 startup(): void;
1284 1284
1285 1285 /**
1286 1286 * Returns whether or not we are loaded - if our dropdown has an href,
1287 1287 * then we want to check that.
1288 1288 */
1289 1289 isLoaded(): boolean;
1290 1290
1291 1291 /**
1292 1292 * Default implementation assumes that drop down already exists,
1293 1293 * but hasn't loaded it's data (ex: ContentPane w/href).
1294 1294 * App must override if the drop down is lazy-created.
1295 1295 */
1296 1296 loadDropDown(callback: () => void): void;
1297 1297
1298 1298 /**
1299 1299 * Overridden so that focus is handled by the _HasDropDown mixin, not by
1300 1300 * the _FormWidget mixin.
1301 1301 */
1302 1302 isFocusable(): boolean;
1303 1303 }
1304 1304
1305 1305 interface DropDownButtonConstructor extends _WidgetBaseConstructor<DropDownButton<any>> {
1306 1306 new <T extends _WidgetBase>(params: Object, srcNodeRef: dojo.NodeOrString): DropDownButton<T>;
1307 1307 }
1308 1308
1309 1309 /* dijit/form/FilteringSelect */
1310 1310
1311 1311 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> {
1312 1312 /**
1313 1313 * True (default) if user is required to enter a value into this field.
1314 1314 */
1315 1315 required: boolean;
1316 1316
1317 1317 _lastDisplayedValue: string;
1318 1318 _isValidSubset(): boolean;
1319 1319 isValid(): boolean;
1320 1320 _refreshState(): void;
1321 1321
1322 1322 /**
1323 1323 * Callback from dojo.store after lookup of user entered value finishes
1324 1324 */
1325 1325 _callbackSetLabel(result: T[], query: Q, options: O, priorityChange?: boolean): void;
1326 1326
1327 1327 _openResultList(results: T[], query: Q, options: O): void;
1328 1328 undo(): void;
1329 1329
1330 1330 // set(name: 'displayedValue', value: string): this;
1331 1331 // set(name: 'item', value: T): this;
1332 1332 // set(name: string, value: any): this;
1333 1333 // set(values: Object): this;
1334 1334 }
1335 1335
1336 1336 interface FilteringSelectConstructor extends _WidgetBaseConstructor<FilteringSelect<any, any, any, any>> {
1337 1337 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>;
1338 1338 }
1339 1339
1340 1340 /* dijit/form/Form */
1341 1341
1342 1342 interface Form extends _Widget, _TemplatedMixin, _FormMixin, layout._ContentPaneResizeMixin {
1343 1343 name?: string;
1344 1344 action?: string;
1345 1345 method?: string;
1346 1346 encType?: string;
1347 1347 'accept-charset'?: string;
1348 1348 accept?: string;
1349 1349 target?: string;
1350 1350 templateString: string;
1351 1351
1352 1352 /**
1353 1353 * Deprecated: use submit()
1354 1354 */
1355 1355 execute(formContents: Object): void;
1356 1356
1357 1357 /**
1358 1358 * Deprecated: use onSubmit()
1359 1359 */
1360 1360 onExecute(): void;
1361 1361
1362 1362 /**
1363 1363 * restores all widget values back to their init values,
1364 1364 * calls onReset() which can cancel the reset by returning false
1365 1365 */
1366 1366 reset(e?: Event): void;
1367 1367
1368 1368 /**
1369 1369 * Callback when user resets the form. This method is intended
1370 1370 * to be over-ridden. When the `reset` method is called
1371 1371 * programmatically, the return value from `onReset` is used
1372 1372 * to compute whether or not resetting should proceed
1373 1373 */
1374 1374 onReset(e?: Event): boolean;
1375 1375
1376 1376 /**
1377 1377 * Callback when user submits the form.
1378 1378 */
1379 1379 onSubmit(e?: Event): boolean;
1380 1380
1381 1381 /**
1382 1382 * programmatically submit form if and only if the `onSubmit` returns true
1383 1383 */
1384 1384 submit(): void;
1385 1385 }
1386 1386
1387 1387 interface FormConstructor extends _WidgetBaseConstructor<Form> { }
1388 1388
1389 1389 /* dijit/form/HorizontalRule */
1390 1390
1391 1391 /**
1392 1392 * Hash marks for `dijit/form/HorizontalSlider`
1393 1393 */
1394 1394 interface HorizontalRule extends _Widget, _TemplatedMixin {
1395 1395 /**
1396 1396 * Number of hash marks to generate
1397 1397 */
1398 1398 count: number;
1399 1399
1400 1400 /**
1401 1401 * For HorizontalSlider, this is either "topDecoration" or "bottomDecoration", and indicates whether this rule goes above or below the slider.
1402 1402 */
1403 1403 container: string;
1404 1404
1405 1405 /**
1406 1406 * CSS style to apply to individual hash marks
1407 1407 */
1408 1408 ruleStyle: string;
1409 1409
1410 1410 _positionPrefix: string;
1411 1411 _positionSuffix: string;
1412 1412 _suffix: string;
1413 1413
1414 1414 _genHTML(pos: number): string;
1415 1415
1416 1416 /**
1417 1417 * VerticalRule will override this...
1418 1418 */
1419 1419 _isHorizontal: boolean;
1420 1420 }
1421 1421
1422 1422 interface HorizontalRuleConstructor extends _WidgetBaseConstructor<HorizontalRule> { }
1423 1423
1424 1424 /* dijit/form/HorizontalRuleLabels */
1425 1425
1426 1426 /**
1427 1427 * Labels for `dijit/form/HorizontalSlider`
1428 1428 */
1429 1429 interface HorizontalRuleLabels extends HorizontalRule {
1430 1430 /**
1431 1431 * CSS style to apply to individual text labels
1432 1432 */
1433 1433 labelStyle: string;
1434 1434
1435 1435 /**
1436 1436 * Array of text labels to render - evenly spaced from left-to-right or bottom-to-top.
1437 1437 * Alternately, minimum and maximum can be specified, to get numeric labels.
1438 1438 */
1439 1439 labels: string[];
1440 1440
1441 1441 /**
1442 1442 * Number of generated numeric labels that should be rendered as '' on the ends when labels[] are not specified
1443 1443 */
1444 1444 numericMargin: number;
1445 1445
1446 1446 /**
1447 1447 * Leftmost label value for generated numeric labels when labels[] are not specified
1448 1448 */
1449 1449 minimum: number;
1450 1450
1451 1451 /**
1452 1452 * Rightmost label value for generated numeric labels when labels[] are not specified
1453 1453 */
1454 1454 maximum: number;
1455 1455
1456 1456 /**
1457 1457 * pattern, places, lang, et al (see dojo.number) for generated numeric labels when labels[] are not specified
1458 1458 */
1459 1459 constraints: { pattern: string };
1460 1460
1461 1461 /**
1462 1462 * Returns the value to be used in HTML for the label as part of the left: attribute
1463 1463 */
1464 1464 _calcPosition(pos: number): number;
1465 1465
1466 1466 _genHTML(pos: number, ndx?: number): string;
1467 1467
1468 1468 /**
1469 1469 * extension point for bidi code
1470 1470 */
1471 1471 _genDirectionHTML(label: string): string;
1472 1472
1473 1473 /**
1474 1474 * Overridable function to return array of labels to use for this slider.
1475 1475 * Can specify a getLabels() method instead of a labels[] array, or min/max attributes.
1476 1476 */
1477 1477 getLabels(): string[];
1478 1478 }
1479 1479
1480 1480 interface HorizontalRuleLabelsConstructor extends _WidgetBaseConstructor<HorizontalRuleLabels> { }
1481 1481
1482 1482 /* dijit/form/HorizontalSlider */
1483 1483
1484 1484 interface _SliderMover extends dojo.dnd.Mover { }
1485 1485
1486 1486 /**
1487 1487 * A form widget that allows one to select a value with a horizontally draggable handle
1488 1488 */
1489 1489 interface HorizontalSlider extends _FormValueWidget, _Container {
1490 1490 /**
1491 1491 * Show increment/decrement buttons at the ends of the slider?
1492 1492 */
1493 1493 showButtons: boolean;
1494 1494
1495 1495 /**
1496 1496 * The minimum value the slider can be set to.
1497 1497 */
1498 1498 minimum: number;
1499 1499
1500 1500 /**
1501 1501 * The maximum value the slider can be set to.
1502 1502 */
1503 1503 maximum: number;
1504 1504
1505 1505 /**
1506 1506 * 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.
1507 1507 * Thus, the slider has only 'discreteValues' possible values.
1508 1508 *
1509 1509 * For example, if minimum=10, maxiumum=30, and discreteValues=3, then the slider handle has three possible positions, representing values 10, 20, or 30.
1510 1510 *
1511 1511 * 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).
1512 1512 */
1513 1513 discreteValues: number;
1514 1514
1515 1515 /**
1516 1516 * If discreteValues is also specified, this indicates the amount of clicks (ie, snap positions) that the slider handle is moved via pageup/pagedown keys.
1517 1517 * If discreteValues is not specified, it indicates the number of pixels.
1518 1518 */
1519 1519 pageIncrement: number;
1520 1520
1521 1521 /**
1522 1522 * If clicking the slider bar changes the value or not
1523 1523 */
1524 1524 clickSelect: boolean;
1525 1525
1526 1526 /**
1527 1527 * 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.
1528 1528 */
1529 1529 slideDuration: number;
1530 1530
1531 1531 _mousePixelCoord: string;
1532 1532 _pixelCount: string;
1533 1533 _startingPixelCoord: string;
1534 1534 _handleOffsetCoord: string;
1535 1535 _progressPixelSize: string;
1536 1536
1537 1537 _onKeyUp(e: Event): void;
1538 1538 _onKeyDown(e: Event): void;
1539 1539 _onHandleClick(e: Event): void;
1540 1540
1541 1541 /**
1542 1542 * Returns true if direction is from right to left
1543 1543 */
1544 1544 _isReversed(): boolean;
1545 1545
1546 1546 _onBarClick(e: Event): void;
1547 1547
1548 1548 _setPixelValue(pixelValue: number, maxPixels: number, priorityChange?: boolean): void;
1549 1549
1550 1550 _setValueAttr(value: number, priorityChange?: boolean): void;
1551 1551
1552 1552 _bumpValue(signedChange: number, priorityChange: boolean): void;
1553 1553
1554 1554 _onClkBumper(val: any): void;
1555 1555 _onClkIncBumper(): void;
1556 1556 _onClkDecBumper(): void;
1557 1557
1558 1558 decrement(e: Event): void;
1559 1559 increment(e: Event): void;
1560 1560
1561 1561 _mouseWheeled(evt: Event): void;
1562 1562
1563 1563 _typematicCallback(count: number, button: Element, e: Event): void;
1564 1564 }
1565 1565
1566 1566 interface HorizontalSliderConstructor extends _WidgetBaseConstructor<HorizontalSlider> {
1567 1567 /**
1568 1568 * for monkey patching
1569 1569 */
1570 1570 _Mover: _SliderMover;
1571 1571 }
1572 1572
1573 1573 /* dijit/form/MappedTextBox */
1574 1574
1575 1575 interface MappedTextBox<C extends Constraints> extends ValidationTextBox<C> {
1576 1576 postMixInProperties(): void;
1577 1577 serialize: SerializationFunction;
1578 1578 toString(): string;
1579 1579 validate(isFocused?: boolean): boolean;
1580 1580 buildRendering(): void;
1581 1581 reset(): void;
1582 1582 }
1583 1583
1584 1584 interface MappedTextBoxConstructor extends _WidgetBaseConstructor<MappedTextBox<Constraints>> {
1585 1585 new <C extends Constraints>(params: Object, srcNodeRef: dojo.NodeOrString): MappedTextBox<C>;
1586 1586 }
1587 1587
1588 1588 /* dijit/form/NumberSpinner */
1589 1589
1590 1590 interface NumberSpinner extends _Spinner, NumberTextBoxMixin {
1591 1591 constraints: NumberTextBoxConstraints;
1592 1592 baseClass: string;
1593 1593 adjust(val: any, delta: number): any;
1594 1594
1595 1595 /* overrides */
1596 1596 pattern: ConstraintsToRegExpString<NumberTextBoxConstraints>;
1597 1597 parse(value: string, constraints: NumberTextBoxConstraints): string;
1598 1598 format(value: number, constraints: NumberTextBoxConstraints): string;
1599 1599 filter(value: number): number;
1600 1600 value: number;
1601 1601 }
1602 1602
1603 1603 interface NumberSpinnerConstructor extends _WidgetBaseConstructor<NumberSpinner> { }
1604 1604
1605 1605 /* dijit/form/NumberTextBox */
1606 1606
1607 1607 interface NumberTextBoxConstraints extends RangeBoundTextBoxConstraints, dojo.NumberFormatOptions, dojo.NumberParseOptions { }
1608 1608
1609 1609 interface NumberTextBoxMixin {
1610 1610 pattern: ConstraintsToRegExpString<NumberTextBoxConstraints>;
1611 1611 constraints: NumberTextBoxConstraints;
1612 1612 value: number;
1613 1613 editOptions: { pattern: string };
1614 1614 _formatter: (value: number, options?: dojo.NumberFormatOptions) => string;
1615 1615 _regExpGenerator: (options?: dojo.NumberRegexpOptions) => string;
1616 1616 _decimalInfo: (constraints: Constraints) => { sep: string; places: number; };
1617 1617 postMixInProperties(): void;
1618 1618 format(value: number, constraints: NumberTextBoxConstraints): string;
1619 1619 _parser: (expression: string, options?: dojo.NumberParseOptions) => number;
1620 1620 parse(value: string, constraints: dojo.NumberParseOptions): string;
1621 1621 filter(value: number): number;
1622 1622 serialize: SerializationFunction;
1623 1623 isValid(isFocused: boolean): boolean;
1624 1624 }
1625 1625
1626 1626 interface NumberTextBoxMixinConstructor extends _WidgetBaseConstructor<NumberTextBoxMixin> { }
1627 1627
1628 1628 interface NumberTextBox extends RangeBoundTextBox, NumberTextBoxMixin {
1629 1629 constraints: NumberTextBoxConstraints;
1630 1630 pattern: ConstraintsToRegExpString<NumberTextBoxConstraints>;
1631 1631 parse(value: string, constraints: dojo.NumberParseOptions): string;
1632 1632 format(value: number, constraints: dojo.NumberFormatOptions): string;
1633 1633 value: number;
1634 1634 filter(value: number): number;
1635 1635 }
1636 1636
1637 1637 interface NumberTextBoxConstructor extends _WidgetBaseConstructor<NumberTextBox> {
1638 1638 Mixin: NumberTextBoxMixinConstructor;
1639 1639 }
1640 1640
1641 1641 /* dijit/form/RadioButton */
1642 1642
1643 1643 interface RadioButton extends CheckBox, _RadioButtonMixin {
1644 1644 baseClass: string;
1645 1645 }
1646 1646
1647 1647 interface RadioButtonConstructor extends _WidgetBaseConstructor<RadioButton> { }
1648 1648
1649 1649 /* dijit/form/RangeBoundTextBox */
1650 1650
1651 1651 interface RangeBoundTextBoxConstraints extends Constraints {
1652 1652 min?: number;
1653 1653 max?: number;
1654 1654 }
1655 1655
1656 1656 interface RangeBoundTextBox extends MappedTextBox<RangeBoundTextBoxConstraints> {
1657 1657 /**
1658 1658 * The message to display if value is out-of-range
1659 1659 */
1660 1660 rangeMessage: string;
1661 1661
1662 1662 /**
1663 1663 * Overridable function used to validate the range of the numeric input value.
1664 1664 */
1665 1665 rangeCheck(primative: number, constraints: RangeBoundTextBoxConstraints): boolean;
1666 1666
1667 1667 /**
1668 1668 * Tests if the value is in the min/max range specified in constraints
1669 1669 */
1670 1670 isInRange(isFocused: boolean): boolean;
1671 1671
1672 1672 /**
1673 1673 * Returns true if the value is out of range and will remain
1674 1674 * out of range even if the user types more characters
1675 1675 */
1676 1676 _isDefinitelyOutOfRange(): boolean;
1677 1677
1678 1678 isValid(isFocused: boolean): boolean;
1679 1679 getErrorMessage(isFocused: boolean): string;
1680 1680 postMixInProperties(): void;
1681 1681 }
1682 1682
1683 1683 interface RangeBoundTextBoxConstructor extends _WidgetBaseConstructor<RangeBoundTextBox> { }
1684 1684
1685 1685 /* dijit/form/Select */
1686 1686
1687 1687 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 {
1688 1688 baseClass: string;
1689 1689
1690 1690 /**
1691 1691 * What to display in an "empty" drop down.
1692 1692 */
1693 1693 emptyLabel: string;
1694 1694
1695 1695 /**
1696 1696 * Specifies how to interpret the labelAttr in the data store items.
1697 1697 */
1698 1698 labelType: string;
1699 1699
1700 1700 /**
1701 1701 * Currently displayed error/prompt message
1702 1702 */
1703 1703 message: string;
1704 1704
1705 1705 /**
1706 1706 * Can be true or false, default is false.
1707 1707 */
1708 1708 required: boolean;
1709 1709
1710 1710 /**
1711 1711 * "Incomplete" if this select is required but unset (i.e. blank value), "" otherwise
1712 1712 */
1713 1713 state: string;
1714 1714
1715 1715 /**
1716 1716 * Order fields are traversed when user hits the tab key
1717 1717 */
1718 1718 tabIndex: any;
1719 1719 templateString: any;
1720 1720
1721 1721 /**
1722 1722 * See the description of dijit/Tooltip.defaultPosition for details on this parameter.
1723 1723 */
1724 1724 tooltipPosition: any;
1725 1725
1726 1726 childSelector(node: Element | Node): boolean;
1727 1727 destroy(preserveDom: boolean): void;
1728 1728 focus(): void;
1729 1729
1730 1730 /**
1731 1731 * Sets the value to the given option, used during search by letter.
1732 1732 * @param widget Reference to option's widget
1733 1733 */
1734 1734 focusChild(widget: dijit._WidgetBase): void;
1735 1735 isLoaded(): boolean;
1736 1736
1737 1737 /**
1738 1738 * Whether or not this is a valid value.
1739 1739 * @param isFocused
1740 1740 */
1741 1741 isValid(isFocused: boolean): boolean;
1742 1742
1743 1743 /**
1744 1744 * populates the menu
1745 1745 * @param loadCallback
1746 1746 */
1747 1747 loadDropDown(loadCallback: () => any): void;
1748 1748 postCreate(): void;
1749 1749
1750 1750 /**
1751 1751 * set the missing message
1752 1752 */
1753 1753 postMixInProperties(): void;
1754 1754
1755 1755 /**
1756 1756 * Overridden so that the state will be cleared.
1757 1757 */
1758 1758 reset(): void;
1759 1759 startup(): void;
1760 1760
1761 1761 /**
1762 1762 * Called by oninit, onblur, and onkeypress, and whenever required/disabled state changes
1763 1763 * @param isFocused
1764 1764 */
1765 1765 validate(isFocused: boolean): boolean;
1766 1766
1767 1767 /**
1768 1768 * When a key is pressed that matches a child item,
1769 1769 * this method is called so that a widget can take
1770 1770 * appropriate action is necessary.
1771 1771 * @param item
1772 1772 * @param evt
1773 1773 * @param searchString
1774 1774 * @param numMatches
1775 1775 */
1776 1776 onKeyboardSearch(item: dijit._WidgetBase, evt: Event, searchString: string, numMatches: number): void;
1777 1777 }
1778 1778
1779 1779 interface SelectConstructor extends _WidgetBaseConstructor<Select<any, any, any, any>> { }
1780 1780
1781 1781 /* dijit/form/SimpleTextarea */
1782 1782
1783 1783 interface SimpleTextarea extends TextBox {
1784 1784 baseClass: string;
1785 1785 rows: string;
1786 1786 cols: string;
1787 1787 templateString: string;
1788 1788 postMixInProperties(): void;
1789 1789 buildRendering(): void;
1790 1790 filter(value: string): string;
1791 1791 }
1792 1792
1793 1793 interface SimpleTextareaConstructor extends _WidgetBaseConstructor<SimpleTextarea> {
1794 1794 new (params: Object, srcNodeRef: dojo.NodeOrString): SimpleTextarea;
1795 1795 }
1796 1796
1797 1797 /* dijit/form/Textarea */
1798 1798
1799 1799 interface Textarea extends SimpleTextarea, _ExpandingTextAreaMixin {
1800 1800 baseClass: string;
1801 1801 cols: string;
1802 1802 buildRendering(): void;
1803 1803 }
1804 1804
1805 1805 interface TextareaConstructor extends _WidgetBaseConstructor<Textarea> { }
1806 1806
1807 1807 /* dijit/form/TextBox */
1808 1808
1809 1809 interface TextBox extends _FormValueWidget, _TextBoxMixin<Constraints> {
1810 1810 // set(name: 'displayedValue', value: string): this;
1811 1811 // set(name: 'disabled', value: boolean): this;
1812 1812 // set(name: 'value', value: string): this;
1813 1813 // set(name: string, value: any): this;
1814 1814 // set(values: Object): this;
1815 1815
1816 1816 // get(name: 'displayedValue'): string;
1817 1817 // get(name: 'value'): string;
1818 1818 // get(name: string): any;
1819 1819 }
1820 1820
1821 1821 interface TextBoxConstructor extends _WidgetBaseConstructor<TextBox> { }
1822 1822
1823 1823 /* dijit/form/ToggleButton */
1824 1824
1825 1825 interface ToggleButton extends Button, _ToggleButtonMixin {
1826 1826 baseClass: string;
1827 1827
1828 1828 setChecked(checked: boolean): void;
1829 1829
1830 1830 // set(name: 'checked', value: boolean): this;
1831 1831 // set(name: string, value: any): this;
1832 1832 // set(values: Object): this;
1833 1833 }
1834 1834
1835 1835 interface ToggleButtonConstructor extends _WidgetBaseConstructor<ToggleButton> { }
1836 1836
1837 1837 /* dijit/form/ValidationTextBox */
1838 1838
1839 1839 interface IsValidFunction {
1840 1840 (isFocused?: boolean): boolean;
1841 1841 }
1842 1842
1843 interface ValidationTextBox<C extends Constraints> extends TextBox {
1843 interface ValidationTextBox<C extends Constraints = Constraints> extends TextBox {
1844 1844 templateString: string;
1845 1845 required: boolean;
1846 1846 promptMessage: string;
1847 1847 invalidMessage: string;
1848 1848 missingMessage: string;
1849 1849 message: string;
1850 1850 constraints: C;
1851 1851 pattern: string | ConstraintsToRegExpString<C>;
1852 1852 regExp: string;
1853 1853 regExpGen(constraints: C): void;
1854 1854 state: string;
1855 1855 tooltipPosition: string[];
1856 1856 validator: ConstrainedValidFunction<C>;
1857 1857 isValid: IsValidFunction;
1858 1858 getErrorMessage(isFocused: boolean): string;
1859 1859 getPromptMessage(isFocused: boolean): string;
1860 1860 validate(isFocused: boolean): boolean;
1861 1861 displayMessage(message: string): void;
1862 1862
1863 1863 startup(): void;
1864 1864 postMixInProperties(): void;
1865 1865
1866 1866 reset(): void;
1867 1867
1868 1868 destroy(preserveDom?: boolean): void;
1869 1869
1870 1870 // set(name: 'constraints', value: Constraints): this;
1871 1871 // set(name: 'disabled', value: boolean): this;
1872 1872 // set(name: 'message', value: string): this;
1873 1873 // set(name: 'pattern', value: string | ConstraintsToRegExpString<C>): this;
1874 1874 // set(name: 'regExp', value: string): this;
1875 1875 // set(name: 'regExpGen', value: Constraints): this;
1876 1876 // set(name: 'required', value: boolean): this;
1877 1877 // set(name: 'value', value: string): this;
1878 1878 // set(name: string, value: any): this;
1879 1879 // set(values: Object): this;
1880 1880
1881 1881 // get(name: 'pattern'): string | ConstraintsToRegExpString<C>;
1882 1882 // get(name: string): any;
1883 1883 }
1884 1884
1885 1885 interface ValidationTextBoxConstructor extends _WidgetBaseConstructor<ValidationTextBox<Constraints>> {
1886 1886 new <C extends Constraints>(params: Object, srcNodeRef: dojo.NodeOrString): ValidationTextBox<C>;
1887 1887 }
1888 1888 }
1889 1889 }
@@ -1,670 +1,670
1 1 declare namespace dijit {
2 2
3 3 namespace layout {
4 4
5 5 /* dijit/_LayoutWidget */
6 6
7 7 /* tslint:disable:class-name */
8 8 interface _LayoutWidget extends _Widget, _Container, _Contained {
9 9
10 10 /**
11 11 * Base class for a _Container widget which is responsible for laying
12 12 * out its children. Widgets which mixin this code must define layout()
13 13 * to manage placement and sizing of the children.
14 14 */
15 15 baseClass: string;
16 16 /**
17 17 * Indicates that this widget is going to call resize() on its
18 18 * children widgets, setting their size, when they become visible.
19 19 */
20 20 isLayoutContainer: boolean;
21 21
22 22 /**
23 23 * Call this to resize a widget, or after its size has changed.
24 24 *
25 25 * ####Change size mode:
26 26 *
27 27 * When changeSize is specified, changes the marginBox of this widget
28 28 * and forces it to re-layout its contents accordingly.
29 29 * changeSize may specify height, width, or both.
30 30 *
31 31 * If resultSize is specified it indicates the size the widget will
32 32 * become after changeSize has been applied.
33 33 *
34 34 * ####Notification mode:
35 35 *
36 36 * When changeSize is null, indicates that the caller has already changed
37 37 * the size of the widget, or perhaps it changed because the browser
38 38 * window was resized. Tells widget to re-layout its contents accordingly.
39 39 *
40 40 * If resultSize is also specified it indicates the size the widget has
41 41 * become.
42 42 *
43 43 * In either mode, this method also:
44 44 *
45 45 * 1. Sets this._borderBox and this._contentBox to the new size of
46 46 * the widget. Queries the current domNode size if necessary.
47 47 * 2. Calls layout() to resize contents (and maybe adjust child widgets).
48 48 */
49 49 resize(changeSize?: dojo.DomGeometryBox, resultSize?: dojo.DomGeometryWidthHeight): void;
50 50
51 51 /**
52 52 * Widgets override this method to size and position their contents/children.
53 53 * When this is called, this._contentBox is guaranteed to be set (see resize()).
54 54 *
55 55 * This is called after startup(), and also when the widget's size has been
56 56 * changed.
57 57 */
58 58 layout(): void;
59 59 }
60 60
61 61 interface _LayoutWidgetConstructor extends _WidgetBaseConstructor<_LayoutWidget> { }
62 62
63 63 /* dijit/layout/_TabContainerBase */
64 64
65 65 interface _TabContainerBase extends StackContainer, _TemplatedMixin {
66 66 /**
67 67 * Defines where tabs go relative to tab content.
68 68 * "top", "bottom", "left-h", "right-h"
69 69 */
70 70 tabPosition: string;
71 71 // tabPosition: 'top' | 'bottom' | 'left-h' | 'right-h';
72 72
73 73 /**
74 74 * Defines whether the tablist gets an extra class for layouting, putting a border/shading
75 75 * around the set of tabs. Not supported by claro theme.
76 76 */
77 77 tabStrip: boolean;
78 78
79 79 /**
80 80 * If true, use styling for a TabContainer nested inside another TabContainer.
81 81 * For tundra etc., makes tabs look like links, and hides the outer
82 82 * border since the outer TabContainer already has a border.
83 83 */
84 84 nested: boolean;
85 85 }
86 86
87 87 /* dijit/layout/LayoutContainer */
88 88
89 89 interface LayoutContainer extends _LayoutWidget {
90 90 /**
91 91 * Which design is used for the layout:
92 92 *
93 93 * - "headline" (default) where the top and bottom extend the full width of the container
94 94 * - "sidebar" where the left and right sides extend from top to bottom.
95 95 *
96 96 * However, a `layoutPriority` setting on child panes overrides the `design` attribute on the parent.
97 97 * In other words, if the top and bottom sections have a lower `layoutPriority` than the left and right
98 98 * panes, the top and bottom panes will extend the entire width of the box.
99 99 */
100 100 design: string;
101 101 // design: 'headline' | 'sidebar';
102 102
103 103 addChild<T extends _WidgetBase>(child: T, insertIndex?: number): void;
104 104 removeChild<T extends _WidgetBase>(child: T): void;
105 105 }
106 106
107 107 interface LayoutContainerConstructor extends _WidgetBaseConstructor<LayoutContainer> { }
108 108
109 109 /* dijit/layout/AccordionContainer */
110 110
111 111 interface _AccordionButton extends _WidgetBase, _TemplatedMixin, _CssStateMixin {
112 112 /**
113 113 * Title of the pane.
114 114 */
115 115 label: string;
116 116
117 117 /**
118 118 * Tooltip that appears on hover.
119 119 */
120 120 title: string;
121 121
122 122 /**
123 123 * CSS class for icon to left of label.
124 124 */
125 125 iconClassAttr: string;
126 126
127 127 /**
128 128 * Returns the height of the title dom node.
129 129 */
130 130 getTitleHeight(): number;
131 131 }
132 132
133 133 interface _AccordionButtonConstructor extends _WidgetBaseConstructor<_AccordionButton> { }
134 134
135 135 interface AccordionContainer extends StackContainer {
136 136 /**
137 137 * Amount of time (in ms) it takes to slide panes.
138 138 */
139 139 duration: number;
140 140
141 141 /**
142 142 * The name of the widget used to display the title of each pane.
143 143 */
144 144 buttonWidget: _AccordionButtonConstructor;
145 145 }
146 146
147 147 interface AccordionContainerConstructor extends _WidgetBaseConstructor<AccordionContainer> { }
148 148
149 149 /* dijit/layout/AccordionPane */
150 150
151 151 interface AccordionPane extends ContentPane {
152 152 /**
153 153 * Called when this pane is selected.
154 154 */
155 155 onSelected(): void;
156 156 }
157 157
158 158 interface AccordionPaneConstructor extends _WidgetBaseConstructor<AccordionPane> { }
159 159
160 160 /* dijit/layout/BorderContainer */
161 161
162 162 interface BorderContainer extends LayoutContainer {
163 163 /**
164 164 * Give each pane a border and margin.
165 165 * Margin determined by domNode.paddingLeft.
166 166 * When false, only resizable panes have a gutter (i.e. draggable splitter) for resizing.
167 167 */
168 168 gutters: boolean;
169 169
170 170 /**
171 171 * Specifies whether splitters resize as you drag (true) or only upon mouseup (false)
172 172 */
173 173 liveSplitters: boolean;
174 174
175 175 /**
176 176 * Save splitter positions in a cookie.
177 177 */
178 178 persist: boolean;
179 179
180 180 /**
181 181 * Returns the widget responsible for rendering the splitter associated with region.with
182 182 */
183 183 getSplitter(region: string): any;
184 184
185 185 destroyRecursive(): void;
186 186 }
187 187
188 188 interface BorderContainerConstructor extends _WidgetBaseConstructor<BorderContainer> { }
189 189
190 190 /* dijit/ContentPane */
191 191
192 192 interface ContentPane extends _Widget, _Container, _ContentPaneResizeMixin {
193 193
194 194 /**
195 195 * The href of the content that displays now
196 196 * Set this at construction if you want to load data externally when th
197 197 * pane is shown. (Set preload=true to load it immediately.
198 198 * Changing href after creation doesn't have any effect; Use set('href', ...);
199 199 */
200 200 href: string;
201 201
202 202 /**
203 203 * The innerHTML of the ContentPane
204 204 * Note that the initialization parameter / argument to set("content", ...
205 205 * can be a String, DomNode, Nodelist, or _Widget.
206 206 */
207 content: dojo.ContentSetterContent | dijit._Widget;
207 content: any;
208 208
209 209 /**
210 210 * Extract visible content from inside of `<body> .... </body>`
211 211 * I.e., strip `<html>` and `<head>` (and it's contents) from the href
212 212 */
213 213 extractContent: boolean;
214 214
215 215 /**
216 216 * Parse content and create the widgets, if any.
217 217 */
218 218 parseOnLoad: boolean;
219 219
220 220 /**
221 221 * Flag passed to parser. Root for attribute names to search for. If scopeName is dojo
222 222 * will search for data-dojo-type (or dojoType). For backwards compatibilit
223 223 * reasons defaults to dojo._scopeName (which is "dojo" except whe
224 224 * multi-version support is used, when it will be something like dojo16, dojo20, etc.)
225 225 */
226 226 parserScope: string;
227 227
228 228 /**
229 229 * Prevent caching of data from href's by appending a timestamp to the href.
230 230 */
231 231 preventCache: boolean;
232 232
233 233 /**
234 234 * Force load of data on initialization even if pane is hidden.
235 235 */
236 236 preload: boolean;
237 237
238 238 /**
239 239 * Refresh (re-download) content when pane goes from hidden to shown
240 240 */
241 241 refreshOnShow: boolean;
242 242
243 243 /**
244 244 * Message that shows while downloading
245 245 */
246 246 loadingMessage: string;
247 247
248 248 /**
249 249 * Message that shows if an error occurs
250 250 */
251 251 errorMessage: string;
252 252
253 253 /**
254 254 * True if the ContentPane has data in it, either specifie
255 255 * during initialization (via href or inline content), or se
256 256 * via set('content', ...) / set('href', ...
257 257 * False if it doesn't have any content, or if ContentPane i
258 258 * still in the process of downloading href.
259 259 */
260 260 isLoaded: boolean;
261 261
262 262 baseClass: string;
263 263
264 264 /**
265 265 * Function that should grab the content specified via href.
266 266 */
267 267 ioMethod<T>(url: string, options?: dojo.request.XhrBaseOptions): dojo.request.Promise<T>;
268 268
269 269 /**
270 270 * Parameters to pass to xhrGet() request, for example:
271 271 * | <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="href: './bar', ioArgs: {timeout: 500}">
272 272 */
273 273 ioArgs: { [arg: string]: string | number };
274 274
275 275 /**
276 276 * This is the `dojo.Deferred` returned by set('href', ...) and refresh()
277 277 * Calling onLoadDeferred.then() registers you
278 278 * callback to be called only once, when the prior set('href', ...) call o
279 279 * the initial href parameter to the constructor finishes loading
280 280 * This is different than an onLoad() handler which gets called any time any hre
281 281 * or content is loaded.
282 282 */
283 283 onLoadDeferred: dojo.Deferred<any>;
284 284
285 285 /**
286 286 * Flag to parser that I'll parse my contents, so it shouldn't.
287 287 */
288 288 stopParser: boolean;
289 289
290 290 /**
291 291 * Flag from the parser that this ContentPane is inside a templat
292 292 * so the contents are pre-parsed.
293 293 */
294 294 template: boolean;
295 295
296 296 markupFactory<T>(params: any, node: HTMLElement, ctor: dojo.GenericConstructor<T>): T;
297 297 postMixInProperties(): void;
298 298 buildRendering(): void;
299 299
300 300 /**
301 301 * Call startup() on all children including non _Widget ones like dojo/dnd/Source objects
302 302 */
303 303 startup(): void;
304 304
305 305 /**
306 306 * Deprecated. Use set('href', ...) instead.
307 307 */
308 308 setHref(href: string | URL): ContentPane;
309 309
310 310 /**
311 311 * Deprecated. Use set('content', ...) instead.
312 312 */
313 313 setContent(data: dojo.ContentSetterContent): ContentPane;
314 314
315 315 /**
316 316 * Cancels an in-flight download of content
317 317 */
318 318 cancel(): void;
319 319
320 320 /**
321 321 * [Re]download contents of href and display
322 322 */
323 323 refresh(): dojo.Deferred<any>;
324 324
325 325 /**
326 326 * Destroy all the widgets inside the ContentPane and empty containerNode
327 327 */
328 328 destroyDescendants(preserveDom?: boolean): void;
329 329
330 330 /**
331 331 * Event hook, is called after everything is loaded and widgetified
332 332 */
333 333 onLoad(data?: any): void;
334 334
335 335 /**
336 336 * Event hook, is called before old content is cleared
337 337 */
338 338 onUnload(): void;
339 339
340 340 /**
341 341 * Called before download starts.
342 342 */
343 343 onDownloadStart(): string;
344 344
345 345 /**
346 346 * Called on DOM faults, require faults etc. in content.
347 347 * In order to display an error message in the pane, return
348 348 * the error message from this method, as an HTML string.
349 349 * By default (if this method is not overriden), it returns
350 350 * nothing, so the error message is just printed to the console.
351 351 */
352 352 onContentError(error: Error): void;
353 353
354 354 /**
355 355 * Called when download error occurs.
356 356 * In order to display an error message in the pane, return
357 357 * the error message from this method, as an HTML string.
358 358 * Default behavior (if this method is not overriden) is to display
359 359 * the error message inside the pane.
360 360 */
361 361 onDownloadError(error: Error): void;
362 362
363 363 /**
364 364 * Called when download is finished.
365 365 */
366 366 onDownloadEnd(): void;
367 367 }
368 368
369 369 interface ContentPaneConstructor extends _WidgetBaseConstructor<ContentPane> { }
370 370
371 371 /* dijit/layout/_ContentPaneResizeMixin */
372 372
373 373 /* tslint:disable:class-name */
374 374 interface _ContentPaneResizeMixin {
375 375
376 376 /**
377 377 * - false - don't adjust size of children
378 378 * - true - if there is a single visible child widget, set it's size to however big the ContentPane is
379 379 */
380 380 doLayout: boolean;
381 381
382 382 /**
383 383 * Indicates that this widget will call resize() on it's child widgets
384 384 * when they become visible.
385 385 */
386 386 isLayoutContainer: boolean;
387 387
388 388 /**
389 389 * See `dijit/layout/_LayoutWidget.startup()` for description.
390 390 * Although ContentPane doesn't extend _LayoutWidget, it does implement
391 391 * the same API.
392 392 */
393 393 startup(): void;
394 394
395 395 /**
396 396 * See `dijit/layout/_LayoutWidget.resize()` for description.
397 397 * Although ContentPane doesn't extend _LayoutWidget, it does implement
398 398 * the same API.
399 399 */
400 400 resize(changeSize?: dojo.DomGeometryBox, resultSize?: dojo.DomGeometryWidthHeight): void;
401 401 }
402 402
403 403 interface _ContentPaneResizeMixinConstructor extends _WidgetBaseConstructor<_ContentPaneResizeMixin> { }
404 404
405 405 /* dijit/layout/LinkPane */
406 406
407 407 interface LinkPane extends ContentPane, _TemplatedMixin {
408 408 /**
409 409 * A ContentPane with an href where (when declared in markup) the
410 410 * title is specified as innerHTML rather than as a title attribute.
411 411 */
412 412 }
413 413
414 414 interface LinkPaneConstructor extends _WidgetBaseConstructor<LinkPane> { }
415 415
416 416 /* dijit/layout/ScrollingTabController */
417 417
418 418 interface ScrollingTabController extends TabController, _WidgetsInTemplateMixin {
419 419 /**
420 420 * True if a menu should be used to select tabs when they are too
421 421 * wide to fit the TabContainer, false otherwise.
422 422 */
423 423 useMenu: boolean;
424 424
425 425 /**
426 426 * True if a slider should be used to select tabs when they are too
427 427 * wide to fit the TabContainer, false otherwise.
428 428 */
429 429 useSlider: boolean;
430 430
431 431 /**
432 432 * The css class to apply to the tab strip, if it is visible.
433 433 */
434 434 tabStripClass: string;
435 435
436 436 /**
437 437 * Creates an Animation object that smoothly scrolls the tab list
438 438 * either to a fixed horizontal pixel value, or to the selected tab.
439 439 */
440 440 createSmoothScroll(pixels?: number): dojo._base.Animation;
441 441
442 442 /**
443 443 * Scrolls the menu to the right.
444 444 */
445 445 doSlideRight(e: MouseEvent): void;
446 446
447 447 /**
448 448 * Scrolls the menu to the left.
449 449 */
450 450 doSlideLeft(e: MouseEvent): void;
451 451
452 452 /**
453 453 * Scrolls the tab list to the left or right by 75% of the widget
454 454 * width.
455 455 */
456 456 doSlide(direction: number, node: HTMLElement): void;
457 457 }
458 458
459 459 interface ScrollingTabControllerConstructor extends _WidgetBaseConstructor<ScrollingTabController> { }
460 460
461 461 /* dijit/layout/StackContainer */
462 462
463 463 interface StackContainer extends _LayoutWidget {
464 464 /**
465 465 * If true, change the size of my currently displayed child to match my size.
466 466 */
467 467 doLayout: boolean;
468 468
469 469 /**
470 470 * Remembers the selected child across sessions.
471 471 */
472 472 persist: boolean;
473 473
474 474 /**
475 475 * References the currently selected child widget, if any.
476 476 * Adjust selected child with selectChild() method.
477 477 */
478 478 selectedChildWidget: _Widget;
479 479
480 480 selectChild<T extends _WidgetBase>(page: T | string, animate: boolean): dojo.promise.Promise<any>;
481 481
482 482 forward(): dojo.promise.Promise<any>;
483 483
484 484 back(): dojo.promise.Promise<any>;
485 485
486 486 closeChild<T extends _WidgetBase>(page: T): void;
487 487
488 488 /**
489 489 * Destroy all the widgets inside the StackContainer and empty containerNode
490 490 */
491 491 destroyDescendants(preserveDom?: boolean): void;
492 492 }
493 493
494 494 interface StackContainerConstructor extends _WidgetBaseConstructor<StackContainer> { }
495 495
496 496 interface StackContainerChildWidget extends _WidgetBase {
497 497 /**
498 498 * Specifies that this widget should be the initially displayed pane.
499 499 * Note: to change the selected child use `dijit/layout/StackContainer.selectChild`
500 500 */
501 501 selected: boolean;
502 502
503 503 /**
504 504 * Specifies that the button to select this pane should be disabled.
505 505 * Doesn't affect programmatic selection of the pane, nor does it deselect the pane if it is currently selected.
506 506 */
507 507 disabled: boolean;
508 508
509 509 /**
510 510 * True if user can close (destroy) this child, such as (for example) clicking the X on the tab.
511 511 */
512 512 closable: boolean;
513 513
514 514 /**
515 515 * CSS class specifying icon to use in label associated with this pane.
516 516 */
517 517 iconClass: string;
518 518
519 519 /**
520 520 * When true, display title of this widget as tab label etc., rather than just using
521 521 * icon specified in iconClass.
522 522 */
523 523 showTitle: boolean;
524 524 }
525 525
526 526 /* dijit/layout/StackController */
527 527
528 528 interface _StackButton extends dijit.form.ToggleButton {
529 529 /**
530 530 * When true, display close button for this tab.
531 531 */
532 532 closeButton: boolean;
533 533 }
534 534
535 535 interface _StackButtonConstructor extends _WidgetBaseConstructor<_StackButton> { }
536 536
537 537 interface StackControllerBase extends _Widget, _TemplatedMixin, _Container {
538 538
539 539 /**
540 540 * The id of the page container I point to.
541 541 */
542 542 containerId: string;
543 543
544 544 /**
545 545 * CSS class of [x] close icon used by event delegation code to tell when
546 546 * the close button was clicked.
547 547 */
548 548 buttonWidgetCloseClass: string;
549 549
550 550 /**
551 551 * Returns the button corresponding to the pane with the given id.
552 552 */
553 553 pane2button<T extends _WidgetBase>(id: string): T;
554 554
555 555 /**
556 556 * Called after the StackContainer has finished initializing.
557 557 */
558 558 onStartup(info: Object): void;
559 559
560 560 /**
561 561 * Called whenever a page is added to the container. Create button
562 562 * corresponding to the page.
563 563 */
564 564 onAddChild<T extends _WidgetBase>(page: T, insertIndex?: number): void;
565 565
566 566 /**
567 567 * Called whenever a page is removed from the container. Remove the
568 568 * button corresponding to the page.
569 569 */
570 570 onRemoveChild<T extends _WidgetBase>(page: T): void;
571 571
572 572 /**
573 573 * Called when a page has been selected in the StackContainer, either
574 574 * by me or by another StackController.
575 575 */
576 576 onSelectChild<T extends _WidgetBase>(page: T): void;
577 577
578 578 /**
579 579 * Called whenever one of my child buttons is pressed in an attempt to
580 580 * select a page.
581 581 */
582 582 onButtonClick<T extends _WidgetBase>(page: T): void;
583 583
584 584 /**
585 585 * Called whenever one of my child buttons [X] is pressed in an attempt
586 586 * to close a page.
587 587 */
588 588 onCloseButtonClick<T extends _WidgetBase>(page: T): void;
589 589
590 590 /**
591 591 * Helper for onkeydown to find next/previous button.
592 592 */
593 593 adjacent(forward: boolean): _WidgetBase;
594 594
595 595 /**
596 596 * Handle keystrokes on the page list, for advancing to next/previous
597 597 * button and closing the page in the page is closable.
598 598 */
599 599 onkeydown(e: Event, fromContainer?: boolean): void;
600 600
601 601 /**
602 602 * Called when there was a keydown on the container.
603 603 */
604 604 onContainerKeyDown(info: Object): void;
605 605 }
606 606
607 607 interface StackController extends StackControllerBase {
608 608 /**
609 609 * The button widget to create to correspond to each page.
610 610 */
611 611 buttonWidget: _StackButtonConstructor;
612 612 }
613 613
614 614 interface StackControllerConstructor extends _WidgetBaseConstructor<StackController> { }
615 615
616 616 /* dijit/layout/TabContainer */
617 617
618 618 interface TabContainer extends _TabContainerBase {
619 619
620 620 /**
621 621 * True if a menu should be used to select tabs when they are too
622 622 * wide to fit the TabContainer, false otherwise.
623 623 */
624 624 useMenu: boolean;
625 625
626 626 /**
627 627 * True if a slider should be used to select tabs when they are too
628 628 * wide to fit the TabContainer, false otherwise.
629 629 */
630 630 useSlider: boolean;
631 631
632 632 /**
633 633 * An optional parameter to override the widget used to display the tab labels.
634 634 */
635 635 controllerWidget: string;
636 636 }
637 637
638 638 interface TabContainerConstructor extends _WidgetBaseConstructor<TabContainer> { }
639 639
640 640 /* dijit/layout/TabController */
641 641
642 642 interface _TabButton extends _StackButton { }
643 643
644 644 interface _TabButtonConstructor extends _WidgetBaseConstructor<_TabButton> { }
645 645
646 646 interface TabController extends StackControllerBase {
647 647 /**
648 648 * Defines where tabs go relative to the content.
649 649 * "top", "bottom", "left-h", "right-h"
650 650 */
651 651 tabPosition: string;
652 652 // tabPosition: 'top' | 'bottom' | 'left-h' | 'right-h';
653 653
654 654 /**
655 655 * The tab widget to create to correspond to each page.
656 656 */
657 657 buttonWidget: _TabButtonConstructor;
658 658
659 659 /**
660 660 * Class of [x] close icon, used by event delegation code to tell
661 661 * when close button was clicked.
662 662 */
663 663 buttonWidgetCloseClass: string;
664 664 }
665 665
666 666 interface TabControllerConstructor extends _WidgetBaseConstructor<TabController> {
667 667 TabButton: _TabButton;
668 668 }
669 669 }
670 670 }
@@ -1,487 +1,487
1 1 /// <reference path="index.d.ts" />
2 2
3 3 declare module 'dijit/_Widget' {
4 4 type _Widget = dijit._Widget;
5 5 const _Widget: dijit._WidgetBaseConstructor<_Widget>;
6 6 export = _Widget;
7 7 }
8 8
9 9 declare module 'dijit/_WidgetBase' {
10 10 type _WidgetBase<E extends { [k in keyof E]: Event } = {}> = dijit._WidgetBase<E & GlobalEventHandlersEventMap>;
11 11
12 12 // individual _WidgetBase constructor to keep type parameters
13 13 interface _WidgetBaseConstructor {
14 14 new <A = {}, E extends { [k in keyof E]: Event } = {}>(params?: Partial<_WidgetBase<E> & A>, srcNodeRef?: dojo.NodeOrString): _WidgetBase<E> & dojo._base.DeclareCreatedObject;
15 15 prototype: _WidgetBase<any>;
16 16 }
17 17 const _WidgetBase: _WidgetBaseConstructor;
18 18 export = _WidgetBase;
19 19 }
20 20
21 21 declare module 'dijit/_AttachMixin' {
22 22 type _AttachMixin = dijit._AttachMixin;
23 23 const _AttachMixin: dijit._AttachMixinConstructor;
24 24 export = _AttachMixin;
25 25 }
26 26
27 27 declare module 'dijit/_CssStateMixin' {
28 28 type _CssStateMixin = dijit._CssStateMixin;
29 29 const _CssStateMixin: dijit._CssStateMixinConstructor;
30 30 export = _CssStateMixin;
31 31 }
32 32
33 33 declare module 'dijit/_Contained' {
34 34 type _Contained = dijit._Contained;
35 35 const _Contained: dijit._ContainedConstructor;
36 36 export = _Contained;
37 37 }
38 38
39 39 declare module 'dijit/_Container' {
40 40 type _Container = dijit._Container;
41 41 const _Container: dijit._ContainerConstructor;
42 42 export = _Container;
43 43 }
44 44
45 45 declare module 'dijit/_KeyNavContainer' {
46 46 type _KeyNavContainer = dijit._KeyNavContainer;
47 47 const _KeyNavContainer: dijit._KeyNavContainerConstructor;
48 48 export = _KeyNavContainer;
49 49 }
50 50
51 51 declare module 'dijit/_KeyNavMixin' {
52 52 type _KeyNavMixin = dijit._KeyNavMixin;
53 53 const _KeyNavMixin: dijit._KeyNavMixinConstructor;
54 54 export = _KeyNavMixin;
55 55 }
56 56
57 57 declare module 'dijit/_MenuBase' {
58 58 type _MenuBase = dijit._MenuBase;
59 59 const _MenuBase: dijit._MenuBaseConstructor;
60 60 export = _MenuBase;
61 61 }
62 62
63 63 declare module 'dijit/_TemplatedMixin' {
64 64 type _TemplatedMixin = dijit._TemplatedMixin;
65 65 const _TemplatedMixin: dijit._TemplatedMixinConstructor;
66 66 export = _TemplatedMixin;
67 67 }
68 68
69 69 declare module 'dijit/_WidgetsInTemplateMixin' {
70 70 type _WidgetsInTemplateMixin = dijit._WidgetsInTemplateMixin;
71 71 const _WidgetsInTemplateMixin: dijit._WidgetsInTemplateMixinConstructor;
72 72 export = _WidgetsInTemplateMixin;
73 73 }
74 74
75 75 declare module 'dijit/ConfirmDialog' {
76 76 type ConfirmDialog = dijit.ConfirmDialog;
77 77 const ConfirmDialog: dijit.ConfirmDialogConstructor;
78 78 export = ConfirmDialog;
79 79 }
80 80
81 81 declare module 'dijit/Calendar' {
82 82 type Calendar = dijit.Calendar;
83 83 const Calendar: dijit.CalendarConstructor;
84 84 export = Calendar;
85 85 }
86 86
87 87 declare module 'dijit/CalendarLite' {
88 88 type CalendarLite = dijit.CalendarLite;
89 89 const CalendarLite: dijit.CalendarLiteConstructor;
90 90 export = CalendarLite;
91 91 }
92 92
93 93 declare module 'dijit/Destroyable' {
94 94 type Destroyable = dijit.Destroyable;
95 95 const Destroyable: dijit.DestroyableConstructor;
96 96 export = Destroyable;
97 97 }
98 98
99 99 declare module 'dijit/Dialog' {
100 100 type Dialog = dijit.Dialog;
101 101 const Dialog: dijit.DialogConstructor;
102 102 export = Dialog;
103 103 }
104 104
105 105 declare module 'dijit/DropDownMenu' {
106 106 type DropDownMenu = dijit.DropDownMenu;
107 107 const DropDownMenu: dijit.DropDownMenuConstructor;
108 108 export = DropDownMenu;
109 109 }
110 110
111 111 declare module 'dijit/Fieldset' {
112 112 type Fieldset = dijit.Fieldset;
113 113 const Fieldset: dijit.FieldsetConstructor;
114 114 export = Fieldset;
115 115 }
116 116
117 117 declare module 'dijit/Menu' {
118 118 type Menu = dijit.Menu;
119 119 const Menu: dijit.MenuConstructor;
120 120 export = Menu;
121 121 }
122 122
123 123 declare module 'dijit/MenuBar' {
124 124 type MenuBar = dijit.MenuBar;
125 125 const MenuBar: dijit.MenuBarConstructor;
126 126 export = MenuBar;
127 127 }
128 128
129 129 declare module 'dijit/MenuBarItem' {
130 130 type MenuBarItem = dijit.MenuBarItem;
131 131 const MenuBarItem: dijit.MenuBarItemConstructor;
132 132 export = MenuBarItem;
133 133 }
134 134
135 135 declare module 'dijit/MenuItem' {
136 136 type MenuItem = dijit.MenuItem;
137 137 const MenuItem: dijit.MenuItemConstructor;
138 138 export = MenuItem;
139 139 }
140 140
141 141 declare module 'dijit/MenuSeparator' {
142 142 type MenuSeparator = dijit.MenuSeparator;
143 143 const MenuSeparator: dijit.MenuSeparatorConstructor;
144 144 export = MenuSeparator;
145 145 }
146 146
147 147 declare module 'dijit/place' {
148 148 const place: dijit.Place;
149 149 export = place;
150 150 }
151 151
152 152 declare module 'dijit/popup' {
153 153 const popup: dijit.PopupManager;
154 154 export = popup;
155 155 }
156 156
157 157 declare module 'dijit/PopupMenuBarItem' {
158 158 type PopupMenuBarItem = dijit.PopupMenuBarItem;
159 159 const PopupMenuBarItem: dijit.PopupMenuBarItemConstructor;
160 160 export = PopupMenuBarItem;
161 161 }
162 162
163 163 declare module 'dijit/PopupMenuItem' {
164 164 type PopupMenuItem = dijit.PopupMenuItem;
165 165 const PopupMenuItem: dijit.PopupMenuItemConstructor;
166 166 export = PopupMenuItem;
167 167 }
168 168
169 169 declare module 'dijit/registry' {
170 170 const registry: dijit.Registry;
171 171 export = registry;
172 172 }
173 173
174 174 declare module 'dijit/TitlePane' {
175 175 type TitlePane = dijit.TitlePane;
176 176 const TitlePane: dijit.TitlePaneConstructor;
177 177 export = TitlePane;
178 178 }
179 179
180 180 declare module 'dijit/Toolbar' {
181 181 type Toolbar = dijit.Toolbar;
182 182 const Toolbar: dijit.ToolbarConstructor;
183 183 export = Toolbar;
184 184 }
185 185
186 186 declare module 'dijit/ToolbarSeparator' {
187 187 type ToolbarSeparator = dijit.ToolbarSeparator;
188 188 const ToolbarSeparator: dijit.ToolbarSeparatorConstructor;
189 189 export = ToolbarSeparator;
190 190 }
191 191
192 192 declare module 'dijit/Tooltip' {
193 193 type Tooltip = dijit.Tooltip;
194 194 const Tooltip: dijit.TooltipConstructor;
195 195 export = Tooltip;
196 196 }
197 197
198 198 declare module 'dijit/TooltipDialog' {
199 199 type TooltipDialog = dijit.TooltipDialog;
200 200 const TooltipDialog: dijit.TooltipDialogConstructor;
201 201 export = TooltipDialog;
202 202 }
203 203
204 204 declare module 'dijit/_base/focus' {
205 205 const focus: dijit._base.Focus;
206 206 export = focus;
207 207 }
208 208
209 209 declare module 'dijit/_base/manager' {
210 210 const manager: dijit._base.Manager;
211 211 export = manager;
212 212 }
213 213
214 214 declare module 'dijit/_base/place' {
215 215 const place: dijit._base.Place;
216 216 export = place;
217 217 }
218 218
219 219 declare module 'dijit/_base/popup' {
220 220 const popup: dijit._base.Popup;
221 221 export = popup;
222 222 }
223 223
224 224 declare module 'dijit/_base/scroll' {
225 225 const scroll: dijit._base.Scroll;
226 226 export = scroll;
227 227 }
228 228
229 229 declare module 'dijit/_base/sniff' {
230 230 const sniff: dijit._base.Sniff;
231 231 export = sniff;
232 232 }
233 233
234 234 declare module 'dijit/_base/typematic' {
235 235 const typematic: dijit._base.Typematic;
236 236 export = typematic;
237 237 }
238 238
239 239 declare module 'dijit/_base/wai' {
240 240 const wai: dijit._base.Wai;
241 241 export = wai;
242 242 }
243 243
244 244 declare module 'dijit/_base/window' {
245 245 const window: dijit._base.Window;
246 246 export = window;
247 247 }
248 248
249 249 declare module 'dijit/form/_FormMixin' {
250 250 type _FormMixin = dijit.form._FormMixin;
251 251 const _FormMixin: dijit.form._FormMixinConstructor;
252 252 export = _FormMixin;
253 253 }
254 254
255 255 declare module 'dijit/form/_FormValueWidget' {
256 256 type _FormValueWidget = dijit.form._FormValueWidget;
257 257 const _FormValueWidget: dijit.form._FormValueWidgetConstructor;
258 258 export = _FormValueWidget;
259 259 }
260 260
261 261 declare module 'dijit/form/_FormWidget' {
262 262 type _FormWidget = dijit.form._FormWidget;
263 263 const _FormWidget: dijit.form._FormWidgetConstructor;
264 264 export = _FormWidget;
265 265 }
266 266
267 267 declare module 'dijit/form/Button' {
268 268 type Button = dijit.form.Button;
269 269 const Button: dijit.form.ButtonConstructor;
270 270 export = Button;
271 271 }
272 272
273 273 declare module 'dijit/form/CheckBox' {
274 274 type CheckBox = dijit.form.CheckBox;
275 275 const CheckBox: dijit.form.CheckBoxConstructor;
276 276 export = CheckBox;
277 277 }
278 278
279 279 declare module 'dijit/form/ComboBox' {
280 280 type ComboBox = dijit.form.TextBox;
281 281 const ComboBox: dijit.form.ComboBoxConstructor;
282 282 export = ComboBox;
283 283 }
284 284
285 285 declare module 'dijit/form/ComboBoxMixin' {
286 type ComboBoxMixin<T, U extends dojo.store.api.BaseQueryType, V> = dijit.form.ComboBoxMixin<T, U, V>;
286 type ComboBoxMixin<T = any, U extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, V = any> = dijit.form.ComboBoxMixin<T, U, V>;
287 287 const ComboBoxMixin: dijit.form.ComboBoxConstructor;
288 288 export = ComboBoxMixin;
289 289 }
290 290
291 291 declare module 'dijit/form/CurrencyTextBox' {
292 292 type CurrencyTextBox = dijit.form.CurrencyTextBox;
293 293 const CurrencyTextBox: dijit.form.CurrencyTextBoxConstructor;
294 294 export = CurrencyTextBox;
295 295 }
296 296
297 297 declare module 'dijit/form/DataList' {
298 298 type DataList<T> = dijit.form.DataList<T>;
299 299 const DataList: dijit.form.DataListConstructor;
300 300 export = DataList;
301 301 }
302 302
303 303 declare module 'dijit/form/DateTextBox' {
304 304 type DateTextBox = dijit.form.DateTextBox;
305 305 const DateTextBox: dijit.form.DateTextBoxConstructor;
306 306 export = DateTextBox;
307 307 }
308 308
309 309 declare module 'dijit/form/DropDownButton' {
310 310 type DropDownButton<T extends dijit._WidgetBase> = dijit.form.DropDownButton<T>;
311 311 const DropDownButton: dijit.form.DropDownButtonConstructor;
312 312 export = DropDownButton;
313 313 }
314 314
315 315 declare module 'dijit/form/FilteringSelect' {
316 316 type FilteringSelect<C extends dijit.form.Constraints, T extends Object, Q extends string | Object | Function, O extends dojo.store.api.QueryOptions> = dijit.form.FilteringSelect<C, T, Q, O>;
317 317 const FilteringSelect: dijit.form.FilteringSelectConstructor;
318 318 export = FilteringSelect;
319 319 }
320 320
321 321 declare module 'dijit/form/Form' {
322 322 type Form = dijit.form.Form;
323 323 const Form: dijit.form.FormConstructor;
324 324 export = Form;
325 325 }
326 326
327 327 declare module 'dijit/form/HorizontalRule' {
328 328 type HorizontalRule = dijit.form.HorizontalRule;
329 329 const HorizontalRule: dijit.form.HorizontalRuleConstructor;
330 330 export = HorizontalRule;
331 331 }
332 332
333 333 declare module 'dijit/form/HorizontalRuleLabels' {
334 334 type HorizontalRuleLabels = dijit.form.HorizontalRuleLabels;
335 335 const HorizontalRuleLabels: dijit.form.HorizontalRuleLabelsConstructor;
336 336 export = HorizontalRuleLabels;
337 337 }
338 338
339 339 declare module 'dijit/form/HorizontalSlider' {
340 340 type HorizontalSlider = dijit.form.HorizontalSlider;
341 341 const HorizontalSlider: dijit.form.HorizontalSliderConstructor;
342 342 export = HorizontalSlider;
343 343 }
344 344
345 345 declare module 'dijit/form/MappedTextBox' {
346 type MappedTextBox<C extends dijit.form.Constraints> = dijit.form.MappedTextBox<C>;
346 type MappedTextBox<C extends dijit.form.Constraints = dijit.form.Constraints> = dijit.form.MappedTextBox<C>;
347 347 const MappedTextBox: dijit.form.MappedTextBoxConstructor;
348 348 export = MappedTextBox;
349 349 }
350 350
351 351 declare module 'dijit/form/NumberSpinner' {
352 352 type NumberSpinner = dijit.form.NumberSpinner;
353 353 const NumberSpinner: dijit.form.NumberSpinnerConstructor;
354 354 export = NumberSpinner;
355 355 }
356 356
357 357 declare module 'dijit/form/NumberTextBox' {
358 358 type NumberTextBox = dijit.form.NumberTextBox;
359 359 const NumberTextBox: dijit.form.NumberTextBoxConstructor;
360 360 export = NumberTextBox;
361 361 }
362 362
363 363 declare module 'dijit/form/RadioButton' {
364 364 type RadioButton = dijit.form.RadioButton;
365 365 const RadioButton: dijit.form.RadioButtonConstructor;
366 366 export = RadioButton;
367 367 }
368 368
369 369 declare module 'dijit/form/RangeBoundTextBox' {
370 370 type RangeBoundTextBox = dijit.form.RangeBoundTextBox;
371 371 const RangeBoundTextBox: dijit.form.RangeBoundTextBoxConstructor;
372 372 export = RangeBoundTextBox;
373 373 }
374 374
375 375 declare module 'dijit/form/Select' {
376 type Select<T, Q extends dojo.store.api.BaseQueryType, O, U extends dijit._WidgetBase> = dijit.form.Select<T, Q, O, U>;
376 type Select<T, Q extends dojo.store.api.BaseQueryType = dojo.store.api.BaseQueryType, O = any, U extends dijit._WidgetBase = dijit._WidgetBase> = dijit.form.Select<T, Q, O, U>;
377 377 const Select: dijit.form.SelectConstructor;
378 378 export = Select;
379 379 }
380 380
381 381 declare module 'dijit/form/SimpleTextarea' {
382 382 type SimpleTextarea = dijit.form.SimpleTextarea;
383 383 const SimpleTextarea: dijit.form.SimpleTextareaConstructor;
384 384 export = SimpleTextarea;
385 385 }
386 386
387 387 declare module 'dijit/form/Textarea' {
388 388 type Textarea = dijit.form.Textarea;
389 389 const Textarea: dijit.form.TextareaConstructor;
390 390 export = Textarea;
391 391 }
392 392
393 393 declare module 'dijit/form/TextBox' {
394 394 type TextBox = dijit.form.TextBox;
395 395 const TextBox: dijit.form.TextBoxConstructor;
396 396 export = TextBox;
397 397 }
398 398
399 399 declare module 'dijit/form/ToggleButton' {
400 400 type ToggleButton = dijit.form.ToggleButton;
401 401 const ToggleButton: dijit.form.ToggleButtonConstructor;
402 402 export = ToggleButton;
403 403 }
404 404
405 405 declare module 'dijit/form/ValidationTextBox' {
406 type ValidationTextBox<C extends dijit.form.Constraints> = dijit.form.ValidationTextBox<C>;
406 type ValidationTextBox<C extends dijit.form.Constraints = dijit.form.Constraints> = dijit.form.ValidationTextBox<C>;
407 407 const ValidationTextBox: dijit.form.ValidationTextBoxConstructor;
408 408 export = ValidationTextBox;
409 409 }
410 410
411 411 declare module 'dijit/layout/_LayoutWidget' {
412 412 type _LayoutWidget = dijit.layout._LayoutWidget;
413 413 const _LayoutWidget: dijit.layout._LayoutWidgetConstructor;
414 414 export = _LayoutWidget;
415 415 }
416 416
417 417 declare module 'dijit/layout/AccordionContainer' {
418 418 type AccordionContainer = dijit.layout.AccordionContainer;
419 419 const AccordionContainer: dijit.layout.AccordionContainerConstructor;
420 420 export = AccordionContainer;
421 421 }
422 422
423 423 declare module 'dijit/layout/AccordionPane' {
424 424 type AccordionPane = dijit.layout.AccordionPane;
425 425 const AccordionPane: dijit.layout.AccordionPaneConstructor;
426 426 export = AccordionPane;
427 427 }
428 428
429 429 declare module 'dijit/layout/ContentPane' {
430 430 type ContentPane = dijit.layout.ContentPane;
431 431 const ContentPane: dijit.layout.ContentPaneConstructor;
432 432 export = ContentPane;
433 433 }
434 434
435 435 declare module 'dijit/layout/_ContentPaneResizeMixin' {
436 436 type _ContentPaneResizeMixin = dijit.layout._ContentPaneResizeMixin;
437 437 const _ContentPaneResizeMixin: dijit.layout._ContentPaneResizeMixinConstructor;
438 438 export = _ContentPaneResizeMixin;
439 439 }
440 440
441 441 declare module 'dijit/layout/BorderContainer' {
442 442 type BorderContainer = dijit.layout.BorderContainer;
443 443 const BorderContainer: dijit.layout.BorderContainerConstructor;
444 444 export = BorderContainer;
445 445 }
446 446
447 447 declare module 'dijit/layout/LayoutContainer' {
448 448 type LayoutContainer = dijit.layout.LayoutContainer;
449 449 const LayoutContainer: dijit.layout.LayoutContainerConstructor;
450 450 export = LayoutContainer;
451 451 }
452 452
453 453 declare module 'dijit/layout/LinkPane' {
454 454 type LinkPane = dijit.layout.LinkPane;
455 455 const LinkPane: dijit.layout.LinkPaneConstructor;
456 456 export = LinkPane;
457 457 }
458 458
459 459 declare module 'dijit/layout/ScrollingTabController' {
460 460 type ScrollingTabController = dijit.layout.ScrollingTabController;
461 461 const ScrollingTabController: dijit.layout.ScrollingTabControllerConstructor;
462 462 export = ScrollingTabController;
463 463 }
464 464
465 465 declare module 'dijit/layout/StackContainer' {
466 466 type StackContainer = dijit.layout.StackContainer;
467 467 const StackContainer: dijit.layout.StackContainerConstructor;
468 468 export = StackContainer;
469 469 }
470 470
471 471 declare module 'dijit/layout/StackController' {
472 472 type StackController = dijit.layout.StackController;
473 473 const StackController: dijit.layout.StackControllerConstructor;
474 474 export = StackController;
475 475 }
476 476
477 477 declare module 'dijit/layout/TabContainer' {
478 478 type TabContainer = dijit.layout.TabContainer;
479 479 const TabContainer: dijit.layout.TabContainerConstructor;
480 480 export = TabContainer;
481 481 }
482 482
483 483 declare module 'dijit/layout/TabController' {
484 484 type TabController = dijit.layout.TabController;
485 485 const TabController: dijit.layout.TabControllerConstructor;
486 486 export = TabController;
487 487 }
@@ -1,41 +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 declare class ScheduleWidget extends _WidgetBase<ScheduleWidgetAttrs, ScheduleWidgetEvents> {
17 class ScheduleWidget extends _WidgetBase<ScheduleWidgetAttrs, ScheduleWidgetEvents> {
18 18 data: string[];
19
20 _onClick() {
21 this.set("data", "", "");
22
23 const t = this.get("title");
24 this.set({
25 data: ["",""]
26 });
27 }
28
29 render(){
30 watch(this, "title", v => String(v) );
31 }
19 32 }
20 33
21 34 const w = new ScheduleWidget({title: "Year schedule", data: ["a", "b"] });
22 35
23 36 w.get("data");
24 37
38 w.set("data", "a","b");
39 w.set({
40 data: ["a", "b"]
41 });
42
25 43 w.watch((p, o, n) => [p,o,n]);
26 44
27 45 w.watch("data", (p, o, n) => [p,o,n]);
28 46
29 47 watch(w, "title", v => String(v) );
30 48 watch(w, "data", v => String(v) );
31 49
32 50 w.emit("scheduled", { detail: { startDate: new Date(), endDate: new Date()} });
33 51
34 52 w.emit("click", {} );
35 53
36 54 w.emit("click", {} );
37 55
38 56 w.emit("some-extra-event", {});
39 57
40 58 w.on("click", e => e);
41 59 w.on("some-extra-event", e => e);
General Comments 0
You need to be logged in to leave comments. Login now