UNPKG

@angular/material

Version:
10 lines (9 loc) 7.44 kB
/** * @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/core"),require("@angular/cdk/tree"),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/core","@angular/cdk/tree","@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.core,e.ng.cdk.tree,e.ng.material.core,e.ng.common,e.ng.cdk.collections,e.Rx,e.Rx.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=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])},c=function(){function e(e){this.viewContainer=e}return e.decorators=[{type:t.Directive,args:[{selector:"[matTreeNodeOutlet]"}]}],e.ctorParameters=function(){return[{type:t.ViewContainerRef}]},e}(),l=n.mixinTabIndex(n.mixinDisabled(r.CdkTreeNode)),p=n.mixinTabIndex(n.mixinDisabled(r.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:t.Directive,args:[{selector:"mat-tree-node",exportAs:"matTreeNode",inputs:["disabled","tabIndex"],host:{"[attr.aria-expanded]":"isExpanded","[attr.aria-level]":"level","[attr.role]":"role",class:"mat-tree-node"},providers:[{provide:r.CdkTreeNode,useExisting:n}]}]}],n.ctorParameters=function(){return[{type:t.ElementRef},{type:r.CdkTree},{type:void 0,decorators:[{type:t.Attribute,args:["tabindex"]}]}]},n.propDecorators={role:[{type:t.Input}]},n}(l),g=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return s(n,e),n.decorators=[{type:t.Directive,args:[{selector:"[matTreeNodeDef]",inputs:["when: matTreeNodeDefWhen"],providers:[{provide:r.CdkTreeNodeDef,useExisting:n}]}]}],n.propDecorators={data:[{type:t.Input,args:["matTreeNode"]}]},n}(r.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:t.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:r.CdkNestedTreeNode,useExisting:n},{provide:r.CdkTreeNode,useExisting:n}]}]}],n.ctorParameters=function(){return[{type:t.ElementRef},{type:r.CdkTree},{type:t.IterableDiffers},{type:void 0,decorators:[{type:t.Attribute,args:["tabindex"]}]}]},n.propDecorators={node:[{type:t.Input,args:["matNestedTreeNode"]}],nodeOutlet:[{type:t.ContentChildren,args:[c]}]},n}(p),m=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return s(n,e),n.decorators=[{type:t.Directive,args:[{selector:"[matTreeNodePadding]",providers:[{provide:r.CdkTreeNodePadding,useExisting:n}]}]}],n.propDecorators={level:[{type:t.Input,args:["matTreeNodePadding"]}],indent:[{type:t.Input,args:["matTreeNodePaddingIndent"]}]},n}(r.CdkTreeNodePadding),y=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return s(n,e),n.decorators=[{type:t.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:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush,providers:[{provide:r.CdkTree,useExisting:n}]}]}],n.propDecorators={_nodeOutlet:[{type:t.ViewChild,args:[c]}]},n}(r.CdkTree),v=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.recursive=!0,t}return s(n,e),n.decorators=[{type:t.Directive,args:[{selector:"[matTreeNodeToggle]",host:{"(click)":"_toggle($event)"},providers:[{provide:r.CdkTreeNodeToggle,useExisting:n}]}]}],n.propDecorators={recursive:[{type:t.Input,args:["matTreeNodeToggleRecursive"]}]},n}(r.CdkTreeNodeToggle),x=[h,g,m,v,y,f,c],N=function(){function e(){}return e.decorators=[{type:t.NgModule,args:[{imports:[r.CdkTreeModule,o.CommonModule,n.MatCommonModule],exports:x,declarations:x}]}],e}(),T=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);return r.push(a),this.isExpandable(a)&&this.getChildren(e).pipe(d.take(1)).subscribe(function(e){e.forEach(function(a,i){var d=n.slice();d.push(i!=e.length-1),o._flattenNode(a,t+1,r,d)})}),r},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}(),b=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),_=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._MatTreeNodeMixinBase=l,e._MatNestedTreeNodeMixinBase=p,e.MatTreeNode=f,e.MatTreeNodeDef=g,e.MatNestedTreeNode=h,e.MatTreeNodePadding=m,e.MatTree=y,e.MatTreeModule=N,e.MatTreeNodeToggle=v,e.MatTreeNodeOutlet=c,e.MatTreeFlattener=T,e.MatTreeFlatDataSource=b,e.MatTreeNestedDataSource=_,Object.defineProperty(e,"__esModule",{value:!0})}); //# sourceMappingURL=material-tree.umd.min.js.map