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

atinc / ngx-tethys / 5ba5b9d7-3ca9-4ff2-bbba-bde58c0f849f

22 Feb 2024 09:41AM UTC coverage: 90.604%. Remained the same
5ba5b9d7-3ca9-4ff2-bbba-bde58c0f849f

Pull #3027

circleci

minlovehua
feat(schematics): provide schematics for removing the suffix of standalone components #INFR-11662
Pull Request #3027: refactor: remove the component suffix for standalone components and provide schematics #INFR-10654

5425 of 6642 branches covered (81.68%)

Branch coverage included in aggregate %.

323 of 333 new or added lines in 193 files covered. (97.0%)

36 existing lines in 8 files now uncovered.

13504 of 14250 relevant lines covered (94.76%)

981.28 hits per line

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

70.45
/src/menu/group/menu-group.component.ts
1
import { animate, state, style, transition, trigger } from '@angular/animations';
2
import { ComponentType } from '@angular/cdk/portal';
3
import {
4
    ChangeDetectionStrategy,
5
    Component,
6
    ContentChild,
7
    ElementRef,
8
    EventEmitter,
9
    HostBinding,
10
    Input,
11
    OnInit,
12
    Output,
13
    TemplateRef,
14
    ViewChild
1✔
15
} from '@angular/core';
16
import { InputBoolean } from 'ngx-tethys/core';
25✔
17
import { ThyPopover } from 'ngx-tethys/popover';
18
import { ThyIcon } from 'ngx-tethys/icon';
19
import { NgClass, NgIf, NgTemplateOutlet } from '@angular/common';
×
20

21
/**
22
 * 菜单分组组件
×
23
 * @name thy-menu-group,[thy-menu-group],[thyMenuGroup]
24
 * @order 30
25
 */
×
26
@Component({
27
    selector: 'thy-menu-group,[thy-menu-group],[thyMenuGroup]',
28
    templateUrl: './menu-group.component.html',
25✔
29
    animations: [
30
        trigger('detailsContentAnimation', [
31
            state(
×
32
                'void',
33
                style({
34
                    height: '*'
25✔
35
                })
25✔
36
            ),
25✔
37
            state(
25✔
38
                '1',
25✔
39
                style({
25✔
40
                    height: 0,
25✔
41
                    overflow: 'hidden'
25✔
42
                })
25✔
43
            ),
25✔
44
            state(
25✔
45
                '0',
25✔
46
                style({
25✔
47
                    height: '*'
48
                })
49
            ),
50
            transition('* => *', animate('0ms ease-out'))
2✔
51
        ])
1✔
52
    ],
53
    changeDetection: ChangeDetectionStrategy.OnPush,
1✔
54
    standalone: true,
1✔
55
    imports: [NgClass, NgIf, NgTemplateOutlet, ThyIcon]
56
})
NEW
57
export class ThyMenuGroup implements OnInit {
×
58
    public _actionMenu: ComponentType<any> | TemplateRef<any>;
×
59

60
    public rightIconClass = 'more';
×
61

×
62
    public iconClass = 'folder-bold';
63

64
    public groupHeaderPaddingLeft = 0;
65

66
    @ViewChild('thyMenuGroup', { static: true }) _thyMenuGroup: ElementRef;
67

68
    @ContentChild('headerContent')
×
69
    headerContentTemplateRef: TemplateRef<any>;
70

71
    @HostBinding('class.thy-menu-group') isThyMenuGroup = true;
1✔
72

73
    @HostBinding('class.has-icon') showIcon = false;
74

1✔
75
    @HostBinding('class.collapsed') isCollapsed = false;
76

77
    /**
78
     * 分组标题
79
     */
80
    @Input() thyTitle = '';
81

82
    /**
83
     * 已废弃,请使用 thyCollapsed
84
     * @deprecated
85
     */
86
    @Input('thyExpand')
87
    @InputBoolean()
88
    set thyExpand(value: boolean) {
89
        this.isCollapsed = !!!value;
90
    }
91

92
    /**
93
     * 是否处于收起状态
94
     * @default false
1✔
95
     */
96
    @Input('thyCollapsed')
97
    @InputBoolean()
98
    set thyCollapsed(value: boolean) {
99
        this.isCollapsed = value;
1✔
100
    }
101

102
    /**
103
     * 是否支持展开收起
104
     */
1✔
105
    @Input() @InputBoolean() thyCollapsible: boolean = false;
106

107
    /**
108
     * 是否显示 Icon
1✔
109
     */
110
    @Input('thyShowIcon')
111
    @InputBoolean()
112
    set thyShowIcon(value: boolean) {
113
        this.showIcon = value;
1✔
114
    }
115

116
    /**
117
     * 图标
1✔
118
     */
119
    @Input('thyIcon')
120
    set thyIcon(value: string) {
121
        this.iconClass = value;
1✔
122
    }
123

124
    /**
125
     * 操作图标
126
     */
127
    @Input('thyActionIcon')
128
    set thyActionIcon(value: string) {
129
        this.rightIconClass = value;
130
    }
131

132
    /**
133
     *是否显示操作
134
     */
135
    @Input() @InputBoolean() thyShowAction = false;
136

137
    /**
138
     * 操作阻止冒泡事件
139
     */
140
    @Input() @InputBoolean() thyActionStopPropagation = true;
141

142
    /**
143
     * Action 点击事件
144
     */
145
    @Output() thyOnActionClick: EventEmitter<Event> = new EventEmitter<Event>();
146

147
    @Output() thyCollapsedChange: EventEmitter<boolean> = new EventEmitter<boolean>();
148

149
    /**
150
     * 设置 Action 菜单
151
     */
152
    @Input()
153
    set thyActionMenu(value: ComponentType<any> | TemplateRef<any>) {
154
        this._actionMenu = value;
155
    }
156

157
    constructor(private popover: ThyPopover) {}
158

159
    ngOnInit(): void {}
160

161
    collapseGroup(): void {
162
        if (!this.thyCollapsible) {
163
            return;
164
        }
165
        this.isCollapsed = !this.isCollapsed;
166
        this.thyCollapsedChange.emit(this.isCollapsed);
167
    }
168

169
    onActionClick(event: Event): void {
170
        if (this.thyActionStopPropagation) {
171
            event.stopPropagation();
172
        }
173
        if (this._actionMenu) {
174
            this.popover.open(this._actionMenu, {
175
                origin: event.currentTarget as HTMLElement,
176
                insideClosable: true,
177
                placement: 'bottom'
178
            });
179
        } else {
180
            this.thyOnActionClick.emit(event);
181
        }
182
    }
183
}
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