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

atinc / ngx-tethys / #102

26 May 2026 08:11AM UTC coverage: 91.111% (+0.7%) from 90.407%
#102

push

web-flow
build: bump docgeni to 2.8.0-next.5 (#3809)

4571 of 5491 branches covered (83.25%)

Branch coverage included in aggregate %.

13141 of 13949 relevant lines covered (94.21%)

966.75 hits per line

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

89.29
/src/shared/option/option.component.ts
1
import { Component, input, TemplateRef, ChangeDetectionStrategy, viewChild, inject, output, signal, contentChild } from '@angular/core';
2
import { ThySelectOptionGroup } from './group/option-group.component';
3
import { SafeAny } from 'ngx-tethys/types';
4

5
export class ThyOptionSelectionChangeEvent {
6
    constructor(
7
        public option: ThyOption,
8
        public isUserInput = false
9
    ) {}
10
}
11

12
/**
13
 * 选项组件
14
 * @name thy-option
15
 */
16
@Component({
17
    selector: 'thy-option',
18
    template: `
19
        <ng-template>
20
            <ng-content></ng-content>
21
        </ng-template>
22
    `,
23
    changeDetection: ChangeDetectionStrategy.OnPush
24
})
25
export class ThyOption {
26
    /**
117✔
27
     * 选项的值,具有唯一性
117!
28
     */
29
    readonly thyValue = input<SafeAny>();
30

31
    /**
32
     * 选项的原始值
33
     */
34
    readonly thyRawValue = input<SafeAny>();
35

36
    /**
37
     * 选项的文本
38
     */
39
    readonly thyLabelText = input<string>();
40

41
    /**
42
     * 是否显示自定义模板
43
     */
44
    readonly thyShowOptionCustom = input<boolean>();
45

46
    /**
47
     * 搜索关键字
48
     */
49
    readonly thySearchKey = input<string>();
50

51
    /**
52
     * 是否禁用
1✔
53
     */
965✔
54
    readonly thyDisabled = input<boolean>();
965✔
55

965✔
56
    /**
57
     * 是否选中,会跟随 ThyOptionSelectionChangeEvent 抛出去
58
     */
59
    readonly selected = signal(false);
60

61
    /**
62
     * 选项被选中时的回调
63
     */
64
    readonly selectionChange = output<ThyOptionSelectionChangeEvent>();
965✔
65

66
    /**
965✔
67
     * 模板
68
     */
965✔
69
    readonly template = viewChild<TemplateRef<SafeAny>>(TemplateRef);
70

965✔
71
    readonly suffixTemplate = contentChild<TemplateRef<SafeAny>>('suffixTemplate');
72

965✔
73
    private readonly optionGroupComponent = inject(ThySelectOptionGroup, { optional: true });
74

75
    get groupLabel() {
76
        return this.optionGroupComponent?.thyGroupLabel() || '';
5,115✔
77
    }
78
}
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