Skip to content

Commit b6972ed

Browse files
authored
Merge branch '17.0.x' into gedinakova/fflateUpdate-17.0
2 parents 6fbcf67 + ab45597 commit b6972ed

File tree

5 files changed

+143
-9
lines changed

5 files changed

+143
-9
lines changed

projects/igniteui-angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
"@angular/forms": "^17.0.0"
8787
},
8888
"igxDevDependencies": {
89-
"@igniteui/angular-schematics": "~17.0.1300"
89+
"@igniteui/angular-schematics": "~17.1.1310"
9090
},
9191
"ng-update": {
9292
"migrations": "./migrations/migration-collection.json",

projects/igniteui-angular/src/lib/grids/filtering/excel-style/excel-style-search.component.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -648,11 +648,13 @@ export class IgxExcelStyleSearchComponent implements AfterViewInit, OnDestroy {
648648

649649
protected onFocus() {
650650
const firstIndexInView = this.virtDir.state.startIndex;
651-
this.focusedItem = {
652-
id: this.getItemId(firstIndexInView),
653-
index: firstIndexInView,
654-
checked: this.virtDir.igxForOf[firstIndexInView].isSelected
655-
};
651+
if (this.virtDir.igxForOf.length > 0) {
652+
this.focusedItem = {
653+
id: this.getItemId(firstIndexInView),
654+
index: firstIndexInView,
655+
checked: this.virtDir.igxForOf[firstIndexInView].isSelected
656+
};
657+
}
656658
this.setActiveDescendant();
657659
}
658660

projects/igniteui-angular/src/lib/grids/grid-base.directive.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3691,6 +3691,7 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
36913691
public resetCaches(recalcFeatureWidth = true) {
36923692
if (recalcFeatureWidth) {
36933693
this._headerFeaturesWidth = NaN;
3694+
this.summaryService.summaryHeight = 0;
36943695
}
36953696
this.resetForOfCache();
36963697
this.resetColumnsCaches();

projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid-base.directive.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,9 @@ export abstract class IgxHierarchicalGridBaseDirective extends IgxGridBaseDirect
211211
this.columns.forEach(column => {
212212
if (column[output.propName]) {
213213
column[output.propName].pipe(takeUntil(column.destroy$)).subscribe((args) => {
214-
const rowIslandColumn = this.parentIsland.childColumns.find(col => col.field === column.field);
214+
const rowIslandColumn = this.parentIsland.columnList.find((col) => col.field
215+
? col.field === column.field
216+
: col.header === column.header);
215217
rowIslandColumn[output.propName].emit({ args, owner: this });
216218
});
217219
}

projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-grid.spec.ts

Lines changed: 131 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { IgxExcelStyleHeaderComponent } from '../filtering/excel-style/excel-sty
2121
import { IgxExcelStyleSortingComponent } from '../filtering/excel-style/excel-style-sorting.component';
2222
import { IgxExcelStyleSearchComponent } from '../filtering/excel-style/excel-style-search.component';
2323
import { IgxCellHeaderTemplateDirective } from '../columns/templates.directive';
24-
import { CellType, ColumnType, IGridCellEventArgs, IgxColumnComponent, IgxRowEditActionsDirective, IgxRowEditTextDirective } from '../public_api';
24+
import { CellType, ColumnType, IGridCellEventArgs, IgxColumnComponent, IgxColumnGroupComponent, IgxRowEditActionsDirective, IgxRowEditTextDirective } from '../public_api';
2525
import { getComponentSize } from '../../core/utils';
2626

2727
describe('Basic IgxHierarchicalGrid #hGrid', () => {
@@ -42,7 +42,8 @@ describe('Basic IgxHierarchicalGrid #hGrid', () => {
4242
IgxHierarchicalGridAutoSizeColumnsComponent,
4343
IgxHierarchicalGridCustomTemplateComponent,
4444
IgxHierarchicalGridCustomFilteringTemplateComponent,
45-
IgxHierarchicalGridToggleRIAndColsComponent
45+
IgxHierarchicalGridToggleRIAndColsComponent,
46+
IgxHierarchicalGridMCHComponent
4647
]
4748
}).compileComponents();
4849
}))
@@ -1713,6 +1714,44 @@ describe('Basic IgxHierarchicalGrid #hGrid', () => {
17131714
}));
17141715
});
17151716

1717+
describe('IgxHierarchicalGrid Multi-Column Headers', () => {
1718+
let fixture: ComponentFixture<IgxHierarchicalGridMCHComponent>;
1719+
let hierarchicalGrid: IgxHierarchicalGridComponent;
1720+
1721+
beforeEach(() => {
1722+
fixture = TestBed.createComponent(IgxHierarchicalGridMCHComponent);
1723+
fixture.detectChanges();
1724+
hierarchicalGrid = fixture.componentInstance.hGrid;
1725+
});
1726+
1727+
it('should fire expandedChange, hiddenChange and pinnedChange events for child grid.', () => {
1728+
const childGrid = hierarchicalGrid.gridAPI.getChildGrids(false)[0];
1729+
const columnGroup2 = childGrid.columns[4] as IgxColumnGroupComponent;
1730+
const columnGroup2Header = GridFunctions.getColumnGroupHeaders(fixture)[3];
1731+
const expandIcon = columnGroup2Header.queryAll(By.css('.igx-icon'))[0];
1732+
const pinIcon = columnGroup2Header.queryAll(By.css('.igx-icon'))[1];
1733+
1734+
expect(columnGroup2.expanded).toBeFalse();
1735+
expect(columnGroup2.pinned).toBeFalse();
1736+
1737+
UIInteractions.simulateClickEvent(expandIcon.nativeElement);
1738+
fixture.detectChanges();
1739+
1740+
expect(columnGroup2.expanded).toBeTrue();
1741+
1742+
expect(fixture.componentInstance.expandedArgs).toBeDefined();
1743+
expect(fixture.componentInstance.expandedArgs.args).toBeTrue();
1744+
expect(fixture.componentInstance.hiddenArgs).toBeDefined();
1745+
expect(fixture.componentInstance.hiddenArgs.args).toBeTrue();
1746+
1747+
UIInteractions.simulateClickEvent(pinIcon.nativeElement);
1748+
fixture.detectChanges();
1749+
1750+
expect(columnGroup2.pinned).toBeTrue();
1751+
expect(fixture.componentInstance.pinnedArgs).toBeDefined();
1752+
expect(fixture.componentInstance.pinnedArgs.args).toBeTrue();
1753+
});
1754+
});
17161755
});
17171756

17181757
@Component({
@@ -2131,3 +2170,93 @@ export class IgxHierarchicalGridCustomRowEditOverlayComponent extends IgxHierarc
21312170
imports: [IgxHierarchicalGridComponent, IgxColumnComponent, IgxRowIslandComponent, IgxRowEditTextDirective, IgxRowEditActionsDirective]
21322171
})
21332172
export class IgxHierarchicalGridAutoSizeColumnsComponent extends IgxHierarchicalGridTestBaseComponent {}
2173+
2174+
@Component({
2175+
template: `
2176+
<ng-template #headerTemplate igxHeader let-col>
2177+
<span >{{ col.header ? col.header : col.field}}</span>
2178+
<igx-icon (click)="pinColumn(col)">push_pin</igx-icon>
2179+
</ng-template>
2180+
<igx-hierarchical-grid #hGrid [data]="data" [height]="'400px'" [width]="'800px'" [expandChildren]="true">
2181+
<igx-column field="CustomerID"></igx-column>
2182+
<igx-column-group header="General Information" [collapsible]="true" [expanded]="false">
2183+
<igx-column field="CompanyName" [visibleWhenCollapsed]="true"></igx-column>
2184+
<igx-column field="ContactName" [visibleWhenCollapsed]="false"></igx-column>
2185+
<igx-column field="ContactTitle" [visibleWhenCollapsed]="false"></igx-column>
2186+
</igx-column-group>
2187+
<igx-column-group header="Address Information" [collapsible]="true" [expanded]="false">
2188+
<igx-column field="Location" [visibleWhenCollapsed]="true"></igx-column>
2189+
<igx-column field="Address" [visibleWhenCollapsed]="false"></igx-column>
2190+
<igx-column field="City" [visibleWhenCollapsed]="false"></igx-column>
2191+
<igx-column field="Country" [visibleWhenCollapsed]="false"></igx-column>
2192+
<igx-column field="PostalCode" [visibleWhenCollapsed]="false"></igx-column>
2193+
</igx-column-group>
2194+
<igx-row-island [height]="null" [key]="'Orders'" [autoGenerate]="false">
2195+
<igx-column-group header="Order Details" [collapsible]="true" [expanded]="false">
2196+
<igx-column field="OrderID" [visibleWhenCollapsed]="true"></igx-column>
2197+
<igx-column field="OrderDate" [dataType]="'date'" [visibleWhenCollapsed]="false"></igx-column>
2198+
<igx-column field="RequiredDate" [dataType]="'date'" [visibleWhenCollapsed]="false"></igx-column>
2199+
</igx-column-group>
2200+
<igx-column-group header="General Shipping Information" [collapsible]="true" [expanded]="false"
2201+
[headerTemplate]="headerTemplate" (expandedChange)="expandedChange($event)">
2202+
<igx-column field="ShippedDate" [dataType]="'date'" [visibleWhenCollapsed]="true"
2203+
(hiddenChange)="hiddenChange($event)" (pinnedChange)="pinnedChange($event)"></igx-column>
2204+
<igx-column field="ShipVia" [visibleWhenCollapsed]="false" ></igx-column>
2205+
<igx-column field="Freight" [visibleWhenCollapsed]="false"></igx-column>
2206+
<igx-column field="ShipName" [visibleWhenCollapsed]="false"></igx-column>
2207+
</igx-column-group>
2208+
</igx-row-island>
2209+
</igx-hierarchical-grid>
2210+
`,
2211+
standalone: true,
2212+
imports: [IgxHierarchicalGridComponent, IgxRowIslandComponent, IgxColumnComponent, IgxColumnGroupComponent, IgxIconComponent, IgxCellHeaderTemplateDirective]
2213+
})
2214+
export class IgxHierarchicalGridMCHComponent {
2215+
@ViewChild('hGrid', { read: IgxHierarchicalGridComponent, static: true })
2216+
public hGrid: IgxHierarchicalGridComponent;
2217+
2218+
public expandedArgs: any;
2219+
public hiddenArgs: any;
2220+
public pinnedArgs: any;
2221+
2222+
public data = [
2223+
{
2224+
CustomerID: "VINET",
2225+
CompanyName: "Vins et alcools Chevalier",
2226+
ContactName: "Paul Henriot",
2227+
ContactTitle: "Accounting Manager",
2228+
Location: "59 rue de l'Abbaye, Reims, France",
2229+
Address: "59 rue de l'Abbaye",
2230+
City: "Reims",
2231+
Country: "France",
2232+
PostalCode: "51100",
2233+
Orders: [
2234+
{
2235+
OrderID: 10248,
2236+
OrderDate: new Date("1996-07-04T00:00:00"),
2237+
RequiredDate: new Date("1996-08-01T00:00:00"),
2238+
ShippedDate: new Date("1996-07-16T00:00:00"),
2239+
ShipVia: 3,
2240+
Freight: 32.38,
2241+
ShipName: "Vins et alcools Chevalier",
2242+
},
2243+
],
2244+
},
2245+
];
2246+
2247+
public pinColumn(col: ColumnType) {
2248+
col.pinned ? col.unpin() : col.pin();
2249+
}
2250+
2251+
public expandedChange(args: any) {
2252+
this.expandedArgs = args;
2253+
}
2254+
2255+
public hiddenChange(args: any) {
2256+
this.hiddenArgs = args;
2257+
}
2258+
2259+
public pinnedChange(args: any) {
2260+
this.pinnedArgs = args;
2261+
}
2262+
}

0 commit comments

Comments
 (0)