• 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

17.24
/src/stepper/stepper.component.ts
1
import { Component, ViewChildren, ContentChildren, QueryList, HostBinding, Input, Output, EventEmitter } from '@angular/core';
2
import { ThyStepComponent, IThyStepperComponent, THY_STEPPER_COMPONENT } from './step.component';
3
import { ThyStepHeaderComponent } from './step-header.component';
4
import { NgIf, NgFor, NgTemplateOutlet } from '@angular/common';
5
import { InputBoolean, InputNumber } from 'ngx-tethys/core';
6

7
/**
8
 * 步骤条组件
9
 * @name thy-stepper
10
 * @order 10
11
 */
12
@Component({
13
    selector: 'thy-stepper',
14
    templateUrl: 'stepper.component.html',
1✔
15
    providers: [
16
        {
×
17
            provide: THY_STEPPER_COMPONENT,
×
18
            useExisting: ThyStepperComponent
×
19
        }
×
20
    ],
21
    standalone: true,
22
    imports: [NgIf, NgFor, ThyStepHeaderComponent, NgTemplateOutlet]
×
23
})
24
export class ThyStepperComponent implements IThyStepperComponent {
25
    /**
×
26
     * 当前处于激活状态的步骤index
27
     * @default 0
28
     */
×
29
    @Input()
30
    @InputNumber()
31
    set thySelectedIndex(value: number) {
×
32
        this.selectedIndex = value;
33
    }
34

×
35
    @Input()
×
36
    set thySelected(value: ThyStepComponent) {
37
        this.selected = value;
38
    }
×
39

40
    /**
41
     * 步骤条导航是否展示,默认展示
42
     */
×
43
    @Input() @InputBoolean() thyShowStepHeader = true;
44

45
    private _selectedIndex = 0;
×
46

×
47
    public set selected(step: ThyStepComponent) {
48
        this.selectedIndex = this.steps ? this.steps.toArray().indexOf(step) : -1;
49
    }
50

51
    public get selected() {
52
        return this.steps ? this.steps.toArray()[this.selectedIndex] : null;
×
53
    }
54

55
    set selectedIndex(index: number) {
×
56
        if (this.steps) {
57
            this._updateSelectedItemIndex(index);
58
        } else {
×
59
            this._selectedIndex = index;
60
        }
61
    }
62

×
63
    get selectedIndex() {
64
        return this._selectedIndex;
1✔
65
    }
66

67
    @Output() selectionChange: EventEmitter<any> = new EventEmitter<any>();
68

69
    @ViewChildren(ThyStepHeaderComponent) stepHeaders: QueryList<ThyStepHeaderComponent>;
70

71
    @ContentChildren(ThyStepComponent) steps: QueryList<ThyStepComponent>;
72

73
    @HostBinding('class.thy-stepper') thyStepper = true;
74

1✔
75
    private _updateSelectedItemIndex(newIndex: number): void {
76
        const stepsArray = this.steps.toArray();
77
        this.selectionChange.emit({
78
            selectedIndex: newIndex,
79
            previouslySelectedIndex: this._selectedIndex,
1✔
80
            selectedStep: stepsArray[newIndex],
81
            previouslySelectedStep: stepsArray[this._selectedIndex]
82
        });
83
        this._selectedIndex = newIndex;
1✔
84
    }
85

86
    to(index: number): void {
87
        this.selectedIndex = Math.min(index, this.steps.length - 1);
88
    }
89

90
    next(): void {
91
        this.selectedIndex = Math.min(this._selectedIndex + 1, this.steps.length - 1);
92
    }
93

94
    /** Selects and focuses the previous step in list. */
95
    previous(): void {
96
        this.selectedIndex = Math.max(this._selectedIndex - 1, 0);
97
    }
98
}
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