• 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

58.33
/src/collapse/collapse.component.ts
1
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
2
import { IThyCollapseItemComponent, IThyCollapseComponent, THY_COLLAPSE_COMPONENT } from './collapse.token';
3
import { coerceBooleanProperty } from 'ngx-tethys/util';
4

5
export type ThyCollapseTheme = 'divided' | 'bordered' | 'ghost';
6

7
export type ThyCollapsedIconPosition = 'left' | 'right';
8

9
/**
10
 * 折叠面板组件
11
 * @name thy-collapse
1✔
12
 * @order 10
13
 */
10✔
14
@Component({
10✔
15
    selector: 'thy-collapse',
10✔
16
    template: `
10✔
17
        <ng-container>
18
            <ng-content></ng-content>
19
        </ng-container>
80✔
20
    `,
21
    host: {
22
        class: 'thy-collapse',
80✔
23
        '[class.thy-collapse-divided]': `thyTheme() === 'divided'`,
24
        '[class.thy-collapse-bordered]': `thyTheme() === 'bordered'`,
25
        '[class.thy-collapse-ghost]': `thyTheme() === 'ghost'`,
3!
UNCOV
26
        '[class.thy-collapse-icon-position-right]': `thyArrowIconPosition() === 'right'`,
×
UNCOV
27
        '[class.thy-collapse-icon-position-left]': `thyArrowIconPosition() === 'left'`
×
28
    },
UNCOV
29
    changeDetection: ChangeDetectionStrategy.OnPush,
×
UNCOV
30
    providers: [
×
UNCOV
31
        {
×
UNCOV
32
            provide: THY_COLLAPSE_COMPONENT,
×
33
            useExisting: ThyCollapse
34
        }
35
    ]
36
})
3✔
37
export class ThyCollapse implements IThyCollapseComponent {
3✔
38
    /**
39
     * 折叠面板主题,支持 `divided` | `bordered` | `ghost`
1✔
40
     */
41
    readonly thyTheme = input<ThyCollapseTheme>('divided');
42

43
    /**
44
     * 是否为手风琴模式,手风琴模式下,只能展开一个面板
45
     */
1✔
46
    readonly thyAccordion = input(false, { transform: coerceBooleanProperty });
47

48
    /**
49
     * 展开收起图标的位置,支持 `left` | `right`
50
     */
51
    readonly thyArrowIconPosition = input<ThyCollapsedIconPosition>('left');
52

53
    private listOfCollapsePanelComponent: IThyCollapseItemComponent[] = [];
54

55
    addPanel(value: IThyCollapseItemComponent): void {
56
        this.listOfCollapsePanelComponent.push(value);
57
    }
58

59
    removePanel(value: IThyCollapseItemComponent): void {
60
        this.listOfCollapsePanelComponent.splice(this.listOfCollapsePanelComponent.indexOf(value), 1);
61
    }
62

63
    click(collapseItem: IThyCollapseItemComponent, event: Event): void {
64
        if (this.thyAccordion() && !collapseItem.thyActive()) {
65
            this.listOfCollapsePanelComponent
66
                .filter(item => item !== collapseItem)
67
                .forEach(item => {
68
                    if (item.thyActive()) {
69
                        item.thyActive.set(false);
70
                        item.thyActiveChange.emit({ active: collapseItem.thyActive(), event });
71
                        item.markForCheck();
72
                    }
73
                });
74
        }
75
        collapseItem.thyActive.set(!collapseItem.thyActive());
76
        collapseItem.thyActiveChange.emit({ active: collapseItem.thyActive(), event });
77
    }
78
}
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