Skip to content

Commit 5b0eed3

Browse files
committed
fix(tree): include constructors on MatTree classes to allow es6 builds (#12556)
1 parent 2798084 commit 5b0eed3

File tree

4 files changed

+54
-5
lines changed

4 files changed

+54
-5
lines changed

src/lib/tree/node.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ import {
2121
Input,
2222
IterableDiffers,
2323
OnDestroy,
24-
QueryList
24+
QueryList,
25+
TemplateRef,
2526
} from '@angular/core';
2627
import {CanDisable, HasTabIndex, mixinDisabled, mixinTabIndex} from '@angular/material/core';
2728
import {MatTreeNodeOutlet} from './outlet';
@@ -70,6 +71,15 @@ export class MatTreeNode<T> extends _MatTreeNodeMixinBase<T>
7071
})
7172
export class MatTreeNodeDef<T> extends CdkTreeNodeDef<T> {
7273
@Input('matTreeNode') data: T;
74+
75+
// TODO(andrewseguin): Remove this explicitly set constructor when the compiler knows how to
76+
// properly build the es6 version of the class. Currently sets ctorParameters to empty due to a
77+
// fixed bug.
78+
// https://github.com/angular/tsickle/pull/760 - tsickle PR that fixed this
79+
// https://github.com/angular/angular/pull/23531 - updates compiler-cli to fixed version
80+
constructor(template: TemplateRef<any>) {
81+
super(template);
82+
}
7383
}
7484

7585
/**

src/lib/tree/padding.ts

+16-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.io/license
77
*/
8-
import {CdkTreeNodePadding} from '@angular/cdk/tree';
9-
import {Directive, Input} from '@angular/core';
8+
import {CdkTreeNodePadding, CdkTreeNode, CdkTree} from '@angular/cdk/tree';
9+
import {Directionality} from '@angular/cdk/bidi';
10+
import {Directive, Input, Optional, Renderer2, ElementRef} from '@angular/core';
1011

1112

1213
/**
@@ -23,4 +24,17 @@ export class MatTreeNodePadding<T> extends CdkTreeNodePadding<T> {
2324

2425
/** The indent for each level. Default number 40px from material design menu sub-menu spec. */
2526
@Input('matTreeNodePaddingIndent') indent: number;
27+
28+
// TODO(andrewseguin): Remove this explicitly set constructor when the compiler knows how to
29+
// properly build the es6 version of the class. Currently sets ctorParameters to empty due to a
30+
// fixed bug.
31+
// https://github.com/angular/tsickle/pull/760 - tsickle PR that fixed this
32+
// https://github.com/angular/angular/pull/23531 - updates compiler-cli to fixed version
33+
constructor(_treeNode: CdkTreeNode<T>,
34+
_tree: CdkTree<T>,
35+
_renderer: Renderer2,
36+
_element: ElementRef,
37+
@Optional() _dir: Directionality) {
38+
super(_treeNode, _tree, _renderer, _element, _dir);
39+
}
2640
}

src/lib/tree/toggle.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import {Directive, Input} from '@angular/core';
10-
import {CdkTreeNodeToggle} from '@angular/cdk/tree';
10+
import {CdkTreeNodeToggle, CdkTree, CdkTreeNode} from '@angular/cdk/tree';
1111

1212
/**
1313
* Wrapper for the CdkTree's toggle with Material design styles.
@@ -21,4 +21,13 @@ import {CdkTreeNodeToggle} from '@angular/cdk/tree';
2121
})
2222
export class MatTreeNodeToggle<T> extends CdkTreeNodeToggle<T> {
2323
@Input('matTreeNodeToggleRecursive') recursive: boolean = false;
24+
25+
// TODO(andrewseguin): Remove this explicitly set constructor when the compiler knows how to
26+
// properly build the es6 version of the class. Currently sets ctorParameters to empty due to a
27+
// fixed bug.
28+
// https://github.com/angular/tsickle/pull/760 - tsickle PR that fixed this
29+
// https://github.com/angular/angular/pull/23531 - updates compiler-cli to fixed version
30+
constructor(_tree: CdkTree<T>, _treeNode: CdkTreeNode<T>) {
31+
super(_tree, _treeNode);
32+
}
2433
}

src/lib/tree/tree.ts

+17-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {ChangeDetectionStrategy, Component, ViewChild, ViewEncapsulation} from '@angular/core';
9+
import {
10+
ChangeDetectionStrategy,
11+
ChangeDetectorRef,
12+
Component,
13+
ViewChild,
14+
ViewEncapsulation,
15+
IterableDiffers,
16+
} from '@angular/core';
1017
import {CdkTree} from '@angular/cdk/tree';
1118
import {MatTreeNodeOutlet} from './outlet';
1219

@@ -30,5 +37,14 @@ import {MatTreeNodeOutlet} from './outlet';
3037
export class MatTree<T> extends CdkTree<T> {
3138
// Outlets within the tree's template where the dataNodes will be inserted.
3239
@ViewChild(MatTreeNodeOutlet) _nodeOutlet: MatTreeNodeOutlet;
40+
41+
// TODO(andrewseguin): Remove this explicitly set constructor when the compiler knows how to
42+
// properly build the es6 version of the class. Currently sets ctorParameters to empty due to a
43+
// fixed bug.
44+
// https://github.com/angular/tsickle/pull/760 - tsickle PR that fixed this
45+
// https://github.com/angular/angular/pull/23531 - updates compiler-cli to fixed version
46+
constructor(_differs: IterableDiffers, _changeDetectorRef: ChangeDetectorRef) {
47+
super(_differs, _changeDetectorRef);
48+
}
3349
}
3450

0 commit comments

Comments
 (0)