• 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

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

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

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

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

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

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

UNCOV
45
    constructor() {
×
46
        this.nativeElement = this.el.nativeElement;
47

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

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

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

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

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

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

90
        if (isThemeColor(this.thyColor())) {
91
            this.renderer.setStyle(this.nativeElement, 'borderColor', 'none');
92
            this.renderer.addClass(this.nativeElement, `dot-color-${this.thyColor()}`);
93
        } else {
94
            this.renderer.setStyle(this.nativeElement, 'borderColor', this.thyColor());
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

© 2025 Coveralls, Inc