11import { NgModule , Component , enableProdMode } from '@angular/core' ;
22import { BrowserModule } from '@angular/platform-browser' ;
33import { platformBrowserDynamic } from '@angular/platform-browser-dynamic' ;
4- import { DxCardViewModule } from 'devextreme-angular' ;
5- import { Customer , Service } from './app.service' ;
4+ import { DxCardViewModule , DxCardViewTypes } from 'devextreme-angular/ui/card-view ' ;
5+ import { Order , Service } from './app.service' ;
66
77if ( ! / l o c a l h o s t / . test ( document . location . host ) ) {
88 enableProdMode ( ) ;
@@ -14,18 +14,94 @@ if (window && window.config?.packageConfigPaths) {
1414 modulePrefix = '/app' ;
1515}
1616
17+ function getDeliveryHours ( rowData ) {
18+ return ( new Date ( rowData . DeliveryDate ) ) . getHours ( ) ;
19+ }
20+
1721@Component ( {
1822 selector : 'demo-app' ,
1923 templateUrl : `.${ modulePrefix } /app.component.html` ,
2024 providers : [ Service ] ,
2125} )
2226export class AppComponent {
23- customers : Customer [ ] ;
27+ // TODO: make nested
28+ headerFilterConfig = {
29+ visible : true
30+ } ;
31+
32+ // TODO: make nested
33+ filterPanelConfig = {
34+ visible : true
35+ } ;
36+
37+ filterValue = [ [ 'Employee' , '=' , 'Clark Morgan' ] , 'and' , [ 'DeliveryDate' , 'beforeNoon' ] ] ;
38+
39+ // TODO: make nested
40+ filterBuilderConfig = {
41+ customOperations : [ {
42+ name : 'beforeNoon' ,
43+ caption : 'Before noon' ,
44+ dataTypes : [ 'datetime' ] ,
45+ icon : 'check' ,
46+ hasValue : false ,
47+ calculateFilterExpression ( ) {
48+ return [ getDeliveryHours , '<' , 12 ] ;
49+ } ,
50+ } , {
51+ name : 'afterNoon' ,
52+ caption : 'After noon' ,
53+ dataTypes : [ 'datetime' ] ,
54+ icon : 'check' ,
55+ hasValue : false ,
56+ calculateFilterExpression ( ) {
57+ return [ getDeliveryHours , '>=' , 12 ] ;
58+ } ,
59+ } ] ,
60+ } ;
61+
62+
63+ // TODO: make nested
64+ saleAmountHeaderFilterConfig = {
65+ dataSource : [
66+ {
67+ text : 'Less than $3000' ,
68+ value : [ 'SaleAmount' , '<' , 3000 ] ,
69+ } ,
70+ {
71+ text : '$3000 - $5000' ,
72+ value : [
73+ [ 'SaleAmount' , '>=' , 3000 ] ,
74+ [ 'SaleAmount' , '<' , 5000 ] ,
75+ ] ,
76+ } ,
77+ {
78+ text : '$5000 - $10000' ,
79+ value : [
80+ [ 'SaleAmount' , '>=' , 5000 ] ,
81+ [ 'SaleAmount' , '<' , 10000 ] ,
82+ ] ,
83+ } ,
84+ {
85+ text : '$10000 - $20000' ,
86+ value : [
87+ [ 'SaleAmount' , '>=' , 10000 ] ,
88+ [ 'SaleAmount' , '<' , 20000 ] ,
89+ ] ,
90+ } ,
91+ {
92+ text : 'Greater than $20000' ,
93+ value : [ 'SaleAmount' , '>=' , 20000 ] ,
94+ } ,
95+ ] ,
96+ } ;
97+
98+ // TODO: make nested
99+ orderNumberHeaderFilterConfig = { groupInterval : 10000 } ;
24100
25- columns = [ 'CompanyName' , 'City' , 'State' , 'Phone' , 'Fax' ] ;
101+ orders : Order [ ] ;
26102
27103 constructor ( service : Service ) {
28- this . customers = service . getCustomers ( ) ;
104+ this . orders = service . getOrders ( ) ;
29105 }
30106}
31107
0 commit comments