]>
git.wh0rd.org - tt-rss.git/blob - lib/dijit/form/TimeTextBox.js
2 Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
3 Available via Academic Free License >= 2.1 OR the modified BSD license.
4 see: http://dojotoolkit.org/license for details
8 if(!dojo
._hasResource
["dijit.form.TimeTextBox"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
9 dojo
._hasResource
["dijit.form.TimeTextBox"] = true;
10 dojo
.provide("dijit.form.TimeTextBox");
11 dojo
.require("dijit._TimePicker");
12 dojo
.require("dijit.form._DateTimeTextBox");
17 "dijit.form.TimeTextBox.__Constraints",
18 [dijit.form._DateTimeTextBox.__Constraints, dijit._TimePicker.__Constraints]
23 "dijit.form.TimeTextBox",
24 dijit
.form
._DateTimeTextBox
,
27 // A validating, serializable, range-bound time text box with a drop down time picker
29 baseClass
: "dijitTextBox dijitComboBox dijitTimeTextBox",
30 popupClass
: "dijit._TimePicker",
34 // constraints: dijit.form.TimeTextBox.__Constraints
39 // The value of this widget as a JavaScript Date object. Note that the date portion implies time zone and daylight savings rules.
42 // | new dijit.form.TimeTextBox({value: dojo.date.stamp.fromISOString("T12:59:59", new Date())})
44 // When passed to the parser in markup, must be specified according to locale-independent
45 // `dojo.date.stamp.fromISOString` format.
48 // | <input dojotype='dijit.form.TimeTextBox' value='T12:34:00'>
49 value
: new Date(""), // value.toString()="NaN"
50 //FIXME: in markup, you have no control over daylight savings
52 _onKey: function(evt
){
53 this.inherited(arguments
);
55 // If the user has backspaced or typed some numbers, then filter the result list
56 // by what they typed. Maybe there's a better way to detect this, like _handleOnChange()?
60 case dojo
.keys
.ESCAPE
:
61 case dojo
.keys
.DOWN_ARROW
:
62 case dojo
.keys
.UP_ARROW
:
63 // these keys have special meaning
66 // setTimeout() because the keystroke hasn't yet appeared in the <input>,
67 // so the get('displayedValue') call below won't give the result we want.
68 setTimeout(dojo
.hitch(this, function(){
69 // set this.filterString to the filter to apply to the drop down list;
70 // it will be used in openDropDown()
71 var val
= this.get('displayedValue');
72 this.filterString
= (val
&& !this.parse(val
, this.constraints
)) ? val
.toLowerCase() : "";
74 // close the drop down and reopen it, in order to filter the items shown in the list
75 // and also since the drop down may need to be repositioned if the number of list items has changed
76 // and it's being displayed above the <input>