From 9789deb04a8a712ca8df19c06cec496c7260e9c7 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Mon, 8 Mar 2021 12:43:29 +0800 Subject: [PATCH] roojs-bootstrap.js roojs-bootstrap-debug.js Roo/bootstrap/CardUploader.js --- Roo/bootstrap/CardUploader.js | 2 +- roojs-bootstrap-debug.js | 6 +++--- roojs-bootstrap.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Roo/bootstrap/CardUploader.js b/Roo/bootstrap/CardUploader.js index 35c0842f8d..aaf4df7a8c 100644 --- a/Roo/bootstrap/CardUploader.js +++ b/Roo/bootstrap/CardUploader.js @@ -235,7 +235,7 @@ Roo.extend(Roo.bootstrap.CardUploader, Roo.bootstrap.Input, { { xns : Roo.bootstrap, xtype : 'Button', - style: 'max-height: 28px;min-width: 27px;', + style: 'max-height: 28px; ', size : 'sm', weight: 'danger', cls : 'col-2', diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 6da99e69e7..419d952e01 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -12694,7 +12694,7 @@ Roo.extend(Roo.bootstrap.CardUploader, Roo.bootstrap.Input, { xns : Roo.bootstrap, xtype : 'Button', html : String.format("{0}", data.title), - cls : 'col-11 text-left', + cls : 'col-10 text-left', size: 'sm', weight: 'link', fa : 'download', @@ -12708,10 +12708,10 @@ Roo.extend(Roo.bootstrap.CardUploader, Roo.bootstrap.Input, { { xns : Roo.bootstrap, xtype : 'Button', - style: 'max-height: 28px;min-width: 27px;', + style: 'max-height: 28px; ', size : 'sm', weight: 'danger', - cls : 'col-1', + cls : 'col-2', fa : 'times', listeners : { click : function() { diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 753fbacbb9..5d31843531 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -526,8 +526,8 @@ this.addxtype({xns:Roo.bootstrap,xtype:'Button',container_method:'getButtonConta this.selectorEl=this.el.select('.roo-card-upload-selector',true).first();this.selectorEl.on('change',this.onFileSelected,this);if(this.images){var t=this;this.images.forEach(function(A){t.addCard(A)});this.images=false;}this.containerEl=this.el.select('.roo-card-uploader-container',true).first(); },onClick:function(e){e.preventDefault();this.selectorEl.dom.click();},onFileSelected:function(e){e.preventDefault();if(typeof(this.selectorEl.dom.files)=='undefined'||!this.selectorEl.dom.files.length){return;}Roo.each(this.selectorEl.dom.files,function(A){this.addFile(A); },this);},addFile:function(A){if(typeof(A)==='string'){throw "Add file by name?";return;}if(!A||!this.urlAPI){return;}var B=this;var C=B.urlAPI.createObjectURL(A);this.addCard({id:Roo.bootstrap.CardUploader.ID--,is_uploaded:false,src:C,srcfile:A,title:A.name,mimetype:A.type,preview:false,is_deleted:0} -);},addCard:function(A){var t=this;var B=[{xns:Roo.bootstrap,xtype:'CardFooter',items:[{xns:Roo.bootstrap,xtype:'Element',cls:'d-flex',items:[{xns:Roo.bootstrap,xtype:'Button',html:String.format("{0}",A.title),cls:'col-11 text-left',size:'sm',weight:'link',fa:'download',listeners:{click:function(){this.downloadCard(A.id)} -}},{xns:Roo.bootstrap,xtype:'Button',style:'max-height: 28px;min-width: 27px;',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); +);},addCard:function(A){var t=this;var B=[{xns:Roo.bootstrap,xtype:'CardFooter',items:[{xns:Roo.bootstrap,xtype:'Element',cls:'d-flex',items:[{xns:Roo.bootstrap,xtype:'Button',html:String.format("{0}",A.title),cls:'col-10 text-left',size:'sm',weight:'link',fa:'download',listeners:{click:function(){this.downloadCard(A.id)} +}},{xns:Roo.bootstrap,xtype:'Button',style:'max-height: 28px; ',size:'sm',weight:'danger',cls:'col-2',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.getCardFooter().addClass('p-1');}});this.fileCollection.add(cn);if(!A.srcfile){this.updateInput(); return;}var _t=this;var C=new FileReader();C.addEventListener("load",function(){A.srcdata=C.result;_t.updateInput();});C.readAsDataURL(A.srcfile);},removeCard:function(id){var A=this.fileCollection.get(id);A.data.is_deleted=1;A.data.src='';A.el.dom.parentNode.removeChild(A.el.dom); 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); -- 2.39.2