• 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

45.0
/src/space/space.component.ts
1
import { InputBoolean, UnsubscribeMixin } from 'ngx-tethys/core';
2
import { useHostRenderer } from '@tethys/cdk/dom';
3
import { takeUntil } from 'rxjs/operators';
4

5
import {
6
    AfterContentInit,
7
    ChangeDetectionStrategy,
8
    ChangeDetectorRef,
9
    Component,
10
    ContentChildren,
11
    Directive,
12
    HostBinding,
13
    Input,
14
    OnInit,
1✔
15
    QueryList,
16
    TemplateRef
17
} from '@angular/core';
1✔
18
import { ThySpacingSize, getNumericSize } from 'ngx-tethys/core';
19
import { NgFor, NgTemplateOutlet } from '@angular/common';
1✔
20

21
/**
22
 * 间距组件项,使用结构性指令 *thySpaceItem 传入模板
23
 * @name thySpaceItem
24
 * @order 20
25
 */
26
@Directive({
27
    selector: '[thySpaceItem]',
28
    host: {
29
        class: 'thy-space-item'
30
    },
1✔
31
    standalone: true
32
})
33
export class ThySpaceItemDirective implements OnInit {
34
    constructor() {}
35

36
    ngOnInit(): void {}
1✔
37
}
38

×
39
const DEFAULT_SIZE: ThySpacingSize = 'md';
40

41
/**
×
42
 * 间距组件
43
 * @name thy-space
44
 * @order 10
×
45
 */
×
46
@Component({
×
47
    selector: 'thy-space',
×
48
    templateUrl: './space.component.html',
×
49
    changeDetection: ChangeDetectionStrategy.OnPush,
50
    host: {
51
        class: 'thy-space'
52
    },
×
53
    standalone: true,
×
54
    imports: [NgFor, NgTemplateOutlet]
55
})
56
export class ThySpaceComponent extends UnsubscribeMixin implements OnInit, AfterContentInit {
1✔
57
    public space: number = getNumericSize(DEFAULT_SIZE);
58

59
    private hostRenderer = useHostRenderer();
1✔
60

61
    /**
62
     * 大小,支持 `zero` | `xxs` | `xs` | `sm` | `md` | `lg` | `xlg` 和自定义数字大小
63
     * @type string | number
64
     */
65
    @Input() set thySize(size: ThySpacingSize) {
66
        this.space = getNumericSize(size, DEFAULT_SIZE);
1✔
67
    }
68

69
    /**
70
     * 间距垂直方向,默认是水平方向
1✔
71
     */
72
    @HostBinding(`class.thy-space-vertical`)
73
    @Input()
74
    @InputBoolean()
75
    thyVertical: boolean = false;
76

77
    // @ClassBinding(`align-items-{{value}}`)
78
    /**
79
     * 对齐方式,可选择 `start` | `end` | `baseline` | `center`
80
     */
81
    @Input()
82
    set thyAlign(align: string) {
83
        this.hostRenderer.updateClass(align ? [`align-items-${align}`] : []);
84
    }
85

86
    @ContentChildren(ThySpaceItemDirective, { read: TemplateRef }) items!: QueryList<TemplateRef<HTMLElement>>;
87

88
    constructor(private cdr: ChangeDetectorRef) {
89
        super();
90
    }
91

92
    ngOnInit(): void {}
93

94
    ngAfterContentInit(): void {
95
        this.items.changes.pipe(takeUntil(this.ngUnsubscribe$)).subscribe(() => {
96
            this.cdr.markForCheck();
97
        });
98
    }
99
}
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