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

atinc / ngx-tethys / d9ae709b-3c27-4b69-b125-b8b80b54f90b

pending completion
d9ae709b-3c27-4b69-b125-b8b80b54f90b

Pull #2757

circleci

mengshuicmq
fix: fix code review
Pull Request #2757: feat(color-picker): color-picker support disabled (#INFR-8645)

98 of 6315 branches covered (1.55%)

Branch coverage included in aggregate %.

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

2392 of 13661 relevant lines covered (17.51%)

83.12 hits per line

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

16.13
/src/menu/item/action/menu-item-action.component.ts
1
import { ComponentType } from '@angular/cdk/portal';
2
import { Component, ElementRef, Input, OnDestroy, Renderer2, TemplateRef } from '@angular/core';
3
import { InputBoolean } from 'ngx-tethys/core';
4
import { ThyPopover } from 'ngx-tethys/popover';
5

6
/**
7
 * 菜单项操作组件
8
 * @name thy-menu-item-action,[thy-menu-item-action],[thyMenuItemAction]
9
 * @order 25
10
 */
11
@Component({
1✔
12
    selector: 'thy-menu-item-action,[thy-menu-item-action],[thyMenuItemAction]',
13
    templateUrl: './menu-item-action.component.html',
×
14
    host: {
×
15
        class: 'thy-menu-item-action'
×
16
    },
17
    standalone: true
18
})
19
export class ThyMenuItemActionComponent implements OnDestroy {
×
20
    _boundEvent = false;
×
21

22
    _actionMenu: ComponentType<any> | TemplateRef<any>;
×
23

×
24
    /**
×
25
     * 设置 Action 菜单
×
26
     */
27
    @Input()
×
28
    set thyActionMenu(value: ComponentType<any> | TemplateRef<any>) {
×
29
        this._actionMenu = value;
30
        if (this._actionMenu) {
31
            this.bindClickEvent();
32
        }
33
    }
34

35
    /**
36
     * 是否阻止事件冒泡
37
     */
×
38
    @Input() @InputBoolean() thyStopPropagation = true;
×
39

×
40
    private bindClickEvent() {
×
41
        if (this._boundEvent) {
×
42
            return;
×
43
        }
44
        this._boundEvent = true;
45
        this.removeClickListenerFn = this.renderer.listen(this.elementRef.nativeElement, 'click', event => {
×
46
            if (this.thyStopPropagation) {
47
                event.stopPropagation();
1✔
48
            }
49
            if (this._actionMenu) {
50
                this.popover.open(this._actionMenu, {
51
                    origin: event.currentTarget as HTMLElement,
52
                    insideClosable: true,
1✔
53
                    placement: 'bottom'
54
                });
55
            }
56
        });
57
    }
1✔
58

59
    private removeClickListenerFn: VoidFunction | null = null;
60

61
    constructor(private popover: ThyPopover, private renderer: Renderer2, private elementRef: ElementRef) {}
1✔
62

63
    ngOnDestroy(): void {
64
        this.removeClickListenerFn?.();
65
    }
66
}
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