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

atinc / ngx-tethys / d4d3bf94-0b08-4dba-b53c-fd90c5e0b80a

27 Mar 2025 01:46AM UTC coverage: 90.236% (+0.06%) from 90.179%
d4d3bf94-0b08-4dba-b53c-fd90c5e0b80a

push

circleci

minlovehua
feat: save draft

5598 of 6865 branches covered (81.54%)

Branch coverage included in aggregate %.

8 of 8 new or added lines in 7 files covered. (100.0%)

157 existing lines in 46 files now uncovered.

13357 of 14141 relevant lines covered (94.46%)

992.52 hits per line

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

64.86
/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
    inject
16
} from '@angular/core';
26✔
17
import { ThyPopover } from 'ngx-tethys/popover';
26✔
18
import { ThyIcon } from 'ngx-tethys/icon';
26✔
19
import { NgClass, NgTemplateOutlet } from '@angular/common';
26✔
20
import { coerceBooleanProperty } from 'ngx-tethys/util';
26✔
21

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

60
    public _actionMenu: ComponentType<any> | TemplateRef<any>;
×
UNCOV
61

×
62
    public rightIconClass = 'more';
63

64
    public iconClass = 'folder-bold';
65

66
    public groupHeaderPaddingLeft = 0;
67

UNCOV
68
    @ViewChild('thyMenuGroup', { static: true }) _thyMenuGroup: ElementRef;
×
69

70
    @ContentChild('headerContent')
71
    headerContentTemplateRef: TemplateRef<any>;
1✔
72

73
    @HostBinding('class.thy-menu-group') isThyMenuGroup = true;
74

75
    @HostBinding('class.has-icon') showIcon = false;
76

77
    @HostBinding('class.collapsed') isCollapsed = false;
78

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

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

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

102
    /**
103
     * 是否支持展开收起
104
     */
105
    @Input({ transform: coerceBooleanProperty }) thyCollapsible: boolean = false;
106

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

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

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

131
    /**
132
     *是否显示操作
133
     */
134
    @Input({ transform: coerceBooleanProperty }) thyShowAction = false;
135

136
    /**
137
     * 操作阻止冒泡事件
138
     */
139
    @Input({ transform: coerceBooleanProperty }) thyActionStopPropagation = true;
140

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

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

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

156
    ngOnInit(): void {}
157

158
    collapseGroup(): void {
159
        if (!this.thyCollapsible) {
160
            return;
161
        }
162
        this.isCollapsed = !this.isCollapsed;
163
        this.thyCollapsedChange.emit(this.isCollapsed);
164
    }
165

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