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

IgniteUI / igniteui-angular / 6797384210

08 Nov 2023 11:09AM UTC coverage: 91.853% (-0.3%) from 92.123%
6797384210

push

github

web-flow
Merge pull request #13613 from IgniteUI/mkirova/fix-empty-pivot

fix(igxPivotGrid): Add check in case data is empty due to removing al…

12459 of 14514 branches covered (0.0%)

1 of 1 new or added line in 1 file covered. (100.0%)

2127 existing lines in 217 files now uncovered.

25413 of 27667 relevant lines covered (91.85%)

31122.38 hits per line

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

87.5
/projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-row.component.ts
1
import { Component, forwardRef, Input, ViewChildren, QueryList, HostBinding, DoCheck, ChangeDetectionStrategy } from '@angular/core';
2
import { IgxRowDirective } from '../row.directive';
3
import { ITreeGridRecord } from './tree-grid.interfaces';
4
import { IgxGridNotGroupedPipe, IgxGridCellStylesPipe, IgxGridCellStyleClassesPipe, IgxGridDataMapperPipe, IgxGridTransactionStatePipe } from '../common/pipes';
5
import { IgxCheckboxComponent } from '../../checkbox/checkbox.component';
6
import { IgxTreeGridCellComponent } from './tree-cell.component';
7
import { IgxGridCellComponent } from '../cell.component';
8
import { IgxGridForOfDirective } from '../../directives/for-of/for_of.directive';
9
import { IgxRowDragDirective } from '../row-drag.directive';
10
import { NgTemplateOutlet, NgIf, NgClass, NgStyle, NgFor } from '@angular/common';
11

12
@Component({
13
    changeDetection: ChangeDetectionStrategy.OnPush,
14
    selector: 'igx-tree-grid-row',
15
    templateUrl: 'tree-grid-row.component.html',
16
    providers: [{ provide: IgxRowDirective, useExisting: forwardRef(() => IgxTreeGridRowComponent) }],
5,564✔
17
    standalone: true,
18
    imports: [NgTemplateOutlet, NgIf, IgxRowDragDirective, IgxGridForOfDirective, IgxGridCellComponent, NgClass, NgStyle, IgxTreeGridCellComponent, IgxCheckboxComponent, NgFor, IgxGridNotGroupedPipe, IgxGridCellStylesPipe, IgxGridCellStyleClassesPipe, IgxGridDataMapperPipe, IgxGridTransactionStatePipe]
19
})
20
export class IgxTreeGridRowComponent extends IgxRowDirective implements DoCheck {
2✔
21
    @ViewChildren('treeCell')
22
    protected override _cells: QueryList<any>;
23

24
    /**
25
     * @hidden
26
     */
27
    public isLoading: boolean;
28

29
    private _treeRow: ITreeGridRecord;
30

31
    /**
32
     * The `ITreeGridRecord` passed to the row component.
33
     *
34
     * ```typescript
35
     * const row = this.grid.getRowByKey(1) as IgxTreeGridRowComponent;
36
     * const treeRow = row.treeRow;
37
     * ```
38
     */
39
    @Input()
40
    public get treeRow(): ITreeGridRecord {
41
        return this._treeRow;
121,841✔
42
    }
43

44
    public set treeRow(value: ITreeGridRecord) {
45
        if (this._treeRow !== value) {
10,360✔
46
            this._treeRow = value;
10,360✔
47
            this.data = this._treeRow.data;
10,360✔
48
        }
49
    }
50

51
    /**
52
     * Sets whether the row is pinned.
53
     * Default value is `false`.
54
     * ```typescript
55
     * this.grid.selectedRows[0].pinned = true;
56
     * ```
57
     */
58
    public override set pinned(value: boolean) {
UNCOV
59
        if (value) {
×
UNCOV
60
            this.grid.pinRow(this.key);
×
61
        } else {
UNCOV
62
            this.grid.unpinRow(this.key);
×
63
        }
64
    }
65

66
    /**
67
     * Gets whether the row is pinned.
68
     * ```typescript
69
     * let isPinned = row.pinned;
70
     * ```
71
     */
72
    public override get pinned() {
73
        return this.grid.isRecordPinned(this._treeRow);
153,304✔
74
    }
75

76
    /**
77
     * @hidden
78
     */
79
    public override get isRoot(): boolean {
80
        let treeRec = this.treeRow;
56✔
81
        const isPinnedArea = this.pinned && !this.disabled;
56✔
82
        if (isPinnedArea) {
56✔
83
            treeRec = this.grid.unpinnedRecords.find(x => x.data === this.data);
83✔
84
        }
85
        return treeRec?.level === 0;
56✔
86
    }
87

88
    /**
89
     * @hidden
90
     */
91
    public override get hasChildren(): boolean {
92
        return true;
42✔
93
    }
94

95
    /**
96
     * Returns a value indicating whether the row component is expanded.
97
     *
98
     * ```typescript
99
     * const row = this.grid.getRowByKey(1) as IgxTreeGridRowComponent;
100
     * const expanded = row.expanded;
101
     * ```
102
     */
103
    @HostBinding('attr.aria-expanded')
104
    public override get expanded(): boolean {
105
        return this._treeRow.expanded;
66,464✔
106
    }
107

108
    /**
109
     * Sets a value indicating whether the row component is expanded.
110
     *
111
     * ```typescript
112
     * const row = this.grid.getRowByKey(1) as IgxTreeGridRowComponent;
113
     * row.expanded = true;
114
     * ```
115
     */
116
    public override set expanded(value: boolean) {
117
        this.grid.gridAPI.set_row_expansion_state(this._treeRow.key, value);
11✔
118
    }
119

120
    /**
121
     * @hidden
122
     * @internal
123
     */
124
    public override get viewIndex(): number {
125
        return this.index + this.grid.page * this.grid.perPage;
310,595✔
126
    }
127

128
    /**
129
     * @hidden
130
     */
131
    public get showIndicator() {
132
        return this.grid.loadChildrenOnDemand ?
33,293✔
133
            this.grid.expansionStates.has(this.key) ?
209✔
134
                this.treeRow.children && this.treeRow.children.length :
88✔
135
                this.grid.hasChildrenKey ?
161✔
136
                    this.data[this.grid.hasChildrenKey] :
137
                    true :
138
            this.treeRow.children && this.treeRow.children.length;
55,320✔
139
    }
140

141
    /**
142
     * @hidden
143
     */
144
    public get indeterminate(): boolean {
145
        return this.selectionService.isRowInIndeterminateState(this.key);
4,156✔
146
    }
147

148
    /**
149
     * @hidden
150
     */
151
    public override ngDoCheck() {
152
        this.isLoading = this.grid.loadChildrenOnDemand ? this.grid.loadingRows.has(this.key) : false;
33,074✔
153
        super.ngDoCheck();
33,074✔
154
    }
155

156
    /**
157
     * Spawns the add child row UI for the specific row.
158
     *
159
     * @example
160
     * ```typescript
161
     * const row = this.grid.getRowByKey(1) as IgxTreeGridRowComponent;
162
     * row.beginAddChild();
163
     * ```
164
     * @param rowID
165
     */
166
    public beginAddChild() {
167
        this.grid.crudService.enterAddRowMode(this, true);
1✔
168
    }
169
}
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

© 2026 Coveralls, Inc