Skip to content

Commit bf3e647

Browse files
authored
Merge branch '15.0.x' into mtsvyatkova/issue-12056
2 parents 75f9af4 + 45d7f19 commit bf3e647

File tree

5 files changed

+159
-5
lines changed

5 files changed

+159
-5
lines changed

projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,7 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
893893
}
894894

895895
protected updateSizes() {
896+
if (!this.scrollComponent.nativeElement.isConnected) return;
896897
const scrollable = this.isScrollable();
897898
this.recalcUpdateSizes();
898899
this._applyChanges();
@@ -1281,7 +1282,7 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
12811282
this.dc.instance.notVirtual = !(this.igxForContainerSize && this.dc && this.state.chunkSize < count);
12821283
const scrollable = this.isScrollable();
12831284
if (this.igxForScrollOrientation === 'horizontal') {
1284-
const totalWidth = this.igxForContainerSize ? this.initSizesCache(this.igxForOf) : 0;
1285+
const totalWidth = parseInt(this.igxForContainerSize, 10) > 0 ? this.initSizesCache(this.igxForOf) : 0;
12851286
this.scrollComponent.nativeElement.style.width = this.igxForContainerSize + 'px';
12861287
this.scrollComponent.size = totalWidth;
12871288
if (totalWidth <= parseInt(this.igxForContainerSize, 10)) {

projects/igniteui-angular/src/lib/simple-combo/simple-combo.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@
3434
(click)="toggleCaseSensitive()">
3535
</igx-icon>
3636
</igx-suffix>
37-
<igx-suffix class="igx-combo__toggle-button">
37+
<igx-suffix class="igx-combo__toggle-button" (click)="onClick($event)">
3838
<ng-container *ngIf="toggleIconTemplate">
3939
<ng-container *ngTemplateOutlet="toggleIconTemplate; context: {$implicit: collapsed}"></ng-container>
4040
</ng-container>
41-
<igx-icon (click)="onClick($event)" *ngIf="!toggleIconTemplate">
41+
<igx-icon *ngIf="!toggleIconTemplate">
4242
{{ dropdown.collapsed ? 'arrow_drop_down' : 'arrow_drop_up'}}
4343
</igx-icon>
4444
</igx-suffix>

projects/igniteui-angular/src/lib/simple-combo/simple-combo.component.spec.ts

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,8 @@ describe('IgxSimpleCombo', () => {
810810
TestBed.configureTestingModule({
811811
declarations: [
812812
IgxSimpleComboSampleComponent,
813-
IgxComboInContainerTestComponent
813+
IgxComboInContainerTestComponent,
814+
IgxSimpleComboIconTemplatesComponent
814815
],
815816
imports: [
816817
IgxSimpleComboModule,
@@ -992,9 +993,10 @@ describe('IgxSimpleCombo', () => {
992993
const toggleButton = fixture.debugElement.query(By.directive(IgxIconComponent));
993994
expect(toggleButton).toBeDefined();
994995

995-
toggleButton.triggerEventHandler('click', UIInteractions.getMouseEvent('click'));
996+
toggleButton.nativeElement.click();
996997
fixture.detectChanges();
997998

999+
expect(combo.collapsed).toBeFalsy();
9981000
expect(combo.onClick).toHaveBeenCalledTimes(1);
9991001
expect((combo as any).virtDir.scrollTo).toHaveBeenCalledWith(0);
10001002
});
@@ -1278,6 +1280,30 @@ describe('IgxSimpleCombo', () => {
12781280
expect(combo.selection).toEqual([]);
12791281
expect(combo.value).toBe('');
12801282
});
1283+
1284+
it('should toggle dropdown list on clicking a templated toggle icon', fakeAsync(() => {
1285+
fixture = TestBed.createComponent(IgxSimpleComboIconTemplatesComponent);
1286+
fixture.detectChanges();
1287+
combo = fixture.componentInstance.combo;
1288+
1289+
const toggleIcon = fixture.debugElement.query(By.directive(IgxIconComponent));
1290+
expect(toggleIcon).toBeDefined();
1291+
1292+
expect(toggleIcon.nativeElement.textContent).toBe('search');
1293+
expect(combo.collapsed).toBeTruthy();
1294+
1295+
toggleIcon.nativeElement.click();
1296+
tick();
1297+
fixture.detectChanges();
1298+
1299+
expect(combo.collapsed).toBeFalsy();
1300+
1301+
toggleIcon.nativeElement.click();
1302+
tick();
1303+
fixture.detectChanges();
1304+
1305+
expect(combo.collapsed).toBeTruthy();
1306+
}));
12811307
});
12821308

12831309
describe('Display density', () => {
@@ -1862,6 +1888,22 @@ export class IgxSimpleComboEmptyComponent {
18621888
public name!: string;
18631889
}
18641890

1891+
@Component({
1892+
template: `<igx-simple-combo #combo [data]="data" displayKey="name" valueKey="id" [(ngModel)]="name">
1893+
<ng-template igxComboToggleIcon><igx-icon>search</igx-icon></ng-template>
1894+
</igx-simple-combo>`
1895+
})
1896+
export class IgxSimpleComboIconTemplatesComponent {
1897+
@ViewChild('combo', { read: IgxSimpleComboComponent, static: true })
1898+
public combo: IgxSimpleComboComponent;
1899+
1900+
public data: any[] = [
1901+
{ name: 'Sofia', id: '1' },
1902+
{ name: 'London', id: '2' },
1903+
];;
1904+
public name!: string;
1905+
}
1906+
18651907
@Component({
18661908
template: `<igx-simple-combo [(ngModel)]="selectedItem" [data]="items"></igx-simple-combo>`
18671909
})

src/app/tabs/tabs.sample.html

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,5 +282,33 @@ <h3 class="sample-title">Bind selected property</h3>
282282
</igx-tab-item>
283283
</igx-tabs>
284284
</div>
285+
286+
287+
<div >
288+
<h3 class="sample-title">Tab with grid</h3>
289+
<igx-tabs>
290+
<igx-tab-item>
291+
<igx-tab-header>
292+
<igx-icon igxTabHeaderIcon>library_music</igx-icon>
293+
<span igxTabHeaderLabel>Albums</span>
294+
</igx-tab-header>
295+
<igx-tab-content>
296+
<igx-grid #grid1 [data]="localData" [autoGenerate]="true" width="100%" height="100%" >
297+
</igx-grid>
298+
</igx-tab-content>
299+
</igx-tab-item>
300+
<igx-tab-item>
301+
<igx-tab-header>
302+
<igx-icon igxTabHeaderIcon>favorite</igx-icon>
303+
<span igxTabHeaderLabel>Favorite</span>
304+
</igx-tab-header>
305+
<igx-tab-content>
306+
<div style="height: 80vh;">
307+
Test
308+
</div>
309+
</igx-tab-content>
310+
</igx-tab-item>
311+
</igx-tabs>
312+
</div>
285313
</div>
286314
</div>

src/app/tabs/tabs.sample.ts

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,88 @@ export class TabsSampleComponent implements OnInit {
5858
{ ID: 'FRANR', CompanyName: 'France restauration', ContactName: 'Carine Schmitt', ContactTitle: 'Marketing Manager', Address: '54, rue Royale', City: 'Nantes', Region: null, PostalCode: '44000', Country: 'France', Phone: '40.32.21.21', Fax: '40.32.21.20' },
5959
{ ID: 'FRANS', CompanyName: 'Franchi S.p.A.', ContactName: 'Paolo Accorti', ContactTitle: 'Sales Representative', Address: 'Via Monte Bianco 34', City: 'Torino', Region: null, PostalCode: '10100', Country: 'Italy', Phone: '011-4988260', Fax: '011-4988261' }
6060
];
61+
public localData;
62+
public lastYear = new Date().getFullYear() - 1;
63+
public employeesHData = [
64+
{
65+
EmployeeID: '56250fa57ab1535722e564a6',
66+
FirstName: 'Downs',
67+
LastName: 'Holcomb',
68+
Country: 'Italy',
69+
Age: 35,
70+
RegisteredDate2: new Date(this.lastYear, 7, 25),
71+
IsActive2: false,
72+
EmployeeID2: '56250fa57ab1535722e564a6',
73+
FirstName2: 'Downs',
74+
LastName2: 'Holcomb',
75+
Country2: 'Italy',
76+
Age2: 35
77+
},
78+
{
79+
EmployeeID: '56250fa5c0fd04f12555d44d',
80+
FirstName: 'Mckenzie',
81+
LastName: 'Calderon',
82+
Country: 'USA',
83+
Age: 26,
84+
RegisteredDate: new Date(this.lastYear - 1, 9, 22),
85+
IsActive: false,
86+
RegisteredDate2: new Date(this.lastYear, 7, 25),
87+
IsActive2: false,
88+
EmployeeID2: '56250fa57ab1535722e564a6',
89+
FirstName2: 'Downs',
90+
LastName2: 'Holcomb',
91+
Country2: 'Italy',
92+
Age2: 35
93+
94+
},
95+
{
96+
EmployeeID: '56250fa565a7bcc21f6bd15e',
97+
FirstName: 'Howell',
98+
LastName: 'Hawkins',
99+
Country: 'Canada',
100+
Age: 25,
101+
RegisteredDate: new Date(this.lastYear, 8, 8),
102+
IsActive: false,
103+
RegisteredDate2: new Date(this.lastYear, 7, 25),
104+
IsActive2: false,
105+
EmployeeID2: '56250fa57ab1535722e564a6',
106+
FirstName2: 'Downs',
107+
LastName2: 'Holcomb',
108+
Country2: 'Italy',
109+
Age2: 35
110+
},
111+
{
112+
EmployeeID: '56250fa5d71a83c33f3f6479',
113+
FirstName: 'Sheppard',
114+
LastName: 'Nicholson',
115+
Country: 'Italy',
116+
Age: 49,
117+
RegisteredDate: new Date(this.lastYear - 1, 6, 28),
118+
IsActive: false,
119+
RegisteredDate2: new Date(this.lastYear, 7, 25),
120+
IsActive2: false,
121+
EmployeeID2: '56250fa57ab1535722e564a6',
122+
FirstName2: 'Downs',
123+
LastName2: 'Holcomb',
124+
Country2: 'Italy',
125+
Age2: 35
126+
},
127+
{
128+
EmployeeID: '56250fa546abbe8c616d37eb',
129+
FirstName: 'Bettye',
130+
LastName: 'Trujillo',
131+
Country: 'Canada',
132+
Age: 37,
133+
RegisteredDate: new Date(new Date().setDate(-20)),
134+
IsActive: false,
135+
RegisteredDate2: new Date(this.lastYear, 7, 25),
136+
IsActive2: false,
137+
EmployeeID2: '56250fa57ab1535722e564a6',
138+
FirstName2: 'Downs',
139+
LastName2: 'Holcomb',
140+
Country2: 'Italy',
141+
Age2: 35
142+
}];
61143

62144
public contacts: any[] = [{
63145
avatar: 'assets/images/avatar/1.jpg',
@@ -99,6 +181,7 @@ export class TabsSampleComponent implements OnInit {
99181
const tab = 'Tab ' + i;
100182
this.scrollableTabs.push(tab);
101183
}
184+
this.localData = this.employeesHData;
102185
}
103186

104187
public addTab() {

0 commit comments

Comments
 (0)