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

📄 igf_editors.js

📁 一个JSF的商业组件的DEMO,infragistics-netadvantage.lic:NetAdvantage for JSF Vol1 2008,m21A99D6A11FF-9B33DC4B8
💻 JS
📖 第 1 页 / 共 3 页
字号:
else
{if(n>21){v=-1;field++;}
if(j<t.length)if(x>18)
{k=this.jpn(t.charCodeAt(j))-48;if(k>=0&&k<=9){if(v<0)v=k;else v=v*10+k;}
else if(i+1<m.length&&t.charAt(j)==m.charAt(i+1))j--;}
else if(n!=x)if(this.getAMPM(false).charAt(0).toUpperCase()==t.charAt(j).toUpperCase())
v=1;}
n=x;}
fields[field]=v;return fields;}
me.curField=function(s,mask)
{var x,n=22,field=this.n0=this.n1=-1;for(var i=0;i<mask.length;i++)
{if(((x=mask.charCodeAt(i))>21)==(n>21))continue;if(x>21){if(i>=s)break;}
else{this.n0=i;field++;}
n=x;}
if(this.n0>=0)this.n1=i;if((field=this.field0IDs[field])==null)return-1;if(field<8)return(field<4)?0:1;if(field<20)return Math.floor((field-4)/2);return(field>21)?8:-1;}
me.key=function(k,c,t,i,s,mask)
{var n=0,v=-1,field=this.curField(s,mask);if(s>=this.n1)if(t.charCodeAt(--s)>21)return this.key(k,c,t,i,s+2,mask);if(field<0)return-1;if(field==5)
{if(s<=this.n0)
{v=this.getAMPM(false);if(v.charAt(0).toUpperCase()!=c.toUpperCase())v=this.getAMPM(true);if(this.n1==this.n0+1)v=v.charAt(0);else if((i=v.length)<2)v+=" ";else if(i>2)v=v.substring(0,2);this.txt=t.substring(0,this.n0)+v+t.substring(this.n1);}
return this.n1;}
if(k<48||k>57)
{if(s==0||(k!=47&&k!=58&&(k<44||k>57)))return-1;if(mask.charCodeAt(s-1)>=21||this.n1==i)return s;while(s<i)
{if(mask.charCodeAt(s++)>=21)break;t=t.substring(0,s-1)+mask.charAt(s-1)+t.substring(s);}
this.txt=t;return s;}
k-=48;if(this.n0==s)
{v=t.charCodeAt(s+1)-48;switch(field)
{case 4:k--;v-=2;case 3:case 1:if(k>1)n=1;else if(k==1&&v>2)n=2;break;case 2:if(k>3)n=1;else if(k==3&&v>1)n=2;break;case 6:case 7:if(k>6)n=1;else if(k==6&&v>0)n=2;break;default:break;}}
if(this.n0+1==s)
{v=t.charCodeAt(s-1)-48;switch(field)
{case 4:v--;k-=2;case 3:case 1:if(v>1||(v==1&&k>2))n=3;break;case 2:if(v>3||(v==3&&k>1))n=3;break;case 6:case 7:if(v>6||(v==6&&k>0))n=3;break;default:break;}}
if(n==1){t=t.substring(0,s)+mask.charAt(s)+t.substring(s+1);s++;}
if(n==2)t=t.substring(0,s+1)+mask.charAt(s+1)+t.substring(s+2);if(n==3)
{while(++s<i)if(mask.charCodeAt(s)<21)break;if(s>=i)return-1;return this.key(k+48,c,t,i,s,mask);}
this.txt=t.substring(0,s)+c+t.substring(s+1);return++s;}
me.spin=function(v)
{var x,i=this.spinF,d=new Date();d.setTime(this.date.getTime());if(i<0||i>8)
{if(this.fcs==2)
{this.getSelectedText();i=this.curField(this.sel0,this.mask);if((d=this.toDate(this.elem.value,true,true,true))==null)d=new Date();this.spinF=i;}
else this.spinF=i=this.d_s;}
if(i==5)v=(v>0)?12:-12;x=this.spinOnlyOneField;switch(i)
{case 0:d.setFullYear(v+=d.getFullYear());if(x&&v!=d.getFullYear())i=-1;break;case 1:d.setMonth(v+=d.getMonth());if(x&&v!=d.getMonth())i=-1;break;case 2:d.setDate(v+=d.getDate());if(x&&v!=d.getDate())i=-1;break;case 3:case 4:case 5:i=d.getDate();d.setHours(v+=d.getHours());if(x&&i!=d.getDate())i=-1;break;case 6:d.setMinutes(v+=d.getMinutes());if(x&&v!=d.getMinutes())i=-1;break;case 7:d.setSeconds(v+=d.getSeconds());if(x&&v!=d.getSeconds())i=-1;break;case 8:for(i=this.n1-this.n0;i++<3;)v*=10;d.setMilliseconds(v+=d.getMilliseconds());if(x&&v!=d.getMilliseconds())i=-1;break;}
if(i<0)return;if((v=this.limits(d))!=null)d=v;this.text=this.toTxt(d,this.fcs==2,this.promptChar,true);this.date=d;this.isNull=false;this.updatePost(d,"");this.repaint();this.select(this.sel0);}
me.getDate=function(){return this.instant(true);}
me.setDate=function(v){this.setValue(v);}
me.getValueByMode=function(vt,limit)
{this._ok();var d=(this.fcs<2)?(this.isNull?null:this.date):this.toDate(this.elem.value,true,limit);if(this._vld==1)this.msV(d?this.toTxt(d,true,""):"");if(vt==0)return d;return this.toTxt(d,vt==1,this.emptyChar);}
me.instant=function(date,limit){return this.getValueByMode(date?0:this.mode,limit==true);}
me.date_7=function(v)
{if(v.length<10)return null;var y,o=v.split("-");if(o.length<7)return null;v=new Date(y=this.intI(o,0),this.intI(o,1),this.intI(o,2),this.intI(o,3),this.intI(o,4),this.intI(o,5),this.intI(o,6));if(y<100)v.setFullYear(y);return v;}
me.getValue=function(date){this._ok();this._vld=1;return this.instant(date,true);}
me.setValue=function(v,o)
{if(v!=null&&v.getTime==null)
{if(this.fcs<0)
{if(v.length<8)v="";o=v.split(",");if(o.length>2)this.max=this.date_7(o[2]);if(o.length>1)this.min=this.date_7(o[1]);v=this.date_7(o[0]);}
else v=this.toDate(v.toString(),this.mode<2&&o!=true);}
o=v;if((v=this.limits(v))==null)v=o;this.txt=this.mask;if(this.isNull=(v==null))v=new Date();else this.toTxt(v,true,"",true);this.date=v;if(this.good!=false)this.good=v;this.text=this.focusTxt(this.fcs>1);this.updatePost(this.isNull?null:v,"");this.repaint();if(this.fix==1)this.old=this.instant(true);}
me.getRenderedValue=function(v)
{if(v!=null&&v.getTime==null)v=this.toDate(v.toString(),false);return this.toTxt(v,false,"");}
return me;}
function igedit_mask(elem,id,prop0,prop1)
{var me=new igedit_new(elem,id,prop0);prop1[0]=ig.replace(prop1[0],'~^+=','\03');var prop=me.valI(prop1,2);me.promptChar=prop.charAt(0);me.padChar=prop.charAt(1);me.emptyChar=prop.charAt(2);me.mode=parseInt(prop.charAt(3));me.minF=parseInt(prop.charAt(4));me.good=prop.length>5;me.flag=function(c,u)
{switch(c)
{case'>':return-1;case'<':return-2;case'&':c=1;break;case'C':c=2;break;case'A':c=7;break;case'a':c=8;break;case'L':c=13;break;case'?':c=14;break;case'#':case'0':return 19;case'9':return 20;default:return 0;}
return c+u*2;}
me.filter=function(flag,s,i,sf)
{if(i>=s.length)return sf;var c=s.charCodeAt(i),f=Math.floor((flag-1)/6);s=s.charAt(i);if(c<21)return sf;if(f==1||f==3)if(c>100)if((c=this.jpn(c))<100)s=String.fromCharCode(c);switch(f)
{case 0:break;case 1:if(c>47&&c<58)return s;case 2:if(c>255||s.toUpperCase()!=s.toLowerCase())break;return sf;case 3:return(c>47&&c<58)?s:sf;}
if((flag=Math.floor((flag-1)/2)%3)==0)return s;return(flag==2)?s.toLowerCase():s.toUpperCase();}
me.getTxt=function(vt,prompt,t)
{var flag,mask=this.mask,o="",non=(t!=null);if(!non)t=(this.bad!=0&&this.fcs>1)?this.elem.value:this.txt;if(non||this.fcs<0)non=this.minF==0;if(t==null||mask==null)return o;for(var i=0;i<mask.length;i++)if((flag=mask.charCodeAt(i))<21)
{if(i<t.length&&t.charCodeAt(i)>=21){o+=t.charAt(i);non=false;}
else if(vt%3==2||(vt%3==1&&(flag&1)==1))o+=prompt;}
else if(vt>=3)o+=mask.charAt(i);return non?"":o;}
me.setTxt=function(v,vt,render)
{var c,flag,j=0,i=-1,mask=this.mask,t=this.mask;if(v!=null)while(++i<mask.length)
{if(vt==1000+j)vt=this.mode;if(j>=v.length)break;if((flag=mask.charCodeAt(i))<21)
{if((c=this.filter(mask.charCodeAt(i),v,j))!=null)t=t.substring(0,i)+c+t.substring(i+1);j++;}
else if(vt>=3)j++;}
if(render)return t;this.txt=t;this.text=this.focusTxt(this.fcs>1," ");this.repaint();}
me.getInputMask=function(){return this.m0;}
me.setInputMask=function(mask)
{if(mask==null)mask="";this.m0=mask;var x,c,i,i0=0,u=0,n="",t="",t0=this.getTxt(0);for(i=0;i<mask.length;i++)
{if((x=this.flag(c=mask.charAt(i),u))!=0)
{if(x<0){u=(u==-x)?0:-x;continue;}
n+=(c=String.fromCharCode(x));c=this.filter(x,t0,i0++,c);}
else if(c=="\\"&&i+1<mask.length&&this.flag(mask.charAt(i+1),0)!=0)
n+=(c=mask.charAt(++i));else n+=c;t+=c;}
this.txt=t;this.mask=n;}
me.dMask=function(v,d)
{if(this.field0IDs==null)this.field0IDs=new Array();if(this.field1IDs==null)this.field1IDs=new Array();if(v==null)v="";var x,i,i0=0,flag=-1,t="";for(i=0;i<v.length;i++)
{x=v.charCodeAt(i);if(x<48||x>57)
{if(d==true&&(flag=v.charAt(i))=="\\"&&i+1<v.length)
{if((x=v.charAt(++i))=="\\")continue;if(x=="0"||x=="9")t+=flag;t+=x;}
else t+=v.charAt(i);continue;}
flag=(x-48)*10+v.charCodeAt(++i)-48;if(d==true){this.field1IDs[i0++]=flag;t+="\01";continue;}
this.field0IDs[i0++]=flag;if(flag==14)t+="L";else if(flag==15)t+="LL";else if(flag==22)t+="#";else{t+="##";if(flag==3)t+="##";while(flag-->23)t+="#";}}
return t;}
prop=me.valI(prop1,1);if(prop1.length>3)prop=me.dMask(prop);me.setInputMask(prop);me.focusTxt=function(foc,e)
{var t=null;if(e!=null&&!foc)
{e=e!=="";if(e&&this.bad!=0)this.txt=this.setTxt(this.elem.value,5,true);t=this.txt;var inv=t.length;if(!e&&this.hadFocus)
{var iL=inv-this.elem.value.length,s0=this.sel0,s1=this.sel1;if(iL>0&&s1-s0==iL)
this.txt=t=t.substring(0,s0)+this.mask.substring(s0,s1)+t.substring(s1);}
while(inv-->0)
{var c=t.charCodeAt(inv);if(c<21&&(c&1)==1)break;}
if(!e&&inv>=0)if(this.fireEvent(13))inv=-1;this._vs=this.elemViewState.value=ig.replace(t=this.txt,String.fromCharCode(13),String.fromCharCode(14))+((inv<0)?"":String.fromCharCode(30));this.valid(this.getTxt(this.mode,""));}
return this.getTxt(foc?5:4,foc?this.promptChar:this.padChar,t);}
me.enter0=function(){return this.getTxt(this.mode,"");}
me.setText=function(v,s){this.sTxt=1;this.setTxt(v,(s==null)?5:(1000+s));this.sTxt=0;if(this.fix==1)this.old=this.instant(true);}
me.key=function(k,c,t,i,s,mask){return-2;}
me.doKey=function(k,c,t,i,sel0,sel1,bad)
{if(i<1||k<7||(k>8&&k<32))k=0;if(bad)
{if(k==0||(this.getAMPM!=null&&!(this.mask.indexOf(c)>0||this.getAMPM(false).indexOf(c)>=0||this.getAMPM(true).indexOf(c)>=0||(k>=48&&k<=57))))
ig_cancelEvent(e);return;}
if(k==0)return;t=this.txt;var mask=this.mask;if(sel0!=sel1){while(--sel1>=sel0)t=t.substring(0,sel1)+mask.charAt(sel1)+t.substring(sel1+1);sel1++;}
else if(k==7)
{while(sel1<i&&mask.charCodeAt(sel1)>=21)sel1++;if(sel1>=i)return;t=t.substring(0,sel1)+mask.charAt(sel1)+t.substring(sel1+1);sel1++;}
else if(k==8)
{while(sel1>0&&mask.charCodeAt(sel1-1)>=21)sel1--;if(sel1--<1)return;t=t.substring(0,sel1)+mask.charAt(sel1)+t.substring(sel1+1);}
if(k>8&&sel1<i)
{if(sel1>=i)return;if((sel0=this.key(k,c,t,i,sel1,mask))>=0){t=this.txt;sel1=sel0;}
else{if(sel0==-1)return;while(mask.charCodeAt(sel1)>=21)if(++sel1>=i)return;}
if(sel0>=0){t=this.txt;sel1=sel0;}
else
{if((c=this.filter(mask.charCodeAt(sel1),c,0))==null)return;t=t.substring(0,sel1)+c+t.substring(sel1+1);sel1++;}}
this.txt=t;this.elem.value=this.focusTxt(true);this.select(sel1);}
me.getValueByMode=function(vt,v){return this.getTxt(vt,v?"":this.emptyChar);}
me.instant=function(v){return this.getValueByMode(this.mode,v);}
me.getValue=function(){this._ok();this.msV(this.getTxt(this.mode,""));return this.instant();}
me.setValue=function(v){this.setTxt(v,(this.fcs<0)?2:this.mode);if(this.fix==1)this.old=this.instant(true);}
me.getRenderedValue=function(v)
{v=(v==null)?"":v.toString();return this.getTxt(4,this.padChar,(this.mode==5)?v:this.setTxt(v,this.mode,true));}
return me;}
function igedit_new(elem,id,prop0)
{this.fcs=-1;this.valI=function(o,i){o=(o==null||o.length<=i)?null:o[i];return(o==null)?"":o;}
this.intI=function(o,i){return ig.isEmpty(o=this.valI(o,i))?-1:parseInt(o);}
this._lsnr=function(e,n){if(e&&!e._old)ig.addEventListener(e,n,igedit_event);}
this.initButElem=function(e,c,o)
{if(e==null)return;var i=-1,n=e.nodeName=="IMG";if(n||e.nodeName=="TD")if(c==null)
{if(o&&n)o.imgE=e;this._lsnr(e,"mousedown");this._lsnr(e,"mouseup");this._lsnr(e,"mousemove");this._lsnr(e,"mouseout");e._old=true;e.unselectable="on";}
else if(!ig.isEmpty(e.bgColor)){e.bgColor=c;e.style.color=c;}
if(!n)if((n=e.childNodes)!=null)while(++i<n.length)this.initButElem(n[i],c,o);}
this.focusTxt=function(foc,e)
{if(e!=null&&!foc)this.valid(this._vs=this.elemViewState.value=this.elem.value);return this.elem.value;}
this.elemID=-10;this.bad=0;this.Element=elem;elem.Object=this;this.eventID=function(s)
{switch(s.toLowerCase())
{case"keydown":return 0;case"keypress":return 1;case"keyup":return 2;case"mousedown":return 3;case"mouseup":return 4;case"mousemove":return 5;case"mouseover":return 6;case"mouseout":return 7;case"focus":return 8;case"blur":return 9;case"initialize":return 10;case"valuechange":return 11;case"textchanged":return 12;case"invalidvalue":return 13;case"custombutton":return 14;case"spin":return 15;}
return-1;}
this.events=new Array(16);this.evtH=function(n,fRef,add,o,s)
{if(n<0||n>15)return;var e=this.events[n];if(e==null){if(add)e=this.events[n]=new Array();else return;}
for(n=0;n<e.length;n++)if(e[n]!=null&&e[n].fRef==fRef)
{if(!add){delete e[n];e[n]=null;}return;}
if(add)for(n=0;n<=e.length;n++)if(e[n]==null)
{e[n]={fRef:fRef,o:o,s:s};break;}}
this.removeEventListener=function(name,fref){this.evtH(this.eventID(name),fref,false);}
this.addEventListener=function(name,fref,o){this.evtH(this.eventID(name),fref,true,o);}
this.getRenderedValue=function(v){return(v==null)?"":v.toString();}
var n,o,ii,j,i=0,e=document.getElementById(id+"_p");if(e==null)e=new Object();e.value=String.fromCharCode(30);this.elemViewState=e;if((e=document.getElementById(id))==null)if((e=document.getElementById(id.substring(1)))==null)e=new Object();this.elemValue=e;this.uniqueId=prop0[i++];e=prop0[i++];if(e.length>2)
{e=e.split(" ");for(j=0;j<e.length-1;j+=2)
{o=this.intI(e,j);n=ig.replace(this.valI(e,j+1),'&quot;','\"');n=ig.replace(ig.replace(n,'&coma;',','),'&nbsp;',' ');if(o==99)this._dt=n;else if(o==98)this._null=n;else if(ig.isName(n))try{this.evtH(o,eval(n),true);}catch(o){}
else this.evtH(o,n,true,null,true);}}
this.nullable=!ig.isEmpty(prop0[i++]);this.postValue=!ig.isEmpty(prop0[i++]);this.postButton=!ig.isEmpty(prop0[i++]);this.postEnter=!ig.isEmpty(prop0[i++]);this.maxLength=this.intI(prop0,i++);this.spinDelta=ig.isEmpty(o=this.valI(prop0,i++))?1:parseFloat(o);this.spinOnArrows=!ig.isEmpty(prop0[i++]);this.spinOnlyOneField=!ig.isEmpty(prop0[i++]);this.hideEnter=!ig.isEmpty(prop0[i++]);this.selectionOnFocus=this.intI(prop0,i++)-1;this._flag=this.intI(prop0,i++);this.roll=!ig.isEmpty(prop0[i++]);this.css=this.intI(prop0,i++);this.repaint=function(){if(this.elem.value==this.text)return;this.elem.value=this.text;}
if((e=document.getElementById(id+"_t"))==null)e=elem;this.elem=e;if(!igedit_all._end){igedit_all._end=true;this._lsnr(window,"unload");this._lsnr(e.form,"submit");}
o=e.parentNode;ii=o.childNodes;n=ii.length-1;while(n-->0)if(ii[n]==e)break;n=(n<0)?null:ii[n+1];o.removeChild(e);this._lsnr(e,"keydown");this._lsnr(e,"keypress");this._lsnr(e,"keyup");this._lsnr(e,"focus");this._lsnr(e,"blur");this._lsnr(e,"mousedown");this._lsnr(e,"mouseup");this._lsnr(e,"mousemove");this._lsnr(e,"mouseover");this._lsnr(e,"mouseout");e._old=true;if(n)o.insertBefore(e,n);else o.appendChild(e);this.ID=id;if(id.indexOf("x_")==0)this.ID_=id.substring(1);e.setAttribute("editID",id);this.k0=this.sel0=this._wh=0;this.getEnabled=function(){return!this.elem.disabled;}
this.setEnabled=function(v)
{if(this.elem.disabled==!v)return;this.elem.disabled=!v;for(var i=0;i<3;i++)this.butState(i,v?0:3);}
if(this.css>=0)
{this.butP=-1;this.butL=1;this.buttons=new Array(3);for(j=0;j<3;j++)
{if((e=document.getElementById(id+"_b"+j))==null)i+=4;else
{o={elem:e,img:new Array(4)};this.initButElem(e,null,o);e.setAttribute("editID",id+","+j);for(ii=0;ii<4;ii++)o.img[ii]=this.valI(prop0,i++);o.state=this.getEnabled()?0:3;this.buttons[j]=o;}}
ii=1;if((o=this.intI(prop0,i++))<0)ii=8;else{while(o++<3)ii/=2;while(o-->4)ii*=2;}
this.spinSpeedUp=ii;this.spinOnReadOnly=!ig.isEmpty(prop0[i++]);this.spinDelay=this.intI(prop0,i++);this.spinFocus=!ig.isEmpty(prop0[i++]);this.ccss=new Array(4);for(ii=0;ii<4;ii++){o=this.valI(prop0,i++);if(ii>0)o=this.ccss[0]+((o.length>0)?(" "+o):"");this.ccss[ii]=o;}
this._wh=this.intI(prop0,i++);}
this.getVisible=function(){return this.Element.style.display!="none";}
this.get_value=function()
{return this.getValue();}
this.set_value=function(val)
{this.setText(val);}
this.showEditor=function(top,left,width,height,cssClass,parent)

⌨️ 快捷键说明

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