• 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

4.55
/src/guider/guider.service.ts
1
import { Router } from '@angular/router';
2
import { helpers } from 'ngx-tethys/util';
3
import { DOCUMENT } from '@angular/common';
4
import { ThyGuiderRef } from './guider-ref';
5
import { NgZone, inject } from '@angular/core';
6
import { ThyPopover } from 'ngx-tethys/popover';
7
import { ThyGuiderManager } from './guider-manager';
8
import { Injectable, RendererFactory2 } from '@angular/core';
9
import { ThyGuiderStep, ThyGuiderConfig, defaultGuiderPositionConfig } from './guider.class';
10
import { Overlay } from '@angular/cdk/overlay';
11

12
/**
13
 * 新手引导服务
14
 * @public
15
 * @order 10
16
 */
17
@Injectable({
1✔
18
    providedIn: 'root'
UNCOV
19
})
×
UNCOV
20
export class ThyGuider {
×
UNCOV
21
    private readonly rendererFactory = inject(RendererFactory2);
×
UNCOV
22
    private popover = inject(ThyPopover);
×
UNCOV
23
    private router = inject(Router);
×
UNCOV
24
    private guiderManager = inject(ThyGuiderManager);
×
UNCOV
25
    private ngZone = inject(NgZone);
×
UNCOV
26
    private overlay = inject(Overlay);
×
27
    private document = inject(DOCUMENT);
28

UNCOV
29
    private guiderRef: ThyGuiderRef;
×
UNCOV
30

×
UNCOV
31
    private guiderRefs: ThyGuiderRef[] = [];
×
32

33
    public create(config: ThyGuiderConfig): ThyGuiderRef {
UNCOV
34
        if (typeof ngDevMode === 'undefined' || ngDevMode) {
×
UNCOV
35
            if (!config || !config?.steps || !helpers.isArray(config?.steps)) {
×
UNCOV
36
                throw new Error(`'config.steps' must be an array of length greater than 0`);
×
UNCOV
37
            }
×
UNCOV
38
        }
×
39
        const normalizeConfig = this.normalizeConfig(config);
UNCOV
40
        this.guiderRef = new ThyGuiderRef(
×
UNCOV
41
            normalizeConfig,
×
42
            this.rendererFactory,
43
            this.popover,
UNCOV
44
            this.router,
×
UNCOV
45
            this.guiderManager,
×
UNCOV
46
            this.ngZone,
×
47
            this.overlay,
UNCOV
48
            this.document
×
49
        );
50
        this.guiderRef.closed().subscribe(() => {
UNCOV
51
            const index = this.guiderRefs.findIndex(guiderRef => guiderRef === this.guiderRef);
×
52
            this.guiderRefs.splice(index, 1);
53
        });
54
        this.guiderRefs.push(this.guiderRef);
55
        return this.guiderRef;
UNCOV
56
    }
×
57

58
    private normalizeConfig(config: ThyGuiderConfig): ThyGuiderConfig {
UNCOV
59
        const normalizeConfig = Object.assign({}, defaultGuiderPositionConfig, config);
×
UNCOV
60
        normalizeConfig.steps = normalizeConfig.steps.map(step => {
×
UNCOV
61
            return this.normalizeStep(step, normalizeConfig);
×
UNCOV
62
        });
×
UNCOV
63
        return normalizeConfig;
×
64
    }
65

66
    private normalizeStep(step: ThyGuiderStep, config: ThyGuiderConfig): ThyGuiderStep {
67
        const tempStep = Object.assign(
68
            {
1✔
69
                hintPlacement: config.hintPlacement,
70
                hintOffset: config.hintOffset,
71
                pointOffset: config.pointOffset
72
            },
73
            step
74
        );
75

76
        return tempStep;
77
    }
78

79
    close() {
80
        if (this.guiderRefs.length > 0) {
81
            const lasGuiderRef = this.guiderRefs[this.guiderRefs.length - 1];
82
            if (lasGuiderRef) {
83
                lasGuiderRef.close();
84
                this.guiderRefs.pop();
85
            }
86
        }
87
    }
88
}
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