roojs-bootstrap.js
authorAlan Knowles <alan@roojs.com>
Fri, 5 Mar 2021 07:05:27 +0000 (15:05 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 5 Mar 2021 07:05:27 +0000 (15:05 +0800)
roojs-bootstrap-debug.js
Roo/bootstrap/CardUploader.js

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

index b81dd26..a3f338a 100644 (file)
@@ -318,8 +318,7 @@ Roo.extend(Roo.bootstrap.CardUploader, Roo.bootstrap.Input,  {
     
     updateInput : function()
     {
-        var i =0;
-        var data = [];
+         var data = [];
         this.fileCollection.forEach(function(e) {
             data.push(e.data);
             
index 1ee1a40..c9c535d 100644 (file)
@@ -12790,26 +12790,12 @@ Roo.extend(Roo.bootstrap.CardUploader, Roo.bootstrap.Input,  {
     {
         var i =0;
         var data = [];
-        var dom = this.inputEl().dom;
-        var fc = this.fileCollection;
-        var next = function() {
-            if (i >= fc.length) {
-                dom.value = JSON.stringify(data);
-                return;
-            }
-            var reader = new FileReader();
-            reader.onloadend = function(evt) {  
-                // file is loaded
-                var ee = Roo.apply({}, fc[i]);
-                ee.src = evt.target.result;
-                data.push(ee);
-                i++;
-                next();
-            };
-            reader.readAsDataURL(fc[i].src);
+        this.fileCollection.forEach(function(e) {
+            data.push(e.data);
             
-        }
-        next();
+        });
+        this.inputEl().dom.value = JSON.stringify(data);
+        
         
         
     }
index 48cbb33..152fa60 100644 (file)
@@ -530,8 +530,7 @@ this.selectorEl=this.el.select('.roo-card-upload-selector',true).first();this.se
 }},{xns:Roo.bootstrap,xtype:'Button',size:'sm',weight:'danger',cls:'col-1',fa:'times',listeners:{click:function(){t.removeCard(A.id)}}}]}]}];var cn=this.addxtype({xns:Roo.bootstrap,xtype:'Card',closeable:true,header:!A.mimetype.match(/image/)&&!A.preview?"Document":false,header_image:A.mimetype.match(/image/)?A.src:A.preview,header_image_fit_square:true,data:A,html:false,items:B,initEvents:function(){Roo.bootstrap.Card.prototype.initEvents.call(this);
 this.imgEl=this.el.select('.card-img-top').first();if(this.imgEl){this.imgEl.on('click',function(){t.previewCard(A.id);},this);this.imgEl.set({'pointer':'cursor'});}}});this.fileCollection.add(cn);var _t=this;var C=new FileReader();C.onloadend=function(D){A.srcdata=D.target.result;
 _t.updateInput();};C.readAsDataURL(A.src);},removeCard:function(id){var A=this.fileCollection.get(id);A.data.is_deleted=1;A.data.src='';this.fileCollection.remove(A);A.el.dom.parentNode.removeChild(A.el.dom);},reset:function(){this.fileCollection.each(function(A){A.el.dom.parentNode.removeChild(A.el.dom);
-});this.fileCollection.clear();this.updateInput();},updateInput:function(){var i=0;var A=[];var B=this.inputEl().dom;var fc=this.fileCollection;var C=function(){if(i>=fc.length){B.value=JSON.stringify(A);return;}var D=new FileReader();D.onloadend=function(E){var ee=Roo.apply({}
-,fc[i]);ee.src=E.target.result;A.push(ee);i++;C();};D.readAsDataURL(fc[i].src);};C();}});Roo.bootstrap.CardUploader.ID=-1;
+});this.fileCollection.clear();this.updateInput();},updateInput:function(){var i=0;var A=[];this.fileCollection.forEach(function(e){A.push(e.data);});this.inputEl().dom.value=JSON.stringify(A);}});Roo.bootstrap.CardUploader.ID=-1;
 // 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,""));