UNPKG

@angular/material

Version:
16 lines 8.23 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("tslib"),require("@angular/cdk/tree"),require("@angular/core"),require("@angular/material/core"),require("@angular/cdk/coercion"),require("@angular/common"),require("@angular/cdk/collections"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@angular/material/tree",["exports","tslib","@angular/cdk/tree","@angular/core","@angular/material/core","@angular/cdk/coercion","@angular/common","@angular/cdk/collections","rxjs","rxjs/operators"],t):t(((e=e||self).ng=e.ng||{},e.ng.material=e.ng.material||{},e.ng.material.tree={}),e.tslib,e.ng.cdk.tree,e.ng.core,e.ng.material.core,e.ng.cdk.coercion,e.ng.common,e.ng.cdk.collections,e.rxjs,e.rxjs.operators)}(this,(function(e,t,r,n,o,a,i,d,s,u){"use strict"; /** * @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 */var l=function(e){function o(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 t.__extends(o,e),o.decorators=[{type:n.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:r.CdkTreeNode,useExisting:o}]}]}],o.ctorParameters=function(){return[{type:n.ElementRef},{type:r.CdkTree},{type:String,decorators:[{type:n.Attribute,args:["tabindex"]}]}]},o.propDecorators={role:[{type:n.Input}]},o}(o.mixinTabIndex(o.mixinDisabled(r.CdkTreeNode))),c=function(e){function o(){return null!==e&&e.apply(this,arguments)||this}return t.__extends(o,e),o.decorators=[{type:n.Directive,args:[{selector:"[matTreeNodeDef]",inputs:["when: matTreeNodeDefWhen"],providers:[{provide:r.CdkTreeNodeDef,useExisting:o}]}]}],o.propDecorators={data:[{type:n.Input,args:["matTreeNode"]}]},o}(r.CdkTreeNodeDef),p=function(e){function o(t,r,n,o){var a=e.call(this,t,r,n)||this;return a._elementRef=t,a._tree=r,a._differs=n,a._disabled=!1,a.tabIndex=Number(o)||0,a}return t.__extends(o,e),Object.defineProperty(o.prototype,"disabled",{get:function(){return this._disabled},set:function(e){this._disabled=a.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"tabIndex",{get:function(){return this.disabled?-1:this._tabIndex},set:function(e){this._tabIndex=null!=e?e:0},enumerable:!0,configurable:!0}),o.prototype.ngAfterContentInit=function(){e.prototype.ngAfterContentInit.call(this)},o.prototype.ngOnDestroy=function(){e.prototype.ngOnDestroy.call(this)},o.decorators=[{type:n.Directive,args:[{selector:"mat-nested-tree-node",exportAs:"matNestedTreeNode",host:{"[attr.aria-expanded]":"isExpanded","[attr.role]":"role",class:"mat-nested-tree-node"},providers:[{provide:r.CdkNestedTreeNode,useExisting:o},{provide:r.CdkTreeNode,useExisting:o},{provide:r.CDK_TREE_NODE_OUTLET_NODE,useExisting:o}]}]}],o.ctorParameters=function(){return[{type:n.ElementRef},{type:r.CdkTree},{type:n.IterableDiffers},{type:String,decorators:[{type:n.Attribute,args:["tabindex"]}]}]},o.propDecorators={node:[{type:n.Input,args:["matNestedTreeNode"]}],disabled:[{type:n.Input}],tabIndex:[{type:n.Input}]},o}(r.CdkNestedTreeNode),f=function(e){function o(){return null!==e&&e.apply(this,arguments)||this}return t.__extends(o,e),o.decorators=[{type:n.Directive,args:[{selector:"[matTreeNodePadding]",providers:[{provide:r.CdkTreeNodePadding,useExisting:o}]}]}],o.propDecorators={level:[{type:n.Input,args:["matTreeNodePadding"]}],indent:[{type:n.Input,args:["matTreeNodePaddingIndent"]}]},o}(r.CdkTreeNodePadding),g=function(){function e(e,t){this.viewContainer=e,this._node=t}return e.decorators=[{type:n.Directive,args:[{selector:"[matTreeNodeOutlet]",providers:[{provide:r.CdkTreeNodeOutlet,useExisting:e}]}]}],e.ctorParameters=function(){return[{type:n.ViewContainerRef},{type:void 0,decorators:[{type:n.Inject,args:[r.CDK_TREE_NODE_OUTLET_NODE]},{type:n.Optional}]}]},e}(),h=function(e){function o(){return null!==e&&e.apply(this,arguments)||this}return t.__extends(o,e),o.decorators=[{type:n.Component,args:[{selector:"mat-tree",exportAs:"matTree",template:"<ng-container matTreeNodeOutlet></ng-container>",host:{class:"mat-tree",role:"tree"},encapsulation:n.ViewEncapsulation.None,changeDetection:n.ChangeDetectionStrategy.Default,providers:[{provide:r.CdkTree,useExisting:o}],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-node{border-bottom-width:0}\n"]}]}],o.propDecorators={_nodeOutlet:[{type:n.ViewChild,args:[g,{static:!0}]}]},o}(r.CdkTree),m=function(e){function o(){var t=null!==e&&e.apply(this,arguments)||this;return t.recursive=!1,t}return t.__extends(o,e),o.decorators=[{type:n.Directive,args:[{selector:"[matTreeNodeToggle]",providers:[{provide:r.CdkTreeNodeToggle,useExisting:o}]}]}],o.propDecorators={recursive:[{type:n.Input,args:["matTreeNodeToggleRecursive"]}]},o}(r.CdkTreeNodeToggle),y=[p,c,f,m,h,l,g],_=function(){function e(){}return e.decorators=[{type:n.NgModule,args:[{imports:[r.CdkTreeModule,i.CommonModule,o.MatCommonModule],exports:y,declarations:y}]}],e}(),v=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(u.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}(),x=function(e){function r(t,r,n){void 0===n&&(n=[]);var o=e.call(this)||this;return o._treeControl=t,o._treeFlattener=r,o._flattenedData=new s.BehaviorSubject([]),o._expandedData=new s.BehaviorSubject([]),o._data=new s.BehaviorSubject(n),o}return t.__extends(r,e),Object.defineProperty(r.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}),r.prototype.connect=function(e){var r=this;return s.merge.apply(void 0,t.__spread([e.viewChange,this._treeControl.expansionModel.changed,this._flattenedData])).pipe(u.map((function(){return r._expandedData.next(r._treeFlattener.expandFlattenedNodes(r._flattenedData.value,r._treeControl)),r._expandedData.value})))},r.prototype.disconnect=function(){},r}(d.DataSource),T=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t._data=new s.BehaviorSubject([]),t}return t.__extends(r,e),Object.defineProperty(r.prototype,"data",{get:function(){return this._data.value},set:function(e){this._data.next(e)},enumerable:!0,configurable:!0}),r.prototype.connect=function(e){var r=this;return s.merge.apply(void 0,t.__spread([e.viewChange,this._data])).pipe(u.map((function(){return r.data})))},r.prototype.disconnect=function(){},r}(d.DataSource); /** * @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 */ e.MatNestedTreeNode=p,e.MatTree=h,e.MatTreeFlatDataSource=x,e.MatTreeFlattener=v,e.MatTreeModule=_,e.MatTreeNestedDataSource=T,e.MatTreeNode=l,e.MatTreeNodeDef=c,e.MatTreeNodeOutlet=g,e.MatTreeNodePadding=f,e.MatTreeNodeToggle=m,Object.defineProperty(e,"__esModule",{value:!0})}));