From: Alan Knowles Date: Fri, 30 Nov 2018 07:51:24 +0000 (+0800) Subject: Uncommited changes synced X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=294506d9a9f5302102745775107795bdc854e4e7 Uncommited changes synced --- diff --git a/Roo/bootstrap/Input.js b/Roo/bootstrap/Input.js index 6b970c1860..21f9ea1a7f 100644 --- a/Roo/bootstrap/Input.js +++ b/Roo/bootstrap/Input.js @@ -537,9 +537,10 @@ Roo.extend(Roo.bootstrap.Input, Roo.bootstrap.Component, { cfg.cls += ' navbar-form'; } - if (this.parentType === 'NavGroup') { - cfg.cls += ' navbar-form'; - cfg.tag = 'li'; + if (this.parentType === 'NavGroup' && !(Roo.bootstrap.version == 4 && this.parent().form)) { + // on BS4 we do this only if not form + cfg.cls += ' navbar-form'; + cfg.tag = 'li'; } return cfg; diff --git a/Roo/bootstrap/NavGroup.js b/Roo/bootstrap/NavGroup.js index 6cd3ce6b42..15e239e7f7 100644 --- a/Roo/bootstrap/NavGroup.js +++ b/Roo/bootstrap/NavGroup.js @@ -57,15 +57,20 @@ Roo.extend(Roo.bootstrap.NavGroup, Roo.bootstrap.Component, { tag : 'ul', cls: 'nav' }; - - if (['tabs','pills'].indexOf(this.type)!==-1) { - cfg.cls += ' nav-' + this.type - } else { - if (this.type!=='nav') { - Roo.log('nav type must be nav/tabs/pills') - } - cfg.cls += ' navbar-nav' - } + if (Roo.bootstrap.version == 4) { + if (this.type == 'pills') { + cfg.cls = ' nav-pills'; + } + } else { + if (['tabs','pills'].indexOf(this.type)!==-1) { + cfg.cls += ' nav-' + this.type + } else { + if (this.type !== 'nav') { + Roo.log('nav type must be nav/tabs/pills') + } + cfg.cls += ' navbar-nav' + } + } if (this.parent() && this.parent().sidebar) { cfg = { @@ -79,7 +84,7 @@ Roo.extend(Roo.bootstrap.NavGroup, Roo.bootstrap.Component, { if (this.form === true) { cfg = { tag: 'form', - cls: 'navbar-form' + cls: 'navbar-form form-inline' }; if (this.align === 'right') { @@ -166,7 +171,10 @@ Roo.extend(Roo.bootstrap.NavGroup, Roo.bootstrap.Component, { */ addItem : function(cfg) { - var cn = new Roo.bootstrap.NavItem(cfg); + if (this.form && Roo.bootstrap.version == 4) { + cfg.tag = 'div'; + } + var cn = new Roo.bootstrap.NavItem(cfg); this.register(cn); cn.parentId = this.id; cn.onRender(this.el, null); diff --git a/Roo/bootstrap/NavItem.js b/Roo/bootstrap/NavItem.js index cff0ad0458..cc2ce294ec 100644 --- a/Roo/bootstrap/NavItem.js +++ b/Roo/bootstrap/NavItem.js @@ -71,6 +71,7 @@ Roo.extend(Roo.bootstrap.NavItem, Roo.bootstrap.Component, { preventDefault : false, tabId : false, tagtype : 'a', + tag: 'li', disabled : false, animateRef : false, was_active : false, @@ -78,7 +79,7 @@ Roo.extend(Roo.bootstrap.NavItem, Roo.bootstrap.Component, { getAutoCreate : function(){ var cfg = { - tag: 'li', + tag: this.tag, cls: 'nav-item' }; @@ -127,6 +128,17 @@ Roo.extend(Roo.bootstrap.NavItem, Roo.bootstrap.Component, { return cfg; }, + onRender : function(ct, position) + { + // Roo.log("Call onRender: " + this.xtype); + if (Roo.bootstrap.version == 4 && ct.dom.type != 'ul') { + this.tag = 'div'; + } + + return Roo.bootstrap.NavItem.superclass.onRender.call(this, ct, position); + }, + + initEvents: function() { if (typeof (this.menu) != 'undefined') { diff --git a/Roo/bootstrap/NavToolbar.js b/Roo/bootstrap/NavToolbar.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/examples/bootstrap/nested.js b/examples/bootstrap/nested.js index e8506c0141..0fc6ebbc3e 100644 --- a/examples/bootstrap/nested.js +++ b/examples/bootstrap/nested.js @@ -141,10 +141,12 @@ Example.Nested = new Roo.XComponent({ toolbar : { xtype: 'NavSimplebar', xns : Roo.bootstrap, + items: [ { xtype: 'NavGroup', xns: Roo.bootstrap, + form: true, items : [ { xtype: 'NavItem', diff --git a/examples/bootstrap4/nested.html b/examples/bootstrap4/nested.html index a0f048be49..e7e2d0fd31 100644 --- a/examples/bootstrap4/nested.html +++ b/examples/bootstrap4/nested.html @@ -1,10 +1,5 @@ - - + + Nested Layout @@ -35,9 +30,7 @@ Roo.namespace("Example");