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

atinc / ngx-tethys / f7dabc41-0a99-4cba-84c1-0825df646971

23 Oct 2023 08:43AM UTC coverage: 90.218% (-0.005%) from 90.223%
f7dabc41-0a99-4cba-84c1-0825df646971

Pull #2860

circleci

su4g
feat: add restoreFocusOptions to control previously element focusing
Pull Request #2860: feat: add restoreFocusOptions to control previously element focusing #INFR-9782

5169 of 6389 branches covered (0.0%)

Branch coverage included in aggregate %.

1 of 1 new or added line in 1 file covered. (100.0%)

13047 of 13802 relevant lines covered (94.53%)

972.06 hits per line

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

0.0
/src/core/overlay/abstract-overlay.config.ts
1
import { Direction } from '@angular/cdk/bidi';
2
import { ViewContainerRef } from '@angular/core';
3

4
export interface ThyAbstractOverlayPosition {
5
    /** Override for the overlay's top position. */
6
    top?: string;
7

×
8
    /** Override for the overlay's bottom position. */
9
    bottom?: string;
10

11
    /** Override for the overlay's left position. */
12
    left?: string;
×
13

14
    /** Override for the overlay's right position. */
15
    right?: string;
16
}
17

×
18
export class ThyAbstractOverlayConfig<TData = unknown> {
19
    /**
20
     * 当前的组件的 viewContainerRef,指定后弹出的组件的父注入器为当前组件的注入器
21
     * @description.en-us Where the attached component should live in Angular's *logical* component tree.This affects what is available for injection and the change detection order for the component instantiated inside of the overlay. This does not affect where the overlay content will be rendered.
22
     */
×
23
    viewContainerRef?: ViewContainerRef;
24

×
25
    /**
26
     * 弹出框的唯一标识
27
     * @description.en-us ID for the overlay. If omitted, a unique one will be generated.
28
     */
29
    id?: string;
30

×
31
    /**
32
     * overlay panel 类名
33
     * @description.en-us Custom class for the overlay pane.
34
     */
35
    panelClass?: string | string[] = '';
36

×
37
    /** Custom class for the overlay component's host element. */
38
    hostClass?: string | string[];
39

40
    /**
41
     * 是否有幕布
×
42
     * @description.en-us Whether the overlay has a backdrop.
43
     */
×
44
    hasBackdrop? = true;
45

×
46
    /**
47
     * 自定义幕布的样式
×
48
     * @description.en-us Custom class for the backdrop.
49
     */
50
    backdropClass?: string | string[] = '';
51

52
    /**
×
53
     * @description 点击幕布或者按ESC键是否自动关闭弹出框,hasBackdrop=true 时该参数起作用
54
     * @description.en-us Whether the user can use escape or clicking on the backdrop to close the overlay.
55
     */
56
    backdropClosable? = true;
×
57

58
    /** Whether the user can use escape or clicking on the backdrop to close the overlay. */
59
    disableClose? = false;
60

61
    /**
×
62
     * 自定义弹出框的宽度
63
     * @default 660px
64
     * @description.en-us Width of the overlay.
65
     */
66
    width? = '';
67

68
    /**
69
     * 自定义弹出框的高度
70
     * @default 85vh
71
     * @description.en-us Height of the overlay.
72
     */
73
    height? = '';
74

75
    /**
76
     * 弹出框最小宽度
77
     * @description.en-us Min-width of the overlay. If a number is provided, pixel units are assumed.
78
     */
79
    minWidth?: number | string;
80

81
    /**
82
     * 弹出框最小高度
83
     * @description.en-us Min-height of the overlay. If a number is provided, pixel units are assumed.
84
     */
85
    minHeight?: number | string;
86

87
    /**
88
     * 弹出框最大宽度
89
     * @description.en-us Max-width of the overlay. If a number is provided, pixel units are assumed. Defaults to 80vw
90
     */
91
    maxWidth?: number | string;
92

93
    /**
94
     * 弹出框最大高度
95
     * @default 85vh
96
     * @description.en-us Max-height of the overlay. If a number is provided, pixel units are assumed.
97
     */
98
    maxHeight?: number | string;
99

100
    /**
101
     * 传入的初始化状态,弹出组件的变量会自动赋值,在 ngOnInit 生命周期钩子可以获取到,构造函数获取不到
102
     * @description.en-us Data being injected into the child component.
103
     */
104
    initialState?: TData | null = null;
105

106
    /** Layout direction for the overlay's content. */
107
    direction?: Direction;
108

109
    /** ID of the element that describes the overlay. */
110
    ariaDescribedBy?: string | null = null;
111

112
    /** Aria label to assign to the overlay element */
113
    ariaLabel?: string | null = null;
114

115
    /** Whether the overlay should focus the first focusable element on open. */
116
    autoFocus? = true;
117

118
    /**
119
     * Whether the overlay should restore focus to the
120
     * previously-focused element, after it's closed.
121
     */
122
    restoreFocus? = true;
123

124
    /**
125
     * Control the previously-focused element focusing process.
126
     */
127
    restoreFocusOptions?: FocusOptions = { preventScroll: true };
128

129
    /**
130
     * 切换浏览器导航是否自动关闭弹出框
131
     * @description.en-us Whether the overlay should close when the user goes backwards/forwards in history.Note that this usually doesn't include clicking on links (unless the user is using the `HashLocationStrategy`).
132
     */
133
    closeOnNavigation? = true;
134

135
    /**
136
     * 关闭弹窗前的回调函数,返回 false 可阻止关闭弹窗
137
     */
138
    canClose?: (result?: unknown) => boolean;
139
}
140

141
export interface ThyAbstractOverlayOptions {
142
    /** component name, e.g. dialog | popover | slide */
143
    name: string;
144
    /** Whether enable animation */
145
    animationEnabled: boolean;
146
    /** Whether dispose cdk overlay ref when close upper overlay */
147
    disposeWhenClose: boolean;
148
}
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