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

atinc / ngx-tethys / 68ef226c-f83e-44c1-b8ed-e420a83c5d84

28 May 2025 10:31AM UTC coverage: 10.352% (-80.0%) from 90.316%
68ef226c-f83e-44c1-b8ed-e420a83c5d84

Pull #3460

circleci

pubuzhixing8
chore: xxx
Pull Request #3460: refactor(icon): migrate signal input #TINFR-1476

132 of 6823 branches covered (1.93%)

Branch coverage included in aggregate %.

10 of 14 new or added lines in 1 file covered. (71.43%)

11648 existing lines in 344 files now uncovered.

2078 of 14525 relevant lines covered (14.31%)

6.69 hits per line

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

13.04
/src/grid/thy-grid-item.component.ts
1
import { ChangeDetectionStrategy, Component, ElementRef, OnInit, inject, DestroyRef, input } from '@angular/core';
2
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
3
import { THY_GRID_COMPONENT } from './grid.token';
4
import { ThyGridResponsiveDescription, THY_GRID_ITEM_DEFAULT_SPAN } from './grid.type';
5
import { useHostRenderer } from '@tethys/cdk/dom';
6

7
/**
8
 * 栅格项组件
9
 * @name thy-grid-item,[thyGridItem]
10
 * @order 15
11
 */
12
@Component({
13
    selector: 'thy-grid-item,[thyGridItem]',
1✔
14
    template: '<ng-content></ng-content>',
UNCOV
15
    changeDetection: ChangeDetectionStrategy.OnPush,
×
UNCOV
16
    host: {
×
UNCOV
17
        class: 'thy-grid-item'
×
UNCOV
18
    }
×
UNCOV
19
})
×
UNCOV
20
export class ThyGridItem implements OnInit {
×
UNCOV
21
    elementRef = inject(ElementRef);
×
UNCOV
22
    private grid = inject(THY_GRID_COMPONENT, { optional: true })!;
×
23

24
    /**
UNCOV
25
     * 栅格项的占位列数,为 0 时会隐藏该栅格项
×
UNCOV
26
     * @default 1
×
27
     */
28
    readonly thySpan = input<number | ThyGridResponsiveDescription>(THY_GRID_ITEM_DEFAULT_SPAN);
29

UNCOV
30
    /**
×
UNCOV
31
     * 栅格项左侧的偏移列数
×
UNCOV
32
     */
×
UNCOV
33
    readonly thyOffset = input<number | ThyGridResponsiveDescription>(0);
×
34

35
    private readonly destroyRef = inject(DestroyRef);
1✔
36

37
    private hostRenderer = useHostRenderer();
38

39
    public span: number = THY_GRID_ITEM_DEFAULT_SPAN;
40

1✔
41
    public offset: number = 0;
42

43
    ngOnInit(): void {
44
        this.grid.gridItemPropValueChange$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
45
            this.setGridItemStyle();
46
        });
47
    }
48

49
    private setGridItemStyle() {
50
        const xGap: number = this.grid?.xGap || 0;
51

52
        this.hostRenderer.setStyle('display', this.span === 0 ? 'none' : '');
53

54
        this.hostRenderer.setStyle('grid-column', `span ${this.span}`);
55

56
        this.hostRenderer.setStyle(
57
            'margin-left',
58
            this.offset ? `calc(((100% - ${(this.span - 1) * xGap}px) / ${this.span} + ${xGap}px) * ${this.offset})` : ''
59
        );
60
    }
61
}
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