Roo/bootstrap/TriggerField.js
authorAlan Knowles <alan@roojs.com>
Thu, 29 Nov 2018 03:41:23 +0000 (11:41 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 29 Nov 2018 03:41:23 +0000 (11:41 +0800)
roojs-bootstrap.js
roojs-bootstrap-debug.js

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

index 6151bc8..a1ee7e8 100644 (file)
@@ -191,42 +191,35 @@ Roo.extend(Roo.bootstrap.TriggerField, Roo.bootstrap.Input,  {
             
         };
         
+        var ibwrap = inputbox;
+        
         if(this.multiple){
-            box = {
-                tag: 'div',
-                cn: [
-                    {
-                        tag: 'input',
-                        type : 'hidden',
-                        cls: 'form-hidden-field'
-                    },
+            ibwrap = {
+                tag: 'ul',
+                cls: 'roo-select2-choices',
+                cn:[
                     {
-                        tag: 'ul',
-                        cls: 'roo-select2-choices',
-                        cn:[
-                            {
-                                tag: 'li',
-                                cls: 'roo-select2-search-field',
-                                cn: [
+                        tag: 'li',
+                        cls: 'roo-select2-search-field',
+                        cn: [
 
-                                    inputblock
-                                ]
-                            }
+                            inputblock
                         ]
                     }
                 ]
-            }
-        };
+            };
+                
+        }
         
         var combobox = {
             cls: 'roo-select2-container input-group',
             cn: [
-                box
-//                {
-//                    tag: 'ul',
-//                    cls: 'typeahead typeahead-long dropdown-menu',
-//                    style: 'display:none'
-//                }
+                 {
+                    tag: 'input',
+                    type : 'hidden',
+                    cls: 'form-hidden-field'
+                },
+                ibwrap
             ]
         };
         
index 3a53e70..2352485 100644 (file)
@@ -10395,42 +10395,35 @@ Roo.extend(Roo.bootstrap.TriggerField, Roo.bootstrap.Input,  {
             
         };
         
+        var ibwrap = inputbox;
+        
         if(this.multiple){
-            box = {
-                tag: 'div',
-                cn: [
-                    {
-                        tag: 'input',
-                        type : 'hidden',
-                        cls: 'form-hidden-field'
-                    },
+            ibwrap = {
+                tag: 'ul',
+                cls: 'roo-select2-choices',
+                cn:[
                     {
-                        tag: 'ul',
-                        cls: 'roo-select2-choices',
-                        cn:[
-                            {
-                                tag: 'li',
-                                cls: 'roo-select2-search-field',
-                                cn: [
+                        tag: 'li',
+                        cls: 'roo-select2-search-field',
+                        cn: [
 
-                                    inputblock
-                                ]
-                            }
+                            inputblock
                         ]
                     }
                 ]
-            }
-        };
+            };
+                
+        }
         
         var combobox = {
             cls: 'roo-select2-container input-group',
             cn: [
-                box
-//                {
-//                    tag: 'ul',
-//                    cls: 'typeahead typeahead-long dropdown-menu',
-//                    style: 'display:none'
-//                }
+                 {
+                    tag: 'input',
+                    type : 'hidden',
+                    cls: 'form-hidden-field'
+                },
+                ibwrap
             ]
         };
         
index 785260d..68cfb5e 100644 (file)
@@ -425,13 +425,13 @@ var id=Roo.id();var B={cls:'form-group'};var C={tag:'input',id:id,type:this.inpu
 }var D=C;if(this.hasFeedback&&!this.allowBlank){var E={tag:'span',cls:'glyphicon form-control-feedback'};if(this.removable&&!this.editable&&!this.tickable){D={cls:'has-feedback',cn:[D,{tag:'button',html:'x',cls:'roo-combo-removable-btn close'},E]};}else{D={cls:'has-feedback',cn:[D,E]}
 ;}}else{if(this.removable&&!this.editable&&!this.tickable){D={cls:'roo-removable',cn:[D,{tag:'button',html:'x',cls:'roo-combo-removable-btn close'}]};}}if(this.before||this.after){D={cls:'input-group',cn:[]};if(this.before){D.cn.push({tag:'span',cls:'input-group-addon input-group-prepend input-group-text',html:this.before}
 );}D.cn.push(C);if(this.hasFeedback&&!this.allowBlank){D.cls+=' has-feedback';D.cn.push(E);}if(this.after){D.cn.push({tag:'span',cls:'input-group-addon input-group-append input-group-text',html:this.after});}};var F={tag:'div',cn:[{tag:'input',type:'hidden',cls:'form-hidden-field'}
-,D]};if(this.multiple){F={tag:'div',cn:[{tag:'input',type:'hidden',cls:'form-hidden-field'},{tag:'ul',cls:'roo-select2-choices',cn:[{tag:'li',cls:'roo-select2-search-field',cn:[D]}]}]}};var G={cls:'roo-select2-container input-group',cn:[F]};if(!this.multiple&&this.showToggleBtn){var H={tag:'span',cls:'caret'}
-;if(this.caret!=false){H={tag:'i',cls:'fa fa-'+this.caret};}G.cn.push({tag:'span',cls:'input-group-addon input-group-append input-group-text btn dropdown-toggle',cn:[H,{tag:'span',cls:'combobox-clear',cn:[{tag:'i',cls:'icon-remove'}]}]})}if(this.multiple){G.cls+=' roo-select2-container-multi';
-}var I={tag:'i',cls:'roo-required-indicator '+(this.indicatorpos=='right'?'right':'left')+'-indicator text-danger fa fa-lg fa-star',tooltip:'This field is required'};if(Roo.bootstrap.version==4){I={tag:'i',style:'display:none'};}if(A==='left'&&this.fieldLabel.length){B.cls+=' roo-form-group-label-left row';
-B.cn=[I,{tag:'label','for':id,cls:'control-label',html:this.fieldLabel},{cls:"",cn:[G]}];var J=B.cn[1];var K=B.cn[2];if(this.indicatorpos=='right'){B.cn=[{tag:'label','for':id,cls:'control-label',cn:[{tag:'span',html:this.fieldLabel},I]},{cls:"",cn:[G]}];
-J=B.cn[0];K=B.cn[1];}if(this.labelWidth>12){J.style="width: "+this.labelWidth+'px';}if(this.labelWidth<13&&this.labelmd==0){this.labelmd=this.labelWidth;}if(this.labellg>0){J.cls+=' col-lg-'+this.labellg;K.cls+=' col-lg-'+(12-this.labellg);}if(this.labelmd>0){J.cls+=' col-md-'+this.labelmd;
-K.cls+=' col-md-'+(12-this.labelmd);}if(this.labelsm>0){J.cls+=' col-sm-'+this.labelsm;K.cls+=' col-sm-'+(12-this.labelsm);}if(this.labelxs>0){J.cls+=' col-xs-'+this.labelxs;K.cls+=' col-xs-'+(12-this.labelxs);}}else if(this.fieldLabel.length){B.cn=[I,{tag:'label',html:this.fieldLabel}
-,G];if(this.indicatorpos=='right'){B.cn=[{tag:'label',cn:[{tag:'span',html:this.fieldLabel},I]},G];}}else{B=G}var L=this;['xs','sm','md','lg'].map(function(M){if(L[M]){B.cls+=' col-'+M+'-'+L[M];}});return B;},onResize:function(w,h){},adjustSize:Roo.BoxComponent.prototype.adjustSize,getResizeEl:function(){return this.inputEl();
+,D]};var G=inputbox;if(this.multiple){G={tag:'ul',cls:'roo-select2-choices',cn:[{tag:'li',cls:'roo-select2-search-field',cn:[D]}]};}var H={cls:'roo-select2-container input-group',cn:[{tag:'input',type:'hidden',cls:'form-hidden-field'},G]};if(!this.multiple&&this.showToggleBtn){var I={tag:'span',cls:'caret'}
+;if(this.caret!=false){I={tag:'i',cls:'fa fa-'+this.caret};}H.cn.push({tag:'span',cls:'input-group-addon input-group-append input-group-text btn dropdown-toggle',cn:[I,{tag:'span',cls:'combobox-clear',cn:[{tag:'i',cls:'icon-remove'}]}]})}if(this.multiple){H.cls+=' roo-select2-container-multi';
+}var J={tag:'i',cls:'roo-required-indicator '+(this.indicatorpos=='right'?'right':'left')+'-indicator text-danger fa fa-lg fa-star',tooltip:'This field is required'};if(Roo.bootstrap.version==4){J={tag:'i',style:'display:none'};}if(A==='left'&&this.fieldLabel.length){B.cls+=' roo-form-group-label-left row';
+B.cn=[J,{tag:'label','for':id,cls:'control-label',html:this.fieldLabel},{cls:"",cn:[H]}];var K=B.cn[1];var L=B.cn[2];if(this.indicatorpos=='right'){B.cn=[{tag:'label','for':id,cls:'control-label',cn:[{tag:'span',html:this.fieldLabel},J]},{cls:"",cn:[H]}];
+K=B.cn[0];L=B.cn[1];}if(this.labelWidth>12){K.style="width: "+this.labelWidth+'px';}if(this.labelWidth<13&&this.labelmd==0){this.labelmd=this.labelWidth;}if(this.labellg>0){K.cls+=' col-lg-'+this.labellg;L.cls+=' col-lg-'+(12-this.labellg);}if(this.labelmd>0){K.cls+=' col-md-'+this.labelmd;
+L.cls+=' col-md-'+(12-this.labelmd);}if(this.labelsm>0){K.cls+=' col-sm-'+this.labelsm;L.cls+=' col-sm-'+(12-this.labelsm);}if(this.labelxs>0){K.cls+=' col-xs-'+this.labelxs;L.cls+=' col-xs-'+(12-this.labelxs);}}else if(this.fieldLabel.length){B.cn=[J,{tag:'label',html:this.fieldLabel}
+,H];if(this.indicatorpos=='right'){B.cn=[{tag:'label',cn:[{tag:'span',html:this.fieldLabel},J]},H];}}else{B=H}var M=this;['xs','sm','md','lg'].map(function(N){if(M[N]){B.cls+=' col-'+N+'-'+M[N];}});return B;},onResize:function(w,h){},adjustSize:Roo.BoxComponent.prototype.adjustSize,getResizeEl:function(){return this.inputEl();
 },getPositionEl:function(){return this.inputEl();},alignErrorIcon:function(){this.errorIcon.alignTo(this.inputEl(),'tl-tr',[2,0]);},initEvents:function(){this.createList();Roo.bootstrap.TriggerField.superclass.initEvents.call(this);if(!this.multiple&&this.showToggleBtn){this.trigger=this.el.select('span.dropdown-toggle',true).first();
 if(this.hideTrigger){this.trigger.setDisplayed(false);}this.trigger.on("click",this.onTriggerClick,this,{preventDefault:true});}if(this.multiple){this.inputEl().on("click",this.onTriggerClick,this,{preventDefault:true});}if(this.removable&&!this.editable&&!this.tickable){var A=this.closeTriggerEl();
 if(A){A.setVisibilityMode(Roo.Element.DISPLAY).hide();A.on('click',this.removeBtnClick,this,A);}}},closeTriggerEl:function(){var A=this.el.select('.roo-combo-removable-btn',true).first();return A?A:false;},removeBtnClick:function(e,h,el){e.preventDefault();