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

atinc / ngx-tethys / ba7e05e2-37c0-44c6-8725-6f617aa0d43e

pending completion
ba7e05e2-37c0-44c6-8725-6f617aa0d43e

Pull #2756

circleci

huanhuanwa
test(color-picker): add test #INFR-8673
Pull Request #2756: feat(color-picker): add popoverRef param when panel open and close #INFR-8673

187 of 6315 branches covered (2.96%)

Branch coverage included in aggregate %.

2 of 2 new or added lines in 1 file covered. (100.0%)

2645 of 13660 relevant lines covered (19.36%)

83.2 hits per line

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

15.79
/src/form/form-group.component.ts
1
import { NgClass, NgIf, NgTemplateOutlet } from '@angular/common';
2
import { InputBoolean, ThyTranslate } from 'ngx-tethys/core';
3
import { ThyIconComponent } from 'ngx-tethys/icon';
4
import { ThyTooltipDirective } from 'ngx-tethys/tooltip';
5
import { coerceBooleanProperty } from 'ngx-tethys/util';
6

7
import {
8
    ChangeDetectionStrategy,
9
    Component,
10
    ContentChild,
1✔
11
    HostBinding,
12
    Input,
13
    OnInit,
14
    Optional,
15
    TemplateRef,
16
    ViewEncapsulation
17
} from '@angular/core';
18

1✔
19
import { ThyFormDirective } from './form.directive';
20

×
21
const internalIconMap = {
22
    date: 'wtf wtf-schedule-o'
23
};
×
24

×
25
type TipsMode = 'default' | 'label';
26

27
/**
×
28
 * 表单分组组件
29
 * @name thy-form-group
30
 * @order 40
31
 */
×
32
@Component({
33
    selector: 'thy-form-group',
34
    templateUrl: './form-group.component.html',
×
35
    encapsulation: ViewEncapsulation.None,
36
    changeDetection: ChangeDetectionStrategy.OnPush,
37
    standalone: true,
×
38
    imports: [NgIf, NgTemplateOutlet, ThyIconComponent, NgClass, ThyTooltipDirective]
×
39
})
×
40
export class ThyFormGroupComponent implements OnInit {
×
41
    labelText: string;
42
    labelRequired = false;
43
    labelPaddingTopClear = false;
×
44
    feedbackIcon: string;
×
45
    feedbackSvgIconName: string;
46
    tips: string;
47
    tipMode: TipsMode = 'default';
48

×
49
    @HostBinding('class.row-fill') _rowFill = false;
50

51
    @HostBinding('class.form-group') _isFormGroup = true;
×
52

53
    @HostBinding('class.row') isHorizontal = true;
54

×
55
    @HostBinding('class.has-feedback') hasFeedback = false;
56

57
    /**
×
58
     * Label 文本
59
     */
60
    @Input()
×
61
    set thyLabelText(value: string) {
×
62
        this.labelText = value;
×
63
    }
×
64

×
65
    /**
×
66
     * Label 文本多语言 Key
×
67
     */
×
68
    @Input()
×
69
    set thyLabelTextTranslateKey(value: string) {
70
        if (value) {
71
            this.labelText = this.thyTranslate.instant(value);
×
72
        } else {
73
            this.labelText = '';
1✔
74
        }
75
    }
76

77
    /**
1✔
78
     * Label 是否显示必填项样式
79
     */
80
    @Input()
81
    set thyLabelRequired(value: string) {
82
        this.labelRequired = coerceBooleanProperty(value);
83
    }
84

85
    @Input()
86
    set thyLabelPaddingTopClear(value: string) {
87
        this.labelPaddingTopClear = coerceBooleanProperty(value);
88
    }
89

90
    /**
91
     * 反馈图标,比如日期输入框显示日期的图标,常用输入 date 表示时间 wtf wtf-schedule-o
92
     */
93
    @Input()
94
    set thyFeedbackIcon(value: string) {
95
        this.hasFeedback = true;
1✔
96
        if (internalIconMap[value]) {
97
            this.feedbackIcon = internalIconMap[value];
98
            this.feedbackSvgIconName = null;
99
        } else {
100
            this.feedbackSvgIconName = value;
1✔
101
            this.feedbackIcon = null;
102
        }
103
    }
104

105
    /**
106
     * 提示文字的显示模式,`label`模式表示在 label 后通过图标+Tooltip 提示, `default`模式在 Form Control 下方直接显示
107
     * @type default | label
108
     * @default default
109
     */
110
    @Input()
111
    set thyTipsMode(mode: TipsMode) {
112
        this.tipMode = mode;
113
    }
114

115
    /**
116
     * 提示文案
117
     */
118
    @Input()
119
    set thyTips(value: string) {
120
        this.tips = value;
121
    }
122

123
    /**
124
     * 提示文案的多语言 Key
125
     */
126
    @Input()
127
    set thyTipsTranslateKey(value: string) {
128
        this.tips = this.thyTranslate.instant(value);
129
    }
130

131
    /**
132
     * 是否填充整行, 没有 Label 文本,只有输入框
133
     * @default false
134
     */
135
    @Input()
136
    @InputBoolean()
137
    set thyRowFill(value: boolean) {
138
        this._rowFill = coerceBooleanProperty(value);
139
    }
140

141
    /**
142
     * 已废弃
143
     * @deprecated please use content because formGroup is same name with angular formGroup directive
144
     */
145
    @ContentChild('formGroup')
146
    public contentTemplateRef: TemplateRef<any>;
147

148
    /**
149
     * 内容自定义模板,`<ng-template #content></ng-template>`
150
     */
151
    @ContentChild('content')
152
    public contentTemplate: TemplateRef<any>;
153

154
    constructor(@Optional() private thyParentForm: ThyFormDirective, private thyTranslate: ThyTranslate) {}
155

156
    ngOnInit() {
157
        this.isHorizontal = this.thyParentForm ? this.thyParentForm.isHorizontal : true;
158
    }
159
}
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