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

atinc / ngx-tethys / d9ae709b-3c27-4b69-b125-b8b80b54f90b

pending completion
d9ae709b-3c27-4b69-b125-b8b80b54f90b

Pull #2757

circleci

mengshuicmq
fix: fix code review
Pull Request #2757: feat(color-picker): color-picker support disabled (#INFR-8645)

98 of 6315 branches covered (1.55%)

Branch coverage included in aggregate %.

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

2392 of 13661 relevant lines covered (17.51%)

83.12 hits per line

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

11.76
/src/nav/nav-ink-bar.directive.ts
1
import { ANIMATION_MODULE_TYPE, Directive, ElementRef, Inject, Input, NgZone, Optional } from '@angular/core';
2
import { InputBoolean } from 'ngx-tethys/core';
3
import { take } from 'rxjs/operators';
4

5
/**
6
 * @internal
7
 */
8
@Directive({
1✔
9
    selector: 'thy-nav-ink-bar, [thyNavInkBar]',
10
    host: {
×
11
        class: 'thy-nav-ink-bar',
12
        '[class.thy-nav-ink-bar-animated]': 'animated'
13
    },
×
14
    standalone: true
×
15
})
×
16
export class ThyNavInkBarDirective {
17
    @Input() @InputBoolean() isVertical: boolean;
18

×
19
    @Input() @InputBoolean() showInkBar: boolean;
×
20

×
21
    get animated(): boolean {
×
22
        return this.animationMode !== 'NoopAnimations' && this.showInkBar;
23
    }
24
    constructor(
25
        private elementRef: ElementRef<HTMLElement>,
26
        private ngZone: NgZone,
×
27
        @Optional() @Inject(ANIMATION_MODULE_TYPE) public animationMode?: string
×
28
    ) {}
×
29

×
30
    public alignToElement(element: HTMLElement): void {
×
31
        this.show();
×
32
        this.ngZone.run(() => {
×
33
            this.ngZone.onStable.pipe(take(1)).subscribe(() => {
34
                this.setStyles(element);
35
            });
×
36
        });
×
37
    }
×
38

×
39
    private setStyles(element: HTMLElement): void {
40
        const inkBar: HTMLElement = this.elementRef.nativeElement;
41
        if (!this.isVertical) {
42
            inkBar.style.top = '';
×
43
            inkBar.style.bottom = '0px';
44
            inkBar.style.height = '2px';
45
            inkBar.style.left = this.getLeftPosition(element);
×
46
            inkBar.style.width = this.getElementWidth(element);
47
        } else {
48
            inkBar.style.left = '';
×
49
            inkBar.style.width = '2px';
50
            inkBar.style.top = this.getTopPosition(element);
51
            inkBar.style.height = this.getElementHeight(element);
×
52
        }
53
    }
54

×
55
    private getLeftPosition(element: HTMLElement): string {
56
        return element ? `${element.offsetLeft || 0}px` : '0';
57
    }
×
58

59
    private getElementWidth(element: HTMLElement): string {
1✔
60
        return element ? `${element.offsetWidth || 0}px` : '0';
61
    }
62

63
    private getTopPosition(element: HTMLElement): string {
64
        return element ? `${element.offsetTop || 0}px` : '0';
1✔
65
    }
66

67
    private getElementHeight(element: HTMLElement): string {
68
        return element ? `${element.offsetHeight || 0}px` : '0';
69
    }
1✔
70

71
    private show() {
72
        this.elementRef.nativeElement.style.visibility = 'visible';
73
    }
1✔
74

75
    public hide() {
76
        this.elementRef.nativeElement.style.visibility = 'hidden';
77
    }
1✔
78
}
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