Roo/bootstrap/TimeField.js
authorEdward <edward@roojs.com>
Fri, 30 May 2014 05:37:09 +0000 (13:37 +0800)
committerEdward <edward@roojs.com>
Fri, 30 May 2014 05:37:09 +0000 (13:37 +0800)
roojs-bootstrap.js
roojs-bootstrap-debug.js

Roo/bootstrap/TimeField.js
roojs-bootstrap-debug.js
roojs-bootstrap.js

index 3c54ba2..663b31a 100644 (file)
@@ -124,6 +124,7 @@ Roo.extend(Roo.bootstrap.TimeField, Roo.bootstrap.Input,  {
         this.el.select('>.input-group', true).first().createChild(Roo.bootstrap.TimeField.template);
         
         this.picker().setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
+        this.picker().select('>.datepicker-time',true).first().setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
         
         this.picker().on('mousedown', this.onMousedown, this);
         this.picker().on('click', this.onClick, this);
@@ -431,6 +432,7 @@ Roo.extend(Roo.bootstrap.TimeField, Roo.bootstrap.Input,  {
     show : function()
     {
         this.picker().show();
+        this.picker().select('>.datepicker-time',true).first().show();
         this.update();
         this.place();
     },
@@ -438,6 +440,7 @@ Roo.extend(Roo.bootstrap.TimeField, Roo.bootstrap.Input,  {
     hide : function()
     {
         this.picker().hide();
+        this.picker().select('>.datepicker-time',true).first().hide();
         
     },
     
index e23e261..3727648 100644 (file)
@@ -11892,6 +11892,7 @@ Roo.extend(Roo.bootstrap.TimeField, Roo.bootstrap.Input,  {
         this.el.select('>.input-group', true).first().createChild(Roo.bootstrap.TimeField.template);
         
         this.picker().setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
+        this.picker().select('>.datepicker-time',true).first().setVisibilityMode(Roo.Element.DISPLAY).originalDisplay = 'block';
         
         this.picker().on('mousedown', this.onMousedown, this);
         this.picker().on('click', this.onClick, this);
@@ -12199,6 +12200,7 @@ Roo.extend(Roo.bootstrap.TimeField, Roo.bootstrap.Input,  {
     show : function()
     {
         this.picker().show();
+        this.picker().select('>.datepicker-time',true).first().show();
         this.update();
         this.place();
     },
@@ -12206,6 +12208,7 @@ Roo.extend(Roo.bootstrap.TimeField, Roo.bootstrap.Input,  {
     hide : function()
     {
         this.picker().hide();
+        this.picker().select('>.datepicker-time',true).first().hide();
         
     },
     
index 6f6acba..311013f 100644 (file)
@@ -272,8 +272,8 @@ this.update();this.updateNavArrows();},setEndDate:function(A){this.endDate=A||In
 this.update();this.updateNavArrows();},setDaysOfWeekDisabled:function(A){this.daysOfWeekDisabled=A||[];if(typeof(this.daysOfWeekDisabled)!=='object'){this.daysOfWeekDisabled=this.daysOfWeekDisabled.split(/,\s*/);}
 this.daysOfWeekDisabled=this.daysOfWeekDisabled.map(function(d){return parseInt(d,10);});this.update();this.updateNavArrows();},updateNavArrows:function(){var d=new Date(this.viewDate),A=d.getUTCFullYear(),B=d.getUTCMonth();Roo.each(this.picker().select('.prev',true).elements,function(v){v.show();switch(this.viewMode){case 0:if(this.startDate!==-Infinity&&A<=this.startDate.getUTCFullYear()&&B<=this.startDate.getUTCMonth()){v.hide();}break;case 1:case 2:if(this.startDate!==-Infinity&&A<=this.startDate.getUTCFullYear()){v.hide();}break;}});Roo.each(this.picker().select('.next',true).elements,function(v){v.show();switch(this.viewMode){case 0:if(this.endDate!==Infinity&&A>=this.endDate.getUTCFullYear()&&B>=this.endDate.getUTCMonth()){v.hide();}break;case 1:case 2:if(this.endDate!==Infinity&&A>=this.endDate.getUTCFullYear()){v.hide();}break;}})},moveMonth:function(A,B){if(!B)return A;var C=new Date(A.valueOf()),D=C.getUTCDate(),E=C.getUTCMonth(),F=Math.abs(B),G,H;B=B>0?1:-1;if(F==1){H=B==-1?function(){return C.getUTCMonth()==E;}:function(){return C.getUTCMonth()!=G;};G=E+B;C.setUTCMonth(G);if(G<0||G>11)G=(G+12)%12;}else {for(var i=0;i<F;i++)C=this.moveMonth(C,B);G=C.getUTCMonth();C.setUTCDate(D);H=function(){return G!=C.getUTCMonth();};}while(H()){C.setUTCDate(--D);C.setUTCMonth(G);}return C;},moveYear:function(A,B){return this.moveMonth(A,B*12);},dateWithinRange:function(A){return A>=this.startDate&&A<=this.endDate;},remove:function(){this.picker().remove();}});Roo.apply(Roo.bootstrap.DateField,{head:{tag:'thead',cn:[{tag:'tr',cn:[{tag:'th',cls:'prev',html:'<i class="icon-arrow-left"/>'},{tag:'th',cls:'switch',colspan:'5'},{tag:'th',cls:'next',html:'<i class="icon-arrow-right"/>'}]}]},content:{tag:'tbody',cn:[{tag:'tr',cn:[{tag:'td',colspan:'7'}]}]},footer:{tag:'tfoot',cn:[{tag:'tr',cn:[{tag:'th',colspan:'7',cls:'today'}]}]},dates:{en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],today:"Today"}},modes:[{clsName:'days',navFnc:'Month',navStep:1},{clsName:'months',navFnc:'FullYear',navStep:1},{clsName:'years',navFnc:'FullYear',navStep:10}]});Roo.apply(Roo.bootstrap.DateField,{template:{tag:'div',cls:'datepicker dropdown-menu',cn:[{tag:'div',cls:'datepicker-days',cn:[{tag:'table',cls:'table-condensed',cn:[Roo.bootstrap.DateField.head,{tag:'tbody'},Roo.bootstrap.DateField.footer]}]},{tag:'div',cls:'datepicker-months',cn:[{tag:'table',cls:'table-condensed',cn:[Roo.bootstrap.DateField.head,Roo.bootstrap.DateField.content,Roo.bootstrap.DateField.footer]}]},{tag:'div',cls:'datepicker-years',cn:[{tag:'table',cls:'table-condensed',cn:[Roo.bootstrap.DateField.head,Roo.bootstrap.DateField.content,Roo.bootstrap.DateField.footer]}]}]}});
 //Roo/bootstrap/TimeField.js
-Roo.bootstrap.TimeField=function(A){Roo.bootstrap.TimeField.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.TimeField,Roo.bootstrap.Input,{format:"H:i",UTCDate:function(){return new Date(Date.UTC.apply(Date,arguments));},UTCTime:function(){return new Date(Date.UTC.apply(Date,arguments));},UTCToday:function(){var A=new Date();return this.UTCDate(A.getUTCFullYear(),A.getUTCMonth(),A.getUTCDate());},UTCTodayTime:function(){var A=new Date();return this.UTCTime(A.getUTCFullYear(),A.getUTCMonth(),A.getUTCDate(),A.getUTCHours(),A.getUTCMinutes());},getDate:function(){var d=this.getUTCDate();return new Date(d.getTime()+(d.getTimezoneOffset()*60000));},getUTCDate:function(){return this.date;},setDate:function(d){this.setUTCDate(new Date(d.getTime()-(d.getTimezoneOffset()*60000)));},setUTCDate:function(d){this.date=d;this.setValue(this.formatDate(this.date));},onRender:function(ct,A){Roo.bootstrap.TimeField.superclass.onRender.call(this,ct,A);this.el.select('>.input-group',true).first().createChild(Roo.bootstrap.TimeField.template);this.picker().setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';this.picker().on('mousedown',this.onMousedown,this);this.picker().on('click',this.onClick,this);this.picker().addClass('datepicker-dropdown');this.fillTime();this.update();var B=this.picker().select('>.datepicker-time span.hours-up',true).first();var C=this.picker().select('>.datepicker-time span.hours-down',true).first();var D=this.picker().select('>.datepicker-time span.minutes-up',true).first();var E=this.picker().select('>.datepicker-time span.minutes-down',true).first();var F=this.picker().select('>.datepicker-time button',true).first();B.on('click',this.onIncrementHours,B);C.on('click',this.onDecrementHours,C);D.on('click',this.onIncrementMinutes,D);E.on('click',this.onDecrementMinutes,E);F.on('click',this.onTogglePeriod,F);},picker:function(){return this.el.select('.datepicker',true).first();},fillTime:function(){var A=this.picker().select('>.datepicker-time tbody',true).first();A.dom.innerHTML='';A.createChild({tag:'tr',cn:[{tag:'td',cn:[{tag:'a',href:'#',cls:'btn',cn:[{tag:'span',cls:'hours-up glyphicon glyphicon-chevron-up'}]}]},{tag:'td',cls:'separator'},{tag:'td',cn:[{tag:'a',href:'#',cls:'btn',cn:[{tag:'span',cls:'minutes-up glyphicon glyphicon-chevron-up'}]}]},{tag:'td',cls:'separator'}]});A.createChild({tag:'tr',cn:[{tag:'td',cn:[{tag:'span',cls:'timepicker-hour',html:'00'}]},{tag:'td',cls:'separator',html:':'},{tag:'td',cn:[{tag:'span',cls:'timepicker-minute',html:'00'}]},{tag:'td',cls:'separator'},{tag:'td',cn:[{tag:'button',type:'button',cls:'btn btn-primary',html:'AM'}]}]});A.createChild({tag:'tr',cn:[{tag:'td',cn:[{tag:'a',href:'#',cls:'btn',cn:[{tag:'span',cls:'hours-down glyphicon glyphicon-chevron-down'}]}]},{tag:'td',cls:'separator'},{tag:'td',cn:[{tag:'a',href:'#',cls:'btn',cn:[{tag:'span',cls:'minutes-down glyphicon glyphicon-chevron-down'}]}]},{tag:'td',cls:'separator'}]});},update:function(){this.time=(typeof(this.time)==='undefined')?new Date():this.time;this.fill();},fill:function(){Roo.log('fill!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1');Roo.log(this.time);Roo.log(this.time.getHours());Roo.log(this.time.getMinutes());},place:function(){this.picker().removeClass(['bottom','top']);if((Roo.lib.Dom.getViewHeight()+Roo.get(document.body).getScroll().top)-(this.inputEl().getBottom()+this.picker().getHeight())<0){this.picker().addClass('top');this.picker().setTop(0-this.picker().getHeight()).setLeft(this.inputEl().getLeft()-this.el.getLeft());return;}
-this.picker().addClass('bottom');this.picker().setTop(this.inputEl().getHeight()).setLeft(this.inputEl().getLeft()-this.el.getLeft());},onFocus:function(){Roo.bootstrap.TimeField.superclass.onFocus.call(this);this.show();},onBlur:function(){Roo.bootstrap.TimeField.superclass.onBlur.call(this);this.hide();},show:function(){this.picker().show();this.update();this.place();},hide:function(){this.picker().hide();},onMousedown:function(e){e.stopPropagation();e.preventDefault();},onClick:function(e){e.stopPropagation();e.preventDefault();var A=e.getTarget();var B=A.nodeName.trim();var C=A.className.trim();var D=A.innerHTML;Roo.log('nodeName');Roo.log(B);Roo.log('className');Roo.log(C);Roo.log('html');Roo.log(D);},onIncrementHours:function(){Roo.log('onIncrementHours');},onDecrementHours:function(){Roo.log('onDecrementHours');},onIncrementMinutes:function(){Roo.log('onIncrementMinutes');},onDecrementMinutes:function(){Roo.log('onDecrementMinutes');},onTogglePeriod:function(){Roo.log('onTogglePeriod');}});Roo.apply(Roo.bootstrap.TimeField,{content:{tag:'tbody',cn:[{tag:'tr',cn:[{tag:'td',colspan:'7'}]}]}});Roo.apply(Roo.bootstrap.TimeField,{template:{tag:'div',cls:'datepicker dropdown-menu',cn:[{tag:'div',cls:'datepicker-time',cn:[{tag:'table',cls:'table-condensed',cn:[Roo.bootstrap.DateField.content]}]}]}});
+Roo.bootstrap.TimeField=function(A){Roo.bootstrap.TimeField.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.TimeField,Roo.bootstrap.Input,{format:"H:i",UTCDate:function(){return new Date(Date.UTC.apply(Date,arguments));},UTCTime:function(){return new Date(Date.UTC.apply(Date,arguments));},UTCToday:function(){var A=new Date();return this.UTCDate(A.getUTCFullYear(),A.getUTCMonth(),A.getUTCDate());},UTCTodayTime:function(){var A=new Date();return this.UTCTime(A.getUTCFullYear(),A.getUTCMonth(),A.getUTCDate(),A.getUTCHours(),A.getUTCMinutes());},getDate:function(){var d=this.getUTCDate();return new Date(d.getTime()+(d.getTimezoneOffset()*60000));},getUTCDate:function(){return this.date;},setDate:function(d){this.setUTCDate(new Date(d.getTime()-(d.getTimezoneOffset()*60000)));},setUTCDate:function(d){this.date=d;this.setValue(this.formatDate(this.date));},onRender:function(ct,A){Roo.bootstrap.TimeField.superclass.onRender.call(this,ct,A);this.el.select('>.input-group',true).first().createChild(Roo.bootstrap.TimeField.template);this.picker().setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';this.picker().select('>.datepicker-time',true).first().setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';this.picker().on('mousedown',this.onMousedown,this);this.picker().on('click',this.onClick,this);this.picker().addClass('datepicker-dropdown');this.fillTime();this.update();var B=this.picker().select('>.datepicker-time span.hours-up',true).first();var C=this.picker().select('>.datepicker-time span.hours-down',true).first();var D=this.picker().select('>.datepicker-time span.minutes-up',true).first();var E=this.picker().select('>.datepicker-time span.minutes-down',true).first();var F=this.picker().select('>.datepicker-time button',true).first();B.on('click',this.onIncrementHours,B);C.on('click',this.onDecrementHours,C);D.on('click',this.onIncrementMinutes,D);E.on('click',this.onDecrementMinutes,E);F.on('click',this.onTogglePeriod,F);},picker:function(){return this.el.select('.datepicker',true).first();},fillTime:function(){var A=this.picker().select('>.datepicker-time tbody',true).first();A.dom.innerHTML='';A.createChild({tag:'tr',cn:[{tag:'td',cn:[{tag:'a',href:'#',cls:'btn',cn:[{tag:'span',cls:'hours-up glyphicon glyphicon-chevron-up'}]}]},{tag:'td',cls:'separator'},{tag:'td',cn:[{tag:'a',href:'#',cls:'btn',cn:[{tag:'span',cls:'minutes-up glyphicon glyphicon-chevron-up'}]}]},{tag:'td',cls:'separator'}]});A.createChild({tag:'tr',cn:[{tag:'td',cn:[{tag:'span',cls:'timepicker-hour',html:'00'}]},{tag:'td',cls:'separator',html:':'},{tag:'td',cn:[{tag:'span',cls:'timepicker-minute',html:'00'}]},{tag:'td',cls:'separator'},{tag:'td',cn:[{tag:'button',type:'button',cls:'btn btn-primary',html:'AM'}]}]});A.createChild({tag:'tr',cn:[{tag:'td',cn:[{tag:'a',href:'#',cls:'btn',cn:[{tag:'span',cls:'hours-down glyphicon glyphicon-chevron-down'}]}]},{tag:'td',cls:'separator'},{tag:'td',cn:[{tag:'a',href:'#',cls:'btn',cn:[{tag:'span',cls:'minutes-down glyphicon glyphicon-chevron-down'}]}]},{tag:'td',cls:'separator'}]});},update:function(){this.time=(typeof(this.time)==='undefined')?new Date():this.time;this.fill();},fill:function(){Roo.log('fill!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1');Roo.log(this.time);Roo.log(this.time.getHours());Roo.log(this.time.getMinutes());},place:function(){this.picker().removeClass(['bottom','top']);if((Roo.lib.Dom.getViewHeight()+Roo.get(document.body).getScroll().top)-(this.inputEl().getBottom()+this.picker().getHeight())<0){this.picker().addClass('top');this.picker().setTop(0-this.picker().getHeight()).setLeft(this.inputEl().getLeft()-this.el.getLeft());return;}
+this.picker().addClass('bottom');this.picker().setTop(this.inputEl().getHeight()).setLeft(this.inputEl().getLeft()-this.el.getLeft());},onFocus:function(){Roo.bootstrap.TimeField.superclass.onFocus.call(this);this.show();},onBlur:function(){Roo.bootstrap.TimeField.superclass.onBlur.call(this);this.hide();},show:function(){this.picker().show();this.picker().select('>.datepicker-time',true).first().show();this.update();this.place();},hide:function(){this.picker().hide();this.picker().select('>.datepicker-time',true).first().hide();},onMousedown:function(e){e.stopPropagation();e.preventDefault();},onClick:function(e){e.stopPropagation();e.preventDefault();var A=e.getTarget();var B=A.nodeName.trim();var C=A.className.trim();var D=A.innerHTML;Roo.log('nodeName');Roo.log(B);Roo.log('className');Roo.log(C);Roo.log('html');Roo.log(D);},onIncrementHours:function(){Roo.log('onIncrementHours');},onDecrementHours:function(){Roo.log('onDecrementHours');},onIncrementMinutes:function(){Roo.log('onIncrementMinutes');},onDecrementMinutes:function(){Roo.log('onDecrementMinutes');},onTogglePeriod:function(){Roo.log('onTogglePeriod');}});Roo.apply(Roo.bootstrap.TimeField,{content:{tag:'tbody',cn:[{tag:'tr',cn:[{tag:'td',colspan:'7'}]}]}});Roo.apply(Roo.bootstrap.TimeField,{template:{tag:'div',cls:'datepicker dropdown-menu',cn:[{tag:'div',cls:'datepicker-time',cn:[{tag:'table',cls:'table-condensed',cn:[Roo.bootstrap.DateField.content]}]}]}});
 //Roo/bootstrap/CheckBox.js
 Roo.bootstrap.CheckBox=function(A){Roo.bootstrap.CheckBox.superclass.constructor.call(this,A);this.addEvents({check:true});};Roo.extend(Roo.bootstrap.CheckBox,Roo.bootstrap.Input,{inputType:'checkbox',value:1,valueOff:0,boxLabel:false,checked:false,getAutoCreate:function(){var A=(!this.labelAlign)?this.parentLabelAlign():this.labelAlign;var id=Roo.id();var B={};B.cls='form-group'var C={tag:'input',id:id,type:this.inputType,value:(!this.checked)?this.valueOff:this.value,cls:'form-box',placeholder:this.placeholder||''};if(this.disabled){C.disabled=true;}if(this.checked){C.checked=this.checked;}if(this.name){C.name=this.name;}if(this.size){C.cls+=' input-'+this.size;}var D=this;['xs','sm','md','lg'].map(function(F){if(D[F]){B.cls+=' col-'+F+'-'+D[F];}});var E=C;if(this.before||this.after){E={cls:'input-group',cn:[]};if(this.before){E.cn.push({tag:'span',cls:'input-group-addon',html:this.before});}
 E.cn.push(C);if(this.after){E.cn.push({tag:'span',cls:'input-group-addon',html:this.after});}};if(A==='left'&&this.fieldLabel.length){Roo.log("left and has label");B.cn=[{tag:'label','for':id,cls:'control-label col-md-'+this.labelWidth,html:this.fieldLabel},{cls:"col-md-"+(12-this.labelWidth),cn:[E]}];}else if(this.fieldLabel.length){Roo.log(" label");B.cn=[{tag:'label','for':id,cls:'control-label box-input-label',html:this.fieldLabel},E];}else {Roo.log(" no label && no align");B.cn=[E];};if(this.boxLabel){B.cn.push({tag:'span','for':id,cls:'box-label',html:this.boxLabel})}return B;},inputEl:function(){return this.el.select('input.form-box',true).first();},initEvents:function(){Roo.bootstrap.CheckBox.superclass.initEvents.call(this);this.inputEl().on('click',this.onClick,this);},onClick:function(){this.setChecked(!this.checked);},setChecked:function(A,B){this.checked=A;if(B!==true){this.fireEvent('check',this,A);}