Skip to content

fix(chore): in dev example tree select all nodes on click (#UIM-92) #171

Merged
merged 1 commit into from
Jul 17, 2019
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: 3 additions & 9 deletions packages/mosaic-dev/all/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { FormControl, FormsModule, ReactiveFormsModule, Validators } from '@angu
import { BrowserModule } from '@angular/platform-browser';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { CdkTreeModule, FlatTreeControl, NestedTreeControl } from '@ptsecurity/cdk/tree';
import { CdkTreeModule, FlatTreeControl } from '@ptsecurity/cdk/tree';
import { McMomentDateModule } from '@ptsecurity/mosaic-moment-adapter/adapter';
import { McButtonModule } from '@ptsecurity/mosaic/button';
import { McButtonToggleModule } from '@ptsecurity/mosaic/button-toggle';
Expand All @@ -29,7 +29,7 @@ import { McTextareaModule } from '@ptsecurity/mosaic/textarea';
import { McTimepickerModule } from '@ptsecurity/mosaic/timepicker';
import { McToggleModule } from '@ptsecurity/mosaic/toggle';
import { McToolTipModule } from '@ptsecurity/mosaic/tooltip';
import { McTreeFlatDataSource, McTreeFlattener, McTreeModule, McTreeNestedDataSource } from '@ptsecurity/mosaic/tree';
import { McTreeFlatDataSource, McTreeFlattener, McTreeModule } from '@ptsecurity/mosaic/tree';
import { Observable, of as observableOf } from 'rxjs';

import { FileDatabase, FileFlatNode, FileNode } from '../tree/module';
Expand Down Expand Up @@ -84,6 +84,7 @@ export class DemoComponent {
updated: new Date('1/28/16')
}
];

notes = [
{
name: 'Vacation Itinerary',
Expand Down Expand Up @@ -128,9 +129,6 @@ export class DemoComponent {
dataSource: McTreeFlatDataSource<FileNode, FileFlatNode>;
treeFlattener: McTreeFlattener<FileNode, FileFlatNode>;

nestedTreeControl: NestedTreeControl<FileNode>;
nestedDataSource: McTreeNestedDataSource<FileNode>;

constructor(private modalService: McModalService, database: FileDatabase) {
setInterval(() => {
this.percent = (this.percent + STEP) % (MAX_PERCENT + STEP);
Expand All @@ -143,12 +141,8 @@ export class DemoComponent {
this.treeControl = new FlatTreeControl<FileFlatNode>(this._getLevel, this._isExpandable);
this.dataSource = new McTreeFlatDataSource(this.treeControl, this.treeFlattener);

this.nestedTreeControl = new NestedTreeControl<FileNode>(this._getChildren);
this.nestedDataSource = new McTreeNestedDataSource();

database.dataChange.subscribe((data) => {
this.dataSource.data = data;
this.nestedDataSource.data = data;
});
}

Expand Down
11 changes: 9 additions & 2 deletions packages/mosaic-dev/all/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -1191,9 +1191,16 @@ <h1>Tree</h1>
[dataSource]="dataSource"
[treeControl]="treeControl">

<mc-tree-option *mcTreeNodeDef="let node" mcTreeNodePadding>{{ node.name }}</mc-tree-option>
<mc-tree-option
*mcTreeNodeDef="let node" mcTreeNodePadding
[value]="node.name">
{{ node.name }}
</mc-tree-option>

<mc-tree-option *mcTreeNodeDef="let node; when: hasChild" mcTreeNodePadding>
<mc-tree-option
*mcTreeNodeDef="let node; when: hasChild"
mcTreeNodePadding
[value]="node.name">
<i mc-icon="mc-angle-down-S_16" [style.transform]="treeControl.isExpanded(node) ? '' : 'rotate(-90deg)'" mcTreeNodeToggle></i>
{{ node.name }} : {{ node.type }}
</mc-tree-option>
Expand Down