• 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

3.13
/projects/igniteui-angular/src/lib/grids/resizing/resize-handle.directive.ts
1
import {
2
    AfterViewInit,
3
    Directive,
4
    ElementRef,
5
    Input,
6
    NgZone,
7
    HostListener,
8
    OnDestroy
9
} from '@angular/core';
10
import { Subject, fromEvent } from 'rxjs';
11
import { debounceTime, takeUntil } from 'rxjs/operators';
12
import { ColumnType } from '../common/grid.interface';
13
import { IgxColumnResizingService } from './resizing.service';
14

15

16
/**
17
 * @hidden
18
 * @internal
19
 */
20
@Directive({
21
    selector: '[igxResizeHandle]',
22
    standalone: true
23
})
24
export class IgxResizeHandleDirective implements AfterViewInit, OnDestroy {
2✔
25

26
    /**
27
     * @hidden
28
     */
29
    @Input('igxResizeHandle')
30
    public column: ColumnType;
31

32
    /**
33
     * @hidden
34
     */
UNCOV
35
    protected _dblClick = false;
×
36

37
    /**
38
     * @hidden
39
     */
UNCOV
40
    private destroy$ = new Subject<boolean>();
×
41

UNCOV
42
    private readonly DEBOUNCE_TIME = 200;
×
43

UNCOV
44
    constructor(protected zone: NgZone,
×
UNCOV
45
        protected element: ElementRef,
×
UNCOV
46
        public colResizingService: IgxColumnResizingService) { }
×
47

48
    /**
49
     * @hidden
50
     */
51
    @HostListener('dblclick')
52
    public onDoubleClick() {
UNCOV
53
        this._dblClick = true;
×
UNCOV
54
        this.initResizeService();
×
UNCOV
55
        this.colResizingService.autosizeColumnOnDblClick();
×
56
    }
57

58
    /**
59
     * @hidden
60
     */
61
    public ngOnDestroy() {
UNCOV
62
        this.destroy$.next(true);
×
UNCOV
63
        this.destroy$.complete();
×
64
    }
65

66
    /**
67
     * @hidden
68
     */
69
    public ngAfterViewInit() {
UNCOV
70
        if (!this.column.columnGroup && this.column.resizable) {
×
UNCOV
71
            this.zone.runOutsideAngular(() => {
×
UNCOV
72
                fromEvent(this.element.nativeElement, 'mousedown').pipe(
×
73
                    debounceTime(this.DEBOUNCE_TIME),
74
                    takeUntil(this.destroy$)
75
                ).subscribe((event: MouseEvent) => {
76

UNCOV
77
                    if (this._dblClick) {
×
78
                        this._dblClick = false;
×
79
                        return;
×
80
                    }
81

UNCOV
82
                    if (event.button === 0) {
×
UNCOV
83
                        this._onResizeAreaMouseDown(event);
×
UNCOV
84
                        this.column.grid.resizeLine.resizer.onMousedown(event);
×
85
                    }
86
                });
87
            });
88

UNCOV
89
            fromEvent(this.element.nativeElement, 'mouseup').pipe(
×
90
                debounceTime(this.DEBOUNCE_TIME),
91
                takeUntil(this.destroy$)
92
            ).subscribe(() => {
UNCOV
93
                this.colResizingService.isColumnResizing = false;
×
UNCOV
94
                this.colResizingService.showResizer = false;
×
UNCOV
95
                this.column.grid.cdr.detectChanges();
×
96
            });
97
        }
98
    }
99

100
    /**
101
     * @hidden
102
     */
103
    private _onResizeAreaMouseDown(event) {
UNCOV
104
        this.initResizeService(event);
×
105

UNCOV
106
        this.colResizingService.showResizer = true;
×
UNCOV
107
        this.column.grid.cdr.detectChanges();
×
108
    }
109

110
    /**
111
     * @hidden
112
     */
113
    protected initResizeService(event = null) {
×
UNCOV
114
        this.colResizingService.column = this.column;
×
115

UNCOV
116
        if (event) {
×
UNCOV
117
            this.colResizingService.isColumnResizing = true;
×
UNCOV
118
            this.colResizingService.startResizePos = event.clientX;
×
119
        }
120
    }
121
}
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