]>
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 // dijit/form/TimeTextBox
14 var __Constraints = declare([_DateTimeTextBox.__Constraints, _TimePicker.__Constraints], {
18 return declare("dijit.form.TimeTextBox", _DateTimeTextBox
, {
20 // A validating, serializable, range-bound time text box with a drop down time picker
22 baseClass
: "dijitTextBox dijitComboBox dijitTimeTextBox",
23 popupClass
: _TimePicker
,
27 // constraints: __Constraints
32 // The value of this widget as a JavaScript Date object. Note that the date portion implies time zone and daylight savings rules.
35 // | new dijit/form/TimeTextBox({value: stamp.fromISOString("T12:59:59", new Date())})
37 // When passed to the parser in markup, must be specified according to locale-independent
38 // `stamp.fromISOString` format.
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
45 _onKey: function(evt
){
46 if(this.disabled
|| this.readOnly
){ return; }
47 this.inherited(arguments
);
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()?
57 // these keys have special meaning
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() : "";
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>