-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path1411.f8abe573bc1a549c.js
1 lines (1 loc) · 15.3 KB
/
1411.f8abe573bc1a549c.js
1
"use strict";(self.webpackChunkmaterial_angular_io=self.webpackChunkmaterial_angular_io||[]).push([[1411],{7851:(U,E,u)=>{u.d(E,{C2:()=>O,HI:()=>k,Hs:()=>g,Ud:()=>I,VY:()=>S,XJ:()=>L,Xx:()=>w,_0:()=>T,cu:()=>a,nZ:()=>K,rO:()=>i});var _=u(5017),t=u(4715),p=u(8929),x=u(591),M=u(1086),b=u(2986),A=u(2198),m=u(7625),o=u(4650),f=u(1281),N=u(445);class y{constructor(){this.expansionModel=new _.Ov(!0)}toggle(n){this.expansionModel.toggle(this._trackByValue(n))}expand(n){this.expansionModel.select(this._trackByValue(n))}collapse(n){this.expansionModel.deselect(this._trackByValue(n))}isExpanded(n){return this.expansionModel.isSelected(this._trackByValue(n))}toggleDescendants(n){this.expansionModel.isSelected(this._trackByValue(n))?this.collapseDescendants(n):this.expandDescendants(n)}collapseAll(){this.expansionModel.clear()}expandDescendants(n){let e=[n];e.push(...this.getDescendants(n)),this.expansionModel.select(...e.map(s=>this._trackByValue(s)))}collapseDescendants(n){let e=[n];e.push(...this.getDescendants(n)),this.expansionModel.deselect(...e.map(s=>this._trackByValue(s)))}_trackByValue(n){return this.trackBy?this.trackBy(n):n}}class O extends y{constructor(n,e,s){super(),this.getLevel=n,this.isExpandable=e,this.options=s,this.options&&(this.trackBy=this.options.trackBy)}getDescendants(n){const s=[];for(let d=this.dataNodes.indexOf(n)+1;d<this.dataNodes.length&&this.getLevel(n)<this.getLevel(this.dataNodes[d]);d++)s.push(this.dataNodes[d]);return s}expandAll(){this.expansionModel.select(...this.dataNodes.map(n=>this._trackByValue(n)))}}class S extends y{constructor(n,e){super(),this.getChildren=n,this.options=e,this.options&&(this.trackBy=this.options.trackBy)}expandAll(){this.expansionModel.clear();const n=this.dataNodes.reduce((e,s)=>[...e,...this.getDescendants(s),s],[]);this.expansionModel.select(...n.map(e=>this._trackByValue(e)))}getDescendants(n){const e=[];return this._getDescendants(e,n),e.splice(1)}_getDescendants(n,e){n.push(e);const s=this.getChildren(e);Array.isArray(s)?s.forEach(d=>this._getDescendants(n,d)):(0,t.b)(s)&&s.pipe((0,b.q)(1),(0,A.h)(Boolean)).subscribe(d=>{for(const c of d)this._getDescendants(n,c)})}}const k=new o.OlP("CDK_TREE_NODE_OUTLET_NODE");let a=(()=>{class r{constructor(e,s){this.viewContainer=e,this._node=s}}return r.\u0275fac=function(e){return new(e||r)(o.Y36(o.s_b),o.Y36(k,8))},r.\u0275dir=o.lG2({type:r,selectors:[["","cdkTreeNodeOutlet",""]]}),r})();class h{constructor(n){this.$implicit=n}}let i=(()=>{class r{constructor(e){this.template=e}}return r.\u0275fac=function(e){return new(e||r)(o.Y36(o.Rgc))},r.\u0275dir=o.lG2({type:r,selectors:[["","cdkTreeNodeDef",""]],inputs:{when:["cdkTreeNodeDefWhen","when"]}}),r})(),T=(()=>{class r{constructor(e,s){this._differs=e,this._changeDetectorRef=s,this._onDestroy=new p.xQ,this._levels=new Map,this.viewChange=new x.X({start:0,end:Number.MAX_VALUE})}get dataSource(){return this._dataSource}set dataSource(e){this._dataSource!==e&&this._switchDataSource(e)}ngOnInit(){this._dataDiffer=this._differs.find([]).create(this.trackBy)}ngOnDestroy(){this._nodeOutlet.viewContainer.clear(),this.viewChange.complete(),this._onDestroy.next(),this._onDestroy.complete(),this._dataSource&&"function"==typeof this._dataSource.disconnect&&this.dataSource.disconnect(this),this._dataSubscription&&(this._dataSubscription.unsubscribe(),this._dataSubscription=null)}ngAfterContentChecked(){const e=this._nodeDefs.filter(s=>!s.when);this._defaultNodeDef=e[0],this.dataSource&&this._nodeDefs&&!this._dataSubscription&&this._observeRenderChanges()}_switchDataSource(e){this._dataSource&&"function"==typeof this._dataSource.disconnect&&this.dataSource.disconnect(this),this._dataSubscription&&(this._dataSubscription.unsubscribe(),this._dataSubscription=null),e||this._nodeOutlet.viewContainer.clear(),this._dataSource=e,this._nodeDefs&&this._observeRenderChanges()}_observeRenderChanges(){let e;(0,_.Z9)(this._dataSource)?e=this._dataSource.connect(this):(0,t.b)(this._dataSource)?e=this._dataSource:Array.isArray(this._dataSource)&&(e=(0,M.of)(this._dataSource)),e&&(this._dataSubscription=e.pipe((0,m.R)(this._onDestroy)).subscribe(s=>this.renderNodeChanges(s)))}renderNodeChanges(e,s=this._dataDiffer,d=this._nodeOutlet.viewContainer,c){const D=s.diff(e);!D||(D.forEachOperation((C,R,P)=>{if(null==C.previousIndex)this.insertNode(e[P],P,d,c);else if(null==P)d.remove(R),this._levels.delete(C.item);else{const W=d.get(R);d.move(W,P)}}),this._changeDetectorRef.detectChanges())}_getNodeDef(e,s){return 1===this._nodeDefs.length?this._nodeDefs.first:this._nodeDefs.find(c=>c.when&&c.when(s,e))||this._defaultNodeDef}insertNode(e,s,d,c){const D=this._getNodeDef(e,s),C=new h(e);C.level=this.treeControl.getLevel?this.treeControl.getLevel(e):typeof c<"u"&&this._levels.has(c)?this._levels.get(c)+1:0,this._levels.set(e,C.level),(d||this._nodeOutlet.viewContainer).createEmbeddedView(D.template,C,s),g.mostRecentTreeNode&&(g.mostRecentTreeNode.data=e)}}return r.\u0275fac=function(e){return new(e||r)(o.Y36(o.ZZ4),o.Y36(o.sBO))},r.\u0275cmp=o.Xpm({type:r,selectors:[["cdk-tree"]],contentQueries:function(e,s,d){if(1&e&&o.Suo(d,i,5),2&e){let c;o.iGM(c=o.CRH())&&(s._nodeDefs=c)}},viewQuery:function(e,s){if(1&e&&o.Gf(a,7),2&e){let d;o.iGM(d=o.CRH())&&(s._nodeOutlet=d.first)}},hostAttrs:["role","tree",1,"cdk-tree"],inputs:{dataSource:"dataSource",treeControl:"treeControl",trackBy:"trackBy"},exportAs:["cdkTree"],decls:1,vars:0,consts:[["cdkTreeNodeOutlet",""]],template:function(e,s){1&e&&o.GkF(0,0)},dependencies:[a],encapsulation:2}),r})(),g=(()=>{class r{constructor(e,s){this._elementRef=e,this._tree=s,this._destroyed=new p.xQ,this._dataChanges=new p.xQ,r.mostRecentTreeNode=this,this.role="treeitem"}get role(){return"treeitem"}set role(e){this._elementRef.nativeElement.setAttribute("role",e)}get data(){return this._data}set data(e){e!==this._data&&(this._data=e,this._setRoleFromData(),this._dataChanges.next())}get isExpanded(){return this._tree.treeControl.isExpanded(this._data)}get level(){return this._tree.treeControl.getLevel?this._tree.treeControl.getLevel(this._data):this._parentNodeAriaLevel}ngOnInit(){this._parentNodeAriaLevel=function F(r){let n=r.parentElement;for(;n&&!Z(n);)n=n.parentElement;return n?n.classList.contains("cdk-nested-tree-node")?(0,f.su)(n.getAttribute("aria-level")):0:-1}(this._elementRef.nativeElement),this._elementRef.nativeElement.setAttribute("aria-level",`${this.level+1}`)}ngOnDestroy(){r.mostRecentTreeNode===this&&(r.mostRecentTreeNode=null),this._dataChanges.complete(),this._destroyed.next(),this._destroyed.complete()}focus(){this._elementRef.nativeElement.focus()}_setRoleFromData(){this.role="treeitem"}}return r.mostRecentTreeNode=null,r.\u0275fac=function(e){return new(e||r)(o.Y36(o.SBq),o.Y36(T))},r.\u0275dir=o.lG2({type:r,selectors:[["cdk-tree-node"]],hostAttrs:[1,"cdk-tree-node"],hostVars:1,hostBindings:function(e,s){2&e&&o.uIk("aria-expanded",s.isExpanded)},inputs:{role:"role"},exportAs:["cdkTreeNode"]}),r})();function Z(r){const n=r.classList;return!(!n?.contains("cdk-nested-tree-node")&&!n?.contains("cdk-tree"))}let w=(()=>{class r extends g{constructor(e,s,d){super(e,s),this._differs=d}ngAfterContentInit(){this._dataDiffer=this._differs.find([]).create(this._tree.trackBy);const e=this._tree.treeControl.getChildren(this.data);Array.isArray(e)?this.updateChildrenNodes(e):(0,t.b)(e)&&e.pipe((0,m.R)(this._destroyed)).subscribe(s=>this.updateChildrenNodes(s)),this.nodeOutlet.changes.pipe((0,m.R)(this._destroyed)).subscribe(()=>this.updateChildrenNodes())}ngOnInit(){super.ngOnInit()}ngOnDestroy(){this._clear(),super.ngOnDestroy()}updateChildrenNodes(e){const s=this._getNodeOutlet();e&&(this._children=e),s&&this._children?this._tree.renderNodeChanges(this._children,this._dataDiffer,s.viewContainer,this._data):this._dataDiffer.diff([])}_clear(){const e=this._getNodeOutlet();e&&(e.viewContainer.clear(),this._dataDiffer.diff([]))}_getNodeOutlet(){const e=this.nodeOutlet;return e&&e.find(s=>!s._node||s._node===this)}}return r.\u0275fac=function(e){return new(e||r)(o.Y36(o.SBq),o.Y36(T),o.Y36(o.ZZ4))},r.\u0275dir=o.lG2({type:r,selectors:[["cdk-nested-tree-node"]],contentQueries:function(e,s,d){if(1&e&&o.Suo(d,a,5),2&e){let c;o.iGM(c=o.CRH())&&(s.nodeOutlet=c)}},hostAttrs:[1,"cdk-nested-tree-node"],inputs:{role:"role",disabled:"disabled",tabIndex:"tabIndex"},exportAs:["cdkNestedTreeNode"],features:[o._Bn([{provide:g,useExisting:r},{provide:k,useExisting:r}]),o.qOj]}),r})();const Y=/([A-Za-z%]+)$/;let L=(()=>{class r{constructor(e,s,d,c){this._treeNode=e,this._tree=s,this._element=d,this._dir=c,this._destroyed=new p.xQ,this.indentUnits="px",this._indent=40,this._setPadding(),c&&c.change.pipe((0,m.R)(this._destroyed)).subscribe(()=>this._setPadding(!0)),e._dataChanges.subscribe(()=>this._setPadding())}get level(){return this._level}set level(e){this._setLevelInput(e)}get indent(){return this._indent}set indent(e){this._setIndentInput(e)}ngOnDestroy(){this._destroyed.next(),this._destroyed.complete()}_paddingIndent(){const e=this._treeNode.data&&this._tree.treeControl.getLevel?this._tree.treeControl.getLevel(this._treeNode.data):null,s=this._level??e;return"number"==typeof s?`${s*this._indent}${this.indentUnits}`:null}_setPadding(e=!1){const s=this._paddingIndent();if(s!==this._currentPadding||e){const d=this._element.nativeElement,c=this._dir&&"rtl"===this._dir.value?"paddingRight":"paddingLeft",D="paddingLeft"===c?"paddingRight":"paddingLeft";d.style[c]=s||"",d.style[D]="",this._currentPadding=s}}_setLevelInput(e){this._level=(0,f.su)(e,null),this._setPadding()}_setIndentInput(e){let s=e,d="px";if("string"==typeof e){const c=e.split(Y);s=c[0],d=c[1]||d}this.indentUnits=d,this._indent=(0,f.su)(s),this._setPadding()}}return r.\u0275fac=function(e){return new(e||r)(o.Y36(g),o.Y36(T),o.Y36(o.SBq),o.Y36(N.Is,8))},r.\u0275dir=o.lG2({type:r,selectors:[["","cdkTreeNodePadding",""]],inputs:{level:["cdkTreeNodePadding","level"],indent:["cdkTreeNodePaddingIndent","indent"]}}),r})(),I=(()=>{class r{constructor(e,s){this._tree=e,this._treeNode=s,this._recursive=!1}get recursive(){return this._recursive}set recursive(e){this._recursive=(0,f.Ig)(e)}_toggle(e){this.recursive?this._tree.treeControl.toggleDescendants(this._treeNode.data):this._tree.treeControl.toggle(this._treeNode.data),e.stopPropagation()}}return r.\u0275fac=function(e){return new(e||r)(o.Y36(T),o.Y36(g))},r.\u0275dir=o.lG2({type:r,selectors:[["","cdkTreeNodeToggle",""]],hostBindings:function(e,s){1&e&&o.NdJ("click",function(c){return s._toggle(c)})},inputs:{recursive:["cdkTreeNodeToggleRecursive","recursive"]}}),r})(),K=(()=>{class r{}return r.\u0275fac=function(e){return new(e||r)},r.\u0275mod=o.oAB({type:r}),r.\u0275inj=o.cJS({}),r})()},1411:(U,E,u)=>{u.r(E),u.d(E,{CdkTreeExamplesModule:()=>k,CdkTreeFlatExample:()=>N,CdkTreeNestedExample:()=>O});var _=u(7851),t=u(4650),p=u(4859),x=u(7392),M=u(5017);function b(a,h){if(1&a&&(t.TgZ(0,"cdk-tree-node",3),t._UZ(1,"button",4),t._uU(2),t.qZA()),2&a){const i=h.$implicit,l=t.oxw();t.Udp("display",l.shouldRender(i)?"flex":"none"),t.xp6(2),t.hij(" ",i.name," ")}}function A(a,h){if(1&a){const i=t.EpF();t.TgZ(0,"cdk-tree-node",3)(1,"button",5),t.NdJ("click",function(){const B=t.CHM(i).$implicit;return t.KtG(B.isExpanded=!B.isExpanded)}),t.TgZ(2,"mat-icon",6),t._uU(3),t.qZA()(),t._uU(4),t.qZA()}if(2&a){const i=h.$implicit,l=t.oxw();t.Udp("display",l.shouldRender(i)?"flex":"none"),t.xp6(1),t.Udp("visibility",i.expandable?"visible":"hidden"),t.uIk("aria-label","Toggle "+i.name),t.xp6(2),t.hij(" ",l.treeControl.isExpanded(i)?"expand_more":"chevron_right"," "),t.xp6(1),t.hij(" ",i.name," ")}}function m(a,h){if(1&a&&(t.TgZ(0,"cdk-nested-tree-node",3),t._UZ(1,"button",4),t._uU(2),t.qZA()),2&a){const i=h.$implicit;t.xp6(2),t.hij(" ",i.name," ")}}function o(a,h){if(1&a&&(t.TgZ(0,"cdk-nested-tree-node",3)(1,"button",5)(2,"mat-icon",6),t._uU(3),t.qZA()(),t._uU(4),t.TgZ(5,"div"),t.GkF(6,7),t.qZA()()),2&a){const i=h.$implicit,l=t.oxw();t.xp6(1),t.uIk("aria-label","Toggle "+i.name),t.xp6(2),t.hij(" ",l.treeControl.isExpanded(i)?"expand_more":"chevron_right"," "),t.xp6(1),t.hij(" ",i.name," "),t.xp6(1),t.ekj("example-tree-invisible",!l.treeControl.isExpanded(i))}}const f=[{name:"Fruit",expandable:!0,level:0},{name:"Apple",expandable:!1,level:1},{name:"Banana",expandable:!1,level:1},{name:"Fruit loops",expandable:!1,level:1},{name:"Vegetables",expandable:!0,level:0},{name:"Green",expandable:!0,level:1},{name:"Broccoli",expandable:!1,level:2},{name:"Brussels sprouts",expandable:!1,level:2},{name:"Orange",expandable:!0,level:1},{name:"Pumpkins",expandable:!1,level:2},{name:"Carrots",expandable:!1,level:2}];let N=(()=>{class a{constructor(){this.treeControl=new _.C2(i=>i.level,i=>i.expandable),this.dataSource=new M.P3(f),this.hasChild=(i,l)=>l.expandable}getParentNode(i){for(let v=f.indexOf(i)-1;v>=0;v--)if(f[v].level===i.level-1)return f[v];return null}shouldRender(i){let l=this.getParentNode(i);for(;l;){if(!l.isExpanded)return!1;l=this.getParentNode(l)}return!0}}return a.\u0275fac=function(i){return new(i||a)},a.\u0275cmp=t.Xpm({type:a,selectors:[["cdk-tree-flat-example"]],decls:3,vars:3,consts:[[3,"dataSource","treeControl"],["cdkTreeNodePadding","","class","example-tree-node",3,"display",4,"cdkTreeNodeDef"],["cdkTreeNodePadding","","class","example-tree-node",3,"display",4,"cdkTreeNodeDef","cdkTreeNodeDefWhen"],["cdkTreeNodePadding","",1,"example-tree-node"],["mat-icon-button","","disabled",""],["mat-icon-button","","cdkTreeNodeToggle","",3,"click"],[1,"mat-icon-rtl-mirror"]],template:function(i,l){1&i&&(t.TgZ(0,"cdk-tree",0),t.YNc(1,b,3,3,"cdk-tree-node",1),t.YNc(2,A,5,7,"cdk-tree-node",2),t.qZA()),2&i&&(t.Q6J("dataSource",l.dataSource)("treeControl",l.treeControl),t.xp6(2),t.Q6J("cdkTreeNodeDefWhen",l.hasChild))},dependencies:[_.rO,_.XJ,_.Ud,_._0,_.Hs,p.RK,x.Hw],styles:[".example-tree-node[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n}"]}),a})();const y=[{name:"Fruit",children:[{name:"Apple"},{name:"Banana"},{name:"Fruit loops"}]},{name:"Vegetables",children:[{name:"Green",children:[{name:"Broccoli"},{name:"Brussels sprouts"}]},{name:"Orange",children:[{name:"Pumpkins"},{name:"Carrots"}]}]}];let O=(()=>{class a{constructor(){this.treeControl=new _.VY(i=>i.children),this.dataSource=new M.P3(y),this.hasChild=(i,l)=>!!l.children&&l.children.length>0}}return a.\u0275fac=function(i){return new(i||a)},a.\u0275cmp=t.Xpm({type:a,selectors:[["cdk-tree-nested-example"]],decls:3,vars:3,consts:[[3,"dataSource","treeControl"],["class","example-tree-node",4,"cdkTreeNodeDef"],["class","example-tree-node",4,"cdkTreeNodeDef","cdkTreeNodeDefWhen"],[1,"example-tree-node"],["mat-icon-button","","disabled",""],["mat-icon-button","","cdkTreeNodeToggle",""],[1,"mat-icon-rtl-mirror"],["cdkTreeNodeOutlet",""]],template:function(i,l){1&i&&(t.TgZ(0,"cdk-tree",0),t.YNc(1,m,3,1,"cdk-nested-tree-node",1),t.YNc(2,o,7,5,"cdk-nested-tree-node",2),t.qZA()),2&i&&(t.Q6J("dataSource",l.dataSource)("treeControl",l.treeControl),t.xp6(2),t.Q6J("cdkTreeNodeDefWhen",l.hasChild))},dependencies:[_.Xx,_.rO,_.Ud,_._0,_.cu,p.RK,x.Hw],styles:[".example-tree-invisible[_ngcontent-%COMP%] {\n display: none;\n}\n\n.example-tree[_ngcontent-%COMP%] ul[_ngcontent-%COMP%], .example-tree[_ngcontent-%COMP%] li[_ngcontent-%COMP%] {\n margin-top: 0;\n margin-bottom: 0;\n list-style-type: none;\n}\n.example-tree-node[_ngcontent-%COMP%] {\n display: block;\n}\n\n.example-tree-node[_ngcontent-%COMP%] .example-tree-node[_ngcontent-%COMP%] {\n padding-left: 40px;\n}"]}),a})(),k=(()=>{class a{}return a.\u0275fac=function(i){return new(i||a)},a.\u0275mod=t.oAB({type:a}),a.\u0275inj=t.cJS({imports:[_.nZ,p.ot,x.Ps]}),a})()}}]);