roojs-bootstrap.js
authoredward <edward@roojs.com>
Thu, 10 May 2018 10:21:47 +0000 (18:21 +0800)
committeredward <edward@roojs.com>
Thu, 10 May 2018 10:21:47 +0000 (18:21 +0800)
roojs-bootstrap-debug.js

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

index 67622fe..3c1fe2d 100644 (file)
@@ -28431,7 +28431,14 @@ Roo.bootstrap.DocumentManager = function(config){
          * @param {Roo.bootstrap.DocumentManager} this
          * @param {Object} file
          */
-        "process" : true
+        "process" : true,
+        /**
+         * @event previewrendered
+         * Fire when preview rendered
+         * @param {Roo.bootstrap.DocumentManager} this
+         * @param {Object} file
+         */
+        "previewrendered" : true
         
     });
 };
@@ -29019,6 +29026,8 @@ Roo.extend(Roo.bootstrap.DocumentManager, Roo.bootstrap.Component,  {
         
         image.on('click', this.onClick, this, file);
         
+        this.fireEvent('previewrendered', this, file);
+        
         return file;
         
     },
index 834419f..86bad25 100644 (file)
@@ -1203,7 +1203,7 @@ i+=1){c=J[i];if(c==='\u0000'){break;}K+=c;}return K;}return J;}});Roo.apply(Roo.
 ]},{tag:'div',cls:'btn-group roo-upload-cropbox-rotate-right',action:'rotate-right',cn:[{tag:'button',cls:'btn btn-default',html:'<i class="fa fa-repeat"></i>'}]}],ROTATOR:[{tag:'div',cls:'btn-group roo-upload-cropbox-rotate-left',action:'rotate-left',cn:[{tag:'button',cls:'btn btn-default',html:'<i class="fa fa-undo"></i>'}
 ]},{tag:'div',cls:'btn-group roo-upload-cropbox-rotate-right',action:'rotate-right',cn:[{tag:'button',cls:'btn btn-default',html:'<i class="fa fa-repeat"></i>'}]}]}});
 // Roo/bootstrap/DocumentManager.js
-Roo.bootstrap.DocumentManager=function(A){Roo.bootstrap.DocumentManager.superclass.constructor.call(this,A);this.files=[];this.delegates=[];this.addEvents({"initial":true,"inspect":true,"exception":true,"afterupload":true,"prepare":true,"remove":true,"refresh":true,"click":true,"edit":true,"beforeselectfile":true,"process":true}
+Roo.bootstrap.DocumentManager=function(A){Roo.bootstrap.DocumentManager.superclass.constructor.call(this,A);this.files=[];this.delegates=[];this.addEvents({"initial":true,"inspect":true,"exception":true,"afterupload":true,"prepare":true,"remove":true,"refresh":true,"click":true,"edit":true,"beforeselectfile":true,"process":true,"previewrendered":true}
 );};Roo.extend(Roo.bootstrap.DocumentManager,Roo.bootstrap.Component,{boxes:0,inputName:'',thumbSize:300,multiple:true,files:false,method:'POST',url:'',paramName:'imageUpload',toolTipName:'filename',fieldLabel:'',labelWidth:4,labelAlign:'left',editable:true,delegates:false,xhr:false,labellg:0,labelmd:0,labelsm:0,labelxs:0,getAutoCreate:function(){var A={tag:'div',cls:'roo-document-manager',cn:[{tag:'input',cls:'roo-document-manager-selector',type:'file'}
 ,{tag:'div',cls:'roo-document-manager-uploader',cn:[{tag:'div',cls:'roo-document-manager-upload-btn',html:'<i class="fa fa-plus"></i>'}]}]};var B=[{tag:'div',cls:'column col-md-12',cn:A}];if(this.fieldLabel.length){B=[{tag:'div',cls:'column col-md-12',html:this.fieldLabel}
 ,{tag:'div',cls:'column col-md-12',cn:A}];if(this.labelAlign=='left'){B=[{tag:'div',cls:'column',html:this.fieldLabel},{tag:'div',cls:'column',cn:A}];if(this.labelWidth>12){B[0].style="width: "+this.labelWidth+'px';}if(this.labelWidth<13&&this.labelmd==0){this.labelmd=this.labelWidth;
@@ -1230,8 +1230,8 @@ if(typeof(A.id)!='undefined'&&A.id*1>0){this.arrange();return;}A.xhr=this.xhr;th
 }this.xhr.send(G);return;};this.uploadCancel();},uploadCancel:function(){if(this.xhr){this.xhr.abort();}this.delegates=[];Roo.each(this.managerEl.select('.roo-document-manager-loading',true).elements,function(el){el.remove();},this);this.arrange();},renderPreview:function(A){if(typeof(A.target)!='undefined'&&A.target){return A;
 }var B=encodeURI(baseURL+'/Images/Thumb/'+this.thumbSize+'/'+A.id+'/'+A.filename);var C=this.managerEl.createChild({tag:'div',cls:'roo-document-manager-preview',cn:[{tag:'div',tooltip:A[this.toolTipName],cls:'roo-document-manager-thumb',html:'<img tooltip="'+A[this.toolTipName]+'" src="'+B+'">'}
 ,{tag:'button',cls:'close',html:'<i class="fa fa-times-circle"></i>'}]});var D=C.select('button.close',true).first();D.on('click',this.onRemove,this,A);A.target=C;var E=C.select('img',true).first();var F=this;E.dom.addEventListener("load",function(){F.onPreviewLoad(A,E);
-});E.on('click',this.onClick,this,A);return A;},onPreviewLoad:function(A,B){if(typeof(A.target)=='undefined'||!A.target){return;}var C=B.dom.naturalWidth||B.dom.width;var D=B.dom.naturalHeight||B.dom.height;if(C>D){A.target.addClass('wide');return;}A.target.addClass('tall');
-return;},uploadFromSource:function(A,B){this.xhr=new XMLHttpRequest();this.managerEl.createChild({tag:'div',cls:'roo-document-manager-loading',cn:[{tag:'div',tooltip:A.name,cls:'roo-document-manager-thumb',html:'<i class="fa fa-circle-o-notch fa-spin"></i>'}
+});E.on('click',this.onClick,this,A);this.fireEvent('previewrendered',this,A);return A;},onPreviewLoad:function(A,B){if(typeof(A.target)=='undefined'||!A.target){return;}var C=B.dom.naturalWidth||B.dom.width;var D=B.dom.naturalHeight||B.dom.height;if(C>D){A.target.addClass('wide');
+return;}A.target.addClass('tall');return;},uploadFromSource:function(A,B){this.xhr=new XMLHttpRequest();this.managerEl.createChild({tag:'div',cls:'roo-document-manager-loading',cn:[{tag:'div',tooltip:A.name,cls:'roo-document-manager-thumb',html:'<i class="fa fa-circle-o-notch fa-spin"></i>'}
 ]});this.xhr.open(this.method,this.url,true);var C={"Accept":"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"};for(var D in C){var E=C[D];if(E){this.xhr.setRequestHeader(D,E);}}var F=this;this.xhr.onload=function(){F.xhrOnLoad(F.xhr);
 };this.xhr.onerror=function(){F.xhrOnError(F.xhr);};var G=new FormData();G.append('returnHTML','NO');G.append('crop',B);if(typeof(A.filename)!='undefined'){G.append('filename',A.filename);}if(typeof(A.mimetype)!='undefined'){G.append('mimetype',A.mimetype);
 }Roo.log(G);if(this.fireEvent('prepare',this,G)!=false){this.xhr.send(G);};}});