From b9dc0d3dedfae81992d91290f55d819a59c91762 Mon Sep 17 00:00:00 2001 From: blackbaud-brandonhare Date: Thu, 8 Feb 2018 13:56:07 -0500 Subject: [PATCH 1/3] Tweaked provider demo to be injectable. --- .../list/list-provider-demo.component.ts | 49 ++++++++++++------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/src/demos/list/list-provider-demo.component.ts b/src/demos/list/list-provider-demo.component.ts index 321c1be06..4503a6291 100644 --- a/src/demos/list/list-provider-demo.component.ts +++ b/src/demos/list/list-provider-demo.component.ts @@ -1,17 +1,13 @@ -import { Component } from '@angular/core'; +import { Component, Injectable } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import { BehaviorSubject } from 'rxjs/BehaviorSubject'; import 'rxjs/add/observable/of'; import 'rxjs/add/operator/map'; -import { - ListDataProvider, - ListDataRequestModel, - ListDataResponseModel, - ListItemModel -} from '../../core'; +import { ListDataProvider, ListDataRequestModel, ListDataResponseModel, ListItemModel } from '../../core'; +@Injectable() export class DemoListProvider extends ListDataProvider { public items: Observable; public remoteCount: BehaviorSubject = new BehaviorSubject(0); @@ -23,43 +19,57 @@ export class DemoListProvider extends ListDataProvider { { id: '1', data: { - column1: 101, column2: 'Apple', column3: 'Anne eats apples' + column1: 101, + column2: 'Apple', + column3: 'Anne eats apples' } }, { id: '2', data: { - column1: 202, column2: 'Banana', column3: 'Ben eats bananas' + column1: 202, + column2: 'Banana', + column3: 'Ben eats bananas' } }, { id: '3', data: { - column1: 303, column2: 'Pear', column3: 'Patty eats pears' + column1: 303, + column2: 'Pear', + column3: 'Patty eats pears' } }, { id: '4', data: { - column1: 404, column2: 'Grape', column3: 'George eats grapes' + column1: 404, + column2: 'Grape', + column3: 'George eats grapes' } }, { id: '5', data: { - column1: 505, column2: 'Banana', column3: 'Becky eats bananas' + column1: 505, + column2: 'Banana', + column3: 'Becky eats bananas' } }, { id: '6', data: { - column1: 606, column2: 'Lemon', column3: 'Larry eats lemons' + column1: 606, + column2: 'Lemon', + column3: 'Larry eats lemons' } }, { id: '7', data: { - column1: 707, column2: 'Strawberry', column3: 'Sally eats strawberries' + column1: 707, + column2: 'Strawberry', + column3: 'Sally eats strawberries' } } ]); @@ -85,8 +95,10 @@ export class DemoListProvider extends ListDataProvider { let searchText = request.search.searchText.toLowerCase(); searchedList = items.filter((item) => { - return item.data.column2.toLowerCase().indexOf(searchText) > -1 || - item.data.column3.toLowerCase().indexOf(searchText) > -1; + return ( + item.data.column2.toLowerCase().indexOf(searchText) > -1 || + item.data.column3.toLowerCase().indexOf(searchText) > -1 + ); }); } @@ -105,8 +117,9 @@ export class DemoListProvider extends ListDataProvider { @Component({ selector: 'sky-list-provider-demo', - templateUrl: './list-provider-demo.component.html' + templateUrl: './list-provider-demo.component.html', + providers: [DemoListProvider] }) export class SkyListProviderDemoComponent { - public listDataProvider: DemoListProvider = new DemoListProvider(); + constructor(public listDataProvider: DemoListProvider) {} } From 0225e8fb7a269f3d66de88673a5f0fe3e84c055d Mon Sep 17 00:00:00 2001 From: blackbaud-brandonhare Date: Thu, 8 Feb 2018 14:00:25 -0500 Subject: [PATCH 2/3] Fixed formatting. --- .../list/list-provider-demo.component.ts | 35 +++++++------------ 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/src/demos/list/list-provider-demo.component.ts b/src/demos/list/list-provider-demo.component.ts index 4503a6291..7bcb07bc9 100644 --- a/src/demos/list/list-provider-demo.component.ts +++ b/src/demos/list/list-provider-demo.component.ts @@ -5,7 +5,12 @@ import { BehaviorSubject } from 'rxjs/BehaviorSubject'; import 'rxjs/add/observable/of'; import 'rxjs/add/operator/map'; -import { ListDataProvider, ListDataRequestModel, ListDataResponseModel, ListItemModel } from '../../core'; +import { + ListDataProvider, + ListDataRequestModel, + ListDataResponseModel, + ListItemModel +} from '../../core'; @Injectable() export class DemoListProvider extends ListDataProvider { @@ -19,57 +24,43 @@ export class DemoListProvider extends ListDataProvider { { id: '1', data: { - column1: 101, - column2: 'Apple', - column3: 'Anne eats apples' + column1: 101, column2: 'Apple', column3: 'Anne eats apples' } }, { id: '2', data: { - column1: 202, - column2: 'Banana', - column3: 'Ben eats bananas' + column1: 202, column2: 'Banana', column3: 'Ben eats bananas' } }, { id: '3', data: { - column1: 303, - column2: 'Pear', - column3: 'Patty eats pears' + column1: 303, column2: 'Pear', column3: 'Patty eats pears' } }, { id: '4', data: { - column1: 404, - column2: 'Grape', - column3: 'George eats grapes' + column1: 404, column2: 'Grape', column3: 'George eats grapes' } }, { id: '5', data: { - column1: 505, - column2: 'Banana', - column3: 'Becky eats bananas' + column1: 505, column2: 'Banana', column3: 'Becky eats bananas' } }, { id: '6', data: { - column1: 606, - column2: 'Lemon', - column3: 'Larry eats lemons' + column1: 606, column2: 'Lemon', column3: 'Larry eats lemons' } }, { id: '7', data: { - column1: 707, - column2: 'Strawberry', - column3: 'Sally eats strawberries' + column1: 707, column2: 'Strawberry', column3: 'Sally eats strawberries' } } ]); From ac2b447ab9f327dac58eb4a479ee7c83280fa613 Mon Sep 17 00:00:00 2001 From: Blackbaud-SteveBrush Date: Thu, 15 Feb 2018 11:31:47 -0500 Subject: [PATCH 3/3] Minor formatting adjustments --- src/demos/list/list-provider-demo.component.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/demos/list/list-provider-demo.component.ts b/src/demos/list/list-provider-demo.component.ts index 7bcb07bc9..e65028f2b 100644 --- a/src/demos/list/list-provider-demo.component.ts +++ b/src/demos/list/list-provider-demo.component.ts @@ -1,8 +1,11 @@ -import { Component, Injectable } from '@angular/core'; +import { + Component, + Injectable +} from '@angular/core'; import { Observable } from 'rxjs/Observable'; -import { BehaviorSubject } from 'rxjs/BehaviorSubject'; import 'rxjs/add/observable/of'; +import { BehaviorSubject } from 'rxjs/BehaviorSubject'; import 'rxjs/add/operator/map'; import { @@ -112,5 +115,7 @@ export class DemoListProvider extends ListDataProvider { providers: [DemoListProvider] }) export class SkyListProviderDemoComponent { - constructor(public listDataProvider: DemoListProvider) {} + constructor( + public listDataProvider: DemoListProvider + ) { } }