Skip to content

Commit f5be5a6

Browse files
authored
Merge branch '9.1.x' into mvenkov/input-with-null-value
2 parents fe90d39 + 326f2a2 commit f5be5a6

File tree

6 files changed

+53
-27
lines changed

6 files changed

+53
-27
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4656,9 +4656,9 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
46564656
/**
46574657
* @hidden
46584658
*/
4659-
protected getPagingHeight(): number {
4659+
protected getPagingFooterHeight(): number {
46604660
let pagingHeight = 0;
4661-
if (this.paging && this.footer) {
4661+
if (this.footer) {
46624662
pagingHeight = this.footer.nativeElement.firstElementChild ?
46634663
this.footer.nativeElement.offsetHeight : 0;
46644664
}
@@ -4689,7 +4689,7 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
46894689
this.theadRow.nativeElement.offsetHeight;
46904690
const footerHeight = this.summariesHeight || this.tfoot.nativeElement.offsetHeight - this.tfoot.nativeElement.clientHeight;
46914691
const toolbarHeight = this.getToolbarHeight();
4692-
const pagingHeight = this.getPagingHeight();
4692+
const pagingHeight = this.getPagingFooterHeight();
46934693
const groupAreaHeight = this.getGroupAreaHeight();
46944694
const renderedHeight = toolbarHeight + actualTheadRow +
46954695
footerHeight + pagingHeight + groupAreaHeight +

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,6 +1742,10 @@ describe('IgxGrid Component Tests #grid', () => {
17421742
const footerContent = footer.textContent.trim();
17431743

17441744
expect(footerContent).toEqual('Custom content');
1745+
const grid = fix.componentInstance.grid;
1746+
1747+
const expectedHeight = parseInt(grid.height, 10) - grid.theadRow.nativeElement.offsetHeight - grid.scrollSize - 100;
1748+
expect(expectedHeight - grid.calcHeight).toBeLessThanOrEqual(1);
17451749
});
17461750
});
17471751

@@ -2129,15 +2133,19 @@ export class IgxGridColumnPercentageWidthComponent extends IgxGridDefaultRenderi
21292133
@Component({
21302134
template:
21312135
`<div>
2132-
<igx-grid #grid [data]="data" [displayDensity]="'compact'" [autoGenerate]="true"
2133-
[paging]="true" [perPage]="5">
2136+
<igx-grid #grid [data]="data" height='300px' [displayDensity]="'compact'" [autoGenerate]="true"
2137+
>
21342138
<igx-grid-footer>
2135-
Custom content
2139+
<div style='height:100px;'>
2140+
Custom content
2141+
</div>
21362142
</igx-grid-footer>
21372143
</igx-grid>
21382144
</div>`
21392145
})
21402146
export class IgxGridWithCustomFooterComponent extends IgxGridTestComponent {
2147+
public data = SampleTestData.foodProductData();
2148+
@ViewChild(IgxGridComponent, { static: true }) public grid: IgxGridComponent;
21412149
}
21422150
@Component({
21432151
template:

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,11 +1033,11 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
10331033
* @inheritdoc
10341034
*/
10351035
getSelectedData(formatters = false, headers = false): any[] {
1036-
if (this.groupingExpressions.length) {
1036+
if (this.groupingExpressions.length || this.hasDetails) {
10371037
const source = [];
10381038

10391039
const process = (record) => {
1040-
if (record.expression || record.summaries) {
1040+
if (record.expression || record.summaries || this.isDetailRecord(record)) {
10411041
source.push(null);
10421042
return;
10431043
}

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

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -800,10 +800,13 @@ describe('IgxGrid Master Detail #grid', () => {
800800
});
801801

802802
describe('Cell Selection', () => {
803-
it('Should exclude expanded detail views when doing range cell selection', fakeAsync(() => {
803+
beforeEach(fakeAsync(() => {
804804
fix = TestBed.createComponent(DefaultGridMasterDetailComponent);
805805
grid = fix.componentInstance.grid;
806806
fix.detectChanges();
807+
}));
808+
809+
it('Should exclude expanded detail views when doing range cell selection', fakeAsync(() => {
807810
grid.expandRow(fix.componentInstance.data[2].ID);
808811
const selectionChangeSpy = spyOn<any>(grid.onRangeSelection, 'emit').and.callThrough();
809812
const startCell = grid.getCellByColumn(1, 'ContactName');
@@ -839,6 +842,22 @@ describe('IgxGrid Master Detail #grid', () => {
839842
expect(selectionChangeSpy).toHaveBeenCalledWith(range);
840843
expect(rowDetail.querySelector('[class*="selected"]')).toBeNull();
841844
}));
845+
846+
it('getSelectedData should return correct values when there are master details', fakeAsync(() => {
847+
const range = { rowStart: 0, rowEnd: 5, columnStart: 'ContactName', columnEnd: 'ContactName' };
848+
const expectedData = [
849+
{ ContactName: 'Maria Anders' },
850+
{ ContactName: 'Ana Trujillo' },
851+
{ ContactName: 'Antonio Moreno' }
852+
];
853+
grid.expandAll();
854+
tick(100);
855+
fix.detectChanges();
856+
857+
grid.selectRange(range);
858+
fix.detectChanges();
859+
expect(grid.getSelectedData()).toEqual(expectedData);
860+
}));
842861
});
843862

844863
describe('Row Selection', () => {
@@ -1081,10 +1100,12 @@ describe('IgxGrid Master Detail #grid', () => {
10811100
describe('GroupBy', () => {
10821101
beforeEach(fakeAsync(() => {
10831102
fix = TestBed.createComponent(DefaultGridMasterDetailComponent);
1084-
fix.componentInstance.columns[0].hasSummary = true;
10851103
fix.detectChanges();
10861104

10871105
grid = fix.componentInstance.grid;
1106+
grid.getColumnByName('ContactName').hasSummary = true;
1107+
fix.detectChanges();
1108+
10881109
grid.summaryCalculationMode = GridSummaryCalculationMode.childLevelsOnly;
10891110
grid.groupingExpressions =
10901111
[{ fieldName: 'CompanyName', dir: SortingDirection.Asc, ignoreCase: false }];
@@ -1173,9 +1194,7 @@ describe('IgxGrid Master Detail #grid', () => {
11731194
template: `
11741195
<igx-grid [data]="data" [width]="width" [height]="height" [primaryKey]="'ID'" [allowFiltering]='true'
11751196
[paging]="paging" [perPage]="perPage" [rowSelection]="rowSelectable">
1176-
<igx-column *ngFor="let c of columns" [field]="c.field" [header]="c.field" [width]="c.width" [dataType]='c.dataType'
1177-
[hidden]='c.hidden' [sortable]="c.sortable" [movable]='c.movable' [groupable]='c.groupable' [editable]="c.editable"
1178-
[hasSummary]="c.hasSummary" [pinned]='c.pinned'>
1197+
<igx-column *ngFor="let c of columns" [field]="c.field" [width]="c.width" [dataType]='c.dataType'>
11791198
</igx-column>
11801199
11811200
<ng-template igxGridDetail let-dataItem>
@@ -1214,9 +1233,7 @@ export class DefaultGridMasterDetailComponent {
12141233
template: `
12151234
<igx-grid [data]="data" [expansionStates]='expStates'
12161235
[width]="width" [height]="height" [primaryKey]="'ID'" [paging]="paging" [rowSelection]="rowSelectable">
1217-
<igx-column *ngFor="let c of columns" [field]="c.field" [header]="c.field" [width]="c.width" [dataType]='c.dataType'
1218-
[hidden]='c.hidden' [sortable]="c.sortable" [movable]='c.movable' [groupable]='c.groupable' [editable]="c.editable"
1219-
[hasSummary]="c.hasSummary" [pinned]='c.pinned'>
1236+
<igx-column *ngFor="let c of columns" [field]="c.field" [header]="c.field" [width]="c.width" [dataType]='c.dataType'>
12201237
</igx-column>
12211238
12221239
<ng-template igxGridDetail let-dataItem>

projects/igniteui-angular/src/lib/list/list.component.spec.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -700,23 +700,20 @@ describe('List', () => {
700700
});
701701

702702
it('should allow setting the index of list items', (async () => {
703-
pending('Related to the bug #7054');
704703
const fixture = TestBed.createComponent(ListWithIgxForAndScrollingComponent);
705704
fixture.detectChanges();
706-
await wait();
705+
await wait(50);
707706

708707
fixture.componentInstance.igxFor.scrollTo(8);
709-
await wait(200);
710-
fixture.detectChanges();
711-
await wait(200);
708+
await wait(50);
712709
fixture.detectChanges();
713710

714711
const items = fixture.debugElement.queryAll(By.css('igx-list-item'));
715712
const len = items.length;
716-
expect(items[0].nativeElement.textContent).toContain('3');
717-
expect(fixture.componentInstance.forOfList.items[0].index).toEqual(2);
718-
expect(items[len - 1].nativeElement.textContent).toContain('11');
719-
expect(fixture.componentInstance.forOfList.items[len - 1].index).toEqual(10);
713+
expect(items[0].nativeElement.textContent).toContain('2');
714+
expect(fixture.componentInstance.forOfList.items[0].index).toEqual(1);
715+
expect(items[len - 1].nativeElement.textContent).toContain('10');
716+
expect(fixture.componentInstance.forOfList.items[len - 1].index).toEqual(9);
720717
}));
721718

722719
it('should return items as they appear in the list with virtualization', (async () => {
@@ -727,8 +724,6 @@ describe('List', () => {
727724
fixture.componentInstance.igxFor.scrollTo(6);
728725
await wait(50);
729726
fixture.detectChanges();
730-
await wait(50);
731-
fixture.detectChanges();
732727

733728
const dItems = GridFunctions.sortDebugElementsVertically(fixture.debugElement.queryAll(By.css('igx-list-item')));
734729
const pItems = fixture.componentInstance.forOfList.items;
@@ -737,6 +732,7 @@ describe('List', () => {
737732
expect(dItems[i].nativeElement).toEqual(pItems[i].element);
738733
}
739734
}));
735+
740736
it('Initializes igxListThumbnail directive', () => {
741737
const fixture = TestBed.createComponent(ListDirectivesComponent);
742738
fixture.detectChanges();

src/app/grid-column-moving/grid-column-moving.sample.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@
3636
[hasSummary]="false"
3737
[dataType]="c.type">
3838
</igx-column>
39+
<igx-grid-footer>
40+
<div style='height:200px;'>
41+
Test
42+
</div>
43+
</igx-grid-footer>
3944
</igx-grid>
4045
Drag mode: {{ grid1.selectionService.dragMode }}
4146
<div class="sample-buttons">

0 commit comments

Comments
 (0)