/** * @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 */ import { DataSource } from '@angular/cdk/collections'; import { BehaviorSubject, merge } from 'rxjs'; import { map } from 'rxjs/operators'; /** * Data source for nested tree. * * The data source for nested tree doesn't have to consider node flattener, or the way to expand * or collapse. The expansion/collapsion will be handled by TreeControl and each non-leaf node. */ export class MatTreeNestedDataSource extends DataSource { constructor() { super(...arguments); this._data = new BehaviorSubject([]); } /** * Data for the nested tree */ get data() { return this._data.value; } set data(value) { this._data.next(value); } connect(collectionViewer) { return merge(...[collectionViewer.viewChange, this._data]) .pipe(map(() => this.data)); } disconnect() { // no op } } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmVzdGVkLWRhdGEtc291cmNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vc3JjL21hdGVyaWFsL3RyZWUvZGF0YS1zb3VyY2UvbmVzdGVkLWRhdGEtc291cmNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRztBQUVILE9BQU8sRUFBbUIsVUFBVSxFQUFDLE1BQU0sMEJBQTBCLENBQUM7QUFDdEUsT0FBTyxFQUFDLGVBQWUsRUFBRSxLQUFLLEVBQWEsTUFBTSxNQUFNLENBQUM7QUFDeEQsT0FBTyxFQUFDLEdBQUcsRUFBQyxNQUFNLGdCQUFnQixDQUFDO0FBR25DOzs7OztHQUtHO0FBQ0gsTUFBTSxPQUFPLHVCQUEyQixTQUFRLFVBQWE7SUFBN0Q7O1FBTW1CLFVBQUssR0FBRyxJQUFJLGVBQWUsQ0FBTSxFQUFFLENBQUMsQ0FBQztJQVV4RCxDQUFDO0lBZkM7O09BRUc7SUFDSCxJQUFJLElBQUksS0FBSyxPQUFPLElBQUksQ0FBQyxLQUFLLENBQUMsS0FBSyxDQUFDLENBQUMs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