⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 igf_input.js

📁 一个JSF的商业组件的DEMO,infragistics-netadvantage.lic:NetAdvantage for JSF Vol1 2008,m21A99D6A11FF-9B33DC4B8
💻 JS
📖 第 1 页 / 共 2 页
字号:
// (c) 2007 Infragistics - Do NOT modify the content of this file
// Version 8.1.20081.1004

if(ig){if(!ig.input){function IgWebCalendarPackage(){this.TYPE_DATE_CHOOSER="DateChooser";this.TYPE_CALENDAR="Calendar";this.TYPE_CALENDAR_DAY="CalendarDay";this.TYPE_CALENDAR_POPUP="CalendarPopup";this.TYPE_INPUT="Input";this.ID_POPUP_CALENDAR="igCalendarPopup";this.CSS_DAY_HEADER="ocssdh";this.CSS_HEADER="ocssh";this.CSS_DEFAULT_CALENDAR="odcCalendarPopup";this.CSS_DEFAULT_DATE="odcCalendarDay";this.CSS_HOVER_DATE="ohcCalendarDay";this.CSS_DISABLED_DATE="odscCalendarDay";this.CSS_SELECTED_DATE="oscCalendarDay";this.CSS_CALENDAR_DAY_NOT_CURRENT_MONTH="odcncm";this.DAY_LIST="odl";this.DISPLAYED_DATE="od";this.EDIT_MASKS="odem";this.EDIT_MASKS_SEPARATOR="odems";this.FIRST_DAY_OF_WEEK="ofdow";this.LONG_DAY_LIST="oldl";this.MAX_DATE="omxd";this.MIN_DATE="omnd";this.MONTH_LIST="oml";this.PARENT_DATE_CHOOSER="oInputCaller";this.SELECTED_DATE="osd";this.SHORT_DAY_LIST="osdl";this.SHORT_MONTH_LIST="osml";this.SHOW_DAY_HEADER="osdh";this.SHOW_HEADER="osh";this.createPopupCalendar=function(){var ppup=document.createElement("div");ppup.id=ig.input.ID_POPUP_CALENDAR;ppup.style.position="absolute";ppup.style.visibility="hidden";ppup.setAttribute("otype",ig.input.TYPE_CALENDAR_POPUP);ppup.setAttribute("ocontrol","true");var cc="<div id=\""+ig.input.ID_POPUP_CALENDAR+"_header\">";cc+="<table id=\""+ig.input.ID_POPUP_CALENDAR+"_tableheader\"><tr>";cc+="<td><button type=\"button\" class=\"owidcbcy\" "+ig.PROP_FLAG+"=\"bpy\">&lt;</button></td>";cc+="<td><select id=\""+ig.input.ID_POPUP_CALENDAR+"_month\" onchange=\"ig.input.onMonthYearChange(event)\"></select></td>";cc+="<td>&nbsp;</td>";cc+="<td><input id=\""+ig.input.ID_POPUP_CALENDAR+"_year\" type=\"text\" maxlenght=\"4\" size=\"4\"";cc+=" "+ig.PROP_FLAG+"=\"tbcy\" onchange=\"ig.input.onMonthYearChange(event)\"/></td>";cc+="<td><button type=\"button\" class=\"owidcbcy\" "+ig.PROP_FLAG+"=\"bny\">&gt;</button></td>";cc+="</tr></table></div>";cc+="<div id=\""+ig.input.ID_POPUP_CALENDAR+"_body\" align='center'></div>";ppup.innerHTML=cc;document.body.appendChild(ppup);return ig.getUIElementById(ppup);};this.getPopupCalendar=function(){var ppup=ig.getUIElementById(ig.input.ID_POPUP_CALENDAR);if(ig.isNull(ppup)){ppup=this.createPopupCalendar();}
return ppup;};this.init=function(){ig.addEventListener(document,ig.event.EVENT_CLICK,ig.input.onClickOutside,false);ig.factory.addClass(ig.input.TYPE_DATE_CHOOSER,IgDateChooser);ig.factory.addClass(ig.input.TYPE_CALENDAR,IgCalendar);ig.factory.addClass(ig.input.TYPE_CALENDAR_DAY,IgCalendarDay);ig.factory.addClass(ig.input.TYPE_CALENDAR_POPUP,IgCalendarPopup);ig.factory.addClass(ig.input.TYPE_INPUT,IgInput);};this.onClickOutside=function(evt){var xEvt=ig.toEvent(evt);if(xEvt===null){return;}
var oe=ig.getTargetUIElement(xEvt.target,ig.input.TYPE_CALENDAR_DAY);if(oe===null){oe=ig.getTargetUIElement(xEvt.target,ig.input.TYPE_CALENDAR_POPUP);if(oe===null){var flagValue=ig.getAttribute(xEvt.target,ig.PROP_FLAG);if(flagValue!="owidcb"){var cal=ig.getUIElementById(ig.input.ID_POPUP_CALENDAR);if(!ig.isNull(cal)){if(cal.isVisible()){cal.hide(true);}}}}}};this.onMonthYearChange=function(evt){var xEvt=ig.toEvent(evt);if(!ig.isNull(xEvt)){var cal=ig.getTargetUIElement(xEvt.target,ig.input.TYPE_CALENDAR_POPUP);if(!ig.isNull(cal)){var oMonth=cal.getMonthCombo();var oYear=cal.getYearCombo();if((!ig.isNull(oMonth))&&(!ig.isNull(oYear))){cal.showDate(oMonth.selectedIndex,oYear.value);}}}};this.getNextMonthOfDate=function(pDate){var nextMonthDate=new Date(pDate.getYear(),pDate.getMonth()+1,"01");return nextMonthDate.getMonth();};};ig.input=new IgWebCalendarPackage();function IgCalendar(e){this.IgUIComponent(e);};IgCalendar.prototype.getMonthCombo=function(){return ig.getElementById(this.elm.id+"_month");};IgCalendar.prototype.getYearCombo=function(){return ig.getElementById(this.elm.id+"_year");};IgCalendar.prototype.getHeader=function(){return ig.getUIElementById(this.elm.id+"_header");};IgCalendar.prototype.getBody=function(){return ig.getElementById(this.elm.id+"_body");};IgCalendar.prototype.getDayHeaderClass=function(){return this.getAttribute(ig.input.CSS_DAY_HEADER);};IgCalendar.prototype.getHeaderClass=function(){return this.getAttribute(ig.input.CSS_HEADER);};IgCalendar.prototype.getSelectedDate=function(){var result=null;var sd=this.elm.getAttribute(ig.input.SELECTED_DATE);if(ig.NaES(sd)){result=new Date();result.igParse("yyyyMMdd",sd);}
return result;};IgCalendar.prototype.getShowDayHeader=function(b){return this.getAttribute(ig.input.SHOW_DAY_HEADER)!="false";};IgCalendar.prototype.getShowHeader=function(b){return this.getAttribute(ig.input.SHOW_HEADER)!="false";};IgCalendar.prototype.getDayList=function(){return this.elm.getAttribute(ig.input.DAY_LIST);};IgCalendar.prototype.getDisplayedDate=function(){var odate_str=this.elm.getAttribute(ig.input.DISPLAYED_DATE);var odate;if(ig.NaES(odate_str)){odate=new Date();odate.setDate("01");odate.igParse("yyyyMMdd",odate_str);odate.setDate("01");odate.setHours(0);odate.setSeconds(0);odate.setMinutes(0);odate.setMilliseconds(0);}
else{odate=this.getSelectedDate();if(odate!==null){odate=new Date(odate.getFullYear(),odate.getMonth(),'01');}else{odate=new Date();odate.setDate('01');}
this.setDisplayedDate(odate);}
return odate;};IgCalendar.prototype.getMonthList=function(){return this.elm.getAttribute(ig.input.MONTH_LIST);};IgCalendar.prototype.getFirstDayOfWeek=function(){return(this.elm.getAttribute(ig.input.FIRST_DAY_OF_WEEK));};IgCalendar.prototype.getMinDate=function(){var dateMin=this.elm.getAttribute(ig.input.MIN_DATE);if(dateMin=="null"){dateMin=null;}
if(ig.NaES(dateMin)){var minDate=new Date();minDate.igParse("yyyyMMdd",dateMin);minDate.setHours(0);minDate.setSeconds(0);minDate.setMinutes(0);minDate.setMilliseconds(0);return minDate;}else{return null;}};IgCalendar.prototype.getMaxDate=function(){var dateMax=this.elm.getAttribute(ig.input.MAX_DATE);if(dateMax=="null"){dateMax=null;}
if(ig.NaES(dateMax)){var maxDate=new Date();maxDate.igParse("yyyyMMdd",dateMax);maxDate.setHours(0);maxDate.setSeconds(0);maxDate.setMinutes(0);maxDate.setMilliseconds(0);return maxDate;}else{return null;}};IgCalendar.prototype.setMinDate=function(d){this.elm.setAttribute(ig.input.MIN_DATE,d+"");};IgCalendar.prototype.setMaxDate=function(d){this.elm.setAttribute(ig.input.MAX_DATE,d+"");};IgCalendar.prototype.setFirstDayOfWeek=function(d){this.elm.setAttribute(ig.input.FIRST_DAY_OF_WEEK,d+"");};IgCalendar.prototype.setDayList=function(d){this.elm.setAttribute(ig.input.DAY_LIST,d+"");};IgCalendar.prototype.setDisplayedDate=function(d){var tmp="";if(d!==null){tmp=d.igFormat("yyyyMMdd");}
this.elm.setAttribute(ig.input.DISPLAYED_DATE,tmp+"");};IgCalendar.prototype.setLongDayList=function(d){this.elm.setAttribute(ig.input.LONG_DAY_LIST,d+"");};IgCalendar.prototype.setMonthList=function(d){this.elm.setAttribute(ig.input.MONTH_LIST,d+"");};IgCalendar.prototype.setShortDayList=function(d){this.elm.setAttribute(ig.input.SHORT_DAY_LIST,d+"");};IgCalendar.prototype.setShortMonthList=function(d){this.elm.setAttribute(ig.input.SHORT_MONTH_LIST,d+"");};IgCalendar.prototype.showNextMonth=function(){var dd=this.getDisplayedDate();this.showDate(dd.getMonth()+1,dd.getFullYear());};IgCalendar.prototype.showNextYear=function(){var dd=this.getDisplayedDate();this.showDate(dd.getMonth(),dd.getFullYear()+1);};IgCalendar.prototype.showPreviousMonth=function(){var dd=this.getDisplayedDate();this.showDate(dd.getMonth()-1,dd.getFullYear());};IgCalendar.prototype.showPreviousYear=function(){var dd=this.getDisplayedDate();this.showDate(dd.getMonth(),dd.getFullYear()-1);};IgCalendar.prototype.setSelectedDate=function(d){this.elm.setAttribute(ig.input.DISPLAYED_DATE,"");if(!ig.isNull(d)){var tmp=d.igFormat("yyyyMMdd");this.elm.setAttribute(ig.input.SELECTED_DATE,tmp+"");}
else{this.elm.setAttribute(ig.input.SELECTED_DATE,"");}};IgCalendar.prototype.setShowDayHeader=function(b){this.elm.setAttribute(ig.input.SHOW_DAY_HEADER,b+"");};IgCalendar.prototype.setShowHeader=function(b){this.elm.setAttribute(ig.input.SHOW_HEADER,b+"");};IgCalendar.prototype.synchroniseMonthYear=function(month,year){if(this.getShowHeader()){var oMonth=this.getMonthCombo();if(!ig.isNull(oMonth)){if(oMonth.selectedIndex!=parseInt(month)){oMonth.selectedIndex=parseInt(month);}}
var oYear=this.getYearCombo();if(!ig.isNull(oYear)){if(oYear.value!=year){oYear.value=year;}}}
else{var header=this.getHeader();if(!ig.isNull(header)){header.hide(true);}}};ig.augment(IgCalendar,IgUIComponent);function IgDateChooser(e){this.IgUIComponent(e);};IgDateChooser.prototype.getDayList=function(){return this.elm.getAttribute(ig.input.DAY_LIST);};IgDateChooser.prototype.getEditMasks=function(){return this.elm.getAttribute(ig.input.EDIT_MASKS);};IgDateChooser.prototype.getDate=function(){var result=null;var it=ig.findDescendant(this.elm,null,null,"input");if(!ig.isNull(it)){var masks=this.getEditMasks();if(!ig.isNull(masks)){var array=masks.split(this.elm.getAttribute(ig.input.EDIT_MASKS_SEPARATOR));if(!ig.isNull(array)&&array.length>0){for(var i=0;i<array.length;i++){result=new Date();result.igSetLocale(this.getShortMonthList(),this.getMonthList(),this.getShortDayList(),this.getLongDayList(),null);result=result.igParse(array[i],it.value);if(!ig.isNull(result)){return result;}}}}}
return result;};IgDateChooser.prototype.getDisplayMask=function(){var masks=this.getEditMasks();if(!ig.isNull(masks)){var array=masks.split(this.elm.getAttribute(ig.input.EDIT_MASKS_SEPARATOR));if(!ig.isNull(array)&&array.length>0){return array[0];}}
return masks;};IgDateChooser.prototype.getId=function(){var id=null;var it=ig.findDescendant(this.elm,null,null,"input");if(!ig.isNull(it)){id=it.id;}
return id;};IgDateChooser.prototype.getLongDayList=function(){return this.elm.getAttribute(ig.input.LONG_DAY_LIST);};IgDateChooser.prototype.getMonthList=function(){return this.elm.getAttribute(ig.input.MONTH_LIST);};IgDateChooser.prototype.getShortDayList=function(){return this.elm.getAttribute(ig.input.SHORT_DAY_LIST);};IgDateChooser.prototype.getShortMonthList=function(){return this.elm.getAttribute(ig.input.SHORT_MONTH_LIST);};IgDateChooser.prototype.getShortName=function(longNamesString){if(!ig.isNull(longNamesString)){var longNamesArray=longNamesString.split(",");if(!ig.isNull(longNamesArray)&&longNamesArray.length>0){var result="";for(var i=0;i<longNamesArray.length;i++){if(i>0){result+=",";}
result+=longNamesArray[i].substring(0,3);}}
return result;}
return null;};IgDateChooser.prototype.onKeyDown=function(evt){switch(evt.keyCode){case evt.KEY_UP:this.showNextDay();break;case evt.KEY_DOWN:this.showPreviousDay();break;}};IgDateChooser.prototype.onClick=function(evt){if(this.isEnabled()){var flagValue=ig.getAttribute(evt.target,ig.PROP_FLAG);if(flagValue=="owidcb"){if(!evt.target.readOnly){var cal=ig.input.getPopupCalendar();var dateChooser=cal.getDateChooser();if((!cal.isVisible())||(dateChooser!=this.elm)){cal.show(this);if(ig.isNetscape){igDoc=ig.getUIElementById(ig.input.ID_POPUP_CALENDAR+"_tableheader");igPpup=ig.getUIElementById(ig.input.ID_POPUP_CALENDAR);igPpup.setSize(igDoc.getWidth(),-1);}}
else{var oCaller=ig.getUIElementById(dateChooser);oCaller.setDate(cal.getSelectedDate());cal.hide(true);}}}}};IgDateChooser.prototype.setDate=function(d){if(!ig.isNull(d)){var previousDate=this.getDate();if(!ig.isNull(previousDate)){d.setHours(previousDate.getHours());d.setMinutes(previousDate.getMinutes());d.setSeconds(previousDate.getSeconds());d.setMilliseconds(previousDate.getMilliseconds());}
d.igSetLocale(this.getShortMonthList(),this.getMonthList(),this.getShortDayList(),this.getLongDayList(),null);var displayedDate=d.igFormat(this.getDisplayMask());if(displayedDate!==null){var it=ig.findDescendant(this.elm,null,null,"input");if(!ig.isNull(it)){it.value=displayedDate;}}}};IgDateChooser.prototype.showNextDay=function(){var d=this.getDate();if(!ig.isNull(d)){d.setDate(d.getDate()+1);this.setDate(d);}};IgDateChooser.prototype.showPreviousDay=function(){var d=this.getDate();if(!ig.isNull(d)){d.setDate(d.getDate()-1);this.setDate(d);}};ig.augment(IgDateChooser,IgUIComponent);function IgCalendarDay(e){this.IgUIElement(e);};IgCalendarDay.prototype.getClass=function(){var css=this.getAttribute("ocbh");if(ig.NaES(css)){this.setAttribute("ocbh","");}
else{if(!this.isEnabled()){css=this.getDisabledClass();}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -