roojs-bootstrap.js
authorEdward <edward@roojs.com>
Tue, 2 Oct 2018 06:58:57 +0000 (14:58 +0800)
committerEdward <edward@roojs.com>
Tue, 2 Oct 2018 06:58:57 +0000 (14:58 +0800)
roojs-bootstrap-debug.js

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

index 8b691ca..90794fe 100644 (file)
@@ -13058,6 +13058,11 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, {
      */
     useNativeIOS : false,
     
+    /**
+     * @cfg {Boolean} mobile_restrict_height (true|false) restrict height for touch view
+     */
+    mobile_restrict_height : false,
+    
     ios_options : false,
     
     //private
@@ -15472,6 +15477,10 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, {
 
         var listHeight = this.touchViewListGroup.getHeight();
         
+        if(this.mobile_restrict_height && listHeight < bodyHeight){
+            this.touchViewBodyEl.setHeight(listHeight);
+        }
+        
         var _this = this;
         
         if(firstChecked && listHeight > bodyHeight){
index 8664028..4371505 100644 (file)
@@ -516,7 +516,7 @@ var E=o;for(var i=0;i<E.length;i++){var n=E[i];var F={};var id=((A||A===0)&&n[A]
 v=f.convert(v);F[f.name]=v;}var H=new B(F,id);H.json=n;D[D.length]=H;}return {records:D,totalRecords:D.length};}});
 // Roo/bootstrap/ComboBox.js
 Roo.bootstrap.ComboBox=function(A){Roo.bootstrap.ComboBox.superclass.constructor.call(this,A);this.addEvents({'expand':true,'collapse':true,'beforeselect':true,'select':true,'beforequery':true,'add':true,'edit':true,'remove':true,'afterremove':true,'specialfilter':true,'tick':true,'touchviewdisplay':true}
-);this.item=[];this.tickItems=[];this.selectedIndex=-1;if(this.mode=='local'){if(A.queryDelay===undefined){this.queryDelay=10;}if(A.minChars===undefined){this.minChars=0;}}};Roo.extend(Roo.bootstrap.ComboBox,Roo.bootstrap.TriggerField,{listWidth:undefined,displayField:undefined,valueField:undefined,modalTitle:'',hiddenName:undefined,listClass:'',selectedClass:'active',shadow:'sides',listAlign:'tl-bl?',maxHeight:300,triggerAction:'query',minChars:4,typeAhead:false,queryDelay:500,pageSize:0,selectOnFocus:false,queryParam:'query',loadingText:'Loading...',resizable:false,handleHeight:8,editable:true,allQuery:'',mode:'remote',minListWidth:70,forceSelection:false,typeAheadDelay:250,valueNotFoundText:undefined,blockFocus:false,disableClear:false,alwaysQuery:false,multiple:false,invalidClass:"has-warning",validClass:"has-success",specialFilter:false,mobileTouchView:true,useNativeIOS:false,ios_options:false,addicon:false,editicon:false,page:0,hasQuery:false,append:false,loadNext:false,autoFocus:true,tickable:false,btnPosition:'right',triggerList:true,showToggleBtn:true,animate:true,emptyResultText:'Empty',triggerText:'Select',emptyTitle:'',getAutoCreate:function(){var A=false;
+);this.item=[];this.tickItems=[];this.selectedIndex=-1;if(this.mode=='local'){if(A.queryDelay===undefined){this.queryDelay=10;}if(A.minChars===undefined){this.minChars=0;}}};Roo.extend(Roo.bootstrap.ComboBox,Roo.bootstrap.TriggerField,{listWidth:undefined,displayField:undefined,valueField:undefined,modalTitle:'',hiddenName:undefined,listClass:'',selectedClass:'active',shadow:'sides',listAlign:'tl-bl?',maxHeight:300,triggerAction:'query',minChars:4,typeAhead:false,queryDelay:500,pageSize:0,selectOnFocus:false,queryParam:'query',loadingText:'Loading...',resizable:false,handleHeight:8,editable:true,allQuery:'',mode:'remote',minListWidth:70,forceSelection:false,typeAheadDelay:250,valueNotFoundText:undefined,blockFocus:false,disableClear:false,alwaysQuery:false,multiple:false,invalidClass:"has-warning",validClass:"has-success",specialFilter:false,mobileTouchView:true,useNativeIOS:false,mobile_restrict_height:false,ios_options:false,addicon:false,editicon:false,page:0,hasQuery:false,append:false,loadNext:false,autoFocus:true,tickable:false,btnPosition:'right',triggerList:true,showToggleBtn:true,animate:true,emptyResultText:'Empty',triggerText:'Select',emptyTitle:'',getAutoCreate:function(){var A=false;
 if(Roo.isIOS&&this.useNativeIOS){A=this.getAutoCreateNativeIOS();return A;}if(Roo.isTouch&&this.mobileTouchView){A=this.getAutoCreateTouchView();return A;;}if(!this.tickable){A=Roo.bootstrap.ComboBox.superclass.getAutoCreate.call(this);return A;}var B=this.labelAlign||this.parentLabelAlign();
 A={cls:'form-group roo-combobox-tickable'};var C='';var D='';var E='';if(this.btn_text_show){C='Select';D='Done';E='Cancel';}var F={tag:'div',cls:'tickable-buttons',cn:[{tag:'button',type:'button',cls:'btn btn-link btn-edit pull-'+this.btnPosition,html:C}
 ,{tag:'button',type:'button',name:'ok',cls:'btn btn-link btn-ok pull-'+this.btnPosition,html:D},{tag:'button',type:'button',name:'cancel',cls:'btn btn-link btn-cancel pull-'+this.btnPosition,html:E}]};if(this.editable){F.cn.unshift({tag:'input',cls:'roo-select2-search-field-input'}
@@ -628,9 +628,9 @@ this.tickItems=[];this.store.data.each(function(d,G){var H=this.touchViewListGro
 ;if(this.fireEvent('touchviewdisplay',this,I)!==false){H.select('.roo-combobox-list-group-item-value',true).first().dom.innerHTML=I.html;}}H.removeClass('selected');if(!this.multiple&&this.valueField&&typeof(d.data[this.valueField])!='undefined'&&d.data[this.valueField]==this.getValue()){H.select('.roo-combobox-list-group-item-box > input',true).first().attr('checked',true);
 H.addClass('selected');}if(this.multiple&&this.valueField&&typeof(d.data[this.valueField])!='undefined'&&this.getValue().indexOf(d.data[this.valueField])!=-1){H.select('.roo-combobox-list-group-item-box > input',true).first().attr('checked',true);this.tickItems.push(d.data);
 }H.on('click',this.onTouchViewClick,this,{row:H,rowIndex:G});},this);var C=this.touchViewListGroup.select('.list-group-item > .roo-combobox-list-group-item-box > input:checked',true).first();var D=Roo.lib.Dom.getViewHeight()-this.touchViewFooterEl.getHeight()+this.touchViewBodyEl.getPadding('tb');
-if(this.modalTitle.length){D=D-this.touchViewHeaderEl.getHeight();}var E=this.touchViewListGroup.getHeight();var F=this;if(C&&E>D){(function(){C.findParent('li').scrollIntoView(F.touchViewListGroup.dom);}).defer(500);}},onTouchViewLoadException:function(){this.hideTouchView();
-},onTouchViewEmptyResults:function(){this.clearTouchView();this.touchViewListGroup.createChild(Roo.bootstrap.ComboBox.emptyResult);this.touchViewListGroup.select('.roo-combobox-touch-view-empty-result',true).first().dom.innerHTML=this.emptyResultText;},clearTouchView:function(){this.touchViewListGroup.dom.innerHTML='';
-},onTouchViewClick:function(e,el,o){e.preventDefault();var A=o.row;var B=o.rowIndex;var r=this.store.getAt(B);if(this.fireEvent('beforeselect',this,r,B)!==false){if(!this.multiple){Roo.each(this.touchViewListGroup.select('.list-group-item > .roo-combobox-list-group-item-box > input:checked',true).elements,function(c){c.dom.removeAttribute('checked');
+if(this.modalTitle.length){D=D-this.touchViewHeaderEl.getHeight();}var E=this.touchViewListGroup.getHeight();if(this.mobile_restrict_height&&E<D){this.touchViewBodyEl.setHeight(E);}var F=this;if(C&&E>D){(function(){C.findParent('li').scrollIntoView(F.touchViewListGroup.dom);
+}).defer(500);}},onTouchViewLoadException:function(){this.hideTouchView();},onTouchViewEmptyResults:function(){this.clearTouchView();this.touchViewListGroup.createChild(Roo.bootstrap.ComboBox.emptyResult);this.touchViewListGroup.select('.roo-combobox-touch-view-empty-result',true).first().dom.innerHTML=this.emptyResultText;
+},clearTouchView:function(){this.touchViewListGroup.dom.innerHTML='';},onTouchViewClick:function(e,el,o){e.preventDefault();var A=o.row;var B=o.rowIndex;var r=this.store.getAt(B);if(this.fireEvent('beforeselect',this,r,B)!==false){if(!this.multiple){Roo.each(this.touchViewListGroup.select('.list-group-item > .roo-combobox-list-group-item-box > input:checked',true).elements,function(c){c.dom.removeAttribute('checked');
 },this);A.select('.roo-combobox-list-group-item-box > input',true).first().attr('checked',true);this.setFromData(r.data);var C=this.closeTriggerEl();if(C){C.show();}this.hideTouchView();this.fireEvent('select',this,r,B);return;}if(this.valueField&&typeof(r.data[this.valueField])!='undefined'&&this.getValue().indexOf(r.data[this.valueField])!=-1){A.select('.roo-combobox-list-group-item-box > input',true).first().dom.removeAttribute('checked');
 this.tickItems.splice(this.tickItems.indexOf(r.data),1);return;}A.select('.roo-combobox-list-group-item-box > input',true).first().attr('checked',true);this.addItem(r.data);this.tickItems.push(r.data);}},getAutoCreateNativeIOS:function(){var A={cls:'form-group'}
 ;var B={tag:'select',cls:'roo-ios-select'};if(this.name){B.name=this.name;}if(this.disabled){B.disabled=true;}var C=this;['xs','sm','md','lg'].map(function(D){if(C[D]){A.cls+=' col-'+D+'-'+C[D];}});A.cn=B;return A;},initIOSView:function(){this.store.on('load',this.onIOSViewLoad,this);