tvheadend/vendor/ext-3.4.1/docs/source/TimeField.html
Adam Sutton bafcfff42d webui: restructure webui/extjs source files
I want to keep the 3rd-party packages away from the main source
where possible.
2013-06-03 17:11:01 +01:00

201 lines
8.3 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The source code</title>
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>
<style type="text/css">
.highlight { display: block; background-color: #ddd; }
</style>
<script type="text/javascript">
function highlight() {
document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
}
</script>
</head>
<body onload="prettyPrint(); highlight();">
<pre class="prettyprint lang-js"><span id='Ext-form-TimeField-method-constructor'><span id='Ext-form-TimeField'>/**
</span></span> * @class Ext.form.TimeField
* @extends Ext.form.ComboBox
* Provides a time input field with a time dropdown and automatic time validation. Example usage:
* &lt;pre&gt;&lt;code&gt;
new Ext.form.TimeField({
minValue: '9:00 AM',
maxValue: '6:00 PM',
increment: 30
});
&lt;/code&gt;&lt;/pre&gt;
* @constructor
* Create a new TimeField
* @param {Object} config
* @xtype timefield
*/
Ext.form.TimeField = Ext.extend(Ext.form.ComboBox, {
<span id='Ext-form-TimeField-cfg-minValue'> /**
</span> * @cfg {Date/String} minValue
* The minimum allowed time. Can be either a Javascript date object with a valid time value or a string
* time in a valid format -- see {@link #format} and {@link #altFormats} (defaults to undefined).
*/
minValue : undefined,
<span id='Ext-form-TimeField-cfg-maxValue'> /**
</span> * @cfg {Date/String} maxValue
* The maximum allowed time. Can be either a Javascript date object with a valid time value or a string
* time in a valid format -- see {@link #format} and {@link #altFormats} (defaults to undefined).
*/
maxValue : undefined,
<span id='Ext-form-TimeField-cfg-minText'> /**
</span> * @cfg {String} minText
* The error text to display when the date in the cell is before minValue (defaults to
* 'The time in this field must be equal to or after {0}').
*/
minText : &quot;The time in this field must be equal to or after {0}&quot;,
<span id='Ext-form-TimeField-cfg-maxText'> /**
</span> * @cfg {String} maxText
* The error text to display when the time is after maxValue (defaults to
* 'The time in this field must be equal to or before {0}').
*/
maxText : &quot;The time in this field must be equal to or before {0}&quot;,
<span id='Ext-form-TimeField-cfg-invalidText'> /**
</span> * @cfg {String} invalidText
* The error text to display when the time in the field is invalid (defaults to
* '{value} is not a valid time').
*/
invalidText : &quot;{0} is not a valid time&quot;,
<span id='Ext-form-TimeField-cfg-format'> /**
</span> * @cfg {String} format
* The default time format string which can be overriden for localization support. The format must be
* valid according to {@link Date#parseDate} (defaults to 'g:i A', e.g., '3:15 PM'). For 24-hour time
* format try 'H:i' instead.
*/
format : &quot;g:i A&quot;,
<span id='Ext-form-TimeField-cfg-altFormats'> /**
</span> * @cfg {String} altFormats
* Multiple date formats separated by &quot;|&quot; to try when parsing a user input value and it doesn't match the defined
* format (defaults to 'g:ia|g:iA|g:i a|g:i A|h:i|g:i|H:i|ga|ha|gA|h a|g a|g A|gi|hi|gia|hia|g|H|gi a|hi a|giA|hiA|gi A|hi A').
*/
altFormats : &quot;g:ia|g:iA|g:i a|g:i A|h:i|g:i|H:i|ga|ha|gA|h a|g a|g A|gi|hi|gia|hia|g|H|gi a|hi a|giA|hiA|gi A|hi A&quot;,
<span id='Ext-form-TimeField-cfg-increment'> /**
</span> * @cfg {Number} increment
* The number of minutes between each time value in the list (defaults to 15).
*/
increment: 15,
<span id='Ext-form-TimeField-cfg-mode'> // private override
</span> mode: 'local',
<span id='Ext-form-TimeField-cfg-triggerAction'> // private override
</span> triggerAction: 'all',
<span id='Ext-form-TimeField-cfg-typeAhead'> // private override
</span> typeAhead: false,
<span id='Ext-form-TimeField-property-initDate'> // private - This is the date to use when generating time values in the absence of either minValue
</span> // or maxValue. Using the current date causes DST issues on DST boundary dates, so this is an
// arbitrary &quot;safe&quot; date that can be any date aside from DST boundary dates.
initDate: '1/1/2008',
<span id='Ext-form-TimeField-property-initDateFormat'> initDateFormat: 'j/n/Y',
</span>
<span id='Ext-form-TimeField-method-initComponent'> // private
</span> initComponent : function(){
if(Ext.isDefined(this.minValue)){
this.setMinValue(this.minValue, true);
}
if(Ext.isDefined(this.maxValue)){
this.setMaxValue(this.maxValue, true);
}
if(!this.store){
this.generateStore(true);
}
Ext.form.TimeField.superclass.initComponent.call(this);
},
<span id='Ext-form-TimeField-method-setMinValue'> /**
</span> * Replaces any existing {@link #minValue} with the new time and refreshes the store.
* @param {Date/String} value The minimum time that can be selected
*/
setMinValue: function(value, /* private */ initial){
this.setLimit(value, true, initial);
return this;
},
<span id='Ext-form-TimeField-method-setMaxValue'> /**
</span> * Replaces any existing {@link #maxValue} with the new time and refreshes the store.
* @param {Date/String} value The maximum time that can be selected
*/
setMaxValue: function(value, /* private */ initial){
this.setLimit(value, false, initial);
return this;
},
<span id='Ext-form-TimeField-method-generateStore'> // private
</span> generateStore: function(initial){
var min = this.minValue || new Date(this.initDate).clearTime(),
max = this.maxValue || new Date(this.initDate).clearTime().add('mi', (24 * 60) - 1),
times = [];
while(min &lt;= max){
times.push(min.dateFormat(this.format));
min = min.add('mi', this.increment);
}
this.bindStore(times, initial);
},
<span id='Ext-form-TimeField-method-setLimit'> // private
</span> setLimit: function(value, isMin, initial){
var d;
if(Ext.isString(value)){
d = this.parseDate(value);
}else if(Ext.isDate(value)){
d = value;
}
if(d){
var val = new Date(this.initDate).clearTime();
val.setHours(d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds());
this[isMin ? 'minValue' : 'maxValue'] = val;
if(!initial){
this.generateStore();
}
}
},
<span id='Ext-form-TimeField-method-getValue'> // inherited docs
</span> getValue : function(){
var v = Ext.form.TimeField.superclass.getValue.call(this);
return this.formatDate(this.parseDate(v)) || '';
},
<span id='Ext-form-TimeField-method-setValue'> // inherited docs
</span> setValue : function(value){
return Ext.form.TimeField.superclass.setValue.call(this, this.formatDate(this.parseDate(value)));
},
<span id='Ext-form-TimeField-property-validateValue'> // private overrides
</span> validateValue : Ext.form.DateField.prototype.validateValue,
<span id='Ext-form-TimeField-property-formatDate'> formatDate : Ext.form.DateField.prototype.formatDate,
</span>
<span id='Ext-form-TimeField-method-parseDate'> parseDate: function(value) {
</span> if (!value || Ext.isDate(value)) {
return value;
}
var id = this.initDate + ' ',
idf = this.initDateFormat + ' ',
v = Date.parseDate(id + value, idf + this.format), // *** handle DST. note: this.format is a TIME-only format
af = this.altFormats;
if (!v &amp;&amp; af) {
if (!this.altFormatsArray) {
this.altFormatsArray = af.split(&quot;|&quot;);
}
for (var i = 0, afa = this.altFormatsArray, len = afa.length; i &lt; len &amp;&amp; !v; i++) {
v = Date.parseDate(id + value, idf + afa[i]);
}
}
return v;
}
});
Ext.reg('timefield', Ext.form.TimeField);</pre>
</body>
</html>