ng-primitives 0.120.4 → 0.121.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/example-theme/index.css +9 -0
- package/fesm2022/ng-primitives-a11y.mjs +5 -5
- package/fesm2022/ng-primitives-a11y.mjs.map +1 -1
- package/fesm2022/ng-primitives-accordion.mjs +34 -51
- package/fesm2022/ng-primitives-accordion.mjs.map +1 -1
- package/fesm2022/ng-primitives-ai.mjs +39 -52
- package/fesm2022/ng-primitives-ai.mjs.map +1 -1
- package/fesm2022/ng-primitives-autofill.mjs +4 -4
- package/fesm2022/ng-primitives-autofill.mjs.map +1 -1
- package/fesm2022/ng-primitives-avatar.mjs +14 -17
- package/fesm2022/ng-primitives-avatar.mjs.map +1 -1
- package/fesm2022/ng-primitives-breadcrumbs.mjs +21 -21
- package/fesm2022/ng-primitives-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ng-primitives-button.mjs +7 -9
- package/fesm2022/ng-primitives-button.mjs.map +1 -1
- package/fesm2022/ng-primitives-checkbox.mjs +15 -30
- package/fesm2022/ng-primitives-checkbox.mjs.map +1 -1
- package/fesm2022/ng-primitives-combobox.mjs +60 -92
- package/fesm2022/ng-primitives-combobox.mjs.map +1 -1
- package/fesm2022/ng-primitives-common.mjs +4 -4
- package/fesm2022/ng-primitives-common.mjs.map +1 -1
- package/fesm2022/ng-primitives-context-menu.mjs +68 -121
- package/fesm2022/ng-primitives-context-menu.mjs.map +1 -1
- package/fesm2022/ng-primitives-date-picker.mjs +91 -115
- package/fesm2022/ng-primitives-date-picker.mjs.map +1 -1
- package/fesm2022/ng-primitives-dialog.mjs +35 -51
- package/fesm2022/ng-primitives-dialog.mjs.map +1 -1
- package/fesm2022/ng-primitives-file-upload.mjs +26 -53
- package/fesm2022/ng-primitives-file-upload.mjs.map +1 -1
- package/fesm2022/ng-primitives-focus-trap.mjs +5 -8
- package/fesm2022/ng-primitives-focus-trap.mjs.map +1 -1
- package/fesm2022/ng-primitives-form-field.mjs +39 -44
- package/fesm2022/ng-primitives-form-field.mjs.map +1 -1
- package/fesm2022/ng-primitives-input-otp.mjs +30 -43
- package/fesm2022/ng-primitives-input-otp.mjs.map +1 -1
- package/fesm2022/ng-primitives-input.mjs +6 -8
- package/fesm2022/ng-primitives-input.mjs.map +1 -1
- package/fesm2022/ng-primitives-interactions.mjs +31 -48
- package/fesm2022/ng-primitives-interactions.mjs.map +1 -1
- package/fesm2022/ng-primitives-internal.mjs +39 -35
- package/fesm2022/ng-primitives-internal.mjs.map +1 -1
- package/fesm2022/ng-primitives-listbox.mjs +34 -48
- package/fesm2022/ng-primitives-listbox.mjs.map +1 -1
- package/fesm2022/ng-primitives-menu.mjs +85 -151
- package/fesm2022/ng-primitives-menu.mjs.map +1 -1
- package/fesm2022/ng-primitives-meter.mjs +25 -36
- package/fesm2022/ng-primitives-meter.mjs.map +1 -1
- package/fesm2022/ng-primitives-navigation-menu.mjs +60 -108
- package/fesm2022/ng-primitives-navigation-menu.mjs.map +1 -1
- package/fesm2022/ng-primitives-number-field.mjs +35 -59
- package/fesm2022/ng-primitives-number-field.mjs.map +1 -1
- package/fesm2022/ng-primitives-pagination.mjs +270 -297
- package/fesm2022/ng-primitives-pagination.mjs.map +1 -1
- package/fesm2022/ng-primitives-popover.mjs +209 -223
- package/fesm2022/ng-primitives-popover.mjs.map +1 -1
- package/fesm2022/ng-primitives-portal.mjs +88 -59
- package/fesm2022/ng-primitives-portal.mjs.map +1 -1
- package/fesm2022/ng-primitives-progress.mjs +30 -41
- package/fesm2022/ng-primitives-progress.mjs.map +1 -1
- package/fesm2022/ng-primitives-radio.mjs +20 -30
- package/fesm2022/ng-primitives-radio.mjs.map +1 -1
- package/fesm2022/ng-primitives-resize.mjs +3 -3
- package/fesm2022/ng-primitives-resize.mjs.map +1 -1
- package/fesm2022/ng-primitives-roving-focus.mjs +20 -34
- package/fesm2022/ng-primitives-roving-focus.mjs.map +1 -1
- package/fesm2022/ng-primitives-search.mjs +9 -9
- package/fesm2022/ng-primitives-search.mjs.map +1 -1
- package/fesm2022/ng-primitives-select.mjs +720 -620
- package/fesm2022/ng-primitives-select.mjs.map +1 -1
- package/fesm2022/ng-primitives-separator.mjs +4 -6
- package/fesm2022/ng-primitives-separator.mjs.map +1 -1
- package/fesm2022/ng-primitives-slider.mjs +63 -100
- package/fesm2022/ng-primitives-slider.mjs.map +1 -1
- package/fesm2022/ng-primitives-state.mjs +3 -3
- package/fesm2022/ng-primitives-state.mjs.map +1 -1
- package/fesm2022/ng-primitives-switch.mjs +15 -21
- package/fesm2022/ng-primitives-switch.mjs.map +1 -1
- package/fesm2022/ng-primitives-tabs.mjs +31 -41
- package/fesm2022/ng-primitives-tabs.mjs.map +1 -1
- package/fesm2022/ng-primitives-textarea.mjs +5 -7
- package/fesm2022/ng-primitives-textarea.mjs.map +1 -1
- package/fesm2022/ng-primitives-toast.mjs +30 -23
- package/fesm2022/ng-primitives-toast.mjs.map +1 -1
- package/fesm2022/ng-primitives-toggle-group.mjs +20 -36
- package/fesm2022/ng-primitives-toggle-group.mjs.map +1 -1
- package/fesm2022/ng-primitives-toggle.mjs +10 -19
- package/fesm2022/ng-primitives-toggle.mjs.map +1 -1
- package/fesm2022/ng-primitives-toolbar.mjs +4 -6
- package/fesm2022/ng-primitives-toolbar.mjs.map +1 -1
- package/fesm2022/ng-primitives-tooltip.mjs +401 -402
- package/fesm2022/ng-primitives-tooltip.mjs.map +1 -1
- package/fesm2022/ng-primitives-utils.mjs +5 -4
- package/fesm2022/ng-primitives-utils.mjs.map +1 -1
- package/package.json +56 -55
- package/schematics/ng-generate/templates/select/select.__fileSuffix@dasherize__.ts.template +48 -48
- package/{a11y/index.d.ts → types/ng-primitives-a11y.d.ts} +18 -24
- package/{accordion/index.d.ts → types/ng-primitives-accordion.d.ts} +85 -98
- package/{autofill/index.d.ts → types/ng-primitives-autofill.d.ts} +3 -10
- package/{avatar/index.d.ts → types/ng-primitives-avatar.d.ts} +7 -30
- package/{breadcrumbs/index.d.ts → types/ng-primitives-breadcrumbs.d.ts} +15 -70
- package/{button/index.d.ts → types/ng-primitives-button.d.ts} +23 -29
- package/{checkbox/index.d.ts → types/ng-primitives-checkbox.d.ts} +68 -74
- package/{combobox/index.d.ts → types/ng-primitives-combobox.d.ts} +35 -35
- package/{context-menu/index.d.ts → types/ng-primitives-context-menu.d.ts} +2 -1
- package/{date-picker/index.d.ts → types/ng-primitives-date-picker.d.ts} +2 -2
- package/{dialog/index.d.ts → types/ng-primitives-dialog.d.ts} +7 -2
- package/{file-upload/index.d.ts → types/ng-primitives-file-upload.d.ts} +5 -20
- package/{focus-trap/index.d.ts → types/ng-primitives-focus-trap.d.ts} +3 -10
- package/{form-field/index.d.ts → types/ng-primitives-form-field.d.ts} +9 -40
- package/{input/index.d.ts → types/ng-primitives-input.d.ts} +3 -10
- package/{menu/index.d.ts → types/ng-primitives-menu.d.ts} +17 -63
- package/{navigation-menu/index.d.ts → types/ng-primitives-navigation-menu.d.ts} +15 -70
- package/{number-field/index.d.ts → types/ng-primitives-number-field.d.ts} +80 -110
- package/types/ng-primitives-pagination.d.ts +502 -0
- package/{popover/index.d.ts → types/ng-primitives-popover.d.ts} +244 -57
- package/{portal/index.d.ts → types/ng-primitives-portal.d.ts} +22 -13
- package/{progress/index.d.ts → types/ng-primitives-progress.d.ts} +3 -10
- package/{roving-focus/index.d.ts → types/ng-primitives-roving-focus.d.ts} +65 -79
- package/types/ng-primitives-select.d.ts +687 -0
- package/{separator/index.d.ts → types/ng-primitives-separator.d.ts} +3 -10
- package/{slider/index.d.ts → types/ng-primitives-slider.d.ts} +76 -138
- package/{state/index.d.ts → types/ng-primitives-state.d.ts} +26 -21
- package/{switch/index.d.ts → types/ng-primitives-switch.d.ts} +50 -64
- package/{tabs/index.d.ts → types/ng-primitives-tabs.d.ts} +9 -40
- package/{textarea/index.d.ts → types/ng-primitives-textarea.d.ts} +3 -10
- package/{toast/index.d.ts → types/ng-primitives-toast.d.ts} +13 -1
- package/{toggle-group/index.d.ts → types/ng-primitives-toggle-group.d.ts} +75 -89
- package/{toggle/index.d.ts → types/ng-primitives-toggle.d.ts} +50 -56
- package/{toolbar/index.d.ts → types/ng-primitives-toolbar.d.ts} +3 -10
- package/types/ng-primitives-tooltip.d.ts +691 -0
- package/pagination/index.d.ts +0 -211
- package/select/index.d.ts +0 -396
- package/tooltip/index.d.ts +0 -384
- /package/{ai/index.d.ts → types/ng-primitives-ai.d.ts} +0 -0
- /package/{common/index.d.ts → types/ng-primitives-common.d.ts} +0 -0
- /package/{date-time-luxon/index.d.ts → types/ng-primitives-date-time-luxon.d.ts} +0 -0
- /package/{date-time/index.d.ts → types/ng-primitives-date-time.d.ts} +0 -0
- /package/{input-otp/index.d.ts → types/ng-primitives-input-otp.d.ts} +0 -0
- /package/{interactions/index.d.ts → types/ng-primitives-interactions.d.ts} +0 -0
- /package/{internal/index.d.ts → types/ng-primitives-internal.d.ts} +0 -0
- /package/{listbox/index.d.ts → types/ng-primitives-listbox.d.ts} +0 -0
- /package/{meter/index.d.ts → types/ng-primitives-meter.d.ts} +0 -0
- /package/{radio/index.d.ts → types/ng-primitives-radio.d.ts} +0 -0
- /package/{resize/index.d.ts → types/ng-primitives-resize.d.ts} +0 -0
- /package/{search/index.d.ts → types/ng-primitives-search.d.ts} +0 -0
- /package/{utils/index.d.ts → types/ng-primitives-utils.d.ts} +0 -0
- /package/{index.d.ts → types/ng-primitives.d.ts} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ngpOverlayArrow, coerceOffset, coerceFlip, coerceShift, dismissGuardAttribute,
|
|
1
|
+
import { ngpOverlayArrow, createOverlay, coerceOffset, coerceFlip, coerceShift, dismissGuardAttribute, injectOverlay, provideControlContainerIsolation } from 'ng-primitives/portal';
|
|
2
2
|
export { injectOverlayContext as injectPopoverContext } from 'ng-primitives/portal';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { InjectionToken, inject, input, numberAttribute, Directive,
|
|
5
|
-
import { createPrimitive,
|
|
4
|
+
import { InjectionToken, inject, input, numberAttribute, Directive, ViewContainerRef, Injector, signal, computed, booleanAttribute, output } from '@angular/core';
|
|
5
|
+
import { createPrimitive, controlled, attrBinding, dataBinding, listener, styleBinding } from 'ng-primitives/state';
|
|
6
6
|
import { injectElementRef, explicitEffect } from 'ng-primitives/internal';
|
|
7
7
|
import * as i1 from 'ng-primitives/focus-trap';
|
|
8
8
|
import { NgpFocusTrap } from 'ng-primitives/focus-trap';
|
|
@@ -53,11 +53,8 @@ class NgpPopoverArrow {
|
|
|
53
53
|
* Padding between the arrow and the edges of the popover.
|
|
54
54
|
* This prevents the arrow from overflowing the rounded corners.
|
|
55
55
|
*/
|
|
56
|
-
this.padding = input(undefined, ...(ngDevMode ?
|
|
57
|
-
|
|
58
|
-
alias: 'ngpPopoverArrowPadding',
|
|
59
|
-
transform: numberAttribute,
|
|
60
|
-
}]));
|
|
56
|
+
this.padding = input(undefined, { ...(ngDevMode ? { debugName: "padding" } : /* istanbul ignore next */ {}), alias: 'ngpPopoverArrowPadding',
|
|
57
|
+
transform: numberAttribute });
|
|
61
58
|
this.state = ngpPopoverArrow({ padding: this.padding });
|
|
62
59
|
}
|
|
63
60
|
/**
|
|
@@ -67,10 +64,10 @@ class NgpPopoverArrow {
|
|
|
67
64
|
setPadding(value) {
|
|
68
65
|
this.state.setPadding(value);
|
|
69
66
|
}
|
|
70
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
71
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
67
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgpPopoverArrow, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
68
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.14", type: NgpPopoverArrow, isStandalone: true, selector: "[ngpPopoverArrow]", inputs: { padding: { classPropertyName: "padding", publicName: "ngpPopoverArrowPadding", isSignal: true, isRequired: false, transformFunction: null } }, providers: [providePopoverArrowState()], exportAs: ["ngpPopoverArrow"], ngImport: i0 }); }
|
|
72
69
|
}
|
|
73
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
70
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgpPopoverArrow, decorators: [{
|
|
74
71
|
type: Directive,
|
|
75
72
|
args: [{
|
|
76
73
|
selector: '[ngpPopoverArrow]',
|
|
@@ -79,40 +76,127 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImpor
|
|
|
79
76
|
}]
|
|
80
77
|
}], propDecorators: { padding: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpPopoverArrowPadding", required: false }] }] } });
|
|
81
78
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
*/
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
79
|
+
const [NgpPopoverTriggerStateToken, ngpPopoverTrigger, _injectPopoverTriggerState, providePopoverTriggerState,] = createPrimitive('NgpPopoverTrigger', ({ popover: _popover = signal(undefined), disabled = signal(false), placement = signal('bottom'), offset = signal(4), showDelay = signal(0), hideDelay = signal(0), flip = signal(true), shift = signal(undefined), container = signal('body'), closeOnOutsideClick = signal(true), closeOnEscape = signal(true), scrollBehavior = signal('reposition'), context = signal(undefined), anchor = signal(null), trackPosition = signal(false), cooldown = signal(0), onOpenChange, }) => {
|
|
80
|
+
const elementRef = injectElementRef();
|
|
81
|
+
const viewContainerRef = inject(ViewContainerRef);
|
|
82
|
+
const injector = inject(Injector);
|
|
83
|
+
const popover = controlled(_popover);
|
|
84
|
+
const overlay = signal(null, ...(ngDevMode ? [{ debugName: "overlay" }] : /* istanbul ignore next */ []));
|
|
85
|
+
const open = computed(() => overlay()?.isOpen() ?? false, ...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
|
|
86
|
+
// Host binding
|
|
87
|
+
attrBinding(elementRef, 'aria-expanded', () => (open() ? 'true' : 'false'));
|
|
88
|
+
attrBinding(elementRef, 'aria-describedby', () => overlay()?.ariaDescribedBy());
|
|
89
|
+
dataBinding(elementRef, 'data-open', open);
|
|
90
|
+
dataBinding(elementRef, 'data-placement', placement);
|
|
91
|
+
dataBinding(elementRef, 'data-disabled', disabled);
|
|
92
|
+
// Event listener
|
|
93
|
+
listener(elementRef, 'click', toggle);
|
|
94
|
+
function destroy() {
|
|
95
|
+
overlay()?.destroy();
|
|
96
|
+
}
|
|
97
|
+
function createOverlayInstance() {
|
|
98
|
+
const popoverInstance = popover();
|
|
99
|
+
if (!popoverInstance) {
|
|
100
|
+
throw new Error('Popover must be either a TemplateRef or a ComponentType');
|
|
101
|
+
}
|
|
102
|
+
// Create config for the overlay
|
|
103
|
+
const config = {
|
|
104
|
+
content: popoverInstance,
|
|
105
|
+
triggerElement: elementRef.nativeElement,
|
|
106
|
+
anchorElement: anchor(),
|
|
107
|
+
injector: injector,
|
|
108
|
+
context: context,
|
|
109
|
+
container: container(),
|
|
110
|
+
placement: placement,
|
|
111
|
+
offset: offset(),
|
|
112
|
+
flip: flip(),
|
|
113
|
+
shift: shift(),
|
|
114
|
+
showDelay: showDelay(),
|
|
115
|
+
hideDelay: hideDelay(),
|
|
116
|
+
closeOnOutsideClick: closeOnOutsideClick(),
|
|
117
|
+
closeOnEscape: closeOnEscape(),
|
|
118
|
+
restoreFocus: true,
|
|
119
|
+
scrollBehaviour: scrollBehavior(),
|
|
120
|
+
viewContainerRef: viewContainerRef,
|
|
121
|
+
trackPosition: trackPosition(),
|
|
122
|
+
overlayType: 'popover',
|
|
123
|
+
cooldown: cooldown(),
|
|
124
|
+
onClose: () => onOpenChange?.(false),
|
|
125
|
+
};
|
|
126
|
+
overlay.set(createOverlay(config));
|
|
127
|
+
}
|
|
128
|
+
function toggle(event) {
|
|
129
|
+
// if the trigger is disabled then do not toggle the popover
|
|
130
|
+
if (disabled()) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
// determine the origin of the event, 0 is keyboard, 1 is mouse
|
|
134
|
+
const origin = event.detail === 0 ? 'keyboard' : 'mouse';
|
|
135
|
+
// if the popover is open then hide it
|
|
136
|
+
if (open()) {
|
|
137
|
+
hide(origin);
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
show();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
async function show() {
|
|
144
|
+
// If the trigger is disabled, don't show the popover
|
|
145
|
+
if (disabled()) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
// Create the overlay if it doesn't exist yet
|
|
149
|
+
if (!overlay()) {
|
|
150
|
+
createOverlayInstance();
|
|
151
|
+
}
|
|
152
|
+
// Show the overlay
|
|
153
|
+
await overlay()?.show();
|
|
154
|
+
if (open()) {
|
|
155
|
+
onOpenChange?.(true);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
async function hide(origin) {
|
|
159
|
+
// If the trigger is disabled or the popover is not open, do nothing
|
|
160
|
+
if (disabled() || !open()) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
// Hide the overlay
|
|
164
|
+
await overlay()?.hide({ origin });
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
elementRef,
|
|
168
|
+
popover,
|
|
169
|
+
disabled,
|
|
170
|
+
placement,
|
|
171
|
+
offset,
|
|
172
|
+
showDelay,
|
|
173
|
+
hideDelay,
|
|
174
|
+
flip,
|
|
175
|
+
shift,
|
|
176
|
+
container,
|
|
177
|
+
closeOnOutsideClick,
|
|
178
|
+
closeOnEscape,
|
|
179
|
+
scrollBehavior,
|
|
180
|
+
context,
|
|
181
|
+
anchor,
|
|
182
|
+
trackPosition,
|
|
183
|
+
cooldown,
|
|
184
|
+
overlay,
|
|
185
|
+
open,
|
|
186
|
+
destroy,
|
|
187
|
+
show,
|
|
188
|
+
hide,
|
|
189
|
+
};
|
|
190
|
+
});
|
|
191
|
+
function injectPopoverTriggerState(options) {
|
|
192
|
+
return _injectPopoverTriggerState(options);
|
|
193
|
+
}
|
|
98
194
|
|
|
99
195
|
/**
|
|
100
196
|
* Apply the `ngpPopoverTrigger` directive to an element that triggers the popover to show.
|
|
101
197
|
*/
|
|
102
198
|
class NgpPopoverTrigger {
|
|
103
199
|
constructor() {
|
|
104
|
-
/**
|
|
105
|
-
* Access the trigger element
|
|
106
|
-
*/
|
|
107
|
-
this.trigger = injectElementRef();
|
|
108
|
-
/**
|
|
109
|
-
* Access the injector.
|
|
110
|
-
*/
|
|
111
|
-
this.injector = inject(Injector);
|
|
112
|
-
/**
|
|
113
|
-
* Access the view container reference.
|
|
114
|
-
*/
|
|
115
|
-
this.viewContainerRef = inject(ViewContainerRef);
|
|
116
200
|
/**
|
|
117
201
|
* Access the global popover configuration.
|
|
118
202
|
*/
|
|
@@ -120,149 +204,97 @@ class NgpPopoverTrigger {
|
|
|
120
204
|
/**
|
|
121
205
|
* Access the popover template ref.
|
|
122
206
|
*/
|
|
123
|
-
this.popover = input(undefined, ...(ngDevMode ?
|
|
124
|
-
alias: 'ngpPopoverTrigger',
|
|
125
|
-
}]));
|
|
207
|
+
this.popover = input(undefined, { ...(ngDevMode ? { debugName: "popover" } : /* istanbul ignore next */ {}), alias: 'ngpPopoverTrigger' });
|
|
126
208
|
/**
|
|
127
209
|
* Define if the trigger should be disabled.
|
|
128
210
|
* @default false
|
|
129
211
|
*/
|
|
130
|
-
this.disabled = input(false, ...(ngDevMode ?
|
|
131
|
-
|
|
132
|
-
alias: 'ngpPopoverTriggerDisabled',
|
|
133
|
-
transform: booleanAttribute,
|
|
134
|
-
}]));
|
|
212
|
+
this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), alias: 'ngpPopoverTriggerDisabled',
|
|
213
|
+
transform: booleanAttribute });
|
|
135
214
|
/**
|
|
136
215
|
* Define the placement of the popover relative to the trigger.
|
|
137
216
|
* @default 'top'
|
|
138
217
|
*/
|
|
139
|
-
this.placement = input(this.config.placement, ...(ngDevMode ?
|
|
140
|
-
alias: 'ngpPopoverTriggerPlacement',
|
|
141
|
-
}]));
|
|
218
|
+
this.placement = input(this.config.placement, { ...(ngDevMode ? { debugName: "placement" } : /* istanbul ignore next */ {}), alias: 'ngpPopoverTriggerPlacement' });
|
|
142
219
|
/**
|
|
143
220
|
* Define the offset of the popover relative to the trigger.
|
|
144
221
|
* Can be a number (applies to mainAxis) or an object with mainAxis, crossAxis, and alignmentAxis.
|
|
145
222
|
* @default 0
|
|
146
223
|
*/
|
|
147
|
-
this.offset = input(this.config.offset, ...(ngDevMode ?
|
|
148
|
-
|
|
149
|
-
alias: 'ngpPopoverTriggerOffset',
|
|
150
|
-
transform: coerceOffset,
|
|
151
|
-
}]));
|
|
224
|
+
this.offset = input(this.config.offset, { ...(ngDevMode ? { debugName: "offset" } : /* istanbul ignore next */ {}), alias: 'ngpPopoverTriggerOffset',
|
|
225
|
+
transform: coerceOffset });
|
|
152
226
|
/**
|
|
153
227
|
* Define the delay before the popover is displayed.
|
|
154
228
|
* @default 0
|
|
155
229
|
*/
|
|
156
|
-
this.showDelay = input(this.config.showDelay, ...(ngDevMode ?
|
|
157
|
-
|
|
158
|
-
alias: 'ngpPopoverTriggerShowDelay',
|
|
159
|
-
transform: numberAttribute,
|
|
160
|
-
}]));
|
|
230
|
+
this.showDelay = input(this.config.showDelay, { ...(ngDevMode ? { debugName: "showDelay" } : /* istanbul ignore next */ {}), alias: 'ngpPopoverTriggerShowDelay',
|
|
231
|
+
transform: numberAttribute });
|
|
161
232
|
/**
|
|
162
233
|
* Define the delay before the popover is hidden.
|
|
163
234
|
* @default 0
|
|
164
235
|
*/
|
|
165
|
-
this.hideDelay = input(this.config.hideDelay, ...(ngDevMode ?
|
|
166
|
-
|
|
167
|
-
alias: 'ngpPopoverTriggerHideDelay',
|
|
168
|
-
transform: numberAttribute,
|
|
169
|
-
}]));
|
|
236
|
+
this.hideDelay = input(this.config.hideDelay, { ...(ngDevMode ? { debugName: "hideDelay" } : /* istanbul ignore next */ {}), alias: 'ngpPopoverTriggerHideDelay',
|
|
237
|
+
transform: numberAttribute });
|
|
170
238
|
/**
|
|
171
239
|
* Define whether the popover should flip when there is not enough space for the popover.
|
|
172
240
|
* Can be a boolean to enable/disable, or an object with padding and fallbackPlacements options.
|
|
173
241
|
* @default true
|
|
174
242
|
*/
|
|
175
|
-
this.flip = input(this.config.flip, ...(ngDevMode ?
|
|
176
|
-
|
|
177
|
-
alias: 'ngpPopoverTriggerFlip',
|
|
178
|
-
transform: coerceFlip,
|
|
179
|
-
}]));
|
|
243
|
+
this.flip = input(this.config.flip, { ...(ngDevMode ? { debugName: "flip" } : /* istanbul ignore next */ {}), alias: 'ngpPopoverTriggerFlip',
|
|
244
|
+
transform: coerceFlip });
|
|
180
245
|
/**
|
|
181
246
|
* Configure shift behavior to keep the popover in view.
|
|
182
247
|
* Can be a boolean to enable/disable, or an object with padding and limiter options.
|
|
183
248
|
* @default undefined (enabled by default in overlay)
|
|
184
249
|
*/
|
|
185
|
-
this.shift = input(this.config.shift, ...(ngDevMode ?
|
|
186
|
-
|
|
187
|
-
alias: 'ngpPopoverTriggerShift',
|
|
188
|
-
transform: coerceShift,
|
|
189
|
-
}]));
|
|
250
|
+
this.shift = input(this.config.shift, { ...(ngDevMode ? { debugName: "shift" } : /* istanbul ignore next */ {}), alias: 'ngpPopoverTriggerShift',
|
|
251
|
+
transform: coerceShift });
|
|
190
252
|
/**
|
|
191
253
|
* Define the container in which the popover should be attached.
|
|
192
254
|
* @default document.body
|
|
193
255
|
*/
|
|
194
|
-
this.container = input(this.config.container, ...(ngDevMode ?
|
|
195
|
-
alias: 'ngpPopoverTriggerContainer',
|
|
196
|
-
}]));
|
|
256
|
+
this.container = input(this.config.container, { ...(ngDevMode ? { debugName: "container" } : /* istanbul ignore next */ {}), alias: 'ngpPopoverTriggerContainer' });
|
|
197
257
|
/**
|
|
198
258
|
* Define whether the popover should close when clicking outside of it, or a guard function.
|
|
199
259
|
* @default true
|
|
200
260
|
*/
|
|
201
|
-
this.closeOnOutsideClick = input(this.config.closeOnOutsideClick, ...(ngDevMode ?
|
|
202
|
-
|
|
203
|
-
alias: 'ngpPopoverTriggerCloseOnOutsideClick',
|
|
204
|
-
transform: dismissGuardAttribute,
|
|
205
|
-
}]));
|
|
261
|
+
this.closeOnOutsideClick = input(this.config.closeOnOutsideClick, { ...(ngDevMode ? { debugName: "closeOnOutsideClick" } : /* istanbul ignore next */ {}), alias: 'ngpPopoverTriggerCloseOnOutsideClick',
|
|
262
|
+
transform: dismissGuardAttribute });
|
|
206
263
|
/**
|
|
207
264
|
* Define whether the popover should close when the escape key is pressed, or a guard function.
|
|
208
265
|
* @default true
|
|
209
266
|
*/
|
|
210
|
-
this.closeOnEscape = input(this.config.closeOnEscape, ...(ngDevMode ?
|
|
211
|
-
|
|
212
|
-
alias: 'ngpPopoverTriggerCloseOnEscape',
|
|
213
|
-
transform: dismissGuardAttribute,
|
|
214
|
-
}]));
|
|
267
|
+
this.closeOnEscape = input(this.config.closeOnEscape, { ...(ngDevMode ? { debugName: "closeOnEscape" } : /* istanbul ignore next */ {}), alias: 'ngpPopoverTriggerCloseOnEscape',
|
|
268
|
+
transform: dismissGuardAttribute });
|
|
215
269
|
/**
|
|
216
270
|
* Defines how the popover behaves when the window is scrolled.
|
|
217
271
|
* @default 'reposition'
|
|
218
272
|
*/
|
|
219
|
-
this.scrollBehavior = input(this.config.scrollBehavior, ...(ngDevMode ?
|
|
220
|
-
alias: 'ngpPopoverTriggerScrollBehavior',
|
|
221
|
-
}]));
|
|
273
|
+
this.scrollBehavior = input(this.config.scrollBehavior, { ...(ngDevMode ? { debugName: "scrollBehavior" } : /* istanbul ignore next */ {}), alias: 'ngpPopoverTriggerScrollBehavior' });
|
|
222
274
|
/**
|
|
223
275
|
* Provide context to the popover. This can be used to pass data to the popover content.
|
|
224
276
|
*/
|
|
225
|
-
this.context = input(undefined, ...(ngDevMode ?
|
|
226
|
-
alias: 'ngpPopoverTriggerContext',
|
|
227
|
-
}]));
|
|
277
|
+
this.context = input(undefined, { ...(ngDevMode ? { debugName: "context" } : /* istanbul ignore next */ {}), alias: 'ngpPopoverTriggerContext' });
|
|
228
278
|
/**
|
|
229
279
|
* Define an anchor element for positioning the popover.
|
|
230
280
|
* If provided, the popover will be positioned relative to this element instead of the trigger.
|
|
231
281
|
*/
|
|
232
|
-
this.anchor = input(null, ...(ngDevMode ?
|
|
233
|
-
alias: 'ngpPopoverTriggerAnchor',
|
|
234
|
-
}]));
|
|
282
|
+
this.anchor = input(null, { ...(ngDevMode ? { debugName: "anchor" } : /* istanbul ignore next */ {}), alias: 'ngpPopoverTriggerAnchor' });
|
|
235
283
|
/**
|
|
236
284
|
* Define whether to track the trigger element position on every animation frame.
|
|
237
285
|
* Useful for moving elements like slider thumbs.
|
|
238
286
|
* @default false
|
|
239
287
|
*/
|
|
240
|
-
this.trackPosition = input(this.config.trackPosition, ...(ngDevMode ?
|
|
241
|
-
|
|
242
|
-
alias: 'ngpPopoverTriggerTrackPosition',
|
|
243
|
-
transform: booleanAttribute,
|
|
244
|
-
}]));
|
|
288
|
+
this.trackPosition = input(this.config.trackPosition, { ...(ngDevMode ? { debugName: "trackPosition" } : /* istanbul ignore next */ {}), alias: 'ngpPopoverTriggerTrackPosition',
|
|
289
|
+
transform: booleanAttribute });
|
|
245
290
|
/**
|
|
246
291
|
* Define the cooldown duration in milliseconds.
|
|
247
292
|
* When moving from one popover to another within this duration,
|
|
248
293
|
* the showDelay is skipped for the new popover.
|
|
249
294
|
* @default 0
|
|
250
295
|
*/
|
|
251
|
-
this.cooldown = input(this.config.cooldown, ...(ngDevMode ?
|
|
252
|
-
|
|
253
|
-
alias: 'ngpPopoverTriggerCooldown',
|
|
254
|
-
transform: numberAttribute,
|
|
255
|
-
}]));
|
|
256
|
-
/**
|
|
257
|
-
* The overlay that manages the popover
|
|
258
|
-
* @internal
|
|
259
|
-
*/
|
|
260
|
-
this.overlay = signal(null, ...(ngDevMode ? [{ debugName: "overlay" }] : []));
|
|
261
|
-
/**
|
|
262
|
-
* The open state of the popover.
|
|
263
|
-
* @internal
|
|
264
|
-
*/
|
|
265
|
-
this.open = computed(() => this.overlay()?.isOpen() ?? false, ...(ngDevMode ? [{ debugName: "open" }] : []));
|
|
296
|
+
this.cooldown = input(this.config.cooldown, { ...(ngDevMode ? { debugName: "cooldown" } : /* istanbul ignore next */ {}), alias: 'ngpPopoverTriggerCooldown',
|
|
297
|
+
transform: numberAttribute });
|
|
266
298
|
/**
|
|
267
299
|
* Event emitted when the popover open state changes.
|
|
268
300
|
*/
|
|
@@ -272,154 +304,108 @@ class NgpPopoverTrigger {
|
|
|
272
304
|
/**
|
|
273
305
|
* The popover trigger state.
|
|
274
306
|
*/
|
|
275
|
-
this.state =
|
|
307
|
+
this.state = ngpPopoverTrigger({
|
|
308
|
+
popover: this.popover,
|
|
309
|
+
disabled: this.disabled,
|
|
310
|
+
placement: this.placement,
|
|
311
|
+
offset: this.offset,
|
|
312
|
+
showDelay: this.showDelay,
|
|
313
|
+
hideDelay: this.hideDelay,
|
|
314
|
+
flip: this.flip,
|
|
315
|
+
shift: this.shift,
|
|
316
|
+
container: this.container,
|
|
317
|
+
closeOnOutsideClick: this.closeOnOutsideClick,
|
|
318
|
+
closeOnEscape: this.closeOnEscape,
|
|
319
|
+
scrollBehavior: this.scrollBehavior,
|
|
320
|
+
context: this.context,
|
|
321
|
+
anchor: this.anchor,
|
|
322
|
+
trackPosition: this.trackPosition,
|
|
323
|
+
cooldown: this.cooldown,
|
|
324
|
+
onOpenChange: (value) => this.openChange.emit(value),
|
|
325
|
+
});
|
|
276
326
|
}
|
|
277
327
|
ngOnDestroy() {
|
|
278
|
-
this.
|
|
279
|
-
}
|
|
280
|
-
toggle(event) {
|
|
281
|
-
// if the trigger is disabled then do not toggle the popover
|
|
282
|
-
if (this.state.disabled()) {
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
// determine the origin of the event, 0 is keyboard, 1 is mouse
|
|
286
|
-
const origin = event.detail === 0 ? 'keyboard' : 'mouse';
|
|
287
|
-
// if the popover is open then hide it
|
|
288
|
-
if (this.open()) {
|
|
289
|
-
this.hide(origin);
|
|
290
|
-
}
|
|
291
|
-
else {
|
|
292
|
-
this.show();
|
|
293
|
-
}
|
|
328
|
+
this.state.destroy();
|
|
294
329
|
}
|
|
295
330
|
/**
|
|
296
331
|
* Show the popover.
|
|
297
332
|
* @returns A promise that resolves when the popover has been shown
|
|
298
333
|
*/
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
if (this.state.disabled()) {
|
|
302
|
-
return;
|
|
303
|
-
}
|
|
304
|
-
// Create the overlay if it doesn't exist yet
|
|
305
|
-
if (!this.overlay()) {
|
|
306
|
-
this.createOverlay();
|
|
307
|
-
}
|
|
308
|
-
// Show the overlay
|
|
309
|
-
await this.overlay()?.show();
|
|
310
|
-
if (this.open()) {
|
|
311
|
-
this.openChange.emit(true);
|
|
312
|
-
}
|
|
334
|
+
show() {
|
|
335
|
+
return this.state.show();
|
|
313
336
|
}
|
|
314
337
|
/**
|
|
315
338
|
* @internal
|
|
316
339
|
* Hide the popover.
|
|
317
340
|
* @returns A promise that resolves when the popover has been hidden
|
|
318
341
|
*/
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
if (this.state.disabled() || !this.open()) {
|
|
322
|
-
return;
|
|
323
|
-
}
|
|
324
|
-
// Hide the overlay
|
|
325
|
-
await this.overlay()?.hide({ origin });
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* Create the overlay that will contain the popover
|
|
329
|
-
*/
|
|
330
|
-
createOverlay() {
|
|
331
|
-
const popover = this.state.popover();
|
|
332
|
-
if (!popover) {
|
|
333
|
-
throw new Error('Popover must be either a TemplateRef or a ComponentType');
|
|
334
|
-
}
|
|
335
|
-
// Create config for the overlay
|
|
336
|
-
const config = {
|
|
337
|
-
content: popover,
|
|
338
|
-
triggerElement: this.trigger.nativeElement,
|
|
339
|
-
anchorElement: this.state.anchor(),
|
|
340
|
-
injector: this.injector,
|
|
341
|
-
context: this.state.context,
|
|
342
|
-
container: this.state.container(),
|
|
343
|
-
placement: this.state.placement,
|
|
344
|
-
offset: this.state.offset(),
|
|
345
|
-
flip: this.state.flip(),
|
|
346
|
-
shift: this.state.shift(),
|
|
347
|
-
showDelay: this.state.showDelay(),
|
|
348
|
-
hideDelay: this.state.hideDelay(),
|
|
349
|
-
closeOnOutsideClick: this.state.closeOnOutsideClick(),
|
|
350
|
-
closeOnEscape: this.state.closeOnEscape(),
|
|
351
|
-
restoreFocus: true,
|
|
352
|
-
scrollBehaviour: this.state.scrollBehavior(),
|
|
353
|
-
viewContainerRef: this.viewContainerRef,
|
|
354
|
-
trackPosition: this.state.trackPosition(),
|
|
355
|
-
overlayType: 'popover',
|
|
356
|
-
cooldown: this.state.cooldown(),
|
|
357
|
-
onClose: () => this.openChange.emit(false),
|
|
358
|
-
};
|
|
359
|
-
this.overlay.set(createOverlay(config));
|
|
342
|
+
hide(origin = 'program') {
|
|
343
|
+
return this.state.hide(origin);
|
|
360
344
|
}
|
|
361
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
362
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
345
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgpPopoverTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
346
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.14", type: NgpPopoverTrigger, isStandalone: true, selector: "[ngpPopoverTrigger]", inputs: { popover: { classPropertyName: "popover", publicName: "ngpPopoverTrigger", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "ngpPopoverTriggerDisabled", isSignal: true, isRequired: false, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "ngpPopoverTriggerPlacement", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "ngpPopoverTriggerOffset", isSignal: true, isRequired: false, transformFunction: null }, showDelay: { classPropertyName: "showDelay", publicName: "ngpPopoverTriggerShowDelay", isSignal: true, isRequired: false, transformFunction: null }, hideDelay: { classPropertyName: "hideDelay", publicName: "ngpPopoverTriggerHideDelay", isSignal: true, isRequired: false, transformFunction: null }, flip: { classPropertyName: "flip", publicName: "ngpPopoverTriggerFlip", isSignal: true, isRequired: false, transformFunction: null }, shift: { classPropertyName: "shift", publicName: "ngpPopoverTriggerShift", isSignal: true, isRequired: false, transformFunction: null }, container: { classPropertyName: "container", publicName: "ngpPopoverTriggerContainer", isSignal: true, isRequired: false, transformFunction: null }, closeOnOutsideClick: { classPropertyName: "closeOnOutsideClick", publicName: "ngpPopoverTriggerCloseOnOutsideClick", isSignal: true, isRequired: false, transformFunction: null }, closeOnEscape: { classPropertyName: "closeOnEscape", publicName: "ngpPopoverTriggerCloseOnEscape", isSignal: true, isRequired: false, transformFunction: null }, scrollBehavior: { classPropertyName: "scrollBehavior", publicName: "ngpPopoverTriggerScrollBehavior", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "ngpPopoverTriggerContext", isSignal: true, isRequired: false, transformFunction: null }, anchor: { classPropertyName: "anchor", publicName: "ngpPopoverTriggerAnchor", isSignal: true, isRequired: false, transformFunction: null }, trackPosition: { classPropertyName: "trackPosition", publicName: "ngpPopoverTriggerTrackPosition", isSignal: true, isRequired: false, transformFunction: null }, cooldown: { classPropertyName: "cooldown", publicName: "ngpPopoverTriggerCooldown", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { openChange: "ngpPopoverTriggerOpenChange" }, providers: [providePopoverTriggerState({ inherit: false })], exportAs: ["ngpPopoverTrigger"], ngImport: i0 }); }
|
|
363
347
|
}
|
|
364
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
348
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgpPopoverTrigger, decorators: [{
|
|
365
349
|
type: Directive,
|
|
366
350
|
args: [{
|
|
367
351
|
selector: '[ngpPopoverTrigger]',
|
|
368
352
|
exportAs: 'ngpPopoverTrigger',
|
|
369
353
|
providers: [providePopoverTriggerState({ inherit: false })],
|
|
370
|
-
host: {
|
|
371
|
-
'[attr.aria-expanded]': 'open() ? "true" : "false"',
|
|
372
|
-
'[attr.data-open]': 'open() ? "" : null',
|
|
373
|
-
'[attr.data-placement]': 'state.placement()',
|
|
374
|
-
'[attr.data-disabled]': 'state.disabled() ? "" : null',
|
|
375
|
-
'[attr.aria-describedby]': 'overlay()?.ariaDescribedBy()',
|
|
376
|
-
'(click)': 'toggle($event)',
|
|
377
|
-
},
|
|
378
354
|
}]
|
|
379
355
|
}], propDecorators: { popover: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpPopoverTrigger", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpPopoverTriggerDisabled", required: false }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpPopoverTriggerPlacement", required: false }] }], offset: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpPopoverTriggerOffset", required: false }] }], showDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpPopoverTriggerShowDelay", required: false }] }], hideDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpPopoverTriggerHideDelay", required: false }] }], flip: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpPopoverTriggerFlip", required: false }] }], shift: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpPopoverTriggerShift", required: false }] }], container: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpPopoverTriggerContainer", required: false }] }], closeOnOutsideClick: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpPopoverTriggerCloseOnOutsideClick", required: false }] }], closeOnEscape: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpPopoverTriggerCloseOnEscape", required: false }] }], scrollBehavior: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpPopoverTriggerScrollBehavior", required: false }] }], context: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpPopoverTriggerContext", required: false }] }], anchor: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpPopoverTriggerAnchor", required: false }] }], trackPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpPopoverTriggerTrackPosition", required: false }] }], cooldown: [{ type: i0.Input, args: [{ isSignal: true, alias: "ngpPopoverTriggerCooldown", required: false }] }], openChange: [{ type: i0.Output, args: ["ngpPopoverTriggerOpenChange"] }] } });
|
|
380
356
|
|
|
357
|
+
const [NgpPopoverStateToken, ngpPopover, injectPopoverState, providePopoverState] = createPrimitive('NgpPopover', ({ id: _id = signal('') }) => {
|
|
358
|
+
const elementRef = injectElementRef();
|
|
359
|
+
const overlay = injectOverlay();
|
|
360
|
+
const id = controlled(_id);
|
|
361
|
+
id.set(overlay.id());
|
|
362
|
+
// Host binding
|
|
363
|
+
attrBinding(elementRef, 'role', 'dialog');
|
|
364
|
+
attrBinding(elementRef, 'id', id);
|
|
365
|
+
styleBinding(elementRef, 'left.px', () => overlay.position().x ?? null);
|
|
366
|
+
styleBinding(elementRef, 'top.px', () => overlay.position().y ?? null);
|
|
367
|
+
styleBinding(elementRef, '--ngp-popover-trigger-width.px', () => overlay.triggerWidth());
|
|
368
|
+
styleBinding(elementRef, '--ngp-popover-transform-origin', () => overlay.transformOrigin());
|
|
369
|
+
styleBinding(elementRef, '--ngp-popover-available-width.px', () => overlay.availableWidth());
|
|
370
|
+
styleBinding(elementRef, '--ngp-popover-available-height.px', () => overlay.availableHeight());
|
|
371
|
+
dataBinding(elementRef, 'data-placement', () => overlay.finalPlacement() ?? null);
|
|
372
|
+
dataBinding(elementRef, 'data-overlay', '');
|
|
373
|
+
// Effect handle
|
|
374
|
+
explicitEffect([id], ([id]) => overlay.id.set(id));
|
|
375
|
+
return {
|
|
376
|
+
id,
|
|
377
|
+
};
|
|
378
|
+
});
|
|
379
|
+
|
|
381
380
|
/**
|
|
382
381
|
* Apply the `ngpPopover` directive to an element that represents the popover. This typically would be a `div` inside an `ng-template`.
|
|
383
382
|
*/
|
|
384
383
|
class NgpPopover {
|
|
385
384
|
constructor() {
|
|
386
|
-
/**
|
|
387
|
-
* Access the overlay.
|
|
388
|
-
*/
|
|
389
|
-
this.overlay = injectOverlay();
|
|
390
385
|
/**
|
|
391
386
|
* The unique id of the tooltip.
|
|
392
387
|
*/
|
|
393
|
-
this.id = input(
|
|
394
|
-
|
|
388
|
+
this.id = input('', ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
389
|
+
this.state = ngpPopover({
|
|
390
|
+
id: this.id,
|
|
391
|
+
});
|
|
395
392
|
}
|
|
396
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
397
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
393
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgpPopover, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
394
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.14", type: NgpPopover, isStandalone: true, selector: "[ngpPopover]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, providers: [providePopoverState(), provideControlContainerIsolation()], exportAs: ["ngpPopover"], hostDirectives: [{ directive: i1.NgpFocusTrap }], ngImport: i0 }); }
|
|
398
395
|
}
|
|
399
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
396
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: NgpPopover, decorators: [{
|
|
400
397
|
type: Directive,
|
|
401
398
|
args: [{
|
|
402
399
|
selector: '[ngpPopover]',
|
|
403
400
|
exportAs: 'ngpPopover',
|
|
404
401
|
hostDirectives: [NgpFocusTrap],
|
|
405
|
-
|
|
406
|
-
role: 'dialog',
|
|
407
|
-
'[id]': 'id()',
|
|
408
|
-
'[style.left.px]': 'overlay.position().x',
|
|
409
|
-
'[style.top.px]': 'overlay.position().y',
|
|
410
|
-
'[style.--ngp-popover-trigger-width.px]': 'overlay.triggerWidth()',
|
|
411
|
-
'[style.--ngp-popover-transform-origin]': 'overlay.transformOrigin()',
|
|
412
|
-
'[style.--ngp-popover-available-width.px]': 'overlay.availableWidth()',
|
|
413
|
-
'[style.--ngp-popover-available-height.px]': 'overlay.availableHeight()',
|
|
414
|
-
'[attr.data-placement]': 'overlay.finalPlacement()',
|
|
415
|
-
'data-overlay': '',
|
|
416
|
-
},
|
|
402
|
+
providers: [providePopoverState(), provideControlContainerIsolation()],
|
|
417
403
|
}]
|
|
418
|
-
}],
|
|
404
|
+
}], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }] } });
|
|
419
405
|
|
|
420
406
|
/**
|
|
421
407
|
* Generated bundle index. Do not edit.
|
|
422
408
|
*/
|
|
423
409
|
|
|
424
|
-
export { NgpPopover, NgpPopoverArrow, NgpPopoverArrowStateToken, NgpPopoverTrigger, injectPopoverArrowState, injectPopoverTriggerState, ngpPopoverArrow, providePopoverArrowState, providePopoverConfig, providePopoverTriggerState };
|
|
410
|
+
export { NgpPopover, NgpPopoverArrow, NgpPopoverArrowStateToken, NgpPopoverStateToken, NgpPopoverTrigger, NgpPopoverTriggerStateToken, injectPopoverArrowState, injectPopoverState, injectPopoverTriggerState, ngpPopover, ngpPopoverArrow, ngpPopoverTrigger, providePopoverArrowState, providePopoverConfig, providePopoverState, providePopoverTriggerState };
|
|
425
411
|
//# sourceMappingURL=ng-primitives-popover.mjs.map
|