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

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

initial commit

  • Property mode set to 100644
File size: 15.5 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { Directionality } from '@angular/cdk/bidi';
9import { coerceNumberProperty } from '@angular/cdk/coercion';
10import { Directive, ElementRef, Input, Optional } from '@angular/core';
11import { takeUntil } from 'rxjs/operators';
12import { Subject } from 'rxjs';
13import { CdkTree, CdkTreeNode } from './tree';
14/** Regex used to split a string on its CSS units. */
15const cssUnitPattern = /([A-Za-z%]+)$/;
16/**
17 * Indent for the children tree dataNodes.
18 * This directive will add left-padding to the node to show hierarchy.
19 */
20export class CdkTreeNodePadding {
21 constructor(_treeNode, _tree, _element, _dir) {
22 this._treeNode = _treeNode;
23 this._tree = _tree;
24 this._element = _element;
25 this._dir = _dir;
26 /** Subject that emits when the component has been destroyed. */
27 this._destroyed = new Subject();
28 /** CSS units used for the indentation value. */
29 this.indentUnits = 'px';
30 this._indent = 40;
31 this._setPadding();
32 if (_dir) {
33 _dir.change.pipe(takeUntil(this._destroyed)).subscribe(() => this._setPadding(true));
34 }
35 // In Ivy the indentation binding might be set before the tree node's data has been added,
36 // which means that we'll miss the first render. We have to subscribe to changes in the
37 // data to ensure that everything is up to date.
38 _treeNode._dataChanges.subscribe(() => this._setPadding());
39 }
40 /** The level of depth of the tree node. The padding will be `level * indent` pixels. */
41 get level() { return this._level; }
42 set level(value) { this._setLevelInput(value); }
43 /**
44 * The indent for each level. Can be a number or a CSS string.
45 * Default number 40px from material design menu sub-menu spec.
46 */
47 get indent() { return this._indent; }
48 set indent(indent) { this._setIndentInput(indent); }
49 ngOnDestroy() {
50 this._destroyed.next();
51 this._destroyed.complete();
52 }
53 /** The padding indent value for the tree node. Returns a string with px numbers if not null. */
54 _paddingIndent() {
55 const nodeLevel = (this._treeNode.data && this._tree.treeControl.getLevel)
56 ? this._tree.treeControl.getLevel(this._treeNode.data)
57 : null;
58 const level = this._level == null ? nodeLevel : this._level;
59 return typeof level === 'number' ? `${level * this._indent}${this.indentUnits}` : null;
60 }
61 _setPadding(forceChange = false) {
62 const padding = this._paddingIndent();
63 if (padding !== this._currentPadding || forceChange) {
64 const element = this._element.nativeElement;
65 const paddingProp = this._dir && this._dir.value === 'rtl' ? 'paddingRight' : 'paddingLeft';
66 const resetProp = paddingProp === 'paddingLeft' ? 'paddingRight' : 'paddingLeft';
67 element.style[paddingProp] = padding || '';
68 element.style[resetProp] = '';
69 this._currentPadding = padding;
70 }
71 }
72 /**
73 * This has been extracted to a util because of TS 4 and VE.
74 * View Engine doesn't support property rename inheritance.
75 * TS 4.0 doesn't allow properties to override accessors or vice-versa.
76 * @docs-private
77 */
78 _setLevelInput(value) {
79 // Set to null as the fallback value so that _setPadding can fall back to the node level if the
80 // consumer set the directive as `cdkTreeNodePadding=""`. We still want to take this value if
81 // they set 0 explicitly.
82 this._level = coerceNumberProperty(value, null);
83 this._setPadding();
84 }
85 /**
86 * This has been extracted to a util because of TS 4 and VE.
87 * View Engine doesn't support property rename inheritance.
88 * TS 4.0 doesn't allow properties to override accessors or vice-versa.
89 * @docs-private
90 */
91 _setIndentInput(indent) {
92 let value = indent;
93 let units = 'px';
94 if (typeof indent === 'string') {
95 const parts = indent.split(cssUnitPattern);
96 value = parts[0];
97 units = parts[1] || units;
98 }
99 this.indentUnits = units;
100 this._indent = coerceNumberProperty(value);
101 this._setPadding();
102 }
103}
104CdkTreeNodePadding.decorators = [
105 { type: Directive, args: [{
106 selector: '[cdkTreeNodePadding]',
107 },] }
108];
109CdkTreeNodePadding.ctorParameters = () => [
110 { type: CdkTreeNode },
111 { type: CdkTree },
112 { type: ElementRef },
113 { type: Directionality, decorators: [{ type: Optional }] }
114];
115CdkTreeNodePadding.propDecorators = {
116 level: [{ type: Input, args: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5pdHM7XG4gICAgfVxuXG4gICAgdGhpcy5pbmRlbnRVbml0cyA9IHVuaXRzO1xuICAgIHRoaXMuX2luZGVudCA9IGNvZXJjZU51bWJlclByb3BlcnR5KHZhbHVlKTtcbiAgICB0aGlzLl9zZXRQYWRkaW5nKCk7XG4gIH1cblxuICBzdGF0aWMgbmdBY2NlcHRJbnB1dFR5cGVfbGV2ZWw6IE51bWJlcklucHV0O1xufVxuIl19
Note: See TracBrowser for help on using the repository browser.