@radix-ng/primitives 0.50.0 → 1.0.0-beta.0
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.
- package/collection/README.md +1 -0
- package/fesm2022/radix-ng-primitives-accordion.mjs +134 -66
- package/fesm2022/radix-ng-primitives-accordion.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-alert-dialog.mjs +224 -132
- package/fesm2022/radix-ng-primitives-alert-dialog.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-arrow.mjs +26 -10
- package/fesm2022/radix-ng-primitives-arrow.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-aspect-ratio.mjs +6 -6
- package/fesm2022/radix-ng-primitives-aspect-ratio.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-avatar.mjs +68 -75
- package/fesm2022/radix-ng-primitives-avatar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-button.mjs +123 -0
- package/fesm2022/radix-ng-primitives-button.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-calendar.mjs +104 -103
- package/fesm2022/radix-ng-primitives-calendar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-checkbox.mjs +414 -80
- package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-collapsible.mjs +193 -92
- package/fesm2022/radix-ng-primitives-collapsible.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-collection.mjs +72 -0
- package/fesm2022/radix-ng-primitives-collection.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-config.mjs +5 -5
- package/fesm2022/radix-ng-primitives-config.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-context-menu.mjs +143 -427
- package/fesm2022/radix-ng-primitives-context-menu.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-core.mjs +757 -757
- package/fesm2022/radix-ng-primitives-core.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-cropper.mjs +55 -53
- package/fesm2022/radix-ng-primitives-cropper.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-date-field.mjs +93 -86
- package/fesm2022/radix-ng-primitives-date-field.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-dialog.mjs +658 -330
- package/fesm2022/radix-ng-primitives-dialog.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-dismissable-layer.mjs +98 -76
- package/fesm2022/radix-ng-primitives-dismissable-layer.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-drawer.mjs +1059 -0
- package/fesm2022/radix-ng-primitives-drawer.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-editable.mjs +20 -20
- package/fesm2022/radix-ng-primitives-editable.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-field.mjs +363 -0
- package/fesm2022/radix-ng-primitives-field.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-fieldset.mjs +79 -0
- package/fesm2022/radix-ng-primitives-fieldset.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-focus-guards.mjs +3 -3
- package/fesm2022/radix-ng-primitives-focus-guards.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-focus-scope.mjs +29 -14
- package/fesm2022/radix-ng-primitives-focus-scope.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-input.mjs +172 -0
- package/fesm2022/radix-ng-primitives-input.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-label.mjs +11 -11
- package/fesm2022/radix-ng-primitives-label.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-menu.mjs +1484 -353
- package/fesm2022/radix-ng-primitives-menu.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-menubar.mjs +290 -162
- package/fesm2022/radix-ng-primitives-menubar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-meter.mjs +271 -0
- package/fesm2022/radix-ng-primitives-meter.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-navigation-menu.mjs +1060 -1553
- package/fesm2022/radix-ng-primitives-navigation-menu.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-number-field.mjs +1102 -366
- package/fesm2022/radix-ng-primitives-number-field.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-pagination.mjs +51 -51
- package/fesm2022/radix-ng-primitives-pagination.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-popover.mjs +980 -995
- package/fesm2022/radix-ng-primitives-popover.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-popper.mjs +137 -82
- package/fesm2022/radix-ng-primitives-popper.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-portal.mjs +40 -16
- package/fesm2022/radix-ng-primitives-portal.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-presence.mjs +134 -246
- package/fesm2022/radix-ng-primitives-presence.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-preview-card.mjs +997 -0
- package/fesm2022/radix-ng-primitives-preview-card.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-progress.mjs +231 -92
- package/fesm2022/radix-ng-primitives-progress.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-radio.mjs +211 -70
- package/fesm2022/radix-ng-primitives-radio.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-roving-focus.mjs +127 -77
- package/fesm2022/radix-ng-primitives-roving-focus.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-select.mjs +791 -511
- package/fesm2022/radix-ng-primitives-select.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-separator.mjs +16 -45
- package/fesm2022/radix-ng-primitives-separator.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-slider.mjs +976 -720
- package/fesm2022/radix-ng-primitives-slider.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-stepper.mjs +69 -71
- package/fesm2022/radix-ng-primitives-stepper.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-switch.mjs +128 -124
- package/fesm2022/radix-ng-primitives-switch.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-tabs.mjs +388 -115
- package/fesm2022/radix-ng-primitives-tabs.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-time-field.mjs +111 -117
- package/fesm2022/radix-ng-primitives-time-field.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toggle-group.mjs +122 -248
- package/fesm2022/radix-ng-primitives-toggle-group.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toggle.mjs +99 -62
- package/fesm2022/radix-ng-primitives-toggle.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toolbar.mjs +307 -94
- package/fesm2022/radix-ng-primitives-toolbar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-tooltip.mjs +690 -1079
- package/fesm2022/radix-ng-primitives-tooltip.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-visually-hidden.mjs +46 -87
- package/fesm2022/radix-ng-primitives-visually-hidden.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives.mjs.map +1 -1
- package/meter/README.md +3 -0
- package/navigation-menu/README.md +2 -1
- package/package.json +85 -63
- package/portal/README.md +2 -0
- package/preview-card/README.md +3 -0
- package/schematics/collection.json +1 -0
- package/schematics/ng-add/index.d.ts +3 -2
- package/schematics/ng-add/index.js +62 -31
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics/ng-add/package-config.d.ts +4 -2
- package/schematics/ng-add/package-config.js +10 -2
- package/schematics/ng-add/package-config.js.map +1 -1
- package/schematics/ng-add/schema.d.ts +3 -0
- package/schematics/ng-add/schema.js +3 -0
- package/schematics/ng-add/schema.js.map +1 -0
- package/schematics/ng-add/schema.json +14 -0
- package/select/README.md +2 -0
- package/{accordion/index.d.ts → types/radix-ng-primitives-accordion.d.ts} +102 -67
- package/types/radix-ng-primitives-alert-dialog.d.ts +114 -0
- package/{arrow/index.d.ts → types/radix-ng-primitives-arrow.d.ts} +1 -1
- package/{aspect-ratio/index.d.ts → types/radix-ng-primitives-aspect-ratio.d.ts} +1 -1
- package/{avatar/index.d.ts → types/radix-ng-primitives-avatar.d.ts} +7 -11
- package/types/radix-ng-primitives-button.d.ts +73 -0
- package/{calendar/index.d.ts → types/radix-ng-primitives-calendar.d.ts} +2 -3
- package/types/radix-ng-primitives-checkbox.d.ts +337 -0
- package/types/radix-ng-primitives-collapsible.d.ts +159 -0
- package/types/radix-ng-primitives-collection.d.ts +44 -0
- package/{config/index.d.ts → types/radix-ng-primitives-config.d.ts} +1 -1
- package/types/radix-ng-primitives-context-menu.d.ts +73 -0
- package/{core/index.d.ts → types/radix-ng-primitives-core.d.ts} +311 -236
- package/{cropper/index.d.ts → types/radix-ng-primitives-cropper.d.ts} +6 -5
- package/{date-field/index.d.ts → types/radix-ng-primitives-date-field.d.ts} +42 -27
- package/types/radix-ng-primitives-dialog.d.ts +323 -0
- package/{dismissable-layer/index.d.ts → types/radix-ng-primitives-dismissable-layer.d.ts} +15 -7
- package/types/radix-ng-primitives-drawer.d.ts +448 -0
- package/{editable/index.d.ts → types/radix-ng-primitives-editable.d.ts} +1 -1
- package/types/radix-ng-primitives-field.d.ts +373 -0
- package/types/radix-ng-primitives-fieldset.d.ts +48 -0
- package/{focus-scope/index.d.ts → types/radix-ng-primitives-focus-scope.d.ts} +13 -5
- package/types/radix-ng-primitives-input.d.ts +87 -0
- package/{label/index.d.ts → types/radix-ng-primitives-label.d.ts} +0 -1
- package/types/radix-ng-primitives-menu.d.ts +612 -0
- package/types/radix-ng-primitives-menubar.d.ts +66 -0
- package/types/radix-ng-primitives-meter.d.ts +193 -0
- package/types/radix-ng-primitives-navigation-menu.d.ts +488 -0
- package/types/radix-ng-primitives-number-field.d.ts +464 -0
- package/{pagination/index.d.ts → types/radix-ng-primitives-pagination.d.ts} +2 -2
- package/types/radix-ng-primitives-popover.d.ts +416 -0
- package/{popper/index.d.ts → types/radix-ng-primitives-popper.d.ts} +50 -9
- package/types/radix-ng-primitives-portal.d.ts +30 -0
- package/types/radix-ng-primitives-presence.d.ts +55 -0
- package/types/radix-ng-primitives-preview-card.d.ts +359 -0
- package/types/radix-ng-primitives-progress.d.ts +206 -0
- package/{radio/index.d.ts → types/radix-ng-primitives-radio.d.ts} +56 -26
- package/{roving-focus/index.d.ts → types/radix-ng-primitives-roving-focus.d.ts} +38 -27
- package/types/radix-ng-primitives-select.d.ts +512 -0
- package/types/radix-ng-primitives-separator.d.ts +38 -0
- package/types/radix-ng-primitives-slider.d.ts +377 -0
- package/{stepper/index.d.ts → types/radix-ng-primitives-stepper.d.ts} +21 -22
- package/types/radix-ng-primitives-switch.d.ts +121 -0
- package/types/radix-ng-primitives-tabs.d.ts +247 -0
- package/{time-field/index.d.ts → types/radix-ng-primitives-time-field.d.ts} +46 -31
- package/types/radix-ng-primitives-toggle-group.d.ts +116 -0
- package/types/radix-ng-primitives-toggle.d.ts +65 -0
- package/types/radix-ng-primitives-toolbar.d.ts +180 -0
- package/types/radix-ng-primitives-tooltip.d.ts +395 -0
- package/{visually-hidden/index.d.ts → types/radix-ng-primitives-visually-hidden.d.ts} +19 -19
- package/alert-dialog/index.d.ts +0 -57
- package/checkbox/index.d.ts +0 -164
- package/collapsible/index.d.ts +0 -85
- package/context-menu/index.d.ts +0 -129
- package/dialog/index.d.ts +0 -205
- package/dropdown-menu/README.md +0 -1
- package/dropdown-menu/index.d.ts +0 -171
- package/fesm2022/radix-ng-primitives-dropdown-menu.mjs +0 -583
- package/fesm2022/radix-ng-primitives-dropdown-menu.mjs.map +0 -1
- package/fesm2022/radix-ng-primitives-hover-card.mjs +0 -1246
- package/fesm2022/radix-ng-primitives-hover-card.mjs.map +0 -1
- package/fesm2022/radix-ng-primitives-tooltip2.mjs +0 -740
- package/fesm2022/radix-ng-primitives-tooltip2.mjs.map +0 -1
- package/hover-card/README.md +0 -3
- package/hover-card/index.d.ts +0 -472
- package/menu/index.d.ts +0 -139
- package/menubar/index.d.ts +0 -56
- package/navigation-menu/index.d.ts +0 -405
- package/number-field/index.d.ts +0 -203
- package/popover/index.d.ts +0 -403
- package/portal/index.d.ts +0 -22
- package/presence/index.d.ts +0 -103
- package/progress/index.d.ts +0 -79
- package/select/index.d.ts +0 -214
- package/separator/index.d.ts +0 -63
- package/slider/index.d.ts +0 -263
- package/switch/index.d.ts +0 -105
- package/tabs/index.d.ts +0 -112
- package/toggle/index.d.ts +0 -75
- package/toggle-group/index.d.ts +0 -194
- package/toolbar/index.d.ts +0 -55
- package/tooltip/index.d.ts +0 -433
- package/tooltip2/README.md +0 -3
- package/tooltip2/index.d.ts +0 -325
- /package/{focus-guards/index.d.ts → types/radix-ng-primitives-focus-guards.d.ts} +0 -0
- /package/{index.d.ts → types/radix-ng-primitives.d.ts} +0 -0
|
@@ -1,1133 +1,1118 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import * as i1 from '@
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
2
|
+
import { booleanAttribute, inject, DestroyRef, signal, model, input, output, computed, effect, untracked, Directive, ElementRef, numberAttribute, afterNextRender, NgModule } from '@angular/core';
|
|
3
|
+
import * as i1 from '@radix-ng/primitives/popper';
|
|
4
|
+
import { RdxPopper, RdxPopperContentWrapper, RdxPopperArrow, RdxPopperContent, provideRdxPopperContentConfig, RdxPopperAnchor } from '@radix-ng/primitives/popper';
|
|
5
|
+
import { createContext, useTransitionStatus, injectId, useScrollLock, useGraceArea } from '@radix-ng/primitives/core';
|
|
6
|
+
import { outputFromObservable, outputToObservable } from '@angular/core/rxjs-interop';
|
|
7
|
+
import * as i2 from '@radix-ng/primitives/dismissable-layer';
|
|
8
|
+
import { RdxDismissableLayer, provideRdxDismissableLayerConfig } from '@radix-ng/primitives/dismissable-layer';
|
|
9
|
+
import * as i3 from '@radix-ng/primitives/focus-scope';
|
|
10
|
+
import { RdxFocusScope, provideRdxFocusScopeConfig } from '@radix-ng/primitives/focus-scope';
|
|
11
|
+
import * as i1$1 from '@radix-ng/primitives/portal';
|
|
12
|
+
import { RdxPortal } from '@radix-ng/primitives/portal';
|
|
13
|
+
import * as i1$2 from '@radix-ng/primitives/presence';
|
|
14
|
+
import { provideRdxPresenceContext, RdxPresenceDirective } from '@radix-ng/primitives/presence';
|
|
10
15
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var RdxPopoverState;
|
|
20
|
-
(function (RdxPopoverState) {
|
|
21
|
-
RdxPopoverState["OPEN"] = "open";
|
|
22
|
-
RdxPopoverState["CLOSED"] = "closed";
|
|
23
|
-
})(RdxPopoverState || (RdxPopoverState = {}));
|
|
24
|
-
var RdxPopoverAttachDetachEvent;
|
|
25
|
-
(function (RdxPopoverAttachDetachEvent) {
|
|
26
|
-
RdxPopoverAttachDetachEvent["ATTACH"] = "attach";
|
|
27
|
-
RdxPopoverAttachDetachEvent["DETACH"] = "detach";
|
|
28
|
-
})(RdxPopoverAttachDetachEvent || (RdxPopoverAttachDetachEvent = {}));
|
|
29
|
-
var RdxPopoverAnimationStatus;
|
|
30
|
-
(function (RdxPopoverAnimationStatus) {
|
|
31
|
-
RdxPopoverAnimationStatus["OPEN_STARTED"] = "open_started";
|
|
32
|
-
RdxPopoverAnimationStatus["OPEN_ENDED"] = "open_ended";
|
|
33
|
-
RdxPopoverAnimationStatus["CLOSED_STARTED"] = "closed_started";
|
|
34
|
-
RdxPopoverAnimationStatus["CLOSED_ENDED"] = "closed_ended";
|
|
35
|
-
})(RdxPopoverAnimationStatus || (RdxPopoverAnimationStatus = {}));
|
|
36
|
-
|
|
37
|
-
class RdxPopoverContentDirective {
|
|
16
|
+
const transformModal = (value) => value === 'trap-focus' ? value : booleanAttribute(value);
|
|
17
|
+
const context = () => contextFor(inject(RdxPopoverRoot));
|
|
18
|
+
const [injectRdxPopoverRootContext, provideRdxPopoverRootContext] = createContext('RdxPopoverRootContext');
|
|
19
|
+
/**
|
|
20
|
+
* Groups all parts of the popover.
|
|
21
|
+
*/
|
|
22
|
+
class RdxPopoverRoot {
|
|
38
23
|
constructor() {
|
|
39
|
-
|
|
40
|
-
this.popoverRoot = injectPopoverRoot();
|
|
41
|
-
/** @ignore */
|
|
42
|
-
this.templateRef = inject(TemplateRef);
|
|
43
|
-
/** @ignore */
|
|
44
|
-
this.overlay = inject(Overlay);
|
|
45
|
-
/** @ignore */
|
|
24
|
+
this.popper = inject(RdxPopper);
|
|
46
25
|
this.destroyRef = inject(DestroyRef);
|
|
47
|
-
|
|
48
|
-
this.
|
|
49
|
-
|
|
50
|
-
this.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
this.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
*/
|
|
60
|
-
this.sideOffset = input(NaN, ...(ngDevMode ? [{ debugName: "sideOffset", transform: numberAttribute }] : [{
|
|
61
|
-
transform: numberAttribute
|
|
62
|
-
}]));
|
|
63
|
-
/**
|
|
64
|
-
* @description The preferred alignment against the trigger. May change when collisions occur.
|
|
65
|
-
* @default center
|
|
66
|
-
*/
|
|
67
|
-
this.align = input(RdxPositionAlign.Center, ...(ngDevMode ? [{ debugName: "align" }] : []));
|
|
26
|
+
this.hasAppliedDefaultOpen = false;
|
|
27
|
+
this.hasAppliedDefaultTriggerId = false;
|
|
28
|
+
this.hoverDelay = 300;
|
|
29
|
+
this.hoverCloseDelay = 0;
|
|
30
|
+
this.transition = useTransitionStatus((open) => {
|
|
31
|
+
this.instant.set(false);
|
|
32
|
+
this.onOpenChangeComplete.emit(open);
|
|
33
|
+
});
|
|
34
|
+
this.isHoverActive = signal(false, ...(ngDevMode ? [{ debugName: "isHoverActive" }] : /* istanbul ignore next */ []));
|
|
35
|
+
this.instant = signal(false, ...(ngDevMode ? [{ debugName: "instant" }] : /* istanbul ignore next */ []));
|
|
36
|
+
this.openChangeReason = signal('none', ...(ngDevMode ? [{ debugName: "openChangeReason" }] : /* istanbul ignore next */ []));
|
|
37
|
+
this.transitionStatus = this.transition.status;
|
|
68
38
|
/**
|
|
69
|
-
*
|
|
70
|
-
* @default undefined
|
|
39
|
+
* Whether the popover is currently open.
|
|
71
40
|
*/
|
|
72
|
-
this.
|
|
73
|
-
transform: numberAttribute
|
|
74
|
-
}]));
|
|
41
|
+
this.open = model(false, ...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
|
|
75
42
|
/**
|
|
76
|
-
*
|
|
77
|
-
* @default false
|
|
43
|
+
* Whether the popover is initially open.
|
|
78
44
|
*/
|
|
79
|
-
this.
|
|
80
|
-
/** @description Whether to prevent `onOverlayEscapeKeyDown` handler from calling. */
|
|
81
|
-
this.onOverlayEscapeKeyDownDisabled = input(false, ...(ngDevMode ? [{ debugName: "onOverlayEscapeKeyDownDisabled", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
82
|
-
/** @description Whether to prevent `onOverlayOutsideClick` handler from calling. */
|
|
83
|
-
this.onOverlayOutsideClickDisabled = input(false, ...(ngDevMode ? [{ debugName: "onOverlayOutsideClickDisabled", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
45
|
+
this.defaultOpen = input(false, { ...(ngDevMode ? { debugName: "defaultOpen" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
84
46
|
/**
|
|
85
|
-
*
|
|
86
|
-
* It can be prevented by setting `onOverlayEscapeKeyDownDisabled` input to `true`.
|
|
47
|
+
* ID of the trigger associated with a controlled popover.
|
|
87
48
|
*/
|
|
88
|
-
this.
|
|
49
|
+
this.triggerId = model(null, ...(ngDevMode ? [{ debugName: "triggerId" }] : /* istanbul ignore next */ []));
|
|
89
50
|
/**
|
|
90
|
-
*
|
|
91
|
-
* It can be prevented by setting `onOverlayOutsideClickDisabled` input to `true`.
|
|
51
|
+
* ID of the trigger associated with an initially open uncontrolled popover.
|
|
92
52
|
*/
|
|
93
|
-
this.
|
|
53
|
+
this.defaultTriggerId = input(null, ...(ngDevMode ? [{ debugName: "defaultTriggerId" }] : /* istanbul ignore next */ []));
|
|
94
54
|
/**
|
|
95
|
-
*
|
|
55
|
+
* Determines whether the popover blocks outside interaction or only traps focus.
|
|
96
56
|
*/
|
|
97
|
-
this.
|
|
57
|
+
this.modal = input(false, { ...(ngDevMode ? { debugName: "modal" } : /* istanbul ignore next */ {}), transform: transformModal });
|
|
98
58
|
/**
|
|
99
|
-
*
|
|
59
|
+
* Associates this root with detached trigger elements.
|
|
100
60
|
*/
|
|
101
|
-
this.
|
|
102
|
-
|
|
103
|
-
this.
|
|
104
|
-
this.
|
|
105
|
-
this.
|
|
61
|
+
this.handle = input(...(ngDevMode ? [undefined, { debugName: "handle" }] : /* istanbul ignore next */ []));
|
|
62
|
+
this.contentId = injectId('rdx-popover-content-');
|
|
63
|
+
this.descriptionId = signal(undefined, ...(ngDevMode ? [{ debugName: "descriptionId" }] : /* istanbul ignore next */ []));
|
|
64
|
+
this.titleId = signal(undefined, ...(ngDevMode ? [{ debugName: "titleId" }] : /* istanbul ignore next */ []));
|
|
65
|
+
this.trigger = signal(undefined, ...(ngDevMode ? [{ debugName: "trigger" }] : /* istanbul ignore next */ []));
|
|
66
|
+
this.triggers = signal([], ...(ngDevMode ? [{ debugName: "triggers" }] : /* istanbul ignore next */ []));
|
|
67
|
+
this.payload = signal(undefined, ...(ngDevMode ? [{ debugName: "payload" }] : /* istanbul ignore next */ []));
|
|
68
|
+
this.isPointerDownOnTrigger = signal(false, ...(ngDevMode ? [{ debugName: "isPointerDownOnTrigger" }] : /* istanbul ignore next */ []));
|
|
69
|
+
this.popupCloseCount = signal(0, ...(ngDevMode ? [{ debugName: "popupCloseCount" }] : /* istanbul ignore next */ []));
|
|
70
|
+
this.onOpenChange = output();
|
|
71
|
+
this.onOpenChangeComplete = output();
|
|
72
|
+
this.registeredTriggers = new Map();
|
|
73
|
+
this.viewportTriggerChange = new Set();
|
|
74
|
+
this.state = computed(() => (this.open() ? 'open' : 'closed'), ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
75
|
+
let previousOpen = this.open();
|
|
76
|
+
effect(() => {
|
|
77
|
+
const defaultOpen = this.defaultOpen();
|
|
78
|
+
if (!this.hasAppliedDefaultOpen && defaultOpen) {
|
|
79
|
+
this.hasAppliedDefaultOpen = true;
|
|
80
|
+
this.open.set(defaultOpen);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
effect(() => {
|
|
84
|
+
const defaultTriggerId = this.defaultTriggerId();
|
|
85
|
+
if (!this.hasAppliedDefaultTriggerId && defaultTriggerId !== null) {
|
|
86
|
+
this.hasAppliedDefaultTriggerId = true;
|
|
87
|
+
this.triggerId.set(defaultTriggerId);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
effect(() => {
|
|
91
|
+
const triggerId = this.triggerId();
|
|
92
|
+
untracked(() => this.syncTriggerId(triggerId));
|
|
93
|
+
});
|
|
94
|
+
effect(() => {
|
|
95
|
+
const open = this.open();
|
|
96
|
+
if (open !== previousOpen) {
|
|
97
|
+
previousOpen = open;
|
|
98
|
+
untracked(() => this.transition.start(open));
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
effect((onCleanup) => {
|
|
102
|
+
const handle = this.handle();
|
|
103
|
+
if (handle) {
|
|
104
|
+
onCleanup(untracked(() => handle.registerRoot(contextFor(this))));
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
effect(() => this.popper.anchorOverride.set(this.trigger()));
|
|
108
|
+
this.destroyRef.onDestroy(() => {
|
|
109
|
+
this.clearHoverTimers();
|
|
110
|
+
if (this.instantFrame !== undefined) {
|
|
111
|
+
cancelAnimationFrame(this.instantFrame);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
106
114
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
this.
|
|
110
|
-
this.
|
|
111
|
-
this.
|
|
112
|
-
this.
|
|
113
|
-
this.
|
|
114
|
-
|
|
115
|
-
|
|
115
|
+
show(trigger = this.trigger(), payload, triggerId, reason = 'none', event = new Event('popover.open-change'), fromHover = false) {
|
|
116
|
+
this.clearHoverTimers();
|
|
117
|
+
this.isHoverActive.set(fromHover);
|
|
118
|
+
this.openChangeReason.set(reason);
|
|
119
|
+
const previousTrigger = this.trigger();
|
|
120
|
+
const changedTriggerWhileOpen = this.open() && previousTrigger !== trigger;
|
|
121
|
+
this.instant.set(changedTriggerWhileOpen || reason === 'trigger-focus');
|
|
122
|
+
if (changedTriggerWhileOpen) {
|
|
123
|
+
this.scheduleInstantReset();
|
|
124
|
+
}
|
|
125
|
+
if (trigger) {
|
|
126
|
+
if (previousTrigger && previousTrigger !== trigger) {
|
|
127
|
+
this.viewportTriggerChange.forEach((notify) => notify(previousTrigger, trigger));
|
|
128
|
+
}
|
|
129
|
+
this.trigger.set(trigger);
|
|
130
|
+
}
|
|
131
|
+
if (triggerId !== undefined) {
|
|
132
|
+
this.triggerId.set(triggerId);
|
|
133
|
+
}
|
|
134
|
+
this.payload.set(payload);
|
|
135
|
+
const changed = !this.open() || previousTrigger !== trigger;
|
|
136
|
+
this.open.set(true);
|
|
137
|
+
if (changed) {
|
|
138
|
+
this.emitOpenChange(true, reason, event);
|
|
139
|
+
}
|
|
116
140
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
141
|
+
close(reason = 'none', event = new Event('popover.open-change')) {
|
|
142
|
+
this.clearHoverTimers();
|
|
143
|
+
this.isHoverActive.set(false);
|
|
144
|
+
if (!this.open()) {
|
|
120
145
|
return;
|
|
121
146
|
}
|
|
122
|
-
|
|
123
|
-
this.
|
|
124
|
-
this.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
147
|
+
this.instant.set(reason !== 'none' && reason !== 'trigger-hover');
|
|
148
|
+
this.openChangeReason.set(reason);
|
|
149
|
+
this.open.set(false);
|
|
150
|
+
this.emitOpenChange(false, reason, event);
|
|
151
|
+
}
|
|
152
|
+
toggle(triggerId, trigger, payload, event) {
|
|
153
|
+
this.clearHoverTimers();
|
|
154
|
+
if (this.open() && this.trigger() === trigger) {
|
|
155
|
+
this.close('trigger-press', event);
|
|
129
156
|
return;
|
|
130
157
|
}
|
|
131
|
-
|
|
132
|
-
this.connectedOverlay.open = false;
|
|
133
|
-
this.fireOverlayNgOnChanges('open', this.connectedOverlay.open, prevOpen);
|
|
134
|
-
}
|
|
135
|
-
/** @ignore */
|
|
136
|
-
positionChange() {
|
|
137
|
-
return this.connectedOverlay.positionChange.asObservable();
|
|
138
|
-
}
|
|
139
|
-
/** @ignore */
|
|
140
|
-
connectKeydownEscape() {
|
|
141
|
-
this.connectedOverlay.overlayKeydown
|
|
142
|
-
.asObservable()
|
|
143
|
-
.pipe(filter(() => !this.onOverlayEscapeKeyDownDisabled() &&
|
|
144
|
-
!this.popoverRoot.rdxCdkEventService?.primitivePreventedFromCdkEvent(this.popoverRoot, 'cdkOverlayEscapeKeyDown')), filter((event) => event.key === 'Escape'), tap((event) => {
|
|
145
|
-
this.onOverlayEscapeKeyDown.emit(event);
|
|
146
|
-
}), filter(() => !this.popoverRoot.firstDefaultOpen()), tap(() => {
|
|
147
|
-
this.popoverRoot.handleClose();
|
|
148
|
-
}), takeUntilDestroyed(this.destroyRef))
|
|
149
|
-
.subscribe();
|
|
150
|
-
}
|
|
151
|
-
/** @ignore */
|
|
152
|
-
connectOutsideClick() {
|
|
153
|
-
this.connectedOverlay.overlayOutsideClick
|
|
154
|
-
.asObservable()
|
|
155
|
-
.pipe(filter(() => !this.onOverlayOutsideClickDisabled() &&
|
|
156
|
-
!this.popoverRoot.rdxCdkEventService?.primitivePreventedFromCdkEvent(this.popoverRoot, 'cdkOverlayOutsideClick')),
|
|
157
|
-
/**
|
|
158
|
-
* Handle the situation when an anchor is added and the anchor becomes the origin of the overlay
|
|
159
|
-
* hence the trigger will be considered the outside element
|
|
160
|
-
*/
|
|
161
|
-
filter((event) => {
|
|
162
|
-
return (!this.popoverRoot.popoverAnchorDirective() ||
|
|
163
|
-
!this.popoverRoot
|
|
164
|
-
.popoverTriggerDirective()
|
|
165
|
-
.elementRef.nativeElement.contains(event.target));
|
|
166
|
-
}), tap((event) => {
|
|
167
|
-
this.onOverlayOutsideClick.emit(event);
|
|
168
|
-
}), filter(() => !this.popoverRoot.firstDefaultOpen()), tap(() => {
|
|
169
|
-
this.popoverRoot.handleClose();
|
|
170
|
-
}), takeUntilDestroyed(this.destroyRef))
|
|
171
|
-
.subscribe();
|
|
158
|
+
this.show(trigger, payload, triggerId, 'trigger-press', event);
|
|
172
159
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
this.
|
|
176
|
-
|
|
177
|
-
.
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
this.popoverRoot.attachDetachEvent.set(RdxPopoverAttachDetachEvent.ATTACH);
|
|
182
|
-
}), takeUntilDestroyed(this.destroyRef))
|
|
183
|
-
.subscribe();
|
|
184
|
-
}
|
|
185
|
-
/** @ignore */
|
|
186
|
-
onDetach() {
|
|
187
|
-
this.connectedOverlay.detach
|
|
188
|
-
.asObservable()
|
|
189
|
-
.pipe(tap(() => {
|
|
190
|
-
/**
|
|
191
|
-
* `this.onClosed.emit();` is being delegated to the root directive due to the closing animation
|
|
192
|
-
*/
|
|
193
|
-
this.popoverRoot.attachDetachEvent.set(RdxPopoverAttachDetachEvent.DETACH);
|
|
194
|
-
}), takeUntilDestroyed(this.destroyRef))
|
|
195
|
-
.subscribe();
|
|
160
|
+
openOnHover(trigger, payload, triggerId, event) {
|
|
161
|
+
this.clearHoverTimers();
|
|
162
|
+
this.isHoverActive.set(true);
|
|
163
|
+
if (this.open()) {
|
|
164
|
+
this.show(trigger, payload, triggerId, 'trigger-hover', event, true);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
this.openTimer = setTimeout(() => this.show(trigger, payload, triggerId, 'trigger-hover', event, true), this.hoverDelay);
|
|
196
168
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
this.
|
|
169
|
+
closeOnHover() {
|
|
170
|
+
if (!this.isHoverActive()) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
this.clearOpenTimer();
|
|
174
|
+
this.clearCloseTimer();
|
|
175
|
+
this.closeTimer = setTimeout(() => this.close('trigger-hover', new Event('popover.hover-close')), this.hoverCloseDelay);
|
|
176
|
+
}
|
|
177
|
+
cancelHoverClose() {
|
|
178
|
+
this.clearCloseTimer();
|
|
179
|
+
}
|
|
180
|
+
cancelHoverOpen() {
|
|
181
|
+
this.clearOpenTimer();
|
|
182
|
+
}
|
|
183
|
+
setHoverDelays(delay, closeDelay) {
|
|
184
|
+
this.hoverDelay = delay;
|
|
185
|
+
this.hoverCloseDelay = closeDelay;
|
|
186
|
+
}
|
|
187
|
+
registerTrigger(id, trigger, payload) {
|
|
188
|
+
this.registeredTriggers.set(id, { element: trigger, payload });
|
|
189
|
+
this.triggers.update((triggers) => (triggers.includes(trigger) ? triggers : [...triggers, trigger]));
|
|
190
|
+
if (this.triggerId() === id) {
|
|
191
|
+
this.trigger.set(trigger);
|
|
192
|
+
this.payload.set(payload());
|
|
193
|
+
}
|
|
194
|
+
else if (!this.trigger() && this.triggerId() === null) {
|
|
195
|
+
this.trigger.set(trigger);
|
|
196
|
+
this.payload.set(payload());
|
|
197
|
+
}
|
|
198
|
+
return () => {
|
|
199
|
+
if (this.registeredTriggers.get(id)?.element === trigger) {
|
|
200
|
+
this.registeredTriggers.delete(id);
|
|
201
|
+
}
|
|
202
|
+
this.triggers.update((triggers) => triggers.filter((candidate) => candidate !== trigger));
|
|
203
|
+
if (this.destroyRef.destroyed) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (this.trigger() === trigger) {
|
|
207
|
+
const next = this.registeredTriggers.entries().next().value;
|
|
208
|
+
if (this.triggerId() !== null) {
|
|
209
|
+
this.triggerId.set(next?.[0] ?? null);
|
|
210
|
+
}
|
|
211
|
+
this.trigger.set(next?.[1].element);
|
|
212
|
+
this.payload.set(next?.[1].payload());
|
|
213
|
+
if (!next && !this.destroyRef.destroyed) {
|
|
214
|
+
this.close();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
};
|
|
202
218
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
this.connectedOverlay.hasBackdrop = false;
|
|
207
|
-
this.fireOverlayNgOnChanges('hasBackdrop', this.connectedOverlay.hasBackdrop, prevHasBackdrop);
|
|
219
|
+
registerViewport(onTriggerChange) {
|
|
220
|
+
this.viewportTriggerChange.add(onTriggerChange);
|
|
221
|
+
return () => this.viewportTriggerChange.delete(onTriggerChange);
|
|
208
222
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
const prevDisableClose = this.connectedOverlay.disableClose;
|
|
212
|
-
this.connectedOverlay.disableClose = true;
|
|
213
|
-
this.fireOverlayNgOnChanges('disableClose', this.connectedOverlay.disableClose, prevDisableClose);
|
|
223
|
+
registerTransitionElement(element) {
|
|
224
|
+
return this.transition.registerElement(element);
|
|
214
225
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
226
|
+
syncTriggerId(triggerId) {
|
|
227
|
+
if (triggerId === null) {
|
|
228
|
+
this.trigger.set(undefined);
|
|
229
|
+
this.payload.set(undefined);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
const trigger = this.registeredTriggers.get(triggerId);
|
|
233
|
+
if (!trigger) {
|
|
234
|
+
this.trigger.set(undefined);
|
|
235
|
+
this.payload.set(undefined);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
if (trigger.element === this.trigger()) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
const previousTrigger = this.trigger();
|
|
242
|
+
if (previousTrigger && this.open()) {
|
|
243
|
+
this.viewportTriggerChange.forEach((notify) => notify(previousTrigger, trigger.element));
|
|
244
|
+
}
|
|
245
|
+
this.trigger.set(trigger.element);
|
|
246
|
+
this.payload.set(trigger.payload());
|
|
247
|
+
}
|
|
248
|
+
emitOpenChange(open, reason, event) {
|
|
249
|
+
this.onOpenChange.emit({
|
|
250
|
+
open,
|
|
251
|
+
triggerId: this.triggerId(),
|
|
252
|
+
trigger: this.trigger(),
|
|
253
|
+
reason,
|
|
254
|
+
event
|
|
255
|
+
});
|
|
220
256
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
this.connectedOverlay.positions = positions;
|
|
225
|
-
this.fireOverlayNgOnChanges('positions', this.connectedOverlay.positions, prevPositions);
|
|
226
|
-
this.connectedOverlay.overlayRef?.updatePosition();
|
|
257
|
+
clearHoverTimers() {
|
|
258
|
+
this.clearOpenTimer();
|
|
259
|
+
this.clearCloseTimer();
|
|
227
260
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
sideOffset: arrowHeight + (isNaN(this.sideOffset()) ? RDX_POSITIONING_DEFAULTS.offsets.side : this.sideOffset()),
|
|
233
|
-
alignOffset: isNaN(this.alignOffset()) ? RDX_POSITIONING_DEFAULTS.offsets.align : this.alignOffset()
|
|
234
|
-
};
|
|
235
|
-
const basePosition = getContentPosition({
|
|
236
|
-
side: this.side(),
|
|
237
|
-
align: this.align(),
|
|
238
|
-
sideOffset: offsets.sideOffset,
|
|
239
|
-
alignOffset: offsets.alignOffset
|
|
240
|
-
});
|
|
241
|
-
const positions = [basePosition];
|
|
242
|
-
if (!this.alternatePositionsDisabled()) {
|
|
243
|
-
/**
|
|
244
|
-
* Alternate positions for better user experience along the X/Y axis (e.g. vertical/horizontal scrolling)
|
|
245
|
-
*/
|
|
246
|
-
const allPossibleConnectedPositions = getAllPossibleConnectedPositions();
|
|
247
|
-
allPossibleConnectedPositions.forEach((_, key) => {
|
|
248
|
-
const sideAndAlignArray = key.split('|');
|
|
249
|
-
if (sideAndAlignArray[0] !== this.side() ||
|
|
250
|
-
sideAndAlignArray[1] !== this.align()) {
|
|
251
|
-
positions.push(getContentPosition({
|
|
252
|
-
side: sideAndAlignArray[0],
|
|
253
|
-
align: sideAndAlignArray[1],
|
|
254
|
-
sideOffset: offsets.sideOffset,
|
|
255
|
-
alignOffset: offsets.alignOffset
|
|
256
|
-
}));
|
|
257
|
-
}
|
|
258
|
-
});
|
|
261
|
+
clearOpenTimer() {
|
|
262
|
+
if (this.openTimer !== undefined) {
|
|
263
|
+
clearTimeout(this.openTimer);
|
|
264
|
+
this.openTimer = undefined;
|
|
259
265
|
}
|
|
260
|
-
return positions;
|
|
261
|
-
}
|
|
262
|
-
onOriginChangeEffect() {
|
|
263
|
-
effect(() => {
|
|
264
|
-
const origin = (this.popoverRoot.popoverAnchorDirective() ?? this.popoverRoot.popoverTriggerDirective())
|
|
265
|
-
.overlayOrigin;
|
|
266
|
-
untracked(() => {
|
|
267
|
-
this.setOrigin(origin);
|
|
268
|
-
});
|
|
269
|
-
});
|
|
270
266
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
untracked(() => {
|
|
277
|
-
this.setPositions(positions);
|
|
278
|
-
});
|
|
279
|
-
});
|
|
267
|
+
clearCloseTimer() {
|
|
268
|
+
if (this.closeTimer !== undefined) {
|
|
269
|
+
clearTimeout(this.closeTimer);
|
|
270
|
+
this.closeTimer = undefined;
|
|
271
|
+
}
|
|
280
272
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
273
|
+
scheduleInstantReset() {
|
|
274
|
+
if (this.instantFrame !== undefined) {
|
|
275
|
+
cancelAnimationFrame(this.instantFrame);
|
|
276
|
+
}
|
|
277
|
+
this.instantFrame = requestAnimationFrame(() => {
|
|
278
|
+
this.instantFrame = undefined;
|
|
279
|
+
if (!this.destroyRef.destroyed && this.open()) {
|
|
280
|
+
this.instant.set(false);
|
|
281
|
+
}
|
|
285
282
|
});
|
|
286
283
|
}
|
|
287
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
288
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
284
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxPopoverRoot, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
285
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxPopoverRoot, isStandalone: true, selector: "[rdxPopoverRoot]", inputs: { open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, defaultOpen: { classPropertyName: "defaultOpen", publicName: "defaultOpen", isSignal: true, isRequired: false, transformFunction: null }, triggerId: { classPropertyName: "triggerId", publicName: "triggerId", isSignal: true, isRequired: false, transformFunction: null }, defaultTriggerId: { classPropertyName: "defaultTriggerId", publicName: "defaultTriggerId", isSignal: true, isRequired: false, transformFunction: null }, modal: { classPropertyName: "modal", publicName: "modal", isSignal: true, isRequired: false, transformFunction: null }, handle: { classPropertyName: "handle", publicName: "handle", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { open: "openChange", triggerId: "triggerIdChange", onOpenChange: "onOpenChange", onOpenChangeComplete: "onOpenChangeComplete" }, providers: [provideRdxPopoverRootContext(context)], exportAs: ["rdxPopoverRoot"], hostDirectives: [{ directive: i1.RdxPopper }], ngImport: i0 }); }
|
|
289
286
|
}
|
|
290
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
287
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxPopoverRoot, decorators: [{
|
|
291
288
|
type: Directive,
|
|
292
289
|
args: [{
|
|
293
|
-
selector: '[
|
|
294
|
-
|
|
290
|
+
selector: '[rdxPopoverRoot]',
|
|
291
|
+
exportAs: 'rdxPopoverRoot',
|
|
292
|
+
providers: [provideRdxPopoverRootContext(context)],
|
|
293
|
+
hostDirectives: [RdxPopper]
|
|
295
294
|
}]
|
|
296
|
-
}], ctorParameters: () => [] });
|
|
295
|
+
}], ctorParameters: () => [], propDecorators: { open: [{ type: i0.Input, args: [{ isSignal: true, alias: "open", required: false }] }, { type: i0.Output, args: ["openChange"] }], defaultOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultOpen", required: false }] }], triggerId: [{ type: i0.Input, args: [{ isSignal: true, alias: "triggerId", required: false }] }, { type: i0.Output, args: ["triggerIdChange"] }], defaultTriggerId: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultTriggerId", required: false }] }], modal: [{ type: i0.Input, args: [{ isSignal: true, alias: "modal", required: false }] }], handle: [{ type: i0.Input, args: [{ isSignal: true, alias: "handle", required: false }] }], onOpenChange: [{ type: i0.Output, args: ["onOpenChange"] }], onOpenChangeComplete: [{ type: i0.Output, args: ["onOpenChangeComplete"] }] } });
|
|
296
|
+
function contextFor(root) {
|
|
297
|
+
return {
|
|
298
|
+
contentId: root.contentId,
|
|
299
|
+
descriptionId: root.descriptionId.asReadonly(),
|
|
300
|
+
isOpen: root.open,
|
|
301
|
+
modal: root.modal,
|
|
302
|
+
titleId: root.titleId.asReadonly(),
|
|
303
|
+
trigger: root.trigger.asReadonly(),
|
|
304
|
+
triggers: root.triggers.asReadonly(),
|
|
305
|
+
payload: root.payload.asReadonly(),
|
|
306
|
+
hasPopupClose: computed(() => root.popupCloseCount() > 0),
|
|
307
|
+
isHoverActive: root.isHoverActive.asReadonly(),
|
|
308
|
+
instant: root.instant.asReadonly(),
|
|
309
|
+
openChangeReason: root.openChangeReason.asReadonly(),
|
|
310
|
+
isPointerDownOnTrigger: root.isPointerDownOnTrigger.asReadonly(),
|
|
311
|
+
close: (reason, event) => root.close(reason, event),
|
|
312
|
+
cancelHoverClose: () => root.cancelHoverClose(),
|
|
313
|
+
cancelHoverOpen: () => root.cancelHoverOpen(),
|
|
314
|
+
closeOnHover: () => root.closeOnHover(),
|
|
315
|
+
open: (trigger, payload, triggerId, reason, event) => root.show(trigger, payload, triggerId, reason, event),
|
|
316
|
+
openOnHover: (trigger, payload, triggerId, event) => root.openOnHover(trigger, payload, triggerId, event),
|
|
317
|
+
registerTrigger: (id, trigger, payload) => root.registerTrigger(id, trigger, payload),
|
|
318
|
+
setDescriptionId: (id) => root.descriptionId.set(id),
|
|
319
|
+
setTitleId: (id) => root.titleId.set(id),
|
|
320
|
+
setPointerDownOnTrigger: (pointerDown) => root.isPointerDownOnTrigger.set(pointerDown),
|
|
321
|
+
setHoverDelays: (delay, closeDelay) => root.setHoverDelays(delay, closeDelay),
|
|
322
|
+
registerPopupClose: () => {
|
|
323
|
+
root.popupCloseCount.update((count) => count + 1);
|
|
324
|
+
return () => root.popupCloseCount.update((count) => count - 1);
|
|
325
|
+
},
|
|
326
|
+
registerTransitionElement: (element) => root.registerTransitionElement(element),
|
|
327
|
+
transitionStatus: root.transitionStatus,
|
|
328
|
+
registerViewport: (onTriggerChange) => root.registerViewport(onTriggerChange),
|
|
329
|
+
toggle: (triggerId, trigger, payload, event) => root.toggle(triggerId, trigger, payload, event)
|
|
330
|
+
};
|
|
331
|
+
}
|
|
297
332
|
|
|
298
|
-
|
|
333
|
+
/**
|
|
334
|
+
* An optional arrow element rendered alongside the popover.
|
|
335
|
+
*/
|
|
336
|
+
class RdxPopoverArrow {
|
|
299
337
|
constructor() {
|
|
300
|
-
|
|
301
|
-
this.
|
|
302
|
-
|
|
303
|
-
this.
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
}
|
|
309
|
-
/** @ignore */
|
|
310
|
-
click() {
|
|
311
|
-
this.popoverRoot.handleToggle();
|
|
312
|
-
}
|
|
313
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: RdxPopoverTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
314
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.3", type: RdxPopoverTriggerDirective, isStandalone: true, selector: "[rdxPopoverTrigger]", host: { attributes: { "type": "button" }, listeners: { "click": "click()" }, properties: { "attr.id": "name()", "attr.aria-haspopup": "\"dialog\"", "attr.aria-expanded": "popoverRoot.isOpen()", "attr.aria-controls": "popoverRoot.popoverContentDirective().name()", "attr.data-state": "popoverRoot.state()" } }, hostDirectives: [{ directive: i1.CdkOverlayOrigin }], ngImport: i0 }); }
|
|
338
|
+
this.rootContext = injectRdxPopoverRootContext();
|
|
339
|
+
this.wrapper = inject(RdxPopperContentWrapper, { optional: true });
|
|
340
|
+
this.side = computed(() => this.wrapper?.placedSide(), ...(ngDevMode ? [{ debugName: "side" }] : /* istanbul ignore next */ []));
|
|
341
|
+
this.align = computed(() => this.wrapper?.placedAlign(), ...(ngDevMode ? [{ debugName: "align" }] : /* istanbul ignore next */ []));
|
|
342
|
+
this.uncentered = computed(() => this.wrapper?.arrowUncentered() ?? false, ...(ngDevMode ? [{ debugName: "uncentered" }] : /* istanbul ignore next */ []));
|
|
343
|
+
}
|
|
344
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxPopoverArrow, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
345
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: RdxPopoverArrow, isStandalone: true, selector: "[rdxPopoverArrow]", host: { properties: { "attr.data-open": "rootContext.isOpen() ? \"\" : undefined", "attr.data-closed": "rootContext.isOpen() ? undefined : \"\"", "attr.data-side": "side()", "attr.data-align": "align()", "attr.data-uncentered": "uncentered() ? \"\" : undefined" } }, hostDirectives: [{ directive: i1.RdxPopperArrow }], ngImport: i0 }); }
|
|
315
346
|
}
|
|
316
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
347
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxPopoverArrow, decorators: [{
|
|
317
348
|
type: Directive,
|
|
318
349
|
args: [{
|
|
319
|
-
selector: '[
|
|
320
|
-
hostDirectives: [
|
|
350
|
+
selector: '[rdxPopoverArrow]',
|
|
351
|
+
hostDirectives: [RdxPopperArrow],
|
|
321
352
|
host: {
|
|
322
|
-
|
|
323
|
-
'[attr.
|
|
324
|
-
'[attr.
|
|
325
|
-
'[attr.
|
|
326
|
-
'[attr.
|
|
327
|
-
'[attr.data-state]': 'popoverRoot.state()',
|
|
328
|
-
'(click)': 'click()'
|
|
353
|
+
'[attr.data-open]': 'rootContext.isOpen() ? "" : undefined',
|
|
354
|
+
'[attr.data-closed]': 'rootContext.isOpen() ? undefined : ""',
|
|
355
|
+
'[attr.data-side]': 'side()',
|
|
356
|
+
'[attr.data-align]': 'align()',
|
|
357
|
+
'[attr.data-uncentered]': 'uncentered() ? "" : undefined'
|
|
329
358
|
}
|
|
330
359
|
}]
|
|
331
360
|
}] });
|
|
332
361
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
}
|
|
338
|
-
class RdxCdkEventService {
|
|
339
|
-
#clickDomRootEventCallbacks;
|
|
362
|
+
/**
|
|
363
|
+
* An optional backdrop rendered behind the popup.
|
|
364
|
+
*/
|
|
365
|
+
class RdxPopoverBackdrop {
|
|
340
366
|
constructor() {
|
|
341
|
-
this.
|
|
342
|
-
this.destroyRef = inject(DestroyRef);
|
|
343
|
-
this.ngZone = inject(NgZone);
|
|
344
|
-
this.renderer2 = inject(Renderer2);
|
|
345
|
-
this.window = injectWindow();
|
|
346
|
-
this.onDestroyCallbacks = new Set([() => deleteRdxCdkEventServiceWindowKey(this.window)]);
|
|
347
|
-
this.#clickDomRootEventCallbacks = new Set();
|
|
348
|
-
this.#listenToClickDomRootEvent();
|
|
349
|
-
this.#registerOnDestroyCallbacks();
|
|
350
|
-
}
|
|
351
|
-
registerPrimitive(primitiveInstance) {
|
|
352
|
-
if (!this.primitiveConfigs) {
|
|
353
|
-
this.primitiveConfigs = new Map();
|
|
354
|
-
}
|
|
355
|
-
if (!this.primitiveConfigs.has(primitiveInstance)) {
|
|
356
|
-
this.primitiveConfigs.set(primitiveInstance, {});
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
deregisterPrimitive(primitiveInstance) {
|
|
360
|
-
if (this.primitiveConfigs?.has(primitiveInstance)) {
|
|
361
|
-
this.primitiveConfigs.delete(primitiveInstance);
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
preventPrimitiveFromCdkEvent(primitiveInstance, eventType) {
|
|
365
|
-
this.#setPreventPrimitiveFromCdkEvent(primitiveInstance, eventType, true);
|
|
366
|
-
}
|
|
367
|
-
allowPrimitiveForCdkEvent(primitiveInstance, eventType) {
|
|
368
|
-
this.#setPreventPrimitiveFromCdkEvent(primitiveInstance, eventType, false);
|
|
369
|
-
}
|
|
370
|
-
preventPrimitiveFromCdkMultiEvents(primitiveInstance, eventTypes) {
|
|
371
|
-
eventTypes.forEach((eventType) => {
|
|
372
|
-
this.#setPreventPrimitiveFromCdkEvent(primitiveInstance, eventType, true);
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
|
-
allowPrimitiveForCdkMultiEvents(primitiveInstance, eventTypes) {
|
|
376
|
-
eventTypes.forEach((eventType) => {
|
|
377
|
-
this.#setPreventPrimitiveFromCdkEvent(primitiveInstance, eventType, false);
|
|
378
|
-
});
|
|
379
|
-
}
|
|
380
|
-
setPreventPrimitiveFromCdkMixEvents(primitiveInstance, eventTypes) {
|
|
381
|
-
Object.keys(eventTypes).forEach((eventType) => {
|
|
382
|
-
this.#setPreventPrimitiveFromCdkEvent(primitiveInstance, eventType, eventTypes[eventTypeAsPrimitiveConfigKey(eventType)]);
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
primitivePreventedFromCdkEvent(primitiveInstance, eventType) {
|
|
386
|
-
return this.primitiveConfigs?.get(primitiveInstance)?.[eventTypeAsPrimitiveConfigKey(eventType)];
|
|
387
|
-
}
|
|
388
|
-
addClickDomRootEventCallback(callback) {
|
|
389
|
-
this.#clickDomRootEventCallbacks.add(callback);
|
|
367
|
+
this.rootContext = injectRdxPopoverRootContext();
|
|
390
368
|
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
}
|
|
394
|
-
#setPreventPrimitiveFromCdkEvent(primitiveInstance, eventType, value) {
|
|
395
|
-
if (!this.primitiveConfigs?.has(primitiveInstance)) {
|
|
396
|
-
isDevMode() &&
|
|
397
|
-
console.error('[RdxCdkEventService.preventPrimitiveFromCdkEvent] RDX Primitive instance has not been registered!', primitiveInstance);
|
|
398
|
-
return;
|
|
399
|
-
}
|
|
400
|
-
switch (eventType) {
|
|
401
|
-
case 'cdkOverlayOutsideClick':
|
|
402
|
-
this.primitiveConfigs.get(primitiveInstance).preventCdkOverlayOutsideClick = value;
|
|
403
|
-
break;
|
|
404
|
-
case 'cdkOverlayEscapeKeyDown':
|
|
405
|
-
this.primitiveConfigs.get(primitiveInstance).preventCdkOverlayEscapeKeyDown = value;
|
|
406
|
-
break;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
#registerOnDestroyCallbacks() {
|
|
410
|
-
this.destroyRef.onDestroy(() => {
|
|
411
|
-
this.onDestroyCallbacks.forEach((onDestroyCallback) => onDestroyCallback());
|
|
412
|
-
this.onDestroyCallbacks.clear();
|
|
413
|
-
});
|
|
414
|
-
}
|
|
415
|
-
#listenToClickDomRootEvent() {
|
|
416
|
-
const target = this.document;
|
|
417
|
-
const eventName = 'click';
|
|
418
|
-
const options = { capture: true };
|
|
419
|
-
const callback = (event) => {
|
|
420
|
-
this.#clickDomRootEventCallbacks.forEach((clickDomRootEventCallback) => clickDomRootEventCallback(event));
|
|
421
|
-
};
|
|
422
|
-
const major = parseInt(VERSION.major);
|
|
423
|
-
const minor = parseInt(VERSION.minor);
|
|
424
|
-
let destroyClickDomRootEventListener;
|
|
425
|
-
/**
|
|
426
|
-
* @see src/cdk/platform/features/backwards-compatibility.ts in @angular/cdk
|
|
427
|
-
*/
|
|
428
|
-
if (major > 19 || (major === 19 && minor > 0) || (major === 0 && minor === 0)) {
|
|
429
|
-
destroyClickDomRootEventListener = this.ngZone.runOutsideAngular(() => {
|
|
430
|
-
const destroyClickDomRootEventListenerInternal = this.renderer2.listen(target, eventName, callback, options);
|
|
431
|
-
return () => {
|
|
432
|
-
destroyClickDomRootEventListenerInternal();
|
|
433
|
-
this.#clickDomRootEventCallbacks.clear();
|
|
434
|
-
};
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
else {
|
|
438
|
-
/**
|
|
439
|
-
* This part can get removed when v19.1 or higher is on the board
|
|
440
|
-
*/
|
|
441
|
-
destroyClickDomRootEventListener = this.ngZone.runOutsideAngular(() => {
|
|
442
|
-
target.addEventListener(eventName, callback, options);
|
|
443
|
-
return () => {
|
|
444
|
-
this.ngZone.runOutsideAngular(() => target.removeEventListener(eventName, callback, options));
|
|
445
|
-
this.#clickDomRootEventCallbacks.clear();
|
|
446
|
-
};
|
|
447
|
-
});
|
|
448
|
-
}
|
|
449
|
-
this.onDestroyCallbacks.add(destroyClickDomRootEventListener);
|
|
450
|
-
}
|
|
451
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: RdxCdkEventService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
452
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.3", ngImport: i0, type: RdxCdkEventService }); }
|
|
369
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxPopoverBackdrop, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
370
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: RdxPopoverBackdrop, isStandalone: true, selector: "[rdxPopoverBackdrop]", host: { properties: { "attr.data-closed": "rootContext.isOpen() ? undefined : \"\"", "attr.data-ending-style": "rootContext.transitionStatus() === \"ending\" ? \"\" : undefined", "attr.data-instant": "rootContext.instant() ? \"\" : undefined", "attr.data-open": "rootContext.isOpen() ? \"\" : undefined", "attr.data-starting-style": "rootContext.transitionStatus() === \"starting\" ? \"\" : undefined", "attr.data-state": "rootContext.isOpen() ? \"open\" : \"closed\"" } }, ngImport: i0 }); }
|
|
453
371
|
}
|
|
454
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
455
|
-
type:
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
if (throwWhenExists) {
|
|
469
|
-
throw Error(existsErrorMessage);
|
|
470
|
-
}
|
|
471
|
-
else {
|
|
472
|
-
isDevMode() && console.warn(existsErrorMessage);
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
window[RdxCdkEventServiceWindowKey] ??= new RdxCdkEventService();
|
|
476
|
-
return window[RdxCdkEventServiceWindowKey];
|
|
477
|
-
}
|
|
478
|
-
});
|
|
479
|
-
const provideRdxCdkEventServiceInRoot = () => makeEnvironmentProviders([getProvider()]);
|
|
480
|
-
const provideRdxCdkEventService = () => getProvider(false);
|
|
481
|
-
const injectRdxCdkEventService = () => inject(RdxCdkEventServiceToken, { optional: true });
|
|
372
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxPopoverBackdrop, decorators: [{
|
|
373
|
+
type: Directive,
|
|
374
|
+
args: [{
|
|
375
|
+
selector: '[rdxPopoverBackdrop]',
|
|
376
|
+
host: {
|
|
377
|
+
'[attr.data-closed]': 'rootContext.isOpen() ? undefined : ""',
|
|
378
|
+
'[attr.data-ending-style]': 'rootContext.transitionStatus() === "ending" ? "" : undefined',
|
|
379
|
+
'[attr.data-instant]': 'rootContext.instant() ? "" : undefined',
|
|
380
|
+
'[attr.data-open]': 'rootContext.isOpen() ? "" : undefined',
|
|
381
|
+
'[attr.data-starting-style]': 'rootContext.transitionStatus() === "starting" ? "" : undefined',
|
|
382
|
+
'[attr.data-state]': 'rootContext.isOpen() ? "open" : "closed"'
|
|
383
|
+
}
|
|
384
|
+
}]
|
|
385
|
+
}] });
|
|
482
386
|
|
|
483
|
-
|
|
484
|
-
|
|
387
|
+
/**
|
|
388
|
+
* A container for the popover contents.
|
|
389
|
+
*/
|
|
390
|
+
class RdxPopoverPopup {
|
|
485
391
|
constructor() {
|
|
486
|
-
|
|
487
|
-
this.
|
|
488
|
-
|
|
489
|
-
this.
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
392
|
+
this.rootContext = injectRdxPopoverRootContext();
|
|
393
|
+
this.dismissableLayer = inject(RdxDismissableLayer);
|
|
394
|
+
this.focusScope = inject(RdxFocusScope);
|
|
395
|
+
this.wrapper = inject(RdxPopperContentWrapper, { optional: true });
|
|
396
|
+
this.align = computed(() => this.wrapper?.placedAlign(), ...(ngDevMode ? [{ debugName: "align" }] : /* istanbul ignore next */ []));
|
|
397
|
+
this.side = computed(() => this.wrapper?.placedSide(), ...(ngDevMode ? [{ debugName: "side" }] : /* istanbul ignore next */ []));
|
|
398
|
+
this.dismissDetails = {
|
|
399
|
+
reason: 'none',
|
|
400
|
+
event: new Event('popover.dismiss')
|
|
401
|
+
};
|
|
495
402
|
/**
|
|
496
|
-
*
|
|
497
|
-
* @default false
|
|
403
|
+
* Event handler called when the escape key is down. Can be prevented.
|
|
498
404
|
*/
|
|
499
|
-
this.
|
|
405
|
+
this.escapeKeyDown = outputFromObservable(outputToObservable(this.dismissableLayer.escapeKeyDown));
|
|
500
406
|
/**
|
|
501
|
-
*
|
|
502
|
-
* @default undefined
|
|
407
|
+
* Event handler called when a pointerdown event happens outside of the popup. Can be prevented.
|
|
503
408
|
*/
|
|
504
|
-
this.
|
|
409
|
+
this.pointerDownOutside = outputFromObservable(outputToObservable(this.dismissableLayer.pointerDownOutside));
|
|
505
410
|
/**
|
|
506
|
-
*
|
|
507
|
-
* @default undefined
|
|
411
|
+
* Event handler called when focus moves outside of the popup. Can be prevented.
|
|
508
412
|
*/
|
|
509
|
-
this.
|
|
413
|
+
this.focusOutside = outputFromObservable(outputToObservable(this.dismissableLayer.focusOutside));
|
|
510
414
|
/**
|
|
511
|
-
*
|
|
512
|
-
* @default false
|
|
415
|
+
* Event handler called when an interaction happens outside of the popup. Can be prevented.
|
|
513
416
|
*/
|
|
514
|
-
this.
|
|
417
|
+
this.interactOutside = outputFromObservable(outputToObservable(this.dismissableLayer.interactOutside));
|
|
515
418
|
/**
|
|
516
|
-
*
|
|
517
|
-
* @default false
|
|
419
|
+
* Event handler called before focus moves into the popup. Can be prevented.
|
|
518
420
|
*/
|
|
519
|
-
this.
|
|
421
|
+
this.openAutoFocus = outputFromObservable(outputToObservable(this.focusScope.mountAutoFocus));
|
|
520
422
|
/**
|
|
521
|
-
*
|
|
522
|
-
* @default false
|
|
423
|
+
* Event handler called before focus returns after the popup is removed. Can be prevented.
|
|
523
424
|
*/
|
|
524
|
-
this.
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
this.
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
this.popoverArrowDirective = contentChild(RdxPopoverArrowToken, ...(ngDevMode ? [{ debugName: "popoverArrowDirective" }] : []));
|
|
533
|
-
/** @ignore */
|
|
534
|
-
this.popoverCloseDirective = contentChild(RdxPopoverCloseToken, ...(ngDevMode ? [{ debugName: "popoverCloseDirective" }] : []));
|
|
535
|
-
/** @ignore */
|
|
536
|
-
this.popoverContentAttributesComponent = contentChild(RdxPopoverContentAttributesToken, ...(ngDevMode ? [{ debugName: "popoverContentAttributesComponent" }] : []));
|
|
537
|
-
/** @ignore */
|
|
538
|
-
this.internalPopoverAnchorDirective = contentChild(RdxPopoverAnchorToken, ...(ngDevMode ? [{ debugName: "internalPopoverAnchorDirective" }] : []));
|
|
539
|
-
/** @ignore */
|
|
540
|
-
this.viewContainerRef = inject(ViewContainerRef);
|
|
541
|
-
/** @ignore */
|
|
542
|
-
this.rdxCdkEventService = injectRdxCdkEventService();
|
|
543
|
-
/** @ignore */
|
|
544
|
-
this.destroyRef = inject(DestroyRef);
|
|
545
|
-
/** @ignore */
|
|
546
|
-
this.state = signal(RdxPopoverState.CLOSED, ...(ngDevMode ? [{ debugName: "state" }] : []));
|
|
547
|
-
/** @ignore */
|
|
548
|
-
this.attachDetachEvent = signal(RdxPopoverAttachDetachEvent.DETACH, ...(ngDevMode ? [{ debugName: "attachDetachEvent" }] : []));
|
|
549
|
-
/** @ignore */
|
|
550
|
-
this.isFirstDefaultOpen = signal(false, ...(ngDevMode ? [{ debugName: "isFirstDefaultOpen" }] : []));
|
|
551
|
-
/** @ignore */
|
|
552
|
-
this.popoverAnchorDirective = computed(() => this.internalPopoverAnchorDirective() ?? this.anchor(), ...(ngDevMode ? [{ debugName: "popoverAnchorDirective" }] : []));
|
|
553
|
-
/** @ignore */
|
|
554
|
-
this.onAnchorChangeEffect = () => {
|
|
555
|
-
effect(() => {
|
|
556
|
-
const anchor = this.anchor();
|
|
557
|
-
untracked(() => {
|
|
558
|
-
if (anchor) {
|
|
559
|
-
anchor.setPopoverRoot(this);
|
|
560
|
-
}
|
|
561
|
-
});
|
|
562
|
-
});
|
|
563
|
-
};
|
|
564
|
-
this.rdxCdkEventService?.registerPrimitive(this);
|
|
565
|
-
this.destroyRef.onDestroy(() => this.rdxCdkEventService?.deregisterPrimitive(this));
|
|
566
|
-
this.onStateChangeEffect();
|
|
567
|
-
this.onCssAnimationStatusChangeChangeEffect();
|
|
568
|
-
this.onOpenChangeEffect();
|
|
569
|
-
this.onIsFirstDefaultOpenChangeEffect();
|
|
570
|
-
this.onAnchorChangeEffect();
|
|
571
|
-
this.emitOpenOrClosedEventEffect();
|
|
572
|
-
afterNextRender({
|
|
573
|
-
write: () => {
|
|
574
|
-
if (this.defaultOpen() && !this.open()) {
|
|
575
|
-
this.isFirstDefaultOpen.set(true);
|
|
576
|
-
}
|
|
425
|
+
this.closeAutoFocus = outputFromObservable(outputToObservable(this.focusScope.unmountAutoFocus));
|
|
426
|
+
useScrollLock(computed(() => this.rootContext.modal() === true));
|
|
427
|
+
const unregisterTransitionElement = this.rootContext.registerTransitionElement(inject(ElementRef).nativeElement);
|
|
428
|
+
inject(DestroyRef).onDestroy(unregisterTransitionElement);
|
|
429
|
+
this.dismissableLayer.pointerDownOutside.subscribe((event) => {
|
|
430
|
+
this.dismissDetails = { reason: 'outside-press', event };
|
|
431
|
+
if (this.rootContext.triggers().some((trigger) => trigger.contains(event.target))) {
|
|
432
|
+
event.preventDefault();
|
|
577
433
|
}
|
|
578
434
|
});
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
cssOpeningAnimation: this.cssOpeningAnimation(),
|
|
585
|
-
cssClosingAnimation: this.cssClosingAnimation(),
|
|
586
|
-
cssAnimationStatus: this.cssAnimationStatus(),
|
|
587
|
-
attachDetachEvent: this.attachDetachEvent(),
|
|
588
|
-
state: this.state(),
|
|
589
|
-
canEmitOnOpenOrOnClosed: this.canEmitOnOpenOrOnClosed()
|
|
590
|
-
};
|
|
591
|
-
}
|
|
592
|
-
/** @ignore */
|
|
593
|
-
controlledExternally() {
|
|
594
|
-
return this.externalControl;
|
|
595
|
-
}
|
|
596
|
-
/** @ignore */
|
|
597
|
-
firstDefaultOpen() {
|
|
598
|
-
return this.isFirstDefaultOpen();
|
|
599
|
-
}
|
|
600
|
-
/** @ignore */
|
|
601
|
-
handleOpen() {
|
|
602
|
-
if (this.externalControl()) {
|
|
603
|
-
return;
|
|
604
|
-
}
|
|
605
|
-
this.setState(RdxPopoverState.OPEN);
|
|
606
|
-
}
|
|
607
|
-
/** @ignore */
|
|
608
|
-
handleClose() {
|
|
609
|
-
if (this.isFirstDefaultOpen()) {
|
|
610
|
-
this.isFirstDefaultOpen.set(false);
|
|
611
|
-
}
|
|
612
|
-
if (this.externalControl()) {
|
|
613
|
-
return;
|
|
614
|
-
}
|
|
615
|
-
this.setState(RdxPopoverState.CLOSED);
|
|
616
|
-
}
|
|
617
|
-
/** @ignore */
|
|
618
|
-
handleToggle() {
|
|
619
|
-
if (this.externalControl()) {
|
|
620
|
-
return;
|
|
621
|
-
}
|
|
622
|
-
this.isOpen() ? this.handleClose() : this.handleOpen();
|
|
623
|
-
}
|
|
624
|
-
/** @ignore */
|
|
625
|
-
isOpen(state) {
|
|
626
|
-
return (state ?? this.state()) === RdxPopoverState.OPEN;
|
|
627
|
-
}
|
|
628
|
-
/** @ignore */
|
|
629
|
-
setState(state = RdxPopoverState.CLOSED) {
|
|
630
|
-
if (state === this.state()) {
|
|
631
|
-
return;
|
|
632
|
-
}
|
|
633
|
-
this.state.set(state);
|
|
634
|
-
}
|
|
635
|
-
/** @ignore */
|
|
636
|
-
openContent() {
|
|
637
|
-
this.popoverContentDirective().open();
|
|
638
|
-
if (!this.cssAnimation() || !this.cssOpeningAnimation()) {
|
|
639
|
-
this.cssAnimationStatus.set(null);
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
/** @ignore */
|
|
643
|
-
closeContent() {
|
|
644
|
-
this.popoverContentDirective().close();
|
|
645
|
-
if (!this.cssAnimation() || !this.cssClosingAnimation()) {
|
|
646
|
-
this.cssAnimationStatus.set(null);
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
/** @ignore */
|
|
650
|
-
emitOnOpen() {
|
|
651
|
-
this.popoverContentDirective().onOpen.emit();
|
|
652
|
-
}
|
|
653
|
-
/** @ignore */
|
|
654
|
-
emitOnClosed() {
|
|
655
|
-
this.popoverContentDirective().onClosed.emit();
|
|
656
|
-
}
|
|
657
|
-
/** @ignore */
|
|
658
|
-
ifOpenOrCloseWithoutAnimations(state) {
|
|
659
|
-
return (!this.popoverContentAttributesComponent() ||
|
|
660
|
-
!this.cssAnimation() ||
|
|
661
|
-
(this.cssAnimation() && !this.cssClosingAnimation() && state === RdxPopoverState.CLOSED) ||
|
|
662
|
-
(this.cssAnimation() && !this.cssOpeningAnimation() && state === RdxPopoverState.OPEN) ||
|
|
663
|
-
// !this.cssAnimationStatus() ||
|
|
664
|
-
(this.cssOpeningAnimation() &&
|
|
665
|
-
state === RdxPopoverState.OPEN &&
|
|
666
|
-
[RdxPopoverAnimationStatus.OPEN_STARTED].includes(this.cssAnimationStatus())) ||
|
|
667
|
-
(this.cssClosingAnimation() &&
|
|
668
|
-
state === RdxPopoverState.CLOSED &&
|
|
669
|
-
[RdxPopoverAnimationStatus.CLOSED_STARTED].includes(this.cssAnimationStatus())));
|
|
670
|
-
}
|
|
671
|
-
/** @ignore */
|
|
672
|
-
ifOpenOrCloseWithAnimations(cssAnimationStatus) {
|
|
673
|
-
return (this.popoverContentAttributesComponent() &&
|
|
674
|
-
this.cssAnimation() &&
|
|
675
|
-
cssAnimationStatus &&
|
|
676
|
-
((this.cssOpeningAnimation() &&
|
|
677
|
-
this.state() === RdxPopoverState.OPEN &&
|
|
678
|
-
[RdxPopoverAnimationStatus.OPEN_ENDED].includes(cssAnimationStatus)) ||
|
|
679
|
-
(this.cssClosingAnimation() &&
|
|
680
|
-
this.state() === RdxPopoverState.CLOSED &&
|
|
681
|
-
[RdxPopoverAnimationStatus.CLOSED_ENDED].includes(cssAnimationStatus))));
|
|
682
|
-
}
|
|
683
|
-
/** @ignore */
|
|
684
|
-
openOrClose(state) {
|
|
685
|
-
const isOpen = this.isOpen(state);
|
|
686
|
-
isOpen ? this.openContent() : this.closeContent();
|
|
687
|
-
}
|
|
688
|
-
/** @ignore */
|
|
689
|
-
emitOnOpenOrOnClosed(state) {
|
|
690
|
-
this.isOpen(state)
|
|
691
|
-
? this.attachDetachEvent() === RdxPopoverAttachDetachEvent.ATTACH && this.emitOnOpen()
|
|
692
|
-
: this.attachDetachEvent() === RdxPopoverAttachDetachEvent.DETACH && this.emitOnClosed();
|
|
693
|
-
}
|
|
694
|
-
/** @ignore */
|
|
695
|
-
canEmitOnOpenOrOnClosed() {
|
|
696
|
-
return (!this.cssAnimation() ||
|
|
697
|
-
(!this.cssOpeningAnimation() && this.state() === RdxPopoverState.OPEN) ||
|
|
698
|
-
(this.cssOpeningAnimation() &&
|
|
699
|
-
this.state() === RdxPopoverState.OPEN &&
|
|
700
|
-
this.cssAnimationStatus() === RdxPopoverAnimationStatus.OPEN_ENDED) ||
|
|
701
|
-
(!this.cssClosingAnimation() && this.state() === RdxPopoverState.CLOSED) ||
|
|
702
|
-
(this.cssClosingAnimation() &&
|
|
703
|
-
this.state() === RdxPopoverState.CLOSED &&
|
|
704
|
-
this.cssAnimationStatus() === RdxPopoverAnimationStatus.CLOSED_ENDED));
|
|
705
|
-
}
|
|
706
|
-
/** @ignore */
|
|
707
|
-
onStateChangeEffect() {
|
|
708
|
-
let isFirst = true;
|
|
709
|
-
effect(() => {
|
|
710
|
-
const state = this.state();
|
|
711
|
-
untracked(() => {
|
|
712
|
-
if (isFirst) {
|
|
713
|
-
isFirst = false;
|
|
714
|
-
return;
|
|
715
|
-
}
|
|
716
|
-
if (!this.ifOpenOrCloseWithoutAnimations(state)) {
|
|
717
|
-
return;
|
|
718
|
-
}
|
|
719
|
-
this.openOrClose(state);
|
|
720
|
-
});
|
|
721
|
-
}, {});
|
|
722
|
-
}
|
|
723
|
-
/** @ignore */
|
|
724
|
-
onCssAnimationStatusChangeChangeEffect() {
|
|
725
|
-
let isFirst = true;
|
|
726
|
-
effect(() => {
|
|
727
|
-
const cssAnimationStatus = this.cssAnimationStatus();
|
|
728
|
-
untracked(() => {
|
|
729
|
-
if (isFirst) {
|
|
730
|
-
isFirst = false;
|
|
731
|
-
return;
|
|
732
|
-
}
|
|
733
|
-
if (!this.ifOpenOrCloseWithAnimations(cssAnimationStatus)) {
|
|
734
|
-
return;
|
|
735
|
-
}
|
|
736
|
-
this.openOrClose(this.state());
|
|
737
|
-
});
|
|
435
|
+
this.dismissableLayer.focusOutside.subscribe((event) => {
|
|
436
|
+
this.dismissDetails = { reason: 'focus-out', event };
|
|
437
|
+
if (this.rootContext.isPointerDownOnTrigger()) {
|
|
438
|
+
event.preventDefault();
|
|
439
|
+
}
|
|
738
440
|
});
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
emitOpenOrClosedEventEffect() {
|
|
742
|
-
let isFirst = true;
|
|
743
|
-
effect(() => {
|
|
744
|
-
this.attachDetachEvent();
|
|
745
|
-
this.cssAnimationStatus();
|
|
746
|
-
untracked(() => {
|
|
747
|
-
if (isFirst) {
|
|
748
|
-
isFirst = false;
|
|
749
|
-
return;
|
|
750
|
-
}
|
|
751
|
-
const canEmitOpenClose = untracked(() => this.canEmitOnOpenOrOnClosed());
|
|
752
|
-
if (!canEmitOpenClose) {
|
|
753
|
-
return;
|
|
754
|
-
}
|
|
755
|
-
this.emitOnOpenOrOnClosed(this.state());
|
|
756
|
-
});
|
|
441
|
+
this.dismissableLayer.escapeKeyDown.subscribe((event) => {
|
|
442
|
+
this.dismissDetails = { reason: 'escape-key', event };
|
|
757
443
|
});
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
}
|
|
444
|
+
this.focusScope.mountAutoFocus.subscribe((event) => {
|
|
445
|
+
if (this.rootContext.isHoverActive()) {
|
|
446
|
+
event.preventDefault();
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
this.dismissableLayer.dismiss.subscribe(() => {
|
|
450
|
+
this.rootContext.close(this.dismissDetails.reason, this.dismissDetails.event);
|
|
451
|
+
this.dismissDetails = { reason: 'none', event: new Event('popover.dismiss') };
|
|
766
452
|
});
|
|
767
453
|
}
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
454
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxPopoverPopup, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
455
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: RdxPopoverPopup, isStandalone: true, selector: "[rdxPopoverPopup]", outputs: { escapeKeyDown: "escapeKeyDown", pointerDownOutside: "pointerDownOutside", focusOutside: "focusOutside", interactOutside: "interactOutside", openAutoFocus: "openAutoFocus", closeAutoFocus: "closeAutoFocus" }, host: { attributes: { "role": "dialog" }, listeners: { "pointerenter": "rootContext.cancelHoverClose()" }, properties: { "attr.aria-describedby": "rootContext.descriptionId()", "attr.aria-labelledby": "rootContext.titleId()", "attr.data-closed": "rootContext.isOpen() ? undefined : \"\"", "attr.data-ending-style": "rootContext.transitionStatus() === \"ending\" ? \"\" : undefined", "attr.data-instant": "rootContext.instant() ? \"\" : undefined", "attr.data-open": "rootContext.isOpen() ? \"\" : undefined", "attr.data-starting-style": "rootContext.transitionStatus() === \"starting\" ? \"\" : undefined", "attr.data-state": "rootContext.isOpen() ? \"open\" : \"closed\"", "attr.data-align": "align()", "attr.data-side": "side()", "id": "rootContext.contentId" } }, providers: [
|
|
456
|
+
provideRdxDismissableLayerConfig(() => {
|
|
457
|
+
const rootContext = injectRdxPopoverRootContext();
|
|
458
|
+
return {
|
|
459
|
+
disableOutsidePointerEvents: computed(() => rootContext.modal() === true)
|
|
460
|
+
};
|
|
461
|
+
}),
|
|
462
|
+
provideRdxFocusScopeConfig(() => {
|
|
463
|
+
const rootContext = injectRdxPopoverRootContext();
|
|
464
|
+
return {
|
|
465
|
+
trapped: computed(() => rootContext.modal() === 'trap-focus' ||
|
|
466
|
+
(rootContext.modal() === true && rootContext.hasPopupClose()))
|
|
467
|
+
};
|
|
468
|
+
})
|
|
469
|
+
], hostDirectives: [{ directive: i1.RdxPopperContent }, { directive: i2.RdxDismissableLayer }, { directive: i3.RdxFocusScope }], ngImport: i0 }); }
|
|
470
|
+
}
|
|
471
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxPopoverPopup, decorators: [{
|
|
472
|
+
type: Directive,
|
|
473
|
+
args: [{
|
|
474
|
+
selector: '[rdxPopoverPopup]',
|
|
475
|
+
hostDirectives: [RdxPopperContent, RdxDismissableLayer, RdxFocusScope],
|
|
476
|
+
providers: [
|
|
477
|
+
provideRdxDismissableLayerConfig(() => {
|
|
478
|
+
const rootContext = injectRdxPopoverRootContext();
|
|
479
|
+
return {
|
|
480
|
+
disableOutsidePointerEvents: computed(() => rootContext.modal() === true)
|
|
481
|
+
};
|
|
482
|
+
}),
|
|
483
|
+
provideRdxFocusScopeConfig(() => {
|
|
484
|
+
const rootContext = injectRdxPopoverRootContext();
|
|
485
|
+
return {
|
|
486
|
+
trapped: computed(() => rootContext.modal() === 'trap-focus' ||
|
|
487
|
+
(rootContext.modal() === true && rootContext.hasPopupClose()))
|
|
488
|
+
};
|
|
489
|
+
})
|
|
490
|
+
],
|
|
491
|
+
host: {
|
|
492
|
+
role: 'dialog',
|
|
493
|
+
'[attr.aria-describedby]': 'rootContext.descriptionId()',
|
|
494
|
+
'[attr.aria-labelledby]': 'rootContext.titleId()',
|
|
495
|
+
'[attr.data-closed]': 'rootContext.isOpen() ? undefined : ""',
|
|
496
|
+
'[attr.data-ending-style]': 'rootContext.transitionStatus() === "ending" ? "" : undefined',
|
|
497
|
+
'[attr.data-instant]': 'rootContext.instant() ? "" : undefined',
|
|
498
|
+
'[attr.data-open]': 'rootContext.isOpen() ? "" : undefined',
|
|
499
|
+
'[attr.data-starting-style]': 'rootContext.transitionStatus() === "starting" ? "" : undefined',
|
|
500
|
+
'[attr.data-state]': 'rootContext.isOpen() ? "open" : "closed"',
|
|
501
|
+
'[attr.data-align]': 'align()',
|
|
502
|
+
'[attr.data-side]': 'side()',
|
|
503
|
+
'[id]': 'rootContext.contentId',
|
|
504
|
+
'(pointerenter)': 'rootContext.cancelHoverClose()'
|
|
505
|
+
}
|
|
506
|
+
}]
|
|
507
|
+
}], ctorParameters: () => [], propDecorators: { escapeKeyDown: [{ type: i0.Output, args: ["escapeKeyDown"] }], pointerDownOutside: [{ type: i0.Output, args: ["pointerDownOutside"] }], focusOutside: [{ type: i0.Output, args: ["focusOutside"] }], interactOutside: [{ type: i0.Output, args: ["interactOutside"] }], openAutoFocus: [{ type: i0.Output, args: ["openAutoFocus"] }], closeAutoFocus: [{ type: i0.Output, args: ["closeAutoFocus"] }] } });
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* A button that closes the popover.
|
|
511
|
+
*/
|
|
512
|
+
class RdxPopoverClose {
|
|
513
|
+
constructor() {
|
|
514
|
+
this.rootContext = injectRdxPopoverRootContext();
|
|
515
|
+
if (inject(RdxPopoverPopup, { optional: true })) {
|
|
516
|
+
const unregister = this.rootContext.registerPopupClose();
|
|
517
|
+
inject(DestroyRef).onDestroy(unregister);
|
|
518
|
+
}
|
|
780
519
|
}
|
|
781
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
782
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
520
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxPopoverClose, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
521
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: RdxPopoverClose, isStandalone: true, selector: "button[rdxPopoverClose]", host: { attributes: { "type": "button" }, listeners: { "click": "rootContext.close(\"close-press\", $event)" } }, ngImport: i0 }); }
|
|
783
522
|
}
|
|
784
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
523
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxPopoverClose, decorators: [{
|
|
785
524
|
type: Directive,
|
|
786
525
|
args: [{
|
|
787
|
-
selector: '[
|
|
788
|
-
|
|
526
|
+
selector: 'button[rdxPopoverClose]',
|
|
527
|
+
host: {
|
|
528
|
+
type: 'button',
|
|
529
|
+
'(click)': 'rootContext.close("close-press", $event)'
|
|
530
|
+
}
|
|
789
531
|
}]
|
|
790
532
|
}], ctorParameters: () => [] });
|
|
791
533
|
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
534
|
+
/**
|
|
535
|
+
* An accessible description for the popover.
|
|
536
|
+
*/
|
|
537
|
+
class RdxPopoverDescription {
|
|
538
|
+
constructor() {
|
|
539
|
+
this.rootContext = injectRdxPopoverRootContext();
|
|
540
|
+
this.id = injectId('rdx-popover-description-');
|
|
541
|
+
this.rootContext.setDescriptionId(this.id);
|
|
542
|
+
inject(DestroyRef).onDestroy(() => this.rootContext.setDescriptionId(undefined));
|
|
543
|
+
}
|
|
544
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxPopoverDescription, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
545
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: RdxPopoverDescription, isStandalone: true, selector: "[rdxPopoverDescription]", host: { properties: { "id": "id" } }, ngImport: i0 }); }
|
|
795
546
|
}
|
|
547
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxPopoverDescription, decorators: [{
|
|
548
|
+
type: Directive,
|
|
549
|
+
args: [{
|
|
550
|
+
selector: '[rdxPopoverDescription]',
|
|
551
|
+
host: {
|
|
552
|
+
'[id]': 'id'
|
|
553
|
+
}
|
|
554
|
+
}]
|
|
555
|
+
}], ctorParameters: () => [] });
|
|
796
556
|
|
|
797
|
-
|
|
557
|
+
/**
|
|
558
|
+
* Moves the popover to a different part of the DOM.
|
|
559
|
+
*/
|
|
560
|
+
class RdxPopoverPortal {
|
|
798
561
|
constructor() {
|
|
562
|
+
this.rootContext = injectRdxPopoverRootContext();
|
|
799
563
|
/**
|
|
800
|
-
*
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
* */
|
|
804
|
-
this.popoverRoot = injectPopoverRoot(true);
|
|
805
|
-
/** @ignore */
|
|
806
|
-
this.elementRef = inject(ElementRef);
|
|
807
|
-
/** @ignore */
|
|
808
|
-
this.overlayOrigin = inject(CdkOverlayOrigin);
|
|
809
|
-
/** @ignore */
|
|
810
|
-
this.document = injectDocument();
|
|
811
|
-
/** @ignore */
|
|
812
|
-
this.name = computed(() => `rdx-popover-external-anchor-${this.popoverRoot?.uniqueId()}`, ...(ngDevMode ? [{ debugName: "name" }] : []));
|
|
813
|
-
}
|
|
814
|
-
/** @ignore */
|
|
815
|
-
click() {
|
|
816
|
-
this.emitOutsideClick();
|
|
817
|
-
}
|
|
818
|
-
/** @ignore */
|
|
819
|
-
setPopoverRoot(popoverRoot) {
|
|
820
|
-
this.popoverRoot = popoverRoot;
|
|
821
|
-
}
|
|
822
|
-
emitOutsideClick() {
|
|
823
|
-
if (!this.popoverRoot?.isOpen() ||
|
|
824
|
-
this.popoverRoot?.popoverContentDirective().onOverlayOutsideClickDisabled()) {
|
|
825
|
-
return;
|
|
826
|
-
}
|
|
827
|
-
const clickEvent = new MouseEvent('click', {
|
|
828
|
-
view: this.document.defaultView,
|
|
829
|
-
bubbles: true,
|
|
830
|
-
cancelable: true,
|
|
831
|
-
relatedTarget: this.elementRef.nativeElement
|
|
832
|
-
});
|
|
833
|
-
this.popoverRoot?.popoverTriggerDirective().elementRef.nativeElement.dispatchEvent(clickEvent);
|
|
564
|
+
* Optional container to portal the content into. Defaults to `document.body`.
|
|
565
|
+
*/
|
|
566
|
+
this.container = input(...(ngDevMode ? [undefined, { debugName: "container" }] : /* istanbul ignore next */ []));
|
|
834
567
|
}
|
|
835
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
836
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
837
|
-
{
|
|
838
|
-
provide: RdxPopoverAnchorToken,
|
|
839
|
-
useExisting: forwardRef(() => RdxPopoverAnchorDirective)
|
|
840
|
-
}
|
|
841
|
-
], exportAs: ["rdxPopoverAnchor"], hostDirectives: [{ directive: i1.CdkOverlayOrigin }], ngImport: i0 }); }
|
|
568
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxPopoverPortal, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
569
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxPopoverPortal, isStandalone: true, selector: "[rdxPopoverPortal]", inputs: { container: { classPropertyName: "container", publicName: "container", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-closed": "rootContext.isOpen() ? undefined : \"\"", "attr.data-open": "rootContext.isOpen() ? \"\" : undefined", "attr.data-state": "rootContext.isOpen() ? \"open\" : \"closed\"" } }, hostDirectives: [{ directive: i1$1.RdxPortal, inputs: ["container", "container"] }], ngImport: i0 }); }
|
|
842
570
|
}
|
|
843
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
571
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxPopoverPortal, decorators: [{
|
|
844
572
|
type: Directive,
|
|
845
573
|
args: [{
|
|
846
|
-
selector: '[
|
|
847
|
-
|
|
848
|
-
hostDirectives: [CdkOverlayOrigin],
|
|
849
|
-
host: {
|
|
850
|
-
type: 'button',
|
|
851
|
-
'[attr.id]': 'name()',
|
|
852
|
-
'[attr.aria-haspopup]': '"dialog"',
|
|
853
|
-
'(click)': 'click()'
|
|
854
|
-
},
|
|
855
|
-
providers: [
|
|
574
|
+
selector: '[rdxPopoverPortal]',
|
|
575
|
+
hostDirectives: [
|
|
856
576
|
{
|
|
857
|
-
|
|
858
|
-
|
|
577
|
+
directive: RdxPortal,
|
|
578
|
+
inputs: ['container']
|
|
859
579
|
}
|
|
580
|
+
],
|
|
581
|
+
host: {
|
|
582
|
+
'[attr.data-closed]': 'rootContext.isOpen() ? undefined : ""',
|
|
583
|
+
'[attr.data-open]': 'rootContext.isOpen() ? "" : undefined',
|
|
584
|
+
'[attr.data-state]': 'rootContext.isOpen() ? "open" : "closed"'
|
|
585
|
+
}
|
|
586
|
+
}]
|
|
587
|
+
}], propDecorators: { container: [{ type: i0.Input, args: [{ isSignal: true, alias: "container", required: false }] }] } });
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* Mounts the portal while the popover is open and waits for CSS exit keyframes before unmounting.
|
|
591
|
+
*/
|
|
592
|
+
class RdxPopoverPortalPresence {
|
|
593
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxPopoverPortalPresence, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
594
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: RdxPopoverPortalPresence, isStandalone: true, selector: "ng-template[rdxPopoverPortalPresence]", providers: [
|
|
595
|
+
provideRdxPresenceContext(() => {
|
|
596
|
+
const context = injectRdxPopoverRootContext();
|
|
597
|
+
return { present: context.isOpen };
|
|
598
|
+
})
|
|
599
|
+
], hostDirectives: [{ directive: i1$2.RdxPresenceDirective }], ngImport: i0 }); }
|
|
600
|
+
}
|
|
601
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxPopoverPortalPresence, decorators: [{
|
|
602
|
+
type: Directive,
|
|
603
|
+
args: [{
|
|
604
|
+
selector: 'ng-template[rdxPopoverPortalPresence]',
|
|
605
|
+
hostDirectives: [RdxPresenceDirective],
|
|
606
|
+
providers: [
|
|
607
|
+
provideRdxPresenceContext(() => {
|
|
608
|
+
const context = injectRdxPopoverRootContext();
|
|
609
|
+
return { present: context.isOpen };
|
|
610
|
+
})
|
|
860
611
|
]
|
|
861
612
|
}]
|
|
862
613
|
}] });
|
|
863
614
|
|
|
864
|
-
|
|
615
|
+
/**
|
|
616
|
+
* Positions the popover against its trigger.
|
|
617
|
+
*/
|
|
618
|
+
class RdxPopoverPositioner {
|
|
865
619
|
constructor() {
|
|
866
|
-
|
|
867
|
-
this.
|
|
868
|
-
/** @ignore */
|
|
869
|
-
this.popoverRoot = injectPopoverRoot();
|
|
870
|
-
/** @ignore */
|
|
620
|
+
this.rootContext = injectRdxPopoverRootContext();
|
|
621
|
+
this.wrapper = inject(RdxPopperContentWrapper);
|
|
871
622
|
this.elementRef = inject(ElementRef);
|
|
623
|
+
this.triggerEl = signal(null, ...(ngDevMode ? [{ debugName: "triggerEl" }] : /* istanbul ignore next */ []));
|
|
624
|
+
this.containerEl = signal(this.elementRef.nativeElement, ...(ngDevMode ? [{ debugName: "containerEl" }] : /* istanbul ignore next */ []));
|
|
625
|
+
this.graceArea = useGraceArea(this.triggerEl, this.containerEl);
|
|
872
626
|
/**
|
|
873
|
-
*
|
|
874
|
-
* @default 10
|
|
627
|
+
* An element to position the popup against. Defaults to the trigger.
|
|
875
628
|
*/
|
|
876
|
-
this.
|
|
629
|
+
this.anchor = input(...(ngDevMode ? [undefined, { debugName: "anchor" }] : /* istanbul ignore next */ []));
|
|
877
630
|
/**
|
|
878
|
-
*
|
|
879
|
-
* @default 5
|
|
631
|
+
* The preferred side of the trigger to render against when open.
|
|
880
632
|
*/
|
|
881
|
-
this.
|
|
882
|
-
/**
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
this.
|
|
898
|
-
/**
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
});
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
this.
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
this.
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
effect(() =>
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
const currentArrowSvgElement = this.currentArrowSvgElement();
|
|
934
|
-
if (currentArrowSvgElement) {
|
|
935
|
-
this.renderer.removeChild(this.elementRef.nativeElement, currentArrowSvgElement);
|
|
936
|
-
}
|
|
937
|
-
this.currentArrowSvgElement.set(arrowElement);
|
|
938
|
-
this.renderer.setStyle(this.elementRef.nativeElement, 'width', `${this.width()}px`);
|
|
939
|
-
this.renderer.setStyle(this.elementRef.nativeElement, 'height', `${this.height()}px`);
|
|
940
|
-
this.renderer.appendChild(this.elementRef.nativeElement, this.currentArrowSvgElement());
|
|
941
|
-
});
|
|
942
|
-
});
|
|
943
|
-
}
|
|
944
|
-
/** @ignore */
|
|
945
|
-
onContentPositionAndArrowDimensionsChangeEffect() {
|
|
946
|
-
effect(() => {
|
|
947
|
-
const position = this.position();
|
|
948
|
-
const arrowDimensions = { width: this.width(), height: this.height() };
|
|
949
|
-
untracked(() => {
|
|
950
|
-
if (!position) {
|
|
951
|
-
return;
|
|
952
|
-
}
|
|
953
|
-
this.setPosition(position, arrowDimensions);
|
|
954
|
-
});
|
|
633
|
+
this.side = input('bottom', ...(ngDevMode ? [{ debugName: "side" }] : /* istanbul ignore next */ []));
|
|
634
|
+
/**
|
|
635
|
+
* Distance between the trigger and the popup in pixels.
|
|
636
|
+
*/
|
|
637
|
+
this.sideOffset = input(0, { ...(ngDevMode ? { debugName: "sideOffset" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
638
|
+
/**
|
|
639
|
+
* How to align the popup relative to the specified side.
|
|
640
|
+
*/
|
|
641
|
+
this.align = input('center', ...(ngDevMode ? [{ debugName: "align" }] : /* istanbul ignore next */ []));
|
|
642
|
+
/**
|
|
643
|
+
* An offset in pixels from the `start` or `end` alignment options.
|
|
644
|
+
*/
|
|
645
|
+
this.alignOffset = input(0, { ...(ngDevMode ? { debugName: "alignOffset" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
646
|
+
/**
|
|
647
|
+
* Minimum distance to maintain between the arrow and the edges of the popup.
|
|
648
|
+
*/
|
|
649
|
+
this.arrowPadding = input(5, { ...(ngDevMode ? { debugName: "arrowPadding" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
650
|
+
/**
|
|
651
|
+
* Whether to override side and alignment preferences to prevent collisions.
|
|
652
|
+
*/
|
|
653
|
+
this.avoidCollisions = input(true, { ...(ngDevMode ? { debugName: "avoidCollisions" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
654
|
+
/**
|
|
655
|
+
* The element used as the collision boundary.
|
|
656
|
+
*/
|
|
657
|
+
this.collisionBoundary = input(...(ngDevMode ? [undefined, { debugName: "collisionBoundary" }] : /* istanbul ignore next */ []));
|
|
658
|
+
/**
|
|
659
|
+
* Distance in pixels from the boundary edges where collision detection should occur.
|
|
660
|
+
*/
|
|
661
|
+
this.collisionPadding = input(5, ...(ngDevMode ? [{ debugName: "collisionPadding" }] : /* istanbul ignore next */ []));
|
|
662
|
+
/**
|
|
663
|
+
* The sticky behavior on the alignment axis.
|
|
664
|
+
*/
|
|
665
|
+
this.sticky = input('partial', ...(ngDevMode ? [{ debugName: "sticky" }] : /* istanbul ignore next */ []));
|
|
666
|
+
/**
|
|
667
|
+
* Whether to hide the popup when the trigger becomes fully occluded.
|
|
668
|
+
*/
|
|
669
|
+
this.hideWhenDetached = input(false, { ...(ngDevMode ? { debugName: "hideWhenDetached" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
670
|
+
/**
|
|
671
|
+
* The CSS position strategy used by Floating UI.
|
|
672
|
+
*/
|
|
673
|
+
this.positionStrategy = input('fixed', ...(ngDevMode ? [{ debugName: "positionStrategy" }] : /* istanbul ignore next */ []));
|
|
674
|
+
/**
|
|
675
|
+
* Whether to update position on every animation frame.
|
|
676
|
+
*/
|
|
677
|
+
this.updatePositionStrategy = input('always', ...(ngDevMode ? [{ debugName: "updatePositionStrategy" }] : /* istanbul ignore next */ []));
|
|
678
|
+
/**
|
|
679
|
+
* Emits when the popup has been placed.
|
|
680
|
+
*/
|
|
681
|
+
this.placed = outputFromObservable(outputToObservable(inject(RdxPopperContentWrapper).placed));
|
|
682
|
+
effect(() => this.triggerEl.set(this.rootContext.trigger() ?? null));
|
|
683
|
+
this.graceArea.onPointerExit(() => {
|
|
684
|
+
this.rootContext.closeOnHover();
|
|
955
685
|
});
|
|
956
686
|
}
|
|
957
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
958
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
959
|
-
{
|
|
960
|
-
|
|
961
|
-
useExisting: forwardRef(() => RdxPopoverArrowDirective)
|
|
962
|
-
}
|
|
963
|
-
], ngImport: i0 }); }
|
|
687
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxPopoverPositioner, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
688
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxPopoverPositioner, isStandalone: true, selector: "[rdxPopoverPositioner]", inputs: { anchor: { classPropertyName: "anchor", publicName: "anchor", isSignal: true, isRequired: false, transformFunction: null }, side: { classPropertyName: "side", publicName: "side", isSignal: true, isRequired: false, transformFunction: null }, sideOffset: { classPropertyName: "sideOffset", publicName: "sideOffset", isSignal: true, isRequired: false, transformFunction: null }, align: { classPropertyName: "align", publicName: "align", isSignal: true, isRequired: false, transformFunction: null }, alignOffset: { classPropertyName: "alignOffset", publicName: "alignOffset", isSignal: true, isRequired: false, transformFunction: null }, arrowPadding: { classPropertyName: "arrowPadding", publicName: "arrowPadding", isSignal: true, isRequired: false, transformFunction: null }, avoidCollisions: { classPropertyName: "avoidCollisions", publicName: "avoidCollisions", isSignal: true, isRequired: false, transformFunction: null }, collisionBoundary: { classPropertyName: "collisionBoundary", publicName: "collisionBoundary", isSignal: true, isRequired: false, transformFunction: null }, collisionPadding: { classPropertyName: "collisionPadding", publicName: "collisionPadding", isSignal: true, isRequired: false, transformFunction: null }, sticky: { classPropertyName: "sticky", publicName: "sticky", isSignal: true, isRequired: false, transformFunction: null }, hideWhenDetached: { classPropertyName: "hideWhenDetached", publicName: "hideWhenDetached", isSignal: true, isRequired: false, transformFunction: null }, positionStrategy: { classPropertyName: "positionStrategy", publicName: "positionStrategy", isSignal: true, isRequired: false, transformFunction: null }, updatePositionStrategy: { classPropertyName: "updatePositionStrategy", publicName: "updatePositionStrategy", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { placed: "placed" }, host: { properties: { "attr.data-open": "rootContext.isOpen() ? \"\" : undefined", "attr.data-closed": "rootContext.isOpen() ? undefined : \"\"", "attr.data-anchor-hidden": "wrapper.anchorHidden() ? \"\" : undefined", "attr.data-align": "wrapper.placedAlign()", "attr.data-side": "wrapper.placedSide()", "attr.data-instant": "rootContext.instant() ? \"\" : undefined", "style": "{\n '--anchor-width': 'var(--radix-popper-anchor-width)',\n '--anchor-height': 'var(--radix-popper-anchor-height)',\n '--available-width': 'var(--radix-popper-available-width)',\n '--available-height': 'var(--radix-popper-available-height)',\n '--positioner-width': 'var(--radix-popper-content-wrapper-width)',\n '--positioner-height': 'var(--radix-popper-content-wrapper-height)',\n '--transform-origin': 'var(--radix-popper-transform-origin)',\n '--radix-popover-content-transform-origin': 'var(--radix-popper-transform-origin)',\n '--radix-popover-content-available-width': 'var(--radix-popper-available-width)',\n '--radix-popover-content-available-height': 'var(--radix-popper-available-height)',\n '--radix-popover-trigger-width': 'var(--radix-popper-anchor-width)',\n '--radix-popover-trigger-height': 'var(--radix-popper-anchor-height)'\n }" } }, providers: [
|
|
689
|
+
provideRdxPopperContentConfig({ arrowPadding: 5, collisionPadding: 5, updatePositionStrategy: 'always' })
|
|
690
|
+
], hostDirectives: [{ directive: i1.RdxPopperContentWrapper, inputs: ["anchor", "anchor", "side", "side", "sideOffset", "sideOffset", "align", "align", "alignOffset", "alignOffset", "arrowPadding", "arrowPadding", "avoidCollisions", "avoidCollisions", "collisionBoundary", "collisionBoundary", "collisionPadding", "collisionPadding", "sticky", "sticky", "hideWhenDetached", "hideWhenDetached", "positionStrategy", "positionStrategy", "updatePositionStrategy", "updatePositionStrategy"] }], ngImport: i0 }); }
|
|
964
691
|
}
|
|
965
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
692
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxPopoverPositioner, decorators: [{
|
|
966
693
|
type: Directive,
|
|
967
694
|
args: [{
|
|
968
|
-
selector: '[
|
|
695
|
+
selector: '[rdxPopoverPositioner]',
|
|
969
696
|
providers: [
|
|
697
|
+
provideRdxPopperContentConfig({ arrowPadding: 5, collisionPadding: 5, updatePositionStrategy: 'always' })
|
|
698
|
+
],
|
|
699
|
+
hostDirectives: [
|
|
970
700
|
{
|
|
971
|
-
|
|
972
|
-
|
|
701
|
+
directive: RdxPopperContentWrapper,
|
|
702
|
+
inputs: [
|
|
703
|
+
'anchor',
|
|
704
|
+
'side',
|
|
705
|
+
'sideOffset',
|
|
706
|
+
'align',
|
|
707
|
+
'alignOffset',
|
|
708
|
+
'arrowPadding',
|
|
709
|
+
'avoidCollisions',
|
|
710
|
+
'collisionBoundary',
|
|
711
|
+
'collisionPadding',
|
|
712
|
+
'sticky',
|
|
713
|
+
'hideWhenDetached',
|
|
714
|
+
'positionStrategy',
|
|
715
|
+
'updatePositionStrategy'
|
|
716
|
+
]
|
|
973
717
|
}
|
|
974
|
-
]
|
|
718
|
+
],
|
|
719
|
+
host: {
|
|
720
|
+
'[attr.data-open]': 'rootContext.isOpen() ? "" : undefined',
|
|
721
|
+
'[attr.data-closed]': 'rootContext.isOpen() ? undefined : ""',
|
|
722
|
+
'[attr.data-anchor-hidden]': 'wrapper.anchorHidden() ? "" : undefined',
|
|
723
|
+
'[attr.data-align]': 'wrapper.placedAlign()',
|
|
724
|
+
'[attr.data-side]': 'wrapper.placedSide()',
|
|
725
|
+
'[attr.data-instant]': 'rootContext.instant() ? "" : undefined',
|
|
726
|
+
'[style]': `{
|
|
727
|
+
'--anchor-width': 'var(--radix-popper-anchor-width)',
|
|
728
|
+
'--anchor-height': 'var(--radix-popper-anchor-height)',
|
|
729
|
+
'--available-width': 'var(--radix-popper-available-width)',
|
|
730
|
+
'--available-height': 'var(--radix-popper-available-height)',
|
|
731
|
+
'--positioner-width': 'var(--radix-popper-content-wrapper-width)',
|
|
732
|
+
'--positioner-height': 'var(--radix-popper-content-wrapper-height)',
|
|
733
|
+
'--transform-origin': 'var(--radix-popper-transform-origin)',
|
|
734
|
+
'--radix-popover-content-transform-origin': 'var(--radix-popper-transform-origin)',
|
|
735
|
+
'--radix-popover-content-available-width': 'var(--radix-popper-available-width)',
|
|
736
|
+
'--radix-popover-content-available-height': 'var(--radix-popper-available-height)',
|
|
737
|
+
'--radix-popover-trigger-width': 'var(--radix-popper-anchor-width)',
|
|
738
|
+
'--radix-popover-trigger-height': 'var(--radix-popper-anchor-height)'
|
|
739
|
+
}`
|
|
740
|
+
}
|
|
741
|
+
}]
|
|
742
|
+
}], ctorParameters: () => [], propDecorators: { anchor: [{ type: i0.Input, args: [{ isSignal: true, alias: "anchor", required: false }] }], side: [{ type: i0.Input, args: [{ isSignal: true, alias: "side", required: false }] }], sideOffset: [{ type: i0.Input, args: [{ isSignal: true, alias: "sideOffset", required: false }] }], align: [{ type: i0.Input, args: [{ isSignal: true, alias: "align", required: false }] }], alignOffset: [{ type: i0.Input, args: [{ isSignal: true, alias: "alignOffset", required: false }] }], arrowPadding: [{ type: i0.Input, args: [{ isSignal: true, alias: "arrowPadding", required: false }] }], avoidCollisions: [{ type: i0.Input, args: [{ isSignal: true, alias: "avoidCollisions", required: false }] }], collisionBoundary: [{ type: i0.Input, args: [{ isSignal: true, alias: "collisionBoundary", required: false }] }], collisionPadding: [{ type: i0.Input, args: [{ isSignal: true, alias: "collisionPadding", required: false }] }], sticky: [{ type: i0.Input, args: [{ isSignal: true, alias: "sticky", required: false }] }], hideWhenDetached: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideWhenDetached", required: false }] }], positionStrategy: [{ type: i0.Input, args: [{ isSignal: true, alias: "positionStrategy", required: false }] }], updatePositionStrategy: [{ type: i0.Input, args: [{ isSignal: true, alias: "updatePositionStrategy", required: false }] }], placed: [{ type: i0.Output, args: ["placed"] }] } });
|
|
743
|
+
|
|
744
|
+
/**
|
|
745
|
+
* An accessible title for the popover.
|
|
746
|
+
*/
|
|
747
|
+
class RdxPopoverTitle {
|
|
748
|
+
constructor() {
|
|
749
|
+
this.rootContext = injectRdxPopoverRootContext();
|
|
750
|
+
this.id = injectId('rdx-popover-title-');
|
|
751
|
+
this.rootContext.setTitleId(this.id);
|
|
752
|
+
inject(DestroyRef).onDestroy(() => this.rootContext.setTitleId(undefined));
|
|
753
|
+
}
|
|
754
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxPopoverTitle, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
755
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: RdxPopoverTitle, isStandalone: true, selector: "[rdxPopoverTitle]", host: { properties: { "id": "id" } }, ngImport: i0 }); }
|
|
756
|
+
}
|
|
757
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxPopoverTitle, decorators: [{
|
|
758
|
+
type: Directive,
|
|
759
|
+
args: [{
|
|
760
|
+
selector: '[rdxPopoverTitle]',
|
|
761
|
+
host: {
|
|
762
|
+
'[id]': 'id'
|
|
763
|
+
}
|
|
975
764
|
}]
|
|
976
765
|
}], ctorParameters: () => [] });
|
|
977
766
|
|
|
978
|
-
|
|
767
|
+
/**
|
|
768
|
+
* A button that opens the popover.
|
|
769
|
+
*/
|
|
770
|
+
class RdxPopoverTrigger {
|
|
979
771
|
constructor() {
|
|
980
|
-
|
|
981
|
-
this.popoverRoot = injectPopoverRoot();
|
|
982
|
-
/** @ignore */
|
|
772
|
+
this.parentRootContext = injectRdxPopoverRootContext(true);
|
|
983
773
|
this.elementRef = inject(ElementRef);
|
|
984
|
-
/**
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
774
|
+
/**
|
|
775
|
+
* Associates this trigger with a detached popover root.
|
|
776
|
+
*/
|
|
777
|
+
this.handle = input(...(ngDevMode ? [undefined, { debugName: "handle" }] : /* istanbul ignore next */ []));
|
|
778
|
+
/**
|
|
779
|
+
* Data associated with this trigger while it is active.
|
|
780
|
+
*/
|
|
781
|
+
this.payload = input(...(ngDevMode ? [undefined, { debugName: "payload" }] : /* istanbul ignore next */ []));
|
|
782
|
+
/**
|
|
783
|
+
* ID used to identify this trigger when opening a detached popover imperatively.
|
|
784
|
+
*/
|
|
785
|
+
this.id = input(...(ngDevMode ? [undefined, { debugName: "id" }] : /* istanbul ignore next */ []));
|
|
786
|
+
/**
|
|
787
|
+
* Whether the trigger should ignore user interaction.
|
|
788
|
+
*/
|
|
789
|
+
this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
790
|
+
/**
|
|
791
|
+
* Whether the popover should also open when this trigger is hovered.
|
|
792
|
+
*/
|
|
793
|
+
this.openOnHover = input(false, { ...(ngDevMode ? { debugName: "openOnHover" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
794
|
+
/**
|
|
795
|
+
* How long to wait before opening the popover on hover, in milliseconds.
|
|
796
|
+
*/
|
|
797
|
+
this.delay = input(300, { ...(ngDevMode ? { debugName: "delay" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
798
|
+
/**
|
|
799
|
+
* How long to wait before closing a hover-opened popover, in milliseconds.
|
|
800
|
+
*/
|
|
801
|
+
this.closeDelay = input(0, { ...(ngDevMode ? { debugName: "closeDelay" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
802
|
+
this.triggerId = computed(() => this.id() ?? this.generatedId, ...(ngDevMode ? [{ debugName: "triggerId" }] : /* istanbul ignore next */ []));
|
|
803
|
+
this.rootContext = computed(() => this.handle()?.context() ?? this.parentRootContext, ...(ngDevMode ? [{ debugName: "rootContext" }] : /* istanbul ignore next */ []));
|
|
804
|
+
this.isOpen = computed(() => this.rootContext()?.isOpen() === true && this.rootContext()?.trigger() === this.elementRef.nativeElement, ...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
805
|
+
this.isPressed = computed(() => this.isOpen() && this.rootContext()?.openChangeReason() === 'trigger-press', ...(ngDevMode ? [{ debugName: "isPressed" }] : /* istanbul ignore next */ []));
|
|
806
|
+
this.generatedId = injectId('rdx-popover-trigger-');
|
|
807
|
+
effect((onCleanup) => {
|
|
808
|
+
const handle = this.handle();
|
|
809
|
+
if (handle) {
|
|
810
|
+
onCleanup(untracked(() => handle.registerTrigger(this.triggerId(), this.elementRef.nativeElement, () => this.payload())));
|
|
811
|
+
}
|
|
812
|
+
else if (this.parentRootContext) {
|
|
813
|
+
onCleanup(untracked(() => this.parentRootContext.registerTrigger(this.triggerId(), this.elementRef.nativeElement, () => this.payload())));
|
|
814
|
+
}
|
|
995
815
|
});
|
|
996
816
|
}
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
817
|
+
handleClick(event) {
|
|
818
|
+
if (this.disabled()) {
|
|
819
|
+
return;
|
|
820
|
+
}
|
|
821
|
+
this.rootContext()?.setPointerDownOnTrigger(false);
|
|
822
|
+
if (this.handle()) {
|
|
823
|
+
this.handle().toggle(this.triggerId(), event);
|
|
824
|
+
}
|
|
825
|
+
else {
|
|
826
|
+
this.parentRootContext?.toggle(this.triggerId(), this.elementRef.nativeElement, this.payload(), event);
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
handlePointerEnter(event) {
|
|
830
|
+
const rootContext = this.rootContext();
|
|
831
|
+
if (event.pointerType === 'touch' || !rootContext || this.disabled() || !this.openOnHover()) {
|
|
832
|
+
return;
|
|
833
|
+
}
|
|
834
|
+
rootContext.setHoverDelays(this.delay(), this.closeDelay());
|
|
835
|
+
rootContext.openOnHover(this.elementRef.nativeElement, this.payload(), this.triggerId(), event);
|
|
836
|
+
}
|
|
837
|
+
handlePointerLeave(event) {
|
|
838
|
+
if (event.pointerType === 'touch' || !this.openOnHover()) {
|
|
839
|
+
return;
|
|
840
|
+
}
|
|
841
|
+
this.rootContext()?.cancelHoverOpen();
|
|
842
|
+
}
|
|
843
|
+
handlePointerDown() {
|
|
844
|
+
this.rootContext()?.setPointerDownOnTrigger(true);
|
|
845
|
+
}
|
|
846
|
+
handlePointerUp() {
|
|
847
|
+
this.rootContext()?.setPointerDownOnTrigger(false);
|
|
848
|
+
}
|
|
849
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxPopoverTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
850
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RdxPopoverTrigger, isStandalone: true, selector: "button[rdxPopoverTrigger]", inputs: { handle: { classPropertyName: "handle", publicName: "handle", isSignal: true, isRequired: false, transformFunction: null }, payload: { classPropertyName: "payload", publicName: "payload", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, openOnHover: { classPropertyName: "openOnHover", publicName: "openOnHover", isSignal: true, isRequired: false, transformFunction: null }, delay: { classPropertyName: "delay", publicName: "delay", isSignal: true, isRequired: false, transformFunction: null }, closeDelay: { classPropertyName: "closeDelay", publicName: "closeDelay", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "type": "button" }, listeners: { "click": "handleClick($event)", "pointerenter": "handlePointerEnter($event)", "pointerleave": "handlePointerLeave($event)", "pointerdown": "handlePointerDown()", "pointerup": "handlePointerUp()", "pointercancel": "handlePointerUp()" }, properties: { "attr.aria-controls": "rootContext()?.contentId", "attr.aria-expanded": "isOpen()", "attr.aria-haspopup": "\"dialog\"", "attr.data-state": "isOpen() ? \"open\" : \"closed\"", "attr.data-popup-open": "isOpen() ? \"\" : undefined", "attr.data-pressed": "isPressed() ? \"\" : undefined", "attr.disabled": "disabled() ? \"\" : undefined", "id": "triggerId()" } }, hostDirectives: [{ directive: i1.RdxPopperAnchor }], ngImport: i0 }); }
|
|
1004
851
|
}
|
|
1005
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
852
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxPopoverTrigger, decorators: [{
|
|
1006
853
|
type: Directive,
|
|
1007
854
|
args: [{
|
|
1008
|
-
selector: '[
|
|
855
|
+
selector: 'button[rdxPopoverTrigger]',
|
|
856
|
+
hostDirectives: [RdxPopperAnchor],
|
|
1009
857
|
host: {
|
|
1010
858
|
type: 'button',
|
|
1011
|
-
'
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
859
|
+
'[attr.aria-controls]': 'rootContext()?.contentId',
|
|
860
|
+
'[attr.aria-expanded]': 'isOpen()',
|
|
861
|
+
'[attr.aria-haspopup]': '"dialog"',
|
|
862
|
+
'[attr.data-state]': 'isOpen() ? "open" : "closed"',
|
|
863
|
+
'[attr.data-popup-open]': 'isOpen() ? "" : undefined',
|
|
864
|
+
'[attr.data-pressed]': 'isPressed() ? "" : undefined',
|
|
865
|
+
'[attr.disabled]': 'disabled() ? "" : undefined',
|
|
866
|
+
'[id]': 'triggerId()',
|
|
867
|
+
'(click)': 'handleClick($event)',
|
|
868
|
+
'(pointerenter)': 'handlePointerEnter($event)',
|
|
869
|
+
'(pointerleave)': 'handlePointerLeave($event)',
|
|
870
|
+
'(pointerdown)': 'handlePointerDown()',
|
|
871
|
+
'(pointerup)': 'handlePointerUp()',
|
|
872
|
+
'(pointercancel)': 'handlePointerUp()'
|
|
873
|
+
}
|
|
1019
874
|
}]
|
|
1020
|
-
}], ctorParameters: () => [] });
|
|
875
|
+
}], ctorParameters: () => [], propDecorators: { handle: [{ type: i0.Input, args: [{ isSignal: true, alias: "handle", required: false }] }], payload: [{ type: i0.Input, args: [{ isSignal: true, alias: "payload", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], openOnHover: [{ type: i0.Input, args: [{ isSignal: true, alias: "openOnHover", required: false }] }], delay: [{ type: i0.Input, args: [{ isSignal: true, alias: "delay", required: false }] }], closeDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeDelay", required: false }] }] } });
|
|
1021
876
|
|
|
1022
|
-
|
|
877
|
+
/**
|
|
878
|
+
* A viewport for animating content changes when a popover moves between triggers.
|
|
879
|
+
*
|
|
880
|
+
* Render one direct child inside the viewport. It is marked with `data-current`;
|
|
881
|
+
* when the active trigger changes, a DOM snapshot is retained as `data-previous`
|
|
882
|
+
* until its CSS animation or transition completes.
|
|
883
|
+
*/
|
|
884
|
+
class RdxPopoverViewport {
|
|
1023
885
|
constructor() {
|
|
1024
|
-
|
|
1025
|
-
this.
|
|
1026
|
-
|
|
1027
|
-
this.
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
afterNextRender({
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
886
|
+
this.rootContext = injectRdxPopoverRootContext();
|
|
887
|
+
this.elementRef = inject(ElementRef);
|
|
888
|
+
this.destroyRef = inject(DestroyRef);
|
|
889
|
+
this.activationDirection = signal(undefined, ...(ngDevMode ? [{ debugName: "activationDirection" }] : /* istanbul ignore next */ []));
|
|
890
|
+
this.transitioning = signal(false, ...(ngDevMode ? [{ debugName: "transitioning" }] : /* istanbul ignore next */ []));
|
|
891
|
+
const unregister = this.rootContext.registerViewport((previousTrigger, nextTrigger) => {
|
|
892
|
+
this.startTransition(previousTrigger, nextTrigger);
|
|
893
|
+
});
|
|
894
|
+
afterNextRender(() => {
|
|
895
|
+
this.markCurrent();
|
|
896
|
+
this.observer = new MutationObserver(() => this.markCurrent());
|
|
897
|
+
this.observer.observe(this.elementRef.nativeElement, { childList: true });
|
|
898
|
+
});
|
|
899
|
+
this.destroyRef.onDestroy(() => {
|
|
900
|
+
unregister();
|
|
901
|
+
this.observer?.disconnect();
|
|
902
|
+
this.cleanupPrevious();
|
|
1039
903
|
});
|
|
1040
904
|
}
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
905
|
+
startTransition(previousTrigger, nextTrigger) {
|
|
906
|
+
const current = this.current();
|
|
907
|
+
if (!current) {
|
|
908
|
+
return;
|
|
909
|
+
}
|
|
910
|
+
this.cleanupPrevious();
|
|
911
|
+
this.activationDirection.set(getActivationDirection(previousTrigger, nextTrigger));
|
|
912
|
+
const previous = current.cloneNode(true);
|
|
913
|
+
const popup = this.elementRef.nativeElement.closest('[rdxPopoverPopup]');
|
|
914
|
+
const popupRect = popup?.getBoundingClientRect();
|
|
915
|
+
previous.removeAttribute('data-current');
|
|
916
|
+
previous.setAttribute('data-previous', '');
|
|
917
|
+
previous.setAttribute('aria-hidden', 'true');
|
|
918
|
+
previous.setAttribute('inert', '');
|
|
919
|
+
removeIds(previous);
|
|
920
|
+
if (popupRect) {
|
|
921
|
+
previous.style.setProperty('--popup-width', `${popupRect.width}px`);
|
|
922
|
+
previous.style.setProperty('--popup-height', `${popupRect.height}px`);
|
|
923
|
+
}
|
|
924
|
+
previous.addEventListener('animationend', () => this.cleanupPrevious(), { once: true });
|
|
925
|
+
previous.addEventListener('transitionend', () => this.cleanupPrevious(), { once: true });
|
|
926
|
+
this.previous = previous;
|
|
927
|
+
this.elementRef.nativeElement.insertBefore(previous, current);
|
|
928
|
+
this.transitioning.set(true);
|
|
929
|
+
queueMicrotask(() => this.scheduleCleanup(previous));
|
|
1046
930
|
}
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
this.popoverRoot.cssAnimationStatus.set(this.popoverRoot.state() === RdxPopoverState.OPEN
|
|
1050
|
-
? RdxPopoverAnimationStatus.OPEN_ENDED
|
|
1051
|
-
: RdxPopoverAnimationStatus.CLOSED_ENDED);
|
|
931
|
+
markCurrent() {
|
|
932
|
+
this.current()?.setAttribute('data-current', '');
|
|
1052
933
|
}
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
return (this.popoverRoot.cssAnimation() &&
|
|
1056
|
-
((this.popoverRoot.cssOpeningAnimation() && this.popoverRoot.state() === RdxPopoverState.OPEN) ||
|
|
1057
|
-
(this.popoverRoot.cssClosingAnimation() && this.popoverRoot.state() === RdxPopoverState.CLOSED)));
|
|
934
|
+
current() {
|
|
935
|
+
return Array.from(this.elementRef.nativeElement.children).find((child) => child instanceof HTMLElement && !child.hasAttribute('data-previous'));
|
|
1058
936
|
}
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
937
|
+
scheduleCleanup(previous) {
|
|
938
|
+
if (this.previous !== previous) {
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
941
|
+
const style = getComputedStyle(previous);
|
|
942
|
+
const duration = Math.max(getMaxDuration(style.animationDuration, style.animationDelay), getMaxDuration(style.transitionDuration, style.transitionDelay));
|
|
943
|
+
this.cleanupTimer = setTimeout(() => this.cleanupPrevious(), duration > 0 ? duration + 50 : 0);
|
|
944
|
+
}
|
|
945
|
+
cleanupPrevious() {
|
|
946
|
+
if (this.cleanupTimer !== undefined) {
|
|
947
|
+
clearTimeout(this.cleanupTimer);
|
|
948
|
+
this.cleanupTimer = undefined;
|
|
949
|
+
}
|
|
950
|
+
this.previous?.remove();
|
|
951
|
+
this.previous = undefined;
|
|
952
|
+
this.transitioning.set(false);
|
|
953
|
+
}
|
|
954
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxPopoverViewport, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
955
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: RdxPopoverViewport, isStandalone: true, selector: "[rdxPopoverViewport]", host: { properties: { "attr.data-activation-direction": "activationDirection()", "attr.data-transitioning": "transitioning() ? \"\" : undefined" } }, ngImport: i0 }); }
|
|
1068
956
|
}
|
|
1069
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1070
|
-
type:
|
|
957
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxPopoverViewport, decorators: [{
|
|
958
|
+
type: Directive,
|
|
1071
959
|
args: [{
|
|
1072
|
-
selector: '[
|
|
1073
|
-
template: `
|
|
1074
|
-
<ng-content />
|
|
1075
|
-
`,
|
|
960
|
+
selector: '[rdxPopoverViewport]',
|
|
1076
961
|
host: {
|
|
1077
|
-
'[attr.
|
|
1078
|
-
'[attr.
|
|
1079
|
-
|
|
1080
|
-
'[attr.data-side]': 'popoverRoot.popoverContentDirective().side()',
|
|
1081
|
-
'[attr.data-align]': 'popoverRoot.popoverContentDirective().align()',
|
|
1082
|
-
'[style]': 'disableAnimation() ? {animation: "none !important"} : null',
|
|
1083
|
-
'(animationstart)': 'onAnimationStart($event)',
|
|
1084
|
-
'(animationend)': 'onAnimationEnd($event)'
|
|
1085
|
-
},
|
|
1086
|
-
hostDirectives: [CdkTrapFocus],
|
|
1087
|
-
providers: [
|
|
1088
|
-
{
|
|
1089
|
-
provide: RdxPopoverContentAttributesToken,
|
|
1090
|
-
useExisting: forwardRef(() => RdxPopoverContentAttributesComponent)
|
|
1091
|
-
}
|
|
1092
|
-
],
|
|
1093
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
|
962
|
+
'[attr.data-activation-direction]': 'activationDirection()',
|
|
963
|
+
'[attr.data-transitioning]': 'transitioning() ? "" : undefined'
|
|
964
|
+
}
|
|
1094
965
|
}]
|
|
1095
|
-
}], ctorParameters: () => []
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
966
|
+
}], ctorParameters: () => [] });
|
|
967
|
+
function getActivationDirection(previous, next) {
|
|
968
|
+
const previousRect = previous.getBoundingClientRect();
|
|
969
|
+
const nextRect = next.getBoundingClientRect();
|
|
970
|
+
const previousCenter = getCenter(previousRect);
|
|
971
|
+
const nextCenter = getCenter(nextRect);
|
|
972
|
+
const directions = [];
|
|
973
|
+
if (nextCenter.x < previousCenter.x) {
|
|
974
|
+
directions.push('left');
|
|
975
|
+
}
|
|
976
|
+
else if (nextCenter.x > previousCenter.x) {
|
|
977
|
+
directions.push('right');
|
|
978
|
+
}
|
|
979
|
+
if (nextCenter.y < previousCenter.y) {
|
|
980
|
+
directions.push('up');
|
|
981
|
+
}
|
|
982
|
+
else if (nextCenter.y > previousCenter.y) {
|
|
983
|
+
directions.push('down');
|
|
984
|
+
}
|
|
985
|
+
return directions.join(' ') || undefined;
|
|
986
|
+
}
|
|
987
|
+
function removeIds(element) {
|
|
988
|
+
element.removeAttribute('id');
|
|
989
|
+
element.querySelectorAll('[id]').forEach((child) => child.removeAttribute('id'));
|
|
990
|
+
}
|
|
991
|
+
function getCenter(rect) {
|
|
992
|
+
return { x: rect.left + rect.width / 2, y: rect.top + rect.height / 2 };
|
|
993
|
+
}
|
|
994
|
+
function getMaxDuration(durations, delays) {
|
|
995
|
+
const durationValues = durations.split(',').map(parseDuration);
|
|
996
|
+
const delayValues = delays.split(',').map(parseDuration);
|
|
997
|
+
return durationValues.reduce((max, duration, index) => {
|
|
998
|
+
const delay = delayValues[index % delayValues.length] ?? 0;
|
|
999
|
+
return Math.max(max, duration + delay);
|
|
1000
|
+
}, 0);
|
|
1001
|
+
}
|
|
1002
|
+
function parseDuration(value) {
|
|
1003
|
+
const duration = Number.parseFloat(value);
|
|
1004
|
+
if (Number.isNaN(duration)) {
|
|
1005
|
+
return 0;
|
|
1006
|
+
}
|
|
1007
|
+
return value.trim().endsWith('ms') ? duration : duration * 1000;
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
class RdxPopoverHandle {
|
|
1011
|
+
constructor() {
|
|
1012
|
+
this.rootContext = signal(undefined, ...(ngDevMode ? [{ debugName: "rootContext" }] : /* istanbul ignore next */ []));
|
|
1013
|
+
this.triggers = new Map();
|
|
1014
|
+
this.rootTriggerCleanups = new Map();
|
|
1015
|
+
this.isOpen = computed(() => this.rootContext()?.isOpen() ?? false, ...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
1016
|
+
}
|
|
1017
|
+
open(triggerId) {
|
|
1018
|
+
const trigger = this.triggers.get(triggerId);
|
|
1019
|
+
if (!trigger) {
|
|
1020
|
+
throw new Error(`No popover trigger registered with id "${triggerId}".`);
|
|
1021
|
+
}
|
|
1022
|
+
this.rootContext()?.open(trigger.element, trigger.payload(), triggerId, 'imperative-action', new Event('popover.open'));
|
|
1023
|
+
}
|
|
1024
|
+
close() {
|
|
1025
|
+
this.rootContext()?.close('imperative-action', new Event('popover.close'));
|
|
1026
|
+
}
|
|
1027
|
+
toggle(triggerId, event = new Event('popover.toggle')) {
|
|
1028
|
+
const trigger = this.triggers.get(triggerId);
|
|
1029
|
+
if (!trigger) {
|
|
1030
|
+
throw new Error(`No popover trigger registered with id "${triggerId}".`);
|
|
1031
|
+
}
|
|
1032
|
+
this.rootContext()?.toggle(triggerId, trigger.element, trigger.payload(), event);
|
|
1033
|
+
}
|
|
1034
|
+
registerRoot(rootContext) {
|
|
1035
|
+
this.rootContext.set(rootContext);
|
|
1036
|
+
this.triggers.forEach((trigger, id) => {
|
|
1037
|
+
this.rootTriggerCleanups.set(id, rootContext.registerTrigger(id, trigger.element, trigger.payload));
|
|
1038
|
+
});
|
|
1039
|
+
return () => {
|
|
1040
|
+
if (this.rootContext() === rootContext) {
|
|
1041
|
+
this.rootTriggerCleanups.forEach((cleanup) => cleanup());
|
|
1042
|
+
this.rootTriggerCleanups.clear();
|
|
1043
|
+
this.rootContext.set(undefined);
|
|
1044
|
+
}
|
|
1045
|
+
};
|
|
1046
|
+
}
|
|
1047
|
+
registerTrigger(id, trigger, payload) {
|
|
1048
|
+
this.rootTriggerCleanups.get(id)?.();
|
|
1049
|
+
this.triggers.set(id, { element: trigger, payload });
|
|
1050
|
+
const unregisterFromRoot = this.rootContext()?.registerTrigger(id, trigger, payload);
|
|
1051
|
+
if (unregisterFromRoot) {
|
|
1052
|
+
this.rootTriggerCleanups.set(id, unregisterFromRoot);
|
|
1053
|
+
}
|
|
1054
|
+
return () => {
|
|
1055
|
+
this.rootTriggerCleanups.get(id)?.();
|
|
1056
|
+
this.rootTriggerCleanups.delete(id);
|
|
1057
|
+
if (this.triggers.get(id)?.element === trigger) {
|
|
1058
|
+
this.triggers.delete(id);
|
|
1059
|
+
}
|
|
1060
|
+
};
|
|
1061
|
+
}
|
|
1062
|
+
context() {
|
|
1063
|
+
return this.rootContext();
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
function createRdxPopoverHandle() {
|
|
1067
|
+
return new RdxPopoverHandle();
|
|
1068
|
+
}
|
|
1099
1069
|
|
|
1100
|
-
const
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1070
|
+
const popoverImports = [
|
|
1071
|
+
RdxPopoverRoot,
|
|
1072
|
+
RdxPopoverTrigger,
|
|
1073
|
+
RdxPopoverPortalPresence,
|
|
1074
|
+
RdxPopoverPortal,
|
|
1075
|
+
RdxPopoverBackdrop,
|
|
1076
|
+
RdxPopoverPositioner,
|
|
1077
|
+
RdxPopoverPopup,
|
|
1078
|
+
RdxPopoverArrow,
|
|
1079
|
+
RdxPopoverTitle,
|
|
1080
|
+
RdxPopoverDescription,
|
|
1081
|
+
RdxPopoverClose,
|
|
1082
|
+
RdxPopoverViewport
|
|
1108
1083
|
];
|
|
1109
1084
|
class RdxPopoverModule {
|
|
1110
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1111
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1085
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxPopoverModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1086
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: RdxPopoverModule, imports: [RdxPopoverRoot,
|
|
1087
|
+
RdxPopoverTrigger,
|
|
1088
|
+
RdxPopoverPortalPresence,
|
|
1089
|
+
RdxPopoverPortal,
|
|
1090
|
+
RdxPopoverBackdrop,
|
|
1091
|
+
RdxPopoverPositioner,
|
|
1092
|
+
RdxPopoverPopup,
|
|
1093
|
+
RdxPopoverArrow,
|
|
1094
|
+
RdxPopoverTitle,
|
|
1095
|
+
RdxPopoverDescription,
|
|
1096
|
+
RdxPopoverClose,
|
|
1097
|
+
RdxPopoverViewport], exports: [RdxPopoverRoot,
|
|
1098
|
+
RdxPopoverTrigger,
|
|
1099
|
+
RdxPopoverPortalPresence,
|
|
1100
|
+
RdxPopoverPortal,
|
|
1101
|
+
RdxPopoverBackdrop,
|
|
1102
|
+
RdxPopoverPositioner,
|
|
1103
|
+
RdxPopoverPopup,
|
|
1104
|
+
RdxPopoverArrow,
|
|
1105
|
+
RdxPopoverTitle,
|
|
1106
|
+
RdxPopoverDescription,
|
|
1107
|
+
RdxPopoverClose,
|
|
1108
|
+
RdxPopoverViewport] }); }
|
|
1109
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxPopoverModule }); }
|
|
1125
1110
|
}
|
|
1126
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1111
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RdxPopoverModule, decorators: [{
|
|
1127
1112
|
type: NgModule,
|
|
1128
1113
|
args: [{
|
|
1129
|
-
imports: [...
|
|
1130
|
-
exports: [...
|
|
1114
|
+
imports: [...popoverImports],
|
|
1115
|
+
exports: [...popoverImports]
|
|
1131
1116
|
}]
|
|
1132
1117
|
}] });
|
|
1133
1118
|
|
|
@@ -1135,5 +1120,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.3", ngImpor
|
|
|
1135
1120
|
* Generated bundle index. Do not edit.
|
|
1136
1121
|
*/
|
|
1137
1122
|
|
|
1138
|
-
export {
|
|
1123
|
+
export { RdxPopoverArrow, RdxPopoverBackdrop, RdxPopoverClose, RdxPopoverDescription, RdxPopoverHandle, RdxPopoverModule, RdxPopoverPopup, RdxPopoverPortal, RdxPopoverPortalPresence, RdxPopoverPositioner, RdxPopoverRoot, RdxPopoverTitle, RdxPopoverTrigger, RdxPopoverViewport, createRdxPopoverHandle, injectRdxPopoverRootContext, popoverImports, provideRdxPopoverRootContext };
|
|
1139
1124
|
//# sourceMappingURL=radix-ng-primitives-popover.mjs.map
|