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

📄 igf_editors.js

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

if(typeof(igedit_all)!="object")
var igedit_all=new Object();function igedit_getById(id,elem)
{var o,e=elem,i1=-2;if(e!=null)
{while(true)
{if(e==null)return null;try{if(e.getAttribute!=null)id=e.getAttribute("editID");}catch(ex){}
if(!ig.isEmpty(id))break;if(++i1>4)return null;e=e.parentNode;}
var ids=id.split(",");if(ig.isEmpty(ids))return null;id=ids[0];i1=(ids.length>1)?parseInt(ids[1]):-1;}
if((e=igedit_all)!=null)if((o=e[id])==null)for(var i in e)if((o=e[i])!=null)
if(o.ID==id||o.ID_==id||o.uniqueId==id)break;else o=null;if(o!=null&&i1>-2)o.elemID=i1;return o;}
function igedit_init(id,t,prop0,prop1,cb)
{var o=igedit_all[id],elem=(typeof document=='unknown')?null:document.getElementById('igtxt'+id);if(o&&o.msV)
{var i=-1,b=o.buttons;if(b)while(++i<b.length)if(b[i])b[i].elem=null;o.Element=o.elem=o.elemViewState=o.elemValue=o.tr=o.Event=o.webGrid=null;ig_dispose(o);}
if(!elem||!prop0)return;prop0=prop0.split(",");if(t>=4)o=igedit_number(elem,id,prop0,prop1);else if(t==2)o=igedit_date(elem,id,prop0,prop1);else if(t==1)o=igedit_mask(elem,id,prop0,prop1);else o=new igedit_new(elem,id,prop0);igedit_all[id]=o;o.fix=1;if(cb)ig.getCBManager().addPanel(o,id,id,o.Element,(cb=='1')?null:cb);o.setValue(prop1[0]);o.fcs=o._np=0;o._dtt();if((o._flag&2)!=0)o.focus1();o.fireEvent(10);o._vs=o._vs0=o.elemViewState.value;$addHandler(elem,"keydown",Function.createDelegate(o,o._onKeyDownHandler));$addHandler(elem,"blur",Function.createDelegate(o,o._onBlurHandler));}
function igedit_number(elem,id,prop0,prop1)
{var i=1,me=new igedit_new(elem,id,prop0);var j=-1,v=me.valI(prop1,i++);var n=v.length;if(n<1)v=".";if(n<2){n=2;v+=v;}
me.dec_vld=v.substring(n>>=1);me.decimalSeparator=v.substring(0,n);me.groupSeparator=me.valI(prop1,i++);v=me.valI(prop1,i++);if(v.length<1)v="-";me.minus=v;me.symbol=me.valI(prop1,i++);me.nullText=me.valI(prop1,i++);me.positivePattern=me.valI(prop1,i++);me.negativePattern=me.valI(prop1,i++);me.mode=me.valI(prop1,i++);me.decimals=me.valI(prop1,i++);me.minDecimals=me.valI(prop1,i++);v=me.valI(prop1,i++);if(v==1)me.min=me.valI(prop1,i++);v=me.valI(prop1,i++);if(v==1)me.max=me.valI(prop1,i++);me.clr1=me.valI(prop1,i++);me.clr0=me.valI(prop1,i++);me.groups=new Array();while(++j<6){if((v=me.valI(prop1,i++))>0)me.groups[j]=v;else break;}
me.getMaxValue=function(){return this.max;}
me.setMaxValue=function(v){this.max=this.toNum(v,false);}
me.getMinValue=function(){return this.min;}
me.setMinValue=function(v){this.min=this.toNum(v,false);}
me.toNum=function(t,limit,fire)
{var c,num=null,i=-1,div=1,dec=-1,iLen=0;if(t==="")t=null;if(t==null||t.length==null)num=t;else
{var neg=false,dot=this.decimalSeparator.charCodeAt(0);if(t)
{c=this.symbol;if(c.length>0)if((iLen=t.indexOf(c))>=0)t=t.substring(0,iLen)+t.substring(iLen+c.length);if(t.toUpperCase==null)t=t.toString();iLen=t.length;}
while(++i<iLen)
{if(this.isMinus(c=this.jpn(t.charCodeAt(i)))){if(neg)break;neg=true;}
if(c==dot||c==12290||c==65294||(c==12289&&dot==44)){if(dec>=0)break;dec=0;}
if(c<48||c>57)continue;if(num==null)num=0;if(dec<0)num=num*10+c-48;else{dec=dec*10+c-48;div*=10;}}
if(num!=null){if(dec>0)num+=dec/div;if(neg)num=-num;}}
i=limit?this.limits(num):num;if(fire!=true)return i;c="";if(i!=num||(i==null&&iLen>0))
{fire=new Object();fire.value=i;fire.text=t;fire.type=(num==null)?((iLen==0)?2:0):1;c=String.fromCharCode(30);c+=t+c+fire.type;if(this.fireEvent(13,null,fire))c="";i=fire.value;}
this.value=i;this._vs=this.elemViewState.value=this.toTxt(i,true,null,"-",".")+c;this.valid(this.toTxt(i,true,null,"-",this.dec_vld));return i;}
me.enter0=function(){return this.toTxt(null,true,this.elem.value,"-",".");}
me.focusTxt=function(foc,e)
{if(e!=null&&!foc)this.value=this.toNum(this.elem.value,true,true);return this.toTxt(this.value,foc);}
me.toTxt=function(v,foc,t,m,dec)
{if(t==null)
{if(v==null)return foc?"":this.nullText;var neg=(v<0);if(neg)v=-v;try{t=v.toFixed(this.decimals);}catch(ex){t=""+v;}
return this.toTxt(neg,foc,t.toUpperCase(),(m==null)?this.minus:m,(dec==null)?this.decimalSeparator:dec);}
var c,i=-1,iL=t.length;if(v==null)
{if(iL==0)return foc?t:this.nullText;if(v=this.isMinus(t.charCodeAt(0)))t=t.substring(1);}
var iE=t.indexOf("E");if(iE<0)iE=0;else
{iL=parseInt(t.substring(iE+1));t=t.substring(0,iE);iE=iL;}
iL=t.length;while(++i<iL)
{c=t.charCodeAt(i);if(c<48||c>57){t=t.substring(0,i)+t.substring(i+1);iL--;break;}}
while(i<iL){if(t.charCodeAt(iL-1)!=48)break;t=t.substring(0,--iL);}
if(iE!=0)
{while(iE-->0)if(i++>=iL)t+="0";if(++iE<0){if(i==0)t="0"+t;while(++iE<0)t="0"+t;t="0"+t;i=1;}}
iL=i;var iDec=0;if(this.decimals>0&&iL<t.length)
{iDec=t.length-iL;t=t.substring(0,iL)+dec+t.substring(iL);iL+=dec.length+this.decimals;}
if(iL<t.length)t=t.substring(0,iL);if((iL=this.minDecimals)!=0){if(iDec==0)t+=dec;while(iL-->iDec)t+="0";}
if(foc)return v?(m+t):t;var g0=(this.groups.length>0)?this.groups[0]:0;var ig=0,g=g0;while(g>0&&--i>0)if(--g==0)
{t=t.substring(0,i)+this.groupSeparator+t.substring(i);g=this.groups[++ig];if(g==null||g<1)g=g0;else g0=g;}
var txt=v?this.negativePattern:this.positivePattern;txt=txt.replace("$",me.symbol);return txt.replace("n",t);}
me.setText=function(v){this.sTxt=1;this.setValue(v);this.sTxt=0;}
me.isMinus=function(k){return k==this.minus.charCodeAt(0)||k==45||k==40||k==12540||k==65293||k==65288;}
me.doKey=function(k,c,t,i,sel0,sel1,bad)
{if(bad)
{if(!(k<9||this.isMinus(k)||(k>=48&&k<=57)||k==this.decimalSeparator.charCodeAt(0)))
ig_cancelEvent(e);return;}
if(sel0!=sel1){t=t.substring(0,sel0)+t.substring(sel1);sel1=sel0;i=t.length;}
else if(k==7){if(sel1++>=i||i==0)return;}
else if(k==8){if(sel0--<1)return;}
if(k<9||this.maxLength==0||this.maxLength>i)
{var dot=k==this.decimalSeparator.charCodeAt(0);var ok=(k>47&&k<58)||(sel0==0&&this.isMinus(k))||(dot&&this.decimals>0);if(i>0&&sel0==0)if(this.isMinus(t.charCodeAt(0)))ok=false;if(k>8&&!ok)return;if(dot)if((dot=t.indexOf(this.decimalSeparator))>=0)
{if(dot==sel0||dot==sel0-1)return;i--;if(dot<sel0)sel0=--sel1;t=t.substring(0,dot)+t.substring(dot+1);}
if(k>8&&sel1>=i)t+=c;else t=t.substring(0,sel0)+c+t.substring(sel1);}
else k=0;this.elem.value=t;this.select((k>10)?sel1+1:sel0);}
me.limits=function(v,r)
{if(v==null&&!this.nullable)v=0;if(v!=null)
{var n=this.min,x=this.max;if(n!=null&&v<=n)return r?x:n;if(x!=null&&v>=x)return r?n:x;}
return v;}
me.getNumber=function(){return this.instant(true,true,true);}
me.setNumber=function(v){this.setValue(v);}
me.instant=function(num,limit,v)
{v=(this.fcs==2||v)?this.toNum(this.elem.value,limit==true):this.value;if(this._vld==1)this.msV(this.toTxt(v,true,null,"-",this.dec_vld));return(num||this.mode>0)?v:this.toTxt(v,true);}
me.getValue=function(num){this._ok();this._vld=1;return this.instant(num,true,true);}
me.setValue=function(v)
{this.text=this.toTxt(this.value=this.toNum(v,true,true),this.fcs==2);this.repaint();this.select(1000);if(this.fix==1)this.old=this.instant(true);}
me.spin=function(v)
{var val=this.toNum(this.elem.value);if(val==null)val=0;this.fix=0;this.setValue(val+v);this.fix=1;}
me.getRenderedValue=function(v){return this.toTxt(this.toNum(v),false);}
return me;}
function igedit_date(elem,id,prop0,prop1)
{var me=igedit_mask(elem,id,prop0,prop1);me.mask1=me.dMask(me.valI(prop1,3),true);me.nullText=me.valI(prop1,4);me.century=prop1[5];me.yearFix=prop1[6];me.str=me.valI(prop1,7).split(",");me.getMaxValue=function(){return this.max;}
me.setMaxValue=function(v){if(v!=null&&v.getTime==null)v=this.toDate(v.toString(),true);this.max=v;}
me.getMinValue=function(){return this.min;}
me.setMinValue=function(v){if(v!=null&&v.getTime==null)v=this.toDate(v.toString(),true);this.min=v;}
me.getAMPM=function(am){var v=this.valI(this.str,am?0:1);return(v.length>0)?v:(am?"AM":"PM");}
me.setAMPM=function(v,am){return this.str[am?0:1]=v;}
me.getMonthNameAt=function(i){return this.valI(this.str,2+i%12);}
me.setMonthNameAt=function(v,i){return this.str[2+i%12]=v;}
me.getDowNameAt=function(i){return this.valI(this.str,14+i%7);}
me.setDowNameAt=function(v,i){return this.str[14+i%7]=v;}
me.setNow=function(){this.setValue(new Date());}
me.date=new Date();me.isNull=false;me.d_s=10;me.setText=function(v){this.sTxt=1;this.setValue(v,true);this.sTxt=0;}
me.fieldValue=function(f,d,e,c)
{var v,i=(f&1)*2;if(f<4){v=d.getFullYear()+this.yearFix;if(f==3)i=4;else{v%=100;i=(f==2)?2:0;}}
else if(f<8){this.d_s=2;v=d.getMonth()+1;if(f>5){f=this.getMonthNameAt(v-1);if(f.length>0)return f;}}
else if(f<10)v=d.getDate();else if(f<16)
{v=d.getHours();if(f>13)
{v=this.getAMPM(v<12);if((f-=13)==(i=v.length))return v;if(i<f)v+=" ";return v.substring(0,f);}
if(f<12){v%=12;if(v==0)v=12;}}
else if(f<18)v=d.getMinutes();else if(f<20)v=d.getSeconds();else if(f<22)return this.getDowNameAt(d.getDay());else
{v=d.getMilliseconds();var j=i=f-21;while(j-->3)v*=10;while(j++<2)v=Math.floor(v/10);}
v=""+v;if(f<20||f>22)
{f=v.length;if(e){if(i==0)i=2;else e=false;}
if(i>0){if(i<f)v=v.substring(0,i);else while(f++<i)v=(e?c:"0")+v;}}
return v;}
me.limits=function(d,r)
{if(d==null)return d;var v=d.getTime(),n=this.min,x=this.max;if(n!=null)n=n.getTime();if(x!=null)x=x.getTime();if(n!=null&&(v<n||(r&&v==n))){d.setTime(r?x:n);return d;}
if(x!=null&&(v>x||(r&&v==x))){d.setTime(r?n:x);return d;}
return null;}
me.toDate=function(t,foc,limit,fire)
{var fields=(foc&&fire)?this.fields0(t):this.fields1(t,foc);var v,i0,n=0,i=-1,j=-1,iLen=fields.length,c,y=-1,mo=-1,day=-1,h=-2,m=-2,s=-2,ms=-2,pm=-1;var any=false,arg=new Object();while(++i<iLen)
{j++;v=fields[i];i0=foc?this.field0IDs[i]:this.field1IDs[i];if(i0<4){if(v>100&&v>this.yearFix)v-=this.yearFix;if((arg.year=y=v)<0)n|=8;else{n++;c=this.century;if(v<100){if(i0<3&&c<0)c=29;if(c>=0)y+=(v>c)?1900:2000;}}}
else if(i0<8){arg.month=mo=v;if(v<1||v>12)n|=8;else n++;}
else if(i0<10){arg.day=day=v;if(v<1||v>31)n|=8;else n++;}
else if(i0<14)
{if(v==24)v=0;if(i0>11)pm=-4;else{if(v==12)v=0;if(v>12)n|=8;}
arg.hours=h=v;if(v>23||v<0)n|=8;}
else if(i0<16){j--;if(v>0)pm++;continue;}
else if(i0<18){arg.minutes=m=v;if(v>59||v<0)n|=8;}
else if(i0<20){arg.seconds=s=v;if(v>59||v<0)n|=8;}
else if(i0<22){j--;continue;}
else{while(i0++<24)v*=10;while(i0-->25)v=Math.floor(v/10);arg.milliseconds=ms=v;if(v>999||v<0)n|=8;}
if(v>=0)any=true;if(j<this.minF&&n>7)n|=32;}
if(pm==0&&h>=0&&h<12)arg.hours=(h+=12);var inv=fire?(":"+y+","+mo+","+day+","+h+","+m+","+s+","+ms+","):"";var d=null;if((n&3)==3){d=new Date(y,mo-1,day);if(y<100)d.setFullYear(y);}
else if(n<30)
{d=new Date();if(this.date)d.setTime(this.date.getTime());if(day>0)d.setDate(day);if(y>=0)d.setFullYear(y);if(mo>0)d.setMonth(mo-1);}
n&=15;if(day>0&&d!=null)if(day!=d.getDate())n|=8;day=this.good;if(fire&&d==null&&!this.nullable)
{d=day;if(d==null||d.getTime==null){d=new Date();n|=8;}else n|=32;}
if(d!=null)
{if(h>-2)d.setHours((h<0)?0:h);if(m>-2)d.setMinutes((m<0)?0:m);if(s>-2)d.setSeconds((s<0)?0:s);if(ms>-2)d.setMilliseconds((ms<0)?0:ms);if(limit){if((d=this.limits(i=d))!=null)n=16;else d=i;}}
if(fire)
{if(any&&d==null&&t.length>0&&day!=null&&day.getTime!=null){d=day;n=32;}
arg.date=d;if(n<8||(n==8&&!any&&this.nullable))inv="";else
{inv+=(arg.type=(n<16)?2:((n==16)?1:0));if(this.fireEvent(13,null,arg))inv="";d=arg.date;}
this.updatePost(d,inv);if(day!=false)this.good=d;}
return d;}
me.updatePost=function(d,inv)
{if(d!=null)inv=""+d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate()+"-"+d.getHours()+"-"+d.getMinutes()+"-"+d.getSeconds()+"-"+d.getMilliseconds()+inv;this._vs=this.elemViewState.value=inv;this.valid((d==null)?"":this.toTxt(d,true,""));}
me.enter0=function()
{var d=this.toDate(this.elem.value,true);return(d==null)?"":this.toTxt(d,true,"");}
me.toTxt=function(d,foc,prompt,txt)
{var t="",mask=foc?this.mask:this.mask1;if(d==null)return foc?this.getTxt(5,prompt,txt?(this.txt=mask):mask):this.nullText;var ids=foc?this.field0IDs:this.field1IDs;var c,k,i=-1,f0=0;this.d_s=6;while(++i<mask.length)
{c=mask.charAt(i);if((k=mask.charCodeAt(i))<21)
{t+=this.fieldValue(ids[f0++],d,foc,c);if(foc)while(i+1<mask.length)if(mask.charCodeAt(i+1)==k)i++;else break;}
else t+=c;}
if(!foc)return t;if(txt)this.txt=t;return this.getTxt(5,prompt,t);}
me.focusTxt=function(foc,e,t)
{var d=null,prompt="";if(t==null)
{prompt=this.promptChar;if(e==null&&foc)return this.getTxt(5,prompt);if(e!=null&&!foc)
{d=this.toDate(this.elem.value,e==="",true,true);if(!(this.isNull=(d==null)))this.date=d;}
else if(!this.isNull)d=this.date;}
else d=this.toDate(t,foc,true);return this.toTxt(d,foc,prompt,e!=null);}
me.fields1=function(t,foc)
{var ids=foc?this.field0IDs:this.field1IDs;var iLen=ids.length;var j,i=-1,v=-1,field=0,fields=new Array(iLen);while(++i<iLen)fields[i]=-1;if(t==null)return fields;t=t.toUpperCase();i=-1;while(++i<t.length&&field<iLen)
{var k=this.jpn(t.charCodeAt(i))-48,j=ids[field];if(j==20||j==21)j=ids[++field];if(j==14||j==15)
{if(k>=0&&k<=9){v=-1;field++;i--;continue;}
if(this.getAMPM(false).charAt(0).toUpperCase()==t.charAt(i))
{fields[field++]=1;v=-1;}}
else
{if(k>=0&&k<=9){if(v<0)v=k;else v=v*10+k;}
else
{if(v>=0){fields[field++]=v;v=-1;}
else if(j==6||j==7)while(v-->-3)
{for(k=0;k<12;k++)
{var m=this.getMonthNameAt(k).toUpperCase();if((j=m.length)<1)continue;if(v==-3){if(j<4)continue;m=m.substring(0,3);}
if((j=t.indexOf(m)-1)>-2)if(j<0||t.charAt(j).toLowerCase()==t.charAt(j))break;}
if(k<12){fields[field++]=k+1;break;}}}}}
if(field<iLen)fields[field]=v;return fields;}
me.fields0=function(t)
{var fields=new Array();if(t==null)t="";var x,k,j=-1,i=-1,v=-1,field=-1,n=22,m=this.mask;while(++i<m.length)
{j++;if((x=m.charCodeAt(i))>21&&n>21)continue;if(x>21){if(field>=0)fields[field]=v;}

⌨️ 快捷键说明

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