From 5d62c58725a725d6d38b56d96f7e849c21dfbbb1 Mon Sep 17 00:00:00 2001 From: Sercan Yemen Date: Mon, 27 Aug 2018 08:23:11 +0300 Subject: [PATCH 01/19] Added docs for Material theming --- .../material-theming.component.html | 113 ++++++++++++++++++ .../material-theming.component.scss | 5 + .../material-theming.component.ts | 13 ++ .../working-with-fuse.module.ts | 6 + src/app/navigation/navigation.ts | 6 + 5 files changed, 143 insertions(+) create mode 100644 src/app/main/documentation/working-with-fuse/material-theming/material-theming.component.html create mode 100644 src/app/main/documentation/working-with-fuse/material-theming/material-theming.component.scss create mode 100644 src/app/main/documentation/working-with-fuse/material-theming/material-theming.component.ts diff --git a/src/app/main/documentation/working-with-fuse/material-theming/material-theming.component.html b/src/app/main/documentation/working-with-fuse/material-theming/material-theming.component.html new file mode 100644 index 00000000..1f1040e8 --- /dev/null +++ b/src/app/main/documentation/working-with-fuse/material-theming/material-theming.component.html @@ -0,0 +1,113 @@ +
+ + +
+ +
+ home + chevron_right + Documentation + chevron_right + Working with Fuse +
+ +
Material Theming
+ +
+ + + +
+ +

+ Fuse fully takes advantage of Angular + Material's theming. +

+ +

+ All Material theming related codes can be found in the src/app/app.theme.scss file. This file + is responsible for creating Material color themes as well as applying those themes to the individual + components. +

+ +

+ To simply explain, every component that comes with Fuse has a separate *.theme.scss file + which has everything theming related. These files are separate from the component's scss files simply + because they have theming mixins and they need to be imported in app.theme.scss. Having those + mixins in the component's scss file would have caused duplicate content when imported. +

+ +
Theming components
+ +

+ Below, you can see an example theme (calendar.theme.scss) file. When you create a component, or + move one from the Demo app, you need to import this scss file in the app.theme.scss file and add it + to the component-theme mixin array. +

+ +

+ + + +

+ +

+ calendar.theme.scss +

+ +

+ + + +

+ +

+ app.theme.scss +

+ +

+ The components-theme mixin will be called when you define a new theme so that the components + can be styles according to that theme. +

+ +

+ Too see more examples about multiple color themes you can see the src/app/app.theme.scss file + from the Demo project. +

+ +

+ To learn more about the contents of the $theme map, check out the Demo project. There are + plenty of examples in there and you can also print out the contents of the map using the @debug + function of the sass. +

+ +
+ + +
\ No newline at end of file diff --git a/src/app/main/documentation/working-with-fuse/material-theming/material-theming.component.scss b/src/app/main/documentation/working-with-fuse/material-theming/material-theming.component.scss new file mode 100644 index 00000000..ca2a0c07 --- /dev/null +++ b/src/app/main/documentation/working-with-fuse/material-theming/material-theming.component.scss @@ -0,0 +1,5 @@ +@import "src/@fuse/scss/fuse"; + +:host { + +} diff --git a/src/app/main/documentation/working-with-fuse/material-theming/material-theming.component.ts b/src/app/main/documentation/working-with-fuse/material-theming/material-theming.component.ts new file mode 100644 index 00000000..40732100 --- /dev/null +++ b/src/app/main/documentation/working-with-fuse/material-theming/material-theming.component.ts @@ -0,0 +1,13 @@ +import { Component } from '@angular/core'; + +@Component({ + selector : 'docs-working-with-fuse-material-theming', + templateUrl: './material-theming.component.html', + styleUrls : ['./material-theming.component.scss'] +}) +export class DocsWorkingWithFuseMaterialThemingComponent +{ + constructor() + { + } +} diff --git a/src/app/main/documentation/working-with-fuse/working-with-fuse.module.ts b/src/app/main/documentation/working-with-fuse/working-with-fuse.module.ts index 394a3563..2e477a48 100644 --- a/src/app/main/documentation/working-with-fuse/working-with-fuse.module.ts +++ b/src/app/main/documentation/working-with-fuse/working-with-fuse.module.ts @@ -10,6 +10,7 @@ import { DocsWorkingWithFuseProductionComponent } from 'app/main/documentation/w import { DocsWorkingWithFuseDirectoryStructureComponent } from 'app/main/documentation/working-with-fuse/directory-structure/directory-structure.component'; import { DocsWorkingWithFuseUpdatingFuseComponent } from 'app/main/documentation/working-with-fuse/updating-fuse/updating-fuse.component'; import { DocsWorkingWithFuseMultiLanguageComponent } from 'app/main/documentation/working-with-fuse/multi-language/multi-language.component'; +import { DocsWorkingWithFuseMaterialThemingComponent } from 'app/main/documentation/working-with-fuse/material-theming/material-theming.component'; import { DocsWorkingWithFuseThemeLayoutsComponent } from 'app/main/documentation/working-with-fuse/theme-layouts/theme-layouts.component'; import { DocsWorkingWithFusePageLayoutsComponent } from 'app/main/documentation/working-with-fuse/page-layouts/page-layouts.component'; @@ -34,6 +35,10 @@ const routes = [ path : 'multi-language', component: DocsWorkingWithFuseMultiLanguageComponent }, + { + path : 'material-theming', + component: DocsWorkingWithFuseMaterialThemingComponent + }, { path : 'theme-layouts', component: DocsWorkingWithFuseThemeLayoutsComponent @@ -50,6 +55,7 @@ const routes = [ DocsWorkingWithFuseProductionComponent, DocsWorkingWithFuseDirectoryStructureComponent, DocsWorkingWithFuseUpdatingFuseComponent, + DocsWorkingWithFuseMaterialThemingComponent, DocsWorkingWithFuseMultiLanguageComponent, DocsWorkingWithFuseThemeLayoutsComponent, DocsWorkingWithFusePageLayoutsComponent diff --git a/src/app/navigation/navigation.ts b/src/app/navigation/navigation.ts index a409e0a0..ff8f7c40 100644 --- a/src/app/navigation/navigation.ts +++ b/src/app/navigation/navigation.ts @@ -904,6 +904,12 @@ export const navigation: FuseNavigation[] = [ type : 'item', url : '/documentation/working-with-fuse/multi-language' }, + { + id : 'material-theming', + title: 'Material Theming', + type : 'item', + url : '/documentation/working-with-fuse/material-theming' + }, { id : 'theme-layouts', title: 'Theme Layouts', From c8c0b4a609530aeac74998d475bccf1b2a338aff Mon Sep 17 00:00:00 2001 From: Sercan Yemen Date: Mon, 27 Aug 2018 10:05:48 +0300 Subject: [PATCH 02/19] (Navbar) Correctly delay the update of the perfect scrollbar + Fixed the style-1 color issue --- .../vertical/style-1/style-1.component.html | 5 +++-- .../vertical/style-1/style-1.component.ts | 17 ++++++----------- .../vertical/style-2/style-2.component.ts | 17 ++++++----------- 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/src/app/layout/components/navbar/vertical/style-1/style-1.component.html b/src/app/layout/components/navbar/vertical/style-1/style-1.component.html index 53cd80ac..c6effb77 100644 --- a/src/app/layout/components/navbar/vertical/style-1/style-1.component.html +++ b/src/app/layout/components/navbar/vertical/style-1/style-1.component.html @@ -22,7 +22,8 @@ - diff --git a/src/assets/angular-material-examples/tooltip-custom-class/tooltip-custom-class-example.ts b/src/assets/angular-material-examples/tooltip-custom-class/tooltip-custom-class-example.ts index 51e7f754..62419465 100755 --- a/src/assets/angular-material-examples/tooltip-custom-class/tooltip-custom-class-example.ts +++ b/src/assets/angular-material-examples/tooltip-custom-class/tooltip-custom-class-example.ts @@ -11,4 +11,4 @@ import {Component, ViewEncapsulation} from '@angular/core'; // `tooltip-custom-class-example.css` will not be scoped to this component's view. encapsulation: ViewEncapsulation.None, }) -export class TooltipCustomClassExample { } +export class TooltipCustomClassExample {} diff --git a/src/assets/angular-material-examples/tooltip-position/tooltip-position-example.html b/src/assets/angular-material-examples/tooltip-position/tooltip-position-example.html index f4b76551..444dbad7 100755 --- a/src/assets/angular-material-examples/tooltip-position/tooltip-position-example.html +++ b/src/assets/angular-material-examples/tooltip-position/tooltip-position-example.html @@ -1,7 +1,7 @@ - {{ positionOption }} + {{positionOption}} diff --git a/src/assets/angular-material-examples/tree-checklist/tree-checklist-example.ts b/src/assets/angular-material-examples/tree-checklist/tree-checklist-example.ts index 5407d082..2f031869 100755 --- a/src/assets/angular-material-examples/tree-checklist/tree-checklist-example.ts +++ b/src/assets/angular-material-examples/tree-checklist/tree-checklist-example.ts @@ -1,9 +1,8 @@ -import {Component, Injectable} from '@angular/core'; import {SelectionModel} from '@angular/cdk/collections'; import {FlatTreeControl} from '@angular/cdk/tree'; -import {MatTreeFlattener, MatTreeFlatDataSource} from '@angular/material/tree'; -import {of as ofObservable, Observable, BehaviorSubject} from 'rxjs'; - +import {Component, Injectable} from '@angular/core'; +import {MatTreeFlatDataSource, MatTreeFlattener} from '@angular/material/tree'; +import {BehaviorSubject} from 'rxjs'; /** * Node for to-do item @@ -24,21 +23,21 @@ export class TodoItemFlatNode { * The Json object for to-do list data. */ const TREE_DATA = { - 'Reminders': [ + Groceries: { + 'Almond Meal flour': null, + 'Organic eggs': null, + 'Protein Powder': null, + Fruits: { + Apple: null, + Berries: ['Blueberry', 'Raspberry'], + Orange: null + } + }, + Reminders: [ 'Cook dinner', 'Read the Material Design spec', 'Upgrade Application to Angular' - ], - 'Groceries': { - 'Organic eggs': null, - 'Protein Powder': null, - 'Almond Meal flour': null, - 'Fruits': { - 'Apple': null, - 'Orange': null, - 'Berries': ['Blueberry', 'Raspberry'] - } - } + ] }; /** @@ -48,7 +47,7 @@ const TREE_DATA = { */ @Injectable() export class ChecklistDatabase { - dataChange: BehaviorSubject = new BehaviorSubject([]); + dataChange = new BehaviorSubject([]); get data(): TodoItemNode[] { return this.dataChange.value; } @@ -69,29 +68,28 @@ export class ChecklistDatabase { * Build the file structure tree. The `value` is the Json object, or a sub-tree of a Json object. * The return value is the list of `TodoItemNode`. */ - buildFileTree(value: any, level: number) { - let data: any[] = []; - for (let k in value) { - let v = value[k]; - let node = new TodoItemNode(); - node.item = `${k}`; - if (v === null || v === undefined) { - // no action - } else if (typeof v === 'object') { - node.children = this.buildFileTree(v, level + 1); - } else { - node.item = v; + buildFileTree(obj: object, level: number): TodoItemNode[] { + return Object.keys(obj).reduce((accumulator, key) => { + const value = obj[key]; + const node = new TodoItemNode(); + node.item = key; + + if (value != null) { + if (typeof value === 'object') { + node.children = this.buildFileTree(value, level + 1); + } else { + node.item = value; + } } - data.push(node); - } - return data; + + return accumulator.concat(node); + }, []); } /** Add an item to to-do list */ insertItem(parent: TodoItemNode, name: string) { - const child = {item: name}; if (parent.children) { - parent.children.push(child); + parent.children.push({item: name} as TodoItemNode); this.dataChange.next(this.data); } } @@ -113,16 +111,16 @@ export class ChecklistDatabase { }) export class TreeChecklistExample { /** Map from flat node to nested node. This helps us finding the nested node to be modified */ - flatNodeMap: Map = new Map(); + flatNodeMap = new Map(); /** Map from nested node to flattened node. This helps us to keep the same object for selection */ - nestedNodeMap: Map = new Map(); + nestedNodeMap = new Map(); /** A selected parent node to be inserted */ selectedParent: TodoItemFlatNode | null = null; /** The new item's name */ - newItemName: string = ''; + newItemName = ''; treeControl: FlatTreeControl; @@ -144,25 +142,24 @@ export class TreeChecklistExample { }); } - getLevel = (node: TodoItemFlatNode) => { return node.level; }; + getLevel = (node: TodoItemFlatNode) => node.level; - isExpandable = (node: TodoItemFlatNode) => { return node.expandable; }; + isExpandable = (node: TodoItemFlatNode) => node.expandable; - getChildren = (node: TodoItemNode): Observable => { - return ofObservable(node.children); - } + getChildren = (node: TodoItemNode): TodoItemNode[] => node.children; - hasChild = (_: number, _nodeData: TodoItemFlatNode) => { return _nodeData.expandable; }; + hasChild = (_: number, _nodeData: TodoItemFlatNode) => _nodeData.expandable; - hasNoContent = (_: number, _nodeData: TodoItemFlatNode) => { return _nodeData.item === ''; }; + hasNoContent = (_: number, _nodeData: TodoItemFlatNode) => _nodeData.item === ''; /** * Transformer to convert nested node to flat node. Record the nodes in maps for later use. */ transformer = (node: TodoItemNode, level: number) => { - let flatNode = this.nestedNodeMap.has(node) && this.nestedNodeMap.get(node)!.item === node.item - ? this.nestedNodeMap.get(node)! - : new TodoItemFlatNode(); + const existingNode = this.nestedNodeMap.get(node); + const flatNode = existingNode && existingNode.item === node.item + ? existingNode + : new TodoItemFlatNode(); flatNode.item = node.item; flatNode.level = level; flatNode.expandable = !!node.children; diff --git a/src/assets/angular-material-examples/tree-dynamic/tree-dynamic-example.ts b/src/assets/angular-material-examples/tree-dynamic/tree-dynamic-example.ts index 7f9b4052..8f560382 100755 --- a/src/assets/angular-material-examples/tree-dynamic/tree-dynamic-example.ts +++ b/src/assets/angular-material-examples/tree-dynamic/tree-dynamic-example.ts @@ -1,37 +1,34 @@ -import {Component, Injectable} from '@angular/core'; -import {FlatTreeControl} from '@angular/cdk/tree'; import {CollectionViewer, SelectionChange} from '@angular/cdk/collections'; -import {BehaviorSubject, Observable, merge} from 'rxjs'; +import {FlatTreeControl} from '@angular/cdk/tree'; +import {Component, Injectable} from '@angular/core'; +import {BehaviorSubject, merge, Observable} from 'rxjs'; import {map} from 'rxjs/operators'; - /** Flat node with expandable and level information */ export class DynamicFlatNode { - constructor(public item: string, public level: number = 1, public expandable: boolean = false, - public isLoading: boolean = false) {} + constructor(public item: string, public level = 1, public expandable = false, + public isLoading = false) {} } - /** * Database for dynamic data. When expanding a node in the tree, the data source will need to fetch * the descendants data from the database. */ export class DynamicDatabase { - dataMap = new Map([ + dataMap = new Map([ ['Fruits', ['Apple', 'Orange', 'Banana']], ['Vegetables', ['Tomato', 'Potato', 'Onion']], ['Apple', ['Fuji', 'Macintosh']], ['Onion', ['Yellow', 'White', 'Purple']] ]); - rootLevelNodes = ['Fruits', 'Vegetables']; + rootLevelNodes: string[] = ['Fruits', 'Vegetables']; /** Initial data from database */ initialData(): DynamicFlatNode[] { return this.rootLevelNodes.map(name => new DynamicFlatNode(name, 0, true)); } - getChildren(node: string): string[] | undefined { return this.dataMap.get(node); } @@ -50,7 +47,7 @@ export class DynamicDatabase { @Injectable() export class DynamicDataSource { - dataChange: BehaviorSubject = new BehaviorSubject([]); + dataChange = new BehaviorSubject([]); get data(): DynamicFlatNode[] { return this.dataChange.value; } set data(value: DynamicFlatNode[]) { @@ -75,10 +72,10 @@ export class DynamicDataSource { /** Handle expand/collapse behaviors */ handleTreeControl(change: SelectionChange) { if (change.added) { - change.added.forEach((node) => this.toggleNode(node, true)); + change.added.forEach(node => this.toggleNode(node, true)); } if (change.removed) { - change.removed.reverse().forEach((node) => this.toggleNode(node, false)); + change.removed.slice().reverse().forEach(node => this.toggleNode(node, false)); } } @@ -123,7 +120,6 @@ export class DynamicDataSource { providers: [DynamicDatabase] }) export class TreeDynamicExample { - constructor(database: DynamicDatabase) { this.treeControl = new FlatTreeControl(this.getLevel, this.isExpandable); this.dataSource = new DynamicDataSource(this.treeControl, database); @@ -135,9 +131,9 @@ export class TreeDynamicExample { dataSource: DynamicDataSource; - getLevel = (node: DynamicFlatNode) => { return node.level; }; + getLevel = (node: DynamicFlatNode) => node.level; - isExpandable = (node: DynamicFlatNode) => { return node.expandable; }; + isExpandable = (node: DynamicFlatNode) => node.expandable; - hasChild = (_: number, _nodeData: DynamicFlatNode) => { return _nodeData.expandable; }; + hasChild = (_: number, _nodeData: DynamicFlatNode) => _nodeData.expandable; } diff --git a/src/assets/angular-material-examples/tree-flat-overview/tree-flat-overview-example.ts b/src/assets/angular-material-examples/tree-flat-overview/tree-flat-overview-example.ts index ebdaf064..ba7a4dad 100755 --- a/src/assets/angular-material-examples/tree-flat-overview/tree-flat-overview-example.ts +++ b/src/assets/angular-material-examples/tree-flat-overview/tree-flat-overview-example.ts @@ -15,51 +15,48 @@ export class FileNode { /** Flat node with expandable and level information */ export class FileFlatNode { - filename: string; - type: any; - level: number; - expandable: boolean; + constructor( + public expandable: boolean, public filename: string, public level: number, public type: any) {} } /** * The file structure tree data in string. The data could be parsed into a Json object */ -const TREE_DATA = ` - { - "Documents": { - "angular": { - "src": { - "core": "ts", - "compiler": "ts" - } - }, - "material2": { - "src": { - "button": "ts", - "checkbox": "ts", - "input": "ts" - } +const TREE_DATA = JSON.stringify({ + Applications: { + Calendar: 'app', + Chrome: 'app', + Webstorm: 'app' + }, + Documents: { + angular: { + src: { + compiler: 'ts', + core: 'ts' } }, - "Downloads": { - "Tutorial": "html", - "November": "pdf", - "October": "pdf" - }, - "Pictures": { - "Sun": "png", - "Woods": "jpg", - "Photo Booth Library": { - "Contents": "dir", - "Pictures": "dir" - } - }, - "Applications": { - "Chrome": "app", - "Calendar": "app", - "Webstorm": "app" + material2: { + src: { + button: 'ts', + checkbox: 'ts', + input: 'ts' + } } -}`; + }, + Downloads: { + October: 'pdf', + November: 'pdf', + Tutorial: 'html' + }, + Pictures: { + 'Photo Booth Library': { + Contents: 'dir', + Pictures: 'dir' + }, + Sun: 'png', + Woods: 'jpg' + } +}); /** * File database, it can build a tree structured Json object from string. @@ -70,7 +67,7 @@ const TREE_DATA = ` */ @Injectable() export class FileDatabase { - dataChange: BehaviorSubject = new BehaviorSubject([]); + dataChange = new BehaviorSubject([]); get data(): FileNode[] { return this.dataChange.value; } @@ -94,22 +91,22 @@ export class FileDatabase { * Build the file structure tree. The `value` is the Json object, or a sub-tree of a Json object. * The return value is the list of `FileNode`. */ - buildFileTree(value: any, level: number): FileNode[] { - let data: any[] = []; - for (let k in value) { - let v = value[k]; - let node = new FileNode(); - node.filename = `${k}`; - if (v === null || v === undefined) { - // no action - } else if (typeof v === 'object') { - node.children = this.buildFileTree(v, level + 1); - } else { - node.type = v; + buildFileTree(obj: object, level: number): FileNode[] { + return Object.keys(obj).reduce((accumulator, key) => { + const value = obj[key]; + const node = new FileNode(); + node.filename = key; + + if (value != null) { + if (typeof value === 'object') { + node.children = this.buildFileTree(value, level + 1); + } else { + node.type = value; + } } - data.push(node); - } - return data; + + return accumulator.concat(node); + }, []); } } @@ -123,11 +120,8 @@ export class FileDatabase { providers: [FileDatabase] }) export class TreeFlatOverviewExample { - treeControl: FlatTreeControl; - treeFlattener: MatTreeFlattener; - dataSource: MatTreeFlatDataSource; constructor(database: FileDatabase) { @@ -136,27 +130,18 @@ export class TreeFlatOverviewExample { this.treeControl = new FlatTreeControl(this._getLevel, this._isExpandable); this.dataSource = new MatTreeFlatDataSource(this.treeControl, this.treeFlattener); - database.dataChange.subscribe(data => { - this.dataSource.data = data; - }); + database.dataChange.subscribe(data => this.dataSource.data = data); } transformer = (node: FileNode, level: number) => { - let flatNode = new FileFlatNode(); - flatNode.filename = node.filename; - flatNode.type = node.type; - flatNode.level = level; - flatNode.expandable = !!node.children; - return flatNode; + return new FileFlatNode(!!node.children, node.filename, level, node.type); } - private _getLevel = (node: FileFlatNode) => { return node.level; }; + private _getLevel = (node: FileFlatNode) => node.level; - private _isExpandable = (node: FileFlatNode) => { return node.expandable; }; + private _isExpandable = (node: FileFlatNode) => node.expandable; - private _getChildren = (node: FileNode): Observable => { - return observableOf(node.children); - } + private _getChildren = (node: FileNode): Observable => observableOf(node.children); - hasChild = (_: number, _nodeData: FileFlatNode) => { return _nodeData.expandable; }; + hasChild = (_: number, _nodeData: FileFlatNode) => _nodeData.expandable; } diff --git a/src/assets/angular-material-examples/tree-loadmore/tree-loadmore-example.ts b/src/assets/angular-material-examples/tree-loadmore/tree-loadmore-example.ts index 559ca190..0c958a8a 100755 --- a/src/assets/angular-material-examples/tree-loadmore/tree-loadmore-example.ts +++ b/src/assets/angular-material-examples/tree-loadmore/tree-loadmore-example.ts @@ -5,32 +5,31 @@ * 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 {Component, Injectable} from '@angular/core'; import {FlatTreeControl} from '@angular/cdk/tree'; +import {Component, Injectable} from '@angular/core'; import {MatTreeFlatDataSource, MatTreeFlattener} from '@angular/material/tree'; import {BehaviorSubject, Observable} from 'rxjs'; - const LOAD_MORE = 'LOAD_MORE'; /** Nested node */ export class LoadmoreNode { - childrenChange: BehaviorSubject = new BehaviorSubject([]); + childrenChange = new BehaviorSubject([]); get children(): LoadmoreNode[] { return this.childrenChange.value; } constructor(public item: string, - public hasChildren: boolean = false, + public hasChildren = false, public loadMoreParentItem: string | null = null) {} } /** Flat node with expandable and level information */ export class LoadmoreFlatNode { constructor(public item: string, - public level: number = 1, - public expandable: boolean = false, + public level = 1, + public expandable = false, public loadMoreParentItem: string | null = null) {} } @@ -41,12 +40,12 @@ export class LoadmoreFlatNode { @Injectable() export class LoadmoreDatabase { batchNumber = 5; - dataChange: BehaviorSubject = new BehaviorSubject([]); - nodeMap: Map = new Map(); + dataChange = new BehaviorSubject([]); + nodeMap = new Map(); /** The data */ - rootLevelNodes = ['Vegetables', 'Fruits']; - dataMap = new Map([ + rootLevelNodes: string[] = ['Vegetables', 'Fruits']; + dataMap = new Map([ ['Fruits', ['Apple', 'Orange', 'Banana']], ['Vegetables', ['Tomato', 'Potato', 'Onion']], ['Apple', ['Fuji', 'Macintosh']], @@ -59,7 +58,7 @@ export class LoadmoreDatabase { } /** Expand a node whose children are not loaded */ - loadMore(item: string, onlyFirstTime: boolean = false) { + loadMore(item: string, onlyFirstTime = false) { if (!this.nodeMap.has(item) || !this.dataMap.has(item)) { return; } @@ -69,7 +68,7 @@ export class LoadmoreDatabase { return; } const newChildrenNumber = parent.children!.length + this.batchNumber; - let nodes = children.slice(0, newChildrenNumber) + const nodes = children.slice(0, newChildrenNumber) .map(name => this._generateNode(name)); if (newChildrenNumber < children.length) { // Need a new load more node @@ -100,13 +99,9 @@ export class LoadmoreDatabase { providers: [LoadmoreDatabase] }) export class TreeLoadmoreExample { - - nodeMap: Map = new Map(); - + nodeMap = new Map(); treeControl: FlatTreeControl; - treeFlattener: MatTreeFlattener; - // Flat tree data source dataSource: MatTreeFlatDataSource; @@ -125,24 +120,28 @@ export class TreeLoadmoreExample { database.initialize(); } - getChildren = (node: LoadmoreNode): Observable => { return node.childrenChange; }; + getChildren = (node: LoadmoreNode): Observable => node.childrenChange; transformer = (node: LoadmoreNode, level: number) => { - if (this.nodeMap.has(node.item)) { - return this.nodeMap.get(node.item)!; + const existingNode = this.nodeMap.get(node.item); + + if (existingNode) { + return existingNode; } - let newNode = new LoadmoreFlatNode(node.item, level, node.hasChildren, node.loadMoreParentItem); + + const newNode = + new LoadmoreFlatNode(node.item, level, node.hasChildren, node.loadMoreParentItem); this.nodeMap.set(node.item, newNode); return newNode; } - getLevel = (node: LoadmoreFlatNode) => { return node.level; }; + getLevel = (node: LoadmoreFlatNode) => node.level; - isExpandable = (node: LoadmoreFlatNode) => { return node.expandable; }; + isExpandable = (node: LoadmoreFlatNode) => node.expandable; - hasChild = (_: number, _nodeData: LoadmoreFlatNode) => { return _nodeData.expandable; }; + hasChild = (_: number, _nodeData: LoadmoreFlatNode) => _nodeData.expandable; - isLoadMore = (_: number, _nodeData: LoadmoreFlatNode) => { return _nodeData.item === LOAD_MORE; }; + isLoadMore = (_: number, _nodeData: LoadmoreFlatNode) => _nodeData.item === LOAD_MORE; /** Load more nodes from data source */ loadMore(item: string) { diff --git a/src/assets/angular-material-examples/tree-nested-overview/tree-nested-overview-example.ts b/src/assets/angular-material-examples/tree-nested-overview/tree-nested-overview-example.ts index bdc37e34..9fe9960e 100755 --- a/src/assets/angular-material-examples/tree-nested-overview/tree-nested-overview-example.ts +++ b/src/assets/angular-material-examples/tree-nested-overview/tree-nested-overview-example.ts @@ -1,7 +1,7 @@ import {NestedTreeControl} from '@angular/cdk/tree'; import {Component, Injectable} from '@angular/core'; import {MatTreeNestedDataSource} from '@angular/material/tree'; -import {BehaviorSubject, of as observableOf} from 'rxjs'; +import {BehaviorSubject} from 'rxjs'; /** * Json node data with nested structure. Each node has a filename and a value or a list of children @@ -15,42 +15,41 @@ export class FileNode { /** * The Json tree data in string. The data could be parsed into Json object */ -const TREE_DATA = ` - { - "Documents": { - "angular": { - "src": { - "core": "ts", - "compiler": "ts" - } - }, - "material2": { - "src": { - "button": "ts", - "checkbox": "ts", - "input": "ts" - } +const TREE_DATA = JSON.stringify({ + Applications: { + Calendar: 'app', + Chrome: 'app', + Webstorm: 'app' + }, + Documents: { + angular: { + src: { + compiler: 'ts', + core: 'ts' } }, - "Downloads": { - "Tutorial": "html", - "November": "pdf", - "October": "pdf" - }, - "Pictures": { - "Sun": "png", - "Woods": "jpg", - "Photo Booth Library": { - "Contents": "dir", - "Pictures": "dir" - } - }, - "Applications": { - "Chrome": "app", - "Calendar": "app", - "Webstorm": "app" + material2: { + src: { + button: 'ts', + checkbox: 'ts', + input: 'ts' + } } - }`; + }, + Downloads: { + October: 'pdf', + November: 'pdf', + Tutorial: 'html' + }, + Pictures: { + 'Photo Booth Library': { + Contents: 'dir', + Pictures: 'dir' + }, + Sun: 'png', + Woods: 'jpg' + } +}); /** * File database, it can build a tree structured Json object from string. @@ -61,7 +60,7 @@ const TREE_DATA = ` */ @Injectable() export class FileDatabase { - dataChange: BehaviorSubject = new BehaviorSubject([]); + dataChange = new BehaviorSubject([]); get data(): FileNode[] { return this.dataChange.value; } @@ -85,22 +84,22 @@ export class FileDatabase { * Build the file structure tree. The `value` is the Json object, or a sub-tree of a Json object. * The return value is the list of `FileNode`. */ - buildFileTree(value: any, level: number): FileNode[] { - let data: any[] = []; - for (let k in value) { - let v = value[k]; - let node = new FileNode(); - node.filename = `${k}`; - if (v === null || v === undefined) { - // no action - } else if (typeof v === 'object') { - node.children = this.buildFileTree(v, level + 1); - } else { - node.type = v; + buildFileTree(obj: object, level: number): FileNode[] { + return Object.keys(obj).reduce((accumulator, key) => { + const value = obj[key]; + const node = new FileNode(); + node.filename = key; + + if (value != null) { + if (typeof value === 'object') { + node.children = this.buildFileTree(value, level + 1); + } else { + node.type = value; + } } - data.push(node); - } - return data; + + return accumulator.concat(node); + }, []); } } @@ -115,7 +114,6 @@ export class FileDatabase { }) export class TreeNestedOverviewExample { nestedTreeControl: NestedTreeControl; - nestedDataSource: MatTreeNestedDataSource; constructor(database: FileDatabase) { @@ -125,7 +123,7 @@ export class TreeNestedOverviewExample { database.dataChange.subscribe(data => this.nestedDataSource.data = data); } - private _getChildren = (node: FileNode) => { return observableOf(node.children); }; + hasNestedChild = (_: number, nodeData: FileNode) => !nodeData.type; - hasNestedChild = (_: number, nodeData: FileNode) => {return !(nodeData.type); }; + private _getChildren = (node: FileNode) => node.children; } From 9630d0154f5d6abf8db5f97e73ead63ae712a2ed Mon Sep 17 00:00:00 2001 From: Sercan Yemen Date: Tue, 28 Aug 2018 07:56:57 +0300 Subject: [PATCH 17/19] Updated various packages --- package-lock.json | 288 +++++++++++++++++++++++++++++++++------------- package.json | 4 +- 2 files changed, 212 insertions(+), 80 deletions(-) diff --git a/package-lock.json b/package-lock.json index d9f6e47e..733b7415 100644 --- a/package-lock.json +++ b/package-lock.json @@ -434,6 +434,148 @@ "integrity": "sha1-NOZY7T2jfyOwogDi2lqJvpK7IJ8=", "dev": true }, + "@babel/code-frame": { + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0-beta.51.tgz", + "integrity": "sha1-vXHZsZKvl435FYKdOdQJRFZDmgw=", + "dev": true, + "requires": { + "@babel/highlight": "7.0.0-beta.51" + } + }, + "@babel/generator": { + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.0.0-beta.51.tgz", + "integrity": "sha1-bHV1/952HQdIXgS67cA5LG2eMPY=", + "dev": true, + "requires": { + "@babel/types": "7.0.0-beta.51", + "jsesc": "^2.5.1", + "lodash": "^4.17.5", + "source-map": "^0.5.0", + "trim-right": "^1.0.1" + }, + "dependencies": { + "jsesc": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.1.tgz", + "integrity": "sha1-5CGiqOINawgZ3yiQj3glJrlt0f4=", + "dev": true + } + } + }, + "@babel/helper-function-name": { + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.51.tgz", + "integrity": "sha1-IbSHSiJ8+Z7K/MMKkDAtpaJkBWE=", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "7.0.0-beta.51", + "@babel/template": "7.0.0-beta.51", + "@babel/types": "7.0.0-beta.51" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.51.tgz", + "integrity": "sha1-MoGy0EWvlcFyzpGyCCXYXqRnZBE=", + "dev": true, + "requires": { + "@babel/types": "7.0.0-beta.51" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.51.tgz", + "integrity": "sha1-imw/ZsTSZTUvwHdIT59ugKUauXg=", + "dev": true, + "requires": { + "@babel/types": "7.0.0-beta.51" + } + }, + "@babel/highlight": { + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0-beta.51.tgz", + "integrity": "sha1-6IRK4loVlcz9QriWI7Q3bKBtIl0=", + "dev": true, + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^3.0.0" + } + }, + "@babel/parser": { + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.0.0-beta.51.tgz", + "integrity": "sha1-J87C30Cd9gr1gnDtj2qlVAnqhvY=", + "dev": true + }, + "@babel/template": { + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.0.0-beta.51.tgz", + "integrity": "sha1-lgKkCuvPNXrpZ34lMu9fyBD1+/8=", + "dev": true, + "requires": { + "@babel/code-frame": "7.0.0-beta.51", + "@babel/parser": "7.0.0-beta.51", + "@babel/types": "7.0.0-beta.51", + "lodash": "^4.17.5" + } + }, + "@babel/traverse": { + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.0.0-beta.51.tgz", + "integrity": "sha1-mB2vLOw0emIx06odnhgDsDqqpKg=", + "dev": true, + "requires": { + "@babel/code-frame": "7.0.0-beta.51", + "@babel/generator": "7.0.0-beta.51", + "@babel/helper-function-name": "7.0.0-beta.51", + "@babel/helper-split-export-declaration": "7.0.0-beta.51", + "@babel/parser": "7.0.0-beta.51", + "@babel/types": "7.0.0-beta.51", + "debug": "^3.1.0", + "globals": "^11.1.0", + "invariant": "^2.2.0", + "lodash": "^4.17.5" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "globals": { + "version": "11.7.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.7.0.tgz", + "integrity": "sha512-K8BNSPySfeShBQXsahYB/AbbWruVOTyVpgoIDnl8odPpeSfP2J5QO2oLFFdl2j7GfDCtZj2bMKar2T49itTPCg==", + "dev": true + } + } + }, + "@babel/types": { + "version": "7.0.0-beta.51", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.0.0-beta.51.tgz", + "integrity": "sha1-2AK3tUO1g2x3iqaReXq/APPZfqk=", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.5", + "to-fast-properties": "^2.0.0" + }, + "dependencies": { + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "dev": true + } + } + }, "@ngrx/effects": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/@ngrx/effects/-/effects-6.1.0.tgz", @@ -578,9 +720,9 @@ "dev": true }, "@types/selenium-webdriver": { - "version": "2.53.43", - "resolved": "https://registry.npmjs.org/@types/selenium-webdriver/-/selenium-webdriver-2.53.43.tgz", - "integrity": "sha512-UBYHWph6P3tutkbXpW6XYg9ZPbTKjw/YC2hGG1/GEvWwTbvezBUv3h+mmUFw79T3RFPnmedpiXdOBbXX+4l0jg==", + "version": "3.0.10", + "resolved": "https://registry.npmjs.org/@types/selenium-webdriver/-/selenium-webdriver-3.0.10.tgz", + "integrity": "sha512-ikB0JHv6vCR1KYUQAzTO4gi/lXLElT4Tx+6De2pc/OZwizE9LRNiTa+U8TBFKBD/nntPnr/MPSHSnOTybjhqNA==", "dev": true }, "@webassemblyjs/ast": { @@ -828,9 +970,9 @@ } }, "adm-zip": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.4.tgz", - "integrity": "sha1-ph7VrmkFw66lizplfSUDMJEFJzY=", + "version": "0.4.11", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.11.tgz", + "integrity": "sha512-L8vcjDTCOIJk7wFvmlEUN7AsSb8T+2JrdP7KINBjzr24TJ5Mwj590sLu3BC7zNZowvJWa/JtPmD8eJCzdtDWjA==", "dev": true }, "after": { @@ -1704,6 +1846,15 @@ "electron-to-chromium": "^1.3.47" } }, + "browserstack": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/browserstack/-/browserstack-1.5.1.tgz", + "integrity": "sha512-O8VMT64P9NOLhuIoD4YngyxBURefaSdR4QdhG8l6HZ9VxtU7jc3m6jLufFwKA5gaf7fetfB2TnRJnMxyob+heg==", + "dev": true, + "requires": { + "https-proxy-agent": "^2.2.1" + } + }, "buffer": { "version": "4.9.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", @@ -2133,9 +2284,9 @@ "dev": true }, "compare-versions": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-3.3.0.tgz", - "integrity": "sha512-MAAAIOdi2s4Gl6rZ76PNcUa9IOYB+5ICdT41o5uMRf09aEu/F9RK+qhe8RjXNPwcTjGV7KU7h2P/fljThFVqyQ==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-3.3.1.tgz", + "integrity": "sha512-GkIcfJ9sDt4+gS+RWH3X+kR7ezuKdu3fg2oA9nRA8HZoqZwAKv3ml3TyfB9OyV2iFXxCw7q5XfV6SyPbSCT2pw==", "dev": true }, "component-bind": { @@ -5826,9 +5977,9 @@ } }, "istanbul-api": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/istanbul-api/-/istanbul-api-1.3.1.tgz", - "integrity": "sha512-duj6AlLcsWNwUpfyfHt0nWIeRiZpuShnP40YTxOGQgtaN8fd6JYSxsvxUphTDy8V5MfDXo4s/xVCIIvVCO808g==", + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/istanbul-api/-/istanbul-api-1.3.6.tgz", + "integrity": "sha512-luJDnB1uJ5Qsg/WwusGfNXayQ4598yDgW5S0nUS85T576m1LVJzSqLrCDULkT6sTQXVKHa54093gNuCKumMCjQ==", "dev": true, "requires": { "async": "^2.1.4", @@ -5836,10 +5987,10 @@ "fileset": "^2.0.2", "istanbul-lib-coverage": "^1.2.0", "istanbul-lib-hook": "^1.2.0", - "istanbul-lib-instrument": "^1.10.1", + "istanbul-lib-instrument": "^2.1.0", "istanbul-lib-report": "^1.1.4", - "istanbul-lib-source-maps": "^1.2.4", - "istanbul-reports": "^1.3.0", + "istanbul-lib-source-maps": "^1.2.5", + "istanbul-reports": "^1.4.1", "js-yaml": "^3.7.0", "mkdirp": "^0.5.1", "once": "^1.4.0" @@ -5853,6 +6004,29 @@ "requires": { "lodash": "^4.17.10" } + }, + "istanbul-lib-instrument": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-2.3.2.tgz", + "integrity": "sha512-l7TD/VnBsIB2OJvSyxaLW/ab1+92dxZNH9wLH7uHPPioy3JZ8tnx2UXUdKmdkgmP2EFPzg64CToUP6dAS3U32Q==", + "dev": true, + "requires": { + "@babel/generator": "7.0.0-beta.51", + "@babel/parser": "7.0.0-beta.51", + "@babel/template": "7.0.0-beta.51", + "@babel/traverse": "7.0.0-beta.51", + "@babel/types": "7.0.0-beta.51", + "istanbul-lib-coverage": "^2.0.1", + "semver": "^5.5.0" + }, + "dependencies": { + "istanbul-lib-coverage": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz", + "integrity": "sha512-nPvSZsVlbG9aLhZYaC3Oi1gT/tpyo3Yt5fNyf6NmcKIayz4VV/txxJFFKAK/gU4dcNn8ehsanBbVHVl0+amOLA==", + "dev": true + } + } } } }, @@ -5975,12 +6149,12 @@ } }, "istanbul-reports": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-1.3.0.tgz", - "integrity": "sha512-y2Z2IMqE1gefWUaVjrBm0mSKvUkaBy9Vqz8iwr/r40Y9hBbIteH5wqHG/9DLTfJ9xUnUT2j7A3+VVJ6EaYBllA==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-1.5.0.tgz", + "integrity": "sha512-HeZG0WHretI9FXBni5wZ9DOgNziqDCEwetxnme5k1Vv5e81uTqcsy3fMH99gXGDGKr1ea87TyGseDMa2h4HEUA==", "dev": true, "requires": { - "handlebars": "^4.0.3" + "handlebars": "^4.0.11" } }, "jasmine": { @@ -6356,9 +6530,9 @@ } }, "karma-coverage-istanbul-reporter": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/karma-coverage-istanbul-reporter/-/karma-coverage-istanbul-reporter-2.0.1.tgz", - "integrity": "sha512-UcgrHkFehI5+ivMouD8NH/UOHiX4oCAtwaANylzPFdcAuD52fnCUuelacq2gh8tZ4ydhU3+xiXofSq7j5Ehygw==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/karma-coverage-istanbul-reporter/-/karma-coverage-istanbul-reporter-2.0.2.tgz", + "integrity": "sha512-IIIrfsfYJKkAyyjRrBx8CZRl2UXi2OSrxKRAA95mkpOMF3Zw5FpjE+v79pWuwu1Keu0pdjcfElmmOuAEjFQshA==", "dev": true, "requires": { "istanbul-api": "^1.3.1", @@ -7977,15 +8151,16 @@ "dev": true }, "protractor": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/protractor/-/protractor-5.3.2.tgz", - "integrity": "sha512-pw4uwwiy5lHZjIguxNpkEwJJa7hVz+bJsvaTI+IbXlfn2qXwzbF8eghW/RmrZwE2sGx82I8etb8lVjQ+JrjejA==", + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/protractor/-/protractor-5.4.0.tgz", + "integrity": "sha512-6TSYqMhUUzxr4/wN0ttSISqPMKvcVRXF4k8jOEpGWD8OioLak4KLgfzHK9FJ49IrjzRrZ+Mx1q2Op8Rk0zEcnQ==", "dev": true, "requires": { "@types/node": "^6.0.46", "@types/q": "^0.0.32", - "@types/selenium-webdriver": "~2.53.39", + "@types/selenium-webdriver": "^3.0.0", "blocking-proxy": "^1.0.0", + "browserstack": "^1.5.1", "chalk": "^1.1.3", "glob": "^7.0.3", "jasmine": "2.8.0", @@ -7995,20 +8170,14 @@ "saucelabs": "^1.5.0", "selenium-webdriver": "3.6.0", "source-map-support": "~0.4.0", - "webdriver-js-extender": "^1.0.0", + "webdriver-js-extender": "2.0.0", "webdriver-manager": "^12.0.6" }, "dependencies": { "@types/node": { - "version": "6.0.114", - "resolved": "https://registry.npmjs.org/@types/node/-/node-6.0.114.tgz", - "integrity": "sha512-5ViC9dwf1VIAtrOFTvOuN04lJgw28eKjuy0Vg2Bd/fSlxKP2feCSkIw04ZgOENL2ywdWrtbkthp1XVLEjJmouw==", - "dev": true - }, - "adm-zip": { - "version": "0.4.11", - "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.11.tgz", - "integrity": "sha512-L8vcjDTCOIJk7wFvmlEUN7AsSb8T+2JrdP7KINBjzr24TJ5Mwj590sLu3BC7zNZowvJWa/JtPmD8eJCzdtDWjA==", + "version": "6.0.116", + "resolved": "https://registry.npmjs.org/@types/node/-/node-6.0.116.tgz", + "integrity": "sha512-vToa8YEeulfyYg1gSOeHjvvIRqrokng62VMSj2hoZrwZNcYrp2h3AWo6KeBVuymIklQUaY5zgVJvVsC4KiiLkQ==", "dev": true }, "ansi-styles": { @@ -10505,50 +10674,13 @@ } }, "webdriver-js-extender": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/webdriver-js-extender/-/webdriver-js-extender-1.0.0.tgz", - "integrity": "sha1-gcUzqeM9W/tZe05j4s2yW1R3dRU=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/webdriver-js-extender/-/webdriver-js-extender-2.0.0.tgz", + "integrity": "sha512-fbyKiVu3azzIc5d4+26YfuPQcFTlgFQV5yQ/0OQj4Ybkl4g1YQuIPskf5v5wqwRJhHJnPHthB6tqCjWHOKLWag==", "dev": true, "requires": { - "@types/selenium-webdriver": "^2.53.35", - "selenium-webdriver": "^2.53.2" - }, - "dependencies": { - "sax": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/sax/-/sax-0.6.1.tgz", - "integrity": "sha1-VjsZx8HeiS4Jv8Ty/DDjwn8JUrk=", - "dev": true - }, - "selenium-webdriver": { - "version": "2.53.3", - "resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-2.53.3.tgz", - "integrity": "sha1-0p/1qVff8aG0ncRXdW5OS/vc4IU=", - "dev": true, - "requires": { - "adm-zip": "0.4.4", - "rimraf": "^2.2.8", - "tmp": "0.0.24", - "ws": "^1.0.1", - "xml2js": "0.4.4" - } - }, - "tmp": { - "version": "0.0.24", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.24.tgz", - "integrity": "sha1-1qXhmNFKmDXMby18PZ4wJCjIzxI=", - "dev": true - }, - "xml2js": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.4.tgz", - "integrity": "sha1-MREBAAMAiuGSQOuhdJe1fHKcVV0=", - "dev": true, - "requires": { - "sax": "0.6.x", - "xmlbuilder": ">=1.0.0" - } - } + "@types/selenium-webdriver": "^3.0.0", + "selenium-webdriver": "^3.0.1" } }, "webpack": { diff --git a/package.json b/package.json index 216971af..e69922e8 100644 --- a/package.json +++ b/package.json @@ -77,10 +77,10 @@ "jasmine-spec-reporter": "4.2.1", "karma": "1.7.1", "karma-chrome-launcher": "2.2.0", - "karma-coverage-istanbul-reporter": "2.0.1", + "karma-coverage-istanbul-reporter": "2.0.2", "karma-jasmine": "1.1.2", "karma-jasmine-html-reporter": "0.2.2", - "protractor": "5.3.2", + "protractor": "5.4.0", "ts-node": "5.0.1", "tslint": "5.9.1", "typescript": "2.7.2", From 0b2af161f406d6778c24076bbb26cf96b28b4e3c Mon Sep 17 00:00:00 2001 From: Sercan Yemen Date: Tue, 28 Aug 2018 08:07:17 +0300 Subject: [PATCH 18/19] (MailNgrx) Fixed depreciated ngrx/rxjs stuff --- .../contacts/sidebars/main/main.component.ts | 2 +- .../mail-ngrx/store/effects/mails.effects.ts | 32 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/app/main/apps/contacts/sidebars/main/main.component.ts b/src/app/main/apps/contacts/sidebars/main/main.component.ts index d9b69540..3ce6db1e 100644 --- a/src/app/main/apps/contacts/sidebars/main/main.component.ts +++ b/src/app/main/apps/contacts/sidebars/main/main.component.ts @@ -51,7 +51,7 @@ export class ContactsMainSidebarComponent implements OnInit, OnDestroy /** * On destroy */ - ngOnDestroy() + ngOnDestroy(): void { // Unsubscribe from all subscriptions this._unsubscribeAll.next(); diff --git a/src/app/main/apps/mail-ngrx/store/effects/mails.effects.ts b/src/app/main/apps/mail-ngrx/store/effects/mails.effects.ts index e062e17f..3e3cddf1 100644 --- a/src/app/main/apps/mail-ngrx/store/effects/mails.effects.ts +++ b/src/app/main/apps/mail-ngrx/store/effects/mails.effects.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { Action, Store } from '@ngrx/store'; +import { Action, select, Store } from '@ngrx/store'; import { Actions, Effect, ofType } from '@ngrx/effects'; import { Observable, of, forkJoin } from 'rxjs'; @@ -24,12 +24,14 @@ export class MailsEffect private store: Store ) { - this.store.select(getRouterState).subscribe(routerState => { - if ( routerState ) - { - this.routerState = routerState.state; - } - }); + this.store + .pipe(select(getRouterState)) + .subscribe(routerState => { + if ( routerState ) + { + this.routerState = routerState.state; + } + }); } /** @@ -101,11 +103,9 @@ export class MailsEffect .pipe( ofType(MailsActions.UPDATE_MAILS), exhaustMap((action) => { - return forkJoin( - action.payload.map(mail => this.mailService.updateMail(mail)), - () => { - return new MailsActions.UpdateMailsSuccess(); - }); + return forkJoin(action.payload.map(mail => this.mailService.updateMail(mail))).pipe(map(() => { + return new MailsActions.UpdateMailsSuccess(); + })); }) ); @@ -118,7 +118,7 @@ export class MailsEffect this.actions .pipe( ofType(MailsActions.SET_CURRENT_MAIL), - withLatestFrom(this.store.select(getMailsState)), + withLatestFrom(this.store.pipe(select(getMailsState))), map(([action, state]) => { return new MailsActions.SetCurrentMailSuccess(state.entities[action.payload]); }) @@ -135,7 +135,7 @@ export class MailsEffect this.actions .pipe( ofType(MailsActions.CHECK_CURRENT_MAIL), - withLatestFrom(this.store.select(getMailsState)), + withLatestFrom(this.store.pipe(select(getMailsState))), map(([action, state]) => { if ( !state.entities[this.routerState.params.mailId] ) @@ -200,7 +200,7 @@ export class MailsEffect .pipe( ofType(MailsActions.SET_FOLDER_ON_SELECTED_MAILS), withLatestFrom( - this.store.select(getMailsState)), + this.store.pipe(select(getMailsState))), map(([action, state]) => { const entities = {...state.entities}; let mailsToUpdate = []; @@ -227,7 +227,7 @@ export class MailsEffect this.actions .pipe( ofType(MailsActions.ADD_LABEL_ON_SELECTED_MAILS), - withLatestFrom(this.store.select(getMailsState)), + withLatestFrom(this.store.pipe(select(getMailsState))), map(([action, state]) => { const entities = {...state.entities}; From a5b6e545a7c08963b32125bd25b1159f19f962b9 Mon Sep 17 00:00:00 2001 From: Sercan Yemen Date: Tue, 28 Aug 2018 08:07:28 +0300 Subject: [PATCH 19/19] Added return types --- e2e/src/app.po.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/src/app.po.ts b/e2e/src/app.po.ts index 8327f3c3..99860d83 100644 --- a/e2e/src/app.po.ts +++ b/e2e/src/app.po.ts @@ -1,11 +1,11 @@ import { browser, by, element } from 'protractor'; export class Fuse2Page { - navigateTo() { + navigateTo(): any { return browser.get('/'); } - getParagraphText() { + getParagraphText(): any { return element(by.css('app-root h1')).getText(); } }