From: Alan Knowles Date: Mon, 21 Jan 2019 04:05:42 +0000 (+0800) Subject: Fix #5665 - pre-commit hooks for roojs X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=5bd1c0f72df9c81039eb575cd433edf7658cf3b9 Fix #5665 - pre-commit hooks for roojs --- diff --git a/Roo/ContentPanel.js b/Roo/ContentPanel.js index 0b5b670f45..29f2a68ceb 100644 --- a/Roo/ContentPanel.js +++ b/Roo/ContentPanel.js @@ -130,8 +130,7 @@ Roo.ContentPanel = function(el, config, content){ * @param {Roo.ContentPanel} this */ "render" : true - - + }); @@ -307,7 +306,7 @@ panel.load({ } if(this.footer){ var te = this.footer.getEl(); - Roo.log("footer:" + te.getHeight()); + //Roo.log("footer:" + te.getHeight()); height -= te.getHeight(); te.setWidth(width); diff --git a/buildSDK/pre-commit b/buildSDK/pre-commit index 3d9d1c99d5..054d4a3774 100755 --- a/buildSDK/pre-commit +++ b/buildSDK/pre-commit @@ -66,16 +66,24 @@ function changed_files() function trigger_action_file($fn, $filename) { $ret = explode("\n",file_get_contents(__DIR__ . "/" . $filename)); + $add = array(); + foreach($ret as $r) { + $r=trim($r); + if (strlen($r)) { + $add[] = str_replace('.','/', $r) . ".js"; + } + } $ret[] = "buildSDK/".$filename; - return trigger_action($fn, $ret); + return trigger_action($fn, $add); } function trigger_action($fn, $files) { - $changed = changed_files(); + foreach(changed_files() as $cg) { foreach($files as $f) { + $f = trim($f); if ($f == $cg) { echo "RUNNING : $fn\n"; $fn(); diff --git a/docs/src/Roo_ContentPanel.js.html b/docs/src/Roo_ContentPanel.js.html index 39d1864b8c..64de07caae 100644 --- a/docs/src/Roo_ContentPanel.js.html +++ b/docs/src/Roo_ContentPanel.js.html @@ -132,7 +132,6 @@ "render" : true - }); diff --git a/roojs-all.js b/roojs-all.js index 64497672e2..b622a52cdc 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -665,10 +665,10 @@ if(!this.parent&&C){this.parent={el:true};}if(!this.parent){Roo.debug&&Roo.log(" })};}else{this.parent={el:new Roo.BorderLayout(el||document.body,{center:{titlebar:false,autoScroll:false,closeOnTab:true,tabPosition:'top',alwaysShowTabs:el&&hp?false:true,hideTabs:el||!hp?true:false,minTabWidth:140}})};}}if(!this.parent.el){return;}A.region=A.region||this.region; var D=false;if(this.parent.el===true){if(el){A.el=el;}this.parent.el=Roo.factory(A);D=true;}this.el=this.parent.el.addxtype(A,undefined,D);this.fireEvent('built',this);this.panel=this.el;this.layout=this.panel.layout;this.parentLayout=this.parent.layout||false; }});Roo.apply(Roo.XComponent,{hideProgress:false,buildCompleted:false,topModule:false,modules:[],elmodules:[],is_alt:false,build_from_html:false,register:function(A){Roo.XComponent.event.fireEvent('register',A);switch(typeof(A.disabled)){case 'undefined':break; -case 'function':if(A.disabled()){return;}break;default:if(A.disabled){return;}break;}this.modules.push(A);},toObject:function(str){if(!str||typeof(str)=='object'){return str;}if(str.substring(0,1)=='#'){return str;}var ar=str.split('.');var rt,o;rt=ar.shift(); -try{eval('if (typeof '+rt+' == "undefined"){ o = false;} o = '+rt+';');}catch(e){throw "Module not found : "+str;}if(o===false){throw "Module not found : "+str;}Roo.each(ar,function(e){if(typeof(o[e])=='undefined'){throw "Module not found : "+str;}o=o[e]; -});return o;},preBuild:function(){var _t=this;Roo.each(this.modules,function(A){Roo.XComponent.event.fireEvent('beforebuild',A);var B=A.parent;try{A.parent=this.toObject(B);}catch(e){Roo.debug&&Roo.log("parent:toObject failed: "+e.toString());return;}if(!A.parent){Roo.debug&&Roo.log("GOT top level module"); -Roo.debug&&Roo.log(A);A.modules=new Roo.util.MixedCollection(false,function(o){return o.order+''});this.topModule=A;return;}if(typeof(A.parent)=='string'){this.elmodules.push(A);return;}if(A.parent.constructor!=Roo.XComponent){Roo.debug&&Roo.log("Warning : Object Parent is not instance of XComponent:"+A.name)} +case 'function':if(A.disabled()){return;}break;default:if(A.disabled||A.region=='#disabled'){return;}break;}this.modules.push(A);},toObject:function(str){if(!str||typeof(str)=='object'){return str;}if(str.substring(0,1)=='#'){return str;}var ar=str.split('.'); +var rt,o;rt=ar.shift();try{eval('if (typeof '+rt+' == "undefined"){ o = false;} o = '+rt+';');}catch(e){throw "Module not found : "+str;}if(o===false){throw "Module not found : "+str;}Roo.each(ar,function(e){if(typeof(o[e])=='undefined'){throw "Module not found : "+str; +}o=o[e];});return o;},preBuild:function(){var _t=this;Roo.each(this.modules,function(A){Roo.XComponent.event.fireEvent('beforebuild',A);var B=A.parent;try{A.parent=this.toObject(B);}catch(e){Roo.debug&&Roo.log("parent:toObject failed: "+e.toString());return; +}if(!A.parent){Roo.debug&&Roo.log("GOT top level module");Roo.debug&&Roo.log(A);A.modules=new Roo.util.MixedCollection(false,function(o){return o.order+''});this.topModule=A;return;}if(typeof(A.parent)=='string'){this.elmodules.push(A);return;}if(A.parent.constructor!=Roo.XComponent){Roo.debug&&Roo.log("Warning : Object Parent is not instance of XComponent:"+A.name)} if(!A.parent.modules){A.parent.modules=new Roo.util.MixedCollection(false,function(o){return o.order+''});}if(A.parent.disabled){A.disabled=true;}A.parent.modules.add(A);},this);},buildOrder:function(){var A=this;var B=function(a,b){return String(a).toUpperCase()>String(b).toUpperCase()?1:-1; };if((!this.topModule||!this.topModule.modules)&&!this.elmodules.length){throw "No top level modules to build";}var C=this.topModule?[this.topModule]:[];Roo.each(this.elmodules,function(e){C.push(e);if(!this.topModule&&typeof(e.parent)=='string'&&e.parent.substring(0,1)=='#'&&Roo.get(e.parent.substr(1))){A.topModule=e; }});var D=function(m){Roo.debug&&Roo.log("build Order: add: "+m.name);C.push(m);if(m.modules&&!m.disabled){Roo.debug&&Roo.log("build Order: "+m.modules.length+" child modules");m.modules.keySort('ASC',B);Roo.debug&&Roo.log("build Order: "+m.modules.length+" child modules (after sort)"); @@ -922,8 +922,8 @@ break;case 'date':da[c.name]=new Date();break;case 'float':da[c.name]=0.0;break; // Roo/data/DataProxy.js Roo.data.DataProxy=function(){this.addEvents({beforeload:true,load:true,loadexception:true});Roo.data.DataProxy.superclass.constructor.call(this);};Roo.extend(Roo.data.DataProxy,Roo.util.Observable); // Roo/data/MemoryProxy.js -Roo.data.MemoryProxy=function(A){if(A.data){A=A.data;}Roo.data.MemoryProxy.superclass.constructor.call(this);this.data=A;};Roo.extend(Roo.data.MemoryProxy,Roo.data.DataProxy,{load:function(A,B,C,D,E){A=A||{};var F;try{F=B.readRecords(this.data);}catch(e){this.fireEvent("loadexception",this,E,null,e); -C.call(D,null,E,false);return;}C.call(D,F,E,true);},update:function(A,B){}}); +Roo.data.MemoryProxy=function(A){if(A.data){A=A.data;}Roo.data.MemoryProxy.superclass.constructor.call(this);this.data=A;};Roo.extend(Roo.data.MemoryProxy,Roo.data.DataProxy,{load:function(A,B,C,D,E){A=A||{};var F;try{F=B.readRecords(A.data?A.data:this.data); +}catch(e){this.fireEvent("loadexception",this,E,null,e);C.call(D,null,E,false);return;}C.call(D,F,E,true);},update:function(A,B){}}); // Roo/data/HttpProxy.js Roo.data.HttpProxy=function(A){Roo.data.HttpProxy.superclass.constructor.call(this);this.conn=A;this.useAjax=!A||!A.events;};Roo.extend(Roo.data.HttpProxy,Roo.data.DataProxy,{getConnection:function(){return this.useAjax?Roo.Ajax:this.conn;},load:function(A,B,C,D,E){if(this.fireEvent("beforeload",this,A)!==false){var o={params:A||{} ,request:{callback:C,scope:D,arg:E},reader:B,callback:this.loadResponse,scope:this};if(this.useAjax){Roo.applyIf(o,this.conn);if(this.activeRequest){Roo.Ajax.abort(this.activeRequest);}this.activeRequest=Roo.Ajax.request(o);}else{this.conn.request(o);}}else{C.call(D||this,null,E,false); @@ -952,8 +952,8 @@ Roo.data.XmlReader=function(A,B){A=A||{};Roo.data.XmlReader.superclass.construct }if(this.meta.success){var sv=q.selectValue(this.meta.success,B,true);G=sv!==false&&sv!=='false';}var H=[];var ns=q.select(this.meta.record,B);for(var i=0,I=ns.length;i-1){A.el=this.el.appendChild(document.createElement("div"));var B=new Roo.factory(A);B.render&&B.render(false,''); diff --git a/roojs-debug.js b/roojs-debug.js index 55c8198718..bfdcb3c284 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -16418,7 +16418,7 @@ Roo.apply(Roo.XComponent, { break; default: - if (obj.disabled) { + if (obj.disabled || obj.region == '#disabled') { return; } break; @@ -23849,7 +23849,7 @@ Roo.extend(Roo.data.MemoryProxy, Roo.data.DataProxy, { params = params || {}; var result; try { - result = reader.readRecords(this.data); + result = reader.readRecords(params.data ? params.data :this.data); }catch(e){ this.fireEvent("loadexception", this, arg, null, e); callback.call(scope, null, arg, false); @@ -24588,24 +24588,31 @@ var myReader = new Roo.data.ArrayReader({ *

 [ [1, 'Bill', 'Gardener'], [2, 'Ben', 'Horticulturalist'] ]
   
- * @cfg {String} id (optional) The subscript within row Array that provides an ID for the Record + * @constructor * Create a new JsonReader * @param {Object} meta Metadata configuration options. - * @param {Object} recordType Either an Array of field definition objects + * @param {Object|Array} recordType Either an Array of field definition objects + * + * @cfg {Array} fields Array of field definition objects + * @cfg {String} id Name of the property within a row object that contains a record identifier value. * as specified to {@link Roo.data.Record#create}, * or an {@link Roo.data.Record} object + * + * * created using {@link Roo.data.Record#create}. */ Roo.data.ArrayReader = function(meta, recordType){ - Roo.data.ArrayReader.superclass.constructor.call(this, meta, recordType); + + + Roo.data.ArrayReader.superclass.constructor.call(this, meta, recordType||meta.fields); }; Roo.extend(Roo.data.ArrayReader, Roo.data.JsonReader, { /** * Create a data block containing Roo.data.Records from an XML document. * @param {Object} o An Array of row objects which represents the dataset. - * @return {Object} data A data block which is used by an Roo.data.Store object as + * @return {Object} A data block which is used by an {@link Roo.data.Store} object as * a cache of Roo.data.Records. */ readRecords : function(o){ @@ -34844,7 +34851,7 @@ Roo.extend(Roo.tree.MultiSelectionModel, Roo.util.Observable, { * @cfg {Boolean} allowDrop false if this node cannot be drop on * @cfg {Boolean} disabled true to start the node disabled * @cfg {String} icon The path to an icon for the node. The preferred way to do this - * is to use the cls or iconCls attributes and add the icon via a CSS background image. + * is to use the cls or iconCls attributes and add the icon via a CSS background image. * @cfg {String} cls A css class to be added to the node * @cfg {String} iconCls A css class to be added to the nodes icon element for applying css background images * @cfg {String} href URL of the link used for the node (defaults to #) @@ -36011,7 +36018,9 @@ Roo.extend(Roo.tree.RootTreeNodeUI, Roo.tree.TreeNodeUI, { myTreeLoader.on("beforeload", function(treeLoader, node) { this.baseParams.category = node.attributes.category; }, this); -< + + + * * This would pass an HTTP parameter called "category" to the server containing * the value of the Node's "category" attribute. * @constructor @@ -53360,8 +53369,7 @@ Roo.ContentPanel = function(el, config, content){ * @param {Roo.ContentPanel} this */ "render" : true - - + }); @@ -53537,7 +53545,7 @@ panel.load({ } if(this.footer){ var te = this.footer.getEl(); - Roo.log("footer:" + te.getHeight()); + //Roo.log("footer:" + te.getHeight()); height -= te.getHeight(); te.setWidth(width); diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js index 9e05db1d42..f1cc860b73 100644 --- a/roojs-ui-debug.js +++ b/roojs-ui-debug.js @@ -1399,7 +1399,7 @@ Roo.extend(Roo.data.MemoryProxy, Roo.data.DataProxy, { params = params || {}; var result; try { - result = reader.readRecords(this.data); + result = reader.readRecords(params.data ? params.data :this.data); }catch(e){ this.fireEvent("loadexception", this, arg, null, e); callback.call(scope, null, arg, false); @@ -2138,24 +2138,31 @@ var myReader = new Roo.data.ArrayReader({ *

 [ [1, 'Bill', 'Gardener'], [2, 'Ben', 'Horticulturalist'] ]
   
- * @cfg {String} id (optional) The subscript within row Array that provides an ID for the Record + * @constructor * Create a new JsonReader * @param {Object} meta Metadata configuration options. - * @param {Object} recordType Either an Array of field definition objects + * @param {Object|Array} recordType Either an Array of field definition objects + * + * @cfg {Array} fields Array of field definition objects + * @cfg {String} id Name of the property within a row object that contains a record identifier value. * as specified to {@link Roo.data.Record#create}, * or an {@link Roo.data.Record} object + * + * * created using {@link Roo.data.Record#create}. */ Roo.data.ArrayReader = function(meta, recordType){ - Roo.data.ArrayReader.superclass.constructor.call(this, meta, recordType); + + + Roo.data.ArrayReader.superclass.constructor.call(this, meta, recordType||meta.fields); }; Roo.extend(Roo.data.ArrayReader, Roo.data.JsonReader, { /** * Create a data block containing Roo.data.Records from an XML document. * @param {Object} o An Array of row objects which represents the dataset. - * @return {Object} data A data block which is used by an Roo.data.Store object as + * @return {Object} A data block which is used by an {@link Roo.data.Store} object as * a cache of Roo.data.Records. */ readRecords : function(o){ @@ -12394,7 +12401,7 @@ Roo.extend(Roo.tree.MultiSelectionModel, Roo.util.Observable, { * @cfg {Boolean} allowDrop false if this node cannot be drop on * @cfg {Boolean} disabled true to start the node disabled * @cfg {String} icon The path to an icon for the node. The preferred way to do this - * is to use the cls or iconCls attributes and add the icon via a CSS background image. + * is to use the cls or iconCls attributes and add the icon via a CSS background image. * @cfg {String} cls A css class to be added to the node * @cfg {String} iconCls A css class to be added to the nodes icon element for applying css background images * @cfg {String} href URL of the link used for the node (defaults to #) @@ -13561,7 +13568,9 @@ Roo.extend(Roo.tree.RootTreeNodeUI, Roo.tree.TreeNodeUI, { myTreeLoader.on("beforeload", function(treeLoader, node) { this.baseParams.category = node.attributes.category; }, this); -< + + + * * This would pass an HTTP parameter called "category" to the server containing * the value of the Node's "category" attribute. * @constructor @@ -30910,8 +30919,7 @@ Roo.ContentPanel = function(el, config, content){ * @param {Roo.ContentPanel} this */ "render" : true - - + }); @@ -31087,7 +31095,7 @@ panel.load({ } if(this.footer){ var te = this.footer.getEl(); - Roo.log("footer:" + te.getHeight()); + //Roo.log("footer:" + te.getHeight()); height -= te.getHeight(); te.setWidth(width); diff --git a/roojs-ui.js b/roojs-ui.js index 237118ed26..35f91ad523 100644 --- a/roojs-ui.js +++ b/roojs-ui.js @@ -53,8 +53,8 @@ break;case 'date':da[c.name]=new Date();break;case 'float':da[c.name]=0.0;break; // Roo/data/DataProxy.js Roo.data.DataProxy=function(){this.addEvents({beforeload:true,load:true,loadexception:true});Roo.data.DataProxy.superclass.constructor.call(this);};Roo.extend(Roo.data.DataProxy,Roo.util.Observable); // Roo/data/MemoryProxy.js -Roo.data.MemoryProxy=function(A){if(A.data){A=A.data;}Roo.data.MemoryProxy.superclass.constructor.call(this);this.data=A;};Roo.extend(Roo.data.MemoryProxy,Roo.data.DataProxy,{load:function(A,B,C,D,E){A=A||{};var F;try{F=B.readRecords(this.data);}catch(e){this.fireEvent("loadexception",this,E,null,e); -C.call(D,null,E,false);return;}C.call(D,F,E,true);},update:function(A,B){}}); +Roo.data.MemoryProxy=function(A){if(A.data){A=A.data;}Roo.data.MemoryProxy.superclass.constructor.call(this);this.data=A;};Roo.extend(Roo.data.MemoryProxy,Roo.data.DataProxy,{load:function(A,B,C,D,E){A=A||{};var F;try{F=B.readRecords(A.data?A.data:this.data); +}catch(e){this.fireEvent("loadexception",this,E,null,e);C.call(D,null,E,false);return;}C.call(D,F,E,true);},update:function(A,B){}}); // Roo/data/HttpProxy.js Roo.data.HttpProxy=function(A){Roo.data.HttpProxy.superclass.constructor.call(this);this.conn=A;this.useAjax=!A||!A.events;};Roo.extend(Roo.data.HttpProxy,Roo.data.DataProxy,{getConnection:function(){return this.useAjax?Roo.Ajax:this.conn;},load:function(A,B,C,D,E){if(this.fireEvent("beforeload",this,A)!==false){var o={params:A||{} ,request:{callback:C,scope:D,arg:E},reader:B,callback:this.loadResponse,scope:this};if(this.useAjax){Roo.applyIf(o,this.conn);if(this.activeRequest){Roo.Ajax.abort(this.activeRequest);}this.activeRequest=Roo.Ajax.request(o);}else{this.conn.request(o);}}else{C.call(D||this,null,E,false); @@ -83,8 +83,8 @@ Roo.data.XmlReader=function(A,B){A=A||{};Roo.data.XmlReader.superclass.construct }if(this.meta.success){var sv=q.selectValue(this.meta.success,B,true);G=sv!==false&&sv!=='false';}var H=[];var ns=q.select(this.meta.record,B);for(var i=0,I=ns.length;i-1){A.el=this.el.appendChild(document.createElement("div"));var B=new Roo.factory(A);B.render&&B.render(false,'');