• 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

16.67
/src/table/table-skeleton.component.ts
1
import { NgClass, NgStyle } from '@angular/common';
2
import {
3
    AfterViewInit,
4
    ChangeDetectionStrategy,
5
    ChangeDetectorRef,
6
    Component,
7
    ElementRef,
8
    Input,
9
    ViewChild,
10
    ViewEncapsulation,
1✔
11
    inject
12
} from '@angular/core';
13
import { InputCssPixel } from 'ngx-tethys/core';
14
import { ThySkeletonCircle, ThySkeletonRectangle } from 'ngx-tethys/skeleton';
15
import { ThyTableSkeletonColumn } from './table.interface';
1✔
16
import { ThyViewOutletDirective } from 'ngx-tethys/shared';
UNCOV
17
import { ThyTableColumnSkeletonType } from './enums';
×
UNCOV
18
import { ThyTableSize, ThyTableTheme } from './table.type';
×
UNCOV
19
import { coerceBooleanProperty } from 'ngx-tethys/util';
×
UNCOV
20

×
UNCOV
21
const COLUMN_COUNT = 5;
×
UNCOV
22

×
UNCOV
23
/**
×
UNCOV
24
 * 表格的骨架屏组件
×
UNCOV
25
 * @name thy-table-skeleton
×
UNCOV
26
 */
×
UNCOV
27
@Component({
×
UNCOV
28
    selector: 'thy-table-skeleton',
×
UNCOV
29
    templateUrl: './table-skeleton.component.html',
×
UNCOV
30
    host: {
×
UNCOV
31
        class: 'thy-table-skeleton'
×
UNCOV
32
    },
×
33
    changeDetection: ChangeDetectionStrategy.OnPush,
34
    encapsulation: ViewEncapsulation.None,
35
    imports: [NgClass, NgStyle, ThyViewOutletDirective, ThySkeletonRectangle, ThySkeletonCircle]
36
})
UNCOV
37
export class ThyTableSkeleton implements AfterViewInit {
×
UNCOV
38
    private cdr = inject(ChangeDetectorRef);
×
39

40
    @ViewChild('titleTemplate') titleTemplate: ElementRef<HTMLElement>;
41

42
    @ViewChild('memberTemplate') memberTemplate: ElementRef<HTMLElement>;
43

UNCOV
44
    @ViewChild('defaultTemplate') defaultTemplate: ElementRef<HTMLElement>;
×
45

46
    @ViewChild('checkboxTemplate') checkboxTemplate: ElementRef<HTMLElement>;
47

48
    /**
49
     * 骨架边框圆角
UNCOV
50
     */
×
51
    @Input()
52
    @InputCssPixel()
UNCOV
53
    thyBorderRadius: string | number;
×
54

55
    /**
UNCOV
56
     * 表格内容骨架高度
×
UNCOV
57
     */
×
58
    @Input()
59
    @InputCssPixel()
UNCOV
60
    thyRowHeight: string | number = '20px';
×
61

62
    /**
63
     * 是否开启动画
UNCOV
64
     * @default true
×
65
     */
66
    @Input({ transform: coerceBooleanProperty })
67
    thyAnimated: boolean = true;
68

69
    /**
70
     * 动画速度
71
     */
UNCOV
72
    @Input() thyAnimatedInterval: string;
×
73

74
    /**
75
     * 骨架主色
76
     */
UNCOV
77
    @Input() thyPrimaryColor: string;
×
78

79
    /**
1✔
80
     * 骨架次色
81
     */
82
    @Input() thySecondaryColor: string;
83

84
    rowCount: number[] = [];
85

86
    /**
87
     * 行数
88
     */
89
    @Input()
90
    set thyRowCount(value: number | string) {
91
        this.rowCount = Array.from({ length: +value });
92
    }
93

94
    /**
95
     * 是否展示骨架头
96
     * @default false
97
     */
98
    @Input({ transform: coerceBooleanProperty }) thyHeadless = false;
1✔
99

100
    /**
101
     * 骨架屏的风格
102
     * @type default | bordered | boxed
1✔
103
     */
104
    @Input() thyTheme: ThyTableTheme = 'default';
105

106
    /**
1✔
107
     * 骨架屏的大小
108
     * @type xs | sm | md | lg | xlg | default
109
     * @default md
110
     */
1✔
111
    @Input() thySize: ThyTableSize = 'md';
112

113
    /**
114
     * 设置表格最小宽度
115
     */
116
    @Input()
117
    @InputCssPixel()
118
    thyMinWidth: string | number;
119

120
    /**
121
     * 表格列骨架的配置项,支持配置列宽、骨架类型
122
     * @type ThyTableSkeletonColumn[]
123
     */
124
    @Input() set thyColumns(columns: ThyTableSkeletonColumn[]) {
125
        if (columns && columns.length) {
126
            this.columns = columns;
127
        } else {
128
            this.columns = [...this.defaultColumns];
129
        }
130
    }
131

132
    public titleHeight = '20px';
133

134
    public titleWidth = '50px';
135

136
    public checkboxWidth = '20px';
137

138
    public avatarSize = '24px';
139

140
    public columnType = ThyTableColumnSkeletonType;
141

142
    public skeletonColumnsMap: {
143
        [key: string]: ElementRef<HTMLElement>;
144
    } = {};
145

146
    get tableClassMap() {
147
        return {
148
            table: true,
149
            'table-bordered': this.thyTheme === 'bordered',
150
            'table-boxed': this.thyTheme === 'boxed',
151
            [`table-${this.thySize}`]: !!this.thySize
152
        };
153
    }
154

155
    private defaultColumns = Array.from({ length: COLUMN_COUNT }).map((item, index: number) => {
156
        if (index === 0) {
157
            return {
158
                width: '40%',
159
                type: ThyTableColumnSkeletonType.title
160
            };
161
        } else if (index === 1) {
162
            return {
163
                width: '17%',
164
                type: ThyTableColumnSkeletonType.member
165
            };
166
        } else {
167
            return {
168
                width: 'auto',
169
                type: ThyTableColumnSkeletonType.default
170
            };
171
        }
172
    });
173

174
    public columns: ThyTableSkeletonColumn[] = [...this.defaultColumns];
175

176
    ngAfterViewInit(): void {
177
        this.skeletonColumnsMap = {
178
            [ThyTableColumnSkeletonType.title]: this.titleTemplate,
179
            [ThyTableColumnSkeletonType.member]: this.memberTemplate,
180
            [ThyTableColumnSkeletonType.checkbox]: this.checkboxTemplate
181
        };
182
        this.cdr.detectChanges();
183
    }
184
}
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