]>
git.wh0rd.org - tt-rss.git/blob - 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
7 ], function(declare
, keys
, lang
, _TimePicker
, _DateTimeTextBox
){
10 var _TimePicker = dijit._TimePicker;
11 var _DateTimeTextBox = dijit.form._DateTimeTextBox;
15 // dijit/form/TimeTextBox
17 // A validating, serializable, range-bound time text box with a drop down time picker
22 "dijit.form.TimeTextBox.__Constraints",
23 [dijit.form._DateTimeTextBox.__Constraints, dijit._TimePicker.__Constraints]
27 return declare("dijit.form.TimeTextBox", _DateTimeTextBox
, {
29 // A validating, serializable, range-bound time text box with a drop down time picker
31 baseClass
: "dijitTextBox dijitComboBox dijitTimeTextBox",
32 popupClass
: _TimePicker
,
36 // constraints: dijit.form.TimeTextBox.__Constraints
41 // The value of this widget as a JavaScript Date object. Note that the date portion implies time zone and daylight savings rules.
44 // | new dijit.form.TimeTextBox({value: stamp.fromISOString("T12:59:59", new Date())})
46 // When passed to the parser in markup, must be specified according to locale-independent
47 // `stamp.fromISOString` format.
50 // | <input data-dojo-type='dijit.form.TimeTextBox' value='T12:34:00'>
51 value
: new Date(""), // value.toString()="NaN"
52 //FIXME: in markup, you have no control over daylight savings
54 _onKey: function(evt
){
55 if(this.disabled
|| this.readOnly
){ return; }
56 this.inherited(arguments
);
58 // If the user has backspaced or typed some numbers, then filter the result list
59 // by what they typed. Maybe there's a better way to detect this, like _handleOnChange()?
66 // these keys have special meaning
69 // setTimeout() because the keystroke hasn't yet appeared in the <input>,
70 // so the get('displayedValue') call below won't give the result we want.
71 setTimeout(lang
.hitch(this, function(){
72 // set this.filterString to the filter to apply to the drop down list;
73 // it will be used in openDropDown()
74 var val
= this.get('displayedValue');
75 this.filterString
= (val
&& !this.parse(val
, this.constraints
)) ? val
.toLowerCase() : "";
77 // close the drop down and reopen it, in order to filter the items shown in the list
78 // and also since the drop down may need to be repositioned if the number of list items has changed
79 // and it's being displayed above the <input>