blob: 90ec0692c00badc8a11c0af481466239bd8fcb94 [file] [log] [blame]
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/cdk/tree"),require("@angular/core"),require("@angular/material/core"),require("@angular/common"),require("@angular/cdk/collections"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@angular/material/tree",["exports","@angular/cdk/tree","@angular/core","@angular/material/core","@angular/common","@angular/cdk/collections","rxjs","rxjs/operators"],t):t((e.ng=e.ng||{},e.ng.material=e.ng.material||{},e.ng.material.tree={}),e.ng.cdk.tree,e.ng.core,e.ng.material.core,e.ng.common,e.ng.cdk.collections,e.rxjs,e.rxjs.operators)}(this,function(e,t,r,n,o,a,i,d){"use strict";function s(e,t){function r(){this.constructor=e}u(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var u=function(e,t){return(u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},l=function(){function e(e,t){this.viewContainer=e,this._node=t}return e.decorators=[{type:r.Directive,args:[{selector:"[matTreeNodeOutlet]"}]}],e.ctorParameters=function(){return[{type:r.ViewContainerRef},{type:void 0,decorators:[{type:r.Inject,args:[t.CDK_TREE_NODE_OUTLET_NODE]},{type:r.Optional}]}]},e}(),c=n.mixinTabIndex(n.mixinDisabled(t.CdkTreeNode)),p=n.mixinTabIndex(n.mixinDisabled(t.CdkNestedTreeNode)),f=function(e){function n(t,r,n){var o=e.call(this,t,r)||this;return o._elementRef=t,o._tree=r,o.role="treeitem",o.tabIndex=Number(n)||0,o}return s(n,e),n.decorators=[{type:r.Directive,args:[{selector:"mat-tree-node",exportAs:"matTreeNode",inputs:["disabled","tabIndex"],host:{"[attr.aria-expanded]":"isExpanded","[attr.aria-level]":'role === "treeitem" ? level : null',"[attr.role]":"role",class:"mat-tree-node"},providers:[{provide:t.CdkTreeNode,useExisting:n}]}]}],n.ctorParameters=function(){return[{type:r.ElementRef},{type:t.CdkTree},{type:String,decorators:[{type:r.Attribute,args:["tabindex"]}]}]},n.propDecorators={role:[{type:r.Input}]},n}(c),g=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return s(n,e),n.decorators=[{type:r.Directive,args:[{selector:"[matTreeNodeDef]",inputs:["when: matTreeNodeDefWhen"],providers:[{provide:t.CdkTreeNodeDef,useExisting:n}]}]}],n.propDecorators={data:[{type:r.Input,args:["matTreeNode"]}]},n}(t.CdkTreeNodeDef),h=function(e){function n(t,r,n,o){var a=e.call(this,t,r,n)||this;return a._elementRef=t,a._tree=r,a._differs=n,a.tabIndex=Number(o)||0,a}return s(n,e),n.prototype.ngAfterContentInit=function(){e.prototype.ngAfterContentInit.call(this)},n.prototype.ngOnDestroy=function(){e.prototype.ngOnDestroy.call(this)},n.decorators=[{type:r.Directive,args:[{selector:"mat-nested-tree-node",exportAs:"matNestedTreeNode",host:{"[attr.aria-expanded]":"isExpanded","[attr.role]":"role",class:"mat-nested-tree-node"},inputs:["disabled","tabIndex"],providers:[{provide:t.CdkNestedTreeNode,useExisting:n},{provide:t.CdkTreeNode,useExisting:n},{provide:t.CDK_TREE_NODE_OUTLET_NODE,useExisting:n}]}]}],n.ctorParameters=function(){return[{type:r.ElementRef},{type:t.CdkTree},{type:r.IterableDiffers},{type:String,decorators:[{type:r.Attribute,args:["tabindex"]}]}]},n.propDecorators={node:[{type:r.Input,args:["matNestedTreeNode"]}],nodeOutlet:[{type:r.ContentChildren,args:[l,{descendants:!0}]}]},n}(p),m=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return s(n,e),n.decorators=[{type:r.Directive,args:[{selector:"[matTreeNodePadding]",providers:[{provide:t.CdkTreeNodePadding,useExisting:n}]}]}],n.propDecorators={level:[{type:r.Input,args:["matTreeNodePadding"]}],indent:[{type:r.Input,args:["matTreeNodePaddingIndent"]}]},n}(t.CdkTreeNodePadding),y=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return s(n,e),n.decorators=[{type:r.Component,args:[{selector:"mat-tree",exportAs:"matTree",template:"<ng-container matTreeNodeOutlet></ng-container>",host:{class:"mat-tree",role:"tree"},styles:[".mat-tree{display:block}.mat-tree-node{display:flex;align-items:center;min-height:48px;flex:1;overflow:hidden;word-wrap:break-word}.mat-nested-tree-ndoe{border-bottom-width:0}"],encapsulation:r.ViewEncapsulation.None,changeDetection:r.ChangeDetectionStrategy.Default,providers:[{provide:t.CdkTree,useExisting:n}]}]}],n.propDecorators={_nodeOutlet:[{type:r.ViewChild,args:[l,{static:!0}]}]},n}(t.CdkTree),v=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.recursive=!1,t}return s(n,e),n.decorators=[{type:r.Directive,args:[{selector:"[matTreeNodeToggle]",providers:[{provide:t.CdkTreeNodeToggle,useExisting:n}]}]}],n.propDecorators={recursive:[{type:r.Input,args:["matTreeNodeToggleRecursive"]}]},n}(t.CdkTreeNodeToggle),x=[h,g,m,v,y,f,l],T=function(){function e(){}return e.decorators=[{type:r.NgModule,args:[{imports:[t.CdkTreeModule,o.CommonModule,n.MatCommonModule],exports:x,declarations:x}]}],e}(),_=function(){function e(e,t,r,n){this.transformFunction=e,this.getLevel=t,this.isExpandable=r,this.getChildren=n}return e.prototype._flattenNode=function(e,t,r,n){var o=this,a=this.transformFunction(e,t);if(r.push(a),this.isExpandable(a)){var i=this.getChildren(e);i&&(Array.isArray(i)?this._flattenChildren(i,t,r,n):i.pipe(d.take(1)).subscribe(function(e){o._flattenChildren(e,t,r,n)}))}return r},e.prototype._flattenChildren=function(e,t,r,n){var o=this;e.forEach(function(a,i){var d=n.slice();d.push(i!=e.length-1),o._flattenNode(a,t+1,r,d)})},e.prototype.flattenNodes=function(e){var t=this,r=[];return e.forEach(function(e){return t._flattenNode(e,0,r,[])}),r},e.prototype.expandFlattenedNodes=function(e,t){var r=this,n=[],o=[];return o[0]=!0,e.forEach(function(e){for(var a=!0,i=0;i<=r.getLevel(e);i++)a=a&&o[i];a&&n.push(e),r.isExpandable(e)&&(o[r.getLevel(e)+1]=t.isExpanded(e))}),n},e}(),N=function(e){function t(t,r,n){void 0===n&&(n=[]);var o=e.call(this)||this;return o._treeControl=t,o._treeFlattener=r,o._flattenedData=new i.BehaviorSubject([]),o._expandedData=new i.BehaviorSubject([]),o._data=new i.BehaviorSubject(n),o}return s(t,e),Object.defineProperty(t.prototype,"data",{get:function(){return this._data.value},set:function(e){this._data.next(e),this._flattenedData.next(this._treeFlattener.flattenNodes(this.data)),this._treeControl.dataNodes=this._flattenedData.value},enumerable:!0,configurable:!0}),t.prototype.connect=function(e){var t=this,r=[e.viewChange,this._treeControl.expansionModel.onChange,this._flattenedData];return i.merge.apply(void 0,r).pipe(d.map(function(){return t._expandedData.next(t._treeFlattener.expandFlattenedNodes(t._flattenedData.value,t._treeControl)),t._expandedData.value}))},t.prototype.disconnect=function(){},t}(a.DataSource),D=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._data=new i.BehaviorSubject([]),t}return s(t,e),Object.defineProperty(t.prototype,"data",{get:function(){return this._data.value},set:function(e){this._data.next(e)},enumerable:!0,configurable:!0}),t.prototype.connect=function(e){var t=this;return i.merge.apply(void 0,[e.viewChange,this._data]).pipe(d.map(function(){return t.data}))},t.prototype.disconnect=function(){},t}(a.DataSource);e.MatTreeNode=f,e.MatTreeNodeDef=g,e.MatNestedTreeNode=h,e.MatTreeNodePadding=m,e.MatTree=y,e.MatTreeModule=T,e.MatTreeNodeToggle=v,e.MatTreeNodeOutlet=l,e.MatTreeFlattener=_,e.MatTreeFlatDataSource=N,e.MatTreeNestedDataSource=D,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=material-tree.umd.min.js.map