From 01c95d327a88435efb6a768f21a20506e43ba9ed Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Fri, 8 May 2020 16:15:43 +0800 Subject: [PATCH] roojs-ui.js roojs-ui-debug.js roojs-all.js roojs-debug.js Roo/grid/Grid.js --- Roo/grid/Grid.js | 12 +++++------- roojs-all.js | 22 +++++++++++----------- roojs-debug.js | 34 ++++++++++++++++++++++------------ roojs-ui-debug.js | 34 ++++++++++++++++++++++------------ roojs-ui.js | 22 +++++++++++----------- 5 files changed, 71 insertions(+), 53 deletions(-) diff --git a/Roo/grid/Grid.js b/Roo/grid/Grid.js index 68ebec6344..24da27ea12 100644 --- a/Roo/grid/Grid.js +++ b/Roo/grid/Grid.js @@ -521,13 +521,11 @@ Roo.extend(Roo.grid.Grid, Roo.util.Observable, { if (typeof(pos) == 'undefined' || pos >= this.cm.config.length) { pos = this.cm.config.length; //this.cm.config.push(cfg); } - pos = Math.max(0,pos); - ar.shift(ar.length); - ar.shift(pos); - this.cm.config.splice.call(ar); - - this.cm.config.splice(pos, 0, cfg); - } + pos = Math.max(0,pos); + ar.shift(ar.length); + ar.shift(pos); + this.cm.config.splice.call(ar); + this.view.generateRules(this.cm); diff --git a/roojs-all.js b/roojs-all.js index 063193d8a8..e57c5ec434 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -2302,17 +2302,17 @@ if((!c.dom.offsetHeight||c.dom.offsetHeight<20)||c.getStyle("height")=="auto"){t if(Roo.isTouch){c.on("touchstart",this.onTouchStart,this);}this.relayEvents(c,["mousedown","mouseup","mouseover","mouseout","keypress"]);this.getSelectionModel().init(this);A.render();if(this.loadMask){this.loadMask=new Roo.LoadMask(this.container,Roo.apply({store:this.dataSource} ,this.loadMask));}if(this.toolbar&&this.toolbar.xtype){this.toolbar.container=this.getView().getHeaderPanel(true);this.toolbar=new Roo.Toolbar(this.toolbar);}if(this.footer&&this.footer.xtype){this.footer.dataSource=this.getDataSource();this.footer.container=this.getView().getFooterPanel(true); this.footer=Roo.factory(this.footer,Roo);}if(this.dropTarget&&this.dropTarget.xtype){delete this.dropTarget.xtype;this.dropTarget=new Roo.dd.DropTarget(this.getView().mainBody,this.dropTarget);}this.rendered=true;this.fireEvent('render',this);return this; -},reconfigure:function(A,B){if(this.loadMask){this.loadMask.destroy();this.loadMask=new Roo.LoadMask(this.container,Roo.apply({store:A},this.loadMask));}this.view.bind(A,B);this.dataSource=A;this.colModel=B;this.view.refresh(true);},addColumn:function(A,B){A.id=typeof(A.id)=='undefined'?Roo.id():A.id; -this.cm.lookup[A.id]=A;if(typeof(B)=='undefined'||B>=this.cm.config.length){this.cm.config.push(A);this.view.refresh(true);return;}B=Math.max(0,B);this.cm.config.splice(B,0,A);this.view.refresh(true);}onKeyDown:function(e){this.fireEvent("keydown",e);},destroy:function(A,B){if(this.loadMask){this.loadMask.destroy(); -}var c=this.container;c.removeAllListeners();this.view.destroy();this.colModel.purgeListeners();if(!B){this.purgeListeners();}c.update("");if(A===true){c.remove();}},processEvent:function(A,e){if(A!='touchstart'){this.fireEvent(A,e);}var t=e.getTarget();var v=this.view; -var B=v.findHeaderIndex(t);if(B!==false){var C=A=='touchstart'?'click':A;this.fireEvent("header"+C,this,B,e);}else{var D=v.findRowIndex(t);var E=v.findCellIndex(t);if(A=='touchstart'){A=false;if(typeof(this.selModel.getSelectedCell)!='undefined'){var cs=this.selModel.getSelectedCell(); -if(D==cs[0]&&E==cs[1]){A='dblclick';}}if(typeof(this.selModel.getSelections)!='undefined'){var cs=this.selModel.getSelections();var ds=this.dataSource;if(cs.length==1&&ds.getAt(D)==cs[0]){A='dblclick';}}if(!A){return;}}if(D!==false){this.fireEvent("row"+A,this,D,e); -if(E!==false){this.fireEvent("cell"+A,this,D,E,e);}}}},onClick:function(e){this.processEvent("click",e);},onTouchStart:function(e){this.processEvent("touchstart",e);},onContextMenu:function(e,t){this.processEvent("contextmenu",e);},onDblClick:function(e){this.processEvent("dblclick",e); -},walkCells:function(A,B,C,fn,D){var cm=this.colModel,E=cm.getColumnCount();var ds=this.dataSource,F=ds.getCount(),G=true;if(C<0){if(B<0){A--;G=false;}while(A>=0){if(!G){B=E-1;}G=false;while(B>=0){if(fn.call(D||this,A,B,cm)===true){return [A,B];}B--;}A--; -}}else{if(B>=E){A++;G=false;}while(A=this.cm.config.length){A=this.cm.config.length;}A=Math.max(0,A);ar.shift(ar.length);ar.shift(A);this.cm.config.splice.call(ar); +this.view.generateRules(this.cm);this.view.refresh(true);},onKeyDown:function(e){this.fireEvent("keydown",e);},destroy:function(A,B){if(this.loadMask){this.loadMask.destroy();}var c=this.container;c.removeAllListeners();this.view.destroy();this.colModel.purgeListeners(); +if(!B){this.purgeListeners();}c.update("");if(A===true){c.remove();}},processEvent:function(A,e){if(A!='touchstart'){this.fireEvent(A,e);}var t=e.getTarget();var v=this.view;var B=v.findHeaderIndex(t);if(B!==false){var C=A=='touchstart'?'click':A;this.fireEvent("header"+C,this,B,e); +}else{var D=v.findRowIndex(t);var E=v.findCellIndex(t);if(A=='touchstart'){A=false;if(typeof(this.selModel.getSelectedCell)!='undefined'){var cs=this.selModel.getSelectedCell();if(D==cs[0]&&E==cs[1]){A='dblclick';}}if(typeof(this.selModel.getSelections)!='undefined'){var cs=this.selModel.getSelections(); +var ds=this.dataSource;if(cs.length==1&&ds.getAt(D)==cs[0]){A='dblclick';}}if(!A){return;}}if(D!==false){this.fireEvent("row"+A,this,D,e);if(E!==false){this.fireEvent("cell"+A,this,D,E,e);}}}},onClick:function(e){this.processEvent("click",e);},onTouchStart:function(e){this.processEvent("touchstart",e); +},onContextMenu:function(e,t){this.processEvent("contextmenu",e);},onDblClick:function(e){this.processEvent("dblclick",e);},walkCells:function(A,B,C,fn,D){var cm=this.colModel,E=cm.getColumnCount();var ds=this.dataSource,F=ds.getCount(),G=true;if(C<0){if(B<0){A--; +G=false;}while(A>=0){if(!G){B=E-1;}G=false;while(B>=0){if(fn.call(D||this,A,B,cm)===true){return [A,B];}B--;}A--;}}else{if(B>=E){A++;G=false;}while(A= this.cm.config.length) { - this.cm.config.push(cfg); - this.view.refresh(true); - return; + + for (var i =0;i< ar.length;i++) { + var cfg = ar[i]; + cfg.id = typeof(cfg.id) == 'undefined' ? Roo.id() : cfg.id; // don't normally use this.. + this.cm.lookup[cfg.id] = cfg; } - // splice + + + if (typeof(pos) == 'undefined' || pos >= this.cm.config.length) { + pos = this.cm.config.length; //this.cm.config.push(cfg); + } pos = Math.max(0,pos); - this.cm.config.splice(pos, 0, cfg); + ar.shift(ar.length); + ar.shift(pos); + this.cm.config.splice.call(ar); + + + + this.view.generateRules(this.cm); this.view.refresh(true); - } + }, diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js index 7eb4754113..2ef33c80ad 100644 --- a/roojs-ui-debug.js +++ b/roojs-ui-debug.js @@ -33000,26 +33000,36 @@ Roo.extend(Roo.grid.Grid, Roo.util.Observable, { this.view.refresh(true); }, /** - * addColumn + * addColumns * Add's a column, default at the end.. - * @param {Object} column configuration see {@link Roo.grid.ColumnModel} + * @param {int} position to add (default end) + * @param {Array} of objects of column configuration see {@link Roo.grid.ColumnModel} */ - addColumn : function(cfg, pos) + addColumns : function(pos, ar) { - cfg.id = typeof(cfg.id) == 'undefined' ? Roo.id() : cfg.id; // don't normally use this.. - this.cm.lookup[cfg.id] = cfg; - if (typeof(pos) == 'undefined' || pos >= this.cm.config.length) { - this.cm.config.push(cfg); - this.view.refresh(true); - return; + + for (var i =0;i< ar.length;i++) { + var cfg = ar[i]; + cfg.id = typeof(cfg.id) == 'undefined' ? Roo.id() : cfg.id; // don't normally use this.. + this.cm.lookup[cfg.id] = cfg; } - // splice + + + if (typeof(pos) == 'undefined' || pos >= this.cm.config.length) { + pos = this.cm.config.length; //this.cm.config.push(cfg); + } pos = Math.max(0,pos); - this.cm.config.splice(pos, 0, cfg); + ar.shift(ar.length); + ar.shift(pos); + this.cm.config.splice.call(ar); + + + + this.view.generateRules(this.cm); this.view.refresh(true); - } + }, diff --git a/roojs-ui.js b/roojs-ui.js index 44b6afe923..2e16f0b629 100644 --- a/roojs-ui.js +++ b/roojs-ui.js @@ -1432,17 +1432,17 @@ if((!c.dom.offsetHeight||c.dom.offsetHeight<20)||c.getStyle("height")=="auto"){t if(Roo.isTouch){c.on("touchstart",this.onTouchStart,this);}this.relayEvents(c,["mousedown","mouseup","mouseover","mouseout","keypress"]);this.getSelectionModel().init(this);A.render();if(this.loadMask){this.loadMask=new Roo.LoadMask(this.container,Roo.apply({store:this.dataSource} ,this.loadMask));}if(this.toolbar&&this.toolbar.xtype){this.toolbar.container=this.getView().getHeaderPanel(true);this.toolbar=new Roo.Toolbar(this.toolbar);}if(this.footer&&this.footer.xtype){this.footer.dataSource=this.getDataSource();this.footer.container=this.getView().getFooterPanel(true); this.footer=Roo.factory(this.footer,Roo);}if(this.dropTarget&&this.dropTarget.xtype){delete this.dropTarget.xtype;this.dropTarget=new Roo.dd.DropTarget(this.getView().mainBody,this.dropTarget);}this.rendered=true;this.fireEvent('render',this);return this; -},reconfigure:function(A,B){if(this.loadMask){this.loadMask.destroy();this.loadMask=new Roo.LoadMask(this.container,Roo.apply({store:A},this.loadMask));}this.view.bind(A,B);this.dataSource=A;this.colModel=B;this.view.refresh(true);},addColumn:function(A,B){A.id=typeof(A.id)=='undefined'?Roo.id():A.id; -this.cm.lookup[A.id]=A;if(typeof(B)=='undefined'||B>=this.cm.config.length){this.cm.config.push(A);this.view.refresh(true);return;}B=Math.max(0,B);this.cm.config.splice(B,0,A);this.view.refresh(true);}onKeyDown:function(e){this.fireEvent("keydown",e);},destroy:function(A,B){if(this.loadMask){this.loadMask.destroy(); -}var c=this.container;c.removeAllListeners();this.view.destroy();this.colModel.purgeListeners();if(!B){this.purgeListeners();}c.update("");if(A===true){c.remove();}},processEvent:function(A,e){if(A!='touchstart'){this.fireEvent(A,e);}var t=e.getTarget();var v=this.view; -var B=v.findHeaderIndex(t);if(B!==false){var C=A=='touchstart'?'click':A;this.fireEvent("header"+C,this,B,e);}else{var D=v.findRowIndex(t);var E=v.findCellIndex(t);if(A=='touchstart'){A=false;if(typeof(this.selModel.getSelectedCell)!='undefined'){var cs=this.selModel.getSelectedCell(); -if(D==cs[0]&&E==cs[1]){A='dblclick';}}if(typeof(this.selModel.getSelections)!='undefined'){var cs=this.selModel.getSelections();var ds=this.dataSource;if(cs.length==1&&ds.getAt(D)==cs[0]){A='dblclick';}}if(!A){return;}}if(D!==false){this.fireEvent("row"+A,this,D,e); -if(E!==false){this.fireEvent("cell"+A,this,D,E,e);}}}},onClick:function(e){this.processEvent("click",e);},onTouchStart:function(e){this.processEvent("touchstart",e);},onContextMenu:function(e,t){this.processEvent("contextmenu",e);},onDblClick:function(e){this.processEvent("dblclick",e); -},walkCells:function(A,B,C,fn,D){var cm=this.colModel,E=cm.getColumnCount();var ds=this.dataSource,F=ds.getCount(),G=true;if(C<0){if(B<0){A--;G=false;}while(A>=0){if(!G){B=E-1;}G=false;while(B>=0){if(fn.call(D||this,A,B,cm)===true){return [A,B];}B--;}A--; -}}else{if(B>=E){A++;G=false;}while(A=this.cm.config.length){A=this.cm.config.length;}A=Math.max(0,A);ar.shift(ar.length);ar.shift(A);this.cm.config.splice.call(ar); +this.view.generateRules(this.cm);this.view.refresh(true);},onKeyDown:function(e){this.fireEvent("keydown",e);},destroy:function(A,B){if(this.loadMask){this.loadMask.destroy();}var c=this.container;c.removeAllListeners();this.view.destroy();this.colModel.purgeListeners(); +if(!B){this.purgeListeners();}c.update("");if(A===true){c.remove();}},processEvent:function(A,e){if(A!='touchstart'){this.fireEvent(A,e);}var t=e.getTarget();var v=this.view;var B=v.findHeaderIndex(t);if(B!==false){var C=A=='touchstart'?'click':A;this.fireEvent("header"+C,this,B,e); +}else{var D=v.findRowIndex(t);var E=v.findCellIndex(t);if(A=='touchstart'){A=false;if(typeof(this.selModel.getSelectedCell)!='undefined'){var cs=this.selModel.getSelectedCell();if(D==cs[0]&&E==cs[1]){A='dblclick';}}if(typeof(this.selModel.getSelections)!='undefined'){var cs=this.selModel.getSelections(); +var ds=this.dataSource;if(cs.length==1&&ds.getAt(D)==cs[0]){A='dblclick';}}if(!A){return;}}if(D!==false){this.fireEvent("row"+A,this,D,e);if(E!==false){this.fireEvent("cell"+A,this,D,E,e);}}}},onClick:function(e){this.processEvent("click",e);},onTouchStart:function(e){this.processEvent("touchstart",e); +},onContextMenu:function(e,t){this.processEvent("contextmenu",e);},onDblClick:function(e){this.processEvent("dblclick",e);},walkCells:function(A,B,C,fn,D){var cm=this.colModel,E=cm.getColumnCount();var ds=this.dataSource,F=ds.getCount(),G=true;if(C<0){if(B<0){A--; +G=false;}while(A>=0){if(!G){B=E-1;}G=false;while(B>=0){if(fn.call(D||this,A,B,cm)===true){return [A,B];}B--;}A--;}}else{if(B>=E){A++;G=false;}while(A