• 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

10.64
/src/shared/base-form-check.component.ts
1
import { ControlValueAccessor } from '@angular/forms';
2
import { HostBinding, Input, ChangeDetectorRef, Directive, inject } from '@angular/core';
3
import { ThyTranslate, TabIndexDisabledControlValueAccessorMixin } from 'ngx-tethys/core';
4
import { coerceBooleanProperty } from 'ngx-tethys/util';
5

1✔
6
const noop = () => {};
7

8
/**
9
 * @private
1✔
10
 */
UNCOV
11
@Directive()
×
12
export class ThyFormCheckBaseComponent extends TabIndexDisabledControlValueAccessorMixin implements ControlValueAccessor {
13
    protected thyTranslate = inject(ThyTranslate);
UNCOV
14
    protected changeDetectorRef? = inject(ChangeDetectorRef);
×
15

16
    // The internal data model
UNCOV
17
    _innerValue: boolean = null;
×
18

19
    _disabled = false;
20

×
21
    private onTouchedCallback: () => void = noop;
×
22

23
    private onChangeCallback: (_: any) => void = noop;
24

×
25
    _labelText: string;
26

27
    @HostBinding('class.form-check') _isFormCheck = true;
UNCOV
28

×
UNCOV
29
    @HostBinding('class.form-check-inline') _isFormCheckInline = false;
×
30

31
    @HostBinding('class.form-check-checked') _isChecked = false;
UNCOV
32

×
33
    @HostBinding('class.form-check-inline-no-label-text') get _isNoText() {
34
        return this._isFormCheckInline && !this._labelText;
UNCOV
35
    }
×
UNCOV
36

×
UNCOV
37
    /**
×
38
     * 是否同一行展示
39
     * @default false
40
     */
UNCOV
41
    @Input({ transform: coerceBooleanProperty })
×
42
    set thyInline(value: boolean) {
43
        this._isFormCheckInline = value;
UNCOV
44
    }
×
45

46
    /**
UNCOV
47
     * Label 展示文本
×
UNCOV
48
     */
×
49
    @Input()
50
    set thyLabelText(value: string) {
UNCOV
51
        this._labelText = value;
×
UNCOV
52
    }
×
UNCOV
53

×
UNCOV
54
    /**
×
55
     * Label 文本多语言 key
56
     */
UNCOV
57
    @Input()
×
UNCOV
58
    set thyLabelTextTranslateKey(value: string) {
×
UNCOV
59
        if (value) {
×
60
            this._labelText = this.thyTranslate.instant(value);
UNCOV
61
        } else {
×
UNCOV
62
            this._labelText = '';
×
UNCOV
63
        }
×
UNCOV
64
    }
×
UNCOV
65

×
UNCOV
66
    disabled = false;
×
UNCOV
67

×
UNCOV
68
    /**
×
69
     * 是否禁用
70
     * @default false
UNCOV
71
     */
×
72
    @Input({ transform: coerceBooleanProperty })
73
    override set thyDisabled(value: boolean) {
UNCOV
74
        this.disabled = value;
×
UNCOV
75
        this.setDisabledState(this.disabled);
×
76
    }
77

78
    override get thyDisabled() {
1✔
79
        return this.disabled;
1✔
80
    }
81

82
    writeValue(obj: boolean): void {
83
        if (obj !== this._innerValue) {
84
            this._innerValue = obj;
85
            this._isChecked = !!this._innerValue;
86
        }
87
    }
88

89
    registerOnChange(fn: any): void {
90
        this.onChangeCallback = fn;
1✔
91
    }
92

93
    registerOnTouched(fn: any): void {
94
        this.onTouchedCallback = fn;
95
    }
96

97
    setDisabledState?(isDisabled: boolean): void {
98
        this._disabled = isDisabled;
99
        this.markForCheck();
100
    }
101

102
    updateValue(value: boolean): void {
103
        this._innerValue = value;
104
        this._isChecked = !!this._innerValue;
105
        this.onChangeCallback(value);
106
        this.markForCheck();
107
    }
108

109
    constructor() {
110
        super();
111
    }
112

113
    change() {
114
        this.updateValue(!this._innerValue);
115
    }
116

117
    markForCheck() {
118
        if (this.changeDetectorRef) {
119
            this.changeDetectorRef.markForCheck();
120
        }
121
    }
122
}
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