• 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

9.3
/src/date-picker/lib/calendar/calendar-header.component.ts
1
import { Directive, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } 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

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

×
14
/**
×
15
 * @private
×
16
 */
×
17
@Directive()
×
18
export abstract class CalendarHeader implements OnInit, OnChanges {
19
    @Input() showSuperPreBtn: boolean = true;
20
    @Input() showSuperNextBtn: boolean = true;
×
21
    @Input() showPreBtn: boolean = true;
×
22
    @Input() showNextBtn: boolean = true;
23
    @Input() value: TinyDate;
×
24
    @Output() readonly valueChange = new EventEmitter<TinyDate>();
25
    @Output() readonly panelModeChange = new EventEmitter<ThyPanelMode>();
26

×
27
    abstract getSelectors(): PanelSelector[];
×
28

29
    prefixCls = 'thy-calendar';
30
    selectors: PanelSelector[];
31

×
32
    constructor(public dateHelper: DateHelperService) {}
33

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

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

×
47
    superPrevious(): void {
×
48
        this.gotoYear(-1);
49
    }
50

×
51
    superNext(): void {
×
52
        this.gotoYear(1);
53
    }
54

55
    previous(): void {
×
56
        this.gotoMonth(-1);
57
    }
58

×
59
    next(): void {
60
        this.gotoMonth(1);
61
    }
×
62

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

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

72
    private render(): void {
73
        if (this.value) {
1✔
74
            this.selectors = this.getSelectors();
75
        }
76
    }
77

78
    private gotoMonth(amount: number): void {
79
        this.changeValue(this.value.addMonths(amount));
80
    }
81

82
    private gotoYear(amount: number): void {
83
        this.changeValue(this.value.addYears(amount));
1✔
84
    }
85

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

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