• 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

14.29
/src/fullscreen/fullscreen.component.ts
1
import { Component, ContentChild, ElementRef, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';
2
import { EMPTY, fromEvent, Subject } from 'rxjs';
3
import { switchMap, takeUntil } from 'rxjs/operators';
4

5
import { ThyFullscreen } from './fullscreen.service';
6
import { ThyFullscreenMode } from './fullscreen.config';
7
import { ThyFullscreenLaunchDirective } from './fullscreen-launch.directive';
8

9
/**
10
 * 全屏组件,将某一区域进行全屏展示,支持组件`thy-fullscreen`和`thyFullscreen`指令两种形式
11
 * @name thy-fullscreen,[thyFullscreen]
12
 * @order 10
13
 */
14
@Component({
1✔
15
    selector: 'thy-fullscreen, [thyFullscreen]',
16
    templateUrl: './fullscreen.component.html',
×
17
    standalone: true
18
})
19
export class ThyFullscreenComponent implements OnInit, OnDestroy {
×
20
    /**
×
21
     * immersive 模式使用了浏览器提供的全屏,整个窗体都全屏,emulated 模式为仿真的,只会在 body 区域全屏
×
22
     * @type immersive | emulated
×
23
     * @default immersive
×
24
     */
×
25
    @Input() thyMode: ThyFullscreenMode = ThyFullscreenMode.immersive;
26

×
27
    /**
×
28
     * 打开全屏时需要添加的类名
×
29
     */
×
30
    @Input() thyFullscreenClasses: string;
×
31

×
32
    /**
33
     * 全屏之后的回调
34
     */
×
35
    @Output() thyFullscreenChange: EventEmitter<boolean> = new EventEmitter<boolean>();
36

37
    @ContentChild(ThyFullscreenLaunchDirective, { read: ElementRef, static: false })
38
    set fullscreenLaunch(fullscreenLaunch: ElementRef<HTMLButtonElement> | undefined) {
39
        this.fullscreenLaunch$.next(fullscreenLaunch);
40
    }
×
41

×
42
    private ngUnsubscribe$ = new Subject<void>();
×
43
    private fullscreenLaunch$ = new Subject<ElementRef<HTMLButtonElement> | undefined>();
44

45
    constructor(private elementRef: ElementRef, private service: ThyFullscreen) {}
46

47
    ngOnInit(): void {
48
        this.fullscreenLaunch$
×
49
            .pipe(
×
50
                switchMap(fullscreenLaunch => (fullscreenLaunch ? fromEvent(fullscreenLaunch.nativeElement, 'click') : EMPTY)),
51
                takeUntil(this.ngUnsubscribe$)
52
            )
53
            .subscribe(this.handleFullscreen);
×
54
    }
55

1✔
56
    // Toggles full screen on or off.
57
    private handleFullscreen = () => {
58
        const targetElement = this.elementRef.nativeElement.querySelector('[fullscreen-target]');
59
        const containerElement = this.elementRef.nativeElement.querySelector('[fullscreen-container]');
1✔
60
        const fullscreen = targetElement.classList.contains('thy-fullscreen-active');
61

62
        if (fullscreen) {
63
            this.service.exit();
64
        } else {
65
            const fullscreenRef = this.service.launch({
66
                mode: this.thyMode,
1✔
67
                target: targetElement,
68
                targetLaunchedClass: this.thyFullscreenClasses,
69
                emulatedContainer: containerElement
70
            });
71

72
            this.thyFullscreenChange.emit(true);
73

74
            fullscreenRef.afterExited().subscribe(() => {
75
                this.thyFullscreenChange.emit(false);
76
            });
77
        }
78
    };
79

80
    ngOnDestroy() {
81
        this.ngUnsubscribe$.next();
82
    }
83
}
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