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

atinc / ngx-tethys / 2bb461f1-51aa-4bcb-8006-30243e37cb19

16 May 2025 03:32AM UTC coverage: 90.253% (-0.02%) from 90.272%
2bb461f1-51aa-4bcb-8006-30243e37cb19

Pull #3360

circleci

invalid-email-address
fix: fix type
Pull Request #3360: refactor(grid): migration signal #TINFR-1474

5609 of 6876 branches covered (81.57%)

Branch coverage included in aggregate %.

30 of 31 new or added lines in 5 files covered. (96.77%)

11 existing lines in 5 files now uncovered.

13400 of 14186 relevant lines covered (94.46%)

919.97 hits per line

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

89.19
/src/grid/thy-col.directive.ts
1
import { Directive, inject, input, computed, effect, afterNextRender } from '@angular/core';
2
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
3
import { useHostRenderer } from '@tethys/cdk/dom';
4
import { ThyRowDirective } from './thy-row.directive';
5

6
export interface ThyColEmbeddedProperty {
7
    span?: number;
8
    pull?: number;
9
    push?: number;
10
    offset?: number;
11
    order?: number;
12
}
1✔
13

14
export type ThySpan = number | null | 'auto';
8✔
15

8✔
16
/**
8✔
17
 * 栅格列指令
8✔
18
 * @name thyCol
14✔
19
 * @order 35
14✔
20
 */
21
@Directive({
8✔
22
    selector: '[thyCol]',
8✔
23
    host: {
8✔
24
        class: 'thy-col'
14✔
25
    }
26
})
8✔
27
export class ThyColDirective {
8!
28
    thyRowDirective = inject(ThyRowDirective, { optional: true, host: true })!;
8✔
29

10✔
30
    /**
4✔
31
     * 栅格项的占位列数,thySpan 如果传递了值,以 thySpan 为准
32
     */
10✔
33
    readonly thyCol = input<ThySpan>();
2✔
34

2✔
35
    /**
36
     * 栅格项的占位列数
10!
UNCOV
37
     */
×
NEW
38
    readonly thySpan = input<ThySpan>();
×
39

40
    protected readonly span = computed(() => {
41
        const span = this.thySpan() ?? this.thyCol();
42
        return span || 24;
43
    });
44

45
    private hostRenderer = useHostRenderer();
14✔
46

14✔
47
    private takeUntilDestroyed = takeUntilDestroyed();
48

49
    constructor() {
50
        effect(() => {
1✔
51
            this.updateHostClass();
1✔
52
        });
53

54
        afterNextRender(() => {
55
            if (this.thyRowDirective) {
56
                this.thyRowDirective.actualGutter$.pipe(this.takeUntilDestroyed).subscribe(([horizontalGutter, verticalGutter]) => {
1✔
57
                    const renderGutter = (name: string, gutter: number) => {
58
                        this.hostRenderer.setStyle(name, `${gutter / 2}px`);
59
                    };
60
                    if (horizontalGutter > 0) {
61
                        renderGutter('padding-left', horizontalGutter);
62
                        renderGutter('padding-right', horizontalGutter);
63
                    }
64
                    if (verticalGutter > 0) {
65
                        renderGutter('padding-top', verticalGutter);
66
                        renderGutter('padding-bottom', verticalGutter);
67
                    }
68
                });
69
            }
70
        });
71
    }
72

73
    private updateHostClass() {
74
        const span = this.span();
75
        this.hostRenderer.updateClassByMap({
76
            [`thy-col-${span}`]: true
77
        });
78
    }
79
}
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