angular-docs-cn/aio/dist/default~code-code-example-m...

2 lines
54 KiB
JavaScript
Raw Permalink Normal View History

(window.webpackJsonp=window.webpackJsonp||[]).push([[1],{"+rOU":function(t,e,i){"use strict";i.d(e,"a",function(){return c}),i.d(e,"b",function(){return d}),i.d(e,"c",function(){return _}),i.d(e,"d",function(){return r}),i.d(e,"e",function(){return l}),i.d(e,"f",function(){return p}),i.d(e,"g",function(){return a});var s=i("fXoL"),n=i("ofXK");class o{attach(t){return this._attachedHost=t,t.attach(this)}detach(){let t=this._attachedHost;null!=t&&(this._attachedHost=null,t.detach())}get isAttached(){return null!=this._attachedHost}setAttachedHost(t){this._attachedHost=t}}class r extends o{constructor(t,e,i,s){super(),this.component=t,this.viewContainerRef=e,this.injector=i,this.componentFactoryResolver=s}}class a extends o{constructor(t,e,i){super(),this.templateRef=t,this.viewContainerRef=e,this.context=i}get origin(){return this.templateRef.elementRef}attach(t,e=this.context){return this.context=e,super.attach(t)}detach(){return this.context=void 0,super.detach()}}class h extends o{constructor(t){super(),this.element=t instanceof s.l?t.nativeElement:t}}class c{constructor(){this._isDisposed=!1,this.attachDomPortal=null}hasAttached(){return!!this._attachedPortal}attach(t){return t instanceof r?(this._attachedPortal=t,this.attachComponentPortal(t)):t instanceof a?(this._attachedPortal=t,this.attachTemplatePortal(t)):this.attachDomPortal&&t instanceof h?(this._attachedPortal=t,this.attachDomPortal(t)):void 0}detach(){this._attachedPortal&&(this._attachedPortal.setAttachedHost(null),this._attachedPortal=null),this._invokeDisposeFn()}dispose(){this.hasAttached()&&this.detach(),this._invokeDisposeFn(),this._isDisposed=!0}setDisposeFn(t){this._disposeFn=t}_invokeDisposeFn(){this._disposeFn&&(this._disposeFn(),this._disposeFn=null)}}class l extends c{constructor(t,e,i,s,n){super(),this.outletElement=t,this._componentFactoryResolver=e,this._appRef=i,this._defaultInjector=s,this.attachDomPortal=t=>{const e=t.element,i=this._document.createComment("dom-portal");e.parentNode.insertBefore(i,e),this.outletElement.appendChild(e),super.setDisposeFn(()=>{i.parentNode&&i.parentNode.replaceChild(e,i)})},this._document=n}attachComponentPortal(t){const e=(t.componentFactoryResolver||this._componentFactoryResolver).resolveComponentFactory(t.component);let i;return t.viewContainerRef?(i=t.viewContainerRef.createComponent(e,t.viewContainerRef.length,t.injector||t.viewContainerRef.injector),this.setDisposeFn(()=>i.destroy())):(i=e.create(t.injector||this._defaultInjector),this._appRef.attachView(i.hostView),this.setDisposeFn(()=>{this._appRef.detachView(i.hostView),i.destroy()})),this.outletElement.appendChild(this._getComponentRootNode(i)),i}attachTemplatePortal(t){let e=t.viewContainerRef,i=e.createEmbeddedView(t.templateRef,t.context);return i.rootNodes.forEach(t=>this.outletElement.appendChild(t)),i.detectChanges(),this.setDisposeFn(()=>{let t=e.indexOf(i);-1!==t&&e.remove(t)}),i}dispose(){super.dispose(),null!=this.outletElement.parentNode&&this.outletElement.parentNode.removeChild(this.outletElement)}_getComponentRootNode(t){return t.hostView.rootNodes[0]}}let d=(()=>{class t extends a{constructor(t,e){super(t,e)}}return t.\u0275fac=function(e){return new(e||t)(s.Ob(s.N),s.Ob(s.R))},t.\u0275dir=s.Jb({type:t,selectors:[["","cdkPortal",""]],exportAs:["cdkPortal"],features:[s.zb]}),t})(),_=(()=>{class t extends c{constructor(t,e,i){super(),this._componentFactoryResolver=t,this._viewContainerRef=e,this._isInitialized=!1,this.attached=new s.n,this.attachDomPortal=t=>{const e=t.element,i=this._document.createComment("dom-portal");t.setAttachedHost(this),e.parentNode.insertBefore(i,e),this._getRootNode().appendChild(e),super.setDisposeFn(()=>{i.parentNode&&i.parentNode.replaceChild(e,i)})},this._document=i}get portal(){return this._attachedPortal}set portal(t){(!this.hasAttached()||t||this._isInitialized)&&(this.hasAttached()&&super.detach(),t&&super.attach(t),this._attachedPortal=t)}get attachedRef(){return this._attachedRef}ngOnInit(){this._isInitialized=!0}ngOnDestroy(){super.dispose(),this._attachedPortal=null,this._attachedRef=null}attachCo
//# sourceMappingURL=default~code-code-example-module~code-code-tabs-module-es2015.48e4e1c9f1670b9cec23.js.map