Skip to content

Commit 16ed1f2

Browse files
Update projects
1 parent bd6342e commit 16ed1f2

37 files changed

+528
-635
lines changed

Angular/src/app/app.component.html

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1-
<div class="default-style">
2-
<dx-button [text]="buttonText" (onClick)="onClick($event)"></dx-button>
1+
<div id="container">
2+
<dx-lookup
3+
[dataSource]="dataSource"
4+
valueExpr="ID"
5+
displayExpr="Subject"
6+
searchMode="contains"
7+
[searchExpr]="['Assignee', 'Subject']"
8+
[minSearchLength]="2"
9+
[showDataBeforeSearch]="true"
10+
(onValueChanged)="onValueChanged($event)"
11+
[grouped]="true"
12+
groupTemplate="listGroup"
13+
pageLoadMode="nextButton"
14+
nextButtonText="More"
15+
itemTemplate="listItem"
16+
>
17+
<dxo-drop-down-options [hideOnOutsideClick]="true" [showTitle]="false">
18+
</dxo-drop-down-options>
19+
<div *dxTemplate="let data of 'listGroup'">
20+
{{ data.key + " (" + data.items.length + " tasks)" }}
21+
</div>
22+
<div *dxTemplate="let itemData of 'listItem'">
23+
{{
24+
itemData.disabled
25+
? "\u274C " + itemData.Subject
26+
: "\u2705 " + itemData.Subject
27+
}}
28+
</div>
29+
</dx-lookup>
330
</div>

Angular/src/app/app.component.scss

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
.default-style {
2-
margin: 50px;
3-
width: 90vw;
1+
#container {
2+
width: 500px;
3+
height: 500px;
4+
padding-top: 5px;
45
}

Angular/src/app/app.component.ts

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
11
import { Component } from '@angular/core';
2-
import { ClickEvent } from 'devextreme/ui/button';
2+
import notify from 'devextreme/ui/notify';
3+
import DataSource from 'devextreme/data/data_source';
4+
import { DxLookupTypes } from 'devextreme-angular/ui/lookup';
5+
import { Task } from './app.types';
6+
import { AppService } from './app.service';
37

48
@Component({
59
selector: 'app-root',
610
templateUrl: './app.component.html',
711
styleUrls: ['./app.component.scss'],
12+
providers: [AppService],
813
})
914
export class AppComponent {
10-
title = 'Angular';
15+
employeesTasks: Task[];
1116

12-
counter = 0;
17+
dataSource: DataSource;
1318

14-
buttonText = 'Click count: 0';
19+
constructor(private readonly appService: AppService) {
20+
this.employeesTasks = this.appService.getTasks();
21+
this.dataSource = new DataSource({
22+
store: this.employeesTasks,
23+
key: 'ID',
24+
group: 'Assignee',
25+
paginate: true,
26+
pageSize: 2,
27+
});
28+
}
1529

16-
onClick(e: ClickEvent): void {
17-
this.counter++;
18-
this.buttonText = `Click count: ${this.counter}`;
30+
onValueChanged(e: DxLookupTypes.ValueChangedEvent): void {
31+
notify(`Previous: ${e.previousValue}, Current: ${e.value}`, 'info', 2000);
1932
}
2033
}

Angular/src/app/app.module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { NgModule } from '@angular/core';
22
import { BrowserModule } from '@angular/platform-browser';
3-
import { DxButtonModule } from 'devextreme-angular/ui/button';
3+
import { DxLookupModule } from 'devextreme-angular/ui/lookup';
44
import { AppRoutingModule } from './app-routing.module';
55
import { AppComponent } from './app.component';
66

@@ -11,7 +11,7 @@ import { AppComponent } from './app.component';
1111
imports: [
1212
BrowserModule,
1313
AppRoutingModule,
14-
DxButtonModule,
14+
DxLookupModule,
1515
],
1616
providers: [],
1717
bootstrap: [AppComponent],

Angular/src/app/app.service.ts

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import { Injectable } from '@angular/core';
2+
import { Task } from './app.types';
3+
4+
const employeesTasks: Task[] = [
5+
{
6+
ID: 1,
7+
Assignee: 'Mr. John Heart',
8+
Subject: 'Choose between PPO and HMO Health Plan',
9+
disabled: true,
10+
}, {
11+
ID: 2,
12+
Assignee: 'Mr. John Heart',
13+
Subject: 'Google AdWords Strategy',
14+
}, {
15+
ID: 3,
16+
Assignee: 'Mr. John Heart',
17+
Subject: 'New Brochures',
18+
}, {
19+
ID: 4,
20+
Assignee: 'Mr. John Heart',
21+
Subject: 'Update NDA Agreement',
22+
}, {
23+
ID: 5,
24+
Assignee: 'Mr. John Heart',
25+
Subject: 'Review Product Recall Report by Engineering Team',
26+
}, {
27+
ID: 6,
28+
Assignee: 'Mrs. Olivia Peyton',
29+
Subject: 'Update Personnel Files',
30+
}, {
31+
ID: 7,
32+
Assignee: 'Mrs. Olivia Peyton',
33+
Subject: 'Review Health Insurance Options Under the Affordable Care Act',
34+
}, {
35+
ID: 8,
36+
Assignee: 'Mrs. Olivia Peyton',
37+
Subject: 'Non-Compete Agreements',
38+
}, {
39+
ID: 9,
40+
Assignee: 'Mrs. Olivia Peyton',
41+
Subject: 'Give Final Approval for Refunds',
42+
}, {
43+
ID: 10,
44+
Assignee: 'Mr. Robert Reagan',
45+
Subject: 'Deliver R&D Plans for 2013',
46+
}, {
47+
ID: 11,
48+
Assignee: 'Mr. Robert Reagan',
49+
Subject: 'Decide on Mobile Devices to Use in the Field',
50+
}, {
51+
ID: 12,
52+
Assignee: 'Mr. Robert Reagan',
53+
Subject: 'Try New Touch-Enabled WinForms Apps',
54+
}, {
55+
ID: 13,
56+
Assignee: 'Mr. Robert Reagan',
57+
Subject: 'Approval on Converting to New HDMI Specification',
58+
}, {
59+
ID: 14,
60+
Assignee: 'Ms. Greta Sims',
61+
Subject: 'Approve Hiring of John Jeffers',
62+
}, {
63+
ID: 15,
64+
Assignee: 'Ms. Greta Sims',
65+
Subject: 'Update Employee Files with New NDA',
66+
}, {
67+
ID: 16,
68+
Assignee: 'Ms. Greta Sims',
69+
Subject: 'Provide New Health Insurance Docs',
70+
},
71+
];
72+
73+
@Injectable()
74+
export class AppService {
75+
getTasks(): Task[] {
76+
return employeesTasks;
77+
}
78+
}

Angular/src/app/app.types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export interface Task {
2+
ID: number;
3+
Assignee: string;
4+
Subject: string;
5+
disabled?: boolean;
6+
}

Angular/src/app/orig_app.component.css

Lines changed: 0 additions & 5 deletions
This file was deleted.

Angular/src/app/orig_app.component.html

Lines changed: 0 additions & 29 deletions
This file was deleted.

Angular/src/app/orig_app.component.ts

Lines changed: 0 additions & 31 deletions
This file was deleted.

Angular/src/app/orig_app.service.ts

Lines changed: 0 additions & 84 deletions
This file was deleted.

0 commit comments

Comments
 (0)