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

atinc / ngx-tethys / #55

30 Jul 2025 07:08AM UTC coverage: 9.866% (-80.4%) from 90.297%
#55

push

why520crazy
feat(empty): add setMessage for update display text #TINFR-2616

92 of 6794 branches covered (1.35%)

Branch coverage included in aggregate %.

2014 of 14552 relevant lines covered (13.84%)

6.15 hits per line

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

11.43
/src/notify/notify.component.ts
1
import { Component, Input, HostBinding, NgZone, OnInit, inject } from '@angular/core';
2
import { trigger, state, style, animate, transition } from '@angular/animations';
3
import { helpers, isString } from 'ngx-tethys/util';
4
import { ThyNotifyConfig, ThyNotifyDetail, ThyNotifyPlacement } from './notify.config';
5
import { ANIMATION_IN_DURATION, ANIMATION_OUT_DURATION, HIDE_STYLE, ThyAbstractMessageComponent } from 'ngx-tethys/message';
6
import { ThyNotifyQueue } from './notify-queue.service';
7
import { ThyViewOutletDirective } from 'ngx-tethys/shared';
8
import { ThyIcon } from 'ngx-tethys/icon';
9
import { NgClass, NgTemplateOutlet } from '@angular/common';
10

11
/**
12
 * @private
13
 */
14
@Component({
1✔
15
    selector: 'thy-notify',
16
    templateUrl: './notify.component.html',
×
17
    animations: [
×
18
        trigger('flyInOut', [
×
19
            state('flyInOutRight', style({ transform: 'translateX(0)', opacity: 1, height: '*' })),
×
20
            transition('void => flyInOutRight', [
×
21
                style({ transform: 'translateX(100%)', opacity: 0, height: '*' }),
22
                animate(ANIMATION_IN_DURATION)
23
            ]),
×
24
            transition('flyInOutRight => componentHide', [animate(ANIMATION_OUT_DURATION, style(HIDE_STYLE))]),
25
            state('flyInOutLeft', style({ transform: 'translateX(0)', opacity: 1, height: '*' })),
×
26
            transition('void => flyInOutLeft', [
27
                style({ transform: 'translateX(-100%)', opacity: 0, height: '*' }),
28
                animate(ANIMATION_IN_DURATION)
×
29
            ]),
×
30
            transition('flyInOutLeft => componentHide', [animate(ANIMATION_OUT_DURATION, style(HIDE_STYLE))]),
×
31
            state('componentHide', style(HIDE_STYLE))
×
32
        ])
×
33
    ],
×
34
    imports: [ThyIcon, NgClass, ThyViewOutletDirective, NgTemplateOutlet]
35
})
36
export class ThyNotify extends ThyAbstractMessageComponent<ThyNotifyConfig> implements OnInit {
×
37
    @HostBinding('@flyInOut') animationState: string;
×
38

39
    @HostBinding('class') className = '';
40

×
41
    config: ThyNotifyConfig;
42

43
    extendContentClass = false;
×
44

45
    isShowDetail = false;
46

×
47
    contentIsString = false;
×
48

49
    placement: ThyNotifyPlacement;
×
50

×
51
    @Input()
52
    set thyConfig(value: ThyNotifyConfig) {
53
        this.config = value;
1✔
54
        const type = value.type;
1✔
55
        this.placement = value.placement || 'topRight';
56
        if (this.placement === 'topLeft' || this.placement === 'bottomLeft') {
57
            this.animationState = 'flyInOutLeft';
58
        } else {
59
            this.animationState = 'flyInOutRight';
60
        }
1✔
61
        this.className = `thy-notify thy-notify-${type}`;
62
    }
63

64
    constructor() {
65
        const notifyQueue = inject(ThyNotifyQueue);
66
        super(notifyQueue);
67
    }
68

69
    ngOnInit() {
70
        super.ngOnInit();
71
        this.contentIsString = isString(this.config.content);
72
    }
73

74
    extendContent() {
75
        this.extendContentClass = true;
76
    }
77

78
    showDetailToggle() {
79
        this.isShowDetail = !this.isShowDetail;
80
    }
81

82
    triggerDetail() {
83
        if (helpers.isFunction((this.config.detail as ThyNotifyDetail).action)) {
84
            (this.config.detail as ThyNotifyDetail).action();
85
        }
86
        if ((this.config.detail as ThyNotifyDetail).content) {
87
            this.showDetailToggle();
88
        }
89
    }
90
}
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