Skip to content

Commit 59c12a5

Browse files
Merge branch '10.1.x' into astaev/issue7569-master
2 parents e74fe37 + 7aff8c8 commit 59c12a5

File tree

7 files changed

+79
-18
lines changed

7 files changed

+79
-18
lines changed

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

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2003,7 +2003,7 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
20032003
/**
20042004
* @hidden @internal
20052005
*/
2006-
@ContentChildren(IgxRowEditTabStopDirective)
2006+
@ContentChildren(IgxRowEditTabStopDirective, { descendants: true })
20072007
public rowEditTabsCUSTOM: QueryList<IgxRowEditTabStopDirective>;
20082008

20092009
/**
@@ -4702,14 +4702,37 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
47024702
return 0;
47034703
}
47044704

4705+
/**
4706+
* @hidden
4707+
*/
4708+
protected getComputedHeight(elem) {
4709+
return elem.offsetHeight ? parseFloat(this.document.defaultView.getComputedStyle(elem).getPropertyValue('height')) : 0;
4710+
}
4711+
/**
4712+
* @hidden
4713+
*/
4714+
protected getFooterHeight(): number {
4715+
return this.summariesHeight || this.getComputedHeight(this.tfoot.nativeElement);
4716+
}
4717+
/**
4718+
* @hidden
4719+
*/
4720+
protected getTheadRowHeight(): number {
4721+
const height = this.getComputedHeight(this.theadRow.nativeElement);
4722+
return (!this.allowFiltering || (this.allowFiltering && this.filterMode !== FilterMode.quickFilter)) ?
4723+
height - this.getFilterCellHeight() :
4724+
height;
4725+
}
4726+
47054727
/**
47064728
* @hidden
47074729
*/
47084730
protected getToolbarHeight(): number {
47094731
let toolbarHeight = 0;
47104732
if (this.showToolbar && this.toolbarHtml != null) {
4733+
const height = this.getComputedHeight(this.toolbarHtml.nativeElement);
47114734
toolbarHeight = this.toolbarHtml.nativeElement.firstElementChild ?
4712-
this.toolbarHtml.nativeElement.offsetHeight : 0;
4735+
height : 0;
47134736
}
47144737
return toolbarHeight;
47154738
}
@@ -4720,8 +4743,9 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
47204743
protected getPagingFooterHeight(): number {
47214744
let pagingHeight = 0;
47224745
if (this.footer) {
4746+
const height = this.getComputedHeight(this.footer.nativeElement);
47234747
pagingHeight = this.footer.nativeElement.firstElementChild ?
4724-
this.footer.nativeElement.offsetHeight : 0;
4748+
height : 0;
47254749
}
47264750
return pagingHeight;
47274751
}
@@ -4744,17 +4768,15 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
47444768
if (!this._height) {
47454769
return null;
47464770
}
4747-
4748-
const actualTheadRow = (!this.allowFiltering || (this.allowFiltering && this.filterMode !== FilterMode.quickFilter)) ?
4749-
this.theadRow.nativeElement.offsetHeight - this.getFilterCellHeight() :
4750-
this.theadRow.nativeElement.offsetHeight;
4751-
const footerHeight = this.summariesHeight || this.tfoot.nativeElement.offsetHeight - this.tfoot.nativeElement.clientHeight;
4771+
const actualTheadRow = this.getTheadRowHeight();
4772+
const footerHeight = this.getFooterHeight();
47524773
const toolbarHeight = this.getToolbarHeight();
47534774
const pagingHeight = this.getPagingFooterHeight();
47544775
const groupAreaHeight = this.getGroupAreaHeight();
4776+
const scrHeight = this.getComputedHeight(this.scr.nativeElement);
47554777
const renderedHeight = toolbarHeight + actualTheadRow +
47564778
footerHeight + pagingHeight + groupAreaHeight +
4757-
this.scr.nativeElement.clientHeight;
4779+
scrHeight;
47584780

47594781
let gridHeight = 0;
47604782

@@ -4765,13 +4787,13 @@ export class IgxGridBaseDirective extends DisplayDensityBase implements
47654787
const bodyHeight = this.getDataBasedBodyHeight();
47664788
return bodyHeight > 0 ? bodyHeight : null;
47674789
}
4768-
gridHeight = parseInt(computed, 10);
4790+
gridHeight = parseFloat(computed);
47694791
} else {
47704792
gridHeight = parseInt(this._height, 10);
47714793
}
47724794
const height = Math.abs(gridHeight - renderedHeight);
47734795

4774-
if (height === 0 || isNaN(gridHeight)) {
4796+
if (Math.round(height) === 0 || isNaN(gridHeight)) {
47754797
const bodyHeight = this.defaultTargetBodyHeight;
47764798
return bodyHeight > 0 ? bodyHeight : null;
47774799
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ export class IgxGridComponent extends IgxGridBaseDirective implements GridType,
925925
* @hidden @internal
926926
*/
927927
protected getGroupAreaHeight(): number {
928-
return this.groupArea ? this.groupArea.nativeElement.offsetHeight : 0;
928+
return this.groupArea ? this.getComputedHeight(this.groupArea.nativeElement) : 0;
929929
}
930930

931931
/**

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,28 @@ describe('IgxHierarchicalGrid selection #hGrid', () => {
688688
expect(hierarchicalGrid.getRowByKey('2').selected).toBeTrue();
689689
expect(hierarchicalGrid.getRowByKey('0').selected).toBeFalse();
690690
});
691+
692+
it('Should not clear root selection state when changing selection mode of child grid', () => {
693+
rowIsland1.rowSelection = GridSelectionMode.multiple;
694+
fix.componentInstance.selectedRows = ['0', '1'];
695+
fix.detectChanges();
696+
expect(hierarchicalGrid.getRowByKey('0').selected).toBeTrue();
697+
698+
const thirdRow = hierarchicalGrid.getRowByIndex(2) as IgxHierarchicalRowComponent;
699+
thirdRow.toggle();
700+
fix.detectChanges();
701+
702+
const childGrid = rowIsland1.rowIslandAPI.getChildGrids()[0];
703+
childGrid.selectedRows = ['20', '21'];
704+
fix.detectChanges();
705+
expect(hierarchicalGrid.selectedRows.length).toEqual(2);
706+
expect(childGrid.selectedRows.length).toEqual(2);
707+
708+
rowIsland1.rowSelection = GridSelectionMode.single;
709+
fix.detectChanges();
710+
expect(hierarchicalGrid.selectedRows.length).toEqual(2);
711+
expect(childGrid.selectedRows.length).toEqual(0);
712+
});
691713
});
692714

693715
describe('Row Selection CRUD', () => {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ export interface IGridCreatedEventArgs extends IBaseEventArgs {
5151
changeDetection: ChangeDetectionStrategy.OnPush,
5252
selector: 'igx-row-island',
5353
template: ``,
54-
providers: [IgxRowIslandAPIService]
54+
providers: [IgxRowIslandAPIService,
55+
IgxGridSelectionService]
5556
})
5657
export class IgxRowIslandComponent extends IgxHierarchicalGridBaseDirective
5758
implements AfterContentInit, AfterViewInit, OnChanges, OnInit, OnDestroy, DoCheck {

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,18 +183,20 @@ describe('IgxTreeGrid - Summaries #tGrid', () => {
183183
expect(summaries.length).toBe(0);
184184
});
185185

186-
it('should position correctly summary row for collapsed rows -- bottom position', () => {
186+
it('should position correctly summary row for collapsed rows -- bottom position', async() => {
187187
treeGrid.expandAll();
188188
fix.detectChanges();
189189

190190
treeGrid.summaryCalculationMode = 'childLevelsOnly';
191191
fix.detectChanges();
192+
await wait(30);
192193

193194
let summaries = GridSummaryFunctions.getAllVisibleSummaries(fix);
194195
expect(summaries.length).toBe(4);
195196

196197
treeGrid.showSummaryOnCollapse = true;
197198
fix.detectChanges();
199+
await wait(30);
198200

199201
treeGrid.toggleRow(treeGrid.getRowByIndex(3).rowID);
200202
fix.detectChanges();
@@ -225,15 +227,17 @@ describe('IgxTreeGrid - Summaries #tGrid', () => {
225227
['Count', 'Earliest', 'Latest'], ['2', 'Nov 11, 2009', 'Oct 17, 2015']);
226228
});
227229

228-
it('should position correctly summary row for collapsed rows -- top position', () => {
230+
it('should position correctly summary row for collapsed rows -- top position', async() => {
229231
treeGrid.expandAll();
230232
fix.detectChanges();
231233

232234
treeGrid.summaryCalculationMode = 'childLevelsOnly';
233235
fix.detectChanges();
236+
await wait(30);
234237

235238
treeGrid.showSummaryOnCollapse = true;
236239
fix.detectChanges();
240+
await wait(30);
237241

238242
let summaries = GridSummaryFunctions.getAllVisibleSummaries(fix);
239243
expect(summaries.length).toBe(4);

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,14 @@
1010
margin-bottom: 16px;
1111
max-width: 900px;
1212
}
13+
14+
.references {
15+
font-size: .75em;
16+
}
17+
18+
.references > p {
19+
margin: 0;
20+
letter-spacing: initial;
21+
line-height: initial;
22+
font-size: 1em;
23+
}

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
[filterMode]="'excelStyleFilter'"
2323
[paging]="false"
2424
[width]="'900px'"
25-
[height]="'800px'">
25+
>
2626
<igx-column *ngFor="let c of columns" [field]="c.field"
2727
[header]="c.field"
2828
[movable]="c.movable"
@@ -37,8 +37,9 @@
3737
[dataType]="c.type">
3838
</igx-column>
3939
<igx-grid-footer>
40-
<div style='height:200px;'>
41-
Test
40+
<div class="references">
41+
<p>Test</p>
42+
<p>Test2</p>
4243
</div>
4344
</igx-grid-footer>
4445
</igx-grid>

0 commit comments

Comments
 (0)