• 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

0.0
/src/core/overlay/abstract-overlay-container.ts
1
import { Observable, Subject } from 'rxjs';
2

3
import { AnimationEvent } from '@angular/animations';
4
import { CdkPortalOutlet, ComponentPortal, TemplatePortal } from '@angular/cdk/portal';
×
5
import { ChangeDetectorRef, ComponentRef, EmbeddedViewRef, EventEmitter } from '@angular/core';
6

7
import { ThyAbstractOverlayConfig, ThyAbstractOverlayOptions } from './abstract-overlay.config';
8

9
export function throwPopoverContentAlreadyAttachedError(name: string) {
10
    throw Error(`Attempting to attach ${name} content after content is already attached`);
×
11
}
×
12

×
13
export abstract class ThyAbstractOverlayContainer<TData = unknown> {
×
14
    id?: string;
15

16
    animationState: string;
17

18
    animationStateChanged = new EventEmitter<AnimationEvent>();
19

20
    containerDestroy = new Subject<void>();
×
21

×
22
    abstract config: ThyAbstractOverlayConfig<TData>;
23

×
24
    /**portal outlet */
×
25
    abstract portalOutlet: CdkPortalOutlet;
26

27
    /**
28
     * Opening overlay animation done
29
     */
30
    abstract animationOpeningDone: Observable<AnimationEvent>;
31

×
32
    /**
×
33
     * Closing overlay animation done
34
     */
×
35
    abstract animationClosingDone: Observable<AnimationEvent>;
×
36

37
    /** Before attach content(TemplatePortal or ComponentPortal) portal to portalOutlet*/
38
    abstract beforeAttachPortal(): void;
×
39

×
40
    /** Before detach content*/
41
    beforeDetachPortal() {}
42

43
    constructor(private options: ThyAbstractOverlayOptions, protected changeDetectorRef: ChangeDetectorRef) {}
44

×
45
    /**
46
     * Attach a TemplatePortal as content to this overlay container.
47
     * @param portal Portal to be attached as the overlay content.
×
48
     */
49
    attachTemplatePortal<C>(portal: TemplatePortal<C>): EmbeddedViewRef<C> {
50
        if (this.portalOutlet.hasAttached()) {
×
51
            throwPopoverContentAlreadyAttachedError(this.options.name);
52
        }
53

54
        this.beforeAttachPortal();
55
        return this.portalOutlet.attachTemplatePortal(portal);
56
    }
57

58
    /**
59
     * Attach a ComponentPortal as content to this overlay container.
60
     * @param portal Portal to be attached as the overlay content.
61
     */
62
    attachComponentPortal<T>(portal: ComponentPortal<T>): ComponentRef<T> {
63
        if (this.portalOutlet.hasAttached()) {
64
            throwPopoverContentAlreadyAttachedError(this.options.name);
65
        }
66
        this.beforeAttachPortal();
67
        return this.portalOutlet.attachComponentPortal(portal);
68
    }
69

70
    startExitAnimation() {
71
        if (this.options.animationEnabled) {
72
            this.animationState = 'exit';
73
        } else {
74
            // this.animationClosingDone.
75
        }
76
        this.beforeDetachPortal();
77

78
        // Mark the container for check so it can react if the
79
        // view container is using OnPush change detection.
80
        this.changeDetectorRef.markForCheck();
81
    }
82

83
    destroy() {
84
        this.containerDestroy.next();
85
    }
86
}
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