Skip to content

Commit e1d9253

Browse files
committed
feat(igx-combo): add empty combo sample #1260
1 parent 42df9e7 commit e1d9253

9 files changed

+153
-0
lines changed

demos/app/app.component.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ export class AppComponent implements OnInit {
6060
icon: "view_carousel",
6161
name: "Carousel"
6262
},
63+
{
64+
link: "/combo",
65+
icon: "arrow_drop_down_circle",
66+
name: "Combo"
67+
},
6368
{
6469
link: "/datePicker",
6570
icon: "date_range",

demos/app/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { ButtonGroupSampleModule } from "./buttonGroup/sample.module";
1616
import { IgxCalendarSampleModule } from "./calendar/sample.module";
1717
import { IgxCardSampleModule } from "./card/sample.module";
1818
import { CarouselSampleModule } from "./carousel/sample.module";
19+
import { ComboSampleModule } from "./combo/sample.module";
1920
import { IgxDatePickerSampleModule } from "./date-picker/sample.module";
2021
import { DialogSampleModule } from "./dialog/sample.module";
2122
import { MaskSampleModule } from "./directives/mask/sample.module";
@@ -66,6 +67,7 @@ import { VirtualForSampleModule } from "./virtual-for-directive/sample.module";
6667
IgxAvatarModule,
6768
InputSampleModule,
6869
CarouselSampleModule,
70+
ComboSampleModule,
6971
TabBarSampleModule,
7072
TabsSampleModule,
7173
ListSampleModule,

demos/app/app.routing.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { ButtonGroupSampleComponent } from "./buttonGroup/sample.component";
88
import { IgxCalendarSampleComponent } from "./calendar/sample.component";
99
import { IgxCardSampleComponent } from "./card/sample.component";
1010
import { CarouselSampleComponent } from "./carousel/sample.component";
11+
import { ComboSampleComponent } from "./combo/sample.component";
1112
import { IgxDatePickerSampleComponent } from "./date-picker/sample.component";
1213
import { DialogSampleComponent } from "./dialog/sample.component";
1314
import { MaskSampleComponent } from "./directives/mask/sample.component";
@@ -63,6 +64,10 @@ const appRoutes: Routes = [
6364
component: CarouselSampleComponent,
6465
path: "carousel"
6566
},
67+
{
68+
component: ComboSampleComponent,
69+
path: "combo"
70+
},
6671
{
6772
component: TabBarSampleComponent,
6873
path: "tabbar"

demos/app/combo/sample.component.css

Whitespace-only changes.

demos/app/combo/sample.component.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<div class="sample-wrapper">
2+
<page-header title="Combo" description="Combo lets you choose value from a list"></page-header>
3+
<section class="sample-content">
4+
<igx-combo data="items"></igx-combo>
5+
</section>
6+
</div>

demos/app/combo/sample.component.ts

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
import { Component, OnInit, ViewChild } from "@angular/core";
2+
import { IgxComboComponent } from "../../lib/main";
3+
@Component({
4+
// tslint:disable-next-line:component-selector
5+
selector: "combo-sample",
6+
templateUrl: "./sample.component.html",
7+
styleUrls: ["sample.component.css"]
8+
})
9+
export class ComboSampleComponent implements OnInit {
10+
private width = "160px";
11+
@ViewChild(IgxComboComponent) public igxCombo: IgxComboComponent;
12+
13+
items: any[] = [];
14+
15+
ngOnInit() {
16+
17+
}
18+
19+
constructor() {
20+
const states = [
21+
"New England",
22+
"Connecticut",
23+
"Maine",
24+
"Massachusetts",
25+
"New Hampshire",
26+
"Rhode Island",
27+
"Vermont",
28+
"Mid-Atlantic",
29+
"New Jersey",
30+
"New York",
31+
"Pennsylvania",
32+
"East North Central",
33+
"Illinois",
34+
"Indiana",
35+
"Michigan",
36+
"Ohio",
37+
"Wisconsin",
38+
"West North Central",
39+
"Iowa",
40+
"Kansas",
41+
"Minnesota",
42+
"Missouri",
43+
"Nebraska",
44+
"North Dakota",
45+
"South Dakota",
46+
"South Atlantic",
47+
"Delaware",
48+
"Florida",
49+
"Georgia",
50+
"Maryland",
51+
"North Carolina",
52+
"South Carolina",
53+
"Virginia",
54+
"District of Columbia",
55+
"West Virginia",
56+
"East South Central",
57+
"Alabama",
58+
"Kentucky",
59+
"Mississippi",
60+
"Tennessee",
61+
"West South Central",
62+
"Arkansas",
63+
"Louisiana",
64+
"Oklahoma",
65+
"Texas",
66+
"Mountain",
67+
"Arizona",
68+
"Colorado",
69+
"Idaho",
70+
"Montana",
71+
"Nevada",
72+
"New Mexico",
73+
"Utah",
74+
"Wyoming",
75+
"Pacific",
76+
"Alaska",
77+
"California",
78+
"Hawaii",
79+
"Oregon",
80+
"Washington"];
81+
82+
const areas = [
83+
"New England",
84+
"Mid-Atlantic",
85+
"East North Central",
86+
"West North Central",
87+
"South Atlantic",
88+
"East South Central",
89+
"West South Central",
90+
"Mountain",
91+
"Pacific"
92+
];
93+
94+
for (let i = 0; i < states.length; i += 1) {
95+
const item = { field: states[i] };
96+
if (areas.indexOf(states[i]) !== -1) {
97+
item["header"] = true;
98+
} else if (i % 7 === 4 || i > 49) {
99+
item["disabled"] = true;
100+
}
101+
this.items.push(item);
102+
}
103+
}
104+
105+
onSelection(ev) {
106+
}
107+
}

demos/app/combo/sample.module.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { CommonModule } from "@angular/common";
2+
import { NgModule } from "@angular/core";
3+
4+
import { IgxComboModule } from "../../lib/main";
5+
import { PageHeaderModule } from "../pageHeading/pageHeading.module";
6+
import { ComboSampleComponent } from "./sample.component";
7+
8+
@NgModule({
9+
declarations: [ComboSampleComponent],
10+
imports: [CommonModule, PageHeaderModule, IgxComboModule]
11+
})
12+
export class ComboSampleModule { }

src/combo/combo.component.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { async, ComponentFixture, TestBed } from "@angular/core/testing";
2+
import { IgxComboComponent, IgxComboModule } from "./combo.component";
3+
4+
describe("Combo", () => {
5+
beforeEach(async(() => {
6+
TestBed.configureTestingModule({
7+
declarations: [/*BasicComboComponent*/],
8+
imports: [IgxComboModule]
9+
}).compileComponents();
10+
}));
11+
12+
it("Initialize combo", () => {
13+
14+
});
15+
});

src/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export * from "./calendar";
2626
export * from "./card/card.component";
2727
export * from "./carousel/carousel.component";
2828
export * from "./checkbox/checkbox.component";
29+
export * from "./combo/combo.component";
2930
export * from "./date-picker/date-picker.component";
3031
export * from "./dialog/dialog.component";
3132
export * from "./input-group/input-group.component";

0 commit comments

Comments
 (0)