Skip to content

Commit

Permalink
Merge pull request #3223 from IgniteUI/ikitanov/list-2988-vNext
Browse files Browse the repository at this point in the history
Ikitanov/list 2988 v next
  • Loading branch information
zdrawku authored Jan 9, 2023
2 parents 0c888b2 + f2e05b8 commit f733e86
Show file tree
Hide file tree
Showing 12 changed files with 152 additions and 120 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
<div class="list-sample">
<igx-list>
<igx-list-item [isHeader]="true">Contacts</igx-list-item>
<igx-list-item [ngClass]="contact.selected ? 'selected' : ''"
(click)="selectItem(contact)"
*ngFor="let contact of contacts | igxFilter: filterContacts;">
<igx-list-item [ngClass]="contact.selected ? 'selected' : ''" (click)="selectItem(contact)"
*ngFor="let contact of contacts | igxFilter: filterContacts;">
<igx-avatar igxListThumbnail [src]="contact.photo" [roundShape]="true"></igx-avatar>
<span igxListLineTitle>{{ contact.name }}</span>
<span igxListLineSubTitle>{{ contact.phone }}</span>
<igx-icon igxListAction [style.color]="contact.isFavorite ? 'orange' : 'lightgray'" (click)="toggleFavorite(contact, $event)">star</igx-icon>
<igx-icon igxListAction [style.color]="contact.isFavorite ? 'orange' : 'lightgray'" igxRipple="pink"
[igxRippleCentered]="true" (click)="toggleFavorite(contact, $event)"
(mousedown)="mousedown($event)">star</igx-icon>
</igx-list-item>
</igx-list>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

igx-icon {
cursor: pointer;
position: relative;
}

.search {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,67 +2,71 @@ import { Component } from '@angular/core';
import { IgxFilterOptions } from 'igniteui-angular';

@Component({
selector: 'app-list-item-selection',
templateUrl: './list-item-selection.component.html',
styleUrls: ['./list-item-selection.component.scss']
selector: 'app-list-item-selection',
templateUrl: './list-item-selection.component.html',
styleUrls: ['./list-item-selection.component.scss']
})
export class ListItemSelectionComponent {
public searchContact: string;

public contacts = [
{
isFavorite: false,
name: 'Terrance Orta',
phone: '770-504-2217',
photo: 'assets/images/men/27.jpg',
selected: false
},
{
isFavorite: true,
name: 'Richard Mahoney',
phone: '423-676-2869',
photo: 'assets/images/men/1.jpg',
selected: false
},
{
isFavorite: false,
name: 'Donna Price',
phone: '859-496-2817',
photo: 'assets/images/women/50.jpg',
selected: false
},
{
isFavorite: false,
name: 'Lisa Landers',
phone: '901-747-3428',
photo: 'assets/images/women/3.jpg',
selected: false
},
{
isFavorite: true,
name: 'Dorothy H. Spencer',
phone: '573-394-9254',
photo: 'assets/images/women/67.jpg',
selected: false
}
{
isFavorite: false,
name: 'Terrance Orta',
phone: '770-504-2217',
photo: 'assets/images/men/27.jpg',
selected: false
},
{
isFavorite: true,
name: 'Richard Mahoney',
phone: '423-676-2869',
photo: 'assets/images/men/1.jpg',
selected: false
},
{
isFavorite: false,
name: 'Donna Price',
phone: '859-496-2817',
photo: 'assets/images/women/50.jpg',
selected: false
},
{
isFavorite: false,
name: 'Lisa Landers',
phone: '901-747-3428',
photo: 'assets/images/women/3.jpg',
selected: false
},
{
isFavorite: true,
name: 'Dorothy H. Spencer',
phone: '573-394-9254',
photo: 'assets/images/women/67.jpg',
selected: false
}
];

public toggleFavorite(contact: any, event: Event) {
event.stopPropagation();
contact.isFavorite = !contact.isFavorite;
event.stopPropagation();
contact.isFavorite = !contact.isFavorite;
}

public selectItem(item) {
if (!item.selected) {
this.contacts.forEach(c => c.selected = false);
item.selected = true;
}
if (!item.selected) {
this.contacts.forEach(c => c.selected = false);
item.selected = true;
}
}

get filterContacts() {
const fo = new IgxFilterOptions();
fo.key = 'name';
fo.inputValue = this.searchContact;
return fo;
const fo = new IgxFilterOptions();
fo.key = 'name';
fo.inputValue = this.searchContact;
return fo;
}

public mousedown(event: Event) {
event.stopPropagation();
}
}
7 changes: 5 additions & 2 deletions src/app/lists/list/list-sample-4/list-sample-4.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@
<div class="list-sample">
<igx-list [displayDensity]="density">
<igx-list-item [isHeader]="true">Contacts</igx-list-item>
<igx-list-item igxRipple igxRippleTarget=".igx-list__item-content" #item *ngFor="let contact of contacts | igxFilter: filterContacts;">
<igx-list-item igxRipple igxRippleTarget=".igx-list__item-content" #item
*ngFor="let contact of contacts | igxFilter: filterContacts;">
<igx-avatar igxListThumbnail [src]="contact.photo" [roundShape]="true"></igx-avatar>
<span igxListLineTitle>{{ contact.name }}</span>
<span igxListLineSubTitle>{{ contact.phone }}</span>
<igx-icon igxListAction [style.color]="contact.isFavorite ? 'orange' : 'lightgray'" (click)="toggleFavorite(contact)">star</igx-icon>
<igx-icon igxListAction [style.color]="contact.isFavorite ? 'orange' : 'lightgray'" igxRipple="pink"
[igxRippleCentered]="true" (click)="toggleFavorite(contact, $event)"
(mousedown)="mousedown($event)">star</igx-icon>
</igx-list-item>
</igx-list>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

igx-icon {
cursor: pointer;
position: relative;
}

.search {
Expand Down
121 changes: 63 additions & 58 deletions src/app/lists/list/list-sample-4/list-sample-4.component.ts
Original file line number Diff line number Diff line change
@@ -1,71 +1,76 @@
import { Component, OnInit } from '@angular/core';
import { DisplayDensity, IgxFilterOptions } from 'igniteui-angular';
@Component({
selector: 'app-contact-list2',
styleUrls: ['./list-sample-4.component.scss'],
templateUrl: './list-sample-4.component.html'
selector: 'app-contact-list2',
styleUrls: ['./list-sample-4.component.scss'],
templateUrl: './list-sample-4.component.html'
})
export class ListSample4Component implements OnInit {
public searchContact: string;
public searchContact: string;

public contacts = [
{
isFavorite: false,
name: 'Terrance Orta',
phone: '770-504-2217',
photo: 'assets/images/men/27.jpg'
},
{
isFavorite: true,
name: 'Richard Mahoney',
phone: '423-676-2869',
photo: 'assets/images/men/1.jpg'
},
{
isFavorite: false,
name: 'Donna Price',
phone: '859-496-2817',
photo: 'assets/images/women/50.jpg'
},
{
isFavorite: false,
name: 'Lisa Landers',
phone: '901-747-3428',
photo: 'assets/images/women/3.jpg'
},
{
isFavorite: true,
name: 'Dorothy H. Spencer',
phone: '573-394-9254',
photo: 'assets/images/women/67.jpg'
}
];
public contacts = [
{
isFavorite: false,
name: 'Terrance Orta',
phone: '770-504-2217',
photo: 'assets/images/men/27.jpg'
},
{
isFavorite: true,
name: 'Richard Mahoney',
phone: '423-676-2869',
photo: 'assets/images/men/1.jpg'
},
{
isFavorite: false,
name: 'Donna Price',
phone: '859-496-2817',
photo: 'assets/images/women/50.jpg'
},
{
isFavorite: false,
name: 'Lisa Landers',
phone: '901-747-3428',
photo: 'assets/images/women/3.jpg'
},
{
isFavorite: true,
name: 'Dorothy H. Spencer',
phone: '573-394-9254',
photo: 'assets/images/women/67.jpg'
}
];

public density: DisplayDensity = 'comfortable';
public displayDensities;
public density: DisplayDensity = 'comfortable';
public displayDensities;

constructor() { }
constructor() { }

public ngOnInit() {
this.displayDensities = [
{ label: 'comfortable', selected: this.density === 'comfortable', togglable: true },
{ label: 'cosy', selected: this.density === 'cosy', togglable: true },
{ label: 'compact', selected: this.density === 'compact', togglable: true }
];
}
public ngOnInit() {
this.displayDensities = [
{ label: 'comfortable', selected: this.density === 'comfortable', togglable: true },
{ label: 'cosy', selected: this.density === 'cosy', togglable: true },
{ label: 'compact', selected: this.density === 'compact', togglable: true }
];
}

public selectDensity(event) {
this.density = this.displayDensities[event.index].label;
}
public selectDensity(event) {
this.density = this.displayDensities[event.index].label;
}

public toggleFavorite(contact: any) {
contact.isFavorite = !contact.isFavorite;
}
public toggleFavorite(contact: any, event: Event) {
event.stopPropagation();
contact.isFavorite = !contact.isFavorite;
}

get filterContacts() {
const fo = new IgxFilterOptions();
fo.key = 'name';
fo.inputValue = this.searchContact;
return fo;
}

get filterContacts() {
const fo = new IgxFilterOptions();
fo.key = 'name';
fo.inputValue = this.searchContact;
return fo;
}
public mousedown(event: Event) {
event.stopPropagation();
}
}
10 changes: 7 additions & 3 deletions src/app/lists/list/list-sample-7/list-sample-7.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<div style="width:300px; margin-bottom:20px">
<igx-slider id="slider" [minValue]="0.1" [maxValue]="0.9" [step]="0.1" [continuous]="true" [(ngModel)]="mainIgxList.panEndTriggeringThreshold"></igx-slider>
<igx-slider id="slider" [minValue]="0.1" [maxValue]="0.9" [step]="0.1" [continuous]="true"
[(ngModel)]="mainIgxList.panEndTriggeringThreshold"></igx-slider>
<label>Threshold: {{panThreshold}}</label>
</div>

Expand All @@ -17,11 +18,14 @@
</div>
</ng-template>
<igx-list-item [isHeader]="true">Contacts</igx-list-item>
<igx-list-item #item *ngFor="let contact of contacts" igxRipple="pink" igxRippleTarget=".igx-list__item-content">
<igx-list-item #item *ngFor="let contact of contacts" igxRipple="pink"
igxRippleTarget=".igx-list__item-content">
<igx-avatar igxListThumbnail [src]="contact.photo" [roundShape]="true"></igx-avatar>
<span igxListLineTitle>{{ contact.name }}</span>
<span igxListLineSubTitle>{{ contact.phone }}</span>
<igx-icon igxListAction [style.color]="contact.isFavorite ? 'orange' : 'lightgray'" (click)="toggleFavorite(contact)">star</igx-icon>
<igx-icon igxListAction [style.color]="contact.isFavorite ? 'orange' : 'lightgray'" igxRipple="pink"
[igxRippleCentered]="true" (click)="toggleFavorite(contact, $event)"
(mousedown)="mousedown($event)">star</igx-icon>
</igx-list-item>
</igx-list>
<igx-toast #toast></igx-toast>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

igx-icon {
cursor: pointer;
position: relative;
}

.listItemLeftPanningStyle {
Expand Down
6 changes: 5 additions & 1 deletion src/app/lists/list/list-sample-7/list-sample-7.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ export class ListSample7Component implements OnInit {
this.contacts = Object.assign([], this.dataSource);
}

public toggleFavorite(contact: any) {
public toggleFavorite(contact: any, event: Event) {
event.stopPropagation();
contact.isFavorite = !contact.isFavorite;
}

Expand All @@ -77,4 +78,7 @@ export class ListSample7Component implements OnInit {
return Math.round(result * 100) + '%';
}

public mousedown(event: Event) {
event.stopPropagation();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
<igx-avatar igxListThumbnail [src]="contact.photo" [roundShape]="true"></igx-avatar>
<span igxListLineTitle>{{ contact.name }}</span>
<span igxListLineSubTitle>{{ contact.phone }}</span>
<igx-icon igxListAction [style.color]="contact.isFavorite ? 'orange' : 'lightgray'" (click)="toggleFavorite(contact)">star</igx-icon>
<igx-icon igxListAction [style.color]="contact.isFavorite ? 'orange' : 'lightgray'" igxRipple="white"
[igxRippleCentered]="true" (click)="toggleFavorite(contact, $event)"
(mousedown)="mousedown($event)">star</igx-icon>
</igx-list-item>
</igx-list>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@

igx-icon {
cursor: pointer;
position: relative;
}
Loading

0 comments on commit f733e86

Please sign in to comment.