Skip to content

Commit 0286c70

Browse files
author
Pradeep Terli
committed
lazy loading and groupby
1 parent e1f22f4 commit 0286c70

File tree

9 files changed

+1340
-216
lines changed

9 files changed

+1340
-216
lines changed

src/app/angular2-multiselect-dropdown/list-filter.ts

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { DataService } from './multiselect.service';
99
export class ListFilterPipe implements PipeTransform {
1010

1111
public filteredList: any = [];
12-
constructor(private ds: DataService){
12+
constructor(private ds: DataService) {
1313

1414
}
1515

@@ -25,19 +25,29 @@ export class ListFilterPipe implements PipeTransform {
2525
applyFilter(item: any, filter: any, searchBy: any): boolean {
2626
let found = false;
2727
if (searchBy.length > 0) {
28-
for (var t = 0; t < searchBy.length; t++) {
29-
if (filter && item[searchBy[t]] && item[searchBy[t]] != "") {
30-
if (item[searchBy[t]].toString().toLowerCase().indexOf(filter.toLowerCase()) >= 0) {
31-
found = true;
28+
if (item.grpTitle) {
29+
found = true;
30+
}
31+
else {
32+
for (var t = 0; t < searchBy.length; t++) {
33+
if (filter && item[searchBy[t]] && item[searchBy[t]] != "") {
34+
if (item[searchBy[t]].toString().toLowerCase().indexOf(filter.toLowerCase()) >= 0) {
35+
found = true;
36+
}
3237
}
3338
}
3439
}
3540

3641
} else {
37-
for (var prop in item) {
38-
if (filter && item[prop]) {
39-
if (item[prop].toString().toLowerCase().indexOf(filter.toLowerCase()) >= 0) {
40-
found = true;
42+
if (item.grpTitle) {
43+
found = true;
44+
}
45+
else {
46+
for (var prop in item) {
47+
if (filter && item[prop]) {
48+
if (item[prop].toString().toLowerCase().indexOf(filter.toLowerCase()) >= 0) {
49+
found = true;
50+
}
4151
}
4252
}
4353
}

src/app/angular2-multiselect-dropdown/menu-item.ts

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,78 @@ export class TemplateRenderer implements OnInit, OnDestroy {
6565
}
6666

6767
}
68+
69+
@Component({
70+
selector: 'c-icon',
71+
template: `<svg *ngIf="name == 'remove'" width="100%" height="100%" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
72+
viewBox="0 0 47.971 47.971" style="enable-background:new 0 0 47.971 47.971;" xml:space="preserve">
73+
<g>
74+
<path d="M28.228,23.986L47.092,5.122c1.172-1.171,1.172-3.071,0-4.242c-1.172-1.172-3.07-1.172-4.242,0L23.986,19.744L5.121,0.88
75+
c-1.172-1.172-3.07-1.172-4.242,0c-1.172,1.171-1.172,3.071,0,4.242l18.865,18.864L0.879,42.85c-1.172,1.171-1.172,3.071,0,4.242
76+
C1.465,47.677,2.233,47.97,3,47.97s1.535-0.293,2.121-0.879l18.865-18.864L42.85,47.091c0.586,0.586,1.354,0.879,2.121,0.879
77+
s1.535-0.293,2.121-0.879c1.172-1.171,1.172-3.071,0-4.242L28.228,23.986z"/>
78+
</g>
79+
</svg>
80+
<svg *ngIf="name == 'angle-down'" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
81+
width="100%" height="100%" viewBox="0 0 612 612" style="enable-background:new 0 0 612 612;" xml:space="preserve">
82+
<g>
83+
<g id="_x31_0_34_">
84+
<g>
85+
<path d="M604.501,134.782c-9.999-10.05-26.222-10.05-36.221,0L306.014,422.558L43.721,134.782
86+
c-9.999-10.05-26.223-10.05-36.222,0s-9.999,26.35,0,36.399l279.103,306.241c5.331,5.357,12.422,7.652,19.386,7.296
87+
c6.988,0.356,14.055-1.939,19.386-7.296l279.128-306.268C614.5,161.106,614.5,144.832,604.501,134.782z"/>
88+
</g>
89+
</g>
90+
</g>
91+
</svg>
92+
<svg *ngIf="name == 'angle-up'" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
93+
width="100%" height="100%" viewBox="0 0 612 612" style="enable-background:new 0 0 612 612;" xml:space="preserve">
94+
<g>
95+
<g id="_x39__30_">
96+
<g>
97+
<path d="M604.501,440.509L325.398,134.956c-5.331-5.357-12.423-7.627-19.386-7.27c-6.989-0.357-14.056,1.913-19.387,7.27
98+
L7.499,440.509c-9.999,10.024-9.999,26.298,0,36.323s26.223,10.024,36.222,0l262.293-287.164L568.28,476.832
99+
c9.999,10.024,26.222,10.024,36.221,0C614.5,466.809,614.5,450.534,604.501,440.509z"/>
100+
</g>
101+
</g>
102+
</g>
103+
104+
</svg>
105+
<svg *ngIf="name == 'search'" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
106+
width="100%" height="100%" viewBox="0 0 615.52 615.52" style="enable-background:new 0 0 615.52 615.52;"
107+
xml:space="preserve">
108+
<g>
109+
<g>
110+
<g id="Search__x28_and_thou_shall_find_x29_">
111+
<g>
112+
<path d="M602.531,549.736l-184.31-185.368c26.679-37.72,42.528-83.729,42.528-133.548C460.75,103.35,357.997,0,231.258,0
113+
C104.518,0,1.765,103.35,1.765,230.82c0,127.47,102.753,230.82,229.493,230.82c49.53,0,95.271-15.944,132.78-42.777
114+
l184.31,185.366c7.482,7.521,17.292,11.291,27.102,11.291c9.812,0,19.62-3.77,27.083-11.291
115+
C617.496,589.188,617.496,564.777,602.531,549.736z M355.9,319.763l-15.042,21.273L319.7,356.174
116+
c-26.083,18.658-56.667,28.526-88.442,28.526c-84.365,0-152.995-69.035-152.995-153.88c0-84.846,68.63-153.88,152.995-153.88
117+
s152.996,69.034,152.996,153.88C384.271,262.769,374.462,293.526,355.9,319.763z"/>
118+
</g>
119+
</g>
120+
</g>
121+
</g>
122+
123+
</svg>
124+
<svg *ngIf="name == 'clear'" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
125+
viewBox="0 0 51.976 51.976" style="enable-background:new 0 0 51.976 51.976;" xml:space="preserve">
126+
<g>
127+
<path d="M44.373,7.603c-10.137-10.137-26.632-10.138-36.77,0c-10.138,10.138-10.137,26.632,0,36.77s26.632,10.138,36.77,0
128+
C54.51,34.235,54.51,17.74,44.373,7.603z M36.241,36.241c-0.781,0.781-2.047,0.781-2.828,0l-7.425-7.425l-7.778,7.778
129+
c-0.781,0.781-2.047,0.781-2.828,0c-0.781-0.781-0.781-2.047,0-2.828l7.778-7.778l-7.425-7.425c-0.781-0.781-0.781-2.048,0-2.828
130+
c0.781-0.781,2.047-0.781,2.828,0l7.425,7.425l7.071-7.071c0.781-0.781,2.047-0.781,2.828,0c0.781,0.781,0.781,2.047,0,2.828
131+
l-7.071,7.071l7.425,7.425C37.022,34.194,37.022,35.46,36.241,36.241z"/>
132+
</g>
133+
</svg>`,
134+
encapsulation: ViewEncapsulation.None,
135+
136+
})
137+
138+
export class CIcon {
139+
140+
@Input() name:any;
141+
142+
}

0 commit comments

Comments
 (0)