angular-docs-cn/aio/dist/live-example-live-example-m...

2 lines
4.1 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[9],{m7ka:function(t,e,n){"use strict";n.r(e),n.d(e,"LiveExampleModule",function(){return S});var i=n("ofXK"),c=n("jn67"),o=n("fXoL");function s(t,e){const n="string"==typeof e?e:e.find(e=>t.hasOwnProperty(e.toLowerCase()));return void 0===n?void 0:t[n.toLowerCase()]}function a(t,e=!1){return void 0===t?e:"false"!==t.trim()}const r=["content"];function l(t,e){if(1&t&&(o.Tb(0,"p"),o.Ac(1," You can also "),o.Tb(2,"a",8),o.Ac(3,"download this example"),o.Sb(),o.Ac(4,". "),o.Sb()),2&t){const t=o.ec(2);o.Cb(2),o.jc("href",t.zip,o.uc)}}function b(t,e){if(1&t&&(o.Tb(0,"span"),o.Tb(1,"div",5),o.Pb(2,"aio-embedded-stackblitz",6),o.Sb(),o.zc(3,l,5,1,"p",7),o.Sb()),2&t){const t=o.ec();o.Cb(1),o.kc("title",t.title),o.Cb(1),o.jc("src",t.stackblitz),o.Cb(1),o.jc("ngIf",t.enableDownload)}}function d(t,e){if(1&t&&(o.Tb(0,"span"),o.Tb(1,"a",9),o.Ac(2),o.Sb(),o.Sb()),2&t){const t=o.ec();o.Cb(1),o.kc("title",t.title),o.jc("href",t.zip,o.uc),o.Cb(1),o.Bc(t.title)}}function f(t,e){if(1&t&&(o.Tb(0,"span"),o.Ac(1," / "),o.Tb(2,"a",8),o.Ac(3,"download example"),o.Sb(),o.Sb()),2&t){const t=o.ec(2);o.Cb(2),o.jc("href",t.zip,o.uc)}}function u(t,e){if(1&t&&(o.Tb(0,"span"),o.Tb(1,"a",10),o.Ac(2),o.Sb(),o.zc(3,f,4,1,"span",7),o.Sb()),2&t){const t=o.ec();o.Cb(1),o.kc("title",t.title),o.jc("href",t.stackblitz,o.uc),o.Cb(1),o.Bc(t.title),o.Cb(1),o.jc("ngIf",t.enableDownload)}}const m=["*"],p=["iframe"],h=c.a+"live-examples/",w=c.a+"zips/";let g=(()=>{class t{constructor(t,e){const n=function(t){const e=t instanceof o.l?t.nativeElement.attributes:t.attributes,n={};for(const i of e)n[i.name.toLowerCase()]=i.value;return n}(t),i=this.getExampleDir(n,e.path(!1)),c=this.getStackblitzName(n);this.mode=this.getMode(n),this.enableDownload=this.getEnableDownload(n),this.stackblitz=this.getStackblitz(i,c,"embedded"===this.mode),this.zip=this.getZip(i,c),this.title=this.getTitle(n)}ngAfterContentInit(){const t=this.content.nativeElement.textContent.trim();t&&(this.title=t)}getEnableDownload(t){return!a(s(t,"noDownload"))}getExampleDir(t,e){let n=s(t,"name");if(!n){const t=e.match(/[^/?#]+(?=\/?(?:\?|#|$))/);n=t?t[0]:"index"}return n.trim()}getMode(t){const e=a(s(t,"downloadOnly")),n=a(s(t,"embedded"));return e?"downloadOnly":n?"embedded":"default"}getStackblitz(t,e,n){return`${h}${t}/${e}stackblitz.html${n?"?ctl=1":""}`}getStackblitzName(t){const e=(s(t,"stackblitz")||"").trim();return e&&e+"."}getTitle(t){return(s(t,"title")||"live example").trim()}getZip(t,e){const n=t.split("/")[0];return`${w}${t}/${e}${n}.zip`}}return t.\u0275fac=function(e){return new(e||t)(o.Ob(o.l),o.Ob(i.g))},t.\u0275cmp=o.Ib({type:t,selectors:[["live-example"]],viewQuery:function(t,e){if(1&t&&o.Ec(r,3),2&t){let t;o.oc(t=o.bc())&&(e.content=t.first)}},ngContentSelectors:m,decls:7,vars:3,consts:[[2,"display","none"],["content",""],[3,"ngSwitch"],[4,"ngSwitchCase"],[4,"ngSwitchDefault"],[3,"title"],[3,"src"],[4,"ngIf"],["download","","title","Download example",3,"href"],["download","",3,"href","title"],["target","_blank",3,"href","title"]],template:function(t,e){1&t&&(o.ic(),o.Tb(0,"span",0,1),o.hc(2),o.Sb(),o.Tb(3,"span",2),o.zc(4,b,4,3,"span",3),o.zc(5,d,3,3,"span",3),o.zc(6,u,4,4,"span",4),o.Sb()),2&t&&(o.Cb(3),o.jc("ngSwitch",e.mode),o.Cb(1),o.jc("ngSwitchCase","embedded"),o.Cb(1),o.jc("ngSwitchCase","downloadOnly"))},directives:function(){return[i.m,i.n,i.o,C,i.k]},encapsulation:2}),t})(),C=(()=>{class t{ngAfterViewInit(){this.iframe&&(this.iframe.nativeElement.src=this.src)}}return t.\u0275fac=function(e){return new(e||t)},t.\u0275cmp=o.Ib({type:t,selectors:[["aio-embedded-stackblitz"]],viewQuery:function(t,e){if(1&t&&o.Ec(p,3),2&t){let t;o.oc(t=o.bc())&&(e.iframe=t.first)}},inputs:{src:"src"},decls:2,vars:0,consts:[["frameborder","0","width","100%","height","100%"],["iframe",""]],template:function(t,e){1&t&&o.Pb(0,"iframe",0,1)},styles:["iframe[_ngcontent-%COMP%] { min-height: 400px; }"]}),t})(),S=(()=>{class t{constructor(){this.customElementComponent=g}}return t.\u0275mod=o.Mb({type:t}),t.\u0275inj=o.Lb({factory:function(e){return new(e||t)},imports:[[i.c]]}),t})()}}]);
//# sourceMappingURL=live-example-live-example-module-es2015.e26ac21b0f5aff3a4dc7.js.map