roojs-bootstrap.js
authorEdward <edward@roojs.com>
Thu, 9 Aug 2018 05:23:10 +0000 (13:23 +0800)
committerEdward <edward@roojs.com>
Thu, 9 Aug 2018 05:23:10 +0000 (13:23 +0800)
roojs-bootstrap-debug.js

roojs-bootstrap-debug.js
roojs-bootstrap.js

index 6b2c12e..58112a6 100644 (file)
@@ -8544,6 +8544,7 @@ Roo.form.VTypes = function(){
  * @cfg {String} autocomplete - default is new-password see: https://developers.google.com/web/fundamentals/input/form/label-and-name-inputs?hl=en
  * @cfg {String} indicatorpos (left|right) default left
  * @cfg {String} capture (user|camera) use for file input only. (default empty)
+ * @cfg {String} accept (image|video|audio) use for file input only. (default empty)
 
  * @cfg {String} align (left|center|right) Default left
  * @cfg {Boolean} forceFeedback (true|false) Default false
@@ -8758,6 +8759,7 @@ Roo.extend(Roo.bootstrap.Input, Roo.bootstrap.Component,  {
     labelxs : 0,
     
     capture : '',
+    accept : '',
     
     parentLabelAlign : function()
     {
@@ -8798,6 +8800,10 @@ Roo.extend(Roo.bootstrap.Input, Roo.bootstrap.Component,  {
             input.capture = this.capture;
         }
         
+        if(this.accept.length){
+            input.accept = this.accept + "/*";
+        }
+        
         if(this.align){
             input.style = (typeof(input.style) == 'undefined') ? ('text-align:' + this.align) : (input.style + 'text-align:' + this.align);
         }
index d2fe336..5a6de84 100644 (file)
@@ -343,22 +343,22 @@ Roo.form.VTypes=function(){var A=/^[a-zA-Z_]+$/;var B=/^[a-zA-Z0-9_]+$/;var C=/^
 },'emailText':'This field should be an e-mail address in the format "user@domain.com"','emailMask':/[a-z0-9_\.\-@]/i,'url':function(v){return D.test(v);},'urlText':'This field should be a URL in the format "http:/'+'/www.domain.com"','alpha':function(v){return A.test(v);
 },'alphaText':'This field should only contain letters and _','alphaMask':/[a-z_]/i,'alphanum':function(v){return B.test(v);},'alphanumText':'This field should only contain letters, numbers and _','alphanumMask':/[a-z0-9_]/i};}();
 // Roo/bootstrap/Input.js
-Roo.bootstrap.Input=function(A){Roo.bootstrap.Input.superclass.constructor.call(this,A);this.addEvents({focus:true,blur:true,specialkey:true,change:true,invalid:true,valid:true,keyup:true});};Roo.extend(Roo.bootstrap.Input,Roo.bootstrap.Component,{validationEvent:"keyup",validateOnBlur:true,validationDelay:250,focusClass:"x-form-focus",invalidClass:"has-warning",validClass:"has-success",hasFeedback:true,invalidFeedbackClass:"glyphicon-warning-sign",validFeedbackClass:"glyphicon-ok",selectOnFocus:false,maskRe:null,vtype:null,disableKeyFilter:false,disabled:false,allowBlank:true,blankText:"Please complete this mandatory field",minLength:0,maxLength:Number.MAX_VALUE,minLengthText:"The minimum length for this field is {0}",maxLengthText:"The maximum length for this field is {0}",validator:null,regex:null,regexText:"",invalidText:"",autocomplete:false,fieldLabel:'',inputType:'text',name:false,placeholder:false,before:false,after:false,size:false,hasFocus:false,preventMark:false,isFormField:true,value:'',labelWidth:2,labelAlign:false,readOnly:false,align:false,formatedValue:false,forceFeedback:false,indicatorpos:'left',labellg:0,labelmd:0,labelsm:0,labelxs:0,capture:'',parentLabelAlign:function(){var A=this;
+Roo.bootstrap.Input=function(A){Roo.bootstrap.Input.superclass.constructor.call(this,A);this.addEvents({focus:true,blur:true,specialkey:true,change:true,invalid:true,valid:true,keyup:true});};Roo.extend(Roo.bootstrap.Input,Roo.bootstrap.Component,{validationEvent:"keyup",validateOnBlur:true,validationDelay:250,focusClass:"x-form-focus",invalidClass:"has-warning",validClass:"has-success",hasFeedback:true,invalidFeedbackClass:"glyphicon-warning-sign",validFeedbackClass:"glyphicon-ok",selectOnFocus:false,maskRe:null,vtype:null,disableKeyFilter:false,disabled:false,allowBlank:true,blankText:"Please complete this mandatory field",minLength:0,maxLength:Number.MAX_VALUE,minLengthText:"The minimum length for this field is {0}",maxLengthText:"The maximum length for this field is {0}",validator:null,regex:null,regexText:"",invalidText:"",autocomplete:false,fieldLabel:'',inputType:'text',name:false,placeholder:false,before:false,after:false,size:false,hasFocus:false,preventMark:false,isFormField:true,value:'',labelWidth:2,labelAlign:false,readOnly:false,align:false,formatedValue:false,forceFeedback:false,indicatorpos:'left',labellg:0,labelmd:0,labelsm:0,labelxs:0,capture:'',accept:'',parentLabelAlign:function(){var A=this;
 while(A.parent()){A=A.parent();if(typeof(A.labelAlign)!='undefined'){return A.labelAlign;}}return 'left';},getAutoCreate:function(){var A=(!this.labelAlign)?this.parentLabelAlign():this.labelAlign;var id=Roo.id();var B={};if(this.inputType!='hidden'){B.cls='form-group'}
-var C={tag:'input',id:id,type:this.inputType,value:this.value,cls:'form-control',placeholder:this.placeholder||'',autocomplete:this.autocomplete||'new-password'};if(this.capture.length){C.capture=this.capture;}if(this.align){C.style=(typeof(C.style)=='undefined')?('text-align:'+this.align):(C.style+'text-align:'+this.align);
-}if(this.maxLength&&this.maxLength!=Number.MAX_VALUE){C.maxLength=this.maxLength;}if(this.disabled){C.disabled=true;}if(this.readOnly){C.readonly=true;}if(this.name){C.name=this.name;}if(this.size){C.cls+=' input-'+this.size;}var D=this;['xs','sm','md','lg'].map(function(I){if(D[I]){B.cls+=' col-'+I+'-'+D[I];
-}});var E=C;var F={tag:'span',cls:'glyphicon form-control-feedback'};if(this.hasFeedback&&this.inputType!='hidden'&&!this.allowBlank){E={cls:'has-feedback',cn:[C,F]};}if(this.before||this.after){E={cls:'input-group',cn:[]};if(this.before&&typeof(this.before)=='string'){E.cn.push({tag:'span',cls:'roo-input-before input-group-addon',html:this.before}
-);}if(this.before&&typeof(this.before)=='object'){this.before=Roo.factory(this.before);E.cn.push({tag:'span',cls:'roo-input-before input-group-'+(this.before.xtype=='Button'?'btn':'addon')});}E.cn.push(C);if(this.after&&typeof(this.after)=='string'){E.cn.push({tag:'span',cls:'roo-input-after input-group-addon',html:this.after}
-);}if(this.after&&typeof(this.after)=='object'){this.after=Roo.factory(this.after);E.cn.push({tag:'span',cls:'roo-input-after input-group-'+(this.after.xtype=='Button'?'btn':'addon')});}if(this.hasFeedback&&this.inputType!='hidden'&&!this.allowBlank){E.cls+=' has-feedback';
-E.cn.push(F);}};if(A==='left'&&this.fieldLabel.length){B.cls+=' roo-form-group-label-left';B.cn=[{tag:'i',cls:'roo-required-indicator left-indicator text-danger fa fa-lg fa-star',tooltip:'This field is required'},{tag:'label','for':id,cls:'control-label',html:this.fieldLabel}
-,{cls:"",cn:[E]}];var G=B.cn[1];var H=B.cn[2];if(this.indicatorpos=='right'){B.cn=[{tag:'label','for':id,cls:'control-label',cn:[{tag:'span',html:this.fieldLabel},{tag:'i',cls:'roo-required-indicator right-indicator text-danger fa fa-lg fa-star',tooltip:'This field is required'}
-]},{cls:"",cn:[E]}];G=B.cn[0];H=B.cn[1];}if(this.labelWidth>12){G.style="width: "+this.labelWidth+'px';}if(this.labelWidth<13&&this.labelmd==0){this.labelmd=this.labelWidth;}if(this.labellg>0){G.cls+=' col-lg-'+this.labellg;H.cls+=' col-lg-'+(12-this.labellg);
-}if(this.labelmd>0){G.cls+=' col-md-'+this.labelmd;H.cls+=' col-md-'+(12-this.labelmd);}if(this.labelsm>0){G.cls+=' col-sm-'+this.labelsm;H.cls+=' col-sm-'+(12-this.labelsm);}if(this.labelxs>0){G.cls+=' col-xs-'+this.labelxs;H.cls+=' col-xs-'+(12-this.labelxs);
-}}else if(this.fieldLabel.length){B.cn=[{tag:'i',cls:'roo-required-indicator left-indicator text-danger fa fa-lg fa-star',tooltip:'This field is required'},{tag:'label',html:this.fieldLabel},E];if(this.indicatorpos=='right'){B.cn=[{tag:'label',html:this.fieldLabel}
-,{tag:'i',cls:'roo-required-indicator right-indicator text-danger fa fa-lg fa-star',tooltip:'This field is required'},E];}}else{B.cn=[E];};if(this.parentType==='Navbar'&&this.parent().bar){B.cls+=' navbar-form';}if(this.parentType==='NavGroup'){B.cls+=' navbar-form';
-B.tag='li';}return B;},inputEl:function(){return this.el.select('input.form-control',true).first();},tooltipEl:function(){return this.inputEl();},indicatorEl:function(){var A=this.el.select('i.roo-required-indicator',true).first();if(!A){return false;}return A;
-},setDisabled:function(v){var i=this.inputEl().dom;if(!v){i.removeAttribute('disabled');return;}i.setAttribute('disabled','true');},initEvents:function(){this.inputEl().on("keydown",this.fireKey,this);this.inputEl().on("focus",this.onFocus,this);this.inputEl().on("blur",this.onBlur,this);
-this.inputEl().relayEvent('keyup',this);this.indicator=this.indicatorEl();if(this.indicator){this.indicator.addClass('invisible');}this.originalValue=this.getValue();if(this.validationEvent=='keyup'){this.validationTask=new Roo.util.DelayedTask(this.validate,this);
+var C={tag:'input',id:id,type:this.inputType,value:this.value,cls:'form-control',placeholder:this.placeholder||'',autocomplete:this.autocomplete||'new-password'};if(this.capture.length){C.capture=this.capture;}if(this.accept.length){C.accept=this.accept+"/*";
+}if(this.align){C.style=(typeof(C.style)=='undefined')?('text-align:'+this.align):(C.style+'text-align:'+this.align);}if(this.maxLength&&this.maxLength!=Number.MAX_VALUE){C.maxLength=this.maxLength;}if(this.disabled){C.disabled=true;}if(this.readOnly){C.readonly=true;
+}if(this.name){C.name=this.name;}if(this.size){C.cls+=' input-'+this.size;}var D=this;['xs','sm','md','lg'].map(function(I){if(D[I]){B.cls+=' col-'+I+'-'+D[I];}});var E=C;var F={tag:'span',cls:'glyphicon form-control-feedback'};if(this.hasFeedback&&this.inputType!='hidden'&&!this.allowBlank){E={cls:'has-feedback',cn:[C,F]}
+;}if(this.before||this.after){E={cls:'input-group',cn:[]};if(this.before&&typeof(this.before)=='string'){E.cn.push({tag:'span',cls:'roo-input-before input-group-addon',html:this.before});}if(this.before&&typeof(this.before)=='object'){this.before=Roo.factory(this.before);
+E.cn.push({tag:'span',cls:'roo-input-before input-group-'+(this.before.xtype=='Button'?'btn':'addon')});}E.cn.push(C);if(this.after&&typeof(this.after)=='string'){E.cn.push({tag:'span',cls:'roo-input-after input-group-addon',html:this.after});}if(this.after&&typeof(this.after)=='object'){this.after=Roo.factory(this.after);
+E.cn.push({tag:'span',cls:'roo-input-after input-group-'+(this.after.xtype=='Button'?'btn':'addon')});}if(this.hasFeedback&&this.inputType!='hidden'&&!this.allowBlank){E.cls+=' has-feedback';E.cn.push(F);}};if(A==='left'&&this.fieldLabel.length){B.cls+=' roo-form-group-label-left';
+B.cn=[{tag:'i',cls:'roo-required-indicator left-indicator text-danger fa fa-lg fa-star',tooltip:'This field is required'},{tag:'label','for':id,cls:'control-label',html:this.fieldLabel},{cls:"",cn:[E]}];var G=B.cn[1];var H=B.cn[2];if(this.indicatorpos=='right'){B.cn=[{tag:'label','for':id,cls:'control-label',cn:[{tag:'span',html:this.fieldLabel}
+,{tag:'i',cls:'roo-required-indicator right-indicator text-danger fa fa-lg fa-star',tooltip:'This field is required'}]},{cls:"",cn:[E]}];G=B.cn[0];H=B.cn[1];}if(this.labelWidth>12){G.style="width: "+this.labelWidth+'px';}if(this.labelWidth<13&&this.labelmd==0){this.labelmd=this.labelWidth;
+}if(this.labellg>0){G.cls+=' col-lg-'+this.labellg;H.cls+=' col-lg-'+(12-this.labellg);}if(this.labelmd>0){G.cls+=' col-md-'+this.labelmd;H.cls+=' col-md-'+(12-this.labelmd);}if(this.labelsm>0){G.cls+=' col-sm-'+this.labelsm;H.cls+=' col-sm-'+(12-this.labelsm);
+}if(this.labelxs>0){G.cls+=' col-xs-'+this.labelxs;H.cls+=' col-xs-'+(12-this.labelxs);}}else if(this.fieldLabel.length){B.cn=[{tag:'i',cls:'roo-required-indicator left-indicator text-danger fa fa-lg fa-star',tooltip:'This field is required'},{tag:'label',html:this.fieldLabel}
+,E];if(this.indicatorpos=='right'){B.cn=[{tag:'label',html:this.fieldLabel},{tag:'i',cls:'roo-required-indicator right-indicator text-danger fa fa-lg fa-star',tooltip:'This field is required'},E];}}else{B.cn=[E];};if(this.parentType==='Navbar'&&this.parent().bar){B.cls+=' navbar-form';
+}if(this.parentType==='NavGroup'){B.cls+=' navbar-form';B.tag='li';}return B;},inputEl:function(){return this.el.select('input.form-control',true).first();},tooltipEl:function(){return this.inputEl();},indicatorEl:function(){var A=this.el.select('i.roo-required-indicator',true).first();
+if(!A){return false;}return A;},setDisabled:function(v){var i=this.inputEl().dom;if(!v){i.removeAttribute('disabled');return;}i.setAttribute('disabled','true');},initEvents:function(){this.inputEl().on("keydown",this.fireKey,this);this.inputEl().on("focus",this.onFocus,this);
+this.inputEl().on("blur",this.onBlur,this);this.inputEl().relayEvent('keyup',this);this.indicator=this.indicatorEl();if(this.indicator){this.indicator.addClass('invisible');}this.originalValue=this.getValue();if(this.validationEvent=='keyup'){this.validationTask=new Roo.util.DelayedTask(this.validate,this);
 this.inputEl().on('keyup',this.filterValidation,this);}else if(this.validationEvent!==false){this.inputEl().on(this.validationEvent,this.validate,this,{buffer:this.validationDelay});}if(this.selectOnFocus){this.on("focus",this.preFocus,this);}if(this.maskRe||(this.vtype&&this.disableKeyFilter!==true&&(this.maskRe=Roo.form.VTypes[this.vtype+'Mask']))){this.inputEl().on("keypress",this.filterKeys,this);
 }else{this.inputEl().relayEvent('keypress',this);}if(this.inputEl().is('input[type=password]')&&Roo.isSafari){this.inputEl().on('keydown',this.SafariOnKeyDown,this);}if(typeof(this.before)=='object'){this.before.render(this.el.select('.roo-input-before',true).first());
 }if(typeof(this.after)=='object'){this.after.render(this.el.select('.roo-input-after',true).first());}this.inputEl().on('change',this.onChange,this);},filterValidation:function(e){if(!e.isNavKeyPress()){this.validationTask.delay(this.validationDelay);}},validate:function(){if(this.disabled||this.validateValue(this.getRawValue())){this.markValid();