fixed the resizable text area with IE problem fixed the ad space with IE problem merged the 7.2.0 and 7.1.4 change logs
306 lines
18 KiB
HTML
306 lines
18 KiB
HTML
<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
|
|
<html>
|
|
<head>
|
|
<title>
|
|
Overview
|
|
</title>
|
|
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
|
|
<script>
|
|
function asd() {
|
|
|
|
parent.document.title="DateEditor.js Overview";
|
|
|
|
}
|
|
</script>
|
|
</head>
|
|
<body bgcolor="white" onload="asd();" style="margin:15px;">
|
|
<center>
|
|
|
|
<h2>DateEditor.js</h2>
|
|
|
|
</center>
|
|
|
|
|
|
|
|
|
|
<h4>Summary</h4>
|
|
<p>
|
|
|
|
|
|
|
|
</p>
|
|
|
|
|
|
<table border="1" cellpadding="3" cellspacing="0" width="100%">
|
|
<tr bgcolor="#CCCCFF" class="TableHeadingColor">
|
|
<td colspan="2" class="title-cell">
|
|
|
|
<b>Class Summary</b>
|
|
|
|
</td>
|
|
</tr>
|
|
|
|
<tr bgcolor="white" class="TableRowColor">
|
|
<td width="15%"><b><a href="YAHOO.ext.grid.DateEditor.html">YAHOO.ext.grid.DateEditor</a></b></td>
|
|
<td> </td>
|
|
</tr>
|
|
|
|
</table>
|
|
<hr/>
|
|
|
|
|
|
<!-- ========== METHOD SUMMARY =========== -->
|
|
|
|
<!-- ========== END METHOD SUMMARY =========== -->
|
|
|
|
|
|
<pre class="sourceview">YAHOO.ext.grid.DateEditor = <span class="reserved">function</span>(config){
|
|
var div = document.createElement(<span class="literal">'span'</span>);
|
|
div.className = <span class="literal">'ygrid-editor ygrid-editor-container'</span>;
|
|
|
|
var element = document.createElement(<span class="literal">'input'</span>);
|
|
element.type = <span class="literal">'text'</span>;
|
|
element.tabIndex = 1;
|
|
element.setAttribute(<span class="literal">'autocomplete'</span>, <span class="literal">'off'</span>);
|
|
div.appendChild(element);
|
|
|
|
var pick = document.createElement(<span class="literal">'span'</span>);
|
|
pick.className = <span class="literal">'pick-button'</span>;
|
|
div.appendChild(pick);
|
|
|
|
document.body.appendChild(div);
|
|
|
|
<span class="reserved">this</span>.div = getEl(div, true);
|
|
<span class="reserved">this</span>.element = getEl(element, true);
|
|
<span class="reserved">this</span>.pick = getEl(pick, true);
|
|
|
|
<span class="reserved">this</span>.colIndex = null;
|
|
<span class="reserved">this</span>.rowIndex = null;
|
|
<span class="reserved">this</span>.grid = null;
|
|
<span class="reserved">this</span>.editing = false;
|
|
<span class="reserved">this</span>.originalValue = null;
|
|
<span class="reserved">this</span>.initialized = false;
|
|
<span class="reserved">this</span>.callback = null;
|
|
|
|
<span class="reserved">this</span>.cal = null;
|
|
<span class="reserved">this</span>.mouseDownHandler = YAHOO.ext.EventManager.wrap(<span class="reserved">this</span>.handleMouseDown, <span class="reserved">this</span>, true);
|
|
|
|
YAHOO.ext.util.Config.apply(<span class="reserved">this</span>, config);
|
|
<span class="reserved">if</span>(typeof <span class="reserved">this</span>.minValue == <span class="literal">'string'</span>) <span class="reserved">this</span>.minValue = <span class="reserved">this</span>.parseDate(<span class="reserved">this</span>.minValue);
|
|
<span class="reserved">if</span>(typeof <span class="reserved">this</span>.maxValue == <span class="literal">'string'</span>) <span class="reserved">this</span>.maxValue = <span class="reserved">this</span>.parseDate(<span class="reserved">this</span>.maxValue);
|
|
<span class="reserved">this</span>.ddMatch = /ddnone/;
|
|
<span class="reserved">if</span>(<span class="reserved">this</span>.disabledDates){
|
|
var dd = <span class="reserved">this</span>.disabledDates;
|
|
var re = <span class="literal">"(?:"</span>;
|
|
<span class="reserved">for</span>(var i = 0; i < dd.length; i++){
|
|
re += dd[i];
|
|
<span class="reserved">if</span>(i != dd.length-1) re += <span class="literal">"|"</span>;
|
|
}
|
|
<span class="reserved">this</span>.ddMatch = new RegExp(re + <span class="literal">")"</span>);
|
|
}
|
|
};
|
|
|
|
YAHOO.ext.grid.DateEditor.<span class="reserved">prototype</span> = {
|
|
init : <span class="reserved">function</span>(grid, bodyElement, callback){
|
|
<span class="reserved">if</span>(<span class="reserved">this</span>.initialized) <span class="reserved">return</span>;
|
|
|
|
<span class="reserved">this</span>.initialized = true;
|
|
<span class="reserved">this</span>.callback = callback;
|
|
<span class="reserved">this</span>.grid = grid;
|
|
bodyElement.appendChild(<span class="reserved">this</span>.div.dom);
|
|
<span class="reserved">this</span>.initEvents();
|
|
},
|
|
|
|
initEvents : <span class="reserved">function</span>(){
|
|
var stopOnEnter = <span class="reserved">function</span>(e){
|
|
<span class="reserved">if</span>(e.browserEvent.keyCode == e.RETURN){
|
|
<span class="reserved">this</span>.stopEditing(true);
|
|
}
|
|
}
|
|
<span class="reserved">this</span>.element.mon(<span class="literal">'keydown'</span>, stopOnEnter, <span class="reserved">this</span>, true);
|
|
var vtask = new YAHOO.ext.util.DelayedTask(<span class="reserved">this</span>.validate, <span class="reserved">this</span>);
|
|
<span class="reserved">this</span>.element.mon(<span class="literal">'keyup'</span>, vtask.delay.createDelegate(vtask, [<span class="reserved">this</span>.validationDelay]));
|
|
<span class="reserved">this</span>.pick.on(<span class="literal">'click'</span>, <span class="reserved">this</span>.showCalendar, <span class="reserved">this</span>, true);
|
|
},
|
|
|
|
startEditing : <span class="reserved">function</span>(value, row, cell){
|
|
<span class="reserved">this</span>.originalValue = value;
|
|
<span class="reserved">this</span>.rowIndex = row.rowIndex;
|
|
<span class="reserved">this</span>.colIndex = cell.columnIndex;
|
|
<span class="reserved">this</span>.cell = cell;
|
|
<span class="reserved">this</span>.setValue(value);
|
|
<span class="reserved">this</span>.validate();
|
|
var cellbox = getEl(cell, true).getBox();
|
|
<span class="reserved">this</span>.div.setBox(cellbox, true);
|
|
<span class="reserved">this</span>.element.setWidth(cellbox.width-<span class="reserved">this</span>.pick.getWidth());
|
|
<span class="reserved">this</span>.editing = true;
|
|
YAHOO.util.Event.on(document, <span class="literal">"mousedown"</span>, <span class="reserved">this</span>.mouseDownHandler);
|
|
<span class="reserved">this</span>.show();
|
|
},
|
|
|
|
stopEditing : <span class="reserved">function</span>(focusCell){
|
|
<span class="reserved">if</span>(<span class="reserved">this</span>.editing){
|
|
YAHOO.util.Event.removeListener(document, <span class="literal">"mousedown"</span>, <span class="reserved">this</span>.mouseDownHandler);
|
|
<span class="reserved">this</span>.editing = false;
|
|
var newValue = <span class="reserved">this</span>.getValue();
|
|
<span class="reserved">this</span>.hide();
|
|
<span class="comment">//if(focusCell){try{this.cell.focus();}catch(e){}}// try to give the cell focus so keyboard nav still works</span>
|
|
<span class="reserved">if</span>(<span class="reserved">this</span>.originalValue != newValue){
|
|
<span class="reserved">this</span>.callback(newValue, <span class="reserved">this</span>.rowIndex, <span class="reserved">this</span>.colIndex);
|
|
}
|
|
}
|
|
},
|
|
|
|
setValue : <span class="reserved">function</span>(value){
|
|
<span class="reserved">this</span>.element.dom.value = <span class="reserved">this</span>.formatDate(value);
|
|
<span class="reserved">this</span>.validate();
|
|
},
|
|
|
|
getValue : <span class="reserved">function</span>(){
|
|
<span class="reserved">if</span>(!<span class="reserved">this</span>.validate()){
|
|
<span class="reserved">return</span> <span class="reserved">this</span>.originalValue;
|
|
}<span class="reserved">else</span>{
|
|
var value = <span class="reserved">this</span>.element.dom.value;
|
|
<span class="reserved">if</span>(value.length < 1){
|
|
<span class="reserved">return</span> value;
|
|
} <span class="reserved">else</span>{
|
|
<span class="reserved">return</span> <span class="reserved">this</span>.parseDate(value);
|
|
}
|
|
}
|
|
},
|
|
|
|
show : <span class="reserved">function</span>() {
|
|
<span class="reserved">this</span>.div.show();
|
|
<span class="reserved">this</span>.element.focus();
|
|
<span class="reserved">this</span>.validate();
|
|
},
|
|
|
|
hide : <span class="reserved">function</span>(){
|
|
try{
|
|
<span class="reserved">this</span>.element.dom.blur();
|
|
}catch(e){}
|
|
<span class="reserved">this</span>.div.hide();
|
|
},
|
|
|
|
validate : <span class="reserved">function</span>(){
|
|
var dom = <span class="reserved">this</span>.element.dom;
|
|
var value = dom.value;
|
|
<span class="reserved">if</span>(value.length < 1){ <span class="comment">// if it's blank</span>
|
|
<span class="reserved">if</span>(<span class="reserved">this</span>.allowBlank){
|
|
dom.title = <span class="literal">''</span>;
|
|
<span class="reserved">this</span>.element.removeClass(<span class="literal">'ygrid-editor-invalid'</span>);
|
|
<span class="reserved">return</span> true;
|
|
}<span class="reserved">else</span>{
|
|
dom.title = <span class="reserved">this</span>.blankText;
|
|
<span class="reserved">this</span>.element.addClass(<span class="literal">'ygrid-editor-invalid'</span>);
|
|
<span class="reserved">return</span> false;
|
|
}
|
|
}
|
|
value = <span class="reserved">this</span>.parseDate(value);
|
|
<span class="reserved">if</span>(!value){
|
|
dom.title = <span class="reserved">this</span>.invalidText.replace(<span class="literal">'%0'</span>, dom.value).replace(<span class="literal">'%1'</span>, <span class="reserved">this</span>.format);
|
|
<span class="reserved">this</span>.element.addClass(<span class="literal">'ygrid-editor-invalid'</span>);
|
|
<span class="reserved">return</span> false;
|
|
}
|
|
var time = value.getTime();
|
|
<span class="reserved">if</span>(<span class="reserved">this</span>.minValue && time < <span class="reserved">this</span>.minValue.getTime()){
|
|
dom.title = <span class="reserved">this</span>.minText.replace(<span class="literal">'%0'</span>, <span class="reserved">this</span>.formatDate(<span class="reserved">this</span>.minValue));
|
|
<span class="reserved">this</span>.element.addClass(<span class="literal">'ygrid-editor-invalid'</span>);
|
|
<span class="reserved">return</span> false;
|
|
}
|
|
<span class="reserved">if</span>(<span class="reserved">this</span>.maxValue && time > <span class="reserved">this</span>.maxValue.getTime()){
|
|
dom.title = <span class="reserved">this</span>.maxText.replace(<span class="literal">'%0'</span>, <span class="reserved">this</span>.formatDate(<span class="reserved">this</span>.maxValue));
|
|
<span class="reserved">this</span>.element.addClass(<span class="literal">'ygrid-editor-invalid'</span>);
|
|
<span class="reserved">return</span> false;
|
|
}
|
|
<span class="reserved">if</span>(<span class="reserved">this</span>.disabledDays){
|
|
var day = value.getDay();
|
|
<span class="reserved">for</span>(var i = 0; i < <span class="reserved">this</span>.disabledDays.length; i++) {
|
|
<span class="reserved">if</span>(day === <span class="reserved">this</span>.disabledDays[i]){
|
|
dom.title = <span class="reserved">this</span>.disabledDaysText;
|
|
<span class="reserved">this</span>.element.addClass(<span class="literal">'ygrid-editor-invalid'</span>);
|
|
<span class="reserved">return</span> false;
|
|
}
|
|
}
|
|
}
|
|
var fvalue = <span class="reserved">this</span>.formatDate(value);
|
|
<span class="reserved">if</span>(<span class="reserved">this</span>.ddMatch.test(fvalue)){
|
|
dom.title = <span class="reserved">this</span>.disabledDatesText.replace(<span class="literal">'%0'</span>, fvalue);
|
|
<span class="reserved">this</span>.element.addClass(<span class="literal">'ygrid-editor-invalid'</span>);
|
|
<span class="reserved">return</span> false;
|
|
}
|
|
var msg = <span class="reserved">this</span>.validator(value);
|
|
<span class="reserved">if</span>(msg !== true){
|
|
dom.title = msg;
|
|
<span class="reserved">this</span>.element.addClass(<span class="literal">'ygrid-editor-invalid'</span>);
|
|
<span class="reserved">return</span> false;
|
|
}
|
|
dom.title = <span class="literal">''</span>;
|
|
<span class="reserved">this</span>.element.removeClass(<span class="literal">'ygrid-editor-invalid'</span>);
|
|
<span class="reserved">return</span> true;
|
|
},
|
|
|
|
handleMouseDown : <span class="reserved">function</span>(e){
|
|
var t = e.getTarget();
|
|
var dom = <span class="reserved">this</span>.div.dom;
|
|
<span class="reserved">if</span>(t != dom && !YAHOO.util.Dom.isAncestor(dom, t)){
|
|
<span class="reserved">this</span>.stopEditing();
|
|
}
|
|
},
|
|
|
|
showCalendar : <span class="reserved">function</span>(value){
|
|
<span class="reserved">if</span>(<span class="reserved">this</span>.cal == null){
|
|
<span class="reserved">this</span>.cal = new YAHOO.ext.DatePicker(<span class="reserved">this</span>.div.dom.parentNode.parentNode);
|
|
}
|
|
<span class="reserved">this</span>.cal.minDate = <span class="reserved">this</span>.minValue;
|
|
<span class="reserved">this</span>.cal.maxDate = <span class="reserved">this</span>.maxValue;
|
|
<span class="reserved">this</span>.cal.disabledDatesRE = <span class="reserved">this</span>.ddMatch;
|
|
<span class="reserved">this</span>.cal.disabledDatesText = <span class="reserved">this</span>.disabledDatesText;
|
|
<span class="reserved">this</span>.cal.disabledDays = <span class="reserved">this</span>.disabledDays;
|
|
<span class="reserved">this</span>.cal.disabledDaysText = <span class="reserved">this</span>.disabledDaysText;
|
|
<span class="reserved">this</span>.cal.format = <span class="reserved">this</span>.format;
|
|
<span class="reserved">if</span>(<span class="reserved">this</span>.minValue){
|
|
<span class="reserved">this</span>.cal.minText = <span class="reserved">this</span>.minText.replace(<span class="literal">'%0'</span>, <span class="reserved">this</span>.formatDate(<span class="reserved">this</span>.minValue));
|
|
}
|
|
<span class="reserved">if</span>(<span class="reserved">this</span>.maxValue){
|
|
<span class="reserved">this</span>.cal.maxText = <span class="reserved">this</span>.maxText.replace(<span class="literal">'%0'</span>, <span class="reserved">this</span>.formatDate(<span class="reserved">this</span>.maxValue));
|
|
}
|
|
var r = <span class="reserved">this</span>.div.getRegion();
|
|
<span class="reserved">this</span>.cal.show(r.left, r.bottom, <span class="reserved">this</span>.getValue(), <span class="reserved">this</span>.setValue.createDelegate(<span class="reserved">this</span>));
|
|
},
|
|
|
|
parseDate : <span class="reserved">function</span>(value){
|
|
<span class="reserved">if</span>(!value || value instanceof Date) <span class="reserved">return</span> value;
|
|
<span class="reserved">return</span> Date.parseDate(value, <span class="reserved">this</span>.format);
|
|
},
|
|
|
|
formatDate : <span class="reserved">function</span>(date){
|
|
<span class="reserved">if</span>(!date || !(date instanceof Date)) <span class="reserved">return</span> date;
|
|
<span class="reserved">return</span> date.format(<span class="reserved">this</span>.format);
|
|
}
|
|
};
|
|
|
|
YAHOO.ext.grid.DateEditor.<span class="reserved">prototype</span>.format = <span class="literal">'m/d/y'</span>;
|
|
YAHOO.ext.grid.DateEditor.<span class="reserved">prototype</span>.disabledDays = null;
|
|
YAHOO.ext.grid.DateEditor.<span class="reserved">prototype</span>.disabledDaysText = <span class="literal">''</span>;
|
|
YAHOO.ext.grid.DateEditor.<span class="reserved">prototype</span>.disabledDates = null;
|
|
YAHOO.ext.grid.DateEditor.<span class="reserved">prototype</span>.disabledDatesText = <span class="literal">''</span>;
|
|
YAHOO.ext.grid.DateEditor.<span class="reserved">prototype</span>.allowBlank = true;
|
|
YAHOO.ext.grid.DateEditor.<span class="reserved">prototype</span>.minValue = null;
|
|
YAHOO.ext.grid.DateEditor.<span class="reserved">prototype</span>.maxValue = null;
|
|
YAHOO.ext.grid.DateEditor.<span class="reserved">prototype</span>.minText = <span class="literal">'The date in this field must be after %0'</span>;
|
|
YAHOO.ext.grid.DateEditor.<span class="reserved">prototype</span>.maxText = <span class="literal">'The date in this field must be before %0'</span>;
|
|
YAHOO.ext.grid.DateEditor.<span class="reserved">prototype</span>.blankText = <span class="literal">'This field cannot be blank'</span>;
|
|
YAHOO.ext.grid.DateEditor.<span class="reserved">prototype</span>.invalidText = <span class="literal">'%0 is not a valid date - it must be in the format %1'</span>;
|
|
YAHOO.ext.grid.DateEditor.<span class="reserved">prototype</span>.validationDelay = 200;
|
|
YAHOO.ext.grid.DateEditor.<span class="reserved">prototype</span>.validator = <span class="reserved">function</span>(){<span class="reserved">return</span> true;};</pre>
|
|
<hr>
|
|
|
|
|
|
<hr>
|
|
<font size="-1">
|
|
|
|
</font>
|
|
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Sat Oct 14 06:07:10 2006</div>
|
|
</body>
|
|
</html>
|