Skip to content

fix(tree): include constructors on MatTree classes to allow es6 builds #12556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/lib/tree/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import {
Input,
IterableDiffers,
OnDestroy,
QueryList
QueryList,
TemplateRef,
} from '@angular/core';
import {CanDisable, HasTabIndex, mixinDisabled, mixinTabIndex} from '@angular/material/core';
import {MatTreeNodeOutlet} from './outlet';
Expand Down Expand Up @@ -70,6 +71,15 @@ export class MatTreeNode<T> extends _MatTreeNodeMixinBase<T>
})
export class MatTreeNodeDef<T> extends CdkTreeNodeDef<T> {
@Input('matTreeNode') data: T;

// TODO(andrewseguin): Remove this explicitly set constructor when the compiler knows how to
// properly build the es6 version of the class. Currently sets ctorParameters to empty due to a
// fixed bug.
// https://github.com/angular/tsickle/pull/760 - tsickle PR that fixed this
// https://github.com/angular/angular/pull/23531 - updates compiler-cli to fixed version
constructor(template: TemplateRef<any>) {
super(template);
}
}

/**
Expand Down
18 changes: 16 additions & 2 deletions src/lib/tree/padding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
* 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 {CdkTreeNodePadding} from '@angular/cdk/tree';
import {Directive, Input} from '@angular/core';
import {CdkTreeNodePadding, CdkTreeNode, CdkTree} from '@angular/cdk/tree';
import {Directionality} from '@angular/cdk/bidi';
import {Directive, Input, Optional, Renderer2, ElementRef} from '@angular/core';


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

/** The indent for each level. Default number 40px from material design menu sub-menu spec. */
@Input('matTreeNodePaddingIndent') indent: number;

// TODO(andrewseguin): Remove this explicitly set constructor when the compiler knows how to
// properly build the es6 version of the class. Currently sets ctorParameters to empty due to a
// fixed bug.
// https://github.com/angular/tsickle/pull/760 - tsickle PR that fixed this
// https://github.com/angular/angular/pull/23531 - updates compiler-cli to fixed version
constructor(_treeNode: CdkTreeNode<T>,
_tree: CdkTree<T>,
_renderer: Renderer2,
_element: ElementRef,
@Optional() _dir: Directionality) {
super(_treeNode, _tree, _renderer, _element, _dir);
}
}
11 changes: 10 additions & 1 deletion src/lib/tree/toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import {Directive, Input} from '@angular/core';
import {CdkTreeNodeToggle} from '@angular/cdk/tree';
import {CdkTreeNodeToggle, CdkTree, CdkTreeNode} from '@angular/cdk/tree';

/**
* Wrapper for the CdkTree's toggle with Material design styles.
Expand All @@ -21,4 +21,13 @@ import {CdkTreeNodeToggle} from '@angular/cdk/tree';
})
export class MatTreeNodeToggle<T> extends CdkTreeNodeToggle<T> {
@Input('matTreeNodeToggleRecursive') recursive: boolean = false;

// TODO(andrewseguin): Remove this explicitly set constructor when the compiler knows how to
// properly build the es6 version of the class. Currently sets ctorParameters to empty due to a
// fixed bug.
// https://github.com/angular/tsickle/pull/760 - tsickle PR that fixed this
// https://github.com/angular/angular/pull/23531 - updates compiler-cli to fixed version
constructor(_tree: CdkTree<T>, _treeNode: CdkTreeNode<T>) {
super(_tree, _treeNode);
}
}
18 changes: 17 additions & 1 deletion src/lib/tree/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@
* found in the LICENSE file at https://angular.io/license
*/

import {ChangeDetectionStrategy, Component, ViewChild, ViewEncapsulation} from '@angular/core';
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
ViewChild,
ViewEncapsulation,
IterableDiffers,
} from '@angular/core';
import {CdkTree} from '@angular/cdk/tree';
import {MatTreeNodeOutlet} from './outlet';

Expand All @@ -30,5 +37,14 @@ import {MatTreeNodeOutlet} from './outlet';
export class MatTree<T> extends CdkTree<T> {
// Outlets within the tree's template where the dataNodes will be inserted.
@ViewChild(MatTreeNodeOutlet) _nodeOutlet: MatTreeNodeOutlet;

// TODO(andrewseguin): Remove this explicitly set constructor when the compiler knows how to
// properly build the es6 version of the class. Currently sets ctorParameters to empty due to a
// fixed bug.
// https://github.com/angular/tsickle/pull/760 - tsickle PR that fixed this
// https://github.com/angular/angular/pull/23531 - updates compiler-cli to fixed version
constructor(_differs: IterableDiffers, _changeDetectorRef: ChangeDetectorRef) {
super(_differs, _changeDetectorRef);
}
}