Skip to content

Commit 9e1ff6b

Browse files
Merge branch '18.0.x' into ganastasov/fix-14539-18.0.x
2 parents 8919bd5 + 86c0275 commit 9e1ff6b

File tree

4 files changed

+101
-11
lines changed

4 files changed

+101
-11
lines changed

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

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { ISortingExpression, SortingDirection } from '../../data-operations/sort
2525
import { GRID_SCROLL_CLASS } from '../../test-utils/grid-functions.spec';
2626
import { AsyncPipe, NgFor, NgIf } from '@angular/common';
2727
import { IgxPaginatorComponent, IgxPaginatorContentDirective } from '../../paginator/paginator.component';
28-
import { IGridRowEventArgs, IgxGridFooterComponent, IgxGridRow, IgxGroupByRow, IgxSummaryRow } from '../public_api';
28+
import { IGridRowEventArgs, IgxColumnGroupComponent, IgxGridFooterComponent, IgxGridRow, IgxGroupByRow, IgxSummaryRow } from '../public_api';
2929
import { getComponentSize } from '../../core/utils';
3030
import { setElementSize } from '../../test-utils/helper-utils.spec';
3131

@@ -1900,6 +1900,20 @@ describe('IgxGrid Component Tests #grid', () => {
19001900

19011901
expect(calcWidth).not.toBe(80);
19021902
});
1903+
1904+
it('should correctly autosize column headers inside column groups.', async () => {
1905+
const fix = TestBed.createComponent(IgxGridColumnHeaderInGroupAutoSizeComponent);
1906+
const grid = fix.componentInstance.grid;
1907+
grid.data = [{field1: "Test"}];
1908+
1909+
//waiting for reqeustAnimationFrame to finish
1910+
fix.detectChanges();
1911+
await wait(17);
1912+
fix.detectChanges();
1913+
1914+
const calcWidth = parseInt(grid.getColumnByName("field1").calcWidth);
1915+
expect(calcWidth).toBe(126);
1916+
});
19031917
});
19041918

19051919
describe('IgxGrid - API methods', () => {
@@ -2994,6 +3008,36 @@ export class IgxGridColumnHeaderAutoSizeComponent {
29943008

29953009
}
29963010

3011+
@Component({
3012+
template: `
3013+
<igx-grid #grid>
3014+
<igx-column-group>
3015+
<igx-column
3016+
field="field1"
3017+
header="Field 1 Header"
3018+
width="auto"
3019+
></igx-column>
3020+
<igx-column
3021+
field="field2"
3022+
header="Field 2 Header"
3023+
width="auto"
3024+
></igx-column>
3025+
<igx-column
3026+
field="field3"
3027+
header="Field 3 Header"
3028+
width="auto"
3029+
></igx-column>
3030+
</igx-column-group>
3031+
</igx-grid>`,
3032+
standalone: true,
3033+
imports: [IgxGridComponent, IgxColumnComponent, IgxColumnGroupComponent]
3034+
3035+
})
3036+
export class IgxGridColumnHeaderInGroupAutoSizeComponent {
3037+
@ViewChild('grid', { read: IgxGridComponent, static: true })
3038+
public grid: IgxGridComponent;
3039+
}
3040+
29973041
@Component({
29983042
template: `<igx-grid #grid [data]="data" [width]="'500px'" (columnInit)="initColumns($event)">
29993043
<igx-column *ngFor="let col of columns" [field]="col.key" [header]="col.key" [dataType]="col.dataType">

projects/igniteui-angular/src/lib/grids/grid/grid.multi-row-layout.integration.spec.ts

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { By } from '@angular/platform-browser';
44
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
55
import { IgxGridComponent } from './grid.component';
66
import { SampleTestData } from '../../test-utils/sample-test-data.spec';
7-
import { ViewChild, Component } from '@angular/core';
7+
import { ViewChild, Component, DebugElement } from '@angular/core';
88
import { IgxColumnLayoutComponent } from '../columns/column-layout.component';
99
import { wait, UIInteractions } from '../../test-utils/ui-interactions.spec';
1010
import { DefaultSortingStrategy, SortingDirection } from '../../data-operations/sorting-strategy';
@@ -30,6 +30,7 @@ interface ColGroupsType {
3030
describe('IgxGrid - multi-row-layout Integration #grid - ', () => {
3131
let fixture: ComponentFixture<FixtureType>;
3232
let grid: IgxGridComponent;
33+
const COLUMN_HEADER_CLASS = '.igx-grid-th';
3334
configureTestSuite((() => {
3435
return TestBed.configureTestingModule({
3536
imports: [
@@ -900,6 +901,30 @@ describe('IgxGrid - multi-row-layout Integration #grid - ', () => {
900901
expect((grid.verticalScrollContainer.getScroll().children[0] as HTMLElement).offsetHeight -
901902
grid.verticalScrollContainer.getScroll().offsetHeight).toBeLessThanOrEqual(0);
902903
});
904+
905+
it('should create only one ghost element when dragging a column', async () => {
906+
const headers: DebugElement[] = fixture.debugElement.queryAll(By.css(COLUMN_HEADER_CLASS));
907+
908+
const header = headers[1].nativeElement;
909+
UIInteractions.simulatePointerEvent('pointerdown', header, 50, 50);
910+
await wait();
911+
fixture.detectChanges();
912+
913+
UIInteractions.simulatePointerEvent('pointermove', header, 56, 56);
914+
await wait(50);
915+
fixture.detectChanges();
916+
917+
UIInteractions.simulatePointerEvent('pointermove', header, 230, 30);
918+
await wait();
919+
fixture.detectChanges();
920+
921+
const ghost = fixture.debugElement.queryAll(By.css('.igx-grid__drag-ghost-image'));
922+
expect(ghost.length).toEqual(1);
923+
924+
UIInteractions.simulatePointerEvent('pointerup', header, 230, 30);
925+
await wait();
926+
fixture.detectChanges();
927+
});
903928
});
904929

905930
describe('Resizing', () => {
@@ -1339,6 +1364,19 @@ export class ColumnLayoutGroupingTestComponent extends ColumnLayoutPinningTestCo
13391364
{ field: 'Country', rowStart: 2, colStart: 2, groupable: true },
13401365
{ field: 'Address', rowStart: 3, colStart: 1, colEnd: 3 }
13411366
];
1367+
1368+
public override colGroups: ColGroupsType[] = [
1369+
{
1370+
group: 'group1',
1371+
pinned: true,
1372+
columns: this.cols2
1373+
},
1374+
{
1375+
group: 'group2',
1376+
pinned: false,
1377+
columns: this.cols1
1378+
}
1379+
];
13421380
}
13431381
@Component({
13441382
template: `

projects/igniteui-angular/src/lib/grids/headers/grid-header-group.component.html

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@
1111
<igx-grid-header-group *ngIf="!child.hidden" class="igx-grid-thead__subgroup"
1212
[ngClass]="child.headerGroupClasses"
1313
[ngStyle]="child.headerGroupStyles | igxHeaderGroupStyle:child:grid.pipeTrigger"
14-
[column]="child"
15-
[igxColumnMovingDrag]="child"
16-
[ghostHost]="grid.outlet.nativeElement"
17-
[attr.droppable]="true"
18-
[igxColumnMovingDrop]="child">
14+
[column]="child">
1915
</igx-grid-header-group>
2016
</ng-container>
2117
</div>
@@ -70,8 +66,8 @@
7066
[ngClass]="child.headerGroupClasses"
7167
[ngStyle]="child.headerGroupStyles | igxHeaderGroupStyle:child:grid.pipeTrigger"
7268
[column]="child"
73-
[style.min-width]="child.calcWidth | igxHeaderGroupWidth:grid.defaultHeaderGroupMinWidth:grid.hasColumnLayouts"
74-
[style.flex-basis]="child.calcWidth | igxHeaderGroupWidth:grid.defaultHeaderGroupMinWidth:grid.hasColumnLayouts">
69+
[style.min-width]="child.resolvedWidth | igxHeaderGroupWidth:grid.defaultHeaderGroupMinWidth:grid.hasColumnLayouts"
70+
[style.flex-basis]="child.resolvedWidth | igxHeaderGroupWidth:grid.defaultHeaderGroupMinWidth:grid.hasColumnLayouts">
7571
</igx-grid-header-group>
7672
</ng-container>
7773
</div>

projects/igniteui-angular/src/lib/navigation-drawer/navigation-drawer.directives.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,24 @@ import { Directive, HostBinding, Input, TemplateRef, booleanAttribute } from '@a
88
export class IgxNavDrawerItemDirective {
99

1010
/**
11-
* @hidden
11+
* Styles a navigation drawer item as selected.
12+
* If not set, `active` will have default value `false`.
13+
*
14+
* @example
15+
* ```html
16+
* <span igxDrawerItem [active]="true">Active Item</span>
17+
* ```
1218
*/
1319
@Input({ alias: 'active', transform: booleanAttribute }) public active = false;
1420

1521
/**
16-
* @hidden
22+
* Styles a navigation drawer item as a group header.
23+
* If not set, `isHeader` will have default value `false`.
24+
*
25+
* @example
26+
* ```html
27+
* <span igxDrawerItem [isHeader]="true">Header</span>
28+
* ```
1729
*/
1830
@Input({ alias: 'isHeader', transform: booleanAttribute }) public isHeader = false;
1931

0 commit comments

Comments
 (0)