source: trip-planner-front/node_modules/@angular/cdk/esm2015/tree/tree.js@ bdd6491

Last change on this file since bdd6491 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 48.0 KB
Line 
1import { isDataSource } from '@angular/cdk/collections';
2import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChildren, Directive, ElementRef, Input, IterableDiffers, QueryList, ViewChild, ViewEncapsulation } from '@angular/core';
3import { BehaviorSubject, isObservable, of as observableOf, Subject, } from 'rxjs';
4import { takeUntil } from 'rxjs/operators';
5import { CdkTreeNodeDef, CdkTreeNodeOutletContext } from './node';
6import { CdkTreeNodeOutlet } from './outlet';
7import { getTreeControlFunctionsMissingError, getTreeControlMissingError, getTreeMissingMatchingNodeDefError, getTreeMultipleDefaultNodeDefsError, getTreeNoValidDataSourceError } from './tree-errors';
8import { coerceNumberProperty } from '@angular/cdk/coercion';
9/**
10 * CDK tree component that connects with a data source to retrieve data of type `T` and renders
11 * dataNodes with hierarchy. Updates the dataNodes when new data is provided by the data source.
12 */
13export class CdkTree {
14 constructor(_differs, _changeDetectorRef) {
15 this._differs = _differs;
16 this._changeDetectorRef = _changeDetectorRef;
17 /** Subject that emits when the component has been destroyed. */
18 this._onDestroy = new Subject();
19 /** Level of nodes */
20 this._levels = new Map();
21 // TODO(tinayuangao): Setup a listener for scrolling, emit the calculated view to viewChange.
22 // Remove the MAX_VALUE in viewChange
23 /**
24 * Stream containing the latest information on what rows are being displayed on screen.
25 * Can be used by the data source to as a heuristic of what data should be provided.
26 */
27 this.viewChange = new BehaviorSubject({ start: 0, end: Number.MAX_VALUE });
28 }
29 /**
30 * Provides a stream containing the latest data array to render. Influenced by the tree's
31 * stream of view window (what dataNodes are currently on screen).
32 * Data source can be an observable of data array, or a data array to render.
33 */
34 get dataSource() { return this._dataSource; }
35 set dataSource(dataSource) {
36 if (this._dataSource !== dataSource) {
37 this._switchDataSource(dataSource);
38 }
39 }
40 ngOnInit() {
41 this._dataDiffer = this._differs.find([]).create(this.trackBy);
42 if (!this.treeControl && (typeof ngDevMode === 'undefined' || ngDevMode)) {
43 throw getTreeControlMissingError();
44 }
45 }
46 ngOnDestroy() {
47 this._nodeOutlet.viewContainer.clear();
48 this.viewChange.complete();
49 this._onDestroy.next();
50 this._onDestroy.complete();
51 if (this._dataSource && typeof this._dataSource.disconnect === 'function') {
52 this.dataSource.disconnect(this);
53 }
54 if (this._dataSubscription) {
55 this._dataSubscription.unsubscribe();
56 this._dataSubscription = null;
57 }
58 }
59 ngAfterContentChecked() {
60 const defaultNodeDefs = this._nodeDefs.filter(def => !def.when);
61 if (defaultNodeDefs.length > 1 && (typeof ngDevMode === 'undefined' || ngDevMode)) {
62 throw getTreeMultipleDefaultNodeDefsError();
63 }
64 this._defaultNodeDef = defaultNodeDefs[0];
65 if (this.dataSource && this._nodeDefs && !this._dataSubscription) {
66 this._observeRenderChanges();
67 }
68 }
69 // TODO(tinayuangao): Work on keyboard traversal and actions, make sure it's working for RTL
70 // and nested trees.
71 /**
72 * Switch to the provided data source by resetting the data and unsubscribing from the current
73 * render change subscription if one exists. If the data source is null, interpret this by
74 * clearing the node outlet. Otherwise start listening for new data.
75 */
76 _switchDataSource(dataSource) {
77 if (this._dataSource && typeof this._dataSource.disconnect === 'function') {
78 this.dataSource.disconnect(this);
79 }
80 if (this._dataSubscription) {
81 this._dataSubscription.unsubscribe();
82 this._dataSubscription = null;
83 }
84 // Remove the all dataNodes if there is now no data source
85 if (!dataSource) {
86 this._nodeOutlet.viewContainer.clear();
87 }
88 this._dataSource = dataSource;
89 if (this._nodeDefs) {
90 this._observeRenderChanges();
91 }
92 }
93 /** Set up a subscription for the data provided by the data source. */
94 _observeRenderChanges() {
95 let dataStream;
96 if (isDataSource(this._dataSource)) {
97 dataStream = this._dataSource.connect(this);
98 }
99 else if (isObservable(this._dataSource)) {
100 dataStream = this._dataSource;
101 }
102 else if (Array.isArray(this._dataSource)) {
103 dataStream = observableOf(this._dataSource);
104 }
105 if (dataStream) {
106 this._dataSubscription = dataStream.pipe(takeUntil(this._onDestroy))
107 .subscribe(data => this.renderNodeChanges(data));
108 }
109 else if (typeof ngDevMode === 'undefined' || ngDevMode) {
110 throw getTreeNoValidDataSourceError();
111 }
112 }
113 /** Check for changes made in the data and render each change (node added/removed/moved). */
114 renderNodeChanges(data, dataDiffer = this._dataDiffer, viewContainer = this._nodeOutlet.viewContainer, parentData) {
115 const changes = dataDiffer.diff(data);
116 if (!changes) {
117 return;
118 }
119 changes.forEachOperation((item, adjustedPreviousIndex, currentIndex) => {
120 if (item.previousIndex == null) {
121 this.insertNode(data[currentIndex], currentIndex, viewContainer, parentData);
122 }
123 else if (currentIndex == null) {
124 viewContainer.remove(adjustedPreviousIndex);
125 this._levels.delete(item.item);
126 }
127 else {
128 const view = viewContainer.get(adjustedPreviousIndex);
129 viewContainer.move(view, currentIndex);
130 }
131 });
132 this._changeDetectorRef.detectChanges();
133 }
134 /**
135 * Finds the matching node definition that should be used for this node data. If there is only
136 * one node definition, it is returned. Otherwise, find the node definition that has a when
137 * predicate that returns true with the data. If none return true, return the default node
138 * definition.
139 */
140 _getNodeDef(data, i) {
141 if (this._nodeDefs.length === 1) {
142 return this._nodeDefs.first;
143 }
144 const nodeDef = this._nodeDefs.find(def => def.when && def.when(i, data)) || this._defaultNodeDef;
145 if (!nodeDef && (typeof ngDevMode === 'undefined' || ngDevMode)) {
146 throw getTreeMissingMatchingNodeDefError();
147 }
148 return nodeDef;
149 }
150 /**
151 * Create the embedded view for the data node template and place it in the correct index location
152 * within the data node view container.
153 */
154 insertNode(nodeData, index, viewContainer, parentData) {
155 const node = this._getNodeDef(nodeData, index);
156 // Node context that will be provided to created embedded view
157 const context = new CdkTreeNodeOutletContext(nodeData);
158 // If the tree is flat tree, then use the `getLevel` function in flat tree control
159 // Otherwise, use the level of parent node.
160 if (this.treeControl.getLevel) {
161 context.level = this.treeControl.getLevel(nodeData);
162 }
163 else if (typeof parentData !== 'undefined' && this._levels.has(parentData)) {
164 context.level = this._levels.get(parentData) + 1;
165 }
166 else {
167 context.level = 0;
168 }
169 this._levels.set(nodeData, context.level);
170 // Use default tree nodeOutlet, or nested node's nodeOutlet
171 const container = viewContainer ? viewContainer : this._nodeOutlet.viewContainer;
172 container.createEmbeddedView(node.template, context, index);
173 // Set the data to just created `CdkTreeNode`.
174 // The `CdkTreeNode` created from `createEmbeddedView` will be saved in static variable
175 // `mostRecentTreeNode`. We get it from static variable and pass the node data to it.
176 if (CdkTreeNode.mostRecentTreeNode) {
177 CdkTreeNode.mostRecentTreeNode.data = nodeData;
178 }
179 }
180}
181CdkTree.decorators = [
182 { type: Component, args: [{
183 selector: 'cdk-tree',
184 exportAs: 'cdkTree',
185 template: `<ng-container cdkTreeNodeOutlet></ng-container>`,
186 host: {
187 'class': 'cdk-tree',
188 'role': 'tree',
189 },
190 encapsulation: ViewEncapsulation.None,
191 // The "OnPush" status for the `CdkTree` component is effectively a noop, so we are removing it.
192 // The view for `CdkTree` consists entirely of templates declared in other views. As they are
193 // declared elsewhere, they are checked when their declaration points are checked.
194 // tslint:disable-next-line:validate-decorators
195 changeDetection: ChangeDetectionStrategy.Default
196 },] }
197];
198CdkTree.ctorParameters = () => [
199 { type: IterableDiffers },
200 { type: ChangeDetectorRef }
201];
202CdkTree.propDecorators = {
203 dataSource: [{ type: Input }],
204 treeControl: [{ type: Input }],
205 trackBy: [{ type: Input }],
206 _nodeOutlet: [{ type: ViewChild, args: [CdkTreeNodeOutlet, { static: true },] }],
207 _nodeDefs: [{ type: ContentChildren, args: [CdkTreeNodeDef, {
208 // We need to use `descendants: true`, because Ivy will no longer match
209 // indirect descendants if it's left as false.
210 descendants: true
211 },] }]
212};
213/**
214 * Tree node for CdkTree. It contains the data in the tree node.
215 */
216export class CdkTreeNode {
217 constructor(_elementRef, _tree) {
218 this._elementRef = _elementRef;
219 this._tree = _tree;
220 /** Subject that emits when the component has been destroyed. */
221 this._destroyed = new Subject();
222 /** Emits when the node's data has changed. */
223 this._dataChanges = new Subject();
224 CdkTreeNode.mostRecentTreeNode = this;
225 // The classes are directly added here instead of in the host property because classes on
226 // the host property are not inherited with View Engine. It is not set as a @HostBinding because
227 // it is not set by the time it's children nodes try to read the class from it.
228 // TODO: move to host after View Engine deprecation
229 this._elementRef.nativeElement.classList.add('cdk-tree-node');
230 this.role = 'treeitem';
231 }
232 /**
233 * The role of the tree node.
234 * @deprecated The correct role is 'treeitem', 'group' should not be used. This input will be
235 * removed in a future version.
236 * @breaking-change 12.0.0 Remove this input
237 */
238 get role() { return 'treeitem'; }
239 set role(_role) {
240 // TODO: move to host after View Engine deprecation
241 this._elementRef.nativeElement.setAttribute('role', _role);
242 }
243 /** The tree node's data. */
244 get data() { return this._data; }
245 set data(value) {
246 if (value !== this._data) {
247 this._data = value;
248 this._setRoleFromData();
249 this._dataChanges.next();
250 }
251 }
252 get isExpanded() {
253 return this._tree.treeControl.isExpanded(this._data);
254 }
255 _setExpanded(_expanded) {
256 this._isAriaExpanded = _expanded;
257 this._elementRef.nativeElement.setAttribute('aria-expanded', `${_expanded}`);
258 }
259 get level() {
260 // If the treeControl has a getLevel method, use it to get the level. Otherwise read the
261 // aria-level off the parent node and use it as the level for this node (note aria-level is
262 // 1-indexed, while this property is 0-indexed, so we don't need to increment).
263 return this._tree.treeControl.getLevel ?
264 this._tree.treeControl.getLevel(this._data) : this._parentNodeAriaLevel;
265 }
266 ngOnInit() {
267 this._parentNodeAriaLevel = getParentNodeAriaLevel(this._elementRef.nativeElement);
268 this._elementRef.nativeElement.setAttribute('aria-level', `${this.level + 1}`);
269 }
270 ngDoCheck() {
271 // aria-expanded is be set here because the expanded state is stored in the tree control and
272 // the node isn't aware when the state is changed.
273 // It is not set using a @HostBinding because they sometimes get lost with Mixin based classes.
274 // TODO: move to host after View Engine deprecation
275 if (this.isExpanded != this._isAriaExpanded) {
276 this._setExpanded(this.isExpanded);
277 }
278 }
279 ngOnDestroy() {
280 // If this is the last tree node being destroyed,
281 // clear out the reference to avoid leaking memory.
282 if (CdkTreeNode.mostRecentTreeNode === this) {
283 CdkTreeNode.mostRecentTreeNode = null;
284 }
285 this._dataChanges.complete();
286 this._destroyed.next();
287 this._destroyed.complete();
288 }
289 /** Focuses the menu item. Implements for FocusableOption. */
290 focus() {
291 this._elementRef.nativeElement.focus();
292 }
293 // TODO: role should eventually just be set in the component host
294 _setRoleFromData() {
295 if (!this._tree.treeControl.isExpandable && !this._tree.treeControl.getChildren &&
296 (typeof ngDevMode === 'undefined' || ngDevMode)) {
297 throw getTreeControlFunctionsMissingError();
298 }
299 this.role = 'treeitem';
300 }
301}
302/**
303 * The most recently created `CdkTreeNode`. We save it in static variable so we can retrieve it
304 * in `CdkTree` and set the data to it.
305 */
306CdkTreeNode.mostRecentTreeNode = null;
307CdkTreeNode.decorators = [
308 { type: Directive, args: [{
309 selector: 'cdk-tree-node',
310 exportAs: 'cdkTreeNode',
311 },] }
312];
313CdkTreeNode.ctorParameters = () => [
314 { type: ElementRef },
315 { type: CdkTree }
316];
317CdkTreeNode.propDecorators = {
318 role: [{ type: Input }]
319};
320function getParentNodeAriaLevel(nodeElement) {
321 let parent = nodeElement.parentElement;
322 while (parent && !isNodeElement(parent)) {
323 parent = parent.parentElement;
324 }
325 if (!parent) {
326 if (typeof ngDevMode === 'undefined' || ngDevMode) {
327 throw Error('Incorrect tree structure containing detached node.');
328 }
329 else {
330 return -1;
331 }
332 }
333 else if (parent.classList.contains('cdk-nested-tree-node')) {
334 return coerceNumberProperty(parent.getAttribute('aria-level'));
335 }
336 else {
337 // The ancestor element is the cdk-tree itself
338 return 0;
339 }
340}
341function isNodeElement(element) {
342 const classList = element.classList;
343 return !!((classList === null || classList === void 0 ? void 0 : classList.contains('cdk-nested-tree-node')) || (classList === null || classList === void 0 ? void 0 : classList.contains('cdk-tree')));
344}
345//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJlZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbI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