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

atinc / ngx-tethys / #55

30 Jul 2025 07:08AM UTC coverage: 9.866% (-80.4%) from 90.297%
#55

push

why520crazy
feat(empty): add setMessage for update display text #TINFR-2616

92 of 6794 branches covered (1.35%)

Branch coverage included in aggregate %.

2014 of 14552 relevant lines covered (13.84%)

6.15 hits per line

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

27.27
/src/layout/header.component.ts
1
import { NgClass, NgTemplateOutlet } from '@angular/common';
2
import { ChangeDetectionStrategy, Component, ContentChild, Directive, Input, TemplateRef } from '@angular/core';
3
import { ThyIcon } from 'ngx-tethys/icon';
4
import { coerceBooleanProperty } from 'ngx-tethys/util';
5

6
/**
7
 * 头部布局指令
8
 * @name thyHeader
9
 * @order 10
10
 */
11
@Directive({
12
    selector: '[thyHeader]',
1✔
13
    host: {
14
        class: `thy-layout-header`,
×
15
        '[class.thy-layout-header-sm]': `thySize === 'sm'`,
×
16
        '[class.thy-layout-header-lg]': `thySize === 'lg'`,
×
17
        '[class.thy-layout-header-xlg]': `thySize === 'xlg'`,
18
        '[class.thy-layout-header-shadow]': `thyShadow`,
19
        '[class.thy-layout-header-divided]': `divided`
×
20
    }
21
})
22
export class ThyHeaderDirective {
×
23
    /**
24
     * 头部大小
1✔
25
     * @type sm | md  | lg | xlg
26
     */
27
    @Input('thySize') thySize: 'sm' | 'md' | 'lg' | 'xlg' = 'md';
28

29
    /**
30
     * 底部是否有阴影
31
     * @default false
1✔
32
     */
33
    @Input({ transform: coerceBooleanProperty }) thyShadow = false;
34

35
    divided = false;
36

37
    /**
38
     * 底部是否有分割线
39
     */
40
    @Input({ transform: coerceBooleanProperty })
41
    set thyDivided(value: boolean) {
42
        this.divided = value;
43
    }
44

45
    /**
46
     * 底部是否有分割线,已废弃,请使用 thyDivided
47
     * @deprecated please use thyDivided
48
     */
49
    @Input({ transform: coerceBooleanProperty })
50
    set thyHasBorder(value: boolean) {
1✔
51
        this.divided = value;
52
    }
×
53
}
54

55
/**
×
56
 * 头部布局组件
×
57
 * @name thy-header
×
58
 * @order 11
59
 */
60
@Component({
×
61
    selector: 'thy-header',
62
    preserveWhitespaces: false,
63
    templateUrl: './header.component.html',
64
    changeDetection: ChangeDetectionStrategy.OnPush,
×
65
    hostDirectives: [
×
66
        {
67
            directive: ThyHeaderDirective,
68
            inputs: ['thySize', 'thyShadow', 'thyHasBorder', 'thyDivided']
1✔
69
        }
70
    ],
71
    imports: [NgTemplateOutlet, ThyIcon, NgClass]
72
})
73
export class ThyHeader {
74
    public iconClass: string;
75

76
    public svgIconName: string;
77

1✔
78
    /**
79
     * 头部标题
80
     */
81
    @Input() thyTitle: string;
82

83
    /**
84
     * 图标前缀,被弃用,图标使用 SVG 图标
85
     */
86
    @Input() thyIconPrefix = 'wtf';
87

88
    /**
89
     * 图标,SVG 图标名称
90
     */
91
    @Input('thyIcon')
92
    set thyIcon(value: string) {
93
        if (value) {
94
            if (value.includes('wtf')) {
95
                this.iconClass = `${this.thyIconPrefix} ${value}`;
96
            } else {
97
                this.svgIconName = value;
98
            }
99
        } else {
100
            this.iconClass = null;
101
            this.svgIconName = null;
102
        }
103
    }
104

105
    /**
106
     * 头部自定义标题模板,`<ng-template #headerTitle></ng-template>`
107
     * @type TemplateRef
108
     */
109
    @ContentChild('headerTitle')
110
    public titleTemplateRef: TemplateRef<any>;
111

112
    /**
113
     * 头部自定义内容模板,`<ng-template #headerContent></ng-template>`
114
     * @type TemplateRef
115
     */
116
    @ContentChild('headerContent')
117
    public contentTemplateRef: TemplateRef<any>;
118

119
    /**
120
     * 头部自定义操作模板,`<ng-template #headerOperation></ng-template>`
121
     * @type TemplateRef
122
     */
123
    @ContentChild('headerOperation')
124
    public operationTemplateRef: TemplateRef<any>;
125
}
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