Icard/angular-clarity-master(work.../node_modules/@angular/cdk/fesm2022/tree.mjs.map

1 line
62 KiB
Plaintext
Raw Permalink Normal View History

2024-07-16 14:55:36 +00:00
{"version":3,"file":"tree.mjs","sources":["../../../../../../src/cdk/tree/control/base-tree-control.ts","../../../../../../src/cdk/tree/control/flat-tree-control.ts","../../../../../../src/cdk/tree/control/nested-tree-control.ts","../../../../../../src/cdk/tree/outlet.ts","../../../../../../src/cdk/tree/node.ts","../../../../../../src/cdk/tree/tree-errors.ts","../../../../../../src/cdk/tree/tree.ts","../../../../../../src/cdk/tree/nested-node.ts","../../../../../../src/cdk/tree/padding.ts","../../../../../../src/cdk/tree/toggle.ts","../../../../../../src/cdk/tree/tree-module.ts","../../../../../../src/cdk/tree/tree_public_index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport {SelectionModel} from '@angular/cdk/collections';\nimport {Observable} from 'rxjs';\nimport {TreeControl} from './tree-control';\n\n/** Base tree control. It has basic toggle/expand/collapse operations on a single data node. */\nexport abstract class BaseTreeControl<T, K = T> implements TreeControl<T, K> {\n /** Gets a list of descendent data nodes of a subtree rooted at given data node recursively. */\n abstract getDescendants(dataNode: T): T[];\n\n /** Expands all data nodes in the tree. */\n abstract expandAll(): void;\n\n /** Saved data node for `expandAll` action. */\n dataNodes: T[];\n\n /** A selection model with multi-selection to track expansion status. */\n expansionModel: SelectionModel<K> = new SelectionModel<K>(true);\n\n /**\n * Returns the identifier by which a dataNode should be tracked, should its\n * reference change.\n *\n * Similar to trackBy for *ngFor\n */\n trackBy?: (dataNode: T) => K;\n\n /** Get depth of a given data node, return the level number. This is for flat tree node. */\n getLevel: (dataNode: T) => number;\n\n /**\n * Whether the data node is expandable. Returns true if expandable.\n * This is for flat tree node.\n */\n isExpandable: (dataNode: T) => boolean;\n\n /** Gets a stream that emits whenever the given data node's children change. */\n getChildren: (dataNode: T) => Observable<T[]> | T[] | undefined | null;\n\n /** Toggles one single data node's expanded/collapsed state. */\n toggle(dataNode: T): void {\n this.expansionModel.toggle(this._trackByValue(dataNode));\n }\n\n /** Expands one single data node. */\n expand(dataNode: T): void {\n this.expansionModel.select(this._trackByValue(dataNode));\n }\n\n /** Collapses one single data node. */\n collapse(dataNode: T): void {\n this.expansionModel.deselect(this._trackByValue(dataNode));\n }\n\n /** Whether a given data node is expanded or not. Returns true if the data node is expanded. */\n isExpanded(dataNode: T): boolean {\n return this.expansionModel.isSelected(this._trackByValue(dataNode));\n }\n\n /** Toggles a subtree rooted at `node` recursively. */\n toggleDescendants(dataNode: T): void {\n this.expansionModel.isSelected(this._trackByValue(dataNode))\n ? this.collapseDescendants(dataNode)\n : this.expandDescendants(dataNode);\n }\n\n /** Collapse all dataNodes in the tree. */\n collapseAll(): void {\n this.expansionModel.clear();\n }\n\n /** Expands a subtree rooted at given data node recursively. */\n expandDescendants(dataNode: T): void {\n let toBeProcessed = [dataNode];\n toBeProcessed.push(...this.getDescendants(dataNode));\n this.expansionModel.select(...toBeProcessed.map(value => this._trackByValue(value)));\n }\n\n /** Collapses a subtree rooted at given data node recursively. */\n collapseDescendants(dataNode: T): void {\n let toBeProcessed = [dataNode];\n toBeProcessed.push(...this.getDescendants(dataNode));\n this.expansionModel.deselect(...toBeProcessed.map(value => this._trackByValue(value)));\n }\n\n protected _trackByValue(value: T | K): K {\n return this.trackBy ? this.trackBy(value as T) : (value as K);\n }\n}\n","/**\n * @license\n * Copyright