]> git.wh0rd.org Git - tt-rss.git/blob - lib/dijit/form/TimeTextBox.js.uncompressed.js
modify dojo rebuild script to remove uncompressed files
[tt-rss.git] / lib / dijit / form / TimeTextBox.js.uncompressed.js
1 define("dijit/form/TimeTextBox", [
2         "dojo/_base/declare", // declare
3         "dojo/keys", // keys.DOWN_ARROW keys.ENTER keys.ESCAPE keys.TAB keys.UP_ARROW
4         "dojo/_base/lang", // lang.hitch
5         "../_TimePicker",
6         "./_DateTimeTextBox"
7 ], function(declare, keys, lang, _TimePicker, _DateTimeTextBox){
8
9         // module:
10         //              dijit/form/TimeTextBox
11
12
13         /*=====
14         var __Constraints = declare([_DateTimeTextBox.__Constraints, _TimePicker.__Constraints], {
15         });
16         =====*/
17
18         return declare("dijit.form.TimeTextBox", _DateTimeTextBox, {
19                 // summary:
20                 //              A validating, serializable, range-bound time text box with a drop down time picker
21
22                 baseClass: "dijitTextBox dijitComboBox dijitTimeTextBox",
23                 popupClass: _TimePicker,
24                 _selector: "time",
25
26 /*=====
27                 // constraints: __Constraints
28                 constraints:{},
29 =====*/
30
31                 // value: Date
32                 //              The value of this widget as a JavaScript Date object.  Note that the date portion implies time zone and daylight savings rules.
33                 //
34                 //              Example:
35                 // |    new dijit/form/TimeTextBox({value: stamp.fromISOString("T12:59:59", new Date())})
36                 //
37                 //              When passed to the parser in markup, must be specified according to locale-independent
38                 //              `stamp.fromISOString` format.
39                 //
40                 //              Example:
41                 // |    <input data-dojo-type='dijit/form/TimeTextBox' value='T12:34:00'>
42                 value: new Date(""),            // value.toString()="NaN"
43                 //FIXME: in markup, you have no control over daylight savings
44
45                 _onKey: function(evt){
46                         if(this.disabled || this.readOnly){ return; }
47                         this.inherited(arguments);
48
49                         // If the user has backspaced or typed some numbers, then filter the result list
50                         // by what they typed.  Maybe there's a better way to detect this, like _handleOnChange()?
51                         switch(evt.keyCode){
52                                 case keys.ENTER:
53                                 case keys.TAB:
54                                 case keys.ESCAPE:
55                                 case keys.DOWN_ARROW:
56                                 case keys.UP_ARROW:
57                                         // these keys have special meaning
58                                         break;
59                                 default:
60                                         // defer() because the keystroke hasn't yet appeared in the <input>,
61                                         // so the get('displayedValue') call below won't give the result we want.
62                                         this.defer(function(){
63                                                 // set this.filterString to the filter to apply to the drop down list;
64                                                 // it will be used in openDropDown()
65                                                 var val = this.get('displayedValue');
66                                                 this.filterString = (val && !this.parse(val, this.constraints)) ? val.toLowerCase() : "";
67
68                                                 // close the drop down and reopen it, in order to filter the items shown in the list
69                                                 // and also since the drop down may need to be repositioned if the number of list items has changed
70                                                 // and it's being displayed above the <input>
71                                                 if(this._opened){
72                                                         this.closeDropDown();
73                                                 }
74                                                 this.openDropDown();
75                                         });
76                         }
77                 }
78         });
79 });