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

atinc / ngx-tethys / 68ef226c-f83e-44c1-b8ed-e420a83c5d84

28 May 2025 10:31AM UTC coverage: 10.352% (-80.0%) from 90.316%
68ef226c-f83e-44c1-b8ed-e420a83c5d84

Pull #3460

circleci

pubuzhixing8
chore: xxx
Pull Request #3460: refactor(icon): migrate signal input #TINFR-1476

132 of 6823 branches covered (1.93%)

Branch coverage included in aggregate %.

10 of 14 new or added lines in 1 file covered. (71.43%)

11648 existing lines in 344 files now uncovered.

2078 of 14525 relevant lines covered (14.31%)

6.69 hits per line

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

10.0
/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 { NgClass, NgTemplateOutlet } from '@angular/common';
4
import {
5
    ChangeDetectionStrategy,
6
    Component,
7
    ElementRef,
8
    ModelSignal,
9
    OnInit,
10
    TemplateRef,
11
    contentChild,
12
    inject,
13
    input,
14
    model,
15
    output,
1✔
16
    viewChild
UNCOV
17
} from '@angular/core';
×
UNCOV
18
import { ThyIcon } from 'ngx-tethys/icon';
×
UNCOV
19
import { ThyPopover } from 'ngx-tethys/popover';
×
UNCOV
20
import { coerceBooleanProperty } from 'ngx-tethys/util';
×
UNCOV
21

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

65
    public groupHeaderPaddingLeft = 0;
66

67
    readonly _thyMenuGroup = viewChild<ElementRef>('thyMenuGroup');
68

69
    readonly headerContentTemplateRef = contentChild<TemplateRef<any>>('headerContent');
70

71
    /**
72
     * 分组标题
73
     */
74
    readonly thyTitle = input<string>('');
75

76
    /**
77
     * 是否处于收起状态
1✔
78
     */
79
    readonly thyCollapsed: ModelSignal<boolean> = model(false);
80

81
    /**
82
     * 是否支持展开收起
83
     */
84
    readonly thyCollapsible = input(false, { transform: coerceBooleanProperty });
85

86
    /**
87
     * 是否显示 Icon
88
     */
89
    readonly thyShowIcon = input(false, { transform: coerceBooleanProperty });
90

91
    /**
92
     * 图标
93
     */
94
    readonly thyIcon = input<string, string>('folder-bold', {
95
        transform: (value: string) => value || 'folder-bold'
96
    });
97

98
    /**
99
     * 操作图标
100
     */
101
    readonly thyActionIcon = input<string, string>('more', {
102
        transform: (value: string) => value || 'more'
103
    });
104

105
    /**
106
     *是否显示操作
107
     */
108
    readonly thyShowAction = input(false, { transform: coerceBooleanProperty });
109

110
    /**
111
     * 操作阻止冒泡事件
112
     */
113
    readonly thyActionStopPropagation = input(true, { transform: coerceBooleanProperty });
114

115
    /**
116
     * Action 点击事件
117
     */
118
    readonly thyOnActionClick = output<Event>();
119

120
    readonly thyCollapsedChange = output<boolean>();
121

122
    /**
123
     * 设置 Action 菜单
124
     */
125
    readonly thyActionMenu = input<ComponentType<any> | TemplateRef<any>>();
126

127
    constructor() {}
128

129
    ngOnInit(): void {}
130

131
    collapseGroup(): void {
132
        if (!this.thyCollapsible()) {
133
            return;
134
        }
135
        this.thyCollapsed.set(!this.thyCollapsed());
136
        this.thyCollapsedChange.emit(this.thyCollapsed());
137
    }
138

139
    onActionClick(event: Event): void {
140
        if (this.thyActionStopPropagation()) {
141
            event.stopPropagation();
142
        }
143
        if (this.thyActionMenu()) {
144
            this.popover.open(this.thyActionMenu(), {
145
                origin: event.currentTarget as HTMLElement,
146
                insideClosable: true,
147
                placement: 'bottom'
148
            });
149
        } else {
150
            this.thyOnActionClick.emit(event);
151
        }
152
    }
153
}
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