• 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

4.17
/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',
UNCOV
16
    providers: [{ provide: IgxRowDirective, useExisting: forwardRef(() => IgxTreeGridRowComponent) }],
×
17
    imports: [NgTemplateOutlet, NgIf, IgxRowDragDirective, IgxGridForOfDirective, IgxGridCellComponent, NgClass, NgStyle, IgxTreeGridCellComponent, IgxCheckboxComponent, NgFor, IgxGridNotGroupedPipe, IgxGridCellStylesPipe, IgxGridCellStyleClassesPipe, IgxGridDataMapperPipe, IgxGridTransactionStatePipe]
18
})
19
export class IgxTreeGridRowComponent extends IgxRowDirective implements DoCheck {
2✔
20
    @ViewChildren('treeCell')
21
    protected override _cells: QueryList<any>;
22

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

28
    private _treeRow: ITreeGridRecord;
29

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

43
    public set treeRow(value: ITreeGridRecord) {
UNCOV
44
        if (this._treeRow !== value) {
×
UNCOV
45
            this._treeRow = value;
×
UNCOV
46
            this.data = this._treeRow.data;
×
47
        }
48
    }
49

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

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

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

87
    /**
88
     * @hidden
89
     */
90
    public override get hasChildren(): boolean {
UNCOV
91
        return true;
×
92
    }
93

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

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

119
    /**
120
     * @hidden
121
     * @internal
122
     */
123
    public override get viewIndex(): number {
UNCOV
124
        return this.index + this.grid.page * this.grid.perPage;
×
125
    }
126

127
    /**
128
     * @hidden
129
     */
130
    public get showIndicator() {
UNCOV
131
        return this.grid.loadChildrenOnDemand ?
×
132
            this.grid.expansionStates.has(this.key) ?
×
133
                this.treeRow.children && this.treeRow.children.length :
×
134
                this.grid.hasChildrenKey ?
×
135
                    this.data[this.grid.hasChildrenKey] :
136
                    true :
137
            this.treeRow.children && this.treeRow.children.length;
×
138
    }
139

140
    /**
141
     * @hidden
142
     */
143
    public get indeterminate(): boolean {
UNCOV
144
        return this.selectionService.isRowInIndeterminateState(this.key);
×
145
    }
146

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

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