-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'vNext' into mvenkov/add-row-selector-template-samples
- Loading branch information
Showing
8 changed files
with
181 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
export interface ICity { | ||
name: string; | ||
id: string; | ||
country: string; | ||
} | ||
|
||
export const CITIES: ICity[] = [ | ||
{ | ||
name: "Sofia", | ||
id: "BG01", | ||
country: "Bulgaria" | ||
}, { | ||
name: "Plovdiv", | ||
id: "BG02" | ||
, | ||
country: "Bulgaria" | ||
}, { | ||
name: "Varna", | ||
id: "BG03", | ||
country: "Bulgaria" | ||
}, { | ||
name: "Burgas", | ||
id: "BG04", | ||
country: "Bulgaria" | ||
}, { | ||
name: "London", | ||
id: "UK01", | ||
country: "United Kingdom" | ||
}, { | ||
name: "Birmingham", | ||
id: "UK02", | ||
country: "United Kingdom" | ||
}, { | ||
name: "Liverpool", | ||
id: "UK03", | ||
country: "United Kingdom" | ||
}, { | ||
name: "Nottingham", | ||
id: "UK04", | ||
country: "United Kingdom" | ||
}, { | ||
name: "Tokyo", | ||
id: "JP01", | ||
country: "Japan" | ||
}, { | ||
name: "Yokohama", | ||
id: "JP02", | ||
country: "Japan" | ||
}, { | ||
name: "Osaka", | ||
id: "JP03", | ||
country: "Japan" | ||
}, { | ||
name: "Nagoya", | ||
id: "JP04", | ||
country: "Japan" | ||
}, { | ||
name: "Berlin", | ||
id: "DE01", | ||
country: "Germany" | ||
}, { | ||
name: "Hamburg", | ||
id: "DE02", | ||
country: "Germany" | ||
}, { | ||
name: "Munich", | ||
id: "DE03", | ||
country: "Germany" | ||
}, { | ||
name: "Koeln", | ||
id: "DE04", | ||
country: "Germany" | ||
} | ||
]; |
23 changes: 23 additions & 0 deletions
23
src/app/lists/combo/combo-binding/combo-binding.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<div class="combo-section"> | ||
<igx-combo #withValueKey [data]="cities" valueKey="id" displayKey="name" groupKey="country" | ||
[(ngModel)]="selectedValueKey"> | ||
</igx-combo> | ||
<button igxButton (click)="selectFavorites(true)">Select Favorites</button> | ||
<h6>Selected Cities:</h6> | ||
<div>{{ selectedValueKey }}</div> | ||
</div> | ||
<div class="combo-section"> | ||
<igx-combo #noValueKey [data]="cities" displayKey="name" groupKey="country" [(ngModel)]="selectedNoValueKey"> | ||
</igx-combo> | ||
<button igxButton (click)="selectFavorites(false)">Select Favorites</button> | ||
<h6>Selected Cities:</h6> | ||
<div class="cities-container"> | ||
<igx-card type="outlined" *ngFor="let city of selectedNoValueKey"> | ||
<igx-card-header> | ||
<h5 igxCardHeaderTitle>{{ city.name }}</h5> | ||
<h5 igxCardHeaderSubtitle>{{ city.country }}</h5> | ||
{{ city.id }} | ||
</igx-card-header> | ||
</igx-card> | ||
</div> | ||
</div> |
23 changes: 23 additions & 0 deletions
23
src/app/lists/combo/combo-binding/combo-binding.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
:host { | ||
display: flex; | ||
width: 100%; | ||
flex-flow: row wrap; | ||
} | ||
|
||
button { | ||
margin: 8px 0px; | ||
} | ||
|
||
.combo-section { | ||
margin: 24px; | ||
width: 320px; | ||
} | ||
|
||
.cities-container { | ||
max-height: 200px; | ||
overflow-y: auto; | ||
|
||
igx-card { | ||
margin: 8px 8px 8px 0; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/app/lists/combo/combo-binding/combo-binding.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { Component, ViewChild } from "@angular/core"; | ||
import { IComboSelectionChangeEventArgs, IgxComboComponent } from "igniteui-angular"; | ||
import { CITIES, ICity } from "./cities"; | ||
|
||
@Component({ | ||
selector: "app-combo-binding", | ||
templateUrl: "combo-binding.component.html", | ||
styleUrls: ["combo-binding.component.scss"] | ||
}) | ||
export class ComboBindingComponent { | ||
@ViewChild("withValueKey", { read: IgxComboComponent, static: false }) | ||
public comboValueKey: IgxComboComponent; | ||
@ViewChild("noValueKey", { read: IgxComboComponent, static: false }) | ||
public comboNoValueKey: IgxComboComponent; | ||
|
||
public cities: ICity[] = CITIES; | ||
public selectedValueKey: string[] = ["UK01", "BG01"]; | ||
public selectedNoValueKey: ICity[] = [this.cities[4], this.cities[0]]; | ||
|
||
public handleSelectionChange(event: IComboSelectionChangeEventArgs) { | ||
console.log(event); | ||
} | ||
|
||
public selectFavorites(valueKey: boolean) { | ||
if (valueKey) { | ||
this.comboValueKey.selectItems(["UK01", "BG01", "DE01", "JP01"]); | ||
} else { | ||
const selectedItems: ICity[] = this.cities.filter((e: ICity) => { | ||
return ["UK01", "BG01", "DE01", "JP01"].indexOf(e.id) > -1; | ||
}); | ||
this.comboNoValueKey.selectItems(selectedItems); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters