Skip to content

Commit

Permalink
chore: fixes McTreeSelection, await fix in master
Browse files Browse the repository at this point in the history
  • Loading branch information
pimenovoleg committed Jun 24, 2019
1 parent 240ac61 commit c641ade
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 115 deletions.
16 changes: 13 additions & 3 deletions packages/docs/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@

## Development Setup
1. build:mosaic-examples - generate dynamic examples (for Stackblitz)
2. build:mosaic - generate our components for Docs App
3. build:docs - generate `docs-content` folder
1. generate dynamic examples (for Stackblitz)
```bash
yarn run build:mosaic-examples
```

2. generate components for Docs App
```bash
yarn run build:mosaic
```
3. generate `docs-content` folder
```bash
yarn run build:docs
```


## Development Server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


</mc-vertical-navbar>
<tree-storie-component></tree-storie-component>

<div class="content">
<router-outlet></router-outlet>
</div>
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {ChangeDetectionStrategy, Component, ViewEncapsulation} from '@angular/core';
import {CdkTree} from '@ptsecurity/cdk/tree';
import { Component } from '@angular/core';


@Component({
Expand All @@ -9,23 +8,3 @@ import {CdkTree} from '@ptsecurity/cdk/tree';
export class MainLayoutComponent {

}



@Component({
selector: 'mat-tree',
exportAs: 'matTree',
template: `<ng-container></ng-container>`,
host: {
'class': 'mat-tree',
'role': 'tree'
},
encapsulation: ViewEncapsulation.None,
// See note on CdkTree for explanation on why this uses the default change detection strategy.
// tslint:disable-next-line:validate-decorators
changeDetection: ChangeDetectionStrategy.Default,
providers: [{provide: CdkTree, useExisting: MatTree}]
})
export class MatTree<T> extends CdkTree<T> {
// Outlets within the tree's template where the dataNodes will be inserted.
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,26 @@ import { RouterModule } from '@angular/router';
import { McButtonModule } from '@ptsecurity/mosaic/button';
import { McDropdownModule } from '@ptsecurity/mosaic/dropdown';
import { McIconModule } from '@ptsecurity/mosaic/icon';
import { McTreeModule } from '@ptsecurity/mosaic/tree';
import { McVerticalNavbarModule } from '@ptsecurity/mosaic/vertical-navbar';

import {MainLayoutComponent, MatTree} from './main-layout.component';
import {TreeComponent} from '../tree/tree.component';
import {McTreeModule} from '@ptsecurity/mosaic/tree';
import { TreeComponent } from '../tree/tree.component';

import {CdkTreeModule} from '@ptsecurity/cdk/tree';
import { MainLayoutComponent } from './main-layout.component';


@NgModule({
imports: [
CommonModule,
RouterModule,

CdkTreeModule,
McTreeModule,
McVerticalNavbarModule,
McButtonModule,
McIconModule,
McDropdownModule

],
exports: [MainLayoutComponent],
declarations: [MainLayoutComponent, MatTree, TreeComponent]
declarations: [MainLayoutComponent, TreeComponent]
})
export class MainLayoutModule {}
2 changes: 1 addition & 1 deletion packages/docs/src/app/components/tree/tree.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<mc-tree-selection
[dataSource]="dataSource$"
[dataSource]="dataSource"
>

<mc-tree-option *mcTreeNodeDef="let node" mcTreeNodePadding>
Expand Down
6 changes: 3 additions & 3 deletions packages/docs/src/app/components/tree/tree.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class FileDatabase {
})
export class TreeComponent {
treeControl: FlatTreeControl<FileFlatNode>;
dataSource$: McTreeFlatDataSource<FileNode, FileFlatNode>;
dataSource: McTreeFlatDataSource<FileNode, FileFlatNode>;
treeFlattener: McTreeFlattener<FileNode, FileFlatNode>;

constructor(database: FileDatabase) {
Expand All @@ -123,10 +123,10 @@ export class TreeComponent {
);

this.treeControl = new FlatTreeControl<FileFlatNode>(this._getLevel, this._isExpandable);
this.dataSource$ = new McTreeFlatDataSource(this.treeControl, this.treeFlattener);
this.dataSource = new McTreeFlatDataSource(this.treeControl, this.treeFlattener);

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

Expand Down
73 changes: 5 additions & 68 deletions packages/docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"lib": [
"es2017",
"dom"
],

"module": "es2015",
"moduleResolution": "node",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"importHelpers": true,
"target": "es5",
"baseUrl": ".",
"stripInternal": false,
"typeRoots": [
"../../node_modules/@types"
],
Expand All @@ -29,64 +21,9 @@
"@ptsecurity/mosaic/*": ["../../dist/packages/mosaic/*"],

"@ptsecurity/mosaic-moment-adapter/*": ["../../dist/packages/mosaic-moment-adapter/*"],
// "@ptsecurity/mosaic-moment-adapter": ["../../dist/packages/mosaic-moment-adapter"],

"@ptsecurity/mosaic-examples/*": ["../../dist/packages/mosaic-examples/*"],
"@ptsecurity/mosaic-examples": ["../../dist/packages/mosaic-examples"]
//
//
// "@ptsecurity/cdk": ["../../dist/release/cdk"],
// "@ptsecurity/cdk/a11y": ["../../dist/release/cdk/a11y"],
// "@ptsecurity/cdk/bidi": ["../../dist/release/cdk/bidi"],
// "@ptsecurity/cdk/datetime": ["../../dist/release/cdk/datetime"],
// "@ptsecurity/cdk/coercion": ["../../dist/release/cdk/coercion"],
// "@ptsecurity/cdk/collections": ["../../dist/release/cdk/collections"],
// "@ptsecurity/cdk/keycodes": ["../../dist/release/cdk/keycodes"],
// "@ptsecurity/cdk/layout": ["../../dist/release/cdk/layout"],
// "@ptsecurity/cdk/overlay": ["../../dist/release/cdk/overlay"],
// "@ptsecurity/cdk/platform": ["../../dist/release/cdk/platform"],
// "@ptsecurity/cdk/portal": ["../../dist/release/cdk/portal"],
// "@ptsecurity/cdk/scrolling": ["../../dist/release/cdk/scrolling"],
// "@ptsecurity/cdk/testing": ["../../dist/release/cdk/testing"],
// "@ptsecurity/cdk/tree": ["../../dist/release/cdk/tree"],
//
// "@ptsecurity/mosaic-moment-adapter": ["../../dist/release/mosaic-moment-adapter"],
// "@ptsecurity/mosaic-moment-adapter/adapter": ["../../dist/release/mosaic-moment-adapter/adapter"],
//
// "@ptsecurity/mosaic": ["../../dist/release/mosaic"],
//
// "@ptsecurity/mosaic/autocomplete": ["../../dist/release/mosaic/autocomplete"],
// "@ptsecurity/mosaic/button": ["../../dist/release/mosaic/button"],
// "@ptsecurity/mosaic/button-toggle": ["../../dist/release/mosaic/button-toggle"],
// "@ptsecurity/mosaic/core": ["../../dist/release/mosaic/core"],
// "@ptsecurity/mosaic/card": ["../../dist/release/mosaic/card"],
// "@ptsecurity/mosaic/datepicker": ["../../dist/release/mosaic/datepicker"],
// "@ptsecurity/mosaic/divider": ["../../dist/release/mosaic/divider"],
// "@ptsecurity/mosaic/dropdown": ["../../dist/release/mosaic/dropdown"],
// "@ptsecurity/mosaic/list": ["../../dist/release/mosaic/list"],
// "@ptsecurity/mosaic/navbar": ["../../dist/release/mosaic/navbar"],
// "@ptsecurity/mosaic/progress-bar": ["../../dist/release/mosaic/progress-bar"],
// "@ptsecurity/mosaic/progress-spinner": ["../../dist/release/mosaic/progress-spinner"],
// "@ptsecurity/mosaic/icon": ["../../dist/release/mosaic/icon"],
// "@ptsecurity/mosaic/layout": ["../../dist/release/mosaic/layout"],
// "@ptsecurity/mosaic/link": ["../../dist/release/mosaic/link"],
// "@ptsecurity/mosaic/radio": ["../../dist/release/mosaic/radio"],
// "@ptsecurity/mosaic/checkbox": ["../../dist/release/mosaic/checkbox"],
// "@ptsecurity/mosaic/input": ["../../dist/release/mosaic/input"],
// "@ptsecurity/mosaic/form-field": ["../../dist/release/mosaic/form-field"],
// "@ptsecurity/mosaic/tree": ["../../dist/release/mosaic/tree"],
// "@ptsecurity/mosaic/modal": ["../../dist/release/mosaic/modal"],
// "@ptsecurity/mosaic/tags": ["../../dist/release/mosaic/tags"],
// "@ptsecurity/mosaic/tabs": ["../../dist/release/mosaic/tabs"],
// "@ptsecurity/mosaic/select": ["../../dist/release/mosaic/select"],
// "@ptsecurity/mosaic/sidepanel": ["../../dist/release/mosaic/sidepanel"],
// "@ptsecurity/mosaic/textarea": ["../../dist/release/mosaic/textarea"],
// "@ptsecurity/mosaic/toggle": ["../../dist/release/mosaic/toggle"],
// "@ptsecurity/mosaic/tooltip": ["../../dist/release/mosaic/tooltip"],
// "@ptsecurity/mosaic/timepicker": ["../../dist/release/mosaic/timepicker"],
// "@ptsecurity/mosaic/tree-select": ["../../dist/release/mosaic/tree-select"],
// "@ptsecurity/mosaic/splitter": ["../../dist/release/mosaic/splitter"],
// "@ptsecurity/mosaic/vertical-navbar": ["../../dist/release/mosaic/vertical-navbar"]
}
},
"exclude": [
Expand Down
20 changes: 10 additions & 10 deletions packages/mosaic/tree/tree-selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ export class McTreeSelectionChange {
constructor(public source: McTreeSelection, public option: McTreeOption) {}
}

class McTreeSelectionBase<T> extends CdkTree<T> {
constructor(differs: IterableDiffers, changeDetectorRef: ChangeDetectorRef) {
super(differs, changeDetectorRef);
}
}

/* tslint:disable-next-line:naming-convention */
const McTreeSelectionBaseMixin: HasTabIndexCtor & CanDisableCtor &
typeof McTreeSelectionBase = mixinTabIndex(mixinDisabled(McTreeSelectionBase));
// class McTreeSelectionBase<T> extends CdkTree<T> {
// constructor(differs: IterableDiffers, changeDetectorRef: ChangeDetectorRef) {
// super(differs, changeDetectorRef);
// }
// }
//
// /* tslint:disable-next-line:naming-convention */
// const McTreeSelectionBaseMixin: HasTabIndexCtor & CanDisableCtor &
// typeof McTreeSelectionBase = mixinTabIndex(mixinDisabled(McTreeSelectionBase));


@Component({
Expand All @@ -76,7 +76,7 @@ const McTreeSelectionBaseMixin: HasTabIndexCtor & CanDisableCtor &
{ provide: CdkTree, useExisting: McTreeSelection }
]
})
export class McTreeSelection extends McTreeSelectionBaseMixin<McTreeOption>
export class McTreeSelection extends CdkTree<McTreeOption>
implements AfterContentInit, CanDisable, HasTabIndex {

@ViewChild(CdkTreeNodeOutlet, {static: true}) nodeOutlet: CdkTreeNodeOutlet;
Expand Down

0 comments on commit c641ade

Please sign in to comment.