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

atinc / ngx-tethys / #55

30 Jul 2025 07:08AM UTC coverage: 9.866% (-80.4%) from 90.297%
#55

push

why520crazy
feat(empty): add setMessage for update display text #TINFR-2616

92 of 6794 branches covered (1.35%)

Branch coverage included in aggregate %.

2014 of 14552 relevant lines covered (13.84%)

6.15 hits per line

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

38.89
/src/space/space.component.ts
1
import { useHostRenderer } from '@tethys/cdk/dom';
2

3
import { ChangeDetectionStrategy, Component, Directive, input, TemplateRef, computed, effect, contentChildren } from '@angular/core';
4
import { ThySpacingSize, getNumericSize } from 'ngx-tethys/core';
5
import { NgTemplateOutlet } from '@angular/common';
6
import { coerceBooleanProperty } from 'ngx-tethys/util';
7

8
/**
9
 * 间距组件项,使用结构性指令 *thySpaceItem 传入模板
10
 * @name thySpaceItem
11
 * @order 20
12
 */
13
@Directive({ selector: '[thySpaceItem]', host: { class: 'thy-space-item' } })
14
export class ThySpaceItemDirective {}
1✔
15

16
const DEFAULT_SIZE: ThySpacingSize = 'md';
1✔
17

18
/**
19
 * 间距组件
20
 * @name thy-space
1✔
21
 * @order 10
22
 */
23
@Component({
24
    selector: 'thy-space',
25
    templateUrl: './space.component.html',
26
    changeDetection: ChangeDetectionStrategy.OnPush,
1✔
27
    host: {
28
        '[class.thy-space]': 'true',
×
29
        '[class.thy-space-vertical]': 'thyVertical()'
×
30
    },
×
31
    imports: [NgTemplateOutlet]
×
32
})
33
export class ThySpace {
×
34
    private hostRenderer = useHostRenderer();
×
35

×
36
    /**
×
37
     * 大小,支持 `zero` | `xxs` | `xs` | `sm` | `md` | `lg` | `xlg` 和自定义数字大小
×
38
     * @type string | number
39
     */
40
    readonly thySize = input<ThySpacingSize>(DEFAULT_SIZE);
1✔
41

1✔
42
    readonly space = computed(() => {
43
        return getNumericSize(this.thySize(), DEFAULT_SIZE);
44
    });
45

46
    /**
47
     * 间距垂直方向,默认是水平方向
48
     */
1✔
49
    readonly thyVertical = input<string | boolean, boolean>(false, { transform: coerceBooleanProperty });
50

51
    // @ClassBinding(`align-items-{{value}}`)
52
    /**
53
     * 对齐方式,可选择 `start` | `end` | `baseline` | `center`
54
     */
55
    readonly thyAlign = input<string>();
56

57
    readonly items = contentChildren(ThySpaceItemDirective, { read: TemplateRef<HTMLElement> });
58

59
    constructor() {
60
        effect(() => {
61
            this.hostRenderer.updateClass(this.thyAlign() ? [`align-items-${this.thyAlign()}`] : []);
62
        });
63
    }
64
}
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