• 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

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

37
@Component({
38
    changeDetection: ChangeDetectionStrategy.OnPush,
39
    selector: 'igx-expandable-grid-cell',
40
    templateUrl: 'expandable-cell.component.html',
41
    providers: [HammerGesturesManager],
42
    imports: [NgIf, IgxChipComponent, IgxTextHighlightDirective, IgxIconComponent, NgClass, FormsModule, ReactiveFormsModule, IgxInputGroupComponent, IgxInputDirective, IgxFocusDirective, IgxCheckboxComponent, IgxDatePickerComponent, IgxTimePickerComponent, IgxDateTimeEditorDirective, IgxPrefixDirective, IgxSuffixDirective, NgTemplateOutlet, IgxTooltipTargetDirective, IgxTooltipDirective, IgxGridCellImageAltPipe, IgxStringReplacePipe, IgxColumnFormatterPipe, DecimalPipe, PercentPipe, CurrencyPipe, DatePipe]
43
})
44
export class IgxGridExpandableCellComponent extends IgxGridCellComponent implements OnInit {
2✔
45
    /**
46
     * @hidden
47
     */
48
    @Input()
UNCOV
49
    public expanded = false;
×
50

51
    @ViewChild('indicator', { read: ElementRef })
52
    public indicator: ElementRef;
53

54
    @ViewChild('indentationDiv', { read: ElementRef })
55
    public indentationDiv: ElementRef;
56

57
    /**
58
     * @hidden
59
     */
60
    @ViewChild('defaultExpandedTemplate', { read: TemplateRef, static: true })
61
    protected defaultExpandedTemplate: TemplateRef<any>;
62

63
    /**
64
     * @hidden
65
     */
66
    @ViewChild('defaultCollapsedTemplate', { read: TemplateRef, static: true })
67
    protected defaultCollapsedTemplate: TemplateRef<any>;
68

69
    constructor(selectionService: IgxGridSelectionService,
70
                @Inject(IGX_GRID_BASE) grid: GridType,
71
                @Inject(IgxOverlayService) overlayService: IgxOverlayService,
72
                cdr: ChangeDetectorRef,
73
                element: ElementRef,
74
                zone: NgZone,
75
                touchManager: HammerGesturesManager,
UNCOV
76
                @Inject(DOCUMENT) public document,
×
77
                platformUtil: PlatformUtil) {
UNCOV
78
        super(selectionService, grid, overlayService, cdr, element, zone, touchManager, platformUtil);
×
79
    }
80

81
    /**
82
     * @hidden
83
     */
84
    public toggle(event: Event) {
UNCOV
85
        event.stopPropagation();
×
UNCOV
86
        const expansionState = this.grid.gridAPI.get_row_expansion_state(this.intRow.data);
×
UNCOV
87
        this.grid.gridAPI.set_row_expansion_state(this.intRow.key, !expansionState, event);
×
88
    }
89

90
    /**
91
     * @hidden
92
     */
93
    public onIndicatorFocus() {
94
        this.grid.gridAPI.update_cell(this.grid.crudService.cell);
×
95
    }
96

97
    /**
98
     * @hidden
99
     */
100
    public override calculateSizeToFit(range: any): number {
UNCOV
101
        let leftPadding = 0;
×
UNCOV
102
        if (this.indentationDiv) {
×
UNCOV
103
            const indentationStyle = this.document.defaultView.getComputedStyle(this.indentationDiv.nativeElement);
×
UNCOV
104
            leftPadding = parseFloat(indentationStyle.paddingLeft);
×
105
        }
UNCOV
106
        const contentWidth = this.platformUtil.getNodeSizeViaRange(range, this.nativeElement);
×
UNCOV
107
        return contentWidth + leftPadding;
×
108
    }
109

110
    /**
111
     * @hidden
112
     */
113
    public get iconTemplate() {
UNCOV
114
        if (this.expanded) {
×
UNCOV
115
            return this.grid.rowExpandedIndicatorTemplate || this.defaultExpandedTemplate;
×
116
        } else {
UNCOV
117
            return this.grid.rowCollapsedIndicatorTemplate || this.defaultCollapsedTemplate;
×
118
        }
119
    }
120

121
    /**
122
     * @hidden
123
     */
124
    public get showExpanderIndicator() {
UNCOV
125
        const isGhost = this.intRow.pinned && this.intRow.disabled;
×
UNCOV
126
        return !this.editMode && (!this.intRow.pinned || isGhost);
×
127
    }
128
}
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