• 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

24.14
/projects/igniteui-angular/src/lib/grids/hierarchical-grid/hierarchical-cell.component.ts
1
import { IgxGridCellComponent } from '../cell.component';
2
import { ChangeDetectorRef, ElementRef, ChangeDetectionStrategy, Component, OnInit, NgZone, Inject } from '@angular/core';
3
import { IgxGridSelectionService } from '../selection/selection.service';
4
import { HammerGesturesManager } from '../../core/touch';
5
import { PlatformUtil } from '../../core/utils';
6
import { GridType, IGX_GRID_BASE } from '../common/grid.interface';
7
import { IgxOverlayService } from '../../services/public_api';
8
import { IgxGridCellImageAltPipe, IgxStringReplacePipe, IgxColumnFormatterPipe } from '../common/pipes';
9
import { IgxTooltipDirective } from '../../directives/tooltip/tooltip.directive';
10
import { IgxTooltipTargetDirective } from '../../directives/tooltip/tooltip-target.directive';
11
import { IgxSuffixDirective } from '../../directives/suffix/suffix.directive';
12
import { IgxPrefixDirective } from '../../directives/prefix/prefix.directive';
13
import { IgxDateTimeEditorDirective } from '../../directives/date-time-editor/date-time-editor.directive';
14
import { IgxTimePickerComponent } from '../../time-picker/time-picker.component';
15
import { IgxDatePickerComponent } from '../../date-picker/date-picker.component';
16
import { IgxCheckboxComponent } from '../../checkbox/checkbox.component';
17
import { IgxTextSelectionDirective } from '../../directives/text-selection/text-selection.directive';
18
import { IgxFocusDirective } from '../../directives/focus/focus.directive';
19
import { IgxInputDirective } from '../../directives/input/input.directive';
20
import { IgxInputGroupComponent } from '../../input-group/input-group.component';
21
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
22
import { IgxIconComponent } from '../../icon/icon.component';
23
import { IgxTextHighlightDirective } from '../../directives/text-highlight/text-highlight.directive';
24
import { IgxChipComponent } from '../../chips/chip.component';
25
import { NgIf, NgClass, NgTemplateOutlet, DecimalPipe, PercentPipe, CurrencyPipe, DatePipe } from '@angular/common';
26

27
@Component({
28
    changeDetection: ChangeDetectionStrategy.OnPush,
29
    selector: 'igx-hierarchical-grid-cell',
30
    templateUrl: '../cell.component.html',
31
    providers: [HammerGesturesManager],
32
    imports: [NgIf, IgxChipComponent, IgxTextHighlightDirective, IgxIconComponent, NgClass, FormsModule, ReactiveFormsModule, IgxInputGroupComponent, IgxInputDirective, IgxFocusDirective, IgxTextSelectionDirective, IgxCheckboxComponent, IgxDatePickerComponent, IgxTimePickerComponent, IgxDateTimeEditorDirective, IgxPrefixDirective, IgxSuffixDirective, NgTemplateOutlet, IgxTooltipTargetDirective, IgxTooltipDirective, IgxGridCellImageAltPipe, IgxStringReplacePipe, IgxColumnFormatterPipe, DecimalPipe, PercentPipe, CurrencyPipe, DatePipe]
33
})
34
export class IgxHierarchicalGridCellComponent extends IgxGridCellComponent implements OnInit {
2✔
35
    // protected hSelection;
36
    protected _rootGrid;
37

38
    constructor(
39
        selectionService: IgxGridSelectionService,
40
        @Inject(IGX_GRID_BASE) grid: GridType,
41
        @Inject(IgxOverlayService) overlayService: IgxOverlayService,
42
        cdr: ChangeDetectorRef,
43
        helement: ElementRef<HTMLElement>,
44
        zone: NgZone,
45
        touchManager: HammerGesturesManager,
46
        platformUtil: PlatformUtil
47
    ) {
48
        super(selectionService, grid, overlayService, cdr, helement, zone, touchManager, platformUtil);
15✔
49
    }
50

51
    public override ngOnInit() {
52
        super.ngOnInit();
15✔
53
        this._rootGrid = this._getRootGrid();
15✔
54
    }
55

56
    /**
57
     * @hidden
58
     * @internal
59
     */
60
    public override activate(event: FocusEvent) {
UNCOV
61
        this._clearAllHighlights();
×
UNCOV
62
        const currentElement = this.grid.nativeElement;
×
UNCOV
63
        let parentGrid = this.grid;
×
64
        let childGrid;
65
        // add highligh to the current grid
UNCOV
66
        if (this._rootGrid.id !== currentElement.id) {
×
UNCOV
67
            currentElement.classList.add('igx-grid__tr--highlighted');
×
68
        }
69

70
        // add highligh to the current grid
UNCOV
71
        while (this._rootGrid.id !== parentGrid.id) {
×
UNCOV
72
            childGrid = parentGrid;
×
UNCOV
73
            parentGrid = parentGrid.parent;
×
74

UNCOV
75
            const parentRowID = parentGrid.gridAPI.getParentRowId(childGrid);
×
UNCOV
76
            parentGrid.highlightedRowID = parentRowID;
×
77
        }
UNCOV
78
        this.grid.navigation.activeNode.gridID = this.gridID;
×
UNCOV
79
        super.activate(event);
×
80
    }
81

82
    private _getRootGrid() {
83
        let currGrid = this.grid;
15✔
84
        while (currGrid.parent) {
15✔
UNCOV
85
            currGrid = currGrid.parent;
×
86
        }
87
        return currGrid;
15✔
88
    }
89

90
    // TODO: Extend the new selection service to avoid complete traversal
91
    private _clearAllHighlights() {
UNCOV
92
        [this._rootGrid, ...this._rootGrid.getChildGrids(true)].forEach(grid => {
×
UNCOV
93
            if (grid !== this.grid && grid.navigation.activeNode) {
×
UNCOV
94
                grid.navigation.clearActivation();
×
UNCOV
95
                grid.selectionService.initKeyboardState();
×
UNCOV
96
                grid.selectionService.clear();
×
97
            }
98

UNCOV
99
            grid.selectionService.activeElement = null;
×
UNCOV
100
            grid.nativeElement.classList.remove('igx-grid__tr--highlighted');
×
UNCOV
101
            grid.highlightedRowID = null;
×
UNCOV
102
            grid.cdr.markForCheck();
×
103
        });
104
    }
105
}
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