major doc changes
[roojs1] / Roo / bootstrap / Component.js
index 26a4ce3..3279787 100644 (file)
@@ -9,6 +9,8 @@ Roo.bootstrap = Roo.bootstrap || {};
 /**
  * @class Roo.bootstrap.Component
  * @extends Roo.Component
+ * @abstract
+ * @children Roo.bootstrap.Component
  * Bootstrap Component base class
  * @cfg {String} cls css class
  * @cfg {String} style any extra css
@@ -117,11 +119,11 @@ Roo.extend(Roo.bootstrap.Component, Roo.BoxComponent,  {
         }
         
         if (this.cls) {
-            cfg.cls = (typeof(cfg.cls) == 'undefined') ? this.cls : cfg.cls + ' ' + this.cls;
+            cfg.cls = (typeof(cfg.cls) == 'undefined' ? this.cls : cfg.cls) + ' ' + this.cls;
         }
         
         if (this.style) { // fixme needs to support more complex style data.
-            cfg.style = this.style;
+            cfg.style = (typeof(cfg.style) == 'undefined' ? this.style : cfg.style) + '; ' + this.style;
         }
         
         if(this.name){
@@ -149,6 +151,11 @@ Roo.extend(Roo.bootstrap.Component, Roo.BoxComponent,  {
     {
         return this.el;
     },
+    getDocumentBody : function() // used by menus - as they are attached to the body so zIndexes work
+    {
+        return Roo.get(document.body);
+    },
+    
     /**
      * Fetch the element to display the tooltip on.
      * @return {Roo.Element} defaults to this.el
@@ -366,19 +373,28 @@ Roo.extend(Roo.bootstrap.Component, Roo.BoxComponent,  {
         return cn;
     },
     
+    /**
+     * Set the element that will be used to show or hide
+     */
+    setVisibilityEl : function(el)
+    {
+       this.visibilityEl = el;
+    },
+    
+     /**
+     * Get the element that will be used to show or hide
+     */
     getVisibilityEl : function()
     {
-       
        if (typeof(this.visibilityEl) == 'object') {
-           return this.visibilityEl.getEl();
+           return this.visibilityEl;
        }
+       
        if (typeof(this.visibilityEl) == 'string') {
            return this.visibilityEl == 'parent' ? this.parent().getEl() : this.getEl();
        }
        
-       
        return this.getEl();
-       
     },
     
     /**
@@ -386,11 +402,13 @@ Roo.extend(Roo.bootstrap.Component, Roo.BoxComponent,  {
      */
     show : function()
     {
-        if(!this.getEl()){
+        if(!this.getVisibilityEl()){
             return;
         }
          
-        this.getVisibilityEl().removeClass('hidden');
+        this.getVisibilityEl().removeClass(['hidden','d-none']);
+        
+        this.fireEvent('show', this);
         
         
     },
@@ -399,11 +417,13 @@ Roo.extend(Roo.bootstrap.Component, Roo.BoxComponent,  {
      */
     hide: function()
     {
-        if(!this.getEl() || this.getEl().hasClass('hidden')){
+        if(!this.getVisibilityEl()){
             return;
         }
         
-        this.getVisibilityEl().removeClass('hidden');
+        this.getVisibilityEl().addClass(['hidden','d-none']);
+        
+        this.fireEvent('hide', this);
         
     }
 });