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

IgniteUI / igniteui-angular / 13331632524

14 Feb 2025 02:51PM UTC coverage: 22.015% (-69.6%) from 91.622%
13331632524

Pull #15372

github

web-flow
Merge d52d57714 into bcb78ae0a
Pull Request #15372: chore(*): test ci passing

1990 of 15592 branches covered (12.76%)

431 of 964 new or added lines in 18 files covered. (44.71%)

19956 existing lines in 307 files now uncovered.

6452 of 29307 relevant lines covered (22.02%)

249.17 hits per line

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

2.27
/projects/igniteui-angular/src/lib/calendar/days-view/day-item.component.ts
1
import { Component, Input, Output, EventEmitter, HostBinding, ElementRef, booleanAttribute, ChangeDetectionStrategy } from '@angular/core';
2
import { CalendarSelection } from '../calendar';
3
import { DateRangeDescriptor } from '../../core/dates';
4
import { CalendarDay } from '../common/model'
5
import { areSameMonth, isNextMonth, isPreviousMonth, isDateInRanges } from '../common/helpers';
6

7
/**
8
 * @hidden
9
 */
10
@Component({
11
    selector: 'igx-day-item',
12
    templateUrl: 'day-item.component.html',
13
    changeDetection: ChangeDetectionStrategy.OnPush,
14
    standalone: true
15
})
16
export class IgxDayItemComponent {
2✔
17
    @Input()
18
    public date: CalendarDay;
19

20
    @Input()
21
    public viewDate: Date;
22

23
    @Input()
24
    public selection: string;
25

26
    /**
27
     * Returns boolean indicating if the day is selected
28
     *
29
     */
30
    @Input()
31
    public get selected(): any {
UNCOV
32
        return this._selected;
×
33
    }
34

35
    /**
36
     * Selects the day
37
     */
38
    public set selected(value: any) {
UNCOV
39
        this._selected = value;
×
40
    }
41

42
    @Input()
43
    public disabledDates: DateRangeDescriptor[];
44

45
    @Input()
46
    public specialDates: DateRangeDescriptor[];
47

48
    @Input({ transform: booleanAttribute })
UNCOV
49
    public hideOutsideDays = false;
×
50

51
    @Input({ transform: booleanAttribute })
52
    @HostBinding('class.igx-days-view__date--last')
UNCOV
53
    public isLastInRange = false;
×
54

55
    @Input({ transform: booleanAttribute })
56
    @HostBinding('class.igx-days-view__date--first')
UNCOV
57
    public isFirstInRange = false;
×
58

59
    @Input({ transform: booleanAttribute })
UNCOV
60
    public isWithinRange = false;
×
61

62
    @Input({ transform: booleanAttribute })
UNCOV
63
    public isWithinPreviewRange = false;
×
64

65
    @Input({ transform: booleanAttribute })
UNCOV
66
    public hideLeadingDays = false;
×
67

68
    @Input({ transform: booleanAttribute })
UNCOV
69
    public hideTrailingDays = false;
×
70

71
    private get hideLeading() {
UNCOV
72
        return this.hideLeadingDays && this.isPreviousMonth;
×
73
    }
74

75
    private get hideTrailing() {
UNCOV
76
        return this.hideTrailingDays && this.isNextMonth;
×
77
    }
78

79
    @Output()
UNCOV
80
    public dateSelection = new EventEmitter<CalendarDay>();
×
81

82
    @Output()
UNCOV
83
    public mouseEnter = new EventEmitter<void>();
×
84

85
    @Output()
UNCOV
86
    public mouseLeave = new EventEmitter<void>();
×
87

88
    @Output()
UNCOV
89
    public mouseDown = new EventEmitter<void>();
×
90

91
    public get isCurrentMonth(): boolean {
UNCOV
92
        return areSameMonth(this.date, this.viewDate);
×
93
    }
94

95
    public get isPreviousMonth(): boolean {
UNCOV
96
        return isPreviousMonth(this.date, this.viewDate);
×
97
    }
98

99
    public get isNextMonth(): boolean {
UNCOV
100
        return isNextMonth(this.date, this.viewDate);
×
101
    }
102

103
    public get nativeElement() {
UNCOV
104
        return this.elementRef.nativeElement;
×
105
    }
106

107
    @Input({ transform: booleanAttribute })
108
    @HostBinding('class.igx-days-view__date--active')
UNCOV
109
    public isActive = false;
×
110

111
    @HostBinding('class.igx-days-view__date--selected')
112
    public get isSelectedCSS(): boolean {
113
    const selectable =
UNCOV
114
        !this.isInactive || (this.isWithinRange && this.selection === "range");
×
UNCOV
115
    return !this.isDisabled && selectable && this.selected;
×
116
    }
117

118
    @HostBinding('class.igx-days-view__date--inactive')
119
    public get isInactive(): boolean {
UNCOV
120
        return !this.isCurrentMonth;
×
121
    }
122

123
    @HostBinding('class.igx-days-view__date--hidden')
124
    public get isHidden(): boolean {
UNCOV
125
        return (this.hideLeading || this.hideTrailing) && this.isInactive;
×
126
    }
127

128
    @HostBinding('class.igx-days-view__date--current')
129
    public get isToday(): boolean {
UNCOV
130
        return !this.isInactive && this.date.equalTo(CalendarDay.today);
×
131
    }
132

133
    @HostBinding('class.igx-days-view__date--weekend')
134
    public get isWeekend(): boolean {
UNCOV
135
        return this.date.weekend;
×
136
    }
137

138
    public get isDisabled(): boolean {
UNCOV
139
        if (!this.disabledDates) {
×
140
            return false;
×
141
        }
142

UNCOV
143
        return isDateInRanges(this.date, this.disabledDates);
×
144
    }
145

146
    public get isFocusable(): boolean {
UNCOV
147
        return this.isCurrentMonth && !this.isHidden && !this.isDisabled;
×
148
    }
149

150
    protected onMouseEnter() {
151
        this.mouseEnter.emit();
×
152
    }
153

154
    protected onMouseLeave() {
155
        this.mouseLeave.emit();
×
156
    }
157

158
    protected onMouseDown(event: MouseEvent) {
UNCOV
159
        event.preventDefault();
×
UNCOV
160
        this.mouseDown.emit();
×
161
    }
162

163
    @HostBinding('class.igx-days-view__date--range')
164
    public get isWithinRangeCSS(): boolean {
UNCOV
165
        return !this.isSingleSelection && this.isWithinRange;
×
166
    }
167

168
    @HostBinding('class.igx-days-view__date--range-preview')
169
    public get isWithinPreviewRangeCSS(): boolean {
UNCOV
170
        return !this.isSingleSelection && this.isWithinPreviewRange;
×
171
    }
172

173
    @HostBinding('class.igx-days-view__date--special')
174
    public get isSpecial(): boolean {
UNCOV
175
        if (!this.specialDates) {
×
UNCOV
176
            return false;
×
177
        }
178

UNCOV
179
        return !this.isInactive && isDateInRanges(this.date, this.specialDates);
×
180
    }
181

182
    @HostBinding('class.igx-days-view__date--disabled')
183
    public get isDisabledCSS(): boolean {
UNCOV
184
        return this.isHidden || this.isDisabled;
×
185
    }
186

187
    @HostBinding('class.igx-days-view__date--single')
188
    public get isSingleSelection(): boolean {
UNCOV
189
        return this.selection !== CalendarSelection.RANGE;
×
190
    }
191

UNCOV
192
    private _selected = false;
×
193

UNCOV
194
    constructor(private elementRef: ElementRef) { }
×
195
}
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