• 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

6.98
/src/skeleton/skeleton-rectangle.component.ts
1
import { Component, ChangeDetectionStrategy, ViewEncapsulation, inject, input, computed } from '@angular/core';
2
import { ThySkeleton } from './skeleton.component';
3
import { coerceBooleanProperty, helpers, ThyBooleanInput } from 'ngx-tethys/util';
4
import { THY_SKELETON_CONFIG } from './skeleton.config';
5
import { isUndefinedOrNull } from 'ngx-tethys/util';
6
import { NgStyle } from '@angular/common';
7
import { coerceCssPixelValue } from '@angular/cdk/coercion';
8
/**
9
 * 骨架屏矩形组件
10
 * @name thy-skeleton-rectangle
11
 * @order 20
12
 */
13
@Component({
14
    selector: 'thy-skeleton-rectangle',
15
    host: {
1✔
16
        '[class.thy-skeleton]': 'true',
UNCOV
17
        '[class.thy-skeleton-rectangle]': 'true',
×
UNCOV
18
        '[style.background]': 'primaryColor()',
×
UNCOV
19
        '[style.width]': 'thyRowWidth()',
×
UNCOV
20
        '[style.height]': 'thyRowHeight()',
×
UNCOV
21
        '[style.borderRadius]': 'thyBorderRadius()'
×
UNCOV
22
    },
×
UNCOV
23
    template: ` <div class="thy-skeleton-after" [ngStyle]="afterStyles()"></div> `,
×
UNCOV
24
    changeDetection: ChangeDetectionStrategy.OnPush,
×
UNCOV
25
    encapsulation: ViewEncapsulation.None,
×
UNCOV
26
    imports: [NgStyle]
×
UNCOV
27
})
×
28
export class ThySkeletonRectangle {
UNCOV
29
    private skeletonConfigModel = inject(THY_SKELETON_CONFIG, { optional: true });
×
UNCOV
30

×
31
    private parent = inject(ThySkeleton, { optional: true })!;
UNCOV
32

×
UNCOV
33
    /**
×
34
     * 是否展示动画
UNCOV
35
     * @default true
×
UNCOV
36
     */
×
UNCOV
37
    readonly thyAnimated = input<boolean, ThyBooleanInput>(undefined, { transform: coerceBooleanProperty });
×
38

UNCOV
39
    /**
×
UNCOV
40
     * 动画速度
×
41
     * @default 1.5s
42
     */
×
43
    readonly thyAnimatedInterval = input<string | number>();
UNCOV
44

×
UNCOV
45
    /**
×
46
     * 骨架边框圆角
×
47
     * @default 4px
48
     */
49
    readonly thyBorderRadius = input<string, string | number>(undefined, { transform: coerceCssPixelValue });
×
50

51
    /**
52
     * 骨架宽度
53
     * @default 100%
1✔
54
     */
55
    readonly thyRowWidth = input<string, string | number>(undefined, { transform: coerceCssPixelValue });
56

57
    /**
58
     * 骨架高度
59
     * @default 20px
60
     */
61
    readonly thyRowHeight = input<string, string | number>(undefined, { transform: coerceCssPixelValue });
62

63
    /**
1✔
64
     * 骨架主色
65
     * @default #F7F7F7
66
     */
67
    readonly thyPrimaryColor = input<string>();
68

69
    /**
70
     * 骨架次色
71
     * @default #aaaaaa
72
     */
73
    readonly thySecondaryColor = input<string>();
74

75
    readonly animatedInterval = computed(() => {
76
        return this.thyAnimatedInterval() || this.parent?.thyAnimatedInterval() || this.skeletonConfigModel.thyAnimatedInterval;
77
    });
78

79
    readonly primaryColor = computed(() => {
80
        return this.thyPrimaryColor() || this.parent?.thyPrimaryColor() || this.skeletonConfigModel.thyPrimaryColor;
81
    });
82

83
    readonly secondaryColor = computed(() => {
84
        return this.thySecondaryColor() || this.parent?.thySecondaryColor() || this.skeletonConfigModel.thySecondaryColor;
85
    });
86

87
    readonly animated = computed(() => {
88
        if (!isUndefinedOrNull(this.thyAnimated())) {
89
            return this.thyAnimated();
90
        }
91
        if (!isUndefinedOrNull(this.parent?.thyAnimated())) {
92
            return this.parent.thyAnimated();
93
        }
94
        return this.skeletonConfigModel.thyAnimated;
95
    });
96

97
    readonly afterStyles = computed(() => {
98
        return {
99
            ...(this.secondaryColor() && {
100
                background: `linear-gradient(90deg, ${helpers.hexToRgb(this.secondaryColor(), 0)}, ${helpers.hexToRgb(
101
                    this.secondaryColor(),
102
                    0.15
103
                )}, ${helpers.hexToRgb(this.secondaryColor(), 0)}`
104
            }),
105
            animation: ![false, 'false'].includes(this.animated()) ? `thy-skeleton-animation ${this.animatedInterval()}s infinite` : 'none'
106
        };
107
    });
108
}
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