From: Edward Date: Fri, 30 Nov 2018 03:45:03 +0000 (+0800) Subject: roojs-bootstrap.js X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=3023dd0ae306009ddb95b28b78e7eb0c58f6c457 roojs-bootstrap.js roojs-bootstrap-debug.js --- diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 6593c99001..77cbd3d921 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -29176,6 +29176,7 @@ Roo.extend(Roo.bootstrap.DocumentManager, Roo.bootstrap.Component, { this.progressDialog = new Roo.bootstrap.Modal({ cls : 'roo-document-manager-progress-dialog', allow_close : false, + animate : false, title : '', buttons : [ { @@ -29253,10 +29254,10 @@ Roo.extend(Roo.bootstrap.DocumentManager, Roo.bootstrap.Component, { this.files = this.files.slice(0, this.boxes); } - this.uploader.show(false); + this.uploader.show(); if(this.boxes > 0 && this.files.length > this.boxes - 1){ - this.uploader.hide(false); + this.uploader.hide(); } var _this = this; @@ -29310,14 +29311,14 @@ Roo.extend(Roo.bootstrap.DocumentManager, Roo.bootstrap.Component, { arrange : function() { if(!this.delegates.length){ - this.progressDialog.hide(false); + this.progressDialog.hide(); this.refresh(); return; } var delegate = this.delegates.shift(); - this.progressDialog.show(false); + this.progressDialog.show(); this.progressDialog.setTitle((this.progressBar.aria_valuemax - this.delegates.length) + ' / ' + this.progressBar.aria_valuemax); @@ -29328,10 +29329,10 @@ Roo.extend(Roo.bootstrap.DocumentManager, Roo.bootstrap.Component, { refresh : function() { - this.uploader.show(false); + this.uploader.show(); if(this.boxes > 0 && this.files.length > this.boxes - 1){ - this.uploader.hide(false); + this.uploader.hide(); } Roo.isTouch ? this.closable(false) : this.closable(true); diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index d341a87c4a..90da3cc5ea 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -1243,16 +1243,16 @@ Roo.bootstrap.DocumentManager=function(A){Roo.bootstrap.DocumentManager.supercla }if(this.labelxs>0){B[0].cls+=' col-xs-'+this.labelxs;B[1].cls+=' col-xs-'+(12-this.labelxs);}}}var C={tag:'div',cls:'row clearfix',cn:B};return C;},initEvents:function(){this.managerEl=this.el.select('.roo-document-manager',true).first();this.managerEl.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block'; this.selectorEl=this.el.select('.roo-document-manager-selector',true).first();this.selectorEl.hide();if(this.multiple){this.selectorEl.attr('multiple','multiple');}this.selectorEl.on('change',this.onFileSelected,this);this.uploader=this.el.select('.roo-document-manager-uploader',true).first(); this.uploader.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block';this.uploader.on('click',this.onUploaderClick,this);this.renderProgressDialog();var A=this;window.addEventListener("resize",function(){A.refresh();});this.fireEvent('initial',this); -},renderProgressDialog:function(){var A=this;this.progressDialog=new Roo.bootstrap.Modal({cls:'roo-document-manager-progress-dialog',allow_close:false,title:'',buttons:[{name:'cancel',weight:'danger',html:'Cancel'}],listeners:{btnclick:function(){A.uploadCancel(); +},renderProgressDialog:function(){var A=this;this.progressDialog=new Roo.bootstrap.Modal({cls:'roo-document-manager-progress-dialog',allow_close:false,animate:false,title:'',buttons:[{name:'cancel',weight:'danger',html:'Cancel'}],listeners:{btnclick:function(){A.uploadCancel(); this.hide();}}});this.progressDialog.render(Roo.get(document.body));this.progress=new Roo.bootstrap.Progress({cls:'roo-document-manager-progress',active:true,striped:true});this.progress.render(this.progressDialog.getChildContainer());this.progressBar=new Roo.bootstrap.ProgressBar({cls:'roo-document-manager-progress-bar',aria_valuenow:0,aria_valuemin:0,aria_valuemax:12,panel:'success'} );this.progressBar.render(this.progress.getChildContainer());},onUploaderClick:function(e){e.preventDefault();if(this.fireEvent('beforeselectfile',this)!=false){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){if(this.fireEvent('inspect',this,A)!=false){this.files.push(A);}},this);this.queue();},queue:function(){this.selectorEl.dom.value='';if(!this.files||!this.files.length){return;}if(this.boxes>0&&this.files.length>this.boxes){this.files=this.files.slice(0,this.boxes); -}this.uploader.show(false);if(this.boxes>0&&this.files.length>this.boxes-1){this.uploader.hide(false);}var A=this;var B=[];var C=[];Roo.each(this.files,function(D){if(typeof(D.id)!='undefined'&&D.id*1>0){var f=this.renderPreview(D);B.push(f);return;}if(D.type.indexOf('image')!=-1){this.delegates.push((function(){A.process(D); +}this.uploader.show();if(this.boxes>0&&this.files.length>this.boxes-1){this.uploader.hide();}var A=this;var B=[];var C=[];Roo.each(this.files,function(D){if(typeof(D.id)!='undefined'&&D.id*1>0){var f=this.renderPreview(D);B.push(f);return;}if(D.type.indexOf('image')!=-1){this.delegates.push((function(){A.process(D); }).createDelegate(this));return;}C.push((function(){A.process(D);}).createDelegate(this));},this);this.files=B;this.delegates=this.delegates.concat(C);if(!this.delegates.length){this.refresh();return;}this.progressBar.aria_valuemax=this.delegates.length;this.arrange(); -return;},arrange:function(){if(!this.delegates.length){this.progressDialog.hide(false);this.refresh();return;}var A=this.delegates.shift();this.progressDialog.show(false);this.progressDialog.setTitle((this.progressBar.aria_valuemax-this.delegates.length)+' / '+this.progressBar.aria_valuemax); -this.progressBar.update(this.progressBar.aria_valuemax-this.delegates.length);A();},refresh:function(){this.uploader.show(false);if(this.boxes>0&&this.files.length>this.boxes-1){this.uploader.hide(false);}Roo.isTouch?this.closable(false):this.closable(true); -this.fireEvent('refresh',this);},onRemove:function(e,el,o){e.preventDefault();this.fireEvent('remove',this,o);},remove:function(o){var A=[];Roo.each(this.files,function(B){if(typeof(B.id)=='undefined'||B.id*1<1||B.id!=o.id){A.push(B);return;}o.target.remove(); -},this);this.files=A;this.refresh();},clear:function(){Roo.each(this.files,function(A){if(!A.target){return;}A.target.remove();},this);this.files=[];this.refresh();},onClick:function(e,el,o){e.preventDefault();this.fireEvent('click',this,o);},closable:function(A){Roo.each(this.managerEl.select('.roo-document-manager-preview > button.close',true).elements,function(el){el.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block'; +return;},arrange:function(){if(!this.delegates.length){this.progressDialog.hide();this.refresh();return;}var A=this.delegates.shift();this.progressDialog.show();this.progressDialog.setTitle((this.progressBar.aria_valuemax-this.delegates.length)+' / '+this.progressBar.aria_valuemax); +this.progressBar.update(this.progressBar.aria_valuemax-this.delegates.length);A();},refresh:function(){this.uploader.show();if(this.boxes>0&&this.files.length>this.boxes-1){this.uploader.hide();}Roo.isTouch?this.closable(false):this.closable(true);this.fireEvent('refresh',this); +},onRemove:function(e,el,o){e.preventDefault();this.fireEvent('remove',this,o);},remove:function(o){var A=[];Roo.each(this.files,function(B){if(typeof(B.id)=='undefined'||B.id*1<1||B.id!=o.id){A.push(B);return;}o.target.remove();},this);this.files=A;this.refresh(); +},clear:function(){Roo.each(this.files,function(A){if(!A.target){return;}A.target.remove();},this);this.files=[];this.refresh();},onClick:function(e,el,o){e.preventDefault();this.fireEvent('click',this,o);},closable:function(A){Roo.each(this.managerEl.select('.roo-document-manager-preview > button.close',true).elements,function(el){el.setVisibilityMode(Roo.Element.DISPLAY).originalDisplay='block'; if(A){el.show();return;}el.hide();},this);},xhrOnLoad:function(A){Roo.each(this.managerEl.select('.roo-document-manager-loading',true).elements,function(el){el.remove();},this);if(A.readyState!==4){this.arrange();this.fireEvent('exception',this,A);return; }var B=Roo.decode(A.responseText);if(!B.success){this.arrange();this.fireEvent('exception',this,A);return;}var C=this.renderPreview(B.data);this.files.push(C);this.arrange();this.fireEvent('afterupload',this,A);},xhrOnError:function(A){Roo.log('xhr on error'); var B=Roo.decode(A.responseText);Roo.log(B);this.arrange();},process:function(A){if(this.fireEvent('process',this,A)!==false){if(this.editable&&A.type.indexOf('image')!=-1){this.fireEvent('edit',this,A);return;}this.uploadStart(A,false);return;}},uploadStart:function(A,B){this.xhr=new XMLHttpRequest();