Skip to content

Commit

Permalink
fix(tree): include constructors on MatTree classes to allow es6 builds (
Browse files Browse the repository at this point in the history
  • Loading branch information
josephperrott authored Aug 7, 2018
1 parent 4c2f619 commit 5623c5b
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 5 deletions.
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);
}
}

0 comments on commit 5623c5b

Please sign in to comment.