Roo/bootstrap/form/MultiLineTag.js
authorleon <leon@roojs.com>
Thu, 2 Nov 2023 03:38:47 +0000 (11:38 +0800)
committerleon <leon@roojs.com>
Thu, 2 Nov 2023 03:38:47 +0000 (11:38 +0800)
roojs-bootstrap.js
roojs-bootstrap-debug.js

Roo/bootstrap/form/MultiLineTag.js
roojs-bootstrap-debug.js
roojs-bootstrap.js

index 562e130..9aa2093 100644 (file)
@@ -236,7 +236,7 @@ Roo.extend(Roo.bootstrap.form.MultiLineTag, Roo.bootstrap.form.Input,  {
     {
         Roo.log('GET CHILD CONTAINER');
         Roo.log(this);
-        Roo.log(Roo.select('.roo-multi-line-tag-container', true))
+        Roo.log(Roo.select('.roo-multi-line-tag-container', true));
         return this.el;
     }
 });
index 0684351..eb66118 100644 (file)
@@ -14780,31 +14780,32 @@ Roo.extend(Roo.bootstrap.form.MultiLineTag, Roo.bootstrap.form.Input,  {
     minimumRow : 2,
 
     // for combo box
-    displayField : 'name',
-    valueField : 'name',
+    displayField : '',
+    valueField : '',
     placeholder : '',
     queryParam : '',
     listWidth : 300,
 
     // for combo box store
-    url : '',
-    fields : [
-        {
-            'name' : 'id',
-            'type' : 'int'
-        },
-        {
-            'name' : 'name',
-            'type' : 'string'
-        }
-    ],
+    url : undefined,
+    fields : [],
 
 
 
     getAutoCreate : function()
     {
         var config = {
-            cls : 'roo-multi-line-tag'
+            tag : 'row',
+            cls : 'roo-multi-line-tag',
+            cn : [
+                {
+                    tag : 'column'
+                },
+                {
+                    tag : 'column',
+                    cls : 'roo-multi-line-tag-container'
+                }
+            ]
         };
 
         return config;
@@ -14925,7 +14926,8 @@ Roo.extend(Roo.bootstrap.form.MultiLineTag, Roo.bootstrap.form.Input,  {
         this.showHideRemoveBtn();
     },
 
-    // show remove buttons only if there are more than {minimumRow} tags
+    // hide all remove buttons if there are {minimumRow} or less tags
+    // hide the remove button for empty tag
     showHideRemoveBtn : function()
     {
         var _this = this;
@@ -14982,6 +14984,14 @@ Roo.extend(Roo.bootstrap.form.MultiLineTag, Roo.bootstrap.form.Input,  {
             this.addTagRow();
         }
         
+    },
+
+    getChildContainer : function()
+    {
+        Roo.log('GET CHILD CONTAINER');
+        Roo.log(this);
+        Roo.log(Roo.select('.roo-multi-line-tag-container', true));
+        return this.el;
     }
 });
 /*
index ce2d052..5903bd7 100644 (file)
@@ -627,15 +627,15 @@ return;}var _t=this;var C=new FileReader();C.addEventListener("load",function(){
 this.updateInput();},reset:function(){this.fileCollection.each(function(A){if(A.el.dom&&A.el.dom.parentNode){A.el.dom.parentNode.removeChild(A.el.dom);}});this.fileCollection.clear();this.updateInput();},updateInput:function(){var A=[];this.fileCollection.each(function(e){A.push(e.data);
 });this.inputEl().dom.value=JSON.stringify(A);}});Roo.bootstrap.form.CardUploader.ID=-1;
 // Roo/bootstrap/form/MultiLineTag.js
-Roo.bootstrap.form.MultiLineTag=function(A){Roo.bootstrap.form.MultiLineTag.superclass.constructor.call(this,A);this.addEvents({beforeload:true});};Roo.extend(Roo.bootstrap.form.MultiLineTag,Roo.bootstrap.form.Input,{tagRows:[],minimumRow:2,displayField:'name',valueField:'name',placeholder:'',queryParam:'',listWidth:300,url:'',fields:[{'name':'id','type':'int'}
-,{'name':'name','type':'string'}],getAutoCreate:function(){var A={cls:'roo-multi-line-tag'};return A;},initEvents:function(){this.tagRows=[];for(var i=0;i<this.minimumRow;i++){this.addTagRow();}},addTagRow:function(){var A=this;var B=Roo.factory({xns:Roo.bootstrap.form,xtype:'ComboBox',editable:true,triggerAction:'all',minChars:2,displayField:A.displayField,valueField:A.valueField,listWidth:A.listWidth,placeholder:A.placeholder,queryParam:A.queryParam,store:{xns:Roo.data,xtype:'Store',listeners:{beforeload:function(E,F){A.fireEvent('beforeload',A,E,F);
+Roo.bootstrap.form.MultiLineTag=function(A){Roo.bootstrap.form.MultiLineTag.superclass.constructor.call(this,A);this.addEvents({beforeload:true});};Roo.extend(Roo.bootstrap.form.MultiLineTag,Roo.bootstrap.form.Input,{tagRows:[],minimumRow:2,displayField:'',valueField:'',placeholder:'',queryParam:'',listWidth:300,url:undefined,fields:[],getAutoCreate:function(){var A={tag:'row',cls:'roo-multi-line-tag',cn:[{tag:'column'}
+,{tag:'column',cls:'roo-multi-line-tag-container'}]};return A;},initEvents:function(){this.tagRows=[];for(var i=0;i<this.minimumRow;i++){this.addTagRow();}},addTagRow:function(){var A=this;var B=Roo.factory({xns:Roo.bootstrap.form,xtype:'ComboBox',editable:true,triggerAction:'all',minChars:2,displayField:A.displayField,valueField:A.valueField,listWidth:A.listWidth,placeholder:A.placeholder,queryParam:A.queryParam,store:{xns:Roo.data,xtype:'Store',listeners:{beforeload:function(E,F){A.fireEvent('beforeload',A,E,F);
 }},proxy:{xns:Roo.data,xtype:'HttpProxy',method:'GET',url:A.url},reader:{xns:Roo.data,xtype:'JsonReader',fields:A.fields}},listeners:{'render':function(E){E.inputEl().on('keyup',function(e){if(A.shouldAutoAddTagRow()){A.addTagRow();}});E.inputEl().on('change',function(e){A.fireEvent('change',A,A.getValue(),false);
 A.showHideRemoveBtn();});},'select':function(E,F,G){A.fireEvent('change',A,A.getValue(),false);}}});var C=Roo.factory({xns:Roo.bootstrap,xtype:'Button',html:'-'});var D={xns:Roo.bootstrap,xtype:'Row',items:[B,C],listeners:{'render':function(E){this.inputCb=B;
 this.removeBtn=C;this.removeBtn.on('click',function(){A.removeTagRow(E);});}}};this.tagRows.push(this.addxtype(D));A.showHideRemoveBtn();},shouldAutoAddTagRow:function(){var A=true;Roo.each(this.tagRows,function(r){if(r.inputCb.getRawValue()==''){A=false;
 }});return A;},removeTagRow:function(A){A.destroy();this.tagRows.splice(this.tagRows.indexOf(A),1);this.fireEvent('change',this,this.getValue(),false);this.showHideRemoveBtn();},showHideRemoveBtn:function(){var A=this;Roo.each(this.tagRows,function(r){r.removeBtn.show();
 if(A.tagRows.length<=A.minimumRow||r.inputCb.getRawValue()==''){r.removeBtn.hide();}});},getValue:function(){var A=this;var B=[];Roo.each(A.tagRows,function(r){var C=r.inputCb.getRawValue();if(C!=''){var D={};D[A.valueField]=r.inputCb.getRawValue();B.push(D);
 }});return JSON.stringify(B);},setValue:function(A){var B=this.tagRows.length;for(var i=0;i<B;i++){this.removeTagRow(this.tagRows[0]);}var C=JSON.parse(A);for(var i=0;i<C.length;i++){this.addTagRow();this.tagRows[i].inputCb.setRawValue(C[i][this.valueField]);
-}this.addTagRow();while(this.tagRows.length<this.minimumRow){this.addTagRow();}}});
+}this.addTagRow();while(this.tagRows.length<this.minimumRow){this.addTagRow();}},getChildContainer:function(){Roo.log('GET CHILD CONTAINER');Roo.log(this);Roo.log(Roo.select('.roo-multi-line-tag-container',true));return this.el;}});
 // Roo/data/SortTypes.js
 Roo.data.SortTypes={none:function(s){return s;},stripTagsRE:/<\/?[^>]+>/gi,asText:function(s){return String(s).replace(this.stripTagsRE,"");},asUCText:function(s){return String(s).toUpperCase().replace(this.stripTagsRE,"");},asUCString:function(s){return String(s).toUpperCase();
 },asDate:function(s){if(!s){return 0;}if(s instanceof Date){return s.getTime();}return Date.parse(String(s));},asFloat:function(s){var A=parseFloat(String(s).replace(/,/g,""));if(isNaN(A)){A=0;}return A;},asInt:function(s){var A=parseInt(String(s).replace(/,/g,""));