UNPKG

@angular/material

Version:
31 lines (29 loc) 9.54 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/cdk/tree"),require("@angular/core"),require("@angular/material/core"),require("@angular/cdk/coercion"),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/cdk/coercion","@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.ng.cdk.tree,e.ng.core,e.ng.material.core,e.ng.cdk.coercion,e.ng.cdk.collections,e.rxjs,e.rxjs.operators)}(this,(function(e,t,r,n,o,a,i,d){"use strict"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */var s=function(e,t){return(s=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)};function u(e,t){function r(){this.constructor=e}s(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function c(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i}function l(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(c(arguments[t]));return e} /** * @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 p=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 u(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}(n.mixinTabIndex(n.mixinDisabled(t.CdkTreeNode))),f=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return u(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),g=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._disabled=!1,a.tabIndex=Number(o)||0,a}return u(n,e),Object.defineProperty(n.prototype,"disabled",{get:function(){return this._disabled},set:function(e){this._disabled=o.coerceBooleanProperty(e)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"tabIndex",{get:function(){return this.disabled?-1:this._tabIndex},set:function(e){this._tabIndex=null!=e?e:0},enumerable:!0,configurable:!0}),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"},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"]}],disabled:[{type:r.Input}],tabIndex:[{type:r.Input}]},n}(t.CdkNestedTreeNode),h=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return u(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(){function e(e,t){this.viewContainer=e,this._node=t}return e.decorators=[{type:r.Directive,args:[{selector:"[matTreeNodeOutlet]",providers:[{provide:t.CdkTreeNodeOutlet,useExisting:e}]}]}],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}(),v=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return u(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"},encapsulation:r.ViewEncapsulation.None,changeDetection:r.ChangeDetectionStrategy.Default,providers:[{provide:t.CdkTree,useExisting:n}],styles:[".mat-tree{display:block}.mat-tree-node{display:flex;align-items:center;min-height:48px;flex:1;word-wrap:break-word}.mat-nested-tree-node{border-bottom-width:0}\n"]}]}],n.propDecorators={_nodeOutlet:[{type:r.ViewChild,args:[y,{static:!0}]}]},n}(t.CdkTree),m=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.recursive=!1,t}return u(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),_=[g,f,h,m,v,p,y],x=function(){function e(){}return e.decorators=[{type:r.NgModule,args:[{imports:[t.CdkTreeModule,n.MatCommonModule],exports:_,declarations:_}]}],e}(),b=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}(),T=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 u(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;return i.merge.apply(void 0,l([e.viewChange,this._treeControl.expansionModel.changed,this._flattenedData])).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),N=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._data=new i.BehaviorSubject([]),t}return u(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,l([e.viewChange,this._data])).pipe(d.map((function(){return t.data})))},t.prototype.disconnect=function(){},t}(a.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=g,e.MatTree=v,e.MatTreeFlatDataSource=T,e.MatTreeFlattener=b,e.MatTreeModule=x,e.MatTreeNestedDataSource=N,e.MatTreeNode=p,e.MatTreeNodeDef=f,e.MatTreeNodeOutlet=y,e.MatTreeNodePadding=h,e.MatTreeNodeToggle=m,Object.defineProperty(e,"__esModule",{value:!0})}));