Skip to content

Commit 1c9e3e3

Browse files
authored
Merge pull request #10429 from IgniteUI/mkirova/fix-scrollbar-syncs
Make pivot row dimension content in rows simpler. Use ngFor instead o…
2 parents 070471a + c999a5c commit 1c9e3e3

File tree

6 files changed

+64
-8
lines changed

6 files changed

+64
-8
lines changed

projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-grid.module.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { IgxPivotRowComponent } from './pivot-row.component';
55
import { IgxPivotRowPipe, IgxPivotColumnPipe, IgxPivotGridFilterPipe, IgxPivotRowExpansionPipe } from './pivot-grid.pipes';
66
import { IgxGridComponent } from '../grid/grid.component';
77
import { IgxPivotHeaderRowComponent } from './pivot-header-row.component';
8+
import { IgxPivotRowDimensionContentComponent } from './pivot-row-dimension-content.component';
89

910
/**
1011
* @hidden
@@ -14,6 +15,7 @@ import { IgxPivotHeaderRowComponent } from './pivot-header-row.component';
1415
IgxPivotGridComponent,
1516
IgxPivotRowComponent,
1617
IgxPivotHeaderRowComponent,
18+
IgxPivotRowDimensionContentComponent,
1719
IgxPivotRowPipe,
1820
IgxPivotRowExpansionPipe,
1921
IgxPivotColumnPipe,
@@ -24,6 +26,7 @@ import { IgxPivotHeaderRowComponent } from './pivot-header-row.component';
2426
IgxPivotGridComponent,
2527
IgxPivotRowComponent,
2628
IgxPivotHeaderRowComponent,
29+
IgxPivotRowDimensionContentComponent,
2730
IgxPivotRowExpansionPipe,
2831
IgxPivotRowPipe,
2932
IgxPivotColumnPipe,

projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-header-row.component.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="igx-grid-thead__wrapper" role="row" [style.width.px]="width" *ngIf="!row">
1+
<div class="igx-grid-thead__wrapper" role="row" [style.width.px]="width">
22
<div class="igx-grid__tr" role="row" [style.width.px]="width">
33
<div #pivotFilterContainer class="igx-grid__tr-action" [style.min-width.px]="grid.pivotRowWidths"
44
(igxDragEnter)="onAreaDragEnter($event, filterArea, 2)" (igxDragLeave)="onAreaDragLeave($event, filterArea)"
@@ -68,7 +68,7 @@
6868
<!-- Column headers area -->
6969
<div class="igx-grid__tr" role="row" [style.width.px]="width">
7070

71-
<ng-container *ngIf="!row">
71+
<ng-container>
7272
<div #pivotContainer class="igx-grid__tr-action" [style.min-width.px]="grid.pivotRowWidths"
7373
(igxDragEnter)="onAreaDragEnter($event, rowArea, 0)" (igxDragLeave)="onAreaDragLeave($event, rowArea)"
7474
igxDrop (dropped)="onDimDrop($event, rowArea, 0)" (pointerdown)="$event.preventDefault()"
@@ -106,7 +106,7 @@
106106
<!-- Unpinned columns collection -->
107107
<ng-template igxGridFor #headerVirtualContainer let-column
108108
[igxGridForOf]="unpinnedColumnCollection | igxTopLevel" [igxForScrollContainer]="grid.parentVirtDir"
109-
[igxForContainerSize]=" row ? grid.pivotRowWidths : grid.unpinnedWidth"
109+
[igxForContainerSize]="grid.unpinnedWidth"
110110
[igxForTrackBy]="grid.trackColumnChanges" [igxForSizePropName]="'calcPixelWidth'"
111111
[igxForScrollOrientation]="'horizontal'">
112112
<igx-grid-header-group [ngClass]="column.headerGroupClasses"
@@ -130,5 +130,5 @@
130130
</div>
131131
</div>
132132
<!-- Header thumb area -->
133-
<div *ngIf="!row" class="igx-grid-thead__thumb" [hidden]="!grid.hasVerticalScroll()" [style.width.px]="grid.scrollSize">
133+
<div class="igx-grid-thead__thumb" [hidden]="!grid.hasVerticalScroll()" [style.width.px]="grid.scrollSize">
134134
</div>

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ export interface IgxGridRowSelectorsTemplateContext {
3535
templateUrl: './pivot-header-row.component.html'
3636
})
3737
export class IgxPivotHeaderRowComponent extends IgxGridHeaderRowComponent {
38-
@Input()
39-
public row: IgxPivotRowComponent;
4038

4139
private _dropPos = DropPosition.AfterDropTarget;
4240
private _dropLeftIndicatorClass = 'igx-pivot-grid__drop-indicator--left';
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<div role="rowgroup" class="igx-grid-thead__wrapper" [style.width.px]="width"
2+
[attr.aria-activedescendant]="activeDescendant" [class.igx-grid__tr--mrl]="hasMRL">
3+
<!-- Column headers area -->
4+
<div class="igx-grid__tr" role="row" [style.width.px]="width">
5+
<!-- Unpinned columns collection -->
6+
<ng-template ngFor #headerVirtualContainer let-column
7+
[ngForOf]="unpinnedColumnCollection | igxTopLevel">
8+
<igx-grid-header-group [ngClass]="column.headerGroupClasses"
9+
[ngStyle]="column.headerGroupStyles |igxHeaderGroupStyle:column:grid.pipeTrigger" [column]="column"
10+
[style.min-width]="column.calcWidth | igxHeaderGroupWidth:grid.defaultHeaderGroupMinWidth:hasMRL"
11+
[style.flex-basis]="column.calcWidth | igxHeaderGroupWidth:grid.defaultHeaderGroupMinWidth:hasMRL">
12+
</igx-grid-header-group>
13+
</ng-template>
14+
</div>
15+
</div>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import {
2+
ChangeDetectionStrategy,
3+
ChangeDetectorRef,
4+
Component,
5+
ElementRef,
6+
Input,
7+
Renderer2
8+
} from '@angular/core';
9+
import { IBaseChipEventArgs } from '../../chips/chip.component';
10+
import { IgxGridHeaderRowComponent } from '../headers/grid-header-row.component';
11+
import { DropPosition } from '../moving/moving.service';
12+
import { PivotDimensionType } from './pivot-grid.interface';
13+
import { IgxPivotRowComponent } from './pivot-row.component';
14+
15+
export interface IgxGridRowSelectorsTemplateContext {
16+
$implicit: {
17+
selectedCount: number;
18+
totalCount: number;
19+
selectAll?: () => void;
20+
deselectAll?: () => void;
21+
};
22+
}
23+
24+
/**
25+
*
26+
* For all intents & purposes treat this component as what a <thead> usually is in the default <table> element.
27+
*
28+
* This container holds the pivot grid header elements and their behavior/interactions.
29+
*
30+
* @hidden @internal
31+
*/
32+
@Component({
33+
changeDetection: ChangeDetectionStrategy.OnPush,
34+
selector: 'igx-pivot-row-dimension-content',
35+
templateUrl: './pivot-row-dimension-content.component.html'
36+
})
37+
export class IgxPivotRowDimensionContentComponent extends IgxGridHeaderRowComponent {
38+
@Input()
39+
public row: IgxPivotRowComponent;
40+
}

projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-row.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- Row Dimension -->
22
<div #rowDimensionContainer>
3-
<igx-pivot-header-row class="igx-grid-thead" tabindex="0"
3+
<igx-pivot-row-dimension-content class="igx-grid-thead" tabindex="0"
44
[grid]="grid"
55
[hasMRL]="grid.hasColumnLayouts"
66
[density]="grid.displayDensity"
@@ -10,7 +10,7 @@
1010
(scroll)="grid.preventHeaderScroll($event)"
1111
[row]="this"
1212
>
13-
</igx-pivot-header-row>
13+
</igx-pivot-row-dimension-content>
1414
</div>
1515

1616

0 commit comments

Comments
 (0)