From: Edward Date: Fri, 13 Jul 2018 06:08:38 +0000 (+0800) Subject: roojs-bootstrap.js X-Git-Url: http://git.roojs.org/?a=commitdiff_plain;h=2a1db797ae4360623f7e3ac751623317dada79f1;p=roojs1 roojs-bootstrap.js roojs-bootstrap-debug.js --- diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index f0e10dd04c..6a89c2686e 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -18,7 +18,8 @@ Roo.bootstrap = Roo.bootstrap || {}; * @cfg {string} name Specifies name attribute * @cfg {string} tooltip Text for the tooltip * @cfg {string} container_method method to fetch parents container element (used by NavHeaderbar - getHeaderChildContainer) - * + * @cfg {string|object} visibilityEl (el|parent) What element to use for visibility (@see getVisibilityEl()) + * @constructor * Do not use directly - it does not do anything.. * @param {Object} config The config object @@ -364,22 +365,36 @@ Roo.extend(Roo.bootstrap.Component, Roo.BoxComponent, { return cn; }, + /** + * Get the element that will be used to show or hide + */ + getVisibilityEl : function() + { + + if (typeof(this.visibilityEl) == 'object') { + return this.visibilityEl; + } + + if (typeof(this.visibilityEl) == 'string') { + return this.visibilityEl == 'parent' ? this.parent().getEl() : this.getEl(); + } + + + return this.getEl(); + + }, + /** * Show a component - removes 'hidden' class */ show : function() { - if(!this.getEl()){ - return; - } - - this.getEl().removeClass('hidden'); - - if(!this.hideParent){ + if(!this.getVisibilityEl()){ return; } + + this.getVisibilityEl().removeClass('hidden'); - this.parent().getEl().removeClass('hidden'); }, /** @@ -387,17 +402,11 @@ Roo.extend(Roo.bootstrap.Component, Roo.BoxComponent, { */ hide: function() { - if(!this.getEl() || this.getEl().hasClass('hidden')){ - return; - } - - this.getEl().addClass('hidden'); - - if(!this.hideParent){ + if(!this.getVisibilityEl()){ return; } - this.parent().getEl().addClass('hidden'); + this.getVisibilityEl().addClass('hidden'); } }); @@ -4931,7 +4940,7 @@ Roo.extend(Roo.bootstrap.Element, Roo.bootstrap.Component, { var cfg = { tag: this.tag, - // cls: this.cls, + // cls: this.cls, double assign in parent class Component.js :: onRender html: this.html }; @@ -8519,9 +8528,6 @@ Roo.form.VTypes = function(){ * @cfg {String} align (left|center|right) Default left * @cfg {Boolean} forceFeedback (true|false) Default false - * @cfg {Boolean} hideParent (true|false) Default false also hide the parent - * - * * * @constructor * Create a new Input @@ -8732,8 +8738,6 @@ Roo.extend(Roo.bootstrap.Input, Roo.bootstrap.Component, { labelsm : 0, labelxs : 0, - hideParent : false, - parentLabelAlign : function() { var parent = this; diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 702a10e92b..62d1d00c4e 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -10,9 +10,9 @@ this.el.dom.removeAttribute('xtype');this.initEvents();}return;}var B=Roo.apply( var D=(typeof(A['flexy:if'])!='undefined')||(typeof(A['flexy:foreach'])!='undefined');skip_children=false;if(!C){if(!this[B](true)){A.items=[];return A;}cn=Roo.factory(A);cn.parentType=this.xtype;cn.parentId=this.id;var E=Roo.XComponent.build_from_html;if(E&&Roo.get(document.body).attr('xtype')=='Roo.bootstrap.Body'){var F=Roo.get(this[B](false)); var G=F?F.child('>*[xtype]'):false;if(G){}if(G&&G.attr('xtype').split('.').pop()==cn.xtype){cn.el=G;}else{Roo.debug&&Roo.log("MISSING "+cn.xtype+" on child of "+(this.el?this.el.attr('xbuilderid'):'no parent'));Roo.debug&&Roo.log(F);Roo.debug&&Roo.log(G); Roo.debug&&Roo.log(cn);}}if(E&&D&&!cn.el&&cn.can_build_overlaid){Roo.debug&&Roo.log('skipping render');Roo.debug&&Roo.log(A);if(!cn.el){Roo.debug&&Roo.log('skipping all children');skip_children=true;}}else{cn.render&&cn.render(this[B](true));}}var H=[];if(!A.items||!A.items.length){cn.items=H; -return cn;}var I=A.items;delete A.items;if(!skip_children){for(var i=0;i