From e6e74dd803c2f067844dd0d2a8b3176a06041b88 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Wed, 9 Jun 2021 11:04:37 +0800 Subject: [PATCH] cant refer to local with 'this' --- Roo/util/Format.js | 2 +- docs/src/Roo_util_Format.js.html | 7 ++++--- roojs-all.js | 2 +- roojs-core-debug.js | 7 ++++--- roojs-core.js | 2 +- roojs-debug.js | 7 ++++--- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Roo/util/Format.js b/Roo/util/Format.js index 3c0715c367..dd9c0dc49b 100644 --- a/Roo/util/Format.js +++ b/Roo/util/Format.js @@ -260,7 +260,7 @@ Roo.util.Format = function(){ return 0; } var i = parseInt(Math.floor(Math.log(value) / Math.log(1024))); - return this.number(value/ Math.pow(1024, i) ,decimals) + ' ' + sizes[i]; + return Roo.util.Format.number(value/ Math.pow(1024, i) ,decimals) + ' ' + sizes[i]; } diff --git a/docs/src/Roo_util_Format.js.html b/docs/src/Roo_util_Format.js.html index a6e4997d8d..7e7630980f 100644 --- a/docs/src/Roo_util_Format.js.html +++ b/docs/src/Roo_util_Format.js.html @@ -246,6 +246,7 @@ stripTags : function(v){ return !v ? v : String(v).replace(this.stripTagsRE, ""); }, + /** * Size in Mb,Gb etc. * @param {Number} value The number to be formated @@ -255,11 +256,11 @@ size : function(value, decimals) { var sizes = ['b', 'k', 'M', 'G', 'T']; - if (v == 0) { + if (value == 0) { return 0; } - var i = parseInt(Math.floor(Math.log(v) / Math.log(1024))); - return this.number(v / Math.pow(1024, i) ,decimals) + ' ' + sizes[i]; + var i = parseInt(Math.floor(Math.log(value) / Math.log(1024))); + return this.number(value/ Math.pow(1024, i) ,decimals) + ' ' + sizes[i]; } diff --git a/roojs-all.js b/roojs-all.js index b33beb3226..ee4701d565 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -574,7 +574,7 @@ return eval(fn).apply(window,B);}else{return eval(fn).call(window,value);}},toFi var fd=(ps[1]+z);var r=fd.substring(0,n);var rm=fd.substring(n);if(rm<5){return ps[0]+'.'+r;}r*=1;r++;if(String(r).length!=n){ps[0]*=1;ps[0]++;r=String(r).substring(1);}return ps[0]+'.'+r;},usMoney:function(v){return '$'+Roo.util.Format.number(v);},number:function(v,B,C){B=typeof(B)=='undefined'?2:B; C=typeof(C)=='undefined'?',':C;var D=Math.pow(10,B);var E=String(D).substring(1);v=(Math.round((v-0)*D))/D;v=String(v);var ps=v.split('.');var F=ps[0];var r=/(\d+)(\d{3})/;if(C.length!=0){F=F.replace(/\B(?=(\d{3})+(?!\d))/g,C);}var G=ps[1]?(B?('.'+ps[1]+E.substring(ps[1].length)):''):(B?('.'+E):''); return F+G;},date:function(v,B){if(!v){return "";}if(!(v instanceof Date)){v=new Date(Date.parse(v));}return v.dateFormat(B||Roo.util.Format.defaults.date);},dateRenderer:function(B){return function(v){return Roo.util.Format.date(v,B);};},stripTagsRE:/<\/?[^>]+>/gi,stripTags:function(v){return !v?v:String(v).replace(this.stripTagsRE,""); -},size:function(B,C){var D=['b','k','M','G','T'];if(v==0){return 0;}var i=parseInt(Math.floor(Math.log(v)/Math.log(1024)));return this.number(v/Math.pow(1024,i),C)+' '+D[i];}};}();Roo.util.Format.defaults={date:'d/M/Y'}; +},size:function(B,C){var D=['b','k','M','G','T'];if(B==0){return 0;}var i=parseInt(Math.floor(Math.log(B)/Math.log(1024)));return this.number(B/Math.pow(1024,i),C)+' '+D[i];}};}();Roo.util.Format.defaults={date:'d/M/Y'}; // Roo/MasterTemplate.js Roo.MasterTemplate=function(){Roo.MasterTemplate.superclass.constructor.apply(this,arguments);this.originalHtml=this.html;var st={};var m,re=this.subTemplateRe;re.lastIndex=0;var A=0;while(m=re.exec(this.html)){var B=m[1],C=m[2];st[A]={name:B,index:A,buffer:[],tpl:new Roo.Template(C)} ;if(B){st[B]=st[A];}st[A].tpl.compile();st[A].tpl.call=this.call.createDelegate(this);A++;}this.subCount=A;this.subs=st;};Roo.extend(Roo.MasterTemplate,Roo.Template,{subTemplateRe:/((?:.|\n)*?)<\/tpl>/gi,add:function(A,B){if(arguments.length==1){B=arguments[0]; diff --git a/roojs-core-debug.js b/roojs-core-debug.js index 02fc5b290f..f41e409065 100644 --- a/roojs-core-debug.js +++ b/roojs-core-debug.js @@ -13991,6 +13991,7 @@ Roo.util.Format = function(){ stripTags : function(v){ return !v ? v : String(v).replace(this.stripTagsRE, ""); }, + /** * Size in Mb,Gb etc. * @param {Number} value The number to be formated @@ -14000,11 +14001,11 @@ Roo.util.Format = function(){ size : function(value, decimals) { var sizes = ['b', 'k', 'M', 'G', 'T']; - if (v == 0) { + if (value == 0) { return 0; } - var i = parseInt(Math.floor(Math.log(v) / Math.log(1024))); - return this.number(v / Math.pow(1024, i) ,decimals) + ' ' + sizes[i]; + var i = parseInt(Math.floor(Math.log(value) / Math.log(1024))); + return this.number(value/ Math.pow(1024, i) ,decimals) + ' ' + sizes[i]; } diff --git a/roojs-core.js b/roojs-core.js index d5c015de8b..5dbbe1011e 100644 --- a/roojs-core.js +++ b/roojs-core.js @@ -574,7 +574,7 @@ return eval(fn).apply(window,B);}else{return eval(fn).call(window,value);}},toFi var fd=(ps[1]+z);var r=fd.substring(0,n);var rm=fd.substring(n);if(rm<5){return ps[0]+'.'+r;}r*=1;r++;if(String(r).length!=n){ps[0]*=1;ps[0]++;r=String(r).substring(1);}return ps[0]+'.'+r;},usMoney:function(v){return '$'+Roo.util.Format.number(v);},number:function(v,B,C){B=typeof(B)=='undefined'?2:B; C=typeof(C)=='undefined'?',':C;var D=Math.pow(10,B);var E=String(D).substring(1);v=(Math.round((v-0)*D))/D;v=String(v);var ps=v.split('.');var F=ps[0];var r=/(\d+)(\d{3})/;if(C.length!=0){F=F.replace(/\B(?=(\d{3})+(?!\d))/g,C);}var G=ps[1]?(B?('.'+ps[1]+E.substring(ps[1].length)):''):(B?('.'+E):''); return F+G;},date:function(v,B){if(!v){return "";}if(!(v instanceof Date)){v=new Date(Date.parse(v));}return v.dateFormat(B||Roo.util.Format.defaults.date);},dateRenderer:function(B){return function(v){return Roo.util.Format.date(v,B);};},stripTagsRE:/<\/?[^>]+>/gi,stripTags:function(v){return !v?v:String(v).replace(this.stripTagsRE,""); -},size:function(B,C){var D=['b','k','M','G','T'];if(v==0){return 0;}var i=parseInt(Math.floor(Math.log(v)/Math.log(1024)));return this.number(v/Math.pow(1024,i),C)+' '+D[i];}};}();Roo.util.Format.defaults={date:'d/M/Y'}; +},size:function(B,C){var D=['b','k','M','G','T'];if(B==0){return 0;}var i=parseInt(Math.floor(Math.log(B)/Math.log(1024)));return this.number(B/Math.pow(1024,i),C)+' '+D[i];}};}();Roo.util.Format.defaults={date:'d/M/Y'}; // Roo/MasterTemplate.js Roo.MasterTemplate=function(){Roo.MasterTemplate.superclass.constructor.apply(this,arguments);this.originalHtml=this.html;var st={};var m,re=this.subTemplateRe;re.lastIndex=0;var A=0;while(m=re.exec(this.html)){var B=m[1],C=m[2];st[A]={name:B,index:A,buffer:[],tpl:new Roo.Template(C)} ;if(B){st[B]=st[A];}st[A].tpl.compile();st[A].tpl.call=this.call.createDelegate(this);A++;}this.subCount=A;this.subs=st;};Roo.extend(Roo.MasterTemplate,Roo.Template,{subTemplateRe:/((?:.|\n)*?)<\/tpl>/gi,add:function(A,B){if(arguments.length==1){B=arguments[0]; diff --git a/roojs-debug.js b/roojs-debug.js index 4c9a82c533..b03a292c2e 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -13991,6 +13991,7 @@ Roo.util.Format = function(){ stripTags : function(v){ return !v ? v : String(v).replace(this.stripTagsRE, ""); }, + /** * Size in Mb,Gb etc. * @param {Number} value The number to be formated @@ -14000,11 +14001,11 @@ Roo.util.Format = function(){ size : function(value, decimals) { var sizes = ['b', 'k', 'M', 'G', 'T']; - if (v == 0) { + if (value == 0) { return 0; } - var i = parseInt(Math.floor(Math.log(v) / Math.log(1024))); - return this.number(v / Math.pow(1024, i) ,decimals) + ' ' + sizes[i]; + var i = parseInt(Math.floor(Math.log(value) / Math.log(1024))); + return this.number(value/ Math.pow(1024, i) ,decimals) + ' ' + sizes[i]; } -- 2.39.2