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

atinc / ngx-tethys / 4fa5f46d-cf0f-4aa7-aeb7-9c52248a4f70

29 Apr 2025 10:09AM UTC coverage: 90.253% (-0.02%) from 90.272%
4fa5f46d-cf0f-4aa7-aeb7-9c52248a4f70

Pull #3360

circleci

web-flow
Merge branch 'master' into #TINFR-1474
Pull Request #3360: refactor(grid): migration signal #TINFR-1474

5609 of 6876 branches covered (81.57%)

Branch coverage included in aggregate %.

30 of 32 new or added lines in 5 files covered. (93.75%)

9 existing lines in 3 files now uncovered.

13392 of 14177 relevant lines covered (94.46%)

920.4 hits per line

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

88.89
/src/grid/thy-col.directive.ts
1
import { Directive, AfterViewInit, inject, input, computed, effect } 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
})
27
export class ThyColDirective implements AfterViewInit {
28
    thyRowDirective = inject(ThyRowDirective, { optional: true, host: true })!;
8!
29

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

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

×
40
    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

55
    ngAfterViewInit(): void {
56
        if (this.thyRowDirective) {
1✔
57
            this.thyRowDirective.actualGutter$.pipe(this.takeUntilDestroyed).subscribe(([horizontalGutter, verticalGutter]) => {
58
                const renderGutter = (name: string, gutter: number) => {
59
                    this.hostRenderer.setStyle(name, `${gutter / 2}px`);
60
                };
61
                if (horizontalGutter > 0) {
62
                    renderGutter('padding-left', horizontalGutter);
63
                    renderGutter('padding-right', horizontalGutter);
64
                }
65
                if (verticalGutter > 0) {
66
                    renderGutter('padding-top', verticalGutter);
67
                    renderGutter('padding-bottom', verticalGutter);
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