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

atinc / ngx-tethys / #55

30 Jul 2025 07:08AM UTC coverage: 9.866% (-80.4%) from 90.297%
#55

push

why520crazy
feat(empty): add setMessage for update display text #TINFR-2616

92 of 6794 branches covered (1.35%)

Branch coverage included in aggregate %.

2014 of 14552 relevant lines covered (13.84%)

6.15 hits per line

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

22.73
/src/input/input.directive.ts
1
import { Directive, ElementRef, HostBinding, Input, OnInit, Renderer2, effect, inject, input } from '@angular/core';
2
import { NgControl } from '@angular/forms';
3
import { useHostRenderer } from '@tethys/cdk/dom';
4

5
export type ThyInputSize = 'xs' | 'sm' | 'md' | 'lg' | '';
6

1✔
7
const inputGroupSizeMap = {
8
    xs: ['form-control-xs'],
9
    sm: ['form-control-sm'],
10
    md: ['form-control-md'],
11
    lg: ['form-control-lg']
12
};
13

14
/**
15
 * 输入框指令
16
 * @name thyInput
17
 * @order 10
1✔
18
 */
19
@Directive({
×
20
    selector: 'input[thyInput], select[thyInput], textarea[thyInput]',
21
    exportAs: 'thyInput'
22
})
×
23
export class ThyInputDirective {
24
    private elementRef = inject(ElementRef);
25
    private render = inject(Renderer2);
×
26
    private control = inject(NgControl, { optional: true, self: true })!;
×
27

×
28
    @HostBinding('class.form-control') isFormControl = true;
×
29

×
30
    private hostRenderer = useHostRenderer();
×
31

×
32
    /**
×
33
     * 输入框大小
×
34
     * @type 'xs' | 'sm' | 'md' | 'default' | 'lg'
×
35
     * @default default
36
     */
37
    readonly thySize = input<ThyInputSize>(undefined);
×
38

39
    get ngControl() {
40
        return this.control;
41
    }
1✔
42

1✔
43
    get nativeElement(): HTMLInputElement {
44
        return this.elementRef.nativeElement;
45
    }
46

47
    constructor() {
1✔
48
        effect(() => {
49
            const size = this.thySize();
50
            if (size && inputGroupSizeMap[size]) {
51
                this.hostRenderer.updateClass(inputGroupSizeMap[size]);
52
            } else {
53
                this.hostRenderer.updateClass([]);
54
            }
55
        });
56
    }
57
}
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

© 2026 Coveralls, Inc