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

atinc / ngx-tethys / 68ef226c-f83e-44c1-b8ed-e420a83c5d84

28 May 2025 10:31AM UTC coverage: 10.352% (-80.0%) from 90.316%
68ef226c-f83e-44c1-b8ed-e420a83c5d84

Pull #3460

circleci

pubuzhixing8
chore: xxx
Pull Request #3460: refactor(icon): migrate signal input #TINFR-1476

132 of 6823 branches covered (1.93%)

Branch coverage included in aggregate %.

10 of 14 new or added lines in 1 file covered. (71.43%)

11648 existing lines in 344 files now uncovered.

2078 of 14525 relevant lines covered (14.31%)

6.69 hits per line

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

6.98
/src/date-picker/lib/calendar/calendar-header.component.ts
1
import { Directive, EventEmitter, Input, OnChanges, OnInit, Output, Signal, SimpleChanges, inject } from '@angular/core';
2

3
import { ThyPanelMode } from '../../standard-types';
4
import { TinyDate } from 'ngx-tethys/util';
5
import { DateHelperService } from '../../date-helper.service';
6
import { injectLocale, ThyDatePickerLocale } from 'ngx-tethys/i18n';
7

8
export interface PanelSelector {
9
    className: string;
1✔
10
    title?: string;
UNCOV
11
    label: string;
×
UNCOV
12
    onClick?(): void;
×
UNCOV
13
}
×
UNCOV
14

×
UNCOV
15
/**
×
UNCOV
16
 * @private
×
UNCOV
17
 */
×
UNCOV
18
@Directive()
×
UNCOV
19
export abstract class CalendarHeader implements OnInit, OnChanges {
×
20
    dateHelper = inject(DateHelperService);
21
    locale: Signal<ThyDatePickerLocale> = injectLocale('datePicker');
UNCOV
22

×
23
    @Input() showSuperPreBtn: boolean = true;
×
24
    @Input() showSuperNextBtn: boolean = true;
UNCOV
25
    @Input() showPreBtn: boolean = true;
×
26
    @Input() showNextBtn: boolean = true;
27
    @Input() value: TinyDate;
UNCOV
28
    @Output() readonly valueChange = new EventEmitter<TinyDate>();
×
UNCOV
29
    @Output() readonly panelModeChange = new EventEmitter<ThyPanelMode>();
×
30

31
    abstract getSelectors(): PanelSelector[];
32

UNCOV
33
    prefixCls = 'thy-calendar';
×
34
    selectors: PanelSelector[];
35

UNCOV
36
    ngOnInit(): void {
×
37
        if (!this.value) {
38
            this.value = new TinyDate();
UNCOV
39
        }
×
40
        this.selectors = this.getSelectors();
41
    }
UNCOV
42

×
43
    ngOnChanges(changes: SimpleChanges): void {
44
        if (changes.value) {
UNCOV
45
            this.render();
×
46
        }
47
    }
UNCOV
48

×
UNCOV
49
    superPrevious(): void {
×
50
        this.gotoYear(-1);
51
    }
UNCOV
52

×
UNCOV
53
    superNext(): void {
×
54
        this.gotoYear(1);
55
    }
56

UNCOV
57
    previous(): void {
×
58
        this.gotoMonth(-1);
59
    }
UNCOV
60

×
61
    next(): void {
62
        this.gotoMonth(1);
UNCOV
63
    }
×
UNCOV
64

×
UNCOV
65
    changePanel(mode: ThyPanelMode, value?: TinyDate): void {
×
UNCOV
66
        this.panelModeChange.emit(mode);
×
67
    }
68

69
    selectorClick(event: Event, selector: PanelSelector) {
UNCOV
70
        event.stopPropagation();
×
71
        return selector ? selector.onClick() : null;
72
    }
1✔
73

74
    private render(): void {
75
        if (this.value) {
76
            this.selectors = this.getSelectors();
77
        }
78
    }
79

80
    private gotoMonth(amount: number): void {
81
        this.changeValue(this.value.addMonths(amount));
82
    }
1✔
83

84
    private gotoYear(amount: number): void {
85
        this.changeValue(this.value.addYears(amount));
86
    }
87

88
    public changeValue(value: TinyDate): void {
89
        if (this.value !== value) {
90
            this.value = value;
91
            this.valueChange.emit(this.value);
92
            this.render();
93
        }
94
    }
95

96
    formatDateTime(format: string): string {
97
        return this.dateHelper.format(this.value.nativeDate, format);
98
    }
99
}
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