• 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

4.76
/src/date-picker/lib/quarter/quarter-table.component.ts
1
import { ChangeDetectionStrategy, Component, OnChanges, inject } from '@angular/core';
2
import { TinyDate } from 'ngx-tethys/util';
3
import { DateHelperService } from '../../date-helper.service';
4
import { CalendarTable } from '../calendar/calendar-table.component';
5
import { DateCell, DateBodyRow } from '../date/types';
6
import { NgClass } from '@angular/common';
7

8
/**
9
 * @private
10
 */
11
@Component({
1✔
12
    changeDetection: ChangeDetectionStrategy.OnPush,
UNCOV
13
    // eslint-disable-next-line @angular-eslint/component-selector
×
UNCOV
14
    selector: 'quarter-table',
×
UNCOV
15
    exportAs: 'quarterTable',
×
UNCOV
16
    templateUrl: 'quarter-table.component.html',
×
17
    imports: [NgClass]
18
})
UNCOV
19
export class QuarterTable extends CalendarTable implements OnChanges {
×
UNCOV
20
    private dateHelper = inject(DateHelperService);
×
UNCOV
21

×
22
    MAX_ROW = 1;
23

UNCOV
24
    MAX_COL = 4;
×
25

26
    constructor() {
UNCOV
27
        super();
×
UNCOV
28
    }
×
UNCOV
29

×
UNCOV
30
    private chooseQuarter(quarter: number): void {
×
31
        this.value = this.activeDate.setQuarter(quarter);
32
        this.valueChange.emit(this.value);
33
        this.render();
UNCOV
34
    }
×
UNCOV
35

×
UNCOV
36
    makeHeadRow(): DateCell[] {
×
UNCOV
37
        return [];
×
UNCOV
38
    }
×
39

40
    makeBodyRows(): DateBodyRow[] {
41
        const quarters: DateBodyRow[] = [];
42
        let quarterValue = 0;
43
        for (let rowIndex = 0; rowIndex < this.MAX_ROW; rowIndex++) {
44
            const row: DateBodyRow = {
45
                dateCells: [],
46
                trackByIndex: rowIndex
UNCOV
47
            };
×
48
            for (let colIndex = 0; colIndex < this.MAX_COL; colIndex++) {
49
                const quarter = this.activeDate.setQuarter(quarterValue + 1);
50
                const isDisabled = this.disabledDate ? this.disabledDate(quarter.nativeDate) : false;
UNCOV
51
                const content = `${quarter.format('qqq')}`;
×
UNCOV
52
                const cell: DateCell = {
×
UNCOV
53
                    trackByIndex: colIndex,
×
54
                    value: quarter.nativeDate,
UNCOV
55
                    isDisabled,
×
56
                    content,
UNCOV
57
                    title: content,
×
58
                    classMap: null,
59
                    isSelected: quarter.isSameQuarter(this.value),
UNCOV
60
                    onClick: () => {
×
UNCOV
61
                        this.chooseQuarter(quarter.getQuarter());
×
UNCOV
62
                    },
×
UNCOV
63
                    onMouseEnter: () => {}
×
UNCOV
64
                };
×
65
                this.addCellProperty(cell, quarter);
UNCOV
66
                row.dateCells.push(cell);
×
UNCOV
67
                quarterValue++;
×
UNCOV
68
            }
×
69
            quarters.push(row);
UNCOV
70
        }
×
UNCOV
71
        return quarters;
×
UNCOV
72
    }
×
73

UNCOV
74
    private addCellProperty(cell: DateCell, quarter: TinyDate): void {
×
UNCOV
75
        if (this.selectedValue?.length > 0) {
×
76
            const [startSelected, endSelected] = this.selectedValue;
UNCOV
77
            if (startSelected?.isSameQuarter(quarter)) {
×
78
                cell.isSelectedStartDate = true;
79
                cell.isSelected = true;
UNCOV
80
            }
×
UNCOV
81

×
82
            if (endSelected?.isSameQuarter(quarter)) {
83
                cell.isSelectedEndDate = true;
UNCOV
84
                cell.isSelected = true;
×
85
            }
86

87
            cell.isStartSingle = startSelected && !endSelected;
88
            cell.isEndSingle = !startSelected && !!endSelected;
89
            cell.isInRange = startSelected?.isBeforeQuarter(quarter) && quarter?.isBeforeQuarter(endSelected);
×
90
        } else if (quarter.isSameQuarter(this.value)) {
91
            cell.isSelected = true;
92
        }
1✔
93
        cell.classMap = this.getClassMap(cell, quarter);
94
    }
1✔
95

96
    quarterCellClick(event: Event, quarterCell: DateCell) {
97
        event.stopPropagation();
98
        return quarterCell.isDisabled ? null : quarterCell.onClick();
99
    }
100

101
    getClassMap(cell: DateCell, quarter: TinyDate): { [key: string]: boolean } {
102
        return {
103
            [`${this.prefixCls}-quarter-panel-cell`]: true,
104
            [`${this.prefixCls}-quarter-panel-cell-disabled`]: cell.isDisabled,
105
            [`${this.prefixCls}-quarter-panel-selected-cell`]: cell.isSelected,
106
            [`${this.prefixCls}-in-range-cell`]: !!cell.isInRange,
107
            [`${this.prefixCls}-quarter-panel-current-cell`]:
108
                new TinyDate().getYear() === this.activeDate.getYear() && quarter.getQuarter() === new TinyDate().getQuarter()
109
        };
110
    }
111
}
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