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

atinc / ngx-tethys / 0bbb2cec-209e-4d8a-b1b3-6bc54e05daa6

04 Sep 2023 08:40AM UTC coverage: 15.616% (-74.6%) from 90.2%
0bbb2cec-209e-4d8a-b1b3-6bc54e05daa6

Pull #2829

circleci

cmm-va
fix: add test
Pull Request #2829: fix: add tabIndex

300 of 6386 branches covered (0.0%)

Branch coverage included in aggregate %.

78 of 78 new or added lines in 26 files covered. (100.0%)

2849 of 13779 relevant lines covered (20.68%)

83.41 hits per line

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

21.95
/src/table/table-skeleton.component.ts
1
import { NgClass, NgFor, NgIf, NgTemplateOutlet } from '@angular/common';
2
import { ChangeDetectionStrategy, Component, Input, ViewEncapsulation } from '@angular/core';
3
import { InputBoolean, InputCssPixel } from 'ngx-tethys/core';
4
import { ThySkeletonCircleComponent, ThySkeletonRectangleComponent } from 'ngx-tethys/skeleton';
5
import { ThyTableSkeletonColumn } from './table.interface';
6
import { ThyViewOutletDirective } from 'ngx-tethys/shared';
7
import { ThyTableColumnSkeletonType } from './enums';
8
import { ThyTableSize, ThyTableTheme } from './table.component';
9

1✔
10
const COLUMN_COUNT = 5;
11

12
/**
13
 * 表格的骨架屏组件
14
 * @name thy-table-skeleton
1✔
15
 */
16
@Component({
×
17
    selector: 'thy-table-skeleton',
×
18
    templateUrl: './table-skeleton.component.html',
×
19
    host: {
×
20
        class: 'thy-table-skeleton'
×
21
    },
×
22
    changeDetection: ChangeDetectionStrategy.OnPush,
×
23
    encapsulation: ViewEncapsulation.None,
×
24
    standalone: true,
×
25
    imports: [NgFor, NgClass, NgIf, NgTemplateOutlet, ThyViewOutletDirective, ThySkeletonRectangleComponent, ThySkeletonCircleComponent]
×
26
})
×
27
export class ThyTableSkeletonComponent {
×
28
    /**
×
29
     * 骨架边框圆角
×
30
     */
31
    @Input()
32
    @InputCssPixel()
33
    thyBorderRadius: string | number;
34

×
35
    /**
×
36
     * 表格内容骨架高度
37
     */
38
    @Input()
39
    @InputCssPixel()
40
    thyRowHeight: string | number = '20px';
41

×
42
    /**
43
     * 是否开启动画
44
     * @default true
45
     */
46
    @Input()
47
    @InputBoolean()
×
48
    thyAnimated: boolean = true;
49

50
    /**
×
51
     * 动画速度
52
     */
53
    @Input() thyAnimatedInterval: string;
×
54

×
55
    /**
56
     * 骨架主色
57
     */
×
58
    @Input() thyPrimaryColor: string;
59

60
    /**
61
     * 骨架次色
×
62
     */
63
    @Input() thySecondaryColor: string;
64

65
    rowCount: number[] = [];
66

67
    /**
68
     * 行数
69
     */
×
70
    @Input()
71
    set thyRowCount(value: number | string) {
1✔
72
        this.rowCount = Array.from({ length: +value });
73
    }
74

75
    /**
76
     * 是否展示骨架头
77
     * @default false
78
     */
79
    @Input() @InputBoolean() thyHeadless = false;
80

81
    /**
82
     * 骨架屏的风格
83
     * @type default | bordered | boxed
84
     */
85
    @Input() thyTheme: ThyTableTheme = 'default';
86

1✔
87
    /**
88
     * 骨架屏的大小
89
     * @type xs | sm | md | lg | xlg | default
90
     * @default md
1✔
91
     */
92
    @Input() thySize: ThyTableSize = 'md';
93

94
    /**
1✔
95
     * 设置表格最小宽度
96
     */
97
    @Input()
98
    @InputCssPixel()
1✔
99
    thyMinWidth: string | number;
100

101
    /**
102
     * 表格列骨架的配置项,支持配置列宽、骨架类型
1✔
103
     * @type ThyTableSkeletonColumn[]
104
     */
105
    @Input() set thyColumns(columns: ThyTableSkeletonColumn[]) {
106
        if (columns && columns.length) {
1✔
107
            this.columns = columns;
108
        } else {
109
            this.columns = [...this.defaultColumns];
110
        }
111
    }
112

113
    public titleHeight = '16px';
114

115
    public titleWidth = '50px';
116

117
    public checkBoxWidth = '20px';
118

119
    public avatarSize = '24px';
120

121
    public columnType = ThyTableColumnSkeletonType;
122

123
    get tableClassMap() {
124
        return {
125
            table: true,
126
            'table-bordered': this.thyTheme === 'bordered',
127
            'table-boxed': this.thyTheme === 'boxed',
128
            [`table-${this.thySize}`]: !!this.thySize
129
        };
130
    }
131

132
    private defaultColumns = Array.from({ length: COLUMN_COUNT }).map((item, index: number) => {
133
        if (index === 0) {
134
            return {
135
                width: '40%',
136
                type: ThyTableColumnSkeletonType.title
137
            };
138
        } else if (index === 1) {
139
            return {
140
                width: '17%',
141
                type: ThyTableColumnSkeletonType.member
142
            };
143
        } else {
144
            return {
145
                width: 'auto',
146
                type: ThyTableColumnSkeletonType.default
147
            };
148
        }
149
    });
150

151
    public columns: ThyTableSkeletonColumn[] = [...this.defaultColumns];
152

153
    public trackByFn(index: number) {
154
        return index;
155
    }
156
}
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