• 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

20.0
/src/collapse/collapse.component.ts
1
import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
2
import { InputBoolean } from 'ngx-tethys/core';
3

4
import { ThyCollapseItemComponent } from './collapse-item.component';
5

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

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

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

1✔
39
    /**
40
     * 是否为手风琴模式,手风琴模式下,只能展开一个面板
41
     * @default false
42
     */
43
    @Input() @InputBoolean() thyAccordion: boolean;
44

1✔
45
    /**
46
     * 展开收起图标的位置
47
     * @type left | right
48
     */
1✔
49
    @Input() thyArrowIconPosition: ThyCollapsedIconPosition = 'left';
50

51
    private listOfCollapsePanelComponent: ThyCollapseItemComponent[] = [];
52

53
    constructor() {}
54

55
    ngOnInit() {}
56

57
    addPanel(value: ThyCollapseItemComponent): void {
58
        this.listOfCollapsePanelComponent.push(value);
59
    }
60

61
    removePanel(value: ThyCollapseItemComponent): void {
62
        this.listOfCollapsePanelComponent.splice(this.listOfCollapsePanelComponent.indexOf(value), 1);
63
    }
64

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