@ember-eui/core 5.13.0 → 5.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{{#let
|
|
2
2
|
(unique-id)
|
|
3
3
|
(class-names
|
|
4
|
-
(if this.isOpening
|
|
4
|
+
(if this.isOpening "euiPopover-isOpen")
|
|
5
5
|
position=this.anchorPosition
|
|
6
6
|
display=this.display
|
|
7
7
|
componentName="EuiPopover"
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
<div
|
|
20
20
|
class={{classes}}
|
|
21
21
|
...attributes
|
|
22
|
-
{{on-key "_all" this.onKeyDown}}
|
|
22
|
+
{{on-key "_all" this.onKeyDown priority=1}}
|
|
23
23
|
{{did-insert this.didInsertPopover}}
|
|
24
24
|
{{did-update this.didUpdateIsOpen @isOpen}}
|
|
25
25
|
{{did-update this.didUpdateRepositionOnScroll @repositionOnScroll}}
|
|
26
26
|
{{did-insert (optional @popoverRef)}}
|
|
27
27
|
>
|
|
28
28
|
|
|
29
|
-
{{
|
|
29
|
+
{{! button }}
|
|
30
30
|
<div
|
|
31
31
|
class="euiPopover__anchor {{@anchorClassName}}"
|
|
32
32
|
{{did-insert this.registerButton}}
|
|
@@ -34,11 +34,10 @@
|
|
|
34
34
|
{{yield to="button"}}
|
|
35
35
|
</div>
|
|
36
36
|
|
|
37
|
-
{{
|
|
37
|
+
{{! content }}
|
|
38
38
|
{{#if
|
|
39
39
|
(and
|
|
40
|
-
(not this.suppressingPopover)
|
|
41
|
-
(or this.isCurrentlyOpen this.isClosing)
|
|
40
|
+
(not this.suppressingPopover) (or this.isCurrentlyOpen this.isClosing)
|
|
42
41
|
)
|
|
43
42
|
}}
|
|
44
43
|
<EuiPortal @insert={{@insert}}>
|
|
@@ -57,15 +56,13 @@
|
|
|
57
56
|
@paddingSize={{this.panelPaddingSize}}
|
|
58
57
|
{{simple-style this._popoverStyles}}
|
|
59
58
|
{{did-insert this.registerPanel}}
|
|
60
|
-
{{outside-click-detector
|
|
59
|
+
{{outside-click-detector
|
|
60
|
+
onOutsideClick=(arg-or-default this.onClickOutside)
|
|
61
|
+
}}
|
|
61
62
|
{{on-key "Escape" this.onEscapeKey}}
|
|
62
63
|
{{focus-trap
|
|
63
64
|
isActive=(not
|
|
64
|
-
(or
|
|
65
|
-
(not this.ownFocus)
|
|
66
|
-
(not this.isOpenStable)
|
|
67
|
-
this.isClosing
|
|
68
|
-
)
|
|
65
|
+
(or (not this.ownFocus) (not this.isOpenStable) this.isClosing)
|
|
69
66
|
)
|
|
70
67
|
focusTrapOptions=(merge
|
|
71
68
|
(hash
|
|
@@ -75,7 +72,7 @@
|
|
|
75
72
|
onDeactivate=(optional @onTrapDeactivation)
|
|
76
73
|
preventScroll=true
|
|
77
74
|
clickOutsideDeactivates=true
|
|
78
|
-
fallbackFocus=(concat
|
|
75
|
+
fallbackFocus=(concat "#" panelId)
|
|
79
76
|
)
|
|
80
77
|
@focusTrapOptions
|
|
81
78
|
)
|
|
@@ -149,6 +149,10 @@ export type EuiPopoverArgs = {
|
|
|
149
149
|
'aria-labelledby'?: string;
|
|
150
150
|
|
|
151
151
|
tabindex?: string | number;
|
|
152
|
+
|
|
153
|
+
focusTrapOptions?: {
|
|
154
|
+
onClickOutside?: (e: Event) => void;
|
|
155
|
+
};
|
|
152
156
|
};
|
|
153
157
|
|
|
154
158
|
type AnchorPosition = 'up' | 'right' | 'down' | 'left';
|
|
@@ -279,8 +283,10 @@ export default class EuiPopoverComponent extends Component<EuiPopoverArgs> {
|
|
|
279
283
|
}
|
|
280
284
|
|
|
281
285
|
@action
|
|
282
|
-
onEscapeKey(event: Event): void {
|
|
286
|
+
onEscapeKey(event: Event, ekEvent?: Event): void {
|
|
283
287
|
if (this.isOpen) {
|
|
288
|
+
ekEvent?.stopPropagation();
|
|
289
|
+
ekEvent?.stopImmediatePropagation();
|
|
284
290
|
event.preventDefault();
|
|
285
291
|
event.stopPropagation();
|
|
286
292
|
this.closePopover();
|
|
@@ -288,18 +294,22 @@ export default class EuiPopoverComponent extends Component<EuiPopoverArgs> {
|
|
|
288
294
|
}
|
|
289
295
|
|
|
290
296
|
@action
|
|
291
|
-
onKeyDown(event: KeyboardEvent): void {
|
|
297
|
+
onKeyDown(event: KeyboardEvent, ekEvent: KeyboardEvent): void {
|
|
292
298
|
if (event.key === cascadingMenuKeys.ESCAPE) {
|
|
293
|
-
this.onEscapeKey(event as unknown as Event);
|
|
299
|
+
this.onEscapeKey(event as unknown as Event, ekEvent as unknown as Event);
|
|
294
300
|
}
|
|
295
301
|
}
|
|
296
302
|
|
|
297
303
|
@action
|
|
298
304
|
onClickOutside(event: Event): void {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
305
|
+
if (this.args.focusTrapOptions?.onClickOutside) {
|
|
306
|
+
this.args.focusTrapOptions.onClickOutside(event);
|
|
307
|
+
} else {
|
|
308
|
+
// only close the popover if the event source isn't the anchor button
|
|
309
|
+
// otherwise, it is up to the anchor to toggle the popover's open status
|
|
310
|
+
if (this.button && this.button.contains(event.target as Node) === false) {
|
|
311
|
+
this.closePopover();
|
|
312
|
+
}
|
|
303
313
|
}
|
|
304
314
|
}
|
|
305
315
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-eui/core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.14.1",
|
|
4
4
|
"description": "Ember Components for Elastic UI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -186,5 +186,5 @@
|
|
|
186
186
|
"volta": {
|
|
187
187
|
"extends": "../../package.json"
|
|
188
188
|
},
|
|
189
|
-
"gitHead": "
|
|
189
|
+
"gitHead": "fc26397439fe0c49280a839d84e3e9e48040d56f"
|
|
190
190
|
}
|