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

atinc / ngx-tethys / 0bbb2cec-209e-4d8a-b1b3-6bc54e05daa6

04 Sep 2023 08:40AM UTC coverage: 15.616% (-74.6%) from 90.2%
0bbb2cec-209e-4d8a-b1b3-6bc54e05daa6

Pull #2829

circleci

cmm-va
fix: add test
Pull Request #2829: fix: add tabIndex

300 of 6386 branches covered (0.0%)

Branch coverage included in aggregate %.

78 of 78 new or added lines in 26 files covered. (100.0%)

2849 of 13779 relevant lines covered (20.68%)

83.41 hits per line

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

77.27
/src/dropdown/dropdown-menu.component.ts
1
import { NgIf, NgTemplateOutlet } from '@angular/common';
2
import {
3
    ChangeDetectionStrategy,
4
    Component,
5
    Directive,
1✔
6
    HostBinding,
7
    Input,
8
    TemplateRef,
9
    ViewChild,
1✔
10
    ViewEncapsulation
11
} from '@angular/core';
×
12
import { InputBoolean, InputCssPixel } from 'ngx-tethys/core';
13
import { SafeAny } from 'ngx-tethys/types';
1✔
14

15
export type ThyDropdownMenuDividerType = 'default' | 'crossing' | '';
16

17
export const THY_DROPDOWN_DEFAULT_WIDTH = '240px';
1✔
18

19
/**
20
 * @private
21
 */
22
@Directive()
23
export class ThyDropdownAbstractMenu {
24
    @HostBinding('class.thy-dropdown-menu') addDropdownMenuClass = true;
25
}
26

1✔
27
/**
28
 * 下拉菜单组件
×
29
 * @name thy-dropdown-menu
30
 * @order 20
31
 */
×
32
@Component({
×
33
    selector: 'thy-dropdown-menu',
34
    template: `
1✔
35
        <ng-container *ngIf="thyImmediateRender; then content"> </ng-container>
1✔
36
        <ng-template #dropdownMenu>
37
            <div class="thy-dropdown-menu" [style.width]="thyWidth">
38
                <ng-container *ngTemplateOutlet="content"></ng-container>
39
            </div>
40
        </ng-template>
41
        <ng-template #content>
1✔
42
            <ng-content></ng-content>
43
        </ng-template>
44
    `,
45
    encapsulation: ViewEncapsulation.None,
1✔
46
    changeDetection: ChangeDetectionStrategy.OnPush,
47
    host: {
48
        '[class.thy-dropdown-menu]': 'thyImmediateRender',
49
        '[style.width]': "thyImmediateRender ? thyWidth : ''"
1✔
50
    },
51
    standalone: true,
52
    imports: [NgIf, NgTemplateOutlet]
53
})
54
export class ThyDropdownMenuComponent {
55
    get template() {
56
        return this.templateRef;
57
    }
58

59
    @ViewChild('dropdownMenu', { static: true }) templateRef!: TemplateRef<SafeAny>;
60

61
    /**
62
     * 设置菜单宽度
63
     * @default 240px
64
     */
65
    @Input()
66
    @InputCssPixel()
67
    thyWidth: number | string = THY_DROPDOWN_DEFAULT_WIDTH;
68

69
    /**
70
     * 是否直接渲染 dropdown-menu 中的元素
71
     * @default false
72
     */
73
    @Input() @InputBoolean() thyImmediateRender = false;
74

75
    constructor() {}
76
}
77

78
/**
79
 * 下拉菜单分组
80
 * @name thy-dropdown-menu-group
1✔
81
 * @order 50
82
 */
×
83
@Component({
84
    selector: 'thy-dropdown-menu-group',
85
    template: `
1✔
86
        <div class="dropdown-menu-group-title">{{ title }}</div>
1✔
87
        <ng-content></ng-content>
88
    `,
89
    changeDetection: ChangeDetectionStrategy.OnPush,
90
    host: {
1✔
91
        class: 'dropdown-menu-group'
92
    },
93
    standalone: true
94
})
95
export class ThyDropdownMenuGroupComponent {
96
    title: string;
97

98
    /**
99
     * 分组标题
100
     */
101
    @Input()
102
    set thyTitle(value: string) {
103
        this.title = value;
104
    }
105

106
    constructor() {}
107
}
108

109
/**
110
 * 下拉菜单分割线
1✔
111
 * @name thy-dropdown-menu-divider
112
 */
1✔
113
@Component({
114
    selector: 'thy-dropdown-menu-divider',
1✔
115
    template: ` <!-- <div class="dropdown-menu-divider-title">{{ title }}</div> --> `,
116
    host: {
117
        class: 'dropdown-menu-divider'
118
    },
119
    changeDetection: ChangeDetectionStrategy.OnPush,
120
    standalone: true
121
})
122
export class ThyDropdownMenuDividerComponent {
123
    constructor() {}
124
}
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