From a8a10142cdd2e104d0e5cc7df84860d6962c3e72 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Thu, 3 Jun 2021 18:07:33 +0800 Subject: [PATCH] sync --- Roo/bootstrap/ButtonUploader.js | 5 +++-- docs/json/roodata.json | 6 ++++++ roojs-bootstrap-debug.js | 23 +++++++++++++---------- roojs-bootstrap.js | 8 ++++---- 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/Roo/bootstrap/ButtonUploader.js b/Roo/bootstrap/ButtonUploader.js index 31fdeb6267..7149c64c34 100644 --- a/Roo/bootstrap/ButtonUploader.js +++ b/Roo/bootstrap/ButtonUploader.js @@ -56,15 +56,16 @@ Roo.extend(Roo.bootstrap.ButtonUploader, Roo.bootstrap.Button, { fileCollection : false, allowBlank : true, + multiple : true, + getAutoCreate : function() { var im = { tag: 'input', - type : 'file', cls : 'd-none roo-card-upload-selector' - } + }; if (this.multiple) { im.multiple = 'multiple'; } diff --git a/docs/json/roodata.json b/docs/json/roodata.json index 730bc22a02..181ba3825e 100644 --- a/docs/json/roodata.json +++ b/docs/json/roodata.json @@ -19028,6 +19028,12 @@ "desc" : "list of events and functions to call for this object, \nFor example :\n
\n    listeners :  { \n       'click' : function(e) {\n           ..... \n        } ,\n        .... \n    } \n  
", "memberOf" : "Roo.util.Observable" }, + { + "name" : "multiple", + "type" : "Boolean", + "desc" : "(default true) Should the upload allow multiple files to be uploaded.", + "memberOf" : "" + }, { "name" : "name", "type" : "string", diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index d9da97d245..f513d56791 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -2867,7 +2867,7 @@ Roo.extend(Roo.bootstrap.CardImageTop, Roo.bootstrap.Element, { * @cfg {Number} errorTimeout default 3000 * @cfg {Array} images an array of ?? Img objects ??? when loading existing files.. * @cfg {Array} html The button text. - + * @cfg {Boolean} multiple (default true) Should the upload allow multiple files to be uploaded. * * @constructor * Create a new CardUploader @@ -2911,22 +2911,25 @@ Roo.extend(Roo.bootstrap.ButtonUploader, Roo.bootstrap.Button, { fileCollection : false, allowBlank : true, + multiple : true, + getAutoCreate : function() { - + var im = { + tag: 'input', + type : 'file', + cls : 'd-none roo-card-upload-selector' + + }; + if (this.multiple) { + im.multiple = 'multiple'; + } return { cls :'div' , cn : [ Roo.bootstrap.Button.prototype.getAutoCreate.call(this), - { - tag: 'input', - multiple : 'multiple', - type : 'file', - cls : 'd-none roo-card-upload-selector' - - } - + im ] }; diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 8453074353..5db9134459 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -122,10 +122,10 @@ Roo.bootstrap.CardFooter=function(A){Roo.bootstrap.CardFooter.superclass.constru // Roo/bootstrap/CardImageTop.js Roo.bootstrap.CardImageTop=function(A){Roo.bootstrap.CardImageTop.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.CardImageTop,Roo.bootstrap.Element,{container_method:'getCardImageTop'}); // Roo/bootstrap/ButtonUploader.js -Roo.bootstrap.ButtonUploader=function(A){Roo.bootstrap.ButtonUploader.superclass.constructor.call(this,A);this.addEvents({'beforeselect':true,'uploaded':true});};Roo.extend(Roo.bootstrap.ButtonUploader,Roo.bootstrap.Button,{errorTimeout:3000,images:false,fileCollection:false,allowBlank:true,getAutoCreate:function(){return {cls:'div',cn:[Roo.bootstrap.Button.prototype.getAutoCreate.call(this),{tag:'input',multiple:'multiple',type:'file',cls:'d-none roo-card-upload-selector'} -]};},initEvents:function(){Roo.bootstrap.Button.prototype.initEvents.call(this);this.urlAPI=(window.createObjectURL&&window)||(window.URL&&URL.revokeObjectURL&&URL)||(window.webkitURL&&webkitURL);this.selectorEl=this.el.select('.roo-card-upload-selector',true).first(); -this.selectorEl.on('change',this.onFileSelected,this);},onClick:function(e){e.preventDefault();if(this.fireEvent('beforeselect',this)===false){return;}this.selectorEl.dom.click();},onFileSelected:function(e){e.preventDefault();if(typeof(this.selectorEl.dom.files)=='undefined'||!this.selectorEl.dom.files.length){return; -}var A=Array.prototype.slice.call(this.selectorEl.dom.files);this.selectorEl.dom.reset();this.fireEvent('uploaded',this,A);},reset:function(){this.selectorEl}}); +Roo.bootstrap.ButtonUploader=function(A){Roo.bootstrap.ButtonUploader.superclass.constructor.call(this,A);this.addEvents({'beforeselect':true,'uploaded':true});};Roo.extend(Roo.bootstrap.ButtonUploader,Roo.bootstrap.Button,{errorTimeout:3000,images:false,fileCollection:false,allowBlank:true,multiple:true,getAutoCreate:function(){var im={tag:'input',type:'file',cls:'d-none roo-card-upload-selector'} +;if(this.multiple){im.multiple='multiple';}return {cls:'div',cn:[Roo.bootstrap.Button.prototype.getAutoCreate.call(this),im]};},initEvents:function(){Roo.bootstrap.Button.prototype.initEvents.call(this);this.urlAPI=(window.createObjectURL&&window)||(window.URL&&URL.revokeObjectURL&&URL)||(window.webkitURL&&webkitURL); +this.selectorEl=this.el.select('.roo-card-upload-selector',true).first();this.selectorEl.on('change',this.onFileSelected,this);},onClick:function(e){e.preventDefault();if(this.fireEvent('beforeselect',this)===false){return;}this.selectorEl.dom.click();},onFileSelected:function(e){e.preventDefault(); +if(typeof(this.selectorEl.dom.files)=='undefined'||!this.selectorEl.dom.files.length){return;}var A=Array.prototype.slice.call(this.selectorEl.dom.files);this.selectorEl.dom.reset();this.fireEvent('uploaded',this,A);},reset:function(){this.selectorEl}}); // Roo/bootstrap/Img.js Roo.bootstrap.Img=function(A){Roo.bootstrap.Img.superclass.constructor.call(this,A);this.addEvents({"click":true});};Roo.extend(Roo.bootstrap.Img,Roo.bootstrap.Component,{imgResponsive:true,border:'',src:'about:blank',href:false,target:false,xsUrl:'',smUrl:'',mdUrl:'',lgUrl:'',getAutoCreate:function(){if(this.src||(!this.xsUrl&&!this.smUrl&&!this.mdUrl&&!this.lgUrl)){return this.createSingleImg(); }var A={tag:'div',cls:'roo-image-responsive-group',cn:[]};var B=this;Roo.each(['xs','sm','md','lg'],function(C){if(!B[C+'Url']){return;}var D={tag:'img',cls:(B.imgResponsive)?'img-responsive':'',html:B.html||A.html,src:B[C+'Url']};D.cls+=' roo-image-responsive-'+C; -- 2.39.2