• 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/action/actions.component.ts
1
import {
2
    Component,
3
    OnInit,
4
    OnChanges,
5
    ChangeDetectionStrategy,
6
    Input,
7
    ContentChildren,
8
    QueryList,
9
    AfterContentInit,
1✔
10
    SimpleChanges
11
} from '@angular/core';
×
12
import { ThySpacingSize, getNumericSize } from 'ngx-tethys/core';
13
import { ThyActionComponent } from './action.component';
14

15
/**
×
16
 * Actions 组件
×
17
 * @name thy-actions
18
 */
19
@Component({
20
    selector: 'thy-actions',
×
21
    template: ` <ng-content></ng-content> `,
×
22
    changeDetection: ChangeDetectionStrategy.OnPush,
23
    host: {
×
24
        class: 'thy-actions'
25
    },
26
    standalone: true
×
27
})
28
export class ThyActionsComponent implements OnInit, AfterContentInit, OnChanges {
×
29
    @ContentChildren(ThyActionComponent) actions: QueryList<ThyActionComponent>;
×
30

31
    /**
32
     * 大小,支持 `zero` | `xxs` | `xs` | `sm` | `md` | `lg` | `xlg` 和自定义数字大小
33
     * @type string | number
1✔
34
     */
1✔
35
    @Input() thySize: ThySpacingSize = 'md';
36

37
    constructor() {}
38

39
    ngOnInit(): void {}
1✔
40

41
    ngOnChanges(changes: SimpleChanges): void {
42
        if (changes.thySize && !changes.thySize.firstChange && this.actions) {
43
            this.setActionsSize(this.actions.toArray());
44
        }
45
    }
46

47
    ngAfterContentInit(): void {
48
        this.actions.changes.subscribe((actions: ThyActionComponent[]) => {
49
            this.setActionsSize(actions);
50
        });
51
        this.setActionsSize(this.actions.toArray());
52
    }
53

54
    private setActionsSize(actions: ThyActionComponent[]) {
55
        actions.forEach((action: ThyActionComponent, index) => {
56
            // can't set marginRight value for last item
57
            if (index !== actions.length - 1) {
58
                action.setMarginRight(getNumericSize(this.thySize, 'md') + 'px');
59
            }
60
        });
61
    }
62
}
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