• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

IgniteUI / igniteui-angular / 13331632524

14 Feb 2025 02:51PM CUT coverage: 22.015% (-69.6%) from 91.622%
13331632524

Pull #15372

github

web-flow
Merge d52d57714 into bcb78ae0a
Pull Request #15372: chore(*): test ci passing

1990 of 15592 branches covered (12.76%)

431 of 964 new or added lines in 18 files covered. (44.71%)

19956 existing lines in 307 files now uncovered.

6452 of 29307 relevant lines covered (22.02%)

249.17 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

2.27
/projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-row-dimension-header-group.component.ts
1
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, HostBinding, HostListener, Inject, Input, NgZone, ViewChild } from '@angular/core';
2
import { PlatformUtil } from '../../core/utils';
3
import { IgxColumnComponent } from '../columns/column.component';
4
import { IGX_GRID_BASE, PivotGridType } from '../common/grid.interface';
5
import { IgxFilteringService } from '../filtering/grid-filtering.service';
6
import { IgxGridHeaderGroupComponent } from '../headers/grid-header-group.component';
7
import { IgxPivotColumnResizingService } from '../resizing/pivot-grid/pivot-resizing.service';
8
import { IPivotDimension, PivotRowHeaderGroupType } from './pivot-grid.interface';
9
import { IgxPivotRowDimensionHeaderComponent } from './pivot-row-dimension-header.component';
10
import { IgxHeaderGroupStylePipe } from '../headers/pipes';
11
import { IgxPivotResizeHandleDirective } from '../resizing/pivot-grid/pivot-resize-handle.directive';
12
import { IgxColumnMovingDropDirective } from '../moving/moving.drop.directive';
13
import { IgxColumnMovingDragDirective } from '../moving/moving.drag.directive';
14
import { NgIf, NgClass, NgStyle } from '@angular/common';
15
import { IgxIconComponent } from '../../icon/icon.component';
16
import { IMultiRowLayoutNode } from '../common/types';
17

18
/**
19
 * @hidden
20
 */
21
@Component({
22
    changeDetection: ChangeDetectionStrategy.OnPush,
23
    selector: 'igx-pivot-row-dimension-header-group',
24
    templateUrl: './pivot-row-dimension-header-group.component.html',
25
    imports: [IgxIconComponent, NgIf, IgxPivotRowDimensionHeaderComponent, NgClass, NgStyle, IgxColumnMovingDragDirective, IgxColumnMovingDropDirective, IgxPivotResizeHandleDirective, IgxHeaderGroupStylePipe]
26
})
27
export class IgxPivotRowDimensionHeaderGroupComponent extends IgxGridHeaderGroupComponent implements PivotRowHeaderGroupType {
2✔
28

29
    /**
30
     * @hidden
31
     */
32
    @HostBinding('style.user-select')
UNCOV
33
    public userSelect = 'none';
×
34

UNCOV
35
    constructor(private cdRef: ChangeDetectorRef,
×
UNCOV
36
        @Inject(IGX_GRID_BASE) public override grid: PivotGridType,
×
UNCOV
37
        private elementRef: ElementRef<HTMLElement>,
×
UNCOV
38
        public override colResizingService: IgxPivotColumnResizingService,
×
39
        filteringService: IgxFilteringService,
40
        platform: PlatformUtil,
UNCOV
41
        protected zone: NgZone) {
×
UNCOV
42
        super(cdRef, grid, elementRef, colResizingService, filteringService, platform);
×
43
    }
44

45
    /**
46
     * @hidden
47
     * @internal
48
     */
49
    @Input()
50
    public rowIndex: number;
51

52
    /**
53
     * @hidden
54
     * @internal
55
     */
56
    @Input()
57
    public colIndex: number;
58

59

60
    /**
61
     * @hidden
62
     * @internal
63
     */
64
    @Input()
65
    public layout: IMultiRowLayoutNode;
66

67
    /**
68
    * @hidden
69
    * @internal
70
    */
71
    @Input()
72
    public parent: any;
73

74
    @ViewChild(IgxPivotRowDimensionHeaderComponent)
75
    public override header: IgxPivotRowDimensionHeaderComponent;
76

77
    @HostBinding('attr.id')
78
    public override get headerID() {
UNCOV
79
        return `${this.grid.id}_-2_${this.rowIndex}_${this.visibleIndex}`;
×
80
    }
81

82
    @HostBinding('attr.title')
83
    public override get title() {
UNCOV
84
        return this.column.header;
×
85
    }
86

87
    /**
88
     * @hidden @internal
89
     */
90
    @HostListener('click', ['$event'])
91
    public onClick(event: MouseEvent) {
UNCOV
92
        if (this.grid.rowSelection === 'none') {
×
UNCOV
93
            return;
×
94
        }
UNCOV
95
        event?.stopPropagation();
×
UNCOV
96
        const key = this.parent.getRowDimensionKey(this.column as IgxColumnComponent);
×
UNCOV
97
        if (this.grid.selectionService.isRowSelected(key)) {
×
UNCOV
98
            this.grid.selectionService.deselectRow(key, event);
×
99
        } else {
UNCOV
100
            this.grid.selectionService.selectRowById(key, true, event);
×
101
        }
102

UNCOV
103
        this.zone.run(() => {});
×
104
    }
105

106
    /**
107
     * @hidden
108
     * @internal
109
     */
110
    public get visibleIndex(): number {
UNCOV
111
        if (this.grid.hasHorizontalLayout) {
×
UNCOV
112
            return this.colIndex;
×
113
        }
114

UNCOV
115
        const field = this.column.field;
×
UNCOV
116
        const rows = this.grid.rowDimensions;
×
UNCOV
117
        const rootDimension = this.findRootDimension(field);
×
UNCOV
118
        return rows.indexOf(rootDimension);
×
119
    }
120

121
    @HostBinding('class.igx-grid-th--active')
122
    public override get active() {
UNCOV
123
        const nav = this.grid.navigation;
×
UNCOV
124
        const node = nav.activeNode;
×
UNCOV
125
        return node && !this.column.columnGroup ?
×
126
            nav.isRowHeaderActive &&
×
127
            node.row === this.rowIndex &&
128
            node.column === this.visibleIndex :
129
            false;
130
    }
131

132
    protected override get activeNode() {
UNCOV
133
        this.grid.navigation.isRowHeaderActive = true;
×
UNCOV
134
        this.grid.navigation.isRowDimensionHeaderActive = false;
×
UNCOV
135
        return {
×
136
            row: this.rowIndex, column: this.visibleIndex, level: null,
137
            mchCache: null,
138
            layout: this.layout || null
×
139
        };
140
    }
141

142
    private findRootDimension(field: string): IPivotDimension {
UNCOV
143
        const rows = this.grid.rowDimensions;
×
144
        let tempRow;
UNCOV
145
        let result = null;
×
UNCOV
146
        rows.forEach(row => {
×
UNCOV
147
            tempRow = row;
×
UNCOV
148
            do {
×
UNCOV
149
                if (tempRow.memberName === field) {
×
UNCOV
150
                    result = row;
×
151
                }
UNCOV
152
                tempRow = tempRow.childLevel;
×
153
            } while (tempRow)
154
        });
UNCOV
155
        return result;
×
156
    }
157

158

159
    public override activate() {
UNCOV
160
        this.grid.navigation.isRowHeader = true;
×
UNCOV
161
        this.grid.navigation.setActiveNode(this.activeNode);
×
162
    }
163

164
    /**
165
     * @hidden @internal
166
     */
167
    public override pointerdown(_event: PointerEvent): void {
UNCOV
168
        this.activate();
×
169
    }
170

171
    /**
172
     * @hidden @internal
173
     */
174
    public override onMouseDown(_event: MouseEvent): void {
UNCOV
175
        this.activate();
×
176
    }
177

178
    public override get selectable(): boolean {
179
        return false;
×
180
    }
181
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc