• 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.33
/projects/igniteui-angular/src/lib/grids/pivot-grid/pivot-row.component.ts
1
import {
2
    ChangeDetectionStrategy,
3
    ChangeDetectorRef,
4
    Component,
5
    ElementRef,
6
    forwardRef,
7
    HostBinding, Inject, Input, ViewContainerRef
8
} from '@angular/core';
9
import { IgxColumnComponent } from '../columns/column.component';
10
import { IGX_GRID_BASE, PivotGridType } from '../common/grid.interface';
11
import { IgxRowDirective } from '../row.directive';
12
import { IgxGridSelectionService } from '../selection/selection.service';
13
import { IPivotGridColumn, IPivotGridRecord } from './pivot-grid.interface';
14
import { PivotUtil } from './pivot-util';
15
import { IgxPivotGridCellStyleClassesPipe } from './pivot-grid.pipes';
16
import { IgxGridNotGroupedPipe, IgxGridCellStylesPipe, IgxGridDataMapperPipe, IgxGridTransactionStatePipe } from '../common/pipes';
17
import { IgxCheckboxComponent } from '../../checkbox/checkbox.component';
18
import { NgClass, NgStyle } from '@angular/common';
19
import { IgxGridCellComponent } from '../cell.component';
20
import { IgxGridForOfDirective } from '../../directives/for-of/for_of.directive';
21

22
@Component({
23
    changeDetection: ChangeDetectionStrategy.OnPush,
24
    selector: 'igx-pivot-row',
25
    templateUrl: './pivot-row.component.html',
UNCOV
26
    providers: [{ provide: IgxRowDirective, useExisting: forwardRef(() => IgxPivotRowComponent) }],
×
27
    imports: [IgxGridForOfDirective, IgxGridCellComponent, NgClass, NgStyle, IgxCheckboxComponent, IgxGridNotGroupedPipe, IgxGridCellStylesPipe, IgxGridDataMapperPipe, IgxGridTransactionStatePipe, IgxPivotGridCellStyleClassesPipe]
28
})
29
export class IgxPivotRowComponent extends IgxRowDirective {
2✔
30
    /**
31
     * @hidden
32
     */
33
    @Input()
34
    @HostBinding('attr.aria-selected')
35
    public override get selected(): boolean {
UNCOV
36
        let isSelected = false;
×
UNCOV
37
        for (const rowDim of this.data.dimensions) {
×
UNCOV
38
            const key = PivotUtil.getRecordKey(this.data, rowDim);
×
UNCOV
39
            if (this.selectionService.isPivotRowSelected(key)) {
×
UNCOV
40
                isSelected = true;
×
41
            }
42
        }
UNCOV
43
        return isSelected;
×
44
    }
45

46
    constructor(
UNCOV
47
        @Inject(IGX_GRID_BASE) public override grid: PivotGridType,
×
48
        selectionService: IgxGridSelectionService,
49
        element: ElementRef<HTMLElement>,
50
        cdr: ChangeDetectorRef,
UNCOV
51
        protected viewRef: ViewContainerRef
×
52
    ) {
UNCOV
53
        super(grid, selectionService, element, cdr);
×
54
    }
55

56
    /**
57
     * @hidden
58
     * @internal
59
     */
60
    public override get viewIndex(): number {
UNCOV
61
        return this.index;
×
62
    }
63

64
    /**
65
     * @hidden
66
     * @internal
67
     */
UNCOV
68
    public override disabled = false;
×
69

70
    /**
71
     * @hidden
72
     * @internal
73
     */
74
    public override get addRowUI(): any {
UNCOV
75
        return false;
×
76
    }
77

78
    /**
79
     * @hidden
80
     * @internal
81
     */
82
    public override get inEditMode(): boolean {
UNCOV
83
        return false;
×
84
    }
85

86
    /**
87
     * @hidden
88
     * @internal
89
     */
90
    public override set pinned(_value: boolean) {
91
    }
92

93
    public override get pinned(): boolean {
UNCOV
94
        return false;
×
95
    }
96

97
    /**
98
     * @hidden
99
     * @internal
100
     */
101
    public override delete() {
102
    }
103

104
    /**
105
     * @hidden
106
     * @internal
107
     */
108
    public override beginAddRow() {
109
    }
110

111
    /**
112
     * @hidden
113
     * @internal
114
     */
115
    public override update(_value: any) {
116
    }
117

118
    /**
119
     * @hidden
120
     * @internal
121
     */
122
    public override pin() {
123
        return false;
×
124
    }
125

126
    /**
127
    * @hidden
128
    * @internal
129
    */
130
    public override unpin() {
131
        return false;
×
132
    }
133

134
    /**
135
    *  The pivot record data passed to the row component.
136
    *
137
    * ```typescript
138
    * // get the pivot row data for the first selected row
139
    * let selectedRowData = this.grid.selectedRows[0].data;
140
    * ```
141
    */
142
    @Input()
143
    public override get data(): IPivotGridRecord {
UNCOV
144
        return this._data;
×
145
    }
146

147
    public override set data(v: IPivotGridRecord) {
UNCOV
148
        this._data = v;
×
149
    }
150

151
    /**
152
     * @hidden
153
     * @internal
154
     */
155
    public get pivotAggregationData() {
UNCOV
156
        const aggregations = this.data.aggregationValues;
×
UNCOV
157
        const obj = {};
×
UNCOV
158
        aggregations.forEach((value, key) => {
×
UNCOV
159
            obj[key] = value;
×
160
        });
UNCOV
161
        return obj;
×
162
    }
163

164
    public getCellClass(col: IgxColumnComponent) {
UNCOV
165
        const values = this.grid.values;
×
UNCOV
166
        if (values.length === 1) {
×
UNCOV
167
            return values[0].styles;
×
168
        }
UNCOV
169
        const colName = col.field.split(this.grid.pivotKeys.columnDimensionSeparator);
×
UNCOV
170
        const measureName = colName[colName.length - 1];
×
UNCOV
171
        return values.find(v => v.member === measureName)?.styles;
×
172
    }
173

174
    public override isCellActive(visibleColumnIndex) {
UNCOV
175
        const nav = this.grid.navigation
×
UNCOV
176
        const node = nav.activeNode;
×
UNCOV
177
        return node && Object.keys(node).length !== 0 ?
×
178
            !nav.isRowHeaderActive &&
×
179
            !nav.isRowDimensionHeaderActive &&
180
            super.isCellActive(visibleColumnIndex) :
181
            false;
182
    }
183

184
    public getColumnData(col: IgxColumnComponent) : IPivotGridColumn {
UNCOV
185
        const path = col.field.split(this.grid.pivotKeys.columnDimensionSeparator);
×
UNCOV
186
        const keyValueMap = new Map<string, string>();
×
UNCOV
187
        const colDimensions = PivotUtil.flatten(this.grid.columnDimensions);
×
UNCOV
188
        for (const dim of colDimensions) {
×
UNCOV
189
            keyValueMap.set(dim.memberName, path.shift());
×
190
        }
191
        let pivotValue;
UNCOV
192
        if (this.grid.hasMultipleValues) {
×
UNCOV
193
            pivotValue = this.grid.values.find(x => x.member === path.shift());
×
194
        } else {
UNCOV
195
            pivotValue = this.grid.values ? this.grid.values[0] : undefined;
×
196
        }
UNCOV
197
        return {
×
198
            field: col.field,
199
            dimensions: this.grid.columnDimensions,
200
            dimensionValues: keyValueMap,
201
            value: pivotValue
202
        };
203
    }
204
}
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