• 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

97.22
/src/dot/dot.component.ts
1
import { isThemeColor, ThyThemeColor } from 'ngx-tethys/core';
2

3
import { ChangeDetectionStrategy, Component, effect, ElementRef, inject, input, Renderer2, ViewEncapsulation } from '@angular/core';
4

5
export type ThyColorType = ThyThemeColor | string;
6
export type ThySizeType = 'xs' | 'sm' | 'md' | 'lg' | 'xlg';
7
export type ThyThemeType = 'outline' | 'fill';
8
export type ThyShapeType = 'square' | 'circle';
9

10
export const COMPONENT_CLASS_NAME = 'thy-dot';
1✔
11

12
export const DEFAULT_COLOR_NAME = 'primary';
1✔
13
export const DEFAULT_SIZE_NAME = 'sm';
1✔
14
export const DEFAULT_THEME_NAME = 'fill';
1✔
15
export const DEFAULT_SHAPE_NAME = 'circle';
1✔
16

17
/**
18
 * 显示一个点的组件
19
 * @name thy-dot,[thy-dot],[thyDot]
20
 * @order 10
21
 */
22
@Component({
23
    selector: 'thy-dot,[thy-dot],[thyDot]',
24
    template: '',
25
    encapsulation: ViewEncapsulation.None,
26
    changeDetection: ChangeDetectionStrategy.OnPush,
27
    host: {
28
        class: 'thy-dot',
29
        '[class.dot-theme-fill]': 'thyTheme() === "fill"',
30
        '[class.dot-theme-outline]': 'thyTheme() === "outline"',
31
        '[class.dot-shape-square]': 'thyShape() === "square"',
32
        '[class.dot-shape-circle]': 'thyShape() === "circle"',
33
        '[class.dot-size-md]': 'thySize() === "md"',
34
        '[class.dot-size-sm]': 'thySize() === "sm"',
35
        '[class.dot-size-xs]': 'thySize() === "xs"',
36
        '[class.dot-size-lg]': 'thySize() === "lg"',
37
        '[class.dot-size-xlg]': 'thySize() === "xlg"'
38
    }
39
})
40
export class ThyDot {
1✔
41
    private el = inject(ElementRef);
139✔
42
    private renderer = inject(Renderer2);
139✔
43
    private nativeElement: HTMLElement;
44

45
    constructor() {
46
        this.nativeElement = this.el.nativeElement;
139✔
47

48
        effect(() => {
139✔
49
            this.updateColorStyle();
139✔
50
        });
51
    }
52

53
    /**
54
     * 颜色,可选值为:`primary` `success` `info` `warning` `danger` `default` `light`和自定义颜色,如`#2cccda` `red`  `rgb(153, 153, 153)`
55
     * @type ThyThemeColor | string
56
     */
57
    readonly thyColor = input<ThyColorType, ThyColorType>(DEFAULT_COLOR_NAME, {
139✔
58
        transform: (value: ThyColorType) => value || DEFAULT_COLOR_NAME
3✔
59
    });
60

61
    /**
62
     * 大小
63
     * @type xs | sm | md | lg | xlg
64
     */
65
    readonly thySize = input<ThySizeType, ThySizeType>(DEFAULT_SIZE_NAME, {
139✔
66
        transform: (value: ThySizeType) => value || DEFAULT_SIZE_NAME
3✔
67
    });
68

69
    /**
70
     * 主题
71
     * @type outline(线框) | fill(填充)
72
     */
73
    readonly thyTheme = input<ThyThemeType, ThyThemeType>(DEFAULT_THEME_NAME, {
139✔
74
        transform: (value: ThyThemeType) => value || DEFAULT_THEME_NAME
3✔
75
    });
76

77
    /**
78
     * 形状
79
     * @type circle(圆形) | square(方形)
80
     */
81
    readonly thyShape = input<ThyShapeType, ThyShapeType>(DEFAULT_SHAPE_NAME, {
139✔
82
        transform: (value: ThyShapeType) => value || DEFAULT_SHAPE_NAME
3✔
83
    });
84

85
    updateColorStyle() {
86
        Array.from(this.nativeElement.classList)
139✔
87
            .filter(it => /^dot-color-[\w]+$/.test(it))
156✔
88
            .forEach(it => this.renderer.removeClass(this.nativeElement, it));
×
89

90
        if (isThemeColor(this.thyColor())) {
139✔
91
            this.renderer.removeStyle(this.nativeElement, 'borderColor');
138✔
92
            this.renderer.addClass(this.nativeElement, `dot-color-${this.thyColor()}`);
138✔
93
        } else {
94
            this.renderer.setStyle(this.nativeElement, 'borderColor', this.thyColor());
1✔
95
        }
96
    }
97
}
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