Fix #6696 - Document Browse
[roojs1] / roojs-bootstrap.js
index 5b62445..2f3837c 100644 (file)
@@ -25,9 +25,9 @@ return cn;}var I=A.items;delete A.items;if(!skip_children){for(var i=0;i<I.lengt
 }if(typeof(this.visibilityEl)=='string'){return this.visibilityEl=='parent'?this.parent().getEl():this.getEl();}return this.getEl();},show:function(){if(!this.getVisibilityEl()){return;}this.getVisibilityEl().removeClass(['hidden','d-none']);this.fireEvent('show',this);
 },hide:function(){if(!this.getVisibilityEl()){return;}this.getVisibilityEl().addClass(['hidden','d-none']);this.fireEvent('hide',this);}});
 // Roo/bootstrap/Element.js
-Roo.bootstrap.Element=function(A){Roo.bootstrap.Element.superclass.constructor.call(this,A);this.addEvents({"click":true});};Roo.extend(Roo.bootstrap.Element,Roo.bootstrap.Component,{tag:'div',cls:'',html:'',preventDefault:false,clickable:false,tapedTwice:false,getAutoCreate:function(){var A={tag:this.tag,html:this.html}
-;return A;},initEvents:function(){Roo.bootstrap.Element.superclass.initEvents.call(this);if(this.clickable){this.el.on('click',this.onClick,this);}},onClick:function(e){if(this.preventDefault){e.preventDefault();}this.fireEvent('dblclick',this,e);},getValue:function(){return this.el.dom.innerHTML;
-},setValue:function(A){this.el.dom.innerHTML=A;}});
+Roo.bootstrap.Element=function(A){Roo.bootstrap.Element.superclass.constructor.call(this,A);this.addEvents({"click":true});};Roo.extend(Roo.bootstrap.Element,Roo.bootstrap.Component,{tag:'div',cls:'',html:'',preventDefault:false,clickable:false,tapedTwice:false,role:false,getAutoCreate:function(){var A={tag:this.tag,html:this.html}
+;if(this.role!==false){A.role=this.role;}return A;},initEvents:function(){Roo.bootstrap.Element.superclass.initEvents.call(this);if(this.clickable){this.el.on('click',this.onClick,this);}},onClick:function(e){if(this.preventDefault){e.preventDefault();}this.fireEvent('click',this,e);
+},getValue:function(){return this.el.dom.innerHTML;},setValue:function(A){this.el.dom.innerHTML=A;}});
 // Roo/bootstrap/DropTarget.js
 Roo.bootstrap.DropTarget=function(A){Roo.bootstrap.DropTarget.superclass.constructor.call(this,A);this.addEvents({"drop":true});};Roo.extend(Roo.bootstrap.DropTarget,Roo.bootstrap.Element,{getAutoCreate:function(){},initEvents:function(){Roo.bootstrap.DropTarget.superclass.initEvents.call(this);
 this.dropZone=new Roo.dd.DropTarget(this.getEl(),{ddGroup:this.name,listeners:{drop:this.dragDrop.createDelegate(this),enter:this.dragEnter.createDelegate(this),out:this.dragOut.createDelegate(this),over:this.dragOver.createDelegate(this)}});this.dropZone.DDM.useCache=false}
@@ -94,8 +94,8 @@ if(A.hasClass('d-none')){A.removeClass('d-none');}return A;},getCardImageTop:fun
 },initEvents:function(){this.bodyEl=this.el.select('.card-body',true).first();this.containerEl=this.getChildContainer();if(this.dragable){this.dragZone=new Roo.dd.DragZone(this.getEl(),{containerScroll:true,ddGroup:this.drag_group||'default_card_drag_group'}
 );this.dragZone.getDragData=this.getDragData.createDelegate(this);}if(this.dropable){this.dropZone=new Roo.dd.DropZone(this.el.select('.card-body',true).first(),{containerScroll:true,ddGroup:this.drop_group||'default_card_drag_group'});this.dropZone.getTargetFromEvent=this.getTargetFromEvent.createDelegate(this);
 this.dropZone.onNodeEnter=this.onNodeEnter.createDelegate(this);this.dropZone.onNodeOver=this.onNodeOver.createDelegate(this);this.dropZone.onNodeOut=this.onNodeOut.createDelegate(this);this.dropZone.onNodeDrop=this.onNodeDrop.createDelegate(this);}if(this.collapsable){this.el.select('.card-header',true).on('click',this.onToggleCollapse,this);
-}if(this.rotateable){this.el.select('.card-header',true).on('click',this.onToggleRotate,this);}this.collapsableEl=this.el.select('.roo-collapsable').first();this.footerEl=this.el.select('.card-footer').first();this.collapsableToggleEl=this.el.select('.roo-collapse-toggle');
-this.headerContainerEl=this.el.select('.roo-card-header-ctr').first();this.headerEl=this.el.select('.card-header',true).first();if(this.rotated){this.el.addClass('roo-card-rotated');this.fireEvent('rotate',this,true);}this.header_imageEl=this.el.select('.card-img-top',true).first();
+}if(this.rotateable){this.el.select('.card-header',true).on('click',this.onToggleRotate,this);}this.collapsableEl=this.el.select('.roo-collapsable',true).first();this.footerEl=this.el.select('.card-footer',true).first();this.collapsableToggleEl=this.el.select('.roo-collapse-toggle',true).first();
+this.headerContainerEl=this.el.select('.roo-card-header-ctr',true).first();this.headerEl=this.el.select('.card-header',true).first();if(this.rotated){this.el.addClass('roo-card-rotated');this.fireEvent('rotate',this,true);}this.header_imageEl=this.el.select('.card-img-top',true).first();
 this.header_imageEl.on('load',this.onHeaderImageLoad,this);},getDragData:function(e){var A=this.getEl();if(A){var B={source:this,copy:false,nodes:this.getEl(),records:[]};B.ddel=A.dom;Roo.log(A.getWidth());B.ddel.style.width=A.getWidth()+'px';return B;}return false;
 },getTargetFromEvent:function(e,A){var B=e.getTarget();while((B!==null)&&(B.parentNode!=this.containerEl.dom)){B=B.parentNode;}var C={position:'',cards:[],card_n:-1,items_n:-1,card:false};var D=false;var E=0;var F=0;for(var i=0;i<this.items.length;i++){if(!this.items[i].el.hasClass('card')){continue;
 }D=this.getDropPoint(e,this.items[i].el.dom);F=C.cards.length;C.cards.push(this.items[i]);E=i;if(C.card_n<0&&D=='above'){C.position=F>0?'below':D;C.items_n=i>0?i-1:0;C.card_n=F>0?F-1:0;C.card=C.cards[C.card_n];}}if(!C.cards.length){C.card=true;C.position='below';
@@ -253,10 +253,11 @@ return false;}return true;});return r;}});Roo.apply(Roo.bootstrap.NavGroup,{grou
 // Roo/bootstrap/NavItem.js
 Roo.bootstrap.NavItem=function(A){Roo.bootstrap.NavItem.superclass.constructor.call(this,A);this.addEvents({"click":true,'changed':true,'scrollto':true});};Roo.extend(Roo.bootstrap.NavItem,Roo.bootstrap.Component,{href:false,html:'',badge:'',icon:false,fa:false,glyphicon:false,active:false,preventDefault:false,tabId:false,tagtype:'a',tag:'li',disabled:false,animateRef:false,was_active:false,button_weight:'',button_outline:false,linkcls:'',navLink:false,getAutoCreate:function(){var A={tag:this.tag,cls:'nav-item'}
 ;A.cls=typeof(A.cls)=='undefined'?'':A.cls;if(this.active){A.cls+=' active';}if(this.disabled){A.cls+=' disabled';}if(this.button_weight.length){A.tag=this.href?'a':'button';A.html=this.html||'';A.cls+=' btn btn'+(this.button_outline?'-outline':'')+'-'+this.button_weight;
-if(this.href){A.href=this.href;}if(this.fa){A.html='<i class="fa fas fa-'+this.fa+'"></i> <span>'+this.html+'</span>';}if(this.badge!==''){A.html+=' <span class="badge badge-secondary">'+this.badge+'</span>';}return A;}if(this.href||this.html||this.glyphicon||this.icon||this.fa){A.cn=[{tag:this.tagtype,href:this.href||"#",html:this.html||''}
-];if(this.tagtype=='a'){A.cn[0].cls='nav-link'+(this.active?' active':'')+' '+this.linkcls;}if(this.icon){A.cn[0].html='<i class="'+this.icon+'"></i> <span>'+A.cn[0].html+'</span>';}if(this.fa){A.cn[0].html='<i class="fa fas fa-'+this.fa+'"></i> <span>'+A.cn[0].html+'</span>';
-}if(this.glyphicon){A.cn[0].html='<span class="glyphicon glyphicon-'+this.glyphicon+'"></span> '+A.cn[0].html;}if(this.menu){A.cn[0].html+=" <span class='caret'></span>";}if(this.badge!==''){A.cn[0].html+=' <span class="badge badge-secondary">'+this.badge+'</span>';
-}}return A;},onRender:function(ct,A){if(Roo.bootstrap.version==4&&ct.dom.type!='ul'){this.tag='div';}var B=Roo.bootstrap.NavItem.superclass.onRender.call(this,ct,A);this.navLink=this.el.select('.nav-link',true).first();return B;},initEvents:function(){if(typeof(this.menu)!='undefined'){this.menu.parentType=this.xtype;
+if(this.href){A.href=this.href;}if(this.fa){A.html='<i class="fa fas fa-'+this.fa+'"></i> <span class="nav-html">'+this.html+'</span>';}else{A.cls+=" nav-html";}if(this.badge!==''){A.html+=' <span class="badge badge-secondary">'+this.badge+'</span>';}return A;
+}if(this.href||this.html||this.glyphicon||this.icon||this.fa){A.cn=[{tag:this.tagtype,href:this.href||"#",html:this.html||'',cls:''}];if(this.tagtype=='a'){A.cn[0].cls='nav-link'+(this.active?' active':'')+' '+this.linkcls;}if(this.icon){A.cn[0].html='<i class="'+this.icon+'"></i> <span class="nav-html">'+A.cn[0].html+'</span>';
+}else if(this.fa){A.cn[0].html='<i class="fa fas fa-'+this.fa+'"></i> <span class="nav-html">'+A.cn[0].html+'</span>';}else if(this.glyphicon){A.cn[0].html='<span class="glyphicon glyphicon-'+this.glyphicon+'"></span> '+A.cn[0].html;}else{A.cn[0].cls+=" nav-html";
+}if(this.menu){A.cn[0].html+=" <span class='caret'></span>";}if(this.badge!==''){A.cn[0].html+=' <span class="badge badge-secondary">'+this.badge+'</span>';}}return A;},onRender:function(ct,A){if(Roo.bootstrap.version==4&&ct.dom.type!='ul'){this.tag='div';
+}var B=Roo.bootstrap.NavItem.superclass.onRender.call(this,ct,A);this.navLink=this.el.select('.nav-link',true).first();this.htmlEl=this.el.hasClass('nav-html')?this.el:this.el.select('.nav-html',true).first();return B;},initEvents:function(){if(typeof(this.menu)!='undefined'){this.menu.parentType=this.xtype;
 this.menu.triggerEl=this.el;this.menu=this.addxtype(Roo.apply({},this.menu));}this.el.on('click',this.onClick,this);this.parent().register(this);},onClick:function(e){if(e.getTarget('.dropdown-menu-item')){return;}if(this.preventDefault||this.href=='#'){Roo.log("NavItem - prevent Default?");
 e.preventDefault();}if(this.disabled){return;}var tg=Roo.bootstrap.TabGroup.get(this.navId);if(tg&&tg.transition){Roo.log("waiting for the transitionend");return;}if(this.fireEvent('click',this,e)===false){return;};if(this.tagtype=='span'){return;}var A=this.el.select('a',true).first();
 if(A&&this.animateRef&&this.href.indexOf('#')>-1){if(A.dom.href.split("#")[0]!=document.location.toString().split("#")[0]){return;}Roo.log("NavItem - prevent Default?");e.preventDefault();this.scrollToElement(e);}var p=this.parent();if(['tabs','pills'].indexOf(p.type)!==-1&&p.pilltype){if(typeof(p.setActiveItem)!=='undefined'){p.setActiveItem(this);
@@ -265,7 +266,7 @@ if(nv){nv.clearWasActive(this);}}this.active=A;if(!A){this.el.removeClass('activ
 }}if(B){this.fireEvent('changed',this,A);}if(!this.navId||!this.tabId||!A||C){return;}var tg=Roo.bootstrap.TabGroup.get(this.navId);if(!tg){return;}var D=tg.getPanelByName(this.tabId);if(!D){return;}if(false==tg.showPanel(D)){var nv=Roo.bootstrap.NavGroup.get(this.navId);
 if(nv){var E=nv.getWasActive();if(E){E.setActive(true,false,true);}}}},setDisabled:function(A){this.disabled=A;if(!A){this.el.removeClass('disabled');}else if(!this.el.hasClass('disabled')){this.el.addClass('disabled');}},tooltipEl:function(){return this.el;
 },scrollToElement:function(e){var c=document.body;if(Roo.isFirefox||Roo.isIE||Roo.isIE11){c=document.documentElement;}var A=Roo.get(c).select('a[name='+this.href.split('#')[1]+']',true).first();if(!A){return;}var o=A.calcOffsetsTo(c);var B={target:A,value:o[1]}
-;this.fireEvent('scrollto',this,B,e);Roo.get(c).scrollTo('top',B.value,true);return;}});
+;this.fireEvent('scrollto',this,B,e);Roo.get(c).scrollTo('top',B.value,true);return;},setHtml:function(A){this.html=A;this.htmlEl.dom.innerHTML=A;}});
 // Roo/bootstrap/NavSidebarItem.js
 Roo.bootstrap.NavSidebarItem=function(A){Roo.bootstrap.NavSidebarItem.superclass.constructor.call(this,A);this.addEvents({"click":true,'changed':true});};Roo.extend(Roo.bootstrap.NavSidebarItem,Roo.bootstrap.NavItem,{badgeWeight:'default',open:false,buttonView:false,buttonWeight:'default',buttonSize:'md',showArrow:true,getAutoCreate:function(){var a={tag:'a',href:this.href||'#',cls:'',html:'',cn:[]}
 ;if(this.buttonView){a={tag:'button',href:this.href||'#',cls:'btn btn-'+this.buttonWeight+' btn-'+this.buttonSize+'roo-button-dropdown-toggle',html:this.html,cn:[]};}var A={tag:'li',cls:'',cn:[a]};if(this.active){A.cls+=' active';}if(this.disabled){A.cls+=' disabled';